')).appendChild(a),e.type&&Us(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Qe.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,o=!0;n&&((Je(i)&&i>t.scale||Je(r)&&r
i&&(r=(1/t.scale||1)*i)),Je(r)&&(s="scale("+r+","+r+")"),Ze(o,s)},Qe.prototype._updateOverlaysVisibilty=function(e){var t=this;Zt(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Qe.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",function(e){t.hide()}),e.on("canvas.viewbox.changed",function(e){!function(e){t._updateRoot(e),t._updateOverlaysVisibilty(e),t.show()}(e.viewbox)}),e.on(["shape.remove","connection.remove"],function(e){var n=e.element,i=t.get({element:n});Zt(i,function(e){t.remove(e.id)});var r=t._getOverlayContainer(n);if(r){Ys(r.html);var a=t._overlayContainers.indexOf(r);-1!==a&&t._overlayContainers.splice(a,1)}}),e.on("element.changed",500,function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(Zt(i.overlays,function(e){t._updateOverlay(e)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(e){var n=t._getOverlayContainer(e.element,!0);n&&Us(n.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var Js={__init__:["overlays"],overlays:["type",Zs]},Qs={};Qs.getOriginal=et;var el={};el.isMac=function(){return/mac/i.test(navigator.platform)};var tl={},nl=Qs.getOriginal,il=el.isMac;tl.isPrimaryButton=tt,tl.hasPrimaryModifier=function(e){var t=nl(e)||e;return!!tt(e)&&(il()?t.metaKey:t.ctrlKey)};var rl=tl.isPrimaryButton,al=un.createLine,ol=un.updateLine,sl=500;nt.$inject=["eventBus","elementRegistry","styles"];var ll={__init__:["interactionEvents"],interactionEvents:["type",nt]},pl=fo.getBBox,cl=500;it.prototype.updateShapeOutline=function(e,t){rn(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},it.prototype.updateConnectionOutline=function(e,t){var n=pl(t);rn(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},it.$inject=["eventBus","styles","elementRegistry"];var ul={__init__:["outline"],outline:["type",it]};rt.$inject=["eventBus"];var fl=rt;rt.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},rt.prototype.get=function(){return this._selectedElements},rt.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},rt.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();Wt(e)||(e=e?[e]:[]),t?Zt(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var hl=tl.hasPrimaryModifier;at.$inject=["eventBus","selection","canvas","elementRegistry"];var ml=at,dl="hover",yl="selected";ot.$inject=["eventBus","canvas","selection","styles"];var gl={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ll,ul],selection:["type",fl],selectionVisuals:["type",ot],selectionBehavior:["type",ml]},vl=function(e,t,n){for(var i=e.length,r=t+(n?0:-1);n?r--:++r=_l?Al(t):null,l=t.length;s&&(a=wl,o=!1,t=s);e:for(;++r]{1})/g,Pl=/([\n\r"]{1})/g,Ol={"&":"&","<":"<",">":">",'"':"'"},Nl=pt,Dl={width:"100%",height:"100%",position:"relative"};Wi(ut,zs);var Bl=ut;ut.prototype.importXML=function(e,t){t=t||function(){};var n=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,i,r){i=n._emit("import.parse.complete",{error:e,definitions:i,context:r})||i;var a=r.warnings;if(e)return e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),n._emit("import.done",{error:e,warnings:a}),t(e,a);n.importDefinitions(i,function(e,i){var r=[].concat(a,i||[]);n._emit("import.done",{error:e,warnings:r}),t(e,r)})})},ut.prototype.saveXML=function(e,t){t||(t=e,e={});var n=this._definitions;if(!n)return t(new Error("no definitions loaded"));this._moddle.toXML(n,e,t)},ut.prototype.saveSVG=function(e,t){t||(t=e,e={});var n=this.get("canvas"),i=n.getDefaultLayer(),r=Yi("defs",n._svg),a=Nl(i),o=r?""+Nl(r)+"":"",s=i.getBBox();t(null,'\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n\n")},ut.prototype.importDefinitions=function(e,t){try{this._definitions&&this.clear(),this._definitions=e,zr.importBpmnDiagram(this,e,t)}catch(e){t(e)}},ut.prototype.getModules=function(){return this._modules},ut.prototype.destroy=function(){zs.prototype.destroy.call(this),Ys(this._container)},ut.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ut.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ut.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=Yi(e)),e.appendChild(this._container),this._emit("attach",{})},ut.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ut.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],a=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),o=di(Rl(n,"additionalModules"),{canvas:di({},n.canvas,{container:e}),modules:a});zs.call(this,o),n&&n.container&&this.attachTo(n.container)},ut.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ut.prototype._createContainer=function(e){var t=ia('');return di(t.style,{width:ct(e.width),height:ct(e.height),position:e.position}),t},ut.prototype._createModdle=function(e){var t=di({},this._moddleExtensions,e.moddleExtensions);return new ao(t)},ut.prototype._modules=[Tr,kr,gl,Js],ut.prototype._moddleExtensions={};return Bl});