diff --git a/resources/job-streamer-console/public/js/jsr-352.min.js b/resources/job-streamer-console/public/js/jsr-352.min.js index c99a8da..5d5ef9e 100644 --- a/resources/job-streamer-console/public/js/jsr-352.min.js +++ b/resources/job-streamer-console/public/js/jsr-352.min.js @@ -1,32 +1,33 @@ -!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o'),this._bindListeners(this._container),config&&config.parent&&this.attachTo(config.parent)},PropertiesPanel.prototype.attachTo=function(parentNode){if(!parentNode)throw new Error("parentNode required");this.detach(),parentNode.get&&(parentNode=parentNode.get(0)),"string"==typeof parentNode&&(parentNode=domQuery(parentNode));var container=this._container;parentNode.appendChild(container),this._emit("attach")},PropertiesPanel.prototype.detach=function(){var container=this._container,parentNode=container.parentNode;parentNode&&(this._emit("detach"),parentNode.removeChild(container))},PropertiesPanel.prototype.activateTab=function(tab){var tabId="string"==typeof tab?tab:tab.id,current=this._current,panelNode=current.panel,allTabNodes=domQuery.all(".bpp-properties-tab",panelNode),allTabLinkNodes=domQuery.all(".bpp-properties-tab-link",panelNode);forEach(allTabNodes,function(tabNode){var currentTabId=domAttr(tabNode,"data-tab");domClasses(tabNode).toggle("bpp-active",tabId===currentTabId)}),forEach(allTabLinkNodes,function(tabLinkNode){var tabLink=domQuery("[data-tab-target]",tabLinkNode),currentTabId=domAttr(tabLink,"data-tab-target");domClasses(tabLinkNode).toggle("bpp-active",tabId===currentTabId)})},PropertiesPanel.prototype.update=function(element){var current=this._current,needsCreate=!0;"undefined"==typeof element&&(element=this._canvas.getRootElement());var newTabs=this._propertiesProvider.getTabs(element);if(current&¤t.element===element&&(needsCreate=this._entriesChanged(current,newTabs)),needsCreate){if(current){var activeTabId,activeTabNode=domQuery(".bpp-properties-tab.bpp-active",current.panel);activeTabNode&&(activeTabId=domAttr(activeTabNode,"data-tab")),domRemove(current.panel)}this._current=this._create(element,newTabs),activeTabId?this.activateTab(activeTabId):this.activateTab(this._current.tabs[0])}this._current&&this._updateActivation(this._current),this._emit("changed")},PropertiesPanel.prototype._entriesChanged=function(current,newTabs){var oldEntryIds=keys(current.entries),newEntryIds=keys(extractEntries(newTabs));return!isEmpty(xor(oldEntryIds,newEntryIds))},PropertiesPanel.prototype._emit=function(event){this._eventBus.fire("propertiesPanel."+event,{panel:this,current:this._current})},PropertiesPanel.prototype._bindListeners=function(container){function handleInput(event,element){var inputNode=event.delegateTarget,entryNode=domClosest(inputNode,"[data-entry]");if(entryNode){var eventHandlerId=domAttr(inputNode,"data-blur"),entryId=domAttr(entryNode,"data-entry"),entry=self.getEntry(entryId),isEntryDirty=self.executeAction(entry,entryNode,eventHandlerId,event);if(isEntryDirty){var values=getFormControlValues(entryNode);self.applyChanges(entry,values,entryNode)}self.updateState(entry,entryNode)}}var self=this,handleChange=function(event){var entryId,entry,node=domClosest(event.delegateTarget,"[data-entry]");if(node){entryId=domAttr(node,"data-entry"),entry=self.getEntry(entryId);var values=getFormControlValues(node);if("change"===event.type){var onChangeAction=event.delegateTarget.getAttribute("data-on-change");if(onChangeAction){var isEntryDirty=self.executeAction(entry,node,onChangeAction,event);if(!isEntryDirty)return self.update(self._current.element)}}self.applyChanges(entry,values,node),self.updateState(entry,node)}};domDelegate.bind(container,"input, textarea, [contenteditable]","input",debounce(handleChange,DEBOUNCE_DELAY)),domDelegate.bind(container,"input, textarea, select, [contenteditable]","change",handleChange),domDelegate.bind(container,"[data-action]","click",function(event){var inputNode=event.delegateTarget,entryNode=domClosest(inputNode,"[data-entry]"),actionId=domAttr(inputNode,"data-action"),entryId=domAttr(entryNode,"data-entry"),entry=self.getEntry(entryId),isEntryDirty=self.executeAction(entry,entryNode,actionId,event);if(isEntryDirty){var values=getFormControlValues(entryNode);self.applyChanges(entry,values,entryNode)}self.updateState(entry,entryNode)}),domDelegate.bind(container,"[data-blur]","blur",handleInput,!0),domDelegate.bind(container,".bpp-properties-tabs-links [data-tab-target]","click",function(event){event.preventDefault();var delegateTarget=event.delegateTarget,tabId=domAttr(delegateTarget,"data-tab-target");self.activateTab(tabId)})},PropertiesPanel.prototype.updateState=function(entry,entryNode){this.updateShow(entry,entryNode),this.updateDisable(entry,entryNode)},PropertiesPanel.prototype.updateShow=function(entry,node){var current=this._current;if(current){var showNodes=domQuery.all("[data-show]",node)||[];forEach(showNodes,function(showNode){var expr=domAttr(showNode,"data-show"),fn=get(entry,expr);if(fn){var scope=domClosest(showNode,"[data-scope]")||node,shouldShow=fn(current.element,node,showNode,scope)||!1,hasClass=domClasses(showNode).has(HIDE_CLASS);shouldShow?hasClass&&domClasses(showNode).remove(HIDE_CLASS):domClasses(showNode).add(HIDE_CLASS)}})}},PropertiesPanel.prototype.updateDisable=function(entry,node){var current=this._current;if(current){var nodes=domQuery.all("[data-disable]",node)||[];forEach(nodes,function(currentNode){var expr=domAttr(currentNode,"data-disable"),fn=get(entry,expr);if(fn){var scope=domClosest(currentNode,"[data-scope]")||node,shouldDisable=fn(current.element,node,currentNode,scope)||!1;domAttr(currentNode,"disabled",shouldDisable?"":null)}})}},PropertiesPanel.prototype.executeAction=function(entry,entryNode,actionId,event){var current=this._current;if(current){var fn=get(entry,actionId);if(fn){var scopeNode=domClosest(event.target,"[data-scope]")||entryNode;return fn.apply(entry,[current.element,entryNode,event,scopeNode])}}},PropertiesPanel.prototype.applyChanges=function(entry,values,containerElement){var element=this._current.element;if(!valuesEqual(values,entry.oldValues)){var commandToExecute,command=entry.set(element,values,containerElement);isArray(command)?command.length&&(commandToExecute={cmd:"properties-panel.multi-command-executor",context:flattenDeep(command)}):commandToExecute=command,commandToExecute?this._commandStack.execute(commandToExecute.cmd,commandToExecute.context||{element:element}):this.update(element)}},PropertiesPanel.prototype.applyValidationErrors=function(validationErrors,entryNode){var valid=!0,controlNodes=getFormControls(entryNode,!0);return forEach(controlNodes,function(controlNode){var name=domAttr(controlNode,"name")||domAttr(controlNode,"data-name"),error=validationErrors&&validationErrors[name],errorMessageNode=domQuery(".bpp-error-message",controlNode.parentNode);error?(valid=!1,errorMessageNode||(errorMessageNode=domify("
"),domClasses(errorMessageNode).add("bpp-error-message"),controlNode.parentNode.insertBefore(errorMessageNode,controlNode.nextSibling)),errorMessageNode.innerHTML=error,domClasses(controlNode).add("invalid")):(domClasses(controlNode).remove("invalid"),errorMessageNode&&controlNode.parentNode.removeChild(errorMessageNode))}),valid},PropertiesPanel.prototype.validate=function(entry,values,entryNode){var self=this,current=this._current,valid=!0;if(entryNode=entryNode||domQuery('[data-entry="'+entry.id+'"]',current.panel),values instanceof Array)for(var listContainer=domQuery("[data-list-entry-container]",entryNode),listEntryNodes=listContainer.children||[],i=0;i'),headerNode=domify('
'),tabBarNode=domify('
'),tabLinksNode=domify(''),tabContainerNode=domify('
');return panelNode.appendChild(headerNode),forEach(tabs,function(tab,tabIndex){if(!tab.id)throw new Error("tab must have an id");var tabNode=domify('
'),tabLinkNode=domify('"),groups=tab.groups;forEach(groups,function(group){if(!group.id)throw new Error("group must have an id");var groupNode=domify('
'+group.label+"
");groupNode.querySelector(".group-toggle").addEventListener("click",function(evt){domClasses(groupNode).toggle("group-closed"),evt.preventDefault(),evt.stopPropagation()}),groupNode.addEventListener("click",function(evt){!evt.defaultPrevented&&domClasses(groupNode).has("group-closed")&&domClasses(groupNode).remove("group-closed")}),forEach(group.entries,function(entry){if(!entry.id)throw new Error("entry must have an id");var html=entry.html;"string"==typeof html&&(html=domify(html)),html.get&&(html=html.get(0));var entryNode=domify('
');forEach(entry.cssClasses||[],function(cssClass){domClasses(entryNode).add(cssClass)}),entryNode.appendChild(html),groupNode.appendChild(entryNode),self.updateState(entry,entryNode)}),tabNode.appendChild(groupNode)}),tabLinksNode.appendChild(tabLinkNode),tabContainerNode.appendChild(tabNode)}),tabBarNode.appendChild(tabLinksNode),panelNode.appendChild(tabBarNode),panelNode.appendChild(tabContainerNode),panelNode}},{"bpmn-js/lib/util/ModelUtil":153,"lodash/array/flattenDeep":350,"lodash/array/xor":356,"lodash/collection/filter":360,"lodash/collection/forEach":362,"lodash/collection/indexBy":365,"lodash/collection/map":366,"lodash/function/debounce":374,"lodash/lang/isArray":485,"lodash/lang/isEmpty":486,"lodash/object/get":497,"lodash/object/keys":499,"min-dom/lib/attr":510,"min-dom/lib/classes":511,"min-dom/lib/closest":513,"min-dom/lib/delegate":514,"min-dom/lib/domify":515,"min-dom/lib/matches":517,"min-dom/lib/query":518,"min-dom/lib/remove":519,"scroll-tabs":536,"selection-update":537}],24:[function(require,module,exports){"use strict";function selectedOption(selectBox){if(selectBox.selectedIndex>=0)return selectBox.options[selectBox.selectedIndex].value}function selectedType(elementSyntax,inputNode){var typeSelect=domQuery(elementSyntax,inputNode);return selectedOption(typeSelect)}function getRoot(businessObject){for(var parent=businessObject;parent.$parent;)parent=parent.$parent;return parent}function filterElementsByType(objectList,type){var list=objectList||[],result=[];return forEach(list,function(obj){is(obj,type)&&result.push(obj)}),result}function findRootElementsByType(businessObject,referencedType){var root=getRoot(businessObject);return filterElementsByType(root.rootElements,referencedType)}function removeAllChildren(domElement){for(;domElement.firstChild;)domElement.removeChild(domElement.firstChild)}function addEmptyParameter(list){return list.push({label:"",value:"",name:""})}function refreshOptionsModel(businessObject,referencedType){var model=[],referableObjects=findRootElementsByType(businessObject,referencedType);return forEach(referableObjects,function(obj){model.push({label:(obj.name||"")+" (id="+obj.id+")",value:obj.id,name:obj.name})}),model}function updateOptionsDropDown(domSelector,businessObject,referencedType,entryNode){var options=refreshOptionsModel(businessObject,referencedType);addEmptyParameter(options);var selectBox=domQuery(domSelector,entryNode);return domClear(selectBox),forEach(options,function(option){var optionEntry=domify('");selectBox.appendChild(optionEntry)}),options}function isIdValid(bo,idValue){var assigned=bo.$model.ids.assigned(idValue),idExists=assigned&&assigned!==bo;return!idValue||idExists?"Element must have an unique id.":validateId(idValue)}function validateId(idValue){return idValue=stripPlaceholders(idValue),containsSpace(idValue)?"Id must not contain spaces.":ID_REGEX.test(idValue)?void 0:QNAME_REGEX.test(idValue)?"Id must not contain prefix.":"Id must be a valid QName."; -}function containsSpace(value){return SPACE_REGEX.test(value)}function stripPlaceholders(idValue){return idValue.replace(PLACEHOLDER_REGEX,"$1")}function nextId(prefix){var ids=new Ids([32,32,1]);return ids.nextPrefixed(prefix)}function triggerClickEvent(element){var evt,eventType="click";if(document.createEvent){try{evt=new MouseEvent(eventType,{view:window,bubbles:!0,cancelable:!0})}catch(e){evt=document.createEvent("MouseEvent"),evt.initEvent(eventType,!0,!0)}return element.dispatchEvent(evt)}return evt=document.createEventObject(),element.fireEvent("on"+eventType,evt)}var domQuery=require("min-dom/lib/query"),domClear=require("min-dom/lib/clear"),is=require("bpmn-js/lib/util/ModelUtil").is,forEach=require("lodash/collection/forEach"),domify=require("min-dom/lib/domify"),Ids=require("ids"),SPACE_REGEX=/\s/,QNAME_REGEX=/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i,ID_REGEX=/^[a-z_][\w-.]*$/i,PLACEHOLDER_REGEX=/\$\{([^\}]*)\}/g;module.exports.selectedOption=selectedOption,module.exports.selectedType=selectedType,module.exports.getRoot=getRoot,module.exports.filterElementsByType=filterElementsByType,module.exports.findRootElementsByType=findRootElementsByType,module.exports.removeAllChildren=removeAllChildren,module.exports.addEmptyParameter=addEmptyParameter,module.exports.refreshOptionsModel=refreshOptionsModel,module.exports.updateOptionsDropDown=updateOptionsDropDown,module.exports.isIdValid=isIdValid,module.exports.validateId=validateId,module.exports.containsSpace=containsSpace,module.exports.nextId=nextId,module.exports.triggerClickEvent=triggerClickEvent},{"bpmn-js/lib/util/ModelUtil":153,ids:346,"lodash/collection/forEach":362,"min-dom/lib/clear":512,"min-dom/lib/domify":515,"min-dom/lib/query":518}],25:[function(require,module,exports){"use strict";function CreateAndReferenceElementHandler(elementRegistry,bpmnFactory){this._elementRegistry=elementRegistry,this._bpmnFactory=bpmnFactory}function ensureNotNull(prop,name){if(!prop)throw new Error(name+" required");return prop}var elementHelper=require("../helper/ElementHelper");CreateAndReferenceElementHandler.$inject=["elementRegistry","bpmnFactory"],module.exports=CreateAndReferenceElementHandler,CreateAndReferenceElementHandler.prototype.execute=function(context){var referencingObject=ensureNotNull(context.referencingObject,"referencingObject"),referenceProperty=ensureNotNull(context.referenceProperty,"referenceProperty"),newObject=ensureNotNull(context.newObject,"newObject"),newObjectContainer=ensureNotNull(context.newObjectContainer,"newObjectContainer"),newObjectParent=ensureNotNull(context.newObjectParent,"newObjectParent"),changed=[context.element],referencedObject=elementHelper.createElement(newObject.type,newObject.properties,newObjectParent,this._bpmnFactory);return context.referencedObject=referencedObject,newObjectContainer.push(referencedObject),context.previousReference=referencingObject[referenceProperty],referencingObject[referenceProperty]=referencedObject,context.changed=changed,changed},CreateAndReferenceElementHandler.prototype.revert=function(context){var referencingObject=context.referencingObject,referenceProperty=context.referenceProperty,previousReference=context.previousReference,referencedObject=context.referencedObject,newObjectContainer=context.newObjectContainer;return referencingObject.set(referenceProperty,previousReference),newObjectContainer.splice(newObjectContainer.indexOf(referencedObject),1),context.changed}},{"../helper/ElementHelper":43}],26:[function(require,module,exports){"use strict";function CreateBusinessObjectListHandler(elementRegistry,bpmnFactory){this._elementRegistry=elementRegistry,this._bpmnFactory=bpmnFactory}function ensureNotNull(prop,name){if(!prop)throw new Error(name+" required");return prop}function ensureList(prop,name){if(!prop||"[object Array]"!==Object.prototype.toString.call(prop))throw new Error(name+" needs to be a list");return prop}var forEach=require("lodash/collection/forEach"),elementHelper=require("../helper/ElementHelper");CreateBusinessObjectListHandler.$inject=["elementRegistry","bpmnFactory"],module.exports=CreateBusinessObjectListHandler,CreateBusinessObjectListHandler.prototype.execute=function(context){var currentObject=ensureNotNull(context.currentObject,"currentObject"),propertyName=ensureNotNull(context.propertyName,"propertyName"),newObjects=ensureList(context.newObjects,"newObjects"),changed=[context.element],childObjects=[],self=this;return forEach(newObjects,function(obj){var element=elementHelper.createElement(obj.type,obj.properties,currentObject,self._bpmnFactory);childObjects.push(element)}),context.childObject=childObjects,context.previousChilds=currentObject[propertyName],currentObject[propertyName]=childObjects,context.changed=changed,changed},CreateBusinessObjectListHandler.prototype.revert=function(context){var currentObject=context.currentObject,propertyName=context.propertyName,previousChilds=context.previousChilds;return currentObject.set(propertyName,previousChilds),context.changed}},{"../helper/ElementHelper":43,"lodash/collection/forEach":362}],27:[function(require,module,exports){"use strict";function MultiCommandHandler(commandStack){this._commandStack=commandStack}var forEach=require("lodash/collection/forEach");MultiCommandHandler.$inject=["commandStack"],module.exports=MultiCommandHandler,MultiCommandHandler.prototype.preExecute=function(context){var commandStack=this._commandStack;forEach(context,function(command){commandStack.execute(command.cmd,command.context)})}},{"lodash/collection/forEach":362}],28:[function(require,module,exports){"use strict";function UpdateBusinessObjectHandler(elementRegistry){this._elementRegistry=elementRegistry}function getRoot(businessObject){for(var parent=businessObject;parent.$parent;)parent=parent.$parent;return parent}function getProperties(businessObject,propertyNames){return reduce(propertyNames,function(result,key){return result[key]=businessObject.get(key),result},{})}function setProperties(businessObject,properties){forEach(properties,function(value,key){businessObject.set(key,value)})}var reduce=require("lodash/object/transform"),is=require("bpmn-js/lib/util/ModelUtil").is,keys=require("lodash/object/keys"),forEach=require("lodash/collection/forEach");UpdateBusinessObjectHandler.$inject=["elementRegistry"],module.exports=UpdateBusinessObjectHandler,UpdateBusinessObjectHandler.prototype.execute=function(context){var element=context.element,businessObject=context.businessObject,rootElements=getRoot(businessObject).rootElements,referenceType=context.referenceType,referenceProperty=context.referenceProperty,changed=[element];if(!element)throw new Error("element required");if(!businessObject)throw new Error("businessObject required");var properties=context.properties,oldProperties=context.oldProperties||getProperties(businessObject,keys(properties));return"undefined"!=typeof referenceType&&"undefined"!=typeof referenceProperty&&forEach(rootElements,function(rootElement){is(rootElement,referenceType)&&rootElement.id===properties[referenceProperty]&&(properties[referenceProperty]=rootElement)}),setProperties(businessObject,properties),context.oldProperties=oldProperties,context.changed=changed,changed},UpdateBusinessObjectHandler.prototype.revert=function(context){var oldProperties=context.oldProperties,businessObject=context.businessObject;return setProperties(businessObject,oldProperties),context.changed}},{"bpmn-js/lib/util/ModelUtil":153,"lodash/collection/forEach":362,"lodash/object/keys":499,"lodash/object/transform":505}],29:[function(require,module,exports){"use strict";function UpdateBusinessObjectListHandler(elementRegistry,bpmnFactory){this._elementRegistry=elementRegistry,this._bpmnFactory=bpmnFactory}function ensureNotNull(prop,name){if(!prop)throw new Error(name+"required");return prop}var forEach=require("lodash/collection/forEach");UpdateBusinessObjectListHandler.$inject=["elementRegistry","bpmnFactory"],module.exports=UpdateBusinessObjectListHandler,UpdateBusinessObjectListHandler.prototype.execute=function(context){var referencePropertyName,currentObject=ensureNotNull(context.currentObject,"currentObject"),propertyName=ensureNotNull(context.propertyName,"propertyName"),updatedObjectList=context.updatedObjectList,objectsToRemove=context.objectsToRemove||[],objectsToAdd=context.objectsToAdd||[],changed=[context.element];context.referencePropertyName&&(referencePropertyName=context.referencePropertyName);var objectList=currentObject[propertyName];if(context.previousList=currentObject[propertyName],updatedObjectList)currentObject[propertyName]=updatedObjectList;else{var listCopy=[];if(forEach(objectList,function(object){objectsToRemove.indexOf(object)==-1&&listCopy.push(object)}),listCopy=listCopy.concat(objectsToAdd),listCopy.length>0||!referencePropertyName)currentObject[propertyName]=listCopy;else if(referencePropertyName){var parentObject=currentObject.$parent;parentObject.set(referencePropertyName,void 0)}}return context.changed=changed,changed},UpdateBusinessObjectListHandler.prototype.revert=function(context){var currentObject=context.currentObject,propertyName=context.propertyName,previousList=context.previousList,parentObject=currentObject.$parent;return context.referencePropertyName&&parentObject.set(context.referencePropertyName,currentObject),currentObject.set(propertyName,previousList),context.changed}},{"lodash/collection/forEach":362}],30:[function(require,module,exports){"use strict";function CommandInitializer(eventBus,commandStack){eventBus.on("diagram.init",function(){forEach(HANDLERS,function(handler,id){commandStack.registerHandler(id,handler)})})}var forEach=require("lodash/collection/forEach"),HANDLERS={"properties-panel.update-businessobject":require("./UpdateBusinessObjectHandler"),"properties-panel.create-and-reference":require("./CreateAndReferenceHandler"),"properties-panel.create-businessobject-list":require("./CreateBusinessObjectListHandler"),"properties-panel.update-businessobject-list":require("./UpdateBusinessObjectListHandler"),"properties-panel.multi-command-executor":require("./MultiCommandHandler")};CommandInitializer.$inject=["eventBus","commandStack"],module.exports={__init__:[CommandInitializer]}},{"./CreateAndReferenceHandler":25,"./CreateBusinessObjectListHandler":26,"./MultiCommandHandler":27,"./UpdateBusinessObjectHandler":28,"./UpdateBusinessObjectListHandler":29,"lodash/collection/forEach":362}],31:[function(require,module,exports){"use strict";var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,cmdHelper=require("../helper/CmdHelper"),entryFieldDescription=require("./EntryFieldDescription"),checkbox=function(options,defaultParameters){var resource=defaultParameters,label=options.label||resource.id,canBeDisabled=!!options.disabled&&"function"==typeof options.disabled,description=options.description;return resource.html='",description&&(resource.html+=entryFieldDescription(description)),resource.get=function(element){var bo=getBusinessObject(element),res={};return res[options.modelProperty]=bo.get(options.modelProperty),res},resource.set=function(element,values){var res={};return res[options.modelProperty]=!!values[options.modelProperty],cmdHelper.updateProperties(element,res)},"function"==typeof options.set&&(resource.set=options.set),"function"==typeof options.get&&(resource.get=options.get),canBeDisabled&&(resource.isDisabled=function(){return!options.disabled.apply(resource,arguments)}),resource.cssClasses=["bpp-checkbox"],resource};module.exports=checkbox},{"../helper/CmdHelper":42,"./EntryFieldDescription":34,"bpmn-js/lib/util/ModelUtil":153}],32:[function(require,module,exports){"use strict";var assign=require("lodash/object/assign"),find=require("lodash/collection/find"),domQuery=require("min-dom/lib/query"),selectEntryFactory=require("./SelectEntryFactory"),entryFieldDescription=require("./EntryFieldDescription"),comboBox=function(options){var selectOptions=options.selectOptions,modelProperty=options.modelProperty,customValue=options.customValue||"custom",customName=options.customName||"custom "+modelProperty,description=options.description,isCustomValue=function(value){if("undefined"==typeof value[modelProperty])return!1;var isCustom=!find(selectOptions,function(option){return value[modelProperty]===option.value});return isCustom},comboOptions=assign({},options);comboOptions.showCustomInput=function(element,node){var selectBox=domQuery('[data-entry="'+options.id+'"] select',node.parentNode);return!!selectBox&&selectBox.value===customValue},comboOptions.get=function(element,node){var value=options.get(element,node),modifiedValues={};return isCustomValue(value)?(modifiedValues[modelProperty]=customValue,modifiedValues["custom-"+modelProperty]=value[modelProperty],modifiedValues):(modifiedValues[modelProperty]=value[modelProperty]||"",modifiedValues)},comboOptions.set=function(element,values,node){var modifiedValues={};return values[modelProperty]===customValue?modifiedValues[modelProperty]=values["custom-"+modelProperty]||"":options.emptyParameter&&""===values[modelProperty]?modifiedValues[modelProperty]=void 0:modifiedValues[modelProperty]=values[modelProperty],options.set(element,modifiedValues,node)},comboOptions.selectOptions.push({name:customName,value:customValue});var comboBoxEntry=assign({},selectEntryFactory(comboOptions,comboOptions));return comboBoxEntry.html+='
',description&&(comboBoxEntry.html+=entryFieldDescription(description)),comboBoxEntry};module.exports=comboBox},{"./EntryFieldDescription":34,"./SelectEntryFactory":37,"lodash/collection/find":361,"lodash/object/assign":495,"min-dom/lib/query":518}],33:[function(require,module,exports){"use strict";function ensureNotNull(prop){if(!prop)throw new Error(prop+" must be set.");return prop}function EntryFactory(){}var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,textInputField=require("./TextInputEntryFactory"),checkboxField=require("./CheckboxEntryFactory"),selectBoxField=require("./SelectEntryFactory"),comboBoxField=require("./ComboEntryFactory"),textBoxField=require("./TextBoxEntryFactory"),validationAwareTextInputField=require("./ValidationAwareTextInput"),tableField=require("./TableEntryFactory"),labelEntry=require("./LabelFactory"),link=require("./LinkEntryFactory"),cmdHelper=require("../helper/CmdHelper"),setDefaultParameters=function(options){var defaultGet=function(element){var bo=getBusinessObject(element),res={},prop=ensureNotNull(options.modelProperty);return res[prop]=bo.get(prop),res},defaultSet=function(element,values){var res={},prop=ensureNotNull(options.modelProperty);return""!==values[prop]?res[prop]=values[prop]:res[prop]=void 0,cmdHelper.updateProperties(element,res)},defaultValidate=function(){return{}};return{id:options.id,description:options.description||"",get:options.get||defaultGet,set:options.set||defaultSet,validate:options.validate||defaultValidate,html:""}};EntryFactory.textField=function(options){return textInputField(options,setDefaultParameters(options))},EntryFactory.validationAwareTextField=function(options){return validationAwareTextInputField(options,setDefaultParameters(options))},EntryFactory.checkbox=function(options){return checkboxField(options,setDefaultParameters(options))},EntryFactory.textBox=function(options){return textBoxField(options,setDefaultParameters(options))},EntryFactory.selectBox=function(options){return selectBoxField(options,setDefaultParameters(options))},EntryFactory.comboBox=function(options){return comboBoxField(options)},EntryFactory.table=function(options){return tableField(options)},EntryFactory.label=function(options){return labelEntry(options)},EntryFactory.link=function(options){return link(options)},module.exports=EntryFactory},{"../helper/CmdHelper":42,"./CheckboxEntryFactory":31,"./ComboEntryFactory":32,"./LabelFactory":35,"./LinkEntryFactory":36,"./SelectEntryFactory":37,"./TableEntryFactory":38,"./TextBoxEntryFactory":39,"./TextInputEntryFactory":40,"./ValidationAwareTextInput":41,"bpmn-js/lib/util/ModelUtil":153}],34:[function(require,module,exports){"use strict";function linkify(text){return text.replace(MARKDOWN_LINK_REGEX,'$1')}var MARKDOWN_LINK_REGEX=/\[([^\)]+)\]\(([^\]]+)\)/g;module.exports=function(description){return description=linkify(description),'
'+description+"
"}},{}],35:[function(require,module,exports){"use strict";var label=function(options){return{id:options.id,html:'',get:function(element,node){return"function"==typeof options.get?options.get(element,node):{label:options.labelText}},showLabel:function(element,node){return"function"!=typeof options.showLabel||options.showLabel(element,node)}}};module.exports=label},{}],36:[function(require,module,exports){"use strict";var utils=require("../Utils"),entryFieldDescription=require("./EntryFieldDescription"),link=function(options,defaultParameters){var id=options.id,label=options.label||id,hideLink=options.hideLink,canBeHidden="function"==typeof hideLink,getClickableElement=options.getClickableElement,description=options.description,resource={id:id};return resource.html=''+label+"",description&&(resource.html+=entryFieldDescription(description)),resource.linkSelected=function(element,node,event,scopeNode){if("function"==typeof getClickableElement){var link=getClickableElement.apply(resource,[element,node,event,scopeNode]);link&&utils.triggerClickEvent(link)}return!1},canBeHidden&&(resource.hideLink=function(){return!hideLink.apply(resource,arguments)}),resource};module.exports=link},{"../Utils":24,"./EntryFieldDescription":34}],37:[function(require,module,exports){"use strict";var domify=require("min-dom/lib/domify"),forEach=require("lodash/collection/forEach"),entryFieldDescription=require("./EntryFieldDescription"),isList=function(list){return!(!list||"[object Array]"!==Object.prototype.toString.call(list))},addEmptyParameter=function(list){return list.concat([{name:"",value:""}])},createOption=function(option){return'"},selectbox=function(options,defaultParameters){var resource=defaultParameters,label=options.label||resource.id,selectOptions=options.selectOptions||[{name:"",value:""}],modelProperty=options.modelProperty,emptyParameter=options.emptyParameter,canBeDisabled=!!options.disabled&&"function"==typeof options.disabled,description=options.description;return emptyParameter&&(selectOptions=addEmptyParameter(selectOptions)),resource.html='",description&&"function"===(options.showCustomInput,!1)&&(resource.html+=entryFieldDescription(description)),resource.setControlValue=function(element,entryNode,inputNode,inputName,newValue){if("function"==typeof selectOptions){var options=selectOptions(element,inputNode);if(options){for(;inputNode.firstChild;)inputNode.removeChild(inputNode.firstChild);forEach(options,function(option){var template=domify(createOption(option));inputNode.appendChild(template)})}}void 0!==newValue&&(inputNode.value=newValue)},canBeDisabled&&(resource.isDisabled=function(){return!options.disabled.apply(resource,arguments)}),resource.cssClasses=["dropdown"],resource};module.exports=selectbox},{"./EntryFieldDescription":34,"lodash/collection/forEach":362,"min-dom/lib/domify":515}],38:[function(require,module,exports){"use strict";function createInputRowTemplate(properties,canRemove){var template=TABLE_ROW_DIV_SNIPPET;return template+=createInputTemplate(properties,canRemove),template+=canRemove?DELETE_ROW_BUTTON_SNIPPET:"",template+=""}function createInputTemplate(properties,canRemove){var columns=properties.length,template="";return forEach(properties,function(prop){template+=''}),template}function createLabelRowTemplate(labels){var template=TABLE_ROW_DIV_SNIPPET;return template+=createLabelTemplate(labels),template+=""}function createLabelTemplate(labels){var columns=labels.length,template="";return forEach(labels,function(label){template+='"}),template}function pick(elements,properties){return(elements||[]).map(function(elem){var newElement={};return forEach(properties,function(prop){newElement[prop]=elem[prop]||""}),newElement})}function diff(element,node,values,oldValues,editable){return filter(values,function(value,idx){return!valueEqual(element,node,value,oldValues[idx],editable,idx)})}function valueEqual(element,node,value,oldValue,editable,idx){if(value&&!oldValue)return!1;var allKeys=keys(value).concat(keys(oldValue));return allKeys.every(function(key){var n=value[key]||void 0,o=oldValue[key]||void 0;return!editable(element,node,key,idx)||n===o})}function getEntryNode(node){return domClosest(node,"[data-entry]",!0)}function getContainer(node){return domQuery("div[data-list-entry-container]",node)}function getSelection(node){return{start:node.selectionStart,end:node.selectionEnd}}function setSelection(node,selection){node.selectionStart=selection.start,node.selectionEnd=selection.end}var cmdHelper=require("../helper/CmdHelper"),domQuery=require("min-dom/lib/query"),domAttr=require("min-dom/lib/attr"),domClosest=require("min-dom/lib/closest"),filter=require("lodash/collection/filter"),forEach=require("lodash/collection/forEach"),keys=require("lodash/object/keys"),domify=require("min-dom/lib/domify"),entryFieldDescription=require("./EntryFieldDescription"),updateSelection=require("selection-update"),TABLE_ROW_DIV_SNIPPET='
',DELETE_ROW_BUTTON_SNIPPET='';module.exports=function(options){var id=options.id,modelProperties=options.modelProperties,labels=options.labels,description=options.description,labelRow=createLabelRowTemplate(labels),getElements=options.getElements,removeElement=options.removeElement,canRemove="function"==typeof removeElement,addElement=options.addElement,canAdd="function"==typeof addElement,addLabel=options.addLabel||"Add Value",updateElement=options.updateElement,canUpdate="function"==typeof updateElement,editable=options.editable||function(){return!0},setControlValue=options.setControlValue,show=options.show,canBeShown="function"==typeof show,elements=function(element,node){return pick(getElements(element,node),modelProperties)},factory={id:id,html:(canAdd?'
':"")+'
'+labelRow+"
"+(description?entryFieldDescription(description):""),get:function(element,node){var boElements=elements(element,node,this.__invalidValues),invalidValues=this.__invalidValues;return delete this.__invalidValues,forEach(invalidValues,function(value,idx){var element=boElements[idx];forEach(modelProperties,function(prop){element[prop]=value[prop]})}),boElements},set:function(element,values,node){var action=this.__action||{};if(delete this.__action,"delete-element"===action.id)return removeElement(element,node,action.idx);if("add-element"===action.id)return addElement(element,node);if(canUpdate){var commands=[],valuesToValidate=values;"function"!=typeof options.validate&&(valuesToValidate=diff(element,node,values,elements(element,node),editable));var self=this;return forEach(valuesToValidate,function(value){var validationError,idx=values.indexOf(value);if("function"==typeof options.validate&&(validationError=options.validate(element,value,node,idx)),validationError)self.__invalidValues=self.__invalidValues||{},self.__invalidValues[idx]=value,commands.push(cmdHelper.updateProperties(element,{}));else{var cmd=updateElement(element,value,node,idx);cmd&&commands.push(cmd)}}),commands}},createListEntryTemplate:function(value,index,selectBox){return createInputRowTemplate(modelProperties,canRemove)},addElement:function(element,node,event,scopeNode){var template=domify(createInputRowTemplate(modelProperties,canRemove)),container=getContainer(node);return container.appendChild(template),this.__action={id:"add-element"},!0},deleteElement:function(element,node,event,scopeNode){var container=getContainer(node),rowToDelete=event.delegateTarget.parentNode,idx=parseInt(domAttr(rowToDelete,"data-index"),10);return container.removeChild(rowToDelete),this.__action={id:"delete-element",idx:idx},!0},editable:function(element,rowNode,input,prop,value,idx){var entryNode=domClosest(rowNode,"[data-entry]");return editable(element,entryNode,prop,idx)},show:function(element,entryNode,node,scopeNode){return entryNode=getEntryNode(entryNode),show(element,entryNode,node,scopeNode)},showTable:function(element,entryNode,node,scopeNode){entryNode=getEntryNode(entryNode);var elems=elements(element,entryNode);return elems&&elems.length&&(!canBeShown||show(element,entryNode,node,scopeNode))},validateListItem:function(element,value,node,idx){if("function"==typeof options.validate)return options.validate(element,value,node,idx)}};return setControlValue&&(factory.setControlValue=function(element,rowNode,input,prop,value,idx){var selection,entryNode=getEntryNode(rowNode),isReadOnly=domAttr(input,"readonly"),oldValue=input.value;void 0===value&&(value=""),isReadOnly&&oldValue===value||(document.activeElement===input&&(selection=updateSelection(getSelection(input),oldValue,value)),setControlValue(element,entryNode,input,prop,value,idx),selection&&setSelection(input,selection))}),factory}},{"../helper/CmdHelper":42,"./EntryFieldDescription":34,"lodash/collection/filter":360,"lodash/collection/forEach":362,"lodash/object/keys":499,"min-dom/lib/attr":510,"min-dom/lib/closest":513,"min-dom/lib/domify":515,"min-dom/lib/query":518,"selection-update":537}],39:[function(require,module,exports){"use strict";var entryFieldDescription=require("./EntryFieldDescription"),textBox=function(options,defaultParameters){var resource=defaultParameters,label=options.label||resource.id,canBeShown=!!options.show&&"function"==typeof options.show,description=options.description;return resource.html='
',description&&(resource.html+=entryFieldDescription(description)),canBeShown&&(resource.isShown=function(){return options.show.apply(resource,arguments)}),resource.cssClasses=["bpp-textbox"],resource};module.exports=textBox},{"./EntryFieldDescription":34}],40:[function(require,module,exports){"use strict";var domQuery=require("min-dom/lib/query"),entryFieldDescription=require("./EntryFieldDescription"),textField=function(options,defaultParameters){var defaultButtonAction=function(element,inputNode){var input=domQuery('input[name="'+options.modelProperty+'"]',inputNode);return input.value="",!0},defaultButtonShow=function(element,inputNode){var input=domQuery('input[name="'+options.modelProperty+'"]',inputNode);return""!==input.value},resource=defaultParameters,label=options.label||resource.id,dataValueLabel=options.dataValueLabel,buttonLabel=options.buttonLabel||"X",actionName="undefined"!=typeof options.buttonAction?options.buttonAction.name:"clear",actionMethod="undefined"!=typeof options.buttonAction?options.buttonAction.method:defaultButtonAction,showName="undefined"!=typeof options.buttonShow?options.buttonShow.name:"canClear",showMethod="undefined"!=typeof options.buttonShow?options.buttonShow.method:defaultButtonShow,canBeDisabled=!!options.disabled&&"function"==typeof options.disabled,description=options.description;return resource.html='
",description&&(resource.html+=entryFieldDescription(description)),resource[actionName]=actionMethod,resource[showName]=showMethod,canBeDisabled&&(resource.isDisabled=function(){return!options.disabled.apply(resource,arguments)}),resource.cssClasses=["bpp-textfield"],resource};module.exports=textField},{"./EntryFieldDescription":34,"min-dom/lib/query":518}],41:[function(require,module,exports){"use strict";var textField=require("./TextInputEntryFactory"),validationAwareTextField=function(options,defaultParameters){var modelProperty=options.modelProperty;defaultParameters.get=function(element,node){var value=this.__lastInvalidValue;delete this.__lastInvalidValue;var properties={};return properties[modelProperty]=void 0!==value?value:options.getProperty(element,node),properties},defaultParameters.set=function(element,values,node){var validationErrors=validate.apply(this,[element,values,node]),propertyValue=values[modelProperty];if(validationErrors&&validationErrors[modelProperty])return this.__lastInvalidValue=propertyValue,options.setProperty(element,{},node);var properties={};return properties[modelProperty]=propertyValue,options.setProperty(element,properties,node)};var validate=defaultParameters.validate=function(element,values,node){var value=values[modelProperty]||this.__lastInvalidValue,property={};return property[modelProperty]=value,options.validate(element,property,node)};return textField(options,defaultParameters)};module.exports=validationAwareTextField},{"./TextInputEntryFactory":40}],42:[function(require,module,exports){"use strict";var CmdHelper={};module.exports=CmdHelper,CmdHelper.updateProperties=function(element,properties){return{cmd:"element.updateProperties",context:{element:element,properties:properties}}},CmdHelper.updateBusinessObject=function(element,businessObject,newProperties){return{cmd:"properties-panel.update-businessobject",context:{element:element,businessObject:businessObject,properties:newProperties}}},CmdHelper.addElementsTolist=function(element,businessObject,listPropertyName,objectsToAdd){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject,propertyName:listPropertyName,objectsToAdd:objectsToAdd}}},CmdHelper.removeElementsFromList=function(element,businessObject,listPropertyName,referencePropertyName,objectsToRemove){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject, -propertyName:listPropertyName,referencePropertyName:referencePropertyName,objectsToRemove:objectsToRemove}}},CmdHelper.addAndRemoveElementsFromList=function(element,businessObject,listPropertyName,referencePropertyName,objectsToAdd,objectsToRemove){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject,propertyName:listPropertyName,referencePropertyName:referencePropertyName,objectsToAdd:objectsToAdd,objectsToRemove:objectsToRemove}}},CmdHelper.setList=function(element,businessObject,listPropertyName,updatedObjectList){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject,propertyName:listPropertyName,updatedObjectList:updatedObjectList}}}},{}],43:[function(require,module,exports){"use strict";var ElementHelper={};module.exports=ElementHelper,ElementHelper.createElement=function(elementType,properties,parent,factory){var element=factory.create(elementType,properties);return element.$parent=parent,element}},{}],44:[function(require,module,exports){"use strict";var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,is=require("bpmn-js/lib/util/ModelUtil").is,forEach=require("lodash/collection/forEach"),EventDefinitionHelper={};module.exports=EventDefinitionHelper,EventDefinitionHelper.getEventDefinition=function(element,eventType){var bo=getBusinessObject(element),eventDefinition=null;return bo.eventDefinitions&&forEach(bo.eventDefinitions,function(event){is(event,eventType)&&(eventDefinition=event)}),eventDefinition},EventDefinitionHelper.getTimerEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:TimerEventDefinition")},EventDefinitionHelper.getMessageEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:MessageEventDefinition")},EventDefinitionHelper.getSignalEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:SignalEventDefinition")},EventDefinitionHelper.getErrorEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:ErrorEventDefinition")},EventDefinitionHelper.getEscalationEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:EscalationEventDefinition")},EventDefinitionHelper.getCompensateEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:CompensateEventDefinition")},EventDefinitionHelper.getLinkEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:LinkEventDefinition")},EventDefinitionHelper.getConditionalEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:ConditionalEventDefinition")}},{"bpmn-js/lib/util/ModelUtil":153,"lodash/collection/forEach":362}],45:[function(require,module,exports){"use strict";var cmdHelper=require("./CmdHelper"),elementHelper=require("./ElementHelper"),is=require("bpmn-js/lib/util/ModelUtil").is,ExtensionElementsHelper={},getExtensionElements=function(bo){return bo.get("extensionElements")};ExtensionElementsHelper.getExtensionElements=function(bo,type){var extensionElements=getExtensionElements(bo);if("undefined"!=typeof extensionElements){var extensionValues=extensionElements.get("values");if("undefined"!=typeof extensionValues){var elements=extensionValues.filter(function(value){return is(value,type)});if(elements.length)return elements}}},ExtensionElementsHelper.addEntry=function(bo,element,entry,bpmnFactory){var extensionElements=bo.get("extensionElements");return extensionElements?cmdHelper.addElementsTolist(element,extensionElements,"values",[entry]):(extensionElements=elementHelper.createElement("bpmn:ExtensionElements",{values:[entry]},bo,bpmnFactory),{extensionElements:extensionElements})},ExtensionElementsHelper.removeEntry=function(bo,element,entry){var extensionElements=bo.get("extensionElements");return extensionElements?cmdHelper.removeElementsFromList(element,extensionElements,"values","extensionElements",[entry]):{}},module.exports=ExtensionElementsHelper},{"./CmdHelper":42,"./ElementHelper":43,"bpmn-js/lib/util/ModelUtil":153}],46:[function(require,module,exports){module.exports={__depends__:[require("./cmd")],__init__:["propertiesPanel"],propertiesPanel:["type",require("./PropertiesPanel")]}},{"./PropertiesPanel":23,"./cmd":30}],47:[function(require,module,exports){"use strict";var entryFactory=require("../../../factory/EntryFactory"),cmdHelper=require("../../../helper/CmdHelper"),ModelUtil=require("bpmn-js/lib/util/ModelUtil"),is=ModelUtil.is,getBusinessObject=ModelUtil.getBusinessObject;module.exports=function(group,element,bpmnFactory){var getValue=function(businessObject){return function(element){var documentations=businessObject&&businessObject.get("documentation"),text=documentations&&documentations.length>0?documentations[0].text:"";return{documentation:text}}},setValue=function(businessObject){return function(element,values){var newObjectList=[];return"undefined"!=typeof values.documentation&&""!==values.documentation&&newObjectList.push(bpmnFactory.create("bpmn:Documentation",{text:values.documentation})),cmdHelper.setList(element,businessObject,"documentation",newObjectList)}},elementDocuEntry=entryFactory.textBox({id:"documentation",label:"Element Documentation",modelProperty:"documentation"});elementDocuEntry.set=setValue(getBusinessObject(element)),elementDocuEntry.get=getValue(getBusinessObject(element)),group.entries.push(elementDocuEntry);var processRef;if(is(element,"bpmn:Participant")&&(processRef=getBusinessObject(element).processRef)){var processDocuEntry=entryFactory.textBox({id:"process-documentation",label:"Process Documentation",modelProperty:"documentation"});processDocuEntry.set=setValue(processRef),processDocuEntry.get=getValue(processRef),group.entries.push(processDocuEntry)}}},{"../../../factory/EntryFactory":33,"../../../helper/CmdHelper":42,"bpmn-js/lib/util/ModelUtil":153}],48:[function(require,module,exports){"use strict";var is=require("bpmn-js/lib/util/ModelUtil").is,isAny=require("bpmn-js/lib/features/modeling/util/ModelingUtil").isAny,isEventSubProcess=require("bpmn-js/lib/util/DiUtil").isEventSubProcess,getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,eventDefinitionHelper=require("../../../helper/EventDefinitionHelper"),forEach=require("lodash/collection/forEach"),message=require("./implementation/MessageEventDefinition"),signal=require("./implementation/SignalEventDefinition"),error=require("./implementation/ErrorEventDefinition"),escalation=require("./implementation/EscalationEventDefinition"),timer=require("./implementation/TimerEventDefinition"),compensation=require("./implementation/CompensateEventDefinition"),condition=require("./implementation/ConditionalEventDefinition");module.exports=function(group,element,bpmnFactory,elementRegistry){var events=["bpmn:StartEvent","bpmn:EndEvent","bpmn:IntermediateThrowEvent","bpmn:BoundaryEvent","bpmn:IntermediateCatchEvent"];forEach(events,function(event){if(is(element,event)){var messageEventDefinition=eventDefinitionHelper.getMessageEventDefinition(element),signalEventDefinition=eventDefinitionHelper.getSignalEventDefinition(element);messageEventDefinition&&message(group,element,bpmnFactory,messageEventDefinition),signalEventDefinition&&signal(group,element,bpmnFactory,signalEventDefinition)}}),is(element,"bpmn:ReceiveTask")&&message(group,element,bpmnFactory,getBusinessObject(element));var errorEvents=["bpmn:StartEvent","bpmn:BoundaryEvent","bpmn:EndEvent"];forEach(errorEvents,function(event){if(is(element,event)){var errorEventDefinition=eventDefinitionHelper.getErrorEventDefinition(element);if(errorEventDefinition){var isCatchingErrorEvent=is(element,"bpmn:StartEvent")||is(element,"bpmn:BoundaryEvent"),showErrorCodeVariable=isCatchingErrorEvent,showErrorMessageVariable=isCatchingErrorEvent;error(group,element,bpmnFactory,errorEventDefinition,showErrorCodeVariable,showErrorMessageVariable)}}});var escalationEvents=["bpmn:StartEvent","bpmn:BoundaryEvent","bpmn:IntermediateThrowEvent","bpmn:EndEvent"];forEach(escalationEvents,function(event){if(is(element,event)){var showEscalationCodeVariable=is(element,"bpmn:StartEvent")||is(element,"bpmn:BoundaryEvent"),escalationEventDefinition=eventDefinitionHelper.getEscalationEventDefinition(element);escalationEventDefinition&&escalation(group,element,bpmnFactory,escalationEventDefinition,showEscalationCodeVariable)}});var timerEvents=["bpmn:StartEvent","bpmn:BoundaryEvent","bpmn:IntermediateCatchEvent"];forEach(timerEvents,function(event){if(is(element,event)){var timerEventDefinition=eventDefinitionHelper.getTimerEventDefinition(element);timerEventDefinition&&timer(group,element,bpmnFactory,timerEventDefinition)}});var compensationEvents=["bpmn:EndEvent","bpmn:IntermediateThrowEvent"];forEach(compensationEvents,function(event){if(is(element,event)){var compensateEventDefinition=eventDefinitionHelper.getCompensateEventDefinition(element);compensateEventDefinition&&compensation(group,element,bpmnFactory,compensateEventDefinition,elementRegistry)}});var conditionalEvents=["bpmn:BoundaryEvent","bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"];if(isAny(element,conditionalEvents)||is(element,"bpmn:StartEvent")&&isEventSubProcess(element.parent)){var conditionalEventDefinition=eventDefinitionHelper.getConditionalEventDefinition(element);conditionalEventDefinition&&condition(group,element,bpmnFactory,conditionalEventDefinition,elementRegistry)}}},{"../../../helper/EventDefinitionHelper":44,"./implementation/CompensateEventDefinition":50,"./implementation/ConditionalEventDefinition":51,"./implementation/ErrorEventDefinition":53,"./implementation/EscalationEventDefinition":54,"./implementation/MessageEventDefinition":56,"./implementation/SignalEventDefinition":57,"./implementation/TimerEventDefinition":58,"bpmn-js/lib/features/modeling/util/ModelingUtil":126,"bpmn-js/lib/util/DiUtil":151,"bpmn-js/lib/util/ModelUtil":153,"lodash/collection/forEach":362}],49:[function(require,module,exports){"use strict";function getLinkEventDefinition(element){var bo=getBusinessObject(element),linkEventDefinition=null;return bo.eventDefinitions&&forEach(bo.eventDefinitions,function(eventDefinition){is(eventDefinition,"bpmn:LinkEventDefinition")&&(linkEventDefinition=eventDefinition)}),linkEventDefinition}var is=require("bpmn-js/lib/util/ModelUtil").is,getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,entryFactory=require("../../../factory/EntryFactory"),cmdHelper=require("../../../helper/CmdHelper"),forEach=require("lodash/collection/forEach");module.exports=function(group,element){var linkEvents=["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"];forEach(linkEvents,function(event){if(is(element,event)){var linkEventDefinition=getLinkEventDefinition(element);if(linkEventDefinition){var entry=entryFactory.textField({id:"link-event",label:"Link Name",modelProperty:"link-name"});entry.get=function(){return{"link-name":linkEventDefinition.get("name")}},entry.set=function(element,values){var newProperties={name:values["link-name"]};return cmdHelper.updateBusinessObject(element,linkEventDefinition,newProperties)},group.entries.push(entry)}}})}},{"../../../factory/EntryFactory":33,"../../../helper/CmdHelper":42,"bpmn-js/lib/util/ModelUtil":153,"lodash/collection/forEach":362}],50:[function(require,module,exports){"use strict";function getContainedActivities(element){return getFlowElements(element,"bpmn:Activity")}function getContainedBoundaryEvents(element){return getFlowElements(element,"bpmn:BoundaryEvent")}function getFlowElements(element,type){return utils.filterElementsByType(element.flowElements,type)}function isCompensationEventAttachedToActivity(activity,boundaryEvents){var activityId=activity.id,boundaryEvent=find(boundaryEvents,function(boundaryEvent){var compensateEventDefinition=eventDefinitionHelper.getCompensateEventDefinition(boundaryEvent),attachedToRef=boundaryEvent.attachedToRef;return compensateEventDefinition&&attachedToRef&&attachedToRef.id===activityId});return!!boundaryEvent}function canActivityBeCompensated(activity,boundaryEvents){return is(activity,"bpmn:SubProcess")&&!activity.triggeredByEvent||is(activity,"bpmn:CallActivity")||isCompensationEventAttachedToActivity(activity,boundaryEvents)}function getActivitiesForCompensation(element){var boundaryEvents=getContainedBoundaryEvents(element);return filter(getContainedActivities(element),function(activity){return canActivityBeCompensated(activity,boundaryEvents)})}function getActivitiesForActivityRef(element){var bo=getBusinessObject(element),parent=bo.$parent,activitiesForActivityRef=getActivitiesForCompensation(parent);return is(parent,"bpmn:SubProcess")&&parent.triggeredByEvent&&(parent=parent.$parent,parent&&(activitiesForActivityRef=activitiesForActivityRef.concat(getActivitiesForCompensation(parent)))),activitiesForActivityRef}function createActivityRefOptions(element){var options=[{value:""}],activities=getActivitiesForActivityRef(element);return forEach(activities,function(activity){var activityId=activity.id,name=(activity.name?activity.name+" ":"")+"(id="+activityId+")";options.push({value:activityId,name:name})}),options}var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper"),eventDefinitionHelper=require("../../../../helper/EventDefinitionHelper"),utils=require("../../../../Utils"),getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,is=require("bpmn-js/lib/util/ModelUtil").is,forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),filter=require("lodash/collection/filter");module.exports=function(group,element,bpmnFactory,compensateEventDefinition,elementRegistry){group.entries.push(entryFactory.checkbox({id:"wait-for-completion",label:"Wait for Completion",modelProperty:"waitForCompletion",get:function(element,node){return{waitForCompletion:compensateEventDefinition.waitForCompletion}},set:function(element,values){return values.waitForCompletion=values.waitForCompletion||void 0,cmdHelper.updateBusinessObject(element,compensateEventDefinition,values)}})),group.entries.push(entryFactory.selectBox({id:"activity-ref",label:"Activity Ref",selectOptions:createActivityRefOptions(element),modelProperty:"activityRef",get:function(element,node){var activityRef=compensateEventDefinition.activityRef;return activityRef=activityRef&&activityRef.id,{activityRef:activityRef||""}},set:function(element,values){var activityRef=values.activityRef||void 0;return activityRef=activityRef&&getBusinessObject(elementRegistry.get(activityRef)),cmdHelper.updateBusinessObject(element,compensateEventDefinition,{activityRef:activityRef})}}))}},{"../../../../Utils":24,"../../../../factory/EntryFactory":33,"../../../../helper/CmdHelper":42,"../../../../helper/EventDefinitionHelper":44,"bpmn-js/lib/util/ModelUtil":153,"lodash/collection/filter":360,"lodash/collection/find":361,"lodash/collection/forEach":362}],51:[function(require,module,exports){"use strict";function createFormalExpression(parent,body,bpmnFactory){return body=body||void 0,elementHelper.createElement("bpmn:FormalExpression",{body:body},parent,bpmnFactory)}var entryFactory=require("../../../../factory/EntryFactory"),elementHelper=require("../../../../helper/ElementHelper"),cmdHelper=require("../../../../helper/CmdHelper");module.exports=function(group,element,bpmnFactory,conditionalEventDefinition){var getValue=function(modelProperty){return function(element){var modelPropertyValue=conditionalEventDefinition.get("camunda:"+modelProperty),value={};return value[modelProperty]=modelPropertyValue,value}},setValue=function(modelProperty){return function(element,values){var props={};return props["camunda:"+modelProperty]=values[modelProperty]||void 0,cmdHelper.updateBusinessObject(element,conditionalEventDefinition,props)}};group.entries.push(entryFactory.textField({id:"condition",label:"Condition",modelProperty:"condition",get:function(element){var condition=conditionalEventDefinition.get("condition"),body=condition&&condition.get("body");return{condition:body||""}},set:function(element,values){var condition=conditionalEventDefinition.get("condition");return""===values.condition?cmdHelper.updateBusinessObject(element,conditionalEventDefinition,{condition:void 0}):condition?cmdHelper.updateBusinessObject(element,condition,{body:values.condition||void 0}):(condition=createFormalExpression(conditionalEventDefinition,values.condition,bpmnFactory),cmdHelper.updateBusinessObject(element,conditionalEventDefinition,{condition:condition}))},validate:function(element,values){if(""===values.condition)return{condition:"Must provide a value"}}})),group.entries.push(entryFactory.textField({id:"variableName",label:"Variable Name",modelProperty:"variableName",get:getValue("variableName"),set:setValue("variableName")})),group.entries.push(entryFactory.textField({id:"variableEvent",label:"Variable Event",description:"Specify more than one variable change event as a comma separated list.",modelProperty:"variableEvent",get:getValue("variableEvent"),set:setValue("variableEvent")}))}},{"../../../../factory/EntryFactory":33,"../../../../helper/CmdHelper":42,"../../../../helper/ElementHelper":43}],52:[function(require,module,exports){"use strict";var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper");module.exports=function(element,definition,bpmnFactory,options){var id=options.id||"element-property",label=options.label,referenceProperty=options.referenceProperty,modelProperty=options.modelProperty||"name",shouldValidate=options.shouldValidate||!1,entry=entryFactory.textField({id:id,label:label,modelProperty:modelProperty,get:function(element,node){var reference=definition.get(referenceProperty),props={};return props[modelProperty]=reference&&reference.get(modelProperty),props},set:function(element,values,node){var reference=definition.get(referenceProperty),props={};return props[modelProperty]=values[modelProperty]||void 0,cmdHelper.updateBusinessObject(element,reference,props)},disabled:function(element,node){return!definition.get(referenceProperty)}});return shouldValidate&&(entry.validate=function(element,values,node){var reference=definition.get(referenceProperty);if(reference&&!values[modelProperty]){var validationErrors={};return validationErrors[modelProperty]="Must provide a value",validationErrors}}),[entry]}},{"../../../../factory/EntryFactory":33,"../../../../helper/CmdHelper":42}],53:[function(require,module,exports){"use strict";var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper"),eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,errorEventDefinition,showErrorCodeVariable,showErrorMessageVariable){var getValue=function(modelProperty){return function(element){var modelPropertyValue=errorEventDefinition.get("camunda:"+modelProperty),value={};return value[modelProperty]=modelPropertyValue,value}},setValue=function(modelProperty){return function(element,values){var props={};return props["camunda:"+modelProperty]=values[modelProperty]||void 0,cmdHelper.updateBusinessObject(element,errorEventDefinition,props)}};group.entries=group.entries.concat(eventDefinitionReference(element,errorEventDefinition,bpmnFactory,{label:"Error",elementName:"error",elementType:"bpmn:Error",referenceProperty:"errorRef",newElementIdPrefix:"Error_"})),group.entries=group.entries.concat(elementReferenceProperty(element,errorEventDefinition,bpmnFactory,{id:"error-element-name",label:"Error Name",referenceProperty:"errorRef",modelProperty:"name",shouldValidate:!0})),group.entries=group.entries.concat(elementReferenceProperty(element,errorEventDefinition,bpmnFactory,{id:"error-element-code",label:"Error Code",referenceProperty:"errorRef",modelProperty:"errorCode"})),showErrorCodeVariable&&group.entries.push(entryFactory.textField({id:"errorCodeVariable",label:"Error Code Variable",modelProperty:"errorCodeVariable",get:getValue("errorCodeVariable"),set:setValue("errorCodeVariable")})),showErrorMessageVariable&&group.entries.push(entryFactory.textField({id:"errorMessageVariable",label:"Error Message Variable",modelProperty:"errorMessageVariable",get:getValue("errorMessageVariable"),set:setValue("errorMessageVariable")}))}},{"../../../../factory/EntryFactory":33,"../../../../helper/CmdHelper":42,"./ElementReferenceProperty":52,"./EventDefinitionReference":55}],54:[function(require,module,exports){"use strict";var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper"),eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,escalationEventDefinition,showEscalationCodeVariable){group.entries=group.entries.concat(eventDefinitionReference(element,escalationEventDefinition,bpmnFactory,{label:"Escalation",elementName:"escalation",elementType:"bpmn:Escalation",referenceProperty:"escalationRef",newElementIdPrefix:"Escalation_"})),group.entries=group.entries.concat(elementReferenceProperty(element,escalationEventDefinition,bpmnFactory,{id:"escalation-element-name",label:"Escalation Name",referenceProperty:"escalationRef",modelProperty:"name",shouldValidate:!0})),group.entries=group.entries.concat(elementReferenceProperty(element,escalationEventDefinition,bpmnFactory,{id:"escalation-element-code",label:"Escalation Code",referenceProperty:"escalationRef",modelProperty:"escalationCode"})),showEscalationCodeVariable&&group.entries.push(entryFactory.textField({id:"escalationCodeVariable",label:"Escalation Code Variable",modelProperty:"escalationCodeVariable",get:function(element){var codeVariable=escalationEventDefinition.get("camunda:escalationCodeVariable");return{escalationCodeVariable:codeVariable}},set:function(element,values){return cmdHelper.updateBusinessObject(element,escalationEventDefinition,{"camunda:escalationCodeVariable":values.escalationCodeVariable||void 0})}}))}},{"../../../../factory/EntryFactory":33,"../../../../helper/CmdHelper":42,"./ElementReferenceProperty":52,"./EventDefinitionReference":55}],55:[function(require,module,exports){"use strict";function getSelectBox(node){return domQuery(selector,node.parentElement)}function findElementById(eventDefinition,type,id){var elements=utils.findRootElementsByType(eventDefinition,type);return find(elements,function(element){return element.id===id})}var cmdHelper=require("../../../../helper/CmdHelper"),domQuery=require("min-dom/lib/query"),domify=require("min-dom/lib/domify"),domAttr=require("min-dom/lib/attr"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),elementHelper=require("../../../../helper/ElementHelper"),utils=require("../../../../Utils"),selector="select[name=selectedElement]";module.exports=function(element,definition,bpmnFactory,options){var elementName=options.elementName||"",elementType=options.elementType,referenceProperty=options.referenceProperty,newElementIdPrefix=options.newElementIdPrefix||"elem_",label=options.label||"",description=options.description||"",entries=[];return entries.push({id:"event-definitions-"+elementName,description:description,html:'
',get:function(element,entryNode){utils.updateOptionsDropDown(selector,definition,elementType,entryNode);var reference=definition.get(referenceProperty);return{selectedElement:reference&&reference.id||""}},set:function(element,values){var selection=values.selectedElement,props={};if(!selection||"undefined"==typeof selection)return props[referenceProperty]=void 0,cmdHelper.updateBusinessObject(element,definition,props);var commands=[],selectedElement=findElementById(definition,elementType,selection);if(!selectedElement){var root=utils.getRoot(definition);selectedElement=elementHelper.createElement(elementType,{name:selection},root,bpmnFactory),commands.push(cmdHelper.addAndRemoveElementsFromList(element,root,"rootElements",null,[selectedElement]))}return props[referenceProperty]=selectedElement,commands.push(cmdHelper.updateBusinessObject(element,definition,props)),commands},addElement:function(element,inputNode){var id=utils.nextId(newElementIdPrefix),optionTemplate=domify('"),selectBox=getSelectBox(inputNode);return selectBox.insertBefore(optionTemplate,selectBox.firstChild),forEach(selectBox,function(option){option.value===id?domAttr(option,"selected","selected"):domAttr(option,"selected",null)}),!0}}),entries}},{"../../../../Utils":24,"../../../../helper/CmdHelper":42,"../../../../helper/ElementHelper":43,"lodash/collection/find":361,"lodash/collection/forEach":362,"min-dom/lib/attr":510,"min-dom/lib/domify":515,"min-dom/lib/query":518}],56:[function(require,module,exports){"use strict";var eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,messageEventDefinition){group.entries=group.entries.concat(eventDefinitionReference(element,messageEventDefinition,bpmnFactory,{label:"Message",elementName:"message",elementType:"bpmn:Message",referenceProperty:"messageRef",newElementIdPrefix:"Message_"})),group.entries=group.entries.concat(elementReferenceProperty(element,messageEventDefinition,bpmnFactory,{id:"message-element-name",label:"Message Name",referenceProperty:"messageRef",modelProperty:"name",shouldValidate:!0}))}},{"./ElementReferenceProperty":52,"./EventDefinitionReference":55}],57:[function(require,module,exports){"use strict";var eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,signalEventDefinition){group.entries=group.entries.concat(eventDefinitionReference(element,signalEventDefinition,bpmnFactory,{label:"Signal",elementName:"signal",elementType:"bpmn:Signal",referenceProperty:"signalRef",newElementIdPrefix:"Signal_"})),group.entries=group.entries.concat(elementReferenceProperty(element,signalEventDefinition,bpmnFactory,{id:"signal-element-name",label:"Signal Name",referenceProperty:"signalRef",modelProperty:"name",shouldValidate:!0}))}},{"./ElementReferenceProperty":52,"./EventDefinitionReference":55}],58:[function(require,module,exports){"use strict";function getTimerDefinitionType(timer){var timeDate=timer.get("timeDate");if("undefined"!=typeof timeDate)return"timeDate";var timeCycle=timer.get("timeCycle");if("undefined"!=typeof timeCycle)return"timeCycle";var timeDuration=timer.get("timeDuration");return"undefined"!=typeof timeDuration?"timeDuration":void 0}function createFormalExpression(parent,body,bpmnFactory){return body=body||void 0,elementHelper.createElement("bpmn:FormalExpression",{body:body},parent,bpmnFactory)}function TimerEventDefinition(group,element,bpmnFactory,timerEventDefinition){var selectOptions=[{value:"timeDate",name:"Date"},{value:"timeDuration",name:"Duration"},{value:"timeCycle",name:"Cycle"}];group.entries.push(entryFactory.selectBox({id:"timer-event-definition-type",label:"Timer Definition Type",selectOptions:selectOptions,emptyParameter:!0,modelProperty:"timerDefinitionType",get:function(element,node){return{timerDefinitionType:getTimerDefinitionType(timerEventDefinition)||""}},set:function(element,values){var props={timeDuration:void 0,timeDate:void 0,timeCycle:void 0},newType=values.timerDefinitionType;if(values.timerDefinitionType){var value,oldType=getTimerDefinitionType(timerEventDefinition);if(oldType){var definition=timerEventDefinition.get(oldType);value=definition.get("body")}props[newType]=createFormalExpression(timerEventDefinition,value,bpmnFactory)}return cmdHelper.updateBusinessObject(element,timerEventDefinition,props)}})),group.entries.push(entryFactory.textField({id:"timer-event-definition",label:"Timer Definition",modelProperty:"timerDefinition",get:function(element,node){var type=getTimerDefinitionType(timerEventDefinition),definition=type&&timerEventDefinition.get(type),value=definition&&definition.get("body");return{timerDefinition:value}},set:function(element,values){var type=getTimerDefinitionType(timerEventDefinition),definition=type&&timerEventDefinition.get(type);if(definition)return cmdHelper.updateBusinessObject(element,definition,{body:values.timerDefinition||void 0})},validate:function(element){var type=getTimerDefinitionType(timerEventDefinition),definition=type&&timerEventDefinition.get(type);if(definition){var value=definition.get("body");if(!value)return{timerDefinition:"Must provide a value"}}},disabled:function(element){return!getTimerDefinitionType(timerEventDefinition)}}))}var elementHelper=require("../../../../helper/ElementHelper"),cmdHelper=require("../../../../helper/CmdHelper"),entryFactory=require("../../../../factory/EntryFactory");module.exports=TimerEventDefinition},{"../../../../factory/EntryFactory":33,"../../../../helper/CmdHelper":42,"../../../../helper/ElementHelper":43}],59:[function(require,module,exports){"use strict";var properties=require("./implementation/Properties"),elementHelper=require("../../../helper/ElementHelper"),cmdHelper=require("../../../helper/CmdHelper");module.exports=function(group,element,bpmnFactory){var propertiesEntry=properties(element,bpmnFactory,{id:"properties",modelProperties:["name","value"],labels:["Name","Value"],getParent:function(element,node,bo){return bo.extensionElements},createParent:function(element,bo){var parent=elementHelper.createElement("bpmn:ExtensionElements",{values:[]},bo,bpmnFactory),cmd=cmdHelper.updateBusinessObject(element,bo,{extensionElements:parent});return{cmd:cmd,parent:parent}}});propertiesEntry&&group.entries.push(propertiesEntry)}},{"../../../helper/CmdHelper":42,"../../../helper/ElementHelper":43,"./implementation/Properties":60}],60:[function(require,module,exports){"use strict";function generatePropertyId(){return utils.nextId("Property_")}function getPropertyValues(parent){var properties=parent&&getPropertiesElement(parent);return properties&&properties.values?properties.values:[]}function getPropertiesElement(element){return isExtensionElements(element)?getPropertiesElementInsideExtensionElements(element):element.properties}function getPropertiesElementInsideExtensionElements(extensionElements){return find(extensionElements.values,function(elem){return is(elem,"camunda:Properties")})}function isExtensionElements(element){return is(element,"bpmn:ExtensionElements")}var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,is=require("bpmn-js/lib/util/ModelUtil").is,factory=require("../../../../factory/EntryFactory"),elementHelper=require("../../../../helper/ElementHelper"),extensionElementsHelper=require("../../../../helper/ExtensionElementsHelper"),cmdHelper=require("../../../../helper/CmdHelper"),utils=require("../../../../Utils"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find");module.exports=function(element,bpmnFactory,options){var getParent=options.getParent,modelProperties=options.modelProperties,createParent=options.createParent,bo=getBusinessObject(element);if(is(element,"bpmn:Participant")&&(bo=bo.get("processRef")),bo)return assign(options,{addLabel:"Add Property",getElements:function(element,node){var parent=getParent(element,node,bo);return getPropertyValues(parent)},addElement:function(element,node){var commands=[],parent=getParent(element,node,bo);if(!parent&&"function"==typeof createParent){ -var result=createParent(element,bo);parent=result.parent,commands.push(result.cmd)}var properties=getPropertiesElement(parent);properties||(properties=elementHelper.createElement("camunda:Properties",{},parent,bpmnFactory),isExtensionElements(parent)?commands.push(cmdHelper.addAndRemoveElementsFromList(element,parent,"values","extensionElements",[properties],[])):commands.push(cmdHelper.updateBusinessObject(element,parent,{properties:properties})));var propertyProps={};forEach(modelProperties,function(prop){propertyProps[prop]=void 0}),modelProperties.indexOf("id")>=0&&(propertyProps.id=generatePropertyId());var property=elementHelper.createElement("camunda:Property",propertyProps,properties,bpmnFactory);return commands.push(cmdHelper.addElementsTolist(element,properties,"values",[property])),commands},updateElement:function(element,value,node,idx){var parent=getParent(element,node,bo),property=getPropertyValues(parent)[idx];return forEach(modelProperties,function(prop){value[prop]=value[prop]||void 0}),cmdHelper.updateBusinessObject(element,property,value)},validate:function(element,value,node,idx){if(modelProperties.indexOf("id")>=0){var parent=getParent(element,node,bo),properties=getPropertyValues(parent),property=properties[idx];if(property){var validationError=utils.isIdValid(property,value.id);if(validationError)return{id:validationError}}}},removeElement:function(element,node,idx){var commands=[],parent=getParent(element,node,bo),properties=getPropertiesElement(parent),propertyValues=getPropertyValues(parent),currentProperty=propertyValues[idx];return commands.push(cmdHelper.removeElementsFromList(element,properties,"values",null,[currentProperty])),1===propertyValues.length&&(isExtensionElements(parent)?forEach(parent.values,function(value){is(value,"camunda:Properties")&&commands.push(extensionElementsHelper.removeEntry(bo,element,value))}):commands.push(cmdHelper.updateBusinessObject(element,parent,{properties:void 0}))),commands}}),factory.table(options)}},{"../../../../Utils":24,"../../../../factory/EntryFactory":33,"../../../../helper/CmdHelper":42,"../../../../helper/ElementHelper":43,"../../../../helper/ExtensionElementsHelper":45,"bpmn-js/lib/util/ModelUtil":153,"lodash/collection/find":361,"lodash/collection/forEach":362,"lodash/object/assign":495}],61:[function(require,module,exports){"use strict";function Modeler(options){Viewer.call(this,options),this.on("import.parse.complete",function(event){event.error||this._collectIds(event.definitions,event.context)},this),this.on("diagram.destroy",function(){this.moddle.ids.clear()},this)}var inherits=require("inherits"),Ids=require("ids"),Viewer=require("./Viewer"),NavigatedViewer=require("./NavigatedViewer"),initialDiagram='';inherits(Modeler,Viewer),module.exports=Modeler,module.exports.Viewer=Viewer,module.exports.NavigatedViewer=NavigatedViewer,Modeler.prototype.createDiagram=function(done){return this.importXML(initialDiagram,done)},Modeler.prototype._createModdle=function(options){var moddle=Viewer.prototype._createModdle.call(this,options);return moddle.ids=new Ids([32,36,1]),moddle},Modeler.prototype._collectIds=function(definitions,context){var id,moddle=definitions.$model,ids=moddle.ids;ids.clear();for(id in context.elementsById)ids.claim(id,context.elementsById[id])},Modeler.prototype._interactionModules=[require("diagram-js/lib/navigation/movecanvas"),require("diagram-js/lib/navigation/touch"),require("diagram-js/lib/navigation/zoomscroll")],Modeler.prototype._modelingModules=[require("diagram-js/lib/features/auto-scroll"),require("diagram-js/lib/features/bendpoints"),require("diagram-js/lib/features/move"),require("diagram-js/lib/features/resize"),require("./features/auto-resize"),require("./features/editor-actions"),require("./features/context-pad"),require("./features/keyboard"),require("./features/label-editing"),require("./features/modeling"),require("./features/palette"),require("./features/replace-preview"),require("./features/snapping")],Modeler.prototype._modules=[].concat(Modeler.prototype._modules,Modeler.prototype._interactionModules,Modeler.prototype._modelingModules)},{"./NavigatedViewer":62,"./Viewer":63,"./features/auto-resize":70,"./features/context-pad":72,"./features/editor-actions":78,"./features/keyboard":82,"./features/label-editing":86,"./features/modeling":124,"./features/palette":130,"./features/replace-preview":135,"./features/snapping":145,"diagram-js/lib/features/auto-scroll":195,"diagram-js/lib/features/bendpoints":201,"diagram-js/lib/features/move":262,"diagram-js/lib/features/resize":280,"diagram-js/lib/navigation/movecanvas":312,"diagram-js/lib/navigation/touch":313,"diagram-js/lib/navigation/zoomscroll":316,ids:346,inherits:347}],62:[function(require,module,exports){"use strict";function NavigatedViewer(options){Viewer.call(this,options)}var inherits=require("inherits"),Viewer=require("./Viewer");inherits(NavigatedViewer,Viewer),module.exports=NavigatedViewer,NavigatedViewer.prototype._navigationModules=[require("diagram-js/lib/navigation/zoomscroll"),require("diagram-js/lib/navigation/movecanvas")],NavigatedViewer.prototype._modules=[].concat(NavigatedViewer.prototype._modules,NavigatedViewer.prototype._navigationModules)},{"./Viewer":63,"diagram-js/lib/navigation/movecanvas":312,"diagram-js/lib/navigation/zoomscroll":316,inherits:347}],63:[function(require,module,exports){"use strict";function checkValidationError(err){var pattern=/unparsable content <([^>]+)> detected([\s\S]*)$/,match=pattern.exec(err.message);return match&&(err.message="unparsable content <"+match[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+match[2]),err}function ensureUnit(val){return val+(isNumber(val)?"px":"")}function Viewer(options){options=assign({},DEFAULT_OPTIONS,options),this.moddle=this._createModdle(options),this.container=this._createContainer(options),addProjectLogo(this.container),this._init(this.container,this.moddle,options)}function addProjectLogo(container){var logoData=PoweredBy.BPMNIO_LOGO,linkMarkup='',linkElement=domify(linkMarkup);container.appendChild(linkElement),domEvent.bind(linkElement,"click",function(event){PoweredBy.open(),event.preventDefault()})}var assign=require("lodash/object/assign"),omit=require("lodash/object/omit"),isString=require("lodash/lang/isString"),isNumber=require("lodash/lang/isNumber"),domify=require("min-dom/lib/domify"),domQuery=require("min-dom/lib/query"),domRemove=require("min-dom/lib/remove"),innerSVG=require("tiny-svg/lib/innerSVG"),Diagram=require("diagram-js"),BpmnModdle=require("bpmn-moddle"),inherits=require("inherits"),Importer=require("./import/Importer"),DEFAULT_OPTIONS={width:"100%",height:"100%",position:"relative",container:"body"};inherits(Viewer,Diagram),module.exports=Viewer,Viewer.prototype.importXML=function(xml,done){done=done||function(){};var self=this;xml=this._emit("import.parse.start",{xml:xml})||xml,this.moddle.fromXML(xml,"bpmn:Definitions",function(err,definitions,context){if(definitions=self._emit("import.parse.complete",{error:err,definitions:definitions,context:context})||definitions,err)return err=checkValidationError(err),self._emit("import.done",{error:err}),done(err);var parseWarnings=context.warnings;self.importDefinitions(definitions,function(err,importWarnings){var allWarnings=[].concat(parseWarnings,importWarnings||[]);self._emit("import.done",{error:err,warnings:allWarnings}),done(err,allWarnings)})})},Viewer.prototype.saveXML=function(options,done){done||(done=options,options={});var definitions=this.definitions;return definitions?void this.moddle.toXML(definitions,options,done):done(new Error("no definitions loaded"))},Viewer.prototype.saveSVG=function(options,done){done||(done=options,options={});var canvas=this.get("canvas"),contentNode=canvas.getDefaultLayer(),defsNode=domQuery("defs",canvas._svg),contents=innerSVG(contentNode),defs=defsNode&&defsNode.outerHTML||"",bbox=contentNode.getBBox(),svg='\n\n\n'+defs+contents+"";done(null,svg)},Viewer.prototype.importDefinitions=function(definitions,done){try{this.definitions&&this.clear(),this.definitions=definitions,Importer.importBpmnDiagram(this,definitions,done)}catch(e){done(e)}},Viewer.prototype.getModules=function(){return this._modules},Viewer.prototype.destroy=function(){Diagram.prototype.destroy.call(this),domRemove(this.container)},Viewer.prototype.on=function(event,priority,callback,target){return this.get("eventBus").on(event,priority,callback,target)},Viewer.prototype.off=function(event,callback){this.get("eventBus").off(event,callback)},Viewer.prototype._init=function(container,moddle,options){var baseModules=options.modules||this.getModules(),additionalModules=options.additionalModules||[],staticModules=[{bpmnjs:["value",this],moddle:["value",moddle]}],diagramModules=[].concat(staticModules,baseModules,additionalModules),diagramOptions=assign(omit(options,"additionalModules"),{canvas:assign({},options.canvas,{container:container}),modules:diagramModules});Diagram.call(this,diagramOptions)},Viewer.prototype._emit=function(type,event){return this.get("eventBus").fire(type,event)},Viewer.prototype._createContainer=function(options){var container,parent=options.container;return parent.get&&(parent=parent.get(0)),isString(parent)&&(parent=domQuery(parent)),container=domify('
'),assign(container.style,{width:ensureUnit(options.width),height:ensureUnit(options.height),position:options.position}),parent.appendChild(container),container},Viewer.prototype._createModdle=function(options){var moddleOptions=assign({},this._moddleExtensions,options.moddleExtensions);return new BpmnModdle(moddleOptions)},Viewer.prototype._modules=[require("./core"),require("diagram-js/lib/i18n/translate"),require("diagram-js/lib/features/selection"),require("diagram-js/lib/features/overlays")],Viewer.prototype._moddleExtensions={};var PoweredBy=require("./util/PoweredByUtil"),domEvent=require("min-dom/lib/event")},{"./core":64,"./import/Importer":148,"./util/PoweredByUtil":154,"bpmn-moddle":155,"diagram-js":173,"diagram-js/lib/features/overlays":267,"diagram-js/lib/features/selection":289,"diagram-js/lib/i18n/translate":304,inherits:347,"lodash/lang/isNumber":489,"lodash/lang/isString":492,"lodash/object/assign":495,"lodash/object/omit":502,"min-dom/lib/domify":515,"min-dom/lib/event":516,"min-dom/lib/query":518,"min-dom/lib/remove":519,"tiny-svg/lib/innerSVG":547}],64:[function(require,module,exports){module.exports={__depends__:[require("../draw"),require("../import")]}},{"../draw":67,"../import":150}],65:[function(require,module,exports){"use strict";function BpmnRenderer(eventBus,styles,pathMap,priority){function addMarker(id,element){markers[id]=element}function marker(id){var marker=markers[id];return"url(#"+marker.id+")"}function initMarkers(svg){function createMarker(id,options){var attrs=assign({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},options.attrs),ref=options.ref||{x:0,y:0},scale=options.scale||1;"none"===attrs.strokeDasharray&&(attrs.strokeDasharray=[1e4,1]);var marker=svgCreate("marker");svgAttr(options.element,attrs),svgAppend(marker,options.element),svgAttr(marker,{id:id,viewBox:"0 0 20 20",refX:ref.x,refY:ref.y,markerWidth:20*scale,markerHeight:20*scale,orient:"auto"});var defs=domQuery("defs",svg);return defs||(defs=svgCreate("defs"),svgAppend(svg,defs)),svgAppend(defs,marker),addMarker(id,marker)}var sequenceflowEnd=svgCreate("path");svgAttr(sequenceflowEnd,{d:"M 1 5 L 11 10 L 1 15 Z"}),createMarker("sequenceflow-end",{element:sequenceflowEnd,ref:{x:11,y:10},scale:.5});var messageflowStart=svgCreate("circle");svgAttr(messageflowStart,{cx:6,cy:6,r:3.5}),createMarker("messageflow-start",{element:messageflowStart,attrs:{fill:"white",stroke:"black"},ref:{x:6,y:6}});var messageflowEnd=svgCreate("path");svgAttr(messageflowEnd,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),createMarker("messageflow-end",{element:messageflowEnd,attrs:{fill:"white",stroke:"black",strokeLinecap:"butt"},ref:{x:8.5,y:5}});var associationStart=svgCreate("path");svgAttr(associationStart,{d:"M 11 5 L 1 10 L 11 15"}),createMarker("association-start",{element:associationStart,attrs:{fill:"none",stroke:"black",strokeWidth:1.5},ref:{x:1,y:10},scale:.5});var associationEnd=svgCreate("path");svgAttr(associationEnd,{d:"M 1 5 L 11 10 L 1 15"}),createMarker("association-end",{element:associationEnd,attrs:{fill:"none",stroke:"black",strokeWidth:1.5},ref:{x:12,y:10},scale:.5});var conditionalflowMarker=svgCreate("path");svgAttr(conditionalflowMarker,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),createMarker("conditional-flow-marker",{element:conditionalflowMarker,attrs:{fill:"white",stroke:"black"},ref:{x:-1,y:10},scale:.5});var conditionaldefaultflowMarker=svgCreate("path");svgAttr(conditionaldefaultflowMarker,{d:"M 1 4 L 5 16"}),createMarker("conditional-default-flow-marker",{element:conditionaldefaultflowMarker,attrs:{stroke:"black"},ref:{x:-5,y:10},scale:.5})}function drawCircle(parentGfx,width,height,offset,attrs){isObject(offset)&&(attrs=offset,offset=0),offset=offset||0,attrs=computeStyle(attrs,{stroke:"black",strokeWidth:2,fill:"white"});var cx=width/2,cy=height/2,circle=svgCreate("circle");return svgAttr(circle,{cx:cx,cy:cy,r:Math.round((width+height)/4-offset)}),svgAttr(circle,attrs),svgAppend(parentGfx,circle),circle}function drawRect(parentGfx,width,height,r,offset,attrs){isObject(offset)&&(attrs=offset,offset=0),offset=offset||0,attrs=computeStyle(attrs,{stroke:"black",strokeWidth:2,fill:"white"});var rect=svgCreate("rect");return svgAttr(rect,{x:offset,y:offset,width:width-2*offset,height:height-2*offset,rx:r,ry:r}),svgAttr(rect,attrs),svgAppend(parentGfx,rect),rect}function drawDiamond(parentGfx,width,height,attrs){var x_2=width/2,y_2=height/2,points=[{x:x_2,y:0},{x:width,y:y_2},{x:x_2,y:height},{x:0,y:y_2}],pointsString=points.map(function(point){return point.x+","+point.y}).join(" ");attrs=computeStyle(attrs,{stroke:"black",strokeWidth:2,fill:"white"});var polygon=svgCreate("polygon");return svgAttr(polygon,{points:pointsString}),svgAttr(polygon,attrs),svgAppend(parentGfx,polygon),polygon}function drawLine(parentGfx,waypoints,attrs){attrs=computeStyle(attrs,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"});var line=createLine(waypoints,attrs);return svgAppend(parentGfx,line),line}function drawPath(parentGfx,d,attrs){attrs=computeStyle(attrs,["no-fill"],{strokeWidth:2,stroke:"black"});var path=svgCreate("path");return svgAttr(path,{d:d}),svgAttr(path,attrs),svgAppend(parentGfx,path),path}function drawMarker(type,parentGfx,path,attrs){return drawPath(parentGfx,path,assign({"data-marker":type},attrs))}function as(type){return function(parentGfx,element){return handlers[type](parentGfx,element)}}function renderer(type){return handlers[type]}function renderEventContent(element,parentGfx){var event=getSemantic(element),isThrowing=isThrowEvent(event);return isTypedEvent(event,"bpmn:MessageEventDefinition")?renderer("bpmn:MessageEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:TimerEventDefinition")?renderer("bpmn:TimerEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:ConditionalEventDefinition")?renderer("bpmn:ConditionalEventDefinition")(parentGfx,element):isTypedEvent(event,"bpmn:SignalEventDefinition")?renderer("bpmn:SignalEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CancelEventDefinition")&&isTypedEvent(event,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?renderer("bpmn:MultipleEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CancelEventDefinition")&&isTypedEvent(event,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?renderer("bpmn:ParallelMultipleEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:EscalationEventDefinition")?renderer("bpmn:EscalationEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:LinkEventDefinition")?renderer("bpmn:LinkEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:ErrorEventDefinition")?renderer("bpmn:ErrorEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CancelEventDefinition")?renderer("bpmn:CancelEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CompensateEventDefinition")?renderer("bpmn:CompensateEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:TerminateEventDefinition")?renderer("bpmn:TerminateEventDefinition")(parentGfx,element,isThrowing):null}function renderLabel(parentGfx,label,options){var text=textUtil.createText(parentGfx,label||"",options);return svgClasses(text).add("djs-label"),text}function renderEmbeddedLabel(parentGfx,element,align){var semantic=getSemantic(element);return renderLabel(parentGfx,semantic.name,{box:element,align:align,padding:5})}function renderExternalLabel(parentGfx,element){var semantic=getSemantic(element),box={width:90,height:30,x:element.width/2+element.x,y:element.height/2+element.y};return renderLabel(parentGfx,semantic.name,{box:box,style:{fontSize:"11px"}})}function renderLaneLabel(parentGfx,text,element){var textBox=renderLabel(parentGfx,text,{box:{height:30,width:element.height},align:"center-middle"}),top=-1*element.height;transform(textBox,0,-top,270)}function createPathFromConnection(connection){for(var waypoints=connection.waypoints,pathData="m "+waypoints[0].x+","+waypoints[0].y,i=1;i=120&&assign(actions,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:translate("Divide into two Lanes"),action:{click:splitLaneHandler(2)}}}),element.height>=180&&assign(actions,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:translate("Divide into three Lanes"),action:{click:splitLaneHandler(3)}}})),assign(actions,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:translate("Add Lane below"),action:{click:function(event,element){modeling.addLane(element,"bottom")}}}})}is(businessObject,"bpmn:FlowNode")&&(is(businessObject,"bpmn:EventBasedGateway")?assign(actions,{"append.receive-task":appendAction("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",{eventDefinitionType:"bpmn:SignalEventDefinition"})}):isEventType(businessObject,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?assign(actions,{"append.compensation-activity":appendAction("bpmn:Task","bpmn-icon-task",translate("Append compensation activity"),{isForCompensation:!0})}):is(businessObject,"bpmn:EndEvent")||businessObject.isForCompensation||isEventType(businessObject,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||isEventSubProcess(businessObject)||assign(actions,{"append.end-event":appendAction("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":appendAction("bpmn:ExclusiveGateway","bpmn-icon-gateway-xor"),"append.append-task":appendAction("bpmn:Task","bpmn-icon-task"), -"append.intermediate-event":appendAction("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none")}));var replaceMenu;popupMenu._providers["bpmn-replace"]&&(replaceMenu=popupMenu.create("bpmn-replace",element)),replaceMenu&&!replaceMenu.isEmpty()&&assign(actions,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:translate("Change type"),action:{click:function(event,element){replaceMenu.open(assign(getReplaceMenuPosition(element),{cursor:{x:event.x,y:event.y}}),element)}}}}),isAny(businessObject,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&assign(actions,{"append.text-annotation":appendAction("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:translate("Connect using "+(businessObject.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:startConnect,dragstart:startConnect}}}),isAny(businessObject,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&assign(actions,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:translate("Connect using DataInputAssociation"),action:{click:startConnect,dragstart:startConnect}}});var deleteAllowed=rules.allowed("elements.delete",{elements:[element]});return isArray(deleteAllowed)&&(deleteAllowed=deleteAllowed[0]===element),deleteAllowed&&assign(actions,{delete:{group:"edit",className:"bpmn-icon-trash",title:translate("Remove"),action:{click:removeElement,dragstart:removeElement}}}),actions}},{"../../util/DiUtil":151,"../../util/ModelUtil":153,"../modeling/util/LaneUtil":125,"../modeling/util/ModelingUtil":126,"diagram-js/lib/util/Mouse":330,"lodash/collection/forEach":362,"lodash/lang/isArray":485,"lodash/object/assign":495}],72:[function(require,module,exports){module.exports={__depends__:[require("diagram-js-direct-editing"),require("diagram-js/lib/features/context-pad"),require("diagram-js/lib/features/selection"),require("diagram-js/lib/features/connect"),require("diagram-js/lib/features/create"),require("../popup-menu")],__init__:["contextPadProvider"],contextPadProvider:["type",require("./ContextPadProvider")]}},{"../popup-menu":132,"./ContextPadProvider":71,"diagram-js-direct-editing":170,"diagram-js/lib/features/connect":207,"diagram-js/lib/features/context-pad":209,"diagram-js/lib/features/create":213,"diagram-js/lib/features/selection":289}],73:[function(require,module,exports){"use strict";function setProperties(descriptor,data,properties){forEach(properties,function(property){void 0!==data[property]&&(descriptor[property]=data[property])})}function removeProperties(element,properties){forEach(properties,function(prop){element[prop]&&delete element[prop]})}function BpmnCopyPaste(bpmnFactory,eventBus,copyPaste,clipboard,moddle,canvas,bpmnRules){copyPaste.registerDescriptor(function(element,descriptor){var conditionExpression,eventDefinitions,businessObject=getBusinessObject(element);return descriptor.type=element.type,"label"===element.type?descriptor:(setProperties(descriptor,businessObject,["name","text","processRef","isInterrupting","isForCompensation","associationDirection","triggeredByEvent","cancelActivity"]),businessObject.default&&(descriptor.default=businessObject.default.id),businessObject.loopCharacteristics&&(descriptor.loopCharacteristics={type:businessObject.loopCharacteristics.$type,isSequential:businessObject.loopCharacteristics.isSequential}),setProperties(descriptor,businessObject.di,["isExpanded"]),is(businessObject,"bpmn:SequenceFlow")&&(conditionExpression=businessObject.get("conditionExpression"),conditionExpression&&(descriptor.conditionExpression={type:conditionExpression.$type,body:conditionExpression.body})),eventDefinitions=businessObject.get("eventDefinitions")||[],eventDefinitions.length&&(descriptor.eventDefinitions=map(eventDefinitions,function(defs){return defs.$type})),descriptor)}),eventBus.on("element.paste",function(context){var businessObject,newEventDefinition,conditionExpression,loopCharacteristics,source,target,canConnect,descriptor=context.descriptor,createdElements=context.createdElements,parent=descriptor.parent,rootElement=canvas.getRootElement();"label"!==descriptor.type&&(is(parent,"bpmn:Process")&&(descriptor.parent=is(rootElement,"bpmn:Collaboration")?rootElement:parent),"bpmn:DataOutputAssociation"!==descriptor.type&&"bpmn:DataInputAssociation"!==descriptor.type&&"bpmn:MessageFlow"!==descriptor.type||(descriptor.parent=rootElement),is(parent,"bpmn:Lane")&&(descriptor.parent=parent.parent),descriptor.waypoints&&(source=createdElements[descriptor.source],target=createdElements[descriptor.target],source&&target&&(source=source.element,target=target.element),canConnect=bpmnRules.canConnect(source,target),canConnect&&(descriptor.type=canConnect.type)),descriptor.businessObject=businessObject=bpmnFactory.create(descriptor.type),"bpmn:Participant"===descriptor.type&&descriptor.processRef&&(descriptor.processRef=businessObject.processRef=bpmnFactory.create("bpmn:Process")),setProperties(businessObject,descriptor,["name","text","isExpanded","isInterrupting","cancelActivity","triggeredByEvent"]),descriptor.loopCharacteristics&&(loopCharacteristics=descriptor.loopCharacteristics,businessObject.loopCharacteristics=moddle.create(loopCharacteristics.type),loopCharacteristics.isSequential&&(businessObject.loopCharacteristics.isSequential=!0),businessObject.loopCharacteristics.$parent=businessObject),descriptor.conditionExpression&&(conditionExpression=descriptor.conditionExpression,businessObject.conditionExpression=moddle.create(conditionExpression.type,{body:conditionExpression.body}),businessObject.conditionExpression.$parent=businessObject),descriptor.eventDefinitions&&(businessObject.eventDefinitions=map(descriptor.eventDefinitions,function(type){return newEventDefinition=moddle.create(type),newEventDefinition.$parent=businessObject,newEventDefinition})),removeProperties(descriptor,["name","text","eventDefinitions","conditionExpression","loopCharacteristics","isInterrupting","cancelActivity","triggeredByEvent"]))})}var ModelUtil=require("../../util/ModelUtil"),getBusinessObject=ModelUtil.getBusinessObject,is=ModelUtil.is,map=require("lodash/collection/map"),forEach=require("lodash/collection/forEach");BpmnCopyPaste.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","moddle","canvas","bpmnRules"],module.exports=BpmnCopyPaste},{"../../util/ModelUtil":153,"lodash/collection/forEach":362,"lodash/collection/map":366}],74:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/copy-paste")],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",require("./BpmnCopyPaste")]}},{"./BpmnCopyPaste":73,"diagram-js/lib/features/copy-paste":211}],75:[function(require,module,exports){"use strict";function BpmnDistributeElements(distributeElements){distributeElements.registerFilter(function(elements){return filter(elements,function(element){var cannotDistribute=isAny(element,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(element.labelTarget||cannotDistribute)})})}var filter=require("lodash/collection/filter"),isAny=require("../modeling/util/ModelingUtil").isAny;BpmnDistributeElements.$inject=["distributeElements"],module.exports=BpmnDistributeElements},{"../modeling/util/ModelingUtil":126,"lodash/collection/filter":360}],76:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/distribute-elements")],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",require("./BpmnDistributeElements")]}},{"./BpmnDistributeElements":75,"diagram-js/lib/features/distribute-elements":215}],77:[function(require,module,exports){"use strict";function BpmnEditorActions(injector,canvas,elementRegistry,selection,spaceTool,lassoTool,handTool,globalConnect,distributeElements,alignElements,directEditing,searchPad,modeling){injector.invoke(EditorActions,this),this.register({selectElements:function(){var rootElement=canvas.getRootElement(),elements=elementRegistry.filter(function(element){return element!==rootElement});return selection.select(elements),elements},spaceTool:function(){spaceTool.toggle()},lassoTool:function(){lassoTool.toggle()},handTool:function(){handTool.toggle()},globalConnectTool:function(){globalConnect.toggle()},distributeElements:function(opts){var currentSelection=selection.get(),type=opts.type;currentSelection.length&&distributeElements.trigger(currentSelection,type)},alignElements:function(opts){var currentSelection=selection.get(),aligneableElements=[],type=opts.type;currentSelection.length&&(aligneableElements=filter(currentSelection,function(element){return!is(element,"bpmn:Lane")}),alignElements.trigger(aligneableElements,type))},directEditing:function(){var currentSelection=selection.get();currentSelection.length&&directEditing.activate(currentSelection[0])},find:function(){searchPad.toggle()},moveToOrigin:function(){var boundingBox,elements,rootElement=canvas.getRootElement();elements=is(rootElement,"bpmn:Collaboration")?elementRegistry.filter(function(element){return is(element.parent,"bpmn:Collaboration")}):elementRegistry.filter(function(element){return element!==rootElement}),boundingBox=getBBox(elements),modeling.moveElements(elements,{x:-boundingBox.x,y:-boundingBox.y},rootElement)}})}var inherits=require("inherits"),EditorActions=require("diagram-js/lib/features/editor-actions/EditorActions"),filter=require("lodash/collection/filter"),is=require("../../util/ModelUtil").is,getBBox=require("diagram-js/lib/util/Elements").getBBox;inherits(BpmnEditorActions,EditorActions),BpmnEditorActions.$inject=["injector","canvas","elementRegistry","selection","spaceTool","lassoTool","handTool","globalConnect","distributeElements","alignElements","directEditing","searchPad","modeling"],module.exports=BpmnEditorActions},{"../../util/ModelUtil":153,"diagram-js/lib/features/editor-actions/EditorActions":219,"diagram-js/lib/util/Elements":322,inherits:347,"lodash/collection/filter":360}],78:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/align-elements"),require("diagram-js/lib/features/editor-actions"),require("diagram-js/lib/features/hand-tool"),require("diagram-js/lib/features/lasso-tool"),require("diagram-js/lib/features/space-tool"),require("../global-connect"),require("../copy-paste"),require("../distribute-elements"),require("../search"),require("../modeling")],editorActions:["type",require("./BpmnEditorActions")]}},{"../copy-paste":74,"../distribute-elements":76,"../global-connect":80,"../modeling":124,"../search":142,"./BpmnEditorActions":77,"diagram-js/lib/features/align-elements":189,"diagram-js/lib/features/editor-actions":220,"diagram-js/lib/features/hand-tool":224,"diagram-js/lib/features/lasso-tool":232,"diagram-js/lib/features/space-tool":296}],79:[function(require,module,exports){"use strict";function BpmnGlobalConnect(globalConnect){globalConnect.registerProvider(this)}function nonExistantOrLabel(element){return!element||isLabel(element)}function isLabel(element){return element.labelTarget}var isAny=require("../modeling/util/ModelingUtil").isAny;BpmnGlobalConnect.$inject=["globalConnect"],module.exports=BpmnGlobalConnect,BpmnGlobalConnect.prototype.canStartConnect=function(source){if(nonExistantOrLabel(source))return null;var businessObject=source.businessObject;return isAny(businessObject,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])}},{"../modeling/util/ModelingUtil":126}],80:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/global-connect")],__init__:["bpmnGlobalConnect"],bpmnGlobalConnect:["type",require("./BpmnGlobalConnect")]}},{"./BpmnGlobalConnect":79,"diagram-js/lib/features/global-connect":222}],81:[function(require,module,exports){"use strict";function BpmnKeyBindings(keyboard,editorActions){keyboard.addListener(function(key,modifiers){if(65===key&&keyboard.isCmd(modifiers))return editorActions.trigger("selectElements"),!0;if(70===key&&keyboard.isCmd(modifiers))return editorActions.trigger("find"),!0;if(!keyboard.hasModifier(modifiers))return 83===key?(editorActions.trigger("spaceTool"),!0):76===key?(editorActions.trigger("lassoTool"),!0):72===key?(editorActions.trigger("handTool"),!0):67===key?(editorActions.trigger("globalConnectTool"),!0):69===key?(editorActions.trigger("directEditing"),!0):void 0})}BpmnKeyBindings.$inject=["keyboard","editorActions"],module.exports=BpmnKeyBindings},{}],82:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/keyboard")],__init__:["bpmnKeyBindings"],bpmnKeyBindings:["type",require("./BpmnKeyBindings")]}},{"./BpmnKeyBindings":81,"diagram-js/lib/features/keyboard":228}],83:[function(require,module,exports){"use strict";function LabelEditingProvider(eventBus,canvas,directEditing,commandStack){this._canvas=canvas,this._commandStack=commandStack,directEditing.registerProvider(this),commandStack.registerHandler("element.updateLabel",UpdateLabelHandler),eventBus.on("element.dblclick",function(event){directEditing.activate(event.element)}),eventBus.on(["element.mousedown","drag.init","canvas.viewbox.changed"],function(event){directEditing.complete()}),eventBus.on(["commandStack.changed"],function(){directEditing.cancel()}),"ontouchstart"in document.documentElement||eventBus.on("create.end",500,function(e){var element=e.shape,canExecute=e.context.canExecute;canExecute&&(is(element,"bpmn:Task")||is(element,"bpmn:TextAnnotation")||is(element,"bpmn:SubProcess")&&!isExpanded(element))&&directEditing.activate(element)})}var UpdateLabelHandler=require("./cmd/UpdateLabelHandler"),LabelUtil=require("./LabelUtil"),is=require("../../util/ModelUtil").is,isExpanded=require("../../util/DiUtil").isExpanded,LINE_HEIGHT=14,PADDING=6;LabelEditingProvider.$inject=["eventBus","canvas","directEditing","commandStack"],module.exports=LabelEditingProvider,LabelEditingProvider.prototype.activate=function(element){var text=LabelUtil.getLabel(element);if(void 0!==text){var properties=this.getEditingBBox(element);return properties.text=text,properties}},LabelEditingProvider.prototype.getEditingBBox=function(element){var zoom,canvas=this._canvas,target=element.label||element,bbox=canvas.getAbsoluteBBox(target),mid={x:bbox.x+bbox.width/2,y:bbox.y+bbox.height/2},bounds={x:bbox.x,y:bbox.y},style={};return(is(element,"bpmn:Participant")&&isExpanded(element)||is(element,"bpmn:Lane"))&&(bounds.width=150,bounds.minHeight=LINE_HEIGHT+PADDING,bounds.maxHeight=2*LINE_HEIGHT+PADDING,bounds.x=bbox.x-bounds.width/2,bounds.y=mid.y-bounds.minHeight/2),(is(element,"bpmn:Task")||is(element,"bpmn:CallActivity")&&!isExpanded(element)||is(element,"bpmn:SubProcess")&&!isExpanded(element)||is(element,"bpmn:Participant")&&!isExpanded(element))&&(zoom=canvas.zoom(),zoom>1?(bounds.width=bbox.width,bounds.height=bbox.height):(bounds.width=bbox.width/zoom,bounds.height=bbox.height/zoom),zoom<1&&(bounds.x=bbox.x-(bounds.width/2-bbox.width/2),bounds.y=bbox.y-(bounds.height/2-bbox.height/2))),is(element,"bpmn:SubProcess")&&isExpanded(element)&&(bounds.width=element.width,bounds.maxHeight=3*LINE_HEIGHT+PADDING,bounds.x=mid.x-element.width/2),target.labelTarget&&(bounds.width=150,bounds.minHeight=LINE_HEIGHT+PADDING,bounds.x=mid.x-bounds.width/2),is(element,"bpmn:TextAnnotation")&&(bounds.minWidth=100,bounds.height=element.height,style.textAlign="left"),{bounds:bounds,style:style}},LabelEditingProvider.prototype.update=function(element,newLabel){this._commandStack.execute("element.updateLabel",{element:element,newLabel:newLabel})}},{"../../util/DiUtil":151,"../../util/ModelUtil":153,"./LabelUtil":84,"./cmd/UpdateLabelHandler":85}],84:[function(require,module,exports){"use strict";function getLabelAttr(semantic){return is(semantic,"bpmn:FlowElement")||is(semantic,"bpmn:Participant")||is(semantic,"bpmn:Lane")||is(semantic,"bpmn:SequenceFlow")||is(semantic,"bpmn:MessageFlow")?"name":is(semantic,"bpmn:TextAnnotation")?"text":void 0}var is=require("../../util/ModelUtil").is;module.exports.getLabel=function(element){var semantic=element.businessObject,attr=getLabelAttr(semantic);if(attr)return semantic[attr]||""},module.exports.setLabel=function(element,text,isExternal){var semantic=element.businessObject,attr=getLabelAttr(semantic);return attr&&(semantic[attr]=text),isExternal&&(element.hidden=!text),element}},{"../../util/ModelUtil":153}],85:[function(require,module,exports){"use strict";function UpdateLabelHandler(){function setText(element,text){var label=element.label||element,labelTarget=element.labelTarget||element;return LabelUtil.setLabel(label,text,labelTarget!==label),[label,labelTarget]}function execute(ctx){return ctx.oldLabel=LabelUtil.getLabel(ctx.element),setText(ctx.element,ctx.newLabel)}function revert(ctx){return setText(ctx.element,ctx.oldLabel)}this.execute=execute,this.revert=revert}var LabelUtil=require("../LabelUtil");module.exports=UpdateLabelHandler},{"../LabelUtil":84}],86:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/command"),require("diagram-js/lib/features/change-support"),require("diagram-js-direct-editing")],__init__:["labelEditingProvider"],labelEditingProvider:["type",require("./LabelEditingProvider")]}},{"./LabelEditingProvider":83,"diagram-js-direct-editing":170,"diagram-js/lib/command":177,"diagram-js/lib/features/change-support":203}],87:[function(require,module,exports){"use strict";function BpmnFactory(moddle){this._model=moddle}var map=require("lodash/collection/map"),assign=require("lodash/object/assign"),pick=require("lodash/object/pick");BpmnFactory.$inject=["moddle"],BpmnFactory.prototype._needsId=function(element){return element.$instanceOf("bpmn:RootElement")||element.$instanceOf("bpmn:FlowElement")||element.$instanceOf("bpmn:MessageFlow")||element.$instanceOf("bpmn:DataAssociation")||element.$instanceOf("bpmn:Artifact")||element.$instanceOf("bpmn:Participant")||element.$instanceOf("bpmn:Lane")||element.$instanceOf("bpmn:Process")||element.$instanceOf("bpmn:Collaboration")||element.$instanceOf("bpmndi:BPMNShape")||element.$instanceOf("bpmndi:BPMNEdge")||element.$instanceOf("bpmndi:BPMNDiagram")||element.$instanceOf("bpmndi:BPMNPlane")||element.$instanceOf("bpmn:Property")},BpmnFactory.prototype._ensureId=function(element){var prefix=(element.$type||"").replace(/^[^:]*:/g,"")+"_";!element.id&&this._needsId(element)&&(element.id=this._model.ids.nextPrefixed(prefix,element))},BpmnFactory.prototype.create=function(type,attrs){var element=this._model.create(type,attrs||{});return this._ensureId(element),element},BpmnFactory.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},BpmnFactory.prototype.createDiShape=function(semantic,bounds,attrs){return this.create("bpmndi:BPMNShape",assign({bpmnElement:semantic,bounds:this.createDiBounds(bounds)},attrs))},BpmnFactory.prototype.createDiBounds=function(bounds){return this.create("dc:Bounds",bounds)},BpmnFactory.prototype.createDiWaypoints=function(waypoints){return map(waypoints,function(pos){return this.createDiWaypoint(pos)},this)},BpmnFactory.prototype.createDiWaypoint=function(point){return this.create("dc:Point",pick(point,["x","y"]))},BpmnFactory.prototype.createDiEdge=function(semantic,waypoints,attrs){return this.create("bpmndi:BPMNEdge",assign({bpmnElement:semantic},attrs))},BpmnFactory.prototype.createDiPlane=function(semantic){return this.create("bpmndi:BPMNPlane",{bpmnElement:semantic})},module.exports=BpmnFactory},{"lodash/collection/map":366,"lodash/object/assign":495,"lodash/object/pick":504}],88:[function(require,module,exports){"use strict";function BpmnLayouter(){}function getAttachOrientation(attachedElement){var hostElement=attachedElement.host,padding=-10;return getOrientation(getMid(attachedElement),hostElement,padding)}function getConnectionDocking(point,shape){return point?point.original||point:getMid(shape)}function isCompensationAssociation(connection){var source=connection.source,target=connection.target;return is(target,"bpmn:Activity")&&is(source,"bpmn:BoundaryEvent")&&target.businessObject.isForCompensation}function isExpandedSubProcess(element){return is(element,"bpmn:SubProcess")&&isExpanded(element)}var inherits=require("inherits"),assign=require("lodash/object/assign"),BaseLayouter=require("diagram-js/lib/layout/BaseLayouter"),ManhattanLayout=require("diagram-js/lib/layout/ManhattanLayout"),LayoutUtil=require("diagram-js/lib/layout/LayoutUtil"),isExpanded=require("../../util/DiUtil").isExpanded,getMid=LayoutUtil.getMid,getOrientation=LayoutUtil.getOrientation,is=require("../../util/ModelUtil").is;inherits(BpmnLayouter,BaseLayouter),module.exports=BpmnLayouter,BpmnLayouter.prototype.layoutConnection=function(connection,hints){hints=hints||{};var manhattanOptions,updatedWaypoints,source=connection.source,target=connection.target,waypoints=connection.waypoints,start=hints.connectionStart,end=hints.connectionEnd;if(start||(start=getConnectionDocking(waypoints&&waypoints[0],source)),end||(end=getConnectionDocking(waypoints&&waypoints[waypoints.length-1],target)),(is(connection,"bpmn:Association")||is(connection,"bpmn:DataAssociation"))&&waypoints&&!isCompensationAssociation(connection))return[].concat([start],waypoints.slice(1,-1),[end]);if(is(connection,"bpmn:MessageFlow"))manhattanOptions={preferredLayouts:["v:v"]},is(target,"bpmn:Participant")&&(manhattanOptions={preferredLayouts:["straight","v:v"]}),isExpandedSubProcess(target)&&(manhattanOptions={preferredLayouts:["straight","v:v"]}),isExpandedSubProcess(source)&&is(target,"bpmn:FlowNode")&&(manhattanOptions={preferredLayouts:["straight","v:v"],preserveDocking:isExpandedSubProcess(target)?"source":"target"}),is(source,"bpmn:Participant")&&is(target,"bpmn:FlowNode")&&(manhattanOptions={preferredLayouts:["straight","v:v"],preserveDocking:"target"}),is(target,"bpmn:Event")&&(manhattanOptions={preferredLayouts:["v:v"]});else if(is(connection,"bpmn:SequenceFlow")||isCompensationAssociation(connection))if(is(source,"bpmn:BoundaryEvent")){var orientation=getAttachOrientation(source);/left|right/.test(orientation)?manhattanOptions={preferredLayouts:["h:v"]}:/top|bottom/.test(orientation)&&(manhattanOptions={preferredLayouts:["v:h"]})}else manhattanOptions=is(source,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:is(target,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]};return manhattanOptions&&(manhattanOptions=assign(manhattanOptions,hints),updatedWaypoints=ManhattanLayout.repairConnection(source,target,start,end,waypoints,manhattanOptions)),updatedWaypoints||[start,end]}},{"../../util/DiUtil":151,"../../util/ModelUtil":153,"diagram-js/lib/layout/BaseLayouter":306,"diagram-js/lib/layout/LayoutUtil":308,"diagram-js/lib/layout/ManhattanLayout":309,inherits:347,"lodash/object/assign":495}],89:[function(require,module,exports){"use strict";function BpmnUpdater(eventBus,bpmnFactory,connectionDocking,translate){function cropConnection(e){var connection,context=e.context;context.cropped||(connection=context.connection,connection.waypoints=connectionDocking.getCroppedWaypoints(connection),context.cropped=!0)}function updateParent(e){var context=e.context;self.updateParent(context.shape||context.connection,context.oldParent)}function reverseUpdateParent(e){var context=e.context,element=context.shape||context.connection,oldParent=context.parent||context.newParent;self.updateParent(element,oldParent)}function updateRoot(event){var context=event.context,oldRoot=context.oldRoot,children=oldRoot.children;forEach(children,function(child){is(child,"bpmn:BaseElement")&&self.updateParent(child)})}function updateBounds(e){var shape=e.context.shape;is(shape,"bpmn:BaseElement")&&self.updateBounds(shape)}function updateConnection(e){self.updateConnection(e.context)}function updateConnectionWaypoints(e){self.updateConnectionWaypoints(e.context.connection)}function updateAttachment(e){self.updateAttachment(e.context)}CommandInterceptor.call(this,eventBus),this._bpmnFactory=bpmnFactory,this._translate=translate;var self=this;this.executed(["connection.layout","connection.create","connection.reconnectEnd","connection.reconnectStart"],cropConnection),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ifBpmn(updateParent)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ifBpmn(reverseUpdateParent)),this.executed(["canvas.updateRoot"],updateRoot),this.reverted(["canvas.updateRoot"],updateRoot),this.executed(["shape.move","shape.create","shape.resize"],ifBpmn(function(event){"label"!==event.context.shape.type&&updateBounds(event)})),this.reverted(["shape.move","shape.create","shape.resize"],ifBpmn(function(event){"label"!==event.context.shape.type&&updateBounds(event)})),eventBus.on("shape.changed",function(event){"label"===event.element.type&&updateBounds({context:{shape:event.element}})}),this.executed(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnection)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnection)),this.executed(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnectionWaypoints)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnectionWaypoints)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],ifBpmn(function(e){var context=e.context,connection=context.connection,businessObject=getBusinessObject(connection),oldSource=getBusinessObject(context.oldSource),oldTarget=getBusinessObject(context.oldTarget),newSource=getBusinessObject(connection.source),newTarget=getBusinessObject(connection.target);oldSource!==newSource&&oldTarget!==newTarget&&(oldSource&&oldSource.default===businessObject&&(context.default=oldSource.default,oldSource.default=void 0),businessObject.sourceRef&&businessObject.sourceRef.default&&!(is(newTarget,"bpmn:Activity")||is(newTarget,"bpmn:EndEvent")||is(newTarget,"bpmn:Gateway")||is(newTarget,"bpmn:IntermediateThrowEvent"))&&(context.default=businessObject.sourceRef.default,businessObject.sourceRef.default=void 0),oldSource&&businessObject.conditionExpression&&!is(newSource,"bpmn:Activity")&&!is(newSource,"bpmn:Gateway")&&(context.conditionExpression=businessObject.conditionExpression,businessObject.conditionExpression=void 0),oldTarget&&businessObject.conditionExpression&&!(is(newTarget,"bpmn:Activity")||is(newTarget,"bpmn:EndEvent")||is(newTarget,"bpmn:Gateway")||is(newTarget,"bpmn:IntermediateThrowEvent"))&&(context.conditionExpression=businessObject.conditionExpression,businessObject.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],ifBpmn(function(e){var context=e.context,connection=context.connection,businessObject=getBusinessObject(connection),newSource=getBusinessObject(connection.source);context.default&&(is(newSource,"bpmn:ExclusiveGateway")||is(newSource,"bpmn:InclusiveGateway")||is(newSource,"bpmn:Activity"))&&(newSource.default=context.default),context.conditionExpression&&is(newSource,"bpmn:Activity")&&(businessObject.conditionExpression=context.conditionExpression)})),this.executed(["element.updateAttachment"],ifBpmn(updateAttachment)),this.reverted(["element.updateAttachment"],ifBpmn(updateAttachment))}function getDefinitions(element){for(;element&&!is(element,"bpmn:Definitions");)element=element.$parent;return element}function ifBpmn(fn){return function(event){var context=event.context,element=context.shape||context.connection;is(element,"bpmn:BaseElement")&&fn(event)}}var assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),inherits=require("inherits"),Collections=require("diagram-js/lib/util/Collections"),Model=require("diagram-js/lib/model"),getBusinessObject=require("../../util/ModelUtil").getBusinessObject,is=require("../../util/ModelUtil").is,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");inherits(BpmnUpdater,CommandInterceptor),module.exports=BpmnUpdater,BpmnUpdater.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],BpmnUpdater.prototype.updateAttachment=function(context){var shape=context.shape,businessObject=shape.businessObject,host=shape.host;businessObject.attachedToRef=host&&host.businessObject},BpmnUpdater.prototype.updateParent=function(element,oldParent){if(!(element instanceof Model.Label)){var parentShape=element.parent,businessObject=element.businessObject,parentBusinessObject=parentShape&&parentShape.businessObject,parentDi=parentBusinessObject&&parentBusinessObject.di;is(element,"bpmn:FlowNode")&&this.updateFlowNodeRefs(businessObject,parentBusinessObject,oldParent&&oldParent.businessObject),is(element,"bpmn:DataOutputAssociation")&&(parentBusinessObject=element.source?element.source.businessObject:null),is(element,"bpmn:DataInputAssociation")&&(parentBusinessObject=element.target?element.target.businessObject:null),this.updateSemanticParent(businessObject,parentBusinessObject),is(element,"bpmn:DataObjectReference")&&businessObject.dataObjectRef&&this.updateSemanticParent(businessObject.dataObjectRef,parentBusinessObject),this.updateDiParent(businessObject.di,parentDi)}},BpmnUpdater.prototype.updateBounds=function(shape){var di=shape.businessObject.di,bounds=shape instanceof Model.Label?this._getLabel(di).bounds:di.bounds;assign(bounds,{x:shape.x,y:shape.y,width:shape.width,height:shape.height})},BpmnUpdater.prototype.updateFlowNodeRefs=function(businessObject,newContainment,oldContainment){if(oldContainment!==newContainment){var oldRefs,newRefs;is(oldContainment,"bpmn:Lane")&&(oldRefs=oldContainment.get("flowNodeRef"),Collections.remove(oldRefs,businessObject)),is(newContainment,"bpmn:Lane")&&(newRefs=newContainment.get("flowNodeRef"),Collections.add(newRefs,businessObject))}},BpmnUpdater.prototype.updateDiConnection=function(di,newSource,newTarget){di.sourceElement&&di.sourceElement.bpmnElement!==newSource&&(di.sourceElement=newSource&&newSource.di),di.targetElement&&di.targetElement.bpmnElement!==newTarget&&(di.targetElement=newTarget&&newTarget.di)},BpmnUpdater.prototype.updateDiParent=function(di,parentDi){if(parentDi&&!is(parentDi,"bpmndi:BPMNPlane")&&(parentDi=parentDi.$parent),di.$parent!==parentDi){var planeElements=(parentDi||di.$parent).get("planeElement");parentDi?(planeElements.push(di),di.$parent=parentDi):(Collections.remove(planeElements,di),di.$parent=null)}},BpmnUpdater.prototype.getLaneSet=function(container){var laneSet,laneSets;return is(container,"bpmn:Lane")?(laneSet=container.childLaneSet,laneSet||(laneSet=this._bpmnFactory.create("bpmn:LaneSet"),container.childLaneSet=laneSet,laneSet.$parent=container),laneSet):(is(container,"bpmn:Participant")&&(container=container.processRef),laneSets=container.get("laneSets"),laneSet=laneSets[0],laneSet||(laneSet=this._bpmnFactory.create("bpmn:LaneSet"),laneSet.$parent=container,laneSets.push(laneSet)),laneSet)},BpmnUpdater.prototype.updateSemanticParent=function(businessObject,newParent,visualParent){var containment,translate=this._translate;if(businessObject.$parent!==newParent){if(is(businessObject,"bpmn:Lane"))newParent&&(newParent=this.getLaneSet(newParent)),containment="lanes";else if(is(businessObject,"bpmn:FlowElement")){if(newParent)if(is(newParent,"bpmn:Participant"))newParent=newParent.processRef;else if(is(newParent,"bpmn:Lane"))do newParent=newParent.$parent.$parent;while(is(newParent,"bpmn:Lane")); -containment="flowElements"}else if(is(businessObject,"bpmn:Artifact")){for(;newParent&&!is(newParent,"bpmn:Process")&&!is(newParent,"bpmn:SubProcess")&&!is(newParent,"bpmn:Collaboration");){if(is(newParent,"bpmn:Participant")){newParent=newParent.processRef;break}newParent=newParent.$parent}containment="artifacts"}else if(is(businessObject,"bpmn:MessageFlow"))containment="messageFlows";else if(is(businessObject,"bpmn:Participant")){containment="participants";var definitions,process=businessObject.processRef;process&&(definitions=getDefinitions(businessObject.$parent||newParent),businessObject.$parent&&(Collections.remove(definitions.get("rootElements"),process),process.$parent=null),newParent&&(Collections.add(definitions.get("rootElements"),process),process.$parent=definitions))}else is(businessObject,"bpmn:DataOutputAssociation")?containment="dataOutputAssociations":is(businessObject,"bpmn:DataInputAssociation")&&(containment="dataInputAssociations");if(!containment)throw new Error(translate("no parent for {element} in {parent}",{element:businessObject.id,parent:newParent.id}));var children;if(businessObject.$parent&&(children=businessObject.$parent.get(containment),Collections.remove(children,businessObject)),newParent?(children=newParent.get(containment),children.push(businessObject),businessObject.$parent=newParent):businessObject.$parent=null,visualParent){var diChildren=visualParent.get(containment);Collections.remove(children,businessObject),newParent&&(diChildren||(diChildren=[],newParent.set(containment,diChildren)),diChildren.push(businessObject))}}},BpmnUpdater.prototype.updateConnectionWaypoints=function(connection){connection.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(connection.waypoints))},BpmnUpdater.prototype.updateConnection=function(context){var visualParent,connection=context.connection,businessObject=getBusinessObject(connection),newSource=getBusinessObject(connection.source),newTarget=getBusinessObject(connection.target);if(is(businessObject,"bpmn:DataAssociation"))is(businessObject,"bpmn:DataInputAssociation")?(businessObject.get("sourceRef")[0]=newSource,visualParent=context.parent||context.newParent||newTarget,this.updateSemanticParent(businessObject,newTarget,parent.businessObject)):is(businessObject,"bpmn:DataOutputAssociation")&&(visualParent=context.parent||context.newParent||newSource,this.updateSemanticParent(businessObject,newSource,visualParent),businessObject.targetRef=newTarget);else{var inverseSet=is(businessObject,"bpmn:SequenceFlow");businessObject.sourceRef!==newSource&&(inverseSet&&(Collections.remove(businessObject.sourceRef&&businessObject.sourceRef.get("outgoing"),businessObject),newSource&&newSource.get("outgoing")&&newSource.get("outgoing").push(businessObject)),businessObject.sourceRef=newSource),businessObject.targetRef!==newTarget&&(inverseSet&&(Collections.remove(businessObject.targetRef&&businessObject.targetRef.get("incoming"),businessObject),newTarget&&newTarget.get("incoming")&&newTarget.get("incoming").push(businessObject)),businessObject.targetRef=newTarget)}this.updateConnectionWaypoints(connection),this.updateDiConnection(businessObject.di,newSource,newTarget)},BpmnUpdater.prototype._getLabel=function(di){return di.label||(di.label=this._bpmnFactory.createDiLabel()),di.label}},{"../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,"diagram-js/lib/model":310,"diagram-js/lib/util/Collections":319,inherits:347,"lodash/collection/forEach":362,"lodash/object/assign":495}],90:[function(require,module,exports){"use strict";function ElementFactory(bpmnFactory,moddle,translate){BaseElementFactory.call(this),this._bpmnFactory=bpmnFactory,this._moddle=moddle,this._translate=translate}var assign=require("lodash/object/assign"),inherits=require("inherits"),is=require("../../util/ModelUtil").is,isExpanded=require("../../util/DiUtil").isExpanded,BaseElementFactory=require("diagram-js/lib/core/ElementFactory"),LabelUtil=require("../../util/LabelUtil");inherits(ElementFactory,BaseElementFactory),ElementFactory.$inject=["bpmnFactory","moddle","translate"],module.exports=ElementFactory,ElementFactory.prototype.baseCreate=BaseElementFactory.prototype.create,ElementFactory.prototype.create=function(elementType,attrs){return"label"===elementType?this.baseCreate(elementType,assign({type:"label"},LabelUtil.DEFAULT_LABEL_SIZE,attrs)):this.createBpmnElement(elementType,attrs)},ElementFactory.prototype.createBpmnElement=function(elementType,attrs){var size,translate=this._translate;attrs=attrs||{};var businessObject=attrs.businessObject;if(!businessObject){if(!attrs.type)throw new Error(translate("no shape type specified"));businessObject=this._bpmnFactory.create(attrs.type)}businessObject.di||("root"===elementType?businessObject.di=this._bpmnFactory.createDiPlane(businessObject,[],{id:businessObject.id+"_di"}):"connection"===elementType?businessObject.di=this._bpmnFactory.createDiEdge(businessObject,[],{id:businessObject.id+"_di"}):businessObject.di=this._bpmnFactory.createDiShape(businessObject,{},{id:businessObject.id+"_di"})),attrs.processRef&&(businessObject.processRef=attrs.processRef),attrs.isExpanded&&(businessObject.di.isExpanded=attrs.isExpanded),is(businessObject,"bpmn:ExclusiveGateway")&&(businessObject.di.isMarkerVisible=!0),attrs.isInterrupting===!1&&(businessObject.isInterrupting=!1),attrs.associationDirection&&(businessObject.associationDirection=attrs.associationDirection);var eventDefinitions,newEventDefinition;return attrs.eventDefinitionType&&(eventDefinitions=businessObject.get("eventDefinitions")||[],newEventDefinition=this._moddle.create(attrs.eventDefinitionType),eventDefinitions.push(newEventDefinition),newEventDefinition.$parent=businessObject,businessObject.eventDefinitions=eventDefinitions),attrs.isForCompensation&&(businessObject.isForCompensation=!0),size=this._getDefaultSize(businessObject),attrs=assign({businessObject:businessObject,id:businessObject.id},size,attrs),this.baseCreate(elementType,attrs)},ElementFactory.prototype._getDefaultSize=function(semantic){return is(semantic,"bpmn:SubProcess")?isExpanded(semantic)?{width:350,height:200}:{width:100,height:80}:is(semantic,"bpmn:Task")?{width:100,height:80}:is(semantic,"bpmn:Gateway")?{width:50,height:50}:is(semantic,"bpmn:Event")?{width:36,height:36}:is(semantic,"bpmn:Participant")?isExpanded(semantic)?{width:600,height:250}:{width:400,height:100}:is(semantic,"bpmn:Lane")?{width:400,height:100}:is(semantic,"bpmn:DataObjectReference")?{width:36,height:50}:is(semantic,"bpmn:DataStoreReference")?{width:50,height:50}:is(semantic,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},ElementFactory.prototype.createParticipantShape=function(collapsed){var attrs={type:"bpmn:Participant"};return collapsed||(attrs.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(attrs)}},{"../../util/DiUtil":151,"../../util/LabelUtil":152,"../../util/ModelUtil":153,"diagram-js/lib/core/ElementFactory":179,inherits:347,"lodash/object/assign":495}],91:[function(require,module,exports){"use strict";function Modeling(eventBus,elementFactory,commandStack,bpmnRules){BaseModeling.call(this,eventBus,elementFactory,commandStack),this._bpmnRules=bpmnRules}var inherits=require("inherits"),BaseModeling=require("diagram-js/lib/features/modeling/Modeling"),UpdatePropertiesHandler=require("./cmd/UpdatePropertiesHandler"),UpdateCanvasRootHandler=require("./cmd/UpdateCanvasRootHandler"),AddLaneHandler=require("./cmd/AddLaneHandler"),SplitLaneHandler=require("./cmd/SplitLaneHandler"),ResizeLaneHandler=require("./cmd/ResizeLaneHandler"),UpdateFlowNodeRefsHandler=require("./cmd/UpdateFlowNodeRefsHandler"),IdClaimHandler=require("./cmd/IdClaimHandler");inherits(Modeling,BaseModeling),Modeling.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],module.exports=Modeling,Modeling.prototype.getHandlers=function(){var handlers=BaseModeling.prototype.getHandlers.call(this);return handlers["element.updateProperties"]=UpdatePropertiesHandler,handlers["canvas.updateRoot"]=UpdateCanvasRootHandler,handlers["lane.add"]=AddLaneHandler,handlers["lane.resize"]=ResizeLaneHandler,handlers["lane.split"]=SplitLaneHandler,handlers["lane.updateRefs"]=UpdateFlowNodeRefsHandler,handlers["id.updateClaim"]=IdClaimHandler,handlers},Modeling.prototype.updateLabel=function(element,newLabel){this._commandStack.execute("element.updateLabel",{element:element,newLabel:newLabel})},Modeling.prototype.connect=function(source,target,attrs,hints){var bpmnRules=this._bpmnRules;return attrs||(attrs=bpmnRules.canConnect(source,target)||{type:"bpmn:Association"}),this.createConnection(source,target,attrs,source.parent,hints)},Modeling.prototype.updateProperties=function(element,properties){this._commandStack.execute("element.updateProperties",{element:element,properties:properties})},Modeling.prototype.resizeLane=function(laneShape,newBounds,balanced){this._commandStack.execute("lane.resize",{shape:laneShape,newBounds:newBounds,balanced:balanced})},Modeling.prototype.addLane=function(targetLaneShape,location){var context={shape:targetLaneShape,location:location};return this._commandStack.execute("lane.add",context),context.newLane},Modeling.prototype.splitLane=function(targetLane,count){this._commandStack.execute("lane.split",{shape:targetLane,count:count})},Modeling.prototype.makeCollaboration=function(){var collaborationElement=this._create("root",{type:"bpmn:Collaboration"}),context={newRoot:collaborationElement};return this._commandStack.execute("canvas.updateRoot",context),collaborationElement},Modeling.prototype.updateLaneRefs=function(flowNodeShapes,laneShapes){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:flowNodeShapes,laneShapes:laneShapes})},Modeling.prototype.makeProcess=function(){var processElement=this._create("root",{type:"bpmn:Process"}),context={newRoot:processElement};this._commandStack.execute("canvas.updateRoot",context)},Modeling.prototype.claimId=function(id,moddleElement){this._commandStack.execute("id.updateClaim",{id:id,element:moddleElement,claiming:!0})},Modeling.prototype.unclaimId=function(id,moddleElement){this._commandStack.execute("id.updateClaim",{id:id,element:moddleElement})}},{"./cmd/AddLaneHandler":117,"./cmd/IdClaimHandler":118,"./cmd/ResizeLaneHandler":119,"./cmd/SplitLaneHandler":120,"./cmd/UpdateCanvasRootHandler":121,"./cmd/UpdateFlowNodeRefsHandler":122,"./cmd/UpdatePropertiesHandler":123,"diagram-js/lib/features/modeling/Modeling":233,inherits:347}],92:[function(require,module,exports){"use strict";function AppendBehavior(eventBus,elementFactory,bpmnRules){CommandInterceptor.call(this,eventBus),this.preExecute("shape.append",function(context){var source=context.source,shape=context.shape;context.position||(is(shape,"bpmn:TextAnnotation")?context.position={x:source.x+source.width/2+75,y:source.y-50-shape.height/2}:context.position={x:source.x+source.width+80+shape.width/2,y:source.y+source.height/2})},!0)}var inherits=require("inherits"),is=require("../../../util/ModelUtil").is,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");AppendBehavior.$inject=["eventBus","elementFactory","bpmnRules"],inherits(AppendBehavior,CommandInterceptor),module.exports=AppendBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],93:[function(require,module,exports){"use strict";function CopyPasteBehavior(eventBus,modeling,canvas){CommandInterceptor.call(this,eventBus),this.preExecute("elements.paste",1500,function(context){var topParent=context.topParent;if(topParent.parent||(context.topParent=canvas.getRootElement()),is(topParent,"bpmn:Lane"))do topParent=context.topParent=topParent.parent;while(is(topParent,"bpmn:Lane")||!is(topParent,"bpmn:Participant"))},!0),this.postExecute("elements.paste",function(context){var tree=context.tree,createdElements=tree.createdElements;forEach(createdElements,function(data){var defaultFlow,element=data.element,businessObject=element.businessObject,descriptor=data.descriptor;(is(businessObject,"bpmn:ExclusiveGateway")||is(businessObject,"bpmn:InclusiveGateway")||is(businessObject,"bpmn:Activity"))&&descriptor.default&&(defaultFlow=createdElements[descriptor.default],defaultFlow=defaultFlow?defaultFlow.element:void 0,delete element.default,modeling.updateProperties(element,{default:defaultFlow}))})},!0)}var inherits=require("inherits"),forEach=require("lodash/collection/forEach"),is=require("../../../util/ModelUtil").is,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");CopyPasteBehavior.$inject=["eventBus","modeling","canvas"],inherits(CopyPasteBehavior,CommandInterceptor),module.exports=CopyPasteBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347,"lodash/collection/forEach":362}],94:[function(require,module,exports){"use strict";function CreateBoundaryEventBehavior(eventBus,modeling,elementFactory,bpmnFactory){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(context){var businessObject,boundaryEvent,shape=context.shape,host=context.host,attrs={cancelActivity:!0};host&&is(shape,"bpmn:IntermediateThrowEvent")&&(attrs.attachedToRef=host.businessObject,businessObject=bpmnFactory.create("bpmn:BoundaryEvent",attrs),boundaryEvent={type:"bpmn:BoundaryEvent",businessObject:businessObject},context.shape=elementFactory.createShape(boundaryEvent))},!0)}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;CreateBoundaryEventBehavior.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],inherits(CreateBoundaryEventBehavior,CommandInterceptor),module.exports=CreateBoundaryEventBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],95:[function(require,module,exports){"use strict";function CreateDataObjectBehavior(eventBus,bpmnFactory,moddle){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(event){var context=event.context,shape=context.shape;if(is(shape,"bpmn:DataObjectReference")&&"label"!==shape.type){var dataObject=bpmnFactory.create("bpmn:DataObject");shape.businessObject.dataObjectRef=dataObject}})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;CreateDataObjectBehavior.$inject=["eventBus","bpmnFactory","moddle"],inherits(CreateDataObjectBehavior,CommandInterceptor),module.exports=CreateDataObjectBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],96:[function(require,module,exports){"use strict";function copy(obj){return assign({},obj)}function CreateOnFlowBehavior(eventBus,bpmnRules,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(context){var parent=context.parent,shape=context.shape;bpmnRules.canInsert(shape,parent)&&(context.targetFlow=parent,context.parent=parent.parent)},!0),this.postExecute("shape.create",function(context){var source,target,reconnected,intersection,waypoints,waypointsBefore,waypointsAfter,dockingPoint,shape=context.shape,targetFlow=context.targetFlow,position=context.position;targetFlow&&(waypoints=targetFlow.waypoints,intersection=getApproxIntersection(waypoints,position),intersection&&(waypointsBefore=waypoints.slice(0,intersection.index),waypointsAfter=waypoints.slice(intersection.index+(intersection.bendpoint?1:0)),dockingPoint=intersection.bendpoint?waypoints[intersection.index]:position,waypointsBefore.push(copy(dockingPoint)),waypointsAfter.unshift(copy(dockingPoint))),source=targetFlow.source,target=targetFlow.target,bpmnRules.canConnect(source,shape,targetFlow)&&(modeling.reconnectEnd(targetFlow,shape,waypointsBefore||copy(position)),reconnected=!0),bpmnRules.canConnect(shape,target,targetFlow)&&(reconnected?modeling.connect(shape,target,{type:targetFlow.type,waypoints:waypointsAfter}):modeling.reconnectStart(targetFlow,shape,waypointsAfter||copy(position))))},!0)}var inherits=require("inherits"),assign=require("lodash/object/assign"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),getApproxIntersection=require("diagram-js/lib/util/LineIntersection").getApproxIntersection;inherits(CreateOnFlowBehavior,CommandInterceptor),CreateOnFlowBehavior.$inject=["eventBus","bpmnRules","modeling"],module.exports=CreateOnFlowBehavior},{"diagram-js/lib/command/CommandInterceptor":175,"diagram-js/lib/util/LineIntersection":328,inherits:347,"lodash/object/assign":495}],97:[function(require,module,exports){"use strict";function CreateParticipantBehavior(eventBus,modeling,elementFactory,bpmnFactory,canvas){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(context){var parent=context.parent,shape=context.shape,position=context.position,rootElement=canvas.getRootElement();if(is(parent,"bpmn:Process")&&is(shape,"bpmn:Participant")&&!is(rootElement,"bpmn:Collaboration")){var collaborationElement=modeling.makeCollaboration();context.position=position,context.parent=collaborationElement,context.processRoot=parent}},!0),this.execute("shape.create",function(context){var processRoot=context.processRoot,shape=context.shape;processRoot&&(context.oldProcessRef=shape.businessObject.processRef,shape.businessObject.processRef=processRoot.businessObject)},!0),this.revert("shape.create",function(context){var processRoot=context.processRoot,shape=context.shape;processRoot&&(shape.businessObject.processRef=context.oldProcessRef)},!0),this.postExecute("shape.create",function(context){var processRoot=context.processRoot,shape=context.shape;if(processRoot){var processChildren=processRoot.children.slice();modeling.moveElements(processChildren,{x:0,y:0},shape)}},!0)}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;CreateParticipantBehavior.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],inherits(CreateParticipantBehavior,CommandInterceptor),module.exports=CreateParticipantBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],98:[function(require,module,exports){"use strict";function DataInputAssociationBehavior(eventBus,bpmnFactory){function usesTargetRef(element,targetRef,removedConnection){var inputAssociations=element.get("dataInputAssociations");return find(inputAssociations,function(association){return association!==removedConnection&&association.targetRef===targetRef})}function getTargetRef(element,create){var properties=element.get("properties"),targetRefProp=find(properties,function(p){return p.name===TARGET_REF_PLACEHOLDER_NAME});return!targetRefProp&&create&&(targetRefProp=bpmnFactory.create("bpmn:Property",{name:TARGET_REF_PLACEHOLDER_NAME}),Collections.add(properties,targetRefProp)),targetRefProp}function cleanupTargetRef(element,connection){var targetRefProp=getTargetRef(element);targetRefProp&&(usesTargetRef(element,targetRefProp,connection)||Collections.remove(element.get("properties"),targetRefProp))}function fixTargetRef(event){var targetRefProp,context=event.context,connection=context.connection,connectionBo=connection.businessObject,target=connection.target,targetBo=target&&target.businessObject,newTarget=context.newTarget,newTargetBo=newTarget&&newTarget.businessObject,oldTarget=context.oldTarget||context.target,oldTargetBo=oldTarget&&oldTarget.businessObject,dataAssociation=connection.businessObject;oldTargetBo&&oldTargetBo!==targetBo&&cleanupTargetRef(oldTargetBo,connectionBo),newTargetBo&&newTargetBo!==targetBo&&cleanupTargetRef(newTargetBo,connectionBo),targetBo?(targetRefProp=getTargetRef(targetBo,!0),dataAssociation.targetRef=targetRefProp):dataAssociation.targetRef=null}CommandInterceptor.call(this,eventBus),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],ifDataInputAssociation(fixTargetRef)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],ifDataInputAssociation(fixTargetRef))}function ifDataInputAssociation(fn){return function(event){var context=event.context,connection=context.connection;if(is(connection,"bpmn:DataInputAssociation"))return fn(event)}}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),Collections=require("diagram-js/lib/util/Collections"),find=require("lodash/collection/find"),is=require("../../../util/ModelUtil").is,TARGET_REF_PLACEHOLDER_NAME="__targetRef_placeholder";DataInputAssociationBehavior.$inject=["eventBus","bpmnFactory"],inherits(DataInputAssociationBehavior,CommandInterceptor),module.exports=DataInputAssociationBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,"diagram-js/lib/util/Collections":319,inherits:347,"lodash/collection/find":361}],99:[function(require,module,exports){"use strict";function DeleteLaneBehavior(eventBus,modeling,spaceTool){function compensateLaneDelete(shape,oldParent){var siblings=getChildLanes(oldParent),topAffected=[],bottomAffected=[];if(eachElement(siblings,function(element){return element.y>shape.y?bottomAffected.push(element):topAffected.push(element),element.children}),siblings.length){var offset;offset=bottomAffected.length&&topAffected.length?shape.height/2:shape.height;var topAdjustments,bottomAdjustments;topAffected.length&&(topAdjustments=spaceTool.calculateAdjustments(topAffected,"y",offset,shape.y-10),spaceTool.makeSpace(topAdjustments.movingShapes,topAdjustments.resizingShapes,{x:0,y:offset},"s")),bottomAffected.length&&(bottomAdjustments=spaceTool.calculateAdjustments(bottomAffected,"y",-offset,shape.y+shape.height+10),spaceTool.makeSpace(bottomAdjustments.movingShapes,bottomAdjustments.resizingShapes,{x:0,y:-offset},"n"))}}CommandInterceptor.call(this,eventBus),this.postExecuted("shape.delete",LOW_PRIORITY,function(event){var context=event.context,hints=context.hints,shape=context.shape,oldParent=context.oldParent;is(shape,"bpmn:Lane")&&(hints&&hints.nested||compensateLaneDelete(shape,oldParent))})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is,getChildLanes=require("../util/LaneUtil").getChildLanes,eachElement=require("diagram-js/lib/util/Elements").eachElement,LOW_PRIORITY=500;DeleteLaneBehavior.$inject=["eventBus","modeling","spaceTool"],inherits(DeleteLaneBehavior,CommandInterceptor),module.exports=DeleteLaneBehavior},{"../../../util/ModelUtil":153,"../util/LaneUtil":125,"diagram-js/lib/command/CommandInterceptor":175,"diagram-js/lib/util/Elements":322,inherits:347}],100:[function(require,module,exports){"use strict";function ImportDockingFix(eventBus){function adjustDocking(startPoint,nextPoint,elementMid){var centerIntersect,elementTop={x:elementMid.x,y:elementMid.y-50},elementLeft={x:elementMid.x-50,y:elementMid.y},verticalIntersect=lineIntersect(startPoint,nextPoint,elementMid,elementTop),horizontalIntersect=lineIntersect(startPoint,nextPoint,elementMid,elementLeft);centerIntersect=verticalIntersect&&horizontalIntersect?getDistance(verticalIntersect,elementMid)>getDistance(horizontalIntersect,elementMid)?horizontalIntersect:verticalIntersect:verticalIntersect||horizontalIntersect,startPoint.original=centerIntersect}function fixDockings(connection){var waypoints=connection.waypoints;adjustDocking(waypoints[0],waypoints[1],getMid(connection.source)),adjustDocking(waypoints[waypoints.length-1],waypoints[waypoints.length-2],getMid(connection.target))}eventBus.on("bpmnElement.added",function(e){var element=e.element;element.waypoints&&fixDockings(element)})}function getDistance(p1,p2){return Math.sqrt(Math.pow(p1.x-p2.x,2)+Math.pow(p1.y-p2.y,2))}var getMid=require("diagram-js/lib/layout/LayoutUtil").getMid,lineIntersect=require("./util/LineIntersect");ImportDockingFix.$inject=["eventBus"],module.exports=ImportDockingFix},{"./util/LineIntersect":116,"diagram-js/lib/layout/LayoutUtil":308}],101:[function(require,module,exports){"use strict";function LabelSupport(eventBus,modeling,bpmnFactory){function getHiddenLabelAdjustment(event){var context=event.context,connection=context.connection,label=connection.label,labelPosition=getExternalLabelMid(connection);return{x:labelPosition.x-label.x-label.width/2,y:labelPosition.y-label.y-label.height/2}}function getVisibleLabelAdjustment(event){var command=event.command,context=event.context,connection=context.connection,label=connection.label,hints=assign({},context.hints),newWaypoints=context.newWaypoints||connection.waypoints,oldWaypoints=context.oldWaypoints;return"undefined"==typeof hints.startChanged&&(hints.startChanged="connection.reconnectStart"===command),"undefined"==typeof hints.endChanged&&(hints.endChanged="connection.reconnectEnd"===command),getLabelAdjustment(label,newWaypoints,oldWaypoints,hints)}CommandInterceptor.call(this,eventBus),this.postExecute(["shape.create","connection.create"],function(e){var position,context=e.context,element=context.shape||context.connection,businessObject=element.businessObject;hasExternalLabel(businessObject)&&(position=getExternalLabelMid(element),modeling.createLabel(element,position,{id:businessObject.id+"_label",hidden:!businessObject.name,businessObject:businessObject}))}),this.executed(["label.create"],function(event){var businessObject,di,element=event.context.shape;element.labelTarget&&is(element.labelTarget||element,"bpmn:BaseElement")&&(businessObject=element.businessObject,di=businessObject.di,di.label||(di.label=bpmnFactory.create("bpmndi:BPMNLabel",{bounds:bpmnFactory.create("dc:Bounds")})),assign(di.label.bounds,{x:element.x,y:element.y,width:element.width,height:element.height}))}),this.postExecute(["connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(event){var labelAdjustment,label=event.context.connection.label;label&&(labelAdjustment=label.hidden?getHiddenLabelAdjustment(event):getVisibleLabelAdjustment(event),modeling.moveShape(label,labelAdjustment))}),this.postExecute(["shape.replace"],function(event){var context=event.context,newShape=context.newShape,oldShape=context.oldShape,businessObject=getBusinessObject(newShape);businessObject&&hasExternalLabel(businessObject)&&(newShape.label.x=oldShape.label.x,newShape.label.y=oldShape.label.y)})}var assign=require("lodash/object/assign"),inherits=require("inherits"),LabelUtil=require("../../../util/LabelUtil"),LabelLayoutUtil=require("./util/LabelLayoutUtil"),ModelUtil=require("../../../util/ModelUtil"),is=ModelUtil.is,getBusinessObject=ModelUtil.getBusinessObject,hasExternalLabel=LabelUtil.hasExternalLabel,getExternalLabelMid=LabelUtil.getExternalLabelMid,getLabelAdjustment=LabelLayoutUtil.getLabelAdjustment,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");inherits(LabelSupport,CommandInterceptor),LabelSupport.$inject=["eventBus","modeling","bpmnFactory"],module.exports=LabelSupport},{"../../../util/LabelUtil":152,"../../../util/ModelUtil":153,"./util/LabelLayoutUtil":114,"diagram-js/lib/command/CommandInterceptor":175,inherits:347,"lodash/object/assign":495}],102:[function(require,module,exports){"use strict";function ModelingFeedback(eventBus,tooltips,translate){function showError(position,message,timeout){tooltips.add({position:{x:position.x+5,y:position.y+5},type:"error",timeout:timeout||2e3,html:"
"+message+"
"})}eventBus.on(["shape.move.rejected","create.rejected"],function(event){var context=event.context,shape=context.shape,target=context.target;is(target,"bpmn:Collaboration")&&is(shape,"bpmn:FlowNode")&&showError(event,translate(COLLAB_ERR_MSG))}),eventBus.on(["elements.paste.rejected"],function(event){var context=event.context,position=context.position,target=context.target;is(target,"bpmn:Collaboration")&&showError(position,translate(COLLAB_ERR_MSG)),is(target,"bpmn:Process")&&showError(position,translate(PROCESS_ERR_MSG),3e3)})}var is=require("../../../util/ModelUtil").is,COLLAB_ERR_MSG="flow elements must be children of pools/participants",PROCESS_ERR_MSG="participants cannot be pasted onto a non-empty process diagram";ModelingFeedback.$inject=["eventBus","tooltips","translate"],module.exports=ModelingFeedback},{"../../../util/ModelUtil":153}],103:[function(require,module,exports){"use strict";function RemoveElementBehavior(eventBus,bpmnRules,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("shape.delete",function(e){var shape=e.context.shape;if(1==shape.incoming.length&&1==shape.outgoing.length){var inConnection=shape.incoming[0],outConnection=shape.outgoing[0];if(bpmnRules.canConnect(inConnection.source,outConnection.target,inConnection)){var newWaypoints=getNewWaypoints(inConnection.waypoints,outConnection.waypoints);modeling.reconnectEnd(inConnection,outConnection.target,newWaypoints)}}})}function getDocking(point){return point.original||point}function getNewWaypoints(inWaypoints,outWaypoints){var intersection=lineIntersect(getDocking(inWaypoints[inWaypoints.length-2]),getDocking(inWaypoints[inWaypoints.length-1]),getDocking(outWaypoints[1]),getDocking(outWaypoints[0]));return intersection?[].concat(inWaypoints.slice(0,inWaypoints.length-1),[intersection],outWaypoints.slice(1)):[getDocking(inWaypoints[0]),getDocking(outWaypoints[outWaypoints.length-1])]}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),lineIntersect=require("./util/LineIntersect");inherits(RemoveElementBehavior,CommandInterceptor),RemoveElementBehavior.$inject=["eventBus","bpmnRules","modeling"],module.exports=RemoveElementBehavior},{"./util/LineIntersect":116,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],104:[function(require,module,exports){"use strict";function RemoveParticipantBehavior(eventBus,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("shape.delete",function(context){var shape=context.shape,parent=shape.parent;is(shape,"bpmn:Participant")&&(context.collaborationRoot=parent)},!0),this.postExecute("shape.delete",function(context){var collaborationRoot=context.collaborationRoot;collaborationRoot&&!collaborationRoot.businessObject.participants.length&&modeling.makeProcess()},!0)}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;RemoveParticipantBehavior.$inject=["eventBus","modeling"],inherits(RemoveParticipantBehavior,CommandInterceptor),module.exports=RemoveParticipantBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],105:[function(require,module,exports){"use strict";function ReplaceConnectionBehavior(eventBus,modeling,bpmnRules){function fixConnection(connection){var source=connection.source,target=connection.target,parent=connection.parent;if(parent){var replacementType,remove;is(connection,"bpmn:SequenceFlow")&&(bpmnRules.canConnectSequenceFlow(source,target)||(remove=!0),bpmnRules.canConnectMessageFlow(source,target)&&(replacementType="bpmn:MessageFlow")),is(connection,"bpmn:MessageFlow")&&(bpmnRules.canConnectMessageFlow(source,target)||(remove=!0),bpmnRules.canConnectSequenceFlow(source,target)&&(replacementType="bpmn:SequenceFlow")),is(connection,"bpmn:Association")&&!bpmnRules.canConnectAssociation(source,target)&&(remove=!0),remove&&modeling.removeConnection(connection),replacementType&&modeling.connect(source,target,{type:replacementType,waypoints:connection.waypoints.slice()})}}CommandInterceptor.call(this,eventBus),this.postExecuted("elements.move",function(context){var closure=context.closure,allConnections=closure.allConnections;forEach(allConnections,fixConnection)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(event){var connection=event.context.connection; -fixConnection(connection)}),this.postExecuted("element.updateProperties",function(event){var connection,context=event.context,properties=context.properties,element=context.element,businessObject=element.businessObject;properties.default&&(connection=find(element.outgoing,{id:element.businessObject.default.id}),connection&&modeling.updateProperties(connection,{conditionExpression:void 0})),properties.conditionExpression&&businessObject.sourceRef.default===businessObject&&modeling.updateProperties(element.source,{default:void 0})})}var forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;inherits(ReplaceConnectionBehavior,CommandInterceptor),ReplaceConnectionBehavior.$inject=["eventBus","modeling","bpmnRules"],module.exports=ReplaceConnectionBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347,"lodash/collection/find":361,"lodash/collection/forEach":362}],106:[function(require,module,exports){"use strict";function ReplaceElementBehaviour(eventBus,bpmnReplace,bpmnRules,elementRegistry,selection,modeling){CommandInterceptor.call(this,eventBus),this._bpmnReplace=bpmnReplace,this._elementRegistry=elementRegistry,this._selection=selection,this._modeling=modeling,this.postExecuted(["elements.move"],500,function(event){var context=event.context,target=context.newParent,newHost=context.newHost,elements=[];forEach(context.closure.topLevel,function(topLevelElements){elements=isEventSubProcess(topLevelElements)?elements.concat(topLevelElements.children):elements.concat(topLevelElements)}),1===elements.length&&newHost&&(target=newHost);var canReplace=bpmnRules.canReplace(elements,target);canReplace&&this.replaceElements(elements,canReplace.replacements,newHost)},this),this.postExecute(["shape.replace"],1500,function(e){var canReplace,context=e.context,oldShape=context.oldShape,newShape=context.newShape,attachers=oldShape.attachers;attachers&&attachers.length&&(canReplace=bpmnRules.canReplace(attachers,newShape),this.replaceElements(attachers,canReplace.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var context=e.context,oldShape=context.oldShape,newShape=context.newShape;modeling.unclaimId(oldShape.businessObject.id,oldShape.businessObject),modeling.updateProperties(newShape,{id:oldShape.id})})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),forEach=require("lodash/collection/forEach"),isEventSubProcess=require("../../../util/DiUtil").isEventSubProcess,is=require("../../../util/ModelUtil").is;inherits(ReplaceElementBehaviour,CommandInterceptor),ReplaceElementBehaviour.prototype.replaceElements=function(elements,newElements,newHost){var elementRegistry=this._elementRegistry,bpmnReplace=this._bpmnReplace,selection=this._selection,modeling=this._modeling;forEach(newElements,function(replacement){var newElement={type:replacement.newElementType},oldElement=elementRegistry.get(replacement.oldElementId);newHost&&is(oldElement,"bpmn:BoundaryEvent")&&modeling.updateAttachment(oldElement,null);var idx=elements.indexOf(oldElement);elements[idx]=bpmnReplace.replaceElement(oldElement,newElement,{select:!1}),newHost&&is(elements[idx],"bpmn:BoundaryEvent")&&modeling.updateAttachment(elements[idx],newHost)}),newElements&&selection.select(elements)},ReplaceElementBehaviour.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"],module.exports=ReplaceElementBehaviour},{"../../../util/DiUtil":151,"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347,"lodash/collection/forEach":362}],107:[function(require,module,exports){"use strict";function ResizeLaneBehavior(eventBus,modeling){eventBus.on("resize.start",SLIGHTLY_HIGHER_PRIORITY+500,function(event){var context=event.context,shape=context.shape;(is(shape,"bpmn:Lane")||is(shape,"bpmn:Participant"))&&(context.balanced=!hasPrimaryModifier(event))}),eventBus.on("resize.end",SLIGHTLY_HIGHER_PRIORITY,function(event){var context=event.context,shape=context.shape,canExecute=context.canExecute,newBounds=context.newBounds;if(is(shape,"bpmn:Lane")||is(shape,"bpmn:Participant"))return canExecute&&(newBounds=roundBounds(newBounds),modeling.resizeLane(shape,newBounds,context.balanced)),!1})}var is=require("../../../util/ModelUtil").is,roundBounds=require("diagram-js/lib/layout/LayoutUtil").roundBounds,hasPrimaryModifier=require("diagram-js/lib/util/Mouse").hasPrimaryModifier,SLIGHTLY_HIGHER_PRIORITY=1001;ResizeLaneBehavior.$inject=["eventBus","modeling"],module.exports=ResizeLaneBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/layout/LayoutUtil":308,"diagram-js/lib/util/Mouse":330}],108:[function(require,module,exports){"use strict";function ToggleElementCollapseBehaviour(eventBus,elementFactory,modeling,resize){function hideEmptyLables(children){children.length&&children.forEach(function(child){"label"!==child.type||child.businessObject.name||(child.hidden=!0)})}function expandedBounds(shape,defaultSize){var visibleElements,visibleBBox,children=shape.children,newBounds=defaultSize;return visibleElements=filterVisible(children).concat([shape]),visibleBBox=computeChildrenBBox(visibleElements),visibleBBox?(newBounds.width=Math.max(visibleBBox.width,newBounds.width),newBounds.height=Math.max(visibleBBox.height,newBounds.height),newBounds.x=visibleBBox.x+(visibleBBox.width-newBounds.width)/2,newBounds.y=visibleBBox.y+(visibleBBox.height-newBounds.height)/2):(newBounds.x=shape.x+(shape.width-newBounds.width)/2,newBounds.y=shape.y+(shape.height-newBounds.height)/2),newBounds}function collapsedBounds(shape,defaultSize){return{x:shape.x+(shape.width-defaultSize.width)/2,y:shape.y+(shape.height-defaultSize.height)/2,width:defaultSize.width,height:defaultSize.height}}CommandInterceptor.call(this,eventBus),this.executed(["shape.toggleCollapse"],LOW_PRIORITY,function(e){var context=e.context,shape=context.shape;is(shape,"bpmn:SubProcess")&&(shape.collapsed?getBusinessObject(shape).di.isExpanded=!1:(hideEmptyLables(shape.children),getBusinessObject(shape).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],LOW_PRIORITY,function(e){var context=e.context,shape=context.shape;shape.collapsed?getBusinessObject(shape).di.isExpanded=!1:getBusinessObject(shape).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],LOW_PRIORITY,function(e){var newBounds,shape=e.context.shape,defaultSize=elementFactory._getDefaultSize(shape);newBounds=shape.collapsed?collapsedBounds(shape,defaultSize):expandedBounds(shape,defaultSize),modeling.resizeShape(shape,newBounds)})}function filterVisible(elements){return elements.filter(function(e){return!e.hidden})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),getBusinessObject=require("../../../util/ModelUtil").getBusinessObject,is=require("../../../util/ModelUtil").is,computeChildrenBBox=require("diagram-js/lib/features/resize/ResizeUtil").computeChildrenBBox,LOW_PRIORITY=500;inherits(ToggleElementCollapseBehaviour,CommandInterceptor),ToggleElementCollapseBehaviour.$inject=["eventBus","elementFactory","modeling"],module.exports=ToggleElementCollapseBehaviour},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,"diagram-js/lib/features/resize/ResizeUtil":279,inherits:347}],109:[function(require,module,exports){"use strict";function UnclaimIdBehavior(eventBus,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("elements.delete",function(event){var context=event.context,elements=context.elements;forEach(elements,function(element){modeling.unclaimId(element.businessObject.id,element.businessObject)})})}var forEach=require("lodash/collection/forEach"),inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");inherits(UnclaimIdBehavior,CommandInterceptor),UnclaimIdBehavior.$inject=["eventBus","modeling"],module.exports=UnclaimIdBehavior},{"diagram-js/lib/command/CommandInterceptor":175,inherits:347,"lodash/collection/forEach":362}],110:[function(require,module,exports){"use strict";function DeleteSequenceFlowBehavior(eventBus,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("connection.delete",function(event){var context=event.context,connection=context.connection,source=connection.source;isDefaultFlow(connection,source)&&modeling.updateProperties(source,{default:null})})}function isDefaultFlow(connection,source){if(!is(connection,"bpmn:SequenceFlow"))return!1;var sourceBo=getBusinessObject(source),sequenceFlow=getBusinessObject(connection);return sourceBo.get("default")===sequenceFlow}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is,getBusinessObject=require("../../../util/ModelUtil").getBusinessObject;inherits(DeleteSequenceFlowBehavior,CommandInterceptor),DeleteSequenceFlowBehavior.$inject=["eventBus","modeling"],module.exports=DeleteSequenceFlowBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],111:[function(require,module,exports){"use strict";function UpdateFlowNodeRefsBehavior(eventBus,modeling,translate){function initContext(){return context=context||new UpdateContext,context.enter(),context}function getContext(){if(!context)throw new Error(translate("out of bounds release"));return context}function releaseContext(){if(!context)throw new Error(translate("out of bounds release"));var triggerUpdate=context.leave();return triggerUpdate&&(modeling.updateLaneRefs(context.flowNodes,context.lanes),context=null),triggerUpdate}CommandInterceptor.call(this,eventBus);var context,laneRefUpdateEvents=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(laneRefUpdateEvents,HIGH_PRIORITY,function(event){initContext()}),this.postExecuted(laneRefUpdateEvents,LOW_PRIORITY,function(event){releaseContext()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(event){var context=event.context,shape=context.shape,updateContext=getContext();shape.labelTarget||(is(shape,"bpmn:Lane")&&updateContext.addLane(shape),is(shape,"bpmn:FlowNode")&&updateContext.addFlowNode(shape))})}function UpdateContext(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(lane){this.lanes.push(lane)},this.addFlowNode=function(flowNode){this.flowNodes.push(flowNode)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is,LOW_PRIORITY=500,HIGH_PRIORITY=5e3;UpdateFlowNodeRefsBehavior.$inject=["eventBus","modeling","translate"],inherits(UpdateFlowNodeRefsBehavior,CommandInterceptor),module.exports=UpdateFlowNodeRefsBehavior},{"../../../util/ModelUtil":153,"diagram-js/lib/command/CommandInterceptor":175,inherits:347}],112:[function(require,module,exports){module.exports={__init__:["appendBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createOnFlowBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","importDockingFix","labelBehavior","modelingFeedback","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior","removeElementBehavior","unclaimIdBehavior","toggleElementCollapseBehaviour"],appendBehavior:["type",require("./AppendBehavior")],copyPasteBehavior:["type",require("./CopyPasteBehavior")],createBoundaryEventBehavior:["type",require("./CreateBoundaryEventBehavior")],createDataObjectBehavior:["type",require("./CreateDataObjectBehavior")],createOnFlowBehavior:["type",require("./CreateOnFlowBehavior")],createParticipantBehavior:["type",require("./CreateParticipantBehavior")],dataInputAssociationBehavior:["type",require("./DataInputAssociationBehavior")],deleteLaneBehavior:["type",require("./DeleteLaneBehavior")],importDockingFix:["type",require("./ImportDockingFix")],labelBehavior:["type",require("./LabelBehavior")],modelingFeedback:["type",require("./ModelingFeedback")],removeParticipantBehavior:["type",require("./RemoveParticipantBehavior")],replaceConnectionBehavior:["type",require("./ReplaceConnectionBehavior")],replaceElementBehaviour:["type",require("./ReplaceElementBehaviour")],resizeLaneBehavior:["type",require("./ResizeLaneBehavior")],unsetDefaultFlowBehavior:["type",require("./UnsetDefaultFlowBehavior")],updateFlowNodeRefsBehavior:["type",require("./UpdateFlowNodeRefsBehavior")],removeElementBehavior:["type",require("./RemoveElementBehavior")],unclaimIdBehavior:["type",require("./UnclaimIdBehavior")],toggleElementCollapseBehaviour:["type",require("./ToggleElementCollapseBehaviour")]}},{"./AppendBehavior":92,"./CopyPasteBehavior":93,"./CreateBoundaryEventBehavior":94,"./CreateDataObjectBehavior":95,"./CreateOnFlowBehavior":96,"./CreateParticipantBehavior":97,"./DataInputAssociationBehavior":98,"./DeleteLaneBehavior":99,"./ImportDockingFix":100,"./LabelBehavior":101,"./ModelingFeedback":102,"./RemoveElementBehavior":103,"./RemoveParticipantBehavior":104,"./ReplaceConnectionBehavior":105,"./ReplaceElementBehaviour":106,"./ResizeLaneBehavior":107,"./ToggleElementCollapseBehaviour":108,"./UnclaimIdBehavior":109,"./UnsetDefaultFlowBehavior":110,"./UpdateFlowNodeRefsBehavior":111}],113:[function(require,module,exports){"use strict";function vectorLength(v){return Math.sqrt(Math.pow(v.x,2)+Math.pow(v.y,2))}function getAngle(line){return Math.atan((line[1].y-line[0].y)/(line[1].x-line[0].x))}function rotateVector(vector,angle){return angle?{x:Math.cos(angle)*vector.x-Math.sin(angle)*vector.y,y:Math.sin(angle)*vector.x+Math.cos(angle)*vector.y}:vector}function solveLambaSystem(a,b,c){var system=[{n:a[0]-c[0],lambda:b[0]},{n:a[1]-c[1],lambda:b[1]}],n=system[0].n*b[0]+system[1].n*b[1],l=system[0].lambda*b[0]+system[1].lambda*b[1];return-n/l}function perpendicularFoot(point,line){var a=line[0],b=line[1],bd={x:b.x-a.x,y:b.y-a.y},r=solveLambaSystem([a.x,a.y],[bd.x,bd.y],[point.x,point.y]);return{x:a.x+r*bd.x,y:a.y+r*bd.y}}function getDistancePointLine(point,line){var pfPoint=perpendicularFoot(point,line),connectionVector={x:pfPoint.x-point.x,y:pfPoint.y-point.y};return vectorLength(connectionVector)}function getDistancePointPoint(point1,point2){return vectorLength({x:point1.x-point2.x,y:point1.y-point2.y})}module.exports.vectorLength=vectorLength,module.exports.getAngle=getAngle,module.exports.rotateVector=rotateVector,module.exports.perpendicularFoot=perpendicularFoot,module.exports.getDistancePointLine=getDistancePointLine,module.exports.getDistancePointPoint=getDistancePointPoint},{}],114:[function(require,module,exports){"use strict";function findNewLabelLineStartIndex(oldWaypoints,newWaypoints,attachment,hints){var index=attachment.segmentIndex,offset=newWaypoints.length-oldWaypoints.length;if(hints.segmentMove){var oldSegmentStartIndex=hints.segmentMove.segmentStartIndex,newSegmentStartIndex=hints.segmentMove.newSegmentStartIndex;return index===oldSegmentStartIndex?newSegmentStartIndex:index>=newSegmentStartIndex?index+offset=bendpointIndex&&(newIndex=insert?index+1:index-1),indexnewWaypoints.length-2)return{x:x,y:y};var oldLabelLine=getLine(oldWaypoints,oldLabelLineIndex),newLabelLine=getLine(newWaypoints,newLabelLineIndex),oldFoot=attachment.position,relativeFootPosition=getRelativeFootPosition(oldLabelLine,oldFoot),angleDelta=getAngleDelta(oldLabelLine,newLabelLine);if("bendpoint"===attachment.type){var offset=newWaypoints.length-oldWaypoints.length,oldBendpointIndex=attachment.bendpointIndex,oldBendpoint=oldWaypoints[oldBendpointIndex];if(newWaypoints.indexOf(oldBendpoint)!==-1)return{x:x,y:y};if(0===offset){var newBendpoint=newWaypoints[oldBendpointIndex];return{x:newBendpoint.x-attachment.position.x,y:newBendpoint.y-attachment.position.y}}offset<0&&0!==oldBendpointIndex&&oldBendpointIndex line intersections");1===intersections.length&&(attachment={type:"bendpoint",position:intersections[0],segmentIndex:idx,bendpointIndex:pointsEqual(segmentStart,intersections[0])?idx:idx+1}),2===intersections.length&&(attachmentPosition=mid(intersections[0],intersections[1]),attachment={type:"segment",position:attachmentPosition,segmentIndex:idx,relativeLocation:getDistance(segmentStart,attachmentPosition)/getDistance(segmentStart,segmentEnd)}),attachmentDistance=getDistance(attachment.position,point),(!closestAttachment||closestAttachmentDistance>attachmentDistance)&&(closestAttachment=attachment,closestAttachmentDistance=attachmentDistance)}return closestAttachment}function getCircleSegmentIntersections(s1,s2,cc,cr){s1=roundPoint(s1),s2=roundPoint(s2),cc=roundPoint(cc),cr=min(getDistance(s1,cc),getDistance(s2,cc));var baX=s2.x-s1.x,baY=s2.y-s1.y,caX=cc.x-s1.x,caY=cc.y-s1.y,a=baX*baX+baY*baY,bBy2=baX*caX+baY*caY,c=caX*caX+caY*caY-cr*cr,pBy2=bBy2/a,q=c/a,disc=pBy2*pBy2-q;if(disc<0)return[];var tmpSqrt=sqrt(disc),abScalingFactor1=-pBy2+tmpSqrt,abScalingFactor2=-pBy2-tmpSqrt,i1={x:round(s1.x-baX*abScalingFactor1),y:round(s1.y-baY*abScalingFactor1)};if(0===disc)return[i1];var i2={x:round(s1.x-baX*abScalingFactor2),y:round(s1.y-baY*abScalingFactor2)};return[i1,i2].filter(function(p){return isPointInSegment(p,s1,s2)})}function isPointInSegment(p,segmentStart,segmentEnd){return fenced(p.x,segmentStart.x,segmentEnd.x)&&fenced(p.y,segmentStart.y,segmentEnd.y)}function fenced(n,rangeStart,rangeEnd){return min(rangeStart,rangeEnd)<=n&&n<=max(rangeStart,rangeEnd)}function mid(p1,p2){return{x:(p1.x+p2.x)/2,y:(p1.y+p2.y)/2}}function round(n){return Math.round(1e3*n)/1e3}function roundPoint(p){return{x:round(p.x),y:round(p.y)}}function pointsEqual(p1,p2){return p1.x===p2.x&&p1.y===p2.y}var sqrt=Math.sqrt,min=Math.min,max=Math.max;module.exports.getAttachment=getAttachment},{}],116:[function(require,module,exports){"use strict";module.exports=function(l1s,l1e,l2s,l2e){var denominator,a,b,c,numerator;return denominator=(l2e.y-l2s.y)*(l1e.x-l1s.x)-(l2e.x-l2s.x)*(l1e.y-l1s.y),0==denominator?null:(a=l1s.y-l2s.y,b=l1s.x-l2s.x,numerator=(l2e.x-l2s.x)*a-(l2e.y-l2s.y)*b,c=numerator/denominator,{x:Math.round(l1s.x+c*(l1e.x-l1s.x)),y:Math.round(l1s.y+c*(l1e.y-l1s.y))})}},{}],117:[function(require,module,exports){"use strict";function AddLaneHandler(modeling,spaceTool){this._modeling=modeling,this._spaceTool=spaceTool}var filter=require("lodash/collection/filter"),Elements=require("diagram-js/lib/util/Elements"),getLanesRoot=require("../util/LaneUtil").getLanesRoot,getChildLanes=require("../util/LaneUtil").getChildLanes,LANE_INDENTATION=require("../util/LaneUtil").LANE_INDENTATION;AddLaneHandler.$inject=["modeling","spaceTool"],module.exports=AddLaneHandler,AddLaneHandler.prototype.preExecute=function(context){var spaceTool=this._spaceTool,modeling=this._modeling,shape=context.shape,location=context.location,lanesRoot=getLanesRoot(shape),isRoot=lanesRoot===shape,laneParent=isRoot?shape:shape.parent,existingChildLanes=getChildLanes(laneParent);existingChildLanes.length||modeling.createShape({type:"bpmn:Lane"},{x:shape.x+LANE_INDENTATION,y:shape.y,width:shape.width-LANE_INDENTATION,height:shape.height},laneParent);var allAffected=[];Elements.eachElement(lanesRoot,function(element){return allAffected.push(element),element===shape?[]:filter(element.children,function(c){return c!==shape})});var offset="top"===location?-120:120,lanePosition="top"===location?shape.y:shape.y+shape.height,spacePos=lanePosition+("top"===location?10:-10),direction="top"===location?"n":"s",adjustments=spaceTool.calculateAdjustments(allAffected,"y",offset,spacePos);spaceTool.makeSpace(adjustments.movingShapes,adjustments.resizingShapes,{x:0,y:offset},direction),context.newLane=modeling.createShape({type:"bpmn:Lane"},{x:shape.x+(isRoot?LANE_INDENTATION:0),y:lanePosition-("top"===location?120:0),width:shape.width-(isRoot?LANE_INDENTATION:0),height:120},laneParent)}},{"../util/LaneUtil":125,"diagram-js/lib/util/Elements":322,"lodash/collection/filter":360}],118:[function(require,module,exports){"use strict";function IdClaimHandler(moddle){this._moddle=moddle}IdClaimHandler.$inject=["moddle"],module.exports=IdClaimHandler,IdClaimHandler.prototype.execute=function(context){var ids=this._moddle.ids,id=context.id,element=context.element,claiming=context.claiming;claiming?ids.claim(id,element):ids.unclaim(id)},IdClaimHandler.prototype.revert=function(context){var ids=this._moddle.ids,id=context.id,element=context.element,claiming=context.claiming;claiming?ids.unclaim(id):ids.claim(id,element)}},{}],119:[function(require,module,exports){"use strict";function ResizeLaneHandler(modeling,spaceTool){this._modeling=modeling,this._spaceTool=spaceTool}var is=require("../../../util/ModelUtil").is,getLanesRoot=require("../util/LaneUtil").getLanesRoot,computeLanesResize=require("../util/LaneUtil").computeLanesResize,eachElement=require("diagram-js/lib/util/Elements").eachElement,asTRBL=require("diagram-js/lib/layout/LayoutUtil").asTRBL,substractTRBL=require("diagram-js/lib/features/resize/ResizeUtil").substractTRBL;ResizeLaneHandler.$inject=["modeling","spaceTool"],module.exports=ResizeLaneHandler,ResizeLaneHandler.prototype.preExecute=function(context){var shape=context.shape,newBounds=context.newBounds,balanced=context.balanced;balanced!==!1?this.resizeBalanced(shape,newBounds):this.resizeSpace(shape,newBounds)},ResizeLaneHandler.prototype.resizeBalanced=function(shape,newBounds){var modeling=this._modeling,resizeNeeded=computeLanesResize(shape,newBounds);modeling.resizeShape(shape,newBounds),resizeNeeded.forEach(function(r){modeling.resizeShape(r.shape,r.newBounds)})},ResizeLaneHandler.prototype.resizeSpace=function(shape,newBounds){var spaceTool=this._spaceTool,shapeTrbl=asTRBL(shape),newTrbl=asTRBL(newBounds),trblDiff=substractTRBL(newTrbl,shapeTrbl),lanesRoot=getLanesRoot(shape),allAffected=[],allLanes=[];eachElement(lanesRoot,function(element){return allAffected.push(element),(is(element,"bpmn:Lane")||is(element,"bpmn:Participant"))&&allLanes.push(element),element.children});var change,spacePos,direction,offset,adjustments;(trblDiff.bottom||trblDiff.top)&&(change=trblDiff.bottom||trblDiff.top,spacePos=shape.y+(trblDiff.bottom?shape.height:0)+(trblDiff.bottom?-10:10),direction=trblDiff.bottom?"s":"n",offset=trblDiff.top>0||trblDiff.bottom<0?-change:change,adjustments=spaceTool.calculateAdjustments(allAffected,"y",offset,spacePos),spaceTool.makeSpace(adjustments.movingShapes,adjustments.resizingShapes,{x:0,y:change},direction)),(trblDiff.left||trblDiff.right)&&(change=trblDiff.right||trblDiff.left,spacePos=shape.x+(trblDiff.right?shape.width:0)+(trblDiff.right?-10:100),direction=trblDiff.right?"e":"w",offset=trblDiff.left>0||trblDiff.right<0?-change:change,adjustments=spaceTool.calculateAdjustments(allLanes,"x",offset,spacePos),spaceTool.makeSpace(adjustments.movingShapes,adjustments.resizingShapes,{x:change,y:0},direction))}},{"../../../util/ModelUtil":153,"../util/LaneUtil":125,"diagram-js/lib/features/resize/ResizeUtil":279,"diagram-js/lib/layout/LayoutUtil":308,"diagram-js/lib/util/Elements":322}],120:[function(require,module,exports){"use strict";function SplitLaneHandler(modeling,translate){this._modeling=modeling,this._translate=translate}var getChildLanes=require("../util/LaneUtil").getChildLanes,LANE_INDENTATION=require("../util/LaneUtil").LANE_INDENTATION;SplitLaneHandler.$inject=["modeling","translate"],module.exports=SplitLaneHandler,SplitLaneHandler.prototype.preExecute=function(context){var modeling=this._modeling,translate=this._translate,shape=context.shape,newLanesCount=context.count,childLanes=getChildLanes(shape),existingLanesCount=childLanes.length;if(existingLanesCount>newLanesCount)throw new Error(translate("more than {count} child lanes",{count:newLanesCount}));var laneY,laneHeight,laneBounds,newLaneAttrs,idx,newLanesHeight=Math.round(shape.height/newLanesCount);for(idx=0;idxlaneTrbl.left&&elementMid.xlaneTrbl.top&&elementMid.y0)):!(is(target,"bpmn:Participant")&&!isExpanded(target))&&(is(target,"bpmn:FlowElementsContainer")?isExpanded(target):isAny(target,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]))}function isBoundaryEvent(element){return!isLabel(element)&&is(element,"bpmn:BoundaryEvent")}function isLane(element){return is(element,"bpmn:Lane")}function isBoundaryCandidate(element){return isBoundaryEvent(element)||is(element,"bpmn:IntermediateThrowEvent")&&!element.parent}function canAttach(elements,target,source,position){if(Array.isArray(elements)||(elements=[elements]),source)return!1;if(1!==elements.length)return!1;var element=elements[0];return!isLabel(element)&&(!!isBoundaryCandidate(element)&&(!target||!isEventSubProcess(target)&&(!(!is(target,"bpmn:Activity")||isForCompensation(target))&&(!(position&&!isBoundaryAttachment(position,target))&&"attach"))))}function canReplace(elements,target,position){if(!target)return!1;var canExecute={replacements:[]};return forEach(elements,function(element){isEventSubProcess(target)||is(element,"bpmn:StartEvent")&&"label"!==element.type&&canDrop(element,target)&&(isInterrupting(element)||canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:StartEvent"}),(hasErrorEventDefinition(element)||hasEscalationEventDefinition(element)||hasCompensateEventDefinition(element))&&canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:StartEvent"})),is(target,"bpmn:Transaction")||hasEventDefinition(element,"bpmn:CancelEventDefinition")&&"label"!==element.type&&(is(element,"bpmn:EndEvent")&&canDrop(element,target)&&canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:EndEvent"}),is(element,"bpmn:BoundaryEvent")&&canAttach(element,target,null,position)&&canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:BoundaryEvent"}))}),!!canExecute.replacements.length&&canExecute}function canMove(elements,target){return!any(elements,isBoundaryEvent)&&(!any(elements,isLane)&&(!target||elements.every(function(element){return canDrop(element,target)})))}function canCreate(shape,target,source,position){return!!target&&(isLabel(target)?null:!isSame(source,target)&&((!source||!isParent(source,target))&&(canDrop(shape,target,position)||canInsert(shape,target,position))))}function canResize(shape,newBounds){return is(shape,"bpmn:SubProcess")?!!isExpanded(shape)&&(!newBounds||newBounds.width>=100&&newBounds.height>=80):is(shape,"bpmn:Lane")?!newBounds||newBounds.width>=130&&newBounds.height>=60:is(shape,"bpmn:Participant")?!newBounds||newBounds.width>=250&&newBounds.height>=50:!!isTextAnnotation(shape)}function canConnectAssociation(source,target){return!isConnection(source)&&!isConnection(target)&&(!isParent(target,source)&&!isParent(source,target))}function canConnectMessageFlow(source,target){return isMessageFlowSource(source)&&isMessageFlowTarget(target)&&!isSameOrganization(source,target)}function canConnectSequenceFlow(source,target){return isSequenceFlowSource(source)&&isSequenceFlowTarget(target)&&isSameScope(source,target)&&!(is(source,"bpmn:EventBasedGateway")&&!isEventBasedTarget(target))}function canConnectDataAssociation(source,target){return isAny(source,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&isAny(target,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!isAny(target,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!isAny(source,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function canInsert(shape,flow,position){return isAny(flow,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&is(shape,"bpmn:FlowNode")&&!is(shape,"bpmn:BoundaryEvent")&&canDrop(shape,flow.parent,position)}function contains(collection,element){return collection&&element&&collection.indexOf(element)!==-1}function canCopy(collection,element){return!(is(element,"bpmn:Lane")&&!contains(collection,element.parent))&&!(is(element,"bpmn:BoundaryEvent")&&!contains(collection,element.host))}var find=require("lodash/collection/find"),any=require("lodash/collection/any"),every=require("lodash/collection/every"),filter=require("lodash/collection/filter"),forEach=require("lodash/collection/forEach"),inherits=require("inherits"),getParents=require("../modeling/util/ModelingUtil").getParents,is=require("../../util/ModelUtil").is,isAny=require("../modeling/util/ModelingUtil").isAny,getBusinessObject=require("../../util/ModelUtil").getBusinessObject,isExpanded=require("../../util/DiUtil").isExpanded,isEventSubProcess=require("../../util/DiUtil").isEventSubProcess,isInterrupting=require("../../util/DiUtil").isInterrupting,hasErrorEventDefinition=require("../../util/DiUtil").hasErrorEventDefinition,hasEscalationEventDefinition=require("../../util/DiUtil").hasEscalationEventDefinition,hasCompensateEventDefinition=require("../../util/DiUtil").hasCompensateEventDefinition,RuleProvider=require("diagram-js/lib/features/rules/RuleProvider"),isBoundaryAttachment=require("../snapping/BpmnSnappingUtil").getBoundaryAttachment;inherits(BpmnRules,RuleProvider),BpmnRules.$inject=["eventBus"],module.exports=BpmnRules,BpmnRules.prototype.init=function(){this.addRule("connection.create",function(context){var source=context.source,target=context.target;return canConnect(source,target)}),this.addRule("connection.reconnectStart",function(context){var connection=context.connection,source=context.hover||context.source,target=connection.target;return canConnect(source,target,connection)}),this.addRule("connection.reconnectEnd",function(context){var connection=context.connection,source=connection.source,target=context.hover||context.target;return canConnect(source,target,connection)}),this.addRule("connection.updateWaypoints",function(context){return null}),this.addRule("shape.resize",function(context){var shape=context.shape,newBounds=context.newBounds;return canResize(shape,newBounds)}),this.addRule("elements.move",function(context){var target=context.target,shapes=context.shapes,position=context.position;return canAttach(shapes,target,null,position)||canReplace(shapes,target,position)||canMove(shapes,target,position)}),this.addRule(["shape.create","shape.append"],function(context){var target=context.target,shape=context.shape,source=context.source,position=context.position;return canAttach([shape],target,source,position)||canCreate(shape,target,source,position)}),this.addRule("element.copy",function(context){var collection=context.collection,element=context.element;return canCopy(collection,element)}),this.addRule("element.paste",function(context){var parent=context.parent,element=context.element,position=context.position,source=context.source,target=context.target;return source||target?canConnect(source,target):canAttach([element],parent,null,position)||canCreate(element,parent,null,position)}),this.addRule("elements.paste",function(context){var tree=context.tree,target=context.target;return canPaste(tree,target)}),this.addRule(["elements.delete"],function(context){return filter(context.elements,function(e){return!isLabel(e)})})},BpmnRules.prototype.canConnectMessageFlow=canConnectMessageFlow,BpmnRules.prototype.canConnectSequenceFlow=canConnectSequenceFlow,BpmnRules.prototype.canConnectDataAssociation=canConnectDataAssociation,BpmnRules.prototype.canConnectAssociation=canConnectAssociation,BpmnRules.prototype.canMove=canMove,BpmnRules.prototype.canAttach=canAttach,BpmnRules.prototype.canReplace=canReplace,BpmnRules.prototype.canDrop=canDrop,BpmnRules.prototype.canInsert=canInsert,BpmnRules.prototype.canCreate=canCreate,BpmnRules.prototype.canConnect=canConnect,BpmnRules.prototype.canResize=canResize,BpmnRules.prototype.canCopy=canCopy},{"../../util/DiUtil":151,"../../util/ModelUtil":153,"../modeling/util/ModelingUtil":126,"../snapping/BpmnSnappingUtil":144,"diagram-js/lib/features/rules/RuleProvider":281,inherits:347,"lodash/collection/any":358,"lodash/collection/every":359,"lodash/collection/filter":360,"lodash/collection/find":361,"lodash/collection/forEach":362}],140:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/rules")],__init__:["bpmnRules"],bpmnRules:["type",require("./BpmnRules")]}},{"./BpmnRules":139,"diagram-js/lib/features/rules":283}],141:[function(require,module,exports){"use strict";function BpmnSearchProvider(elementRegistry,searchPad,canvas){this._elementRegistry=elementRegistry,this._canvas=canvas,searchPad.registerProvider(this)}function hasMatched(tokens){var matched=filter(tokens,function(t){return!!t.matched});return matched.length>0}function matchAndSplit(text,pattern){var tokens=[],originalText=text;if(!text)return tokens;text=text.toLowerCase(),pattern=pattern.toLowerCase();var i=text.indexOf(pattern);return i>-1?(0!==i&&tokens.push({normal:originalText.substr(0,i)}),tokens.push({matched:originalText.substr(i,pattern.length)}),pattern.length+iy&&(insert=abs(laneTrbl.top-y)>abs(laneTrbl.bottom-y)?assign(insert||{},{after:{element:l,y:laneTrbl.bottom}}):assign(insert||{},{before:{element:l,y:laneTrbl.top}})),insert},!1);insert||(targetTrbl=asTRBL(target),insert=abs(targetTrbl.top-y)=snapTopLeft.x?setSnapped(event,"x",snapTopLeft.x+offset+shapeHalfWidth):currentBottomRight.x<=snapBottomRight.x&&setSnapped(event,"x",snapBottomRight.x-offset-shapeHalfWidth),currentTopLeft.y>=snapTopLeft.y?setSnapped(event,"y",snapTopLeft.y+shapeHalfHeight):currentBottomRight.y<=snapBottomRight.y&&setSnapped(event,"y",snapBottomRight.y-shapeHalfHeight)}function snapBoundaryEvent(event,shape,target){var targetTRBL=asTRBL(target),direction=getBoundaryAttachment(event,target);/top/.test(direction)?setSnapped(event,"y",targetTRBL.top):/bottom/.test(direction)&&setSnapped(event,"y",targetTRBL.bottom),/left/.test(direction)?setSnapped(event,"x",targetTRBL.left):/right/.test(direction)&&setSnapped(event,"x",targetTRBL.right)}var inherits=require("inherits"),abs=Math.abs,forEach=require("lodash/collection/forEach"),filter=require("lodash/collection/filter"),assign=require("lodash/object/assign"),getBoundingBox=require("diagram-js/lib/util/Elements").getBBox,is=require("../../util/ModelUtil").is,isAny=require("../modeling/util/ModelingUtil").isAny,isExpanded=require("../../util/DiUtil").isExpanded,Snapping=require("diagram-js/lib/features/snapping/Snapping"),SnapUtil=require("diagram-js/lib/features/snapping/SnapUtil"),asTRBL=require("diagram-js/lib/layout/LayoutUtil").asTRBL,round=Math.round,mid=SnapUtil.mid,topLeft=SnapUtil.topLeft,bottomRight=SnapUtil.bottomRight,isSnapped=SnapUtil.isSnapped,setSnapped=SnapUtil.setSnapped,getBoundaryAttachment=require("./BpmnSnappingUtil").getBoundaryAttachment,getParticipantSizeConstraints=require("./BpmnSnappingUtil").getParticipantSizeConstraints,getLanesRoot=require("../modeling/util/LaneUtil").getLanesRoot,HIGH_PRIORITY=1500;inherits(BpmnSnapping,Snapping),BpmnSnapping.$inject=["eventBus","canvas","bpmnRules","elementRegistry"],module.exports=BpmnSnapping,BpmnSnapping.prototype.initSnap=function(event){var shapeMid,shapeBounds,shapeTopLeft,shapeBottomRight,snapContext,context=event.context,shape=event.shape;snapContext=Snapping.prototype.initSnap.call(this,event),is(shape,"bpmn:Participant")&&snapContext.setSnapLocations(["top-left","bottom-right","mid"]),shape&&(shapeMid=mid(shape,event),shapeBounds={width:shape.width,height:shape.height,x:isNaN(shape.x)?round(shapeMid.x-shape.width/2):shape.x,y:isNaN(shape.y)?round(shapeMid.y-shape.height/2):shape.y},shapeTopLeft=topLeft(shapeBounds),shapeBottomRight=bottomRight(shapeBounds),snapContext.setSnapOrigin("top-left",{x:shapeTopLeft.x-event.x,y:shapeTopLeft.y-event.y}),snapContext.setSnapOrigin("bottom-right",{x:shapeBottomRight.x-event.x,y:shapeBottomRight.y-event.y}),forEach(shape.outgoing,function(c){var docking=c.waypoints[0];docking=docking.original||docking,snapContext.setSnapOrigin(c.id+"-docking",{x:docking.x-event.x,y:docking.y-event.y})}),forEach(shape.incoming,function(c){var docking=c.waypoints[c.waypoints.length-1];docking=docking.original||docking,snapContext.setSnapOrigin(c.id+"-docking",{x:docking.x-event.x,y:docking.y-event.y})}));var source=context.source;source&&snapContext.addDefaultSnap("mid",mid(source))},BpmnSnapping.prototype.addTargetSnaps=function(snapPoints,shape,target){is(shape,"bpmn:BoundaryEvent")&&"label"!==shape.type&&(target=target.parent),is(target,"bpmn:SequenceFlow")&&this.addTargetSnaps(snapPoints,shape,target.parent);var siblings=this.getSiblings(shape,target)||[];forEach(siblings,function(s){is(s,"bpmn:Lane")||(snapPoints.add("mid",mid(s)),is(s,"bpmn:Participant")&&(snapPoints.add("top-left",topLeft(s)),snapPoints.add("bottom-right",bottomRight(s))))}),forEach(shape.incoming,function(c){siblings.indexOf(c.source)===-1&&snapPoints.add("mid",mid(c.source));var docking=c.waypoints[0];snapPoints.add(c.id+"-docking",docking.original||docking)}),forEach(shape.outgoing,function(c){siblings.indexOf(c.target)===-1&&snapPoints.add("mid",mid(c.target));var docking=c.waypoints[c.waypoints.length-1];snapPoints.add(c.id+"-docking",docking.original||docking)})}},{"../../util/DiUtil":151,"../../util/ModelUtil":153,"../modeling/util/LaneUtil":125,"../modeling/util/ModelingUtil":126,"./BpmnSnappingUtil":144,"diagram-js/lib/features/snapping/SnapUtil":291,"diagram-js/lib/features/snapping/Snapping":292,"diagram-js/lib/layout/LayoutUtil":308,"diagram-js/lib/util/Elements":322,inherits:347,"lodash/collection/filter":360,"lodash/collection/forEach":362,"lodash/object/assign":495}],144:[function(require,module,exports){"use strict";function getBoundaryAttachment(position,targetBounds){var orientation=getOrientation(position,targetBounds,-15);return"intersect"!==orientation?orientation:null}function addToTrbl(trbl,attr,value,choice){var current=trbl[attr];trbl[attr]=void 0===current?value:choice(value,current)}function addMin(trbl,attr,value){return addToTrbl(trbl,attr,value,min)}function addMax(trbl,attr,value){return addToTrbl(trbl,attr,value,max)}function getParticipantSizeConstraints(laneShape,resizeDirection,balanced){var lanesRoot=getLanesRoot(laneShape),isFirst=!0,isLast=!0,allLanes=collectLanes(lanesRoot,[lanesRoot]),laneTrbl=asTRBL(laneShape),maxTrbl={},minTrbl={};/e/.test(resizeDirection)?minTrbl.right=laneTrbl.left+LANE_MIN_WIDTH:/w/.test(resizeDirection)&&(minTrbl.left=laneTrbl.right-LANE_MIN_WIDTH),allLanes.forEach(function(other){var otherTrbl=asTRBL(other);/n/.test(resizeDirection)&&(otherTrbl.toplaneTrbl.bottom+10&&(isLast=!1),balanced&&abs(laneTrbl.bottom-otherTrbl.top)<10&&addMin(maxTrbl,"bottom",otherTrbl.bottom-LANE_MIN_HEIGHT),abs(laneTrbl.bottom-otherTrbl.bottom)<5&&addMax(minTrbl,"bottom",otherTrbl.top+LANE_MIN_HEIGHT))});var flowElements=lanesRoot.children.filter(function(s){return!s.hidden&&!s.waypoints&&(is(s,"bpmn:FlowElement")||is(s,"bpmn:Artifact"))});return flowElements.forEach(function(flowElement){var flowElementTrbl=asTRBL(flowElement);isFirst&&/n/.test(resizeDirection)&&addMin(minTrbl,"top",flowElementTrbl.top-LANE_TOP_PADDING),/e/.test(resizeDirection)&&addMax(minTrbl,"right",flowElementTrbl.right+LANE_RIGHT_PADDING),isLast&&/s/.test(resizeDirection)&&addMax(minTrbl,"bottom",flowElementTrbl.bottom+LANE_BOTTOM_PADDING),/w/.test(resizeDirection)&&addMin(minTrbl,"left",flowElementTrbl.left-LANE_LEFT_PADDING)}),{min:minTrbl,max:maxTrbl}}var getOrientation=require("diagram-js/lib/layout/LayoutUtil").getOrientation;module.exports.getBoundaryAttachment=getBoundaryAttachment;var is=require("../../util/ModelUtil").is,asTRBL=require("diagram-js/lib/layout/LayoutUtil").asTRBL,collectLanes=require("../modeling/util/LaneUtil").collectLanes,getLanesRoot=require("../modeling/util/LaneUtil").getLanesRoot,abs=Math.abs,min=Math.min,max=Math.max,LANE_MIN_HEIGHT=60,LANE_MIN_WIDTH=300,LANE_RIGHT_PADDING=20,LANE_LEFT_PADDING=50,LANE_TOP_PADDING=20,LANE_BOTTOM_PADDING=20;module.exports.getParticipantSizeConstraints=getParticipantSizeConstraints},{"../../util/ModelUtil":153,"../modeling/util/LaneUtil":125,"diagram-js/lib/layout/LayoutUtil":308}],145:[function(require,module,exports){module.exports={__init__:["snapping"],snapping:["type",require("./BpmnSnapping")]}},{"./BpmnSnapping":143}],146:[function(require,module,exports){"use strict";function elementData(semantic,attrs){return assign({id:semantic.id,type:semantic.$type,businessObject:semantic},attrs)}function collectWaypoints(waypoints){return map(waypoints,function(p){return{x:p.x,y:p.y}})}function notYetDrawn(translate,semantic,refSemantic,property){return new Error(translate("element {element} referenced by {referenced}#{property} not yet drawn",{element:elementToString(refSemantic),referenced:elementToString(semantic),property:property}))}function BpmnImporter(eventBus,canvas,elementFactory,elementRegistry,translate){this._eventBus=eventBus,this._canvas=canvas,this._elementFactory=elementFactory,this._elementRegistry=elementRegistry,this._translate=translate}var assign=require("lodash/object/assign"),map=require("lodash/collection/map"),LabelUtil=require("../util/LabelUtil"),is=require("../util/ModelUtil").is,hasExternalLabel=LabelUtil.hasExternalLabel,getExternalLabelBounds=LabelUtil.getExternalLabelBounds,isExpanded=require("../util/DiUtil").isExpanded,elementToString=require("./Util").elementToString;BpmnImporter.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate"],module.exports=BpmnImporter,BpmnImporter.prototype.add=function(semantic,parentElement){var element,hidden,di=semantic.di,translate=this._translate;if(is(di,"bpmndi:BPMNPlane"))element=this._elementFactory.createRoot(elementData(semantic)),this._canvas.setRootElement(element);else if(is(di,"bpmndi:BPMNShape")){var collapsed=!isExpanded(semantic);hidden=parentElement&&(parentElement.hidden||parentElement.collapsed);var bounds=semantic.di.bounds;element=this._elementFactory.createShape(elementData(semantic,{collapsed:collapsed,hidden:hidden,x:Math.round(bounds.x),y:Math.round(bounds.y),width:Math.round(bounds.width),height:Math.round(bounds.height)})),is(semantic,"bpmn:BoundaryEvent")&&this._attachBoundary(semantic,element),this._canvas.addShape(element,parentElement)}else{if(!is(di,"bpmndi:BPMNEdge"))throw new Error(translate("unknown di {di} for element {semantic}",{di:elementToString(di),semantic:elementToString(semantic)}));var source=this._getSource(semantic),target=this._getTarget(semantic);hidden=parentElement&&(parentElement.hidden||parentElement.collapsed),element=this._elementFactory.createConnection(elementData(semantic,{hidden:hidden,source:source,target:target,waypoints:collectWaypoints(semantic.di.waypoint)})),(is(semantic,"bpmn:DataInputAssociation")||is(semantic,"bpmn:DataOutputAssociation"))&&(parentElement=null),this._canvas.addConnection(element,parentElement)}return hasExternalLabel(semantic)&&this.addLabel(semantic,element),this._eventBus.fire("bpmnElement.added",{element:element}),element},BpmnImporter.prototype._attachBoundary=function(boundarySemantic,boundaryElement){var translate=this._translate,hostSemantic=boundarySemantic.attachedToRef;if(!hostSemantic)throw new Error(translate("missing {semantic}#attachedToRef",{semantic:elementToString(boundarySemantic)}));var host=this._elementRegistry.get(hostSemantic.id),attachers=host&&host.attachers;if(!host)throw notYetDrawn(translate,boundarySemantic,hostSemantic,"attachedToRef");boundaryElement.host=host,attachers||(host.attachers=attachers=[]),attachers.indexOf(boundaryElement)===-1&&attachers.push(boundaryElement)},BpmnImporter.prototype.addLabel=function(semantic,element){var bounds=getExternalLabelBounds(semantic,element),label=this._elementFactory.createLabel(elementData(semantic,{id:semantic.id+"_label",labelTarget:element,type:"label",hidden:element.hidden||!semantic.name,x:Math.round(bounds.x),y:Math.round(bounds.y),width:Math.round(bounds.width),height:Math.round(bounds.height)}));return this._canvas.addShape(label,element.parent)},BpmnImporter.prototype._getEnd=function(semantic,side){var element,refSemantic,type=semantic.$type,translate=this._translate;if(refSemantic=semantic[side+"Ref"],"source"===side&&"bpmn:DataInputAssociation"===type&&(refSemantic=refSemantic&&refSemantic[0]),("source"===side&&"bpmn:DataOutputAssociation"===type||"target"===side&&"bpmn:DataInputAssociation"===type)&&(refSemantic=semantic.$parent),element=refSemantic&&this._getElement(refSemantic))return element;throw refSemantic?notYetDrawn(translate,semantic,refSemantic,side+"Ref"):new Error(translate("{semantic}#{side} Ref not specified",{semantic:elementToString(semantic),side:side}))},BpmnImporter.prototype._getSource=function(semantic){return this._getEnd(semantic,"source")},BpmnImporter.prototype._getTarget=function(semantic){return this._getEnd(semantic,"target")},BpmnImporter.prototype._getElement=function(semantic){return this._elementRegistry.get(semantic.id)}},{"../util/DiUtil":151,"../util/LabelUtil":152,"../util/ModelUtil":153,"./Util":149,"lodash/collection/map":366,"lodash/object/assign":495}],147:[function(require,module,exports){"use strict";function is(element,type){return element.$instanceOf(type)}function findDisplayCandidate(definitions){return find(definitions.rootElements,function(e){return is(e,"bpmn:Process")||is(e,"bpmn:Collaboration")})}function BpmnTreeWalker(handler,translate){function contextual(fn,ctx){return function(e){fn(e,ctx)}}function handled(element){handledElements[element.id]=element}function isHandled(element){return handledElements[element.id]}function visit(element,ctx){var gfx=element.gfx;if(gfx)throw new Error(translate("already rendered {element}",{element:elementToString(element)}));return handler.element(element,ctx)}function visitRoot(element,diagram){return handler.root(element,diagram)}function visitIfDi(element,ctx){try{var gfx=element.di&&visit(element,ctx);return handled(element),gfx}catch(e){logError(e.message,{element:element,error:e}),console.error(translate("failed to import {element}",{element:elementToString(element)})),console.error(e)}}function logError(message,context){handler.error(message,context)}function registerDi(di){var bpmnElement=di.bpmnElement;bpmnElement?bpmnElement.di?logError(translate("multiple DI elements defined for {element}",{element:elementToString(bpmnElement)}),{element:bpmnElement}):(diRefs.bind(bpmnElement,"di"),bpmnElement.di=di):logError(translate("no bpmnElement referenced in {element}",{element:elementToString(di)}),{element:di})}function handleDiagram(diagram){handlePlane(diagram.plane)}function handlePlane(plane){registerDi(plane),forEach(plane.planeElement,handlePlaneElement)}function handlePlaneElement(planeElement){registerDi(planeElement)}function handleDefinitions(definitions,diagram){var diagrams=definitions.diagrams;if(diagram&&diagrams.indexOf(diagram)===-1)throw new Error(translate("diagram not part of bpmn:Definitions"));if(!diagram&&diagrams&&diagrams.length&&(diagram=diagrams[0]),!diagram)throw new Error(translate("no diagram to display"));handleDiagram(diagram);var plane=diagram.plane;if(!plane)throw new Error(translate("no plane for {element}",{element:elementToString(diagram)}));var rootElement=plane.bpmnElement;if(!rootElement){if(rootElement=findDisplayCandidate(definitions),!rootElement)throw new Error(translate("no process or collaboration to display"));logError(translate("correcting missing bpmnElement on {plane} to {rootElement}",{plane:elementToString(plane),rootElement:elementToString(rootElement)})),plane.bpmnElement=rootElement,registerDi(plane)}var ctx=visitRoot(rootElement,plane);if(is(rootElement,"bpmn:Process"))handleProcess(rootElement,ctx);else{if(!is(rootElement,"bpmn:Collaboration"))throw new Error(translate("unsupported bpmnElement for {plane}: {rootElement}",{plane:elementToString(plane),rootElement:elementToString(rootElement)}));handleCollaboration(rootElement,ctx),handleUnhandledProcesses(definitions.rootElements,ctx)}handleDeferred(deferred)}function handleDeferred(deferred){forEach(deferred,function(d){d()})}function handleProcess(process,context){handleFlowElementsContainer(process,context),handleIoSpecification(process.ioSpecification,context),handleArtifacts(process.artifacts,context),handled(process)}function handleUnhandledProcesses(rootElements){var processes=filter(rootElements,function(e){return!isHandled(e)&&is(e,"bpmn:Process")&&e.laneSets});processes.forEach(contextual(handleProcess))}function handleMessageFlow(messageFlow,context){visitIfDi(messageFlow,context)}function handleMessageFlows(messageFlows,context){forEach(messageFlows,contextual(handleMessageFlow,context))}function handleDataAssociation(association,context){visitIfDi(association,context)}function handleDataInput(dataInput,context){visitIfDi(dataInput,context)}function handleDataOutput(dataOutput,context){visitIfDi(dataOutput,context)}function handleArtifact(artifact,context){visitIfDi(artifact,context)}function handleArtifacts(artifacts,context){forEach(artifacts,function(e){is(e,"bpmn:Association")?deferred.push(function(){handleArtifact(e,context)}):handleArtifact(e,context)})}function handleIoSpecification(ioSpecification,context){ioSpecification&&(forEach(ioSpecification.dataInputs,contextual(handleDataInput,context)),forEach(ioSpecification.dataOutputs,contextual(handleDataOutput,context)))}function handleSubProcess(subProcess,context){handleFlowElementsContainer(subProcess,context),handleArtifacts(subProcess.artifacts,context)}function handleFlowNode(flowNode,context){var childCtx=visitIfDi(flowNode,context);is(flowNode,"bpmn:SubProcess")&&handleSubProcess(flowNode,childCtx||context),is(flowNode,"bpmn:Activity")&&handleIoSpecification(flowNode.ioSpecification,context),deferred.push(function(){forEach(flowNode.dataInputAssociations,contextual(handleDataAssociation,context)),forEach(flowNode.dataOutputAssociations,contextual(handleDataAssociation,context))})}function handleSequenceFlow(sequenceFlow,context){visitIfDi(sequenceFlow,context)}function handleDataElement(dataObject,context){visitIfDi(dataObject,context)}function handleBoundaryEvent(dataObject,context){visitIfDi(dataObject,context)}function handleLane(lane,context){var newContext=visitIfDi(lane,context);lane.childLaneSet&&handleLaneSet(lane.childLaneSet,newContext||context),wireFlowNodeRefs(lane)}function handleLaneSet(laneSet,context){forEach(laneSet.lanes,contextual(handleLane,context))}function handleLaneSets(laneSets,context){forEach(laneSets,contextual(handleLaneSet,context))}function handleFlowElementsContainer(container,context){container.laneSets&&handleLaneSets(container.laneSets,context),handleFlowElements(container.flowElements,context)}function handleFlowElements(flowElements,context){forEach(flowElements,function(e){is(e,"bpmn:SequenceFlow")?deferred.push(function(){handleSequenceFlow(e,context)}):is(e,"bpmn:BoundaryEvent")?deferred.unshift(function(){handleBoundaryEvent(e,context)}):is(e,"bpmn:FlowNode")?handleFlowNode(e,context):is(e,"bpmn:DataObject")||(is(e,"bpmn:DataStoreReference")?handleDataElement(e,context):is(e,"bpmn:DataObjectReference")?handleDataElement(e,context):logError(translate("unrecognized flowElement {element} in context {context}",{element:elementToString(e),context:context?elementToString(context.businessObject):"null"}),{element:e,context:context}))})}function handleParticipant(participant,context){var newCtx=visitIfDi(participant,context),process=participant.processRef;process&&handleProcess(process,newCtx||context)}function handleCollaboration(collaboration){forEach(collaboration.participants,contextual(handleParticipant)),handleArtifacts(collaboration.artifacts),deferred.push(function(){handleMessageFlows(collaboration.messageFlows)})}function wireFlowNodeRefs(lane){forEach(lane.flowNodeRef,function(flowNode){var lanes=flowNode.get("lanes");lanes&&lanes.push(lane)})}var handledElements={},deferred=[];return{handleDefinitions:handleDefinitions}}var filter=require("lodash/collection/filter"),find=require("lodash/collection/find"),forEach=require("lodash/collection/forEach"),Refs=require("object-refs"),elementToString=require("./Util").elementToString,diRefs=new Refs({name:"bpmnElement",enumerable:!0},{name:"di"});module.exports=BpmnTreeWalker},{"./Util":149,"lodash/collection/filter":360,"lodash/collection/find":361,"lodash/collection/forEach":362,"object-refs":532}],148:[function(require,module,exports){"use strict";function importBpmnDiagram(diagram,definitions,done){function render(definitions){var visitor={root:function(element){return importer.add(element)},element:function(element,parentShape){return importer.add(element,parentShape)},error:function(message,context){warnings.push({message:message,context:context})}},walker=new BpmnTreeWalker(visitor,translate);walker.handleDefinitions(definitions)}var error,importer=diagram.get("bpmnImporter"),eventBus=diagram.get("eventBus"),translate=diagram.get("translate"),warnings=[];eventBus.fire("import.render.start",{definitions:definitions});try{render(definitions)}catch(e){error=e}eventBus.fire("import.render.complete",{error:error,warnings:warnings}),done(error,warnings)}var BpmnTreeWalker=require("./BpmnTreeWalker");module.exports.importBpmnDiagram=importBpmnDiagram},{"./BpmnTreeWalker":147}],149:[function(require,module,exports){"use strict";module.exports.elementToString=function(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':""}},{}],150:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/i18n/translate")],bpmnImporter:["type",require("./BpmnImporter")]}},{"./BpmnImporter":146,"diagram-js/lib/i18n/translate":304}],151:[function(require,module,exports){"use strict";function hasEventDefinition(element,eventType){var bo=getBusinessObject(element),hasEventDefinition=!1;return bo.eventDefinitions&&forEach(bo.eventDefinitions,function(event){is(event,eventType)&&(hasEventDefinition=!0)}),hasEventDefinition}var is=require("./ModelUtil").is,getBusinessObject=require("./ModelUtil").getBusinessObject,forEach=require("lodash/collection/forEach");module.exports.isExpanded=function(element){return!is(element,"bpmn:CallActivity")&&(is(element,"bpmn:SubProcess")?!!getBusinessObject(element).di.isExpanded:!is(element,"bpmn:Participant")||!!getBusinessObject(element).processRef)},module.exports.isInterrupting=function(element){return element&&getBusinessObject(element).isInterrupting!==!1},module.exports.isEventSubProcess=function(element){return element&&!!getBusinessObject(element).triggeredByEvent},module.exports.hasEventDefinition=hasEventDefinition,module.exports.hasErrorEventDefinition=function(element){return hasEventDefinition(element,"bpmn:ErrorEventDefinition")},module.exports.hasEscalationEventDefinition=function(element){return hasEventDefinition(element,"bpmn:EscalationEventDefinition")},module.exports.hasCompensateEventDefinition=function(element){return hasEventDefinition(element,"bpmn:CompensateEventDefinition")}},{"./ModelUtil":153,"lodash/collection/forEach":362}],152:[function(require,module,exports){"use strict";function getFlowLabelPosition(waypoints){var mid=waypoints.length/2-1,first=waypoints[Math.floor(mid)],second=waypoints[Math.ceil(mid+.01)],position=getWaypointsMid(waypoints),angle=Math.atan((second.y-first.y)/(second.x-first.x)),x=position.x,y=position.y;return Math.abs(angle)
Web-based tooling for BPMN, DMN and CMMN diagrams powered by bpmn.io.
';module.exports.open=open},{"min-dom/lib/delegate":514,"min-dom/lib/domify":515}],155:[function(require,module,exports){module.exports=require("./lib/simple")},{"./lib/simple":157}],156:[function(require,module,exports){"use strict";function BpmnModdle(packages,options){Moddle.call(this,packages,options)}var isString=require("lodash/lang/isString"),isFunction=require("lodash/lang/isFunction"),assign=require("lodash/object/assign"),Moddle=require("moddle"),XmlReader=require("moddle-xml/lib/reader"),XmlWriter=require("moddle-xml/lib/writer");BpmnModdle.prototype=Object.create(Moddle.prototype),module.exports=BpmnModdle,BpmnModdle.prototype.fromXML=function(xmlStr,typeName,options,done){isString(typeName)||(done=options,options=typeName,typeName="bpmn:Definitions"),isFunction(options)&&(done=options,options={});var reader=new XmlReader(assign({model:this,lax:!0},options)),rootHandler=reader.handler(typeName);reader.fromXML(xmlStr,rootHandler,done)},BpmnModdle.prototype.toXML=function(element,options,done){isFunction(options)&&(done=options,options={});var writer=new XmlWriter(options);try{var result=writer.toXML(element);done(null,result)}catch(e){done(e)}}},{"lodash/lang/isFunction":487,"lodash/lang/isString":492,"lodash/object/assign":495,moddle:523,"moddle-xml/lib/reader":521,"moddle-xml/lib/writer":522}],157:[function(require,module,exports){"use strict";var assign=require("lodash/object/assign"),BpmnModdle=require("./bpmn-moddle"),packages={bpmn:require("../resources/bpmn/json/bpmn.json"), -bpmndi:require("../resources/bpmn/json/bpmndi.json"),dc:require("../resources/bpmn/json/dc.json"),di:require("../resources/bpmn/json/di.json")};module.exports=function(additionalPackages,options){return new BpmnModdle(assign({},packages,additionalPackages),options)}},{"../resources/bpmn/json/bpmn.json":158,"../resources/bpmn/json/bpmndi.json":159,"../resources/bpmn/json/dc.json":160,"../resources/bpmn/json/di.json":161,"./bpmn-moddle":156,"lodash/object/assign":495}],158:[function(require,module,exports){module.exports={name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean"},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",type:"String",isBody:!0}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",type:"String",isAttr:!0},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["FlowElementsContainer","Collaboration"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isVirtual:!0,isMany:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"CallActivity",superClass:["Activity"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],emumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}}},{}],159:[function(require,module,exports){module.exports={name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],emumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[],prefix:"bpmndi"}},{}],160:[function(require,module,exports){module.exports={name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]}},{}],161:[function(require,module,exports){module.exports={name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{ -name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",xml:{tagAlias:"lowerCase"}}},{}],162:[function(require,module,exports){module.exports={name:"Camunda",uri:"http://camunda.org/schema/1.0/bpmn",prefix:"camunda",xml:{tagAlias:"lowerCase"},associations:[],types:[{name:"InOutBinding",superClass:["Element"],isAbstract:!0,properties:[{name:"source",isAttr:!0,type:"String"},{name:"sourceExpression",isAttr:!0,type:"String"},{name:"target",isAttr:!0,type:"String"},{name:"businessKey",isAttr:!0,type:"String"},{name:"local",isAttr:!0,type:"Boolean",default:!1},{name:"variables",isAttr:!0,type:"String"}]},{name:"In",superClass:["InOutBinding"]},{name:"Out",superClass:["InOutBinding"]},{name:"AsyncCapable",isAbstract:!0,extends:["bpmn:Activity","bpmn:Gateway","bpmn:Event"],properties:[{name:"async",isAttr:!0,type:"Boolean",default:!1},{name:"asyncBefore",isAttr:!0,type:"Boolean",default:!1},{name:"asyncAfter",isAttr:!0,type:"Boolean",default:!1},{name:"exclusive",isAttr:!0,type:"Boolean",default:!0}]},{name:"JobPriorized",isAbstract:!0,extends:["bpmn:Process","camunda:AsyncCapable"],properties:[{name:"jobPriority",isAttr:!0,type:"String"}]},{name:"SignalEventDefinition",isAbstract:!0,extends:["bpmn:SignalEventDefinition"],properties:[{name:"async",isAttr:!0,type:"Boolean",default:!1}]},{name:"ErrorEventDefinition",isAbstract:!0,extends:["bpmn:ErrorEventDefinition"],properties:[{name:"errorCodeVariable",isAttr:!0,type:"String"},{name:"errorMessageVariable",isAttr:!0,type:"String"}]},{name:"PotentialStarter",superClass:["Element"],properties:[{name:"resourceAssignmentExpression",type:"bpmn:ResourceAssignmentExpression"}]},{name:"FormSupported",isAbstract:!0,extends:["bpmn:StartEvent","bpmn:UserTask"],properties:[{name:"formHandlerClass",isAttr:!0,type:"String"},{name:"formKey",isAttr:!0,type:"String"}]},{name:"Initiator",isAbstract:!0,extends:["bpmn:StartEvent"],properties:[{name:"initiator",isAttr:!0,type:"String"}]},{name:"ScriptTask",isAbstract:!0,extends:["bpmn:ScriptTask"],properties:[{name:"resultVariable",isAttr:!0,type:"String"},{name:"resource",isAttr:!0,type:"String"}]},{name:"Process",isAbstract:!0,extends:["bpmn:Process"],properties:[{name:"candidateStarterGroups",isAttr:!0,type:"String"},{name:"candidateStarterUsers",isAttr:!0,type:"String"},{name:"versionTag",isAttr:!0,type:"String"}]},{name:"EscalationEventDefinition",isAbstract:!0,extends:["bpmn:EscalationEventDefinition"],properties:[{name:"escalationCodeVariable",isAttr:!0,type:"String"}]},{name:"FormalExpression",isAbstract:!0,extends:["bpmn:FormalExpression"],properties:[{name:"resource",isAttr:!0,type:"String"}]},{name:"Assignable",extends:["bpmn:UserTask"],properties:[{name:"assignee",isAttr:!0,type:"String"},{name:"candidateUsers",isAttr:!0,type:"String"},{name:"candidateGroups",isAttr:!0,type:"String"},{name:"dueDate",isAttr:!0,type:"String"},{name:"followUpDate",isAttr:!0,type:"String"},{name:"priority",isAttr:!0,type:"String"}]},{name:"CallActivity",extends:["bpmn:CallActivity"],properties:[{name:"calledElementBinding",isAttr:!0,type:"String",default:"latest"},{name:"calledElementVersion",isAttr:!0,type:"String"},{name:"calledElementTenantId",isAttr:!0,type:"String"},{name:"caseRef",isAttr:!0,type:"String"},{name:"caseBinding",isAttr:!0,type:"String",default:"latest"},{name:"caseVersion",isAttr:!0,type:"String"},{name:"caseTenantId",isAttr:!0,type:"String"},{name:"variableMappingClass",isAttr:!0,type:"String"},{name:"variableMappingDelegateExpression",isAttr:!0,type:"String"}]},{name:"ServiceTaskLike",extends:["bpmn:ServiceTask","bpmn:BusinessRuleTask","bpmn:SendTask","bpmn:MessageEventDefinition"],properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"resultVariable",isAttr:!0,type:"String"}]},{name:"DmnCapable",extends:["bpmn:BusinessRuleTask"],properties:[{name:"decisionRef",isAttr:!0,type:"String"},{name:"decisionRefBinding",isAttr:!0,type:"String",default:"latest"},{name:"decisionRefVersion",isAttr:!0,type:"String"},{name:"mapDecisionResult",isAttr:!0,type:"String",default:"resultList"},{name:"decisionRefTenantId",isAttr:!0,type:"String"}]},{name:"ExternalCapable",extends:["camunda:ServiceTaskLike"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"topic",isAttr:!0,type:"String"}]},{name:"TaskPriorized",extends:["bpmn:Process","camunda:ExternalCapable"],properties:[{name:"taskPriority",isAttr:!0,type:"String"}]},{name:"Properties",superClass:["Element"],properties:[{name:"values",type:"Property",isMany:!0}]},{name:"Property",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"name",type:"String",isAttr:!0},{name:"value",type:"String",isAttr:!0}]},{name:"Connector",superClass:["Element"],properties:[{name:"inputOutput",type:"InputOutput"},{name:"connectorId",type:"String"}]},{name:"InputOutput",superClass:["Element"],properties:[{name:"inputOutput",type:"InputOutput"},{name:"connectorId",type:"String"},{name:"inputParameters",isMany:!0,type:"InputParameter"},{name:"outputParameters",isMany:!0,type:"OutputParameter"}]},{name:"InputOutputParameter",properties:[{name:"name",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"},{name:"definition",type:"InputOutputParameterDefinition"}]},{name:"InputOutputParameterDefinition",isAbstract:!0},{name:"List",superClass:["InputOutputParameterDefinition"],properties:[{name:"items",isMany:!0,type:"InputOutputParameterDefinition"}]},{name:"Map",superClass:["InputOutputParameterDefinition"],properties:[{name:"entries",isMany:!0,type:"Entry"}]},{name:"Entry",properties:[{name:"key",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"},{name:"definition",type:"InputOutputParameterDefinition"}]},{name:"Value",superClass:["InputOutputParameterDefinition"],properties:[{name:"id",isAttr:!0,type:"String"},{name:"name",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"}]},{name:"Script",superClass:["InputOutputParameterDefinition"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"resource",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"}]},{name:"Field",superClass:["Element"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"expression",type:"String"},{name:"stringValue",isAttr:!0,type:"String"},{name:"string",type:"String"}]},{name:"InputParameter",superClass:["InputOutputParameter"]},{name:"OutputParameter",superClass:["InputOutputParameter"]},{name:"Collectable",isAbstract:!0,extends:["bpmn:MultiInstanceLoopCharacteristics"],superClass:["camunda:AsyncCapable"],properties:[{name:"collection",isAttr:!0,type:"String"},{name:"elementVariable",isAttr:!0,type:"String"}]},{name:"FailedJobRetryTimeCycle",superClass:["Element"],properties:[{name:"body",isBody:!0,type:"String"}]},{name:"ExecutionListener",superClass:["Element"],properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"event",isAttr:!0,type:"String"},{name:"script",type:"Script"},{name:"fields",type:"Field",isMany:!0}]},{name:"TaskListener",superClass:["Element"],properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"event",isAttr:!0,type:"String"},{name:"script",type:"Script"},{name:"fields",type:"Field",isMany:!0}]},{name:"FormProperty",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"name",type:"String",isAttr:!0},{name:"type",type:"String",isAttr:!0},{name:"required",type:"String",isAttr:!0},{name:"readable",type:"String",isAttr:!0},{name:"writable",type:"String",isAttr:!0},{name:"variable",type:"String",isAttr:!0},{name:"expression",type:"String",isAttr:!0},{name:"datePattern",type:"String",isAttr:!0},{name:"default",type:"String",isAttr:!0},{name:"values",type:"Value",isMany:!0}]},{name:"FormData",superClass:["Element"],properties:[{name:"fields",type:"FormField",isMany:!0},{name:"businessKey",type:"String",isAttr:!0}]},{name:"FormField",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"label",type:"String",isAttr:!0},{name:"type",type:"String",isAttr:!0},{name:"datePattern",type:"String",isAttr:!0},{name:"defaultValue",type:"String",isAttr:!0},{name:"properties",type:"Properties"},{name:"validation",type:"Validation"},{name:"values",type:"Value",isMany:!0}]},{name:"Validation",superClass:["Element"],properties:[{name:"constraints",type:"Constraint",isMany:!0}]},{name:"Constraint",superClass:["Element"],properties:[{name:"name",type:"String",isAttr:!0},{name:"config",type:"String",isAttr:!0}]},{name:"ConditionalEventDefinition",isAbstract:!0,extends:["bpmn:ConditionalEventDefinition"],properties:[{name:"variableName",isAttr:!0,type:"String"},{name:"variableEvent",isAttr:!0,type:"String"}]}],emumerations:[]}},{}],163:[function(require,module,exports){function ClassList(el){if(!el||!el.nodeType)throw new Error("A DOM element reference is required");this.el=el,this.list=el.classList}try{var index=require("indexof")}catch(err){var index=require("component-indexof")}var re=/\s+/,toString=Object.prototype.toString;module.exports=function(el){return new ClassList(el)},ClassList.prototype.add=function(name){if(this.list)return this.list.add(name),this;var arr=this.array(),i=index(arr,name);return~i||arr.push(name),this.el.className=arr.join(" "),this},ClassList.prototype.remove=function(name){if("[object RegExp]"==toString.call(name))return this.removeMatching(name);if(this.list)return this.list.remove(name),this;var arr=this.array(),i=index(arr,name);return~i&&arr.splice(i,1),this.el.className=arr.join(" "),this},ClassList.prototype.removeMatching=function(re){for(var arr=this.array(),i=0;i=0}function addModule(m){modules.push(m)}function visit(m){hasModule(m)||((m.__depends__||[]).forEach(visit),hasModule(m)||(addModule(m),(m.__init__||[]).forEach(function(c){components.push(c)})))}var modules=[],components=[];bootstrapModules.forEach(visit);var injector=new di.Injector(modules);return components.forEach(function(c){try{injector["string"==typeof c?"get":"invoke"](c)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),injector}function createInjector(options){options=options||{};var configModule={config:["value",options]},coreModule=require("./core"),modules=[configModule,coreModule].concat(options.modules||[]);return bootstrap(modules)}function Diagram(options,injector){this.injector=injector=injector||createInjector(options),this.get=injector.get,this.invoke=injector.invoke,this.get("eventBus").fire("diagram.init")}var di=require("didi");module.exports=Diagram,Diagram.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Diagram.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")}},{"./core":183,didi:338}],175:[function(require,module,exports){"use strict";function isObject(element){return"object"==typeof element}function CommandInterceptor(eventBus){this._eventBus=eventBus}function unwrapEvent(fn,that){return function(event){return fn.call(that||null,event.context,event.command,event)}}var forEach=require("lodash/collection/forEach"),isFunction=require("lodash/lang/isFunction"),isArray=require("lodash/lang/isArray"),isNumber=require("lodash/lang/isNumber"),DEFAULT_PRIORITY=1e3;CommandInterceptor.$inject=["eventBus"],module.exports=CommandInterceptor,CommandInterceptor.prototype.on=function(events,hook,priority,handlerFn,unwrap,that){if((isFunction(hook)||isNumber(hook))&&(that=unwrap,unwrap=handlerFn,handlerFn=priority,priority=hook,hook=null),isFunction(priority)&&(that=unwrap,unwrap=handlerFn,handlerFn=priority,priority=DEFAULT_PRIORITY),isObject(unwrap)&&(that=unwrap,unwrap=!1),!isFunction(handlerFn))throw new Error("handlerFn must be a function");isArray(events)||(events=[events]);var eventBus=this._eventBus;forEach(events,function(event){var fullEvent=["commandStack",event,hook].filter(function(e){return e}).join(".");eventBus.on(fullEvent,priority,unwrap?unwrapEvent(handlerFn,that):handlerFn,that)})};var hooks=["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"];forEach(hooks,function(hook){CommandInterceptor.prototype[hook]=function(events,priority,handlerFn,unwrap,that){(isFunction(events)||isNumber(events))&&(that=unwrap,unwrap=handlerFn,handlerFn=priority,priority=events,events=null),this.on(events,hook,priority,handlerFn,unwrap,that)}})},{"lodash/collection/forEach":362,"lodash/lang/isArray":485,"lodash/lang/isFunction":487,"lodash/lang/isNumber":489}],176:[function(require,module,exports){"use strict";function CommandStack(eventBus,injector){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=injector,this._eventBus=eventBus,this._uid=1,eventBus.on(["diagram.destroy","diagram.clear"],this.clear,this)}var unique=require("lodash/array/unique"),isArray=require("lodash/lang/isArray"),assign=require("lodash/object/assign"),InternalEvent=require("../core/EventBus").Event;CommandStack.$inject=["eventBus","injector"],module.exports=CommandStack,CommandStack.prototype.execute=function(command,context){if(!command)throw new Error("command required");var action={command:command,context:context};this._pushAction(action),this._internalExecute(action),this._popAction(action)},CommandStack.prototype.canExecute=function(command,context){var action={command:command,context:context},handler=this._getHandler(command),result=this._fire(command,"canExecute",action);if(void 0===result){if(!handler)return!1;handler.canExecute&&(result=handler.canExecute(context))}return result},CommandStack.prototype.clear=function(){this._stack.length=0,this._stackIdx=-1,this._fire("changed")},CommandStack.prototype.undo=function(){var next,action=this._getUndoAction();if(action){for(this._pushAction(action);action&&(this._internalUndo(action),next=this._getUndoAction(),next&&next.id===action.id);)action=next;this._popAction()}},CommandStack.prototype.redo=function(){var next,action=this._getRedoAction();if(action){for(this._pushAction(action);action&&(this._internalExecute(action,!0),next=this._getRedoAction(),next&&next.id===action.id);)action=next;this._popAction()}},CommandStack.prototype.register=function(command,handler){this._setHandler(command,handler)},CommandStack.prototype.registerHandler=function(command,handlerCls){if(!command||!handlerCls)throw new Error("command and handlerCls must be defined");var handler=this._injector.instantiate(handlerCls);this.register(command,handler)},CommandStack.prototype.canUndo=function(){return!!this._getUndoAction()},CommandStack.prototype.canRedo=function(){return!!this._getRedoAction()},CommandStack.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},CommandStack.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},CommandStack.prototype._internalUndo=function(action){var self=this,command=action.command,context=action.context,handler=this._getHandler(command);this._atomicDo(function(){self._fire(command,"revert",action),handler.revert&&self._markDirty(handler.revert(context)),self._revertedAction(action),self._fire(command,"reverted",action)})},CommandStack.prototype._fire=function(command,qualifier,event){arguments.length<3&&(event=qualifier,qualifier=null);var i,name,result,names=qualifier?[command+"."+qualifier,qualifier]:[command];for(event=assign(new InternalEvent,event),i=0;(name=names[i])&&(result=this._eventBus.fire("commandStack."+name,event),!event.cancelBubble);i++);return result},CommandStack.prototype._createId=function(){return this._uid++},CommandStack.prototype._atomicDo=function(fn){var execution=this._currentExecution;execution.atomic=!0;try{fn()}finally{execution.atomic=!1}},CommandStack.prototype._internalExecute=function(action,redo){var self=this,command=action.command,context=action.context,handler=this._getHandler(command);if(!handler)throw new Error("no command handler registered for <"+command+">");this._pushAction(action),redo||(this._fire(command,"preExecute",action),handler.preExecute&&handler.preExecute(context),this._fire(command,"preExecuted",action)),this._atomicDo(function(){self._fire(command,"execute",action),handler.execute&&self._markDirty(handler.execute(context)),self._executedAction(action,redo),self._fire(command,"executed",action)}),redo||(this._fire(command,"postExecute",action),handler.postExecute&&handler.postExecute(context),this._fire(command,"postExecuted",action)),this._popAction(action)},CommandStack.prototype._pushAction=function(action){var execution=this._currentExecution,actions=execution.actions,baseAction=actions[0];if(execution.atomic)throw new Error("illegal invocation in or phase (action: "+action.command+")");action.id||(action.id=baseAction&&baseAction.id||this._createId()),actions.push(action)},CommandStack.prototype._popAction=function(){var execution=this._currentExecution,actions=execution.actions,dirty=execution.dirty;actions.pop(),actions.length||(this._eventBus.fire("elements.changed",{elements:unique(dirty)}),dirty.length=0,this._fire("changed"))},CommandStack.prototype._markDirty=function(elements){var execution=this._currentExecution;elements&&(elements=isArray(elements)?elements:[elements],execution.dirty=execution.dirty.concat(elements))},CommandStack.prototype._executedAction=function(action,redo){var stackIdx=++this._stackIdx;redo||this._stack.splice(stackIdx,this._stack.length,action)},CommandStack.prototype._revertedAction=function(action){this._stackIdx--},CommandStack.prototype._getHandler=function(command){return this._handlerMap[command]},CommandStack.prototype._setHandler=function(command,handler){if(!command||!handler)throw new Error("command and handler required");if(this._handlerMap[command])throw new Error("overriding handler for command <"+command+">");this._handlerMap[command]=handler}},{"../core/EventBus":181,"lodash/array/unique":354,"lodash/lang/isArray":485,"lodash/object/assign":495}],177:[function(require,module,exports){module.exports={commandStack:["type",require("./CommandStack")]}},{"./CommandStack":176}],178:[function(require,module,exports){"use strict";function round(number,resolution){return Math.round(number*resolution)/resolution}function ensurePx(number){return isNumber(number)?number+"px":number}function createContainer(options){options=assign({},{width:"100%",height:"100%"},options);var container=options.container||document.body,parent=document.createElement("div");return parent.setAttribute("class","djs-container"),assign(parent.style,{position:"relative",overflow:"hidden",width:ensurePx(options.width),height:ensurePx(options.height)}),container.appendChild(parent),parent}function createGroup(parent,cls){var group=svgCreate("g");return svgClasses(group).add(cls),svgAppend(parent,group),group}function Canvas(config,eventBus,graphicsFactory,elementRegistry){this._eventBus=eventBus,this._elementRegistry=elementRegistry,this._graphicsFactory=graphicsFactory,this._init(config||{})}function setCTM(node,m){var mstr="matrix("+m.a+","+m.b+","+m.c+","+m.d+","+m.e+","+m.f+")";node.setAttribute("transform",mstr)}var isNumber=require("lodash/lang/isNumber"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),every=require("lodash/collection/every"),debounce=require("lodash/function/debounce"),Collections=require("../util/Collections"),Elements=require("../util/Elements"),svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgCreate=require("tiny-svg/lib/create"),svgTransform=require("tiny-svg/lib/transform"),createMatrix=require("tiny-svg/lib/geometry").createMatrix,BASE_LAYER="base",REQUIRED_MODEL_ATTRS={shape:["x","y","width","height"],connection:["waypoints"]};Canvas.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],module.exports=Canvas,Canvas.prototype._init=function(config){var eventBus=this._eventBus,container=this._container=createContainer(config),svg=this._svg=svgCreate("svg");svgAttr(svg,{width:"100%",height:"100%"}),svgAppend(container,svg);var viewport=this._viewport=createGroup(svg,"viewport");this._layers={},config.deferUpdate!==!1&&(this._viewboxChanged=debounce(this._viewboxChanged,300)),eventBus.on("diagram.init",function(){eventBus.fire("canvas.init",{svg:svg,viewport:viewport}),this.resized()},this),eventBus.on("diagram.destroy",500,this._destroy,this),eventBus.on("diagram.clear",500,this._clear,this)},Canvas.prototype._destroy=function(emit){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var parent=this._container.parentNode;parent&&parent.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._rootElement,delete this._viewport},Canvas.prototype._clear=function(){var self=this,allElements=this._elementRegistry.getAll();allElements.forEach(function(element){var type=Elements.getType(element);"root"===type?self.setRootElement(null,!0):self._removeElement(element,type)}),delete this._cachedViewbox},Canvas.prototype.getDefaultLayer=function(){return this.getLayer(BASE_LAYER)},Canvas.prototype.getLayer=function(name){if(!name)throw new Error("must specify a name");var layer=this._layers[name];return layer||(layer=this._layers[name]=createGroup(this._viewport,"layer-"+name)),layer},Canvas.prototype.getContainer=function(){return this._container},Canvas.prototype._updateMarker=function(element,marker,add){var container;element.id||(element=this._elementRegistry.get(element)),container=this._elementRegistry._elements[element.id],container&&(forEach([container.gfx,container.secondaryGfx],function(gfx){gfx&&(add?svgClasses(gfx).add(marker):svgClasses(gfx).remove(marker))}),this._eventBus.fire("element.marker.update",{element:element,gfx:container.gfx,marker:marker,add:!!add}))},Canvas.prototype.addMarker=function(element,marker){this._updateMarker(element,marker,!0)},Canvas.prototype.removeMarker=function(element,marker){this._updateMarker(element,marker,!1); -},Canvas.prototype.hasMarker=function(element,marker){element.id||(element=this._elementRegistry.get(element));var gfx=this.getGraphics(element);return svgClasses(gfx).has(marker)},Canvas.prototype.toggleMarker=function(element,marker){this.hasMarker(element,marker)?this.removeMarker(element,marker):this.addMarker(element,marker)},Canvas.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Canvas.prototype.setRootElement=function(element,override){element&&this._ensureValid("root",element);var currentRoot=this._rootElement,elementRegistry=this._elementRegistry,eventBus=this._eventBus;if(currentRoot){if(!override)throw new Error("rootElement already set, need to specify override");eventBus.fire("root.remove",{element:currentRoot}),eventBus.fire("root.removed",{element:currentRoot}),elementRegistry.remove(currentRoot)}if(element){var gfx=this.getDefaultLayer();eventBus.fire("root.add",{element:element}),elementRegistry.add(element,gfx,this._svg),eventBus.fire("root.added",{element:element,gfx:gfx})}return this._rootElement=element,element},Canvas.prototype._ensureValid=function(type,element){if(!element.id)throw new Error("element must have an id");if(this._elementRegistry.get(element.id))throw new Error("element with id "+element.id+" already exists");var requiredAttrs=REQUIRED_MODEL_ATTRS[type],valid=every(requiredAttrs,function(attr){return"undefined"!=typeof element[attr]});if(!valid)throw new Error("must supply { "+requiredAttrs.join(", ")+" } with "+type)},Canvas.prototype._setParent=function(element,parent,parentIndex){Collections.add(parent.children,element,parentIndex),element.parent=parent},Canvas.prototype._addElement=function(type,element,parent,parentIndex){parent=parent||this.getRootElement();var eventBus=this._eventBus,graphicsFactory=this._graphicsFactory;this._ensureValid(type,element),eventBus.fire(type+".add",{element:element,parent:parent}),this._setParent(element,parent,parentIndex);var gfx=graphicsFactory.create(type,element);return this._elementRegistry.add(element,gfx),graphicsFactory.update(type,element,gfx),eventBus.fire(type+".added",{element:element,gfx:gfx}),element},Canvas.prototype.addShape=function(shape,parent,parentIndex){return this._addElement("shape",shape,parent,parentIndex)},Canvas.prototype.addConnection=function(connection,parent,parentIndex){return this._addElement("connection",connection,parent,parentIndex)},Canvas.prototype._removeElement=function(element,type){var elementRegistry=this._elementRegistry,graphicsFactory=this._graphicsFactory,eventBus=this._eventBus;if(element=elementRegistry.get(element.id||element))return eventBus.fire(type+".remove",{element:element}),graphicsFactory.remove(element),Collections.remove(element.parent&&element.parent.children,element),element.parent=null,eventBus.fire(type+".removed",{element:element}),elementRegistry.remove(element),element},Canvas.prototype.removeShape=function(shape){return this._removeElement(shape,"shape")},Canvas.prototype.removeConnection=function(connection){return this._removeElement(connection,"connection")},Canvas.prototype.getGraphics=function(element,secondary){return this._elementRegistry.getGraphics(element,secondary)},Canvas.prototype._changeViewbox=function(changeFn){this._eventBus.fire("canvas.viewbox.changing"),changeFn.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Canvas.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Canvas.prototype.viewbox=function(box){if(void 0===box&&this._cachedViewbox)return this._cachedViewbox;var innerBox,matrix,scale,x,y,viewport=this._viewport,outerBox=this.getSize();if(!box){innerBox=this.getDefaultLayer().getBBox();var transform=svgTransform(viewport);return matrix=transform?transform.matrix:createMatrix(),scale=round(matrix.a,1e3),x=round(-matrix.e||0,1e3),y=round(-matrix.f||0,1e3),box=this._cachedViewbox={x:x?x/scale:0,y:y?y/scale:0,width:outerBox.width/scale,height:outerBox.height/scale,scale:scale,inner:{width:innerBox.width,height:innerBox.height,x:innerBox.x,y:innerBox.y},outer:outerBox}}return this._changeViewbox(function(){scale=Math.min(outerBox.width/box.width,outerBox.height/box.height);var matrix=this._svg.createSVGMatrix().scale(scale).translate(-box.x,-box.y);svgTransform(viewport,matrix)}),box},Canvas.prototype.scroll=function(delta){var node=this._viewport,matrix=node.getCTM();return delta&&this._changeViewbox(function(){delta=assign({dx:0,dy:0},delta||{}),matrix=this._svg.createSVGMatrix().translate(delta.dx,delta.dy).multiply(matrix),setCTM(node,matrix)}),{x:matrix.e,y:matrix.f}},Canvas.prototype.zoom=function(newScale,center){if(!newScale)return this.viewbox(newScale).scale;if("fit-viewport"===newScale)return this._fitViewport(center);var outer,matrix;return this._changeViewbox(function(){"object"!=typeof center&&(outer=this.viewbox().outer,center={x:outer.width/2,y:outer.height/2}),matrix=this._setZoom(newScale,center)}),round(matrix.a,1e3)},Canvas.prototype._fitViewport=function(center){var newScale,newViewbox,vbox=this.viewbox(),outer=vbox.outer,inner=vbox.inner;return inner.x>=0&&inner.y>=0&&inner.x+inner.width<=outer.width&&inner.y+inner.height<=outer.height&&!center?newViewbox={x:0,y:0,width:Math.max(inner.width+inner.x,outer.width),height:Math.max(inner.height+inner.y,outer.height)}:(newScale=Math.min(1,outer.width/inner.width,outer.height/inner.height),newViewbox={x:inner.x+(center?inner.width/2-outer.width/newScale/2:0),y:inner.y+(center?inner.height/2-outer.height/newScale/2:0),width:outer.width/newScale,height:outer.height/newScale}),this.viewbox(newViewbox),this.viewbox(!1).scale},Canvas.prototype._setZoom=function(scale,center){var centerPoint,originalPoint,currentMatrix,scaleMatrix,newMatrix,svg=this._svg,viewport=this._viewport,matrix=svg.createSVGMatrix(),point=svg.createSVGPoint();currentMatrix=viewport.getCTM();var currentScale=currentMatrix.a;return center?(centerPoint=assign(point,center),originalPoint=centerPoint.matrixTransform(currentMatrix.inverse()),scaleMatrix=matrix.translate(originalPoint.x,originalPoint.y).scale(1/currentScale*scale).translate(-originalPoint.x,-originalPoint.y),newMatrix=currentMatrix.multiply(scaleMatrix)):newMatrix=matrix.scale(scale),setCTM(this._viewport,newMatrix),newMatrix},Canvas.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Canvas.prototype.getAbsoluteBBox=function(element){var bbox,vbox=this.viewbox();if(element.waypoints){var gfx=this.getGraphics(element),transformBBox=gfx.getBBox(!0);bbox=gfx.getBBox(),bbox.x-=transformBBox.x,bbox.y-=transformBBox.y,bbox.width+=2*transformBBox.x,bbox.height+=2*transformBBox.y}else bbox=element;var x=bbox.x*vbox.scale-vbox.x*vbox.scale,y=bbox.y*vbox.scale-vbox.y*vbox.scale,width=bbox.width*vbox.scale,height=bbox.height*vbox.scale;return{x:x,y:y,width:width,height:height}},Canvas.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")}},{"../util/Collections":319,"../util/Elements":322,"lodash/collection/every":359,"lodash/collection/forEach":362,"lodash/function/debounce":374,"lodash/lang/isNumber":489,"lodash/object/assign":495,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/classes":542,"tiny-svg/lib/create":545,"tiny-svg/lib/geometry":546,"tiny-svg/lib/transform":549}],179:[function(require,module,exports){"use strict";function ElementFactory(){this._uid=12}var Model=require("../model"),assign=require("lodash/object/assign");module.exports=ElementFactory,ElementFactory.prototype.createRoot=function(attrs){return this.create("root",attrs)},ElementFactory.prototype.createLabel=function(attrs){return this.create("label",attrs)},ElementFactory.prototype.createShape=function(attrs){return this.create("shape",attrs)},ElementFactory.prototype.createConnection=function(attrs){return this.create("connection",attrs)},ElementFactory.prototype.create=function(type,attrs){return attrs=assign({},attrs||{}),attrs.id||(attrs.id=type+"_"+this._uid++),Model.create(type,attrs)}},{"../model":310,"lodash/object/assign":495}],180:[function(require,module,exports){"use strict";function ElementRegistry(){this._elements={}}var ELEMENT_ID="data-element-id",svgAttr=require("tiny-svg/lib/attr");module.exports=ElementRegistry,ElementRegistry.prototype.add=function(element,gfx,secondaryGfx){var id=element.id;this._validateId(id),svgAttr(gfx,ELEMENT_ID,id),secondaryGfx&&svgAttr(secondaryGfx,ELEMENT_ID,id),this._elements[id]={element:element,gfx:gfx,secondaryGfx:secondaryGfx}},ElementRegistry.prototype.remove=function(element){var elements=this._elements,id=element.id||element,container=id&&elements[id];container&&(svgAttr(container.gfx,ELEMENT_ID,""),container.secondaryGfx&&svgAttr(container.secondaryGfx,ELEMENT_ID,""),delete elements[id])},ElementRegistry.prototype.updateId=function(element,newId){this._validateId(newId),"string"==typeof element&&(element=this.get(element));var gfx=this.getGraphics(element),secondaryGfx=this.getGraphics(element,!0);this.remove(element),element.id=newId,this.add(element,gfx,secondaryGfx)},ElementRegistry.prototype.get=function(filter){var id;id="string"==typeof filter?filter:filter&&svgAttr(filter,ELEMENT_ID);var container=this._elements[id];return container&&container.element},ElementRegistry.prototype.filter=function(fn){var filtered=[];return this.forEach(function(element,gfx){fn(element,gfx)&&filtered.push(element)}),filtered},ElementRegistry.prototype.getAll=function(){return this.filter(function(e){return e})},ElementRegistry.prototype.forEach=function(fn){var map=this._elements;Object.keys(map).forEach(function(id){var container=map[id],element=container.element,gfx=container.gfx;return fn(element,gfx)})},ElementRegistry.prototype.getGraphics=function(filter,secondary){var id=filter.id||filter,container=this._elements[id];return container&&(secondary?container.secondaryGfx:container.gfx)},ElementRegistry.prototype._validateId=function(id){if(!id)throw new Error("element must have an id");if(this._elements[id])throw new Error("element with id "+id+" already added")}},{"tiny-svg/lib/attr":541}],181:[function(require,module,exports){"use strict";function EventBus(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Event(){}function invokeFunction(fn,args){return fn.apply(null,args)}var isFunction=require("lodash/lang/isFunction"),isArray=require("lodash/lang/isArray"),isNumber=require("lodash/lang/isNumber"),bind=require("lodash/function/bind"),assign=require("lodash/object/assign"),FN_REF="__fn",DEFAULT_PRIORITY=1e3,slice=Array.prototype.slice;module.exports=EventBus,EventBus.prototype.on=function(events,priority,callback,that){if(events=isArray(events)?events:[events],isFunction(priority)&&(that=callback,callback=priority,priority=DEFAULT_PRIORITY),!isNumber(priority))throw new Error("priority must be a number");var actualCallback=callback;that&&(actualCallback=bind(callback,that),actualCallback[FN_REF]=callback[FN_REF]||callback);var self=this,listener={priority:priority,callback:actualCallback};events.forEach(function(e){self._addListener(e,listener)})},EventBus.prototype.once=function(event,priority,callback,that){function wrappedCallback(){return self.off(event,wrappedCallback),callback.apply(that,arguments)}var self=this;if(isFunction(priority)&&(that=callback,callback=priority,priority=DEFAULT_PRIORITY),!isNumber(priority))throw new Error("priority must be a number");wrappedCallback[FN_REF]=callback,this.on(event,priority,wrappedCallback)},EventBus.prototype.off=function(event,callback){var listener,listenerCallback,idx,listeners=this._getListeners(event);if(callback)for(idx=listeners.length-1;listener=listeners[idx];idx--)listenerCallback=listener.callback,listenerCallback!==callback&&listenerCallback[FN_REF]!==callback||listeners.splice(idx,1);else listeners.length=0},EventBus.prototype.fire=function(type,data){var event,listeners,returnValue,args;if(args=slice.call(arguments),"object"==typeof type&&(event=type,type=event.type),!type)throw new Error("no event type specified");if(listeners=this._listeners[type]){data instanceof Event?event=data:(event=new Event,event.init(data)),args[0]=event;var originalType=event.type;type!==originalType&&(event.type=type);try{returnValue=this._invokeListeners(event,args,listeners)}finally{type!==originalType&&(event.type=originalType)}return void 0===returnValue&&event.defaultPrevented&&(returnValue=!1),returnValue}},EventBus.prototype.handleError=function(error){return this.fire("error",{error:error})===!1},EventBus.prototype._destroy=function(){this._listeners={}},EventBus.prototype._invokeListeners=function(event,args,listeners){var idx,listener,returnValue;for(idx=0;(listener=listeners[idx])&&!event.cancelBubble;idx++)returnValue=this._invokeListener(event,args,listener);return returnValue},EventBus.prototype._invokeListener=function(event,args,listener){var returnValue;try{returnValue=invokeFunction(listener.callback,args),void 0!==returnValue&&(event.returnValue=returnValue,event.stopPropagation()),returnValue===!1&&event.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return returnValue},EventBus.prototype._addListener=function(event,newListener){var existingListener,idx,listeners=this._getListeners(event);for(idx=0;existingListener=listeners[idx];idx++)if(existingListener.priority1&&(hasSharedCenters=!0),center.elements.length}),hasSharedCenters)return alignment[type]=last(centeredElements).center,alignment;firstElement=sortedElements[0],sortedElements=sortBy(sortedElements,function(element){return element[axis]+element[dimension]}),lastElement=last(sortedElements),alignment[type]=getMiddleOrTop(firstElement,lastElement)}return alignment},AlignElements.prototype.trigger=function(elements,type){var modeling=this._modeling,filteredElements=filter(elements,function(element){return!(element.waypoints||element.host||element.labelTarget)}),sortFn=ALIGNMENT_SORTING[type],sortedElements=sortBy(filteredElements,sortFn),alignment=this._alignmentPosition(type,sortedElements);modeling.alignElements(sortedElements,alignment)}},{"lodash/collection/filter":360,"lodash/collection/forEach":362,"lodash/collection/sortBy":371}],189:[function(require,module,exports){"use strict";module.exports={__init__:["alignElements"],alignElements:["type",require("./AlignElements")]}},{"./AlignElements":188}],190:[function(require,module,exports){"use strict";function AttachSupport(eventBus,modeling,movePreview,rules){CommandInterceptor.call(this,eventBus),eventBus.on("shape.move.start",HIGH_PRIORITY,function(e){var context=e.context,shapes=context.shapes,validatedShapes=context.validatedShapes;context.shapes=addAttached(shapes),context.validatedShapes=removeAttached(validatedShapes)}),this.postExecuted(["elements.move"],function(event){var context=event.context,delta=context.delta,newParent=context.newParent,closure=context.closure,enclosedElements=closure.enclosedElements,attachers=getAttachers(enclosedElements);forEach(attachers,function(attacher){enclosedElements[attacher.id]||modeling.moveShape(attacher,delta,newParent)})}),this.postExecuted(["elements.move"],function(e){var attachers,context=e.context,shapes=context.shapes,newHost=context.newHost;shapes.length>1||(attachers=newHost?shapes:filter(shapes,function(s){return!!s.host}),forEach(attachers,function(attacher){modeling.updateAttachment(attacher,newHost)}))}),this.postExecuted(["elements.move"],function(e){var shapes=e.context.shapes;forEach(shapes,function(shape){forEach(shape.attachers,function(attacher){forEach(attacher.outgoing.slice(),function(connection){var allowed=rules.allowed("connection.reconnectStart",{connection:connection,source:connection.source,target:connection.target});allowed||modeling.removeConnection(connection)}),forEach(attacher.incoming.slice(),function(connection){var allowed=rules.allowed("connection.reconnectEnd",{connection:connection,source:connection.source,target:connection.target});allowed||modeling.removeConnection(connection)})})})}),this.postExecute(["shape.create"],function(e){var context=e.context,shape=context.shape,host=context.host;host&&modeling.updateAttachment(shape,host)}),this.postExecute(["shape.replace"],function(e){var context=e.context,oldShape=context.oldShape,newShape=context.newShape;saveClear(oldShape.attachers,function(attacher){var allowed=rules.allowed("elements.move",{target:newShape,shapes:[attacher]});"attach"===allowed?modeling.updateAttachment(attacher,newShape):modeling.removeShape(attacher)}),newShape.attachers.length&&forEach(newShape.attachers,function(attacher){var delta=getNewAttachShapeDelta(attacher,oldShape,newShape);modeling.moveShape(attacher,delta,attacher.parent)})}),this.postExecute(["shape.resize"],function(event){var context=event.context,shape=context.shape,oldBounds=context.oldBounds,newBounds=context.newBounds,attachers=shape.attachers;attachers.length&&forEach(attachers,function(attacher){var delta=getNewAttachShapeDelta(attacher,oldBounds,newBounds);modeling.moveShape(attacher,delta,attacher.parent),attacher.label&&modeling.moveShape(attacher.label,delta,attacher.label.parent)})}),this.preExecute(["shape.delete"],function(event){var shape=event.context.shape;saveClear(shape.attachers,function(attacher){modeling.removeShape(attacher)}),shape.host&&modeling.updateAttachment(shape,null)}),eventBus.on("spaceTool.move",function(event){var movingShapes=event.context.movingShapes,movingAttachers=filter(movingShapes,function(shape){return shape.host&&shape.host.id});forEach(movingAttachers,function(shape){Collections.remove(movingShapes,shape),shape.label&&Collections.remove(movingShapes,shape.label)})})}function getAttachers(shapes){return flatten(map(shapes,function(s){return s.attachers||[]}))}function addAttached(elements){var attachers=getAttachers(elements);return union(elements,attachers)}function removeAttached(elements){var ids=groupBy(elements,"id");return filter(elements,function(element){for(;element;){if(element.host&&ids[element.host.id])return!1;element=element.parent}return!0})}var forEach=require("lodash/collection/forEach"),flatten=require("lodash/array/flatten"),union=require("lodash/array/union"),filter=require("lodash/collection/filter"),groupBy=require("lodash/collection/groupBy"),map=require("lodash/collection/map"),saveClear=require("../../util/Removal").saveClear,Collections=require("../../util/Collections"),getNewAttachShapeDelta=require("../../util/AttachUtil").getNewAttachShapeDelta,inherits=require("inherits"),HIGH_PRIORITY=1500,CommandInterceptor=require("../../command/CommandInterceptor");inherits(AttachSupport,CommandInterceptor),AttachSupport.$inject=["eventBus","modeling","movePreview","rules"],module.exports=AttachSupport},{"../../command/CommandInterceptor":175,"../../util/AttachUtil":317,"../../util/Collections":319,"../../util/Removal":333,inherits:347,"lodash/array/flatten":349,"lodash/array/union":352,"lodash/collection/filter":360,"lodash/collection/forEach":362,"lodash/collection/groupBy":363,"lodash/collection/map":366}],191:[function(require,module,exports){module.exports={__depends__:[require("../move"),require("../label-support")],__init__:["attachSupport"],attachSupport:["type",require("./AttachSupport")]}},{"../label-support":230,"../move":262,"./AttachSupport":190}],192:[function(require,module,exports){"use strict";function AutoResize(eventBus,elementRegistry,modeling,rules){CommandInterceptor.call(this,eventBus),this._elementRegistry=elementRegistry,this._modeling=modeling,this._rules=rules;var self=this;this.postExecuted(["shape.create"],function(event){var context=event.context,hints=context.hints,shape=context.shape,parent=context.parent||context.newParent;hints&&hints.root===!1||self._expand([shape],parent)}),this.postExecuted(["elements.move"],function(event){var context=event.context,elements=flatten(values(context.closure.topLevel)),hints=context.hints;if(!hints||hints.autoResize!==!1){var expandings=groupBy(elements,function(element){return element.parent.id});forEach(expandings,function(elements,parentId){self._expand(elements,parentId)})}})}var inherits=require("inherits"),getBoundingBox=require("../../util/Elements").getBBox,asTRBL=require("../../layout/LayoutUtil").asTRBL,asBounds=require("../../layout/LayoutUtil").asBounds,assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),values=require("lodash/object/values"),flatten=require("lodash/array/flatten"),groupBy=require("lodash/collection/groupBy"),CommandInterceptor=require("../../command/CommandInterceptor");AutoResize.$inject=["eventBus","elementRegistry","modeling","rules"],inherits(AutoResize,CommandInterceptor),module.exports=AutoResize,AutoResize.prototype._getOptimalBounds=function(elements,target){var offset=this.getOffset(target),padding=this.getPadding(target),elementsTrbl=asTRBL(getBoundingBox(elements)),targetTrbl=asTRBL(target),newTrbl={};return elementsTrbl.top-targetTrbl.topvalues-TOLERANCE)return value-rem+values}return value}function mid(element){if(element.width)return{x:round(element.width/2+element.x),y:round(element.height/2+element.y)}}function getConnectionSegmentSnaps(context){var snapPoints=context.snapPoints,connection=context.connection,waypoints=connection.waypoints,segmentStart=context.segmentStart,segmentStartIndex=context.segmentStartIndex,segmentEnd=context.segmentEnd,segmentEndIndex=context.segmentEndIndex,axis=context.axis;if(snapPoints)return snapPoints;var referenceWaypoints=[waypoints[segmentStartIndex-1],segmentStart,segmentEnd,waypoints[segmentEndIndex+1]];return segmentStartIndex<2&&referenceWaypoints.unshift(mid(connection.source)),segmentEndIndex>waypoints.length-3&&referenceWaypoints.unshift(mid(connection.target)),context.snapPoints=snapPoints={horizontal:[],vertical:[]},forEach(referenceWaypoints,function(p){p&&(p=p.original||p,"y"===axis&&snapPoints.horizontal.push(p.y),"x"===axis&&snapPoints.vertical.push(p.x))}),snapPoints}function getBendpointSnaps(context){var snapPoints=context.snapPoints,waypoints=context.connection.waypoints,bendpointIndex=context.bendpointIndex;if(snapPoints)return snapPoints;var referenceWaypoints=[waypoints[bendpointIndex-1],waypoints[bendpointIndex+1]];return context.snapPoints=snapPoints={horizontal:[],vertical:[]},forEach(referenceWaypoints,function(p){p&&(p=p.original||p,snapPoints.horizontal.push(p.y),snapPoints.vertical.push(p.x))}),snapPoints}eventBus.on("connectionSegment.move.move",1500,function(event){var sx,sy,context=event.context,snapPoints=getConnectionSegmentSnaps(context),x=event.x,y=event.y;if(snapPoints){sx=snapTo(snapPoints.vertical,x),sy=snapTo(snapPoints.horizontal,y);var cx=x-sx,cy=y-sy;assign(event,{dx:event.dx-cx,dy:event.dy-cy,x:sx,y:sy})}}),eventBus.on("bendpoint.move.move",1500,function(event){var sx,sy,context=event.context,snapPoints=getBendpointSnaps(context),target=context.target,targetMid=target&&mid(target),x=event.x,y=event.y;if(snapPoints){sx=snapTo(targetMid?snapPoints.vertical.concat([targetMid.x]):snapPoints.vertical,x),sy=snapTo(targetMid?snapPoints.horizontal.concat([targetMid.y]):snapPoints.horizontal,y);var cx=x-sx,cy=y-sy;assign(event,{dx:event.dx-cx,dy:event.dy-cy,x:event.x-cx,y:event.y-cy})}})}var assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),isArray=require("lodash/lang/isArray"),abs=Math.abs,round=Math.round,TOLERANCE=10;BendpointSnapping.$inject=["eventBus"],module.exports=BendpointSnapping},{"lodash/collection/forEach":362,"lodash/lang/isArray":485,"lodash/object/assign":495}],198:[function(require,module,exports){"use strict";function createParallelDragger(parentGfx,position,alignment){var draggerGfx=svgCreate("g");svgAppend(parentGfx,draggerGfx);var width=14,height=3,padding=6,hitWidth=width+padding,hitHeight=height+padding,visual=svgCreate("rect");svgAttr(visual,{x:-width/2,y:-height/2,width:width,height:height}),svgClasses(visual).add("djs-visual"),svgAppend(draggerGfx,visual);var hit=svgCreate("rect");return svgAttr(hit,{x:-hitWidth/2,y:-hitHeight/2,width:hitWidth,height:hitHeight}),svgClasses(hit).add("djs-hit"),svgAppend(draggerGfx,hit),rotate(draggerGfx,"h"===alignment?90:0,0,0),draggerGfx}var Events=require("../../util/Event"),Geometry=require("../../util/Geometry"),BENDPOINT_CLS=module.exports.BENDPOINT_CLS="djs-bendpoint",SEGMENT_DRAGGER_CLS=module.exports.SEGMENT_DRAGGER_CLS="djs-segment-dragger",svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgCreate=require("tiny-svg/lib/create"),rotate=require("../../util/SvgTransformUtil").rotate,translate=require("../../util/SvgTransformUtil").translate;module.exports.toCanvasCoordinates=function(canvas,event){var offset,position=Events.toPoint(event),clientRect=canvas._container.getBoundingClientRect();offset={x:clientRect.left,y:clientRect.top};var viewbox=canvas.viewbox();return{x:viewbox.x+(position.x-offset.x)/viewbox.scale,y:viewbox.y+(position.y-offset.y)/viewbox.scale}},module.exports.addBendpoint=function(parentGfx,cls){var groupGfx=svgCreate("g");svgClasses(groupGfx).add(BENDPOINT_CLS),svgAppend(parentGfx,groupGfx);var visual=svgCreate("circle");svgAttr(visual,{cx:0,cy:0,r:4}),svgClasses(visual).add("djs-visual"),svgAppend(groupGfx,visual);var hit=svgCreate("circle");return svgAttr(hit,{cx:0,cy:0,r:10}),svgClasses(hit).add("djs-hit"),svgAppend(groupGfx,hit),cls&&svgClasses(groupGfx).add(cls),groupGfx},module.exports.addSegmentDragger=function(parentGfx,segmentStart,segmentEnd){var groupGfx=svgCreate("g"),mid=Geometry.getMidPoint(segmentStart,segmentEnd),alignment=Geometry.pointsAligned(segmentStart,segmentEnd);return svgAppend(parentGfx,groupGfx),createParallelDragger(groupGfx,mid,alignment),svgClasses(groupGfx).add(SEGMENT_DRAGGER_CLS),svgClasses(groupGfx).add("h"===alignment?"vertical":"horizontal"),translate(groupGfx,mid.x,mid.y),groupGfx}},{"../../util/Event":323,"../../util/Geometry":324,"../../util/SvgTransformUtil":335,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/classes":542,"tiny-svg/lib/create":545}],199:[function(require,module,exports){"use strict";function Bendpoints(eventBus,canvas,interactionEvents,bendpointMove,connectionSegmentMove){function getConnectionIntersection(waypoints,event){var localPosition=BendpointUtil.toCanvasCoordinates(canvas,event),intersection=getApproxIntersection(waypoints,localPosition);return intersection}function isIntersectionMiddle(intersection,waypoints,treshold){var p0,p1,mid,aligned,xDelta,yDelta,idx=intersection.index,p=intersection.point;return!(idx<=0||intersection.bendpoint)&&(p0=waypoints[idx-1],p1=waypoints[idx],mid=getMidPoint(p0,p1),aligned=pointsAligned(p0,p1),xDelta=Math.abs(p.x-mid.x),yDelta=Math.abs(p.y-mid.y),aligned&&xDelta<=treshold&&yDelta<=treshold)}function activateBendpointMove(event,connection){var waypoints=connection.waypoints,intersection=getConnectionIntersection(waypoints,event);intersection&&(isIntersectionMiddle(intersection,waypoints,10)?connectionSegmentMove.start(event,connection,intersection.index):bendpointMove.start(event,connection,intersection.index,!intersection.bendpoint))}function bindInteractionEvents(node,eventName,element){domEvent.bind(node,eventName,function(event){interactionEvents.triggerMouseEvent(eventName,event,element),event.stopPropagation()})}function getBendpointsContainer(element,create){var layer=canvas.getLayer("overlays"),gfx=domQuery(".djs-bendpoints[data-element-id="+element.id+"]",layer);return!gfx&&create&&(gfx=svgCreate("g"),svgAttr(gfx,{"data-element-id":element.id}),svgClasses(gfx).add("djs-bendpoints"),svgAppend(layer,gfx),bindInteractionEvents(gfx,"mousedown",element),bindInteractionEvents(gfx,"click",element),bindInteractionEvents(gfx,"dblclick",element)),gfx}function createBendpoints(gfx,connection){connection.waypoints.forEach(function(p,idx){var bendpoint=BendpointUtil.addBendpoint(gfx);svgAppend(gfx,bendpoint),translate(bendpoint,p.x,p.y)}),BendpointUtil.addBendpoint(gfx,"floating")}function createSegmentDraggers(gfx,connection){for(var segmentStart,segmentEnd,waypoints=connection.waypoints,i=1;iwaypointCount-3&&(targetToSegmentOrientation=LayoutUtil.getOrientation(connection.target,newSegmentEnd),segmentEndIndex===waypointCount-2?"intersect"===targetToSegmentOrientation&&(newWaypoints.pop(),newWaypoints[newWaypoints.length-1]=newSegmentEnd):"intersect"!==targetToSegmentOrientation&&newWaypoints.push(segmentEnd)),context.newWaypoints=connection.waypoints=cropConnection(connection,newWaypoints),updateDragger(context,segmentOffset,e),context.newSegmentStartIndex=segmentStartIndex+segmentOffset,redrawConnection(e)}),eventBus.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,canvas.addMarker(e.hover,MARKER_CONNECT_HOVER)}),eventBus.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var hover=e.context.hover;hover&&canvas.removeMarker(hover,MARKER_CONNECT_HOVER)}),eventBus.on("connectionSegment.move.cleanup",function(e){var context=e.context,connection=context.connection;context.draggerGfx&&svgRemove(context.draggerGfx),canvas.removeMarker(connection,MARKER_CONNECT_UPDATING)}),eventBus.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var context=e.context,connection=context.connection;connection.waypoints=context.originalWaypoints,redrawConnection(e)}),eventBus.on("connectionSegment.move.end",function(e){var context=e.context,connection=context.connection,newWaypoints=context.newWaypoints,newSegmentStartIndex=context.newSegmentStartIndex;newWaypoints=newWaypoints.map(function(p){return{original:p.original,x:Math.round(p.x),y:Math.round(p.y)}});var filtered=filterRedundantWaypoints(newWaypoints,newSegmentStartIndex),filteredWaypoints=filtered.waypoints,croppedWaypoints=cropConnection(connection,filteredWaypoints),segmentOffset=filtered.segmentOffset,hints={segmentMove:{segmentStartIndex:context.segmentStartIndex,newSegmentStartIndex:newSegmentStartIndex+segmentOffset}};modeling.updateWaypoints(connection,croppedWaypoints,hints)})}var Geometry=require("../../util/Geometry"),BendpointUtil=require("./BendpointUtil"),LayoutUtil=require("../../layout/LayoutUtil"),MARKER_CONNECT_HOVER="connect-hover",MARKER_CONNECT_UPDATING="djs-updating",svgClasses=require("tiny-svg/lib/classes"),svgRemove=require("tiny-svg/lib/remove"),translate=require("../../util/SvgTransformUtil").translate;ConnectionSegmentMove.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"],module.exports=ConnectionSegmentMove},{"../../layout/LayoutUtil":308,"../../util/Geometry":324,"../../util/SvgTransformUtil":335,"./BendpointUtil":198,"tiny-svg/lib/classes":542,"tiny-svg/lib/remove":548}],201:[function(require,module,exports){module.exports={__depends__:[require("../dragging"),require("../rules")],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",require("./Bendpoints")],bendpointMove:["type",require("./BendpointMove")],connectionSegmentMove:["type",require("./ConnectionSegmentMove")],bendpointSnapping:["type",require("./BendpointSnapping")]}},{"../dragging":218,"../rules":283,"./BendpointMove":196,"./BendpointSnapping":197,"./Bendpoints":199,"./ConnectionSegmentMove":200}],202:[function(require,module,exports){"use strict";function ChangeSupport(eventBus,canvas,elementRegistry,graphicsFactory){eventBus.on("element.changed",function(event){var element=event.element;(element.parent||element===canvas.getRootElement())&&(event.gfx=elementRegistry.getGraphics(element)),event.gfx&&eventBus.fire(getElementType(element)+".changed",event)}),eventBus.on("elements.changed",function(event){var elements=event.elements;elements.forEach(function(e){eventBus.fire("element.changed",{element:e})}),graphicsFactory.updateContainments(elements)}),eventBus.on("shape.changed",function(event){graphicsFactory.update("shape",event.element,event.gfx)}),eventBus.on("connection.changed",function(event){graphicsFactory.update("connection",event.element,event.gfx)})}var getElementType=require("../../util/Elements").getType;ChangeSupport.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"],module.exports=ChangeSupport},{"../../util/Elements":322}],203:[function(require,module,exports){module.exports={__init__:["changeSupport"],changeSupport:["type",require("./ChangeSupport")]}},{"./ChangeSupport":202}],204:[function(require,module,exports){"use strict";function Clipboard(){}module.exports=Clipboard,Clipboard.prototype.get=function(){return this._data},Clipboard.prototype.set=function(data){this._data=data},Clipboard.prototype.clear=function(){var data=this._data;return delete this._data,data},Clipboard.prototype.isEmpty=function(){return!this._data}},{}],205:[function(require,module,exports){module.exports={clipboard:["type",require("./Clipboard")]}},{"./Clipboard":204}],206:[function(require,module,exports){"use strict";function Connect(eventBus,dragging,modeling,rules,canvas,graphicsFactory){function canConnect(source,target){return rules.allowed("connection.create",{source:source,target:target})}function crop(start,end,source,target){var sourcePath=graphicsFactory.getShapePath(source),targetPath=target&&graphicsFactory.getShapePath(target),connectionPath=graphicsFactory.getConnectionPath({waypoints:[start,end]});return start=LayoutUtil.getElementLineIntersection(sourcePath,connectionPath,!0)||start,end=target&&LayoutUtil.getElementLineIntersection(targetPath,connectionPath,!1)||end,[start,end]}eventBus.on("connect.move",function(event){var endPosition,waypoints,context=event.context,source=context.source,target=context.target,visual=context.visual,sourcePosition=context.sourcePosition;endPosition={x:event.x,y:event.y},waypoints=crop(sourcePosition,endPosition,source,target),svgAttr(visual,{points:[waypoints[0].x,waypoints[0].y,waypoints[1].x,waypoints[1].y]})}),eventBus.on("connect.hover",function(event){var canExecute,context=event.context,source=context.source,hover=event.hover;canExecute=context.canExecute=canConnect(source,hover),null!==canExecute&&(context.target=hover,canvas.addMarker(hover,canExecute?MARKER_OK:MARKER_NOT_OK))}),eventBus.on(["connect.out","connect.cleanup"],function(event){var context=event.context;context.target&&canvas.removeMarker(context.target,context.canExecute?MARKER_OK:MARKER_NOT_OK),context.target=null}),eventBus.on("connect.cleanup",function(event){var context=event.context;context.visual&&svgRemove(context.visual)}),eventBus.on("connect.start",function(event){var visual,context=event.context;visual=svgCreate("polyline"),svgAttr(visual,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),svgAppend(canvas.getDefaultLayer(),visual),context.visual=visual}),eventBus.on("connect.end",function(event){var context=event.context,source=context.source,sourcePosition=context.sourcePosition,target=context.target,targetPosition={x:event.x,y:event.y},canExecute=context.canExecute||canConnect(source,target);if(!canExecute)return!1;var attrs=null,hints={connectionStart:sourcePosition,connectionEnd:targetPosition};"object"==typeof canExecute&&(attrs=canExecute),modeling.connect(source,target,attrs,hints)}),this.start=function(event,source,sourcePosition,autoActivate){"object"!=typeof sourcePosition&&(autoActivate=sourcePosition,sourcePosition=LayoutUtil.getMid(source)),dragging.init(event,"connect",{autoActivate:autoActivate,data:{shape:source,context:{source:source,sourcePosition:sourcePosition}}})}}var LayoutUtil=require("../../layout/LayoutUtil"),MARKER_OK="connect-ok",MARKER_NOT_OK="connect-not-ok",svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create"),svgRemove=require("tiny-svg/lib/remove");Connect.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"],module.exports=Connect},{"../../layout/LayoutUtil":308,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/create":545,"tiny-svg/lib/remove":548}],207:[function(require,module,exports){module.exports={ -__depends__:[require("../selection"),require("../rules"),require("../dragging")],connect:["type",require("./Connect")]}},{"../dragging":218,"../rules":283,"../selection":289,"./Connect":206}],208:[function(require,module,exports){"use strict";function ContextPad(eventBus,overlays){this._providers=[],this._eventBus=eventBus,this._overlays=overlays,this._current=null,this._init()}function addClasses(element,classNames){var classes=domClasses(element),actualClassNames=isArray(classNames)?classNames:classNames.split(/\s+/g);actualClassNames.forEach(function(cls){classes.add(cls)})}var isFunction=require("lodash/lang/isFunction"),isArray=require("lodash/lang/isArray"),forEach=require("lodash/collection/forEach"),domDelegate=require("min-dom/lib/delegate"),domEvent=require("min-dom/lib/event"),domAttr=require("min-dom/lib/attr"),domQuery=require("min-dom/lib/query"),domClasses=require("min-dom/lib/classes"),domify=require("min-dom/lib/domify"),entrySelector=".entry";ContextPad.$inject=["eventBus","overlays"],module.exports=ContextPad,ContextPad.prototype._init=function(){var eventBus=this._eventBus,self=this;eventBus.on("selection.changed",function(e){var selection=e.newSelection;1===selection.length?self.open(selection[0]):self.close()}),eventBus.on("elements.delete",function(event){var elements=event.elements;forEach(elements,function(e){self.isOpen(e)&&self.close()})}),eventBus.on("element.changed",function(event){var element=event.element,current=self._current;current&¤t.element===element&&self.open(element,!0)})},ContextPad.prototype.registerProvider=function(provider){this._providers.push(provider)},ContextPad.prototype.getEntries=function(element){var entries={};return forEach(this._providers,function(provider){var e=provider.getContextPadEntries(element);forEach(e,function(entry,id){entries[id]=entry})}),entries},ContextPad.prototype.trigger=function(action,event,autoActivate){var entry,handler,originalEvent,element=this._current.element,entries=this._current.entries,button=event.delegateTarget||event.target;if(!button)return event.preventDefault();if(entry=entries[domAttr(button,"data-action")],handler=entry.action,originalEvent=event.originalEvent||event,isFunction(handler)){if("click"===action)return handler(originalEvent,element,autoActivate)}else if(handler[action])return handler[action](originalEvent,element,autoActivate);event.preventDefault()},ContextPad.prototype.open=function(element,force){!force&&this.isOpen(element)||(this.close(),this._updateAndOpen(element))},ContextPad.prototype._updateAndOpen=function(element){var entries=this.getEntries(element),pad=this.getPad(element),html=pad.html;forEach(entries,function(entry,id){var container,grouping=entry.group||"default",control=domify(entry.html||'
');domAttr(control,"data-action",id),container=domQuery("[data-group="+grouping+"]",html),container||(container=domify('
'),html.appendChild(container)),container.appendChild(control),entry.className&&addClasses(control,entry.className),entry.title&&domAttr(control,"title",entry.title),entry.imageUrl&&control.appendChild(domify(''))}),domClasses(html).add("open"),this._current={element:element,pad:pad,entries:entries},this._eventBus.fire("contextPad.open",{current:this._current})},ContextPad.prototype.getPad=function(element){if(this.isOpen())return this._current.pad;var self=this,overlays=this._overlays,html=domify('
');domDelegate.bind(html,entrySelector,"click",function(event){self.trigger("click",event)}),domDelegate.bind(html,entrySelector,"dragstart",function(event){self.trigger("dragstart",event)}),domEvent.bind(html,"mousedown",function(event){event.stopPropagation()}),this._overlayId=overlays.add(element,"context-pad",{position:{right:-9,top:-6},html:html});var pad=overlays.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:element,pad:pad}),pad},ContextPad.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ContextPad.prototype.isOpen=function(element){return!(!this._current||element&&this._current.element!==element)}},{"lodash/collection/forEach":362,"lodash/lang/isArray":485,"lodash/lang/isFunction":487,"min-dom/lib/attr":510,"min-dom/lib/classes":511,"min-dom/lib/delegate":514,"min-dom/lib/domify":515,"min-dom/lib/event":516,"min-dom/lib/query":518}],209:[function(require,module,exports){module.exports={__depends__:[require("../interaction-events"),require("../overlays")],contextPad:["type",require("./ContextPad")]}},{"../interaction-events":226,"../overlays":267,"./ContextPad":208}],210:[function(require,module,exports){"use strict";function CopyPaste(eventBus,modeling,elementFactory,rules,clipboard,canvas){this._eventBus=eventBus,this._modeling=modeling,this._elementFactory=elementFactory,this._rules=rules,this._canvas=canvas,this._clipboard=clipboard,this._descriptors=[],this.registerDescriptor(function(element,descriptor){return descriptor.priority=1,descriptor.id=element.id,element.parent&&(descriptor.parent=element.parent.id),element.labelTarget&&(descriptor.priority=4,descriptor.labelTarget=element.labelTarget.id),element.host&&(descriptor.priority=2,descriptor.host=element.host.id),element.x&&(descriptor.x=element.x,descriptor.y=element.y),element.width&&(descriptor.width=element.width,descriptor.height=element.height),element.waypoints&&(descriptor.priority=3,descriptor.waypoints=[],forEach(element.waypoints,function(waypoint){var wp={x:waypoint.x,y:waypoint.y};waypoint.original&&(wp.original={x:waypoint.original.x,y:waypoint.original.y}),descriptor.waypoints.push(wp)})),element.source&&element.target&&(descriptor.source=element.source.id,descriptor.target=element.target.id),descriptor})}var isArray=require("lodash/lang/isArray"),forEach=require("lodash/collection/forEach"),map=require("lodash/collection/map"),find=require("lodash/collection/find"),findIndex=require("lodash/array/findIndex"),sortBy=require("lodash/collection/sortBy"),reduce=require("lodash/collection/reduce"),getBBox=require("../../util/Elements").getBBox,PositionUtil=require("../../util/PositionUtil"),CopyPasteUtil=require("../../util/CopyPasteUtil"),ElementsUtil=require("../../util/Elements");CopyPaste.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"],module.exports=CopyPaste,CopyPaste.prototype.copy=function(selectedElements){var tree,bbox,clipboard=this._clipboard;if(isArray(selectedElements)||(selectedElements=selectedElements?[selectedElements]:[]),selectedElements.length)return tree=this.createTree(selectedElements),bbox=this._bbox=PositionUtil.center(getBBox(tree.allShapes)),delete tree.allShapes,forEach(tree,function(elements){forEach(elements,function(element){var delta,labelTarget;element.labelTarget?(labelTarget=find(elements,{id:element.labelTarget}),delta=labelTarget.waypoints?PositionUtil.delta(element,labelTarget.waypoints[0]):PositionUtil.delta(element,labelTarget)):3===element.priority?(delta=[],forEach(element.waypoints,function(waypoint){var waypointDelta=PositionUtil.delta(waypoint,bbox);delta.push(waypointDelta)},this)):delta=PositionUtil.delta(element,bbox),element.delta=delta})}),this._eventBus.fire("elements.copy",{context:{tree:tree}}),0===Object.keys(tree).length?clipboard.clear():clipboard.set(tree),this._eventBus.fire("elements.copied",{context:{tree:tree}}),tree},CopyPaste.prototype.paste=function(context){var newTree,canPaste,clipboard=this._clipboard,modeling=this._modeling,eventBus=this._eventBus,rules=this._rules,tree=clipboard.get(),topParent=context.element,position=context.point;if(!clipboard.isEmpty())return newTree=reduce(tree,function(pasteTree,elements,depthStr){var depth=parseInt(depthStr,10);return isNaN(depth)?pasteTree:(pasteTree[depth]=elements,pasteTree)},{},this),(canPaste=rules.allowed("elements.paste",{tree:newTree,target:topParent}))?void modeling.pasteElements(newTree,topParent,position):void eventBus.fire("elements.paste.rejected",{context:{tree:newTree,position:position,target:topParent}})},CopyPaste.prototype._computeDelta=function(elements,element){var bbox=this._bbox,delta={};return element.labelTarget?(console.log(elements),PositionUtil.delta(element,element.labelTarget)):(3===element.priority?(delta=[],forEach(element.waypoints,function(waypoint){var waypointDelta=PositionUtil.delta(waypoint,bbox);delta.push(waypointDelta)},this)):delta=PositionUtil.delta(element,bbox),delta)},CopyPaste.prototype.hasRelations=function(elements,element){var source,target,labelTarget;return!(element.waypoints&&(source=find(elements,{id:element.source.id}),target=find(elements,{id:element.target.id}),!source||!target))&&!(element.labelTarget&&(labelTarget=find(elements,{id:element.labelTarget.id}),!labelTarget))},CopyPaste.prototype.registerDescriptor=function(descriptor){if("function"!=typeof descriptor)throw new Error("the descriptor must be a function");if(this._descriptors.indexOf(descriptor)!==-1)throw new Error("this descriptor is already registered");this._descriptors.push(descriptor)},CopyPaste.prototype._executeDescriptors=function(data){return data.descriptor||(data.descriptor={}),forEach(this._descriptors,function(descriptor){data.descriptor=descriptor(data.element,data.descriptor)}),data},CopyPaste.prototype.createTree=function(elements){function canCopy(collection,element){return rules.allowed("element.copy",{collection:collection,element:element})}function includeElement(data){var element,idx=findIndex(includedElements,{element:data.element});return idx===-1?includedElements.push(data):(element=includedElements[idx],void(element.depth=Math.min(rangeB.min,rangeB.max)&&Math.min(rangeA.min,rangeA.max)<=Math.max(rangeB.min,rangeB.max)},DistributeElements.prototype._findRange=function(element){var axis=element[this._axis],dimension=element[this._dimension];return{min:axis+THRESHOLD,max:axis+dimension-THRESHOLD}}},{"lodash/collection/filter":360,"lodash/collection/forEach":362,"lodash/collection/sortBy":371}],215:[function(require,module,exports){"use strict";module.exports={__init__:["distributeElements"],distributeElements:["type",require("./DistributeElements")]}},{"./DistributeElements":214}],216:[function(require,module,exports){"use strict";function suppressEvent(event){event instanceof MouseEvent?Event.stopEvent(event,!0):Event.preventDefault(event)}function getLength(point){return Math.sqrt(Math.pow(point.x,2)+Math.pow(point.y,2))}function substract(p1,p2){return{x:p1.x-p2.x,y:p1.y-p2.y}}function Dragging(eventBus,canvas,selection){function toLocalPoint(globalPosition){var viewbox=canvas.viewbox(),clientRect=canvas._container.getBoundingClientRect();return{x:viewbox.x+round((globalPosition.x-clientRect.left)/viewbox.scale),y:viewbox.y+round((globalPosition.y-clientRect.top)/viewbox.scale)}}function fire(type,dragContext){dragContext=dragContext||context;var event=assign(new EventBusEvent,dragContext.payload,dragContext.data);return eventBus.fire("drag."+type,event)!==!1&&eventBus.fire(dragContext.prefix+"."+type,event)}function move(event,activate){var payload=context.payload,displacement=context.displacement,globalStart=context.globalStart,globalCurrent=Event.toPoint(event),globalDelta=substract(globalCurrent,globalStart),localStart=context.localStart,localCurrent=toLocalPoint(globalCurrent),localDelta=substract(localCurrent,localStart);if(!context.active&&(activate||getLength(globalDelta)>context.threshold)){if(assign(payload,{x:localStart.x+displacement.x,y:localStart.y+displacement.y,dx:0,dy:0},{originalEvent:event}),!1===fire("start"))return cancel();context.active=!0,context.keepSelection||(payload.previousSelection=selection.get(),selection.select(null)),context.cursor&&Cursor.set(context.cursor),canvas.addMarker(canvas.getRootElement(),DRAG_ACTIVE_CLS)}suppressEvent(event),context.active&&(assign(payload,{x:localCurrent.x+displacement.x,y:localCurrent.y+displacement.y,dx:localDelta.x,dy:localDelta.y},{originalEvent:event}),fire("move"))}function end(event){var previousContext,returnValue=!0;context.active&&(event&&(context.payload.originalEvent=event,suppressEvent(event)),returnValue=fire("end")),returnValue===!1&&fire("rejected"),previousContext=cleanup(returnValue!==!0),fire("ended",previousContext)}function checkCancel(event){27===event.which&&(event.preventDefault(),cancel())}function trapClickAndEnd(event){var untrap;context.active&&(untrap=ClickTrap.install(),setTimeout(untrap,400)),end(event)}function trapTouch(event){move(event)}function hover(event){var payload=context.payload;payload.hoverGfx=event.gfx,payload.hover=event.element,fire("hover")}function out(event){fire("out");var payload=context.payload;payload.hoverGfx=null,payload.hover=null}function cancel(restore){var previousContext;if(context){var wasActive=context.active;wasActive&&fire("cancel"),previousContext=cleanup(restore),wasActive&&fire("canceled",previousContext)}}function cleanup(restore){var previousContext,endDrag;fire("cleanup"),Cursor.unset(),endDrag=context.trapClick?trapClickAndEnd:end,domEvent.unbind(document,"mousemove",move),domEvent.unbind(document,"mousedown",endDrag,!0),domEvent.unbind(document,"mouseup",endDrag,!0),domEvent.unbind(document,"keyup",checkCancel),domEvent.unbind(document,"touchstart",trapTouch,!0),domEvent.unbind(document,"touchcancel",cancel,!0),domEvent.unbind(document,"touchmove",move,!0),domEvent.unbind(document,"touchend",end,!0),eventBus.off("element.hover",hover),eventBus.off("element.out",out),canvas.removeMarker(canvas.getRootElement(),DRAG_ACTIVE_CLS);var previousSelection=context.payload.previousSelection;return restore!==!1&&previousSelection&&!selection.get().length&&selection.select(previousSelection),previousContext=context,context=null,previousContext}function init(event,relativeTo,prefix,options){context&&cancel(!1),"string"==typeof relativeTo&&(options=prefix,prefix=relativeTo,relativeTo=null),options=assign({},defaultOptions,options||{});var originalEvent,globalStart,endDrag,data=options.data||{};endDrag=options.trapClick?trapClickAndEnd:end,event?(originalEvent=Event.getOriginal(event)||event,globalStart=Event.toPoint(event),suppressEvent(event)):(originalEvent=null,globalStart={x:0,y:0});var localStart=toLocalPoint(globalStart);relativeTo||(relativeTo=localStart),context=assign({prefix:prefix,data:data,payload:{},globalStart:globalStart,displacement:substract(relativeTo,localStart),localStart:localStart},options),options.manual||("undefined"!=typeof TouchEvent&&originalEvent instanceof TouchEvent?(domEvent.bind(document,"touchstart",trapTouch,!0),domEvent.bind(document,"touchcancel",cancel,!0),domEvent.bind(document,"touchmove",move,!0),domEvent.bind(document,"touchend",end,!0)):(domEvent.bind(document,"mousemove",move),domEvent.bind(document,"mousedown",endDrag,!0),domEvent.bind(document,"mouseup",endDrag,!0)),domEvent.bind(document,"keyup",checkCancel),eventBus.on("element.hover",hover),eventBus.on("element.out",out)),fire("init"),options.autoActivate&&move(event,!0)}var context,defaultOptions={threshold:5,trapClick:!0};eventBus.on("diagram.destroy",cancel),this.init=init,this.move=move,this.hover=hover,this.out=out,this.end=end,this.cancel=cancel,this.context=function(){return context},this.setOptions=function(options){assign(defaultOptions,options)}}var round=Math.round,assign=require("lodash/object/assign"),domEvent=require("min-dom/lib/event"),Event=require("../../util/Event"),ClickTrap=require("../../util/ClickTrap"),Cursor=require("../../util/Cursor"),EventBusEvent=require("../../core/EventBus").Event,DRAG_ACTIVE_CLS="djs-drag-active";Dragging.$inject=["eventBus","canvas","selection"],module.exports=Dragging},{"../../core/EventBus":181,"../../util/ClickTrap":318,"../../util/Cursor":321,"../../util/Event":323,"lodash/object/assign":495,"min-dom/lib/event":516}],217:[function(require,module,exports){"use strict";function getGfx(target){var node=domClosest(target,"svg, .djs-element",!0);return node}function HoverFix(eventBus,dragging,elementRegistry){var self=this;eventBus.on("drag.start",function(event){eventBus.once("drag.move",function(){eventBus.once("drag.move",function(event){self.ensureHover(event)})})}),this.ensureHover=function(event){if(!event.hover){var position,target,element,gfx,originalEvent=event.originalEvent;originalEvent instanceof MouseEvent&&(position=Event.toPoint(originalEvent),target=document.elementFromPoint(position.x,position.y),gfx=getGfx(target),gfx&&(element=elementRegistry.get(gfx),dragging.hover({element:element,gfx:gfx})))}}}var domClosest=require("min-dom/lib/closest"),Event=require("../../util/Event");HoverFix.$inject=["eventBus","dragging","elementRegistry"],module.exports=HoverFix},{"../../util/Event":323,"min-dom/lib/closest":513}],218:[function(require,module,exports){module.exports={__init__:["hoverFix"],__depends__:[require("../selection")],dragging:["type",require("./Dragging")],hoverFix:["type",require("./HoverFix")]}},{"../selection":289,"./Dragging":216,"./HoverFix":217}],219:[function(require,module,exports){"use strict";function EditorActions(eventBus,commandStack,modeling,selection,zoomScroll,copyPaste,canvas,rules,mouseTracking){this._actions={undo:function(){commandStack.undo()},redo:function(){commandStack.redo()},copy:function(){var selectedElements=selection.get();copyPaste.copy(selectedElements)},paste:function(){var context=mouseTracking.getHoverContext();copyPaste.paste(context)},stepZoom:function(opts){zoomScroll.stepZoom(opts.value)},zoom:function(opts){canvas.zoom(opts.value)},removeSelection:function(){var selectedElements=selection.get();if(selectedElements.length){var removableElements,allowed=rules.allowed("elements.delete",{elements:selectedElements});if(allowed===!1)return;removableElements=isArray(allowed)?allowed:selectedElements,removableElements.length&&modeling.removeElements(removableElements.slice())}},moveCanvas:function(opts){var dx=0,dy=0,invertY=opts.invertY,speed=opts.speed,actualSpeed=speed/Math.min(Math.sqrt(canvas.viewbox().scale),1);switch(opts.direction){case"left":dx=actualSpeed;break;case"up":dy=actualSpeed;break;case"right":dx=-actualSpeed;break;case"down":dy=-actualSpeed}dy&&invertY&&(dy=-dy),canvas.scroll({dx:dx,dy:dy})}}}function error(action,message){return new Error(action+" "+message)}var forEach=require("lodash/collection/forEach"),isArray=require("lodash/lang/isArray"),NOT_REGISTERED_ERROR="is not a registered action",IS_REGISTERED_ERROR="is already registered";EditorActions.$inject=["eventBus","commandStack","modeling","selection","zoomScroll","copyPaste","canvas","rules","mouseTracking"],module.exports=EditorActions,EditorActions.prototype.trigger=function(action,opts){if(!this._actions[action])throw error(action,NOT_REGISTERED_ERROR);return this._actions[action](opts)},EditorActions.prototype.register=function(actions,listener){return"string"==typeof actions?this._registerAction(actions,listener):void forEach(actions,function(listener,action){this._registerAction(action,listener)},this)},EditorActions.prototype._registerAction=function(action,listener){if(this.isRegistered(action))throw error(action,IS_REGISTERED_ERROR);this._actions[action]=listener},EditorActions.prototype.unregister=function(action){if(!this.isRegistered(action))throw error(action,NOT_REGISTERED_ERROR);this._actions[action]=void 0},EditorActions.prototype.length=function(){return Object.keys(this._actions).length},EditorActions.prototype.isRegistered=function(action){return!!this._actions[action]}},{"lodash/collection/forEach":362,"lodash/lang/isArray":485}],220:[function(require,module,exports){module.exports={__depends__:[require("../selection"),require("../copy-paste"),require("../../navigation/zoomscroll")],__init__:["editorActions"],editorActions:["type",require("./EditorActions")]}},{"../../navigation/zoomscroll":316,"../copy-paste":211,"../selection":289,"./EditorActions":219}],221:[function(require,module,exports){"use strict";function GlobalConnect(eventBus,dragging,connect,canvas,toolManager){var self=this;this._dragging=dragging,toolManager.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),eventBus.on("global-connect.hover",function(event){var context=event.context,startTarget=event.hover,canStartConnect=context.canStartConnect=self.canStartConnect(startTarget);null!==canStartConnect&&(context.startTarget=startTarget,canvas.addMarker(startTarget,canStartConnect?MARKER_OK:MARKER_NOT_OK))}),eventBus.on(["global-connect.out","global-connect.cleanup"],function(event){var startTarget=event.context.startTarget,canStartConnect=event.context.canStartConnect;startTarget&&canvas.removeMarker(startTarget,canStartConnect?MARKER_OK:MARKER_NOT_OK)}),eventBus.on(["global-connect.ended"],function(event){var context=event.context,startTarget=context.startTarget,startPosition={x:event.x,y:event.y},canStartConnect=self.canStartConnect(startTarget);if(canStartConnect)return eventBus.once("element.out",function(){eventBus.once(["connect.ended","connect.canceled"],function(){eventBus.fire("global-connect.drag.ended")}),connect.start(null,startTarget,startPosition)}),!1})}var MARKER_OK="connect-ok",MARKER_NOT_OK="connect-not-ok";GlobalConnect.$inject=["eventBus","dragging","connect","canvas","toolManager"],module.exports=GlobalConnect,GlobalConnect.prototype.start=function(event){this._dragging.init(event,"global-connect",{trapClick:!1,data:{context:{}}})},GlobalConnect.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},GlobalConnect.prototype.isActive=function(){var context=this._dragging.context();return context&&/^global-connect/.test(context.prefix)},GlobalConnect.prototype.registerProvider=function(provider){this._provider=provider},GlobalConnect.prototype.canStartConnect=function(startTarget){return this._provider.canStartConnect(startTarget)}},{}],222:[function(require,module,exports){module.exports={__depends__:[require("../connect"),require("../rules"),require("../dragging"),require("../tool-manager")],globalConnect:["type",require("./GlobalConnect")]}},{"../connect":207,"../dragging":218,"../rules":283,"../tool-manager":298,"./GlobalConnect":221}],223:[function(require,module,exports){"use strict";function HandTool(eventBus,canvas,dragging,toolManager){this._dragging=dragging,toolManager.registerTool("hand",{tool:"hand",dragging:"hand.move"}),eventBus.on("element.mousedown",HIGH_PRIORITY,function(event){if(hasPrimaryModifier(event))return this.activateMove(event.originalEvent),!1},this),eventBus.on("hand.end",function(event){var target=event.originalEvent.target;return!!(event.hover||target instanceof SVGElement)&&void eventBus.once("hand.ended",function(){this.activateMove(event.originalEvent,{reactivate:!0})},this)},this),eventBus.on("hand.move.move",function(event){var scale=canvas.viewbox().scale;canvas.scroll({dx:event.dx*scale,dy:event.dy*scale})}),eventBus.on("hand.move.end",function(event){var context=event.context,reactivate=context.reactivate;return!hasPrimaryModifier(event)&&reactivate&&eventBus.once("hand.move.ended",function(event){this.activateHand(event.originalEvent,!0,!0)},this),!1},this)}var hasPrimaryModifier=require("../../util/Mouse").hasPrimaryModifier,HIGH_PRIORITY=1500,HAND_CURSOR="grab";HandTool.$inject=["eventBus","canvas","dragging","toolManager"],module.exports=HandTool,HandTool.prototype.activateMove=function(event,autoActivate,context){"object"==typeof autoActivate&&(context=autoActivate,autoActivate=!1),this._dragging.init(event,"hand.move",{autoActivate:autoActivate,cursor:HAND_CURSOR,data:{context:context||{}}})},HandTool.prototype.activateHand=function(event,autoActivate,reactivate){this._dragging.init(event,"hand",{trapClick:!1,autoActivate:autoActivate,cursor:HAND_CURSOR,data:{context:{reactivate:reactivate}}})},HandTool.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},HandTool.prototype.isActive=function(){var context=this._dragging.context();return context&&/^hand/.test(context.prefix)}},{"../../util/Mouse":330 -}],224:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../tool-manager")],__init__:["handTool"],handTool:["type",require("./HandTool")]}},{"../tool-manager":298,"./HandTool":223}],225:[function(require,module,exports){"use strict";function InteractionEvents(eventBus,elementRegistry,styles){function fire(type,event,element){if(isPrimaryButton(event)){var target,gfx,returnValue;element?gfx=elementRegistry.getGraphics(element):(target=event.delegateTarget||event.target,target&&(gfx=target,element=elementRegistry.get(gfx))),gfx&&element&&(returnValue=eventBus.fire(type,{element:element,gfx:gfx,originalEvent:event}),returnValue===!1&&(event.stopPropagation(),event.preventDefault()))}}function mouseHandler(type){var fn=handlers[type];return fn||(fn=handlers[type]=function(event){fire(type,event)}),fn}function triggerMouseEvent(eventName,event,targetElement){var localEventName=bindings[eventName];if(!localEventName)throw new Error("unmapped DOM event name <"+eventName+">");return fire(localEventName,event,targetElement)}function registerEvent(node,event,localEvent){var handler=mouseHandler(localEvent);handler.$delegate=domDelegate.bind(node,elementSelector,event,handler)}function unregisterEvent(node,event,localEvent){domDelegate.unbind(node,event,mouseHandler(localEvent).$delegate)}function registerEvents(svg){forEach(bindings,function(val,key){registerEvent(svg,key,val)})}function unregisterEvents(svg){forEach(bindings,function(val,key){unregisterEvent(svg,key,val)})}var HIT_STYLE=styles.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15}),handlers={},bindings={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup"},elementSelector="svg, .djs-element";eventBus.on("canvas.destroy",function(event){unregisterEvents(event.svg)}),eventBus.on("canvas.init",function(event){registerEvents(event.svg)}),eventBus.on(["shape.added","connection.added"],function(event){var hit,element=event.element,gfx=event.gfx;element.waypoints?hit=createLine(element.waypoints):(hit=svgCreate("rect"),svgAttr(hit,{x:0,y:0,width:element.width,height:element.height})),svgAttr(hit,HIT_STYLE),svgAppend(gfx,hit)}),eventBus.on("shape.changed",LOW_PRIORITY,function(event){var element=event.element,gfx=event.gfx,hit=domQuery(".djs-hit",gfx);svgAttr(hit,{width:element.width,height:element.height})}),eventBus.on("connection.changed",function(event){var element=event.element,gfx=event.gfx,hit=domQuery(".djs-hit",gfx);updateLine(hit,element.waypoints)}),this.fire=fire,this.triggerMouseEvent=triggerMouseEvent,this.mouseHandler=mouseHandler,this.registerEvent=registerEvent,this.unregisterEvent=unregisterEvent}var forEach=require("lodash/collection/forEach"),domDelegate=require("min-dom/lib/delegate"),isPrimaryButton=require("../../util/Mouse").isPrimaryButton,svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create"),domQuery=require("min-dom/lib/query"),renderUtil=require("../../util/RenderUtil"),createLine=renderUtil.createLine,updateLine=renderUtil.updateLine,LOW_PRIORITY=500;InteractionEvents.$inject=["eventBus","elementRegistry","styles"],module.exports=InteractionEvents},{"../../util/Mouse":330,"../../util/RenderUtil":334,"lodash/collection/forEach":362,"min-dom/lib/delegate":514,"min-dom/lib/query":518,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/create":545}],226:[function(require,module,exports){module.exports={__init__:["interactionEvents"],interactionEvents:["type",require("./InteractionEvents")]}},{"./InteractionEvents":225}],227:[function(require,module,exports){"use strict";function Keyboard(config,eventBus,editorActions){var self=this;this._config=config||{},this._eventBus=eventBus,this._editorActions=editorActions,this._listeners=[],this._keyHandler=function(event){var i,l,target=event.target,listeners=self._listeners,code=event.keyCode||event.charCode||-1;if(!target||!domMatches(target,"input, textarea")&&"true"!==target.contentEditable)for(i=0;l=listeners[i];i++)l(code,event)&&(event.preventDefault(),event.stopPropagation())},eventBus.on("diagram.destroy",function(){self._fire("destroy"),self.unbind(),self._listeners=null}),eventBus.on("diagram.init",function(){self._fire("init"),config&&config.bindTo&&self.bind(config.bindTo)}),this._init()}function hasModifier(modifiers){return modifiers.ctrlKey||modifiers.metaKey||modifiers.shiftKey||modifiers.altKey}function isCmd(modifiers){return modifiers.ctrlKey||modifiers.metaKey}function isShift(modifiers){return modifiers.shiftKey}var domEvent=require("min-dom/lib/event"),domMatches=require("min-dom/lib/matches");Keyboard.$inject=["config.keyboard","eventBus","editorActions"],module.exports=Keyboard,Keyboard.prototype.bind=function(node){this.unbind(),this._node=node,domEvent.bind(node,"keydown",this._keyHandler,!0),this._fire("bind")},Keyboard.prototype.getBinding=function(){return this._node},Keyboard.prototype.unbind=function(){var node=this._node;node&&(this._fire("unbind"),domEvent.unbind(node,"keydown",this._keyHandler,!0)),this._node=null},Keyboard.prototype._fire=function(event){this._eventBus.fire("keyboard."+event,{node:this._node,listeners:this._listeners})},Keyboard.prototype._init=function(){function undo(key,modifiers){if(isCmd(modifiers)&&!isShift(modifiers)&&90===key)return editorActions.trigger("undo"),!0}function redo(key,modifiers){if(isCmd(modifiers)&&(89===key||90===key&&isShift(modifiers)))return editorActions.trigger("redo"),!0}function copy(key,modifiers){if(isCmd(modifiers)&&67===key)return editorActions.trigger("copy"),!0}function paste(key,modifiers){if(isCmd(modifiers)&&86===key)return editorActions.trigger("paste"),!0}function zoomIn(key,modifiers){if((107===key||187===key||171===key||61===key)&&isCmd(modifiers))return editorActions.trigger("stepZoom",{value:1}),!0}function zoomOut(key,modifiers){if((109===key||189===key||173===key)&&isCmd(modifiers))return editorActions.trigger("stepZoom",{value:-1}),!0}function zoomDefault(key,modifiers){if((96===key||48===key)&&isCmd(modifiers))return editorActions.trigger("zoom",{value:1}),!0}function removeSelection(key,modifiers){if(46===key)return editorActions.trigger("removeSelection"),!0}function moveCanvas(key,modifiers){if([37,38,39,40].indexOf(key)>=0){var opts={invertY:config.invertY,speed:config.speed||50};switch(key){case 37:opts.direction="left";break;case 38:opts.direction="up";break;case 39:opts.direction="right";break;case 40:opts.direction="down"}return editorActions.trigger("moveCanvas",opts),!0}}var listeners=this._listeners,editorActions=this._editorActions,config=this._config;listeners.push(undo),listeners.push(redo),listeners.push(copy),listeners.push(paste),listeners.push(removeSelection),listeners.push(zoomIn),listeners.push(zoomOut),listeners.push(zoomDefault),listeners.push(moveCanvas)},Keyboard.prototype.addListener=function(listenerFn){this._listeners.push(listenerFn)},Keyboard.prototype.hasModifier=hasModifier,Keyboard.prototype.isCmd=isCmd,Keyboard.prototype.isShift=isShift},{"min-dom/lib/event":516,"min-dom/lib/matches":517}],228:[function(require,module,exports){module.exports={__init__:["keyboard"],keyboard:["type",require("./Keyboard")]}},{"./Keyboard":227}],229:[function(require,module,exports){"use strict";function LabelSupport(eventBus,modeling,movePreview){CommandInterceptor.call(this,eventBus),eventBus.on("shape.move.start",HIGH_PRIORITY,function(e){var context=e.context,shapes=context.shapes,validatedShapes=context.validatedShapes;context.shapes=removeLabels(shapes),context.validatedShapes=removeLabels(validatedShapes)}),eventBus.on("shape.move.start",LOW_PRIORITY,function(e){var context=e.context,shapes=context.shapes,labels=[];forEach(shapes,function(element){var label=element.label;label&&!label.hidden&&context.shapes.indexOf(label)===-1&&labels.push(label),element.labelTarget&&labels.push(element)}),forEach(labels,function(label){movePreview.makeDraggable(context,label,!0)})}),this.postExecuted(["elements.move"],function(e){var context=e.context,closure=context.closure,enclosedElements=closure.enclosedElements;forEach(enclosedElements,function(e){e.label&&!enclosedElements[e.label.id]&&modeling.moveShape(e.label,context.delta,e.parent)})})}function removeLabels(elements){return filter(elements,function(element){return elements.indexOf(element.labelTarget)===-1})}var forEach=require("lodash/collection/forEach"),filter=require("lodash/collection/filter"),inherits=require("inherits"),LOW_PRIORITY=250,HIGH_PRIORITY=1400,CommandInterceptor=require("../../command/CommandInterceptor");inherits(LabelSupport,CommandInterceptor),LabelSupport.$inject=["eventBus","modeling","movePreview"],module.exports=LabelSupport},{"../../command/CommandInterceptor":175,inherits:347,"lodash/collection/filter":360,"lodash/collection/forEach":362}],230:[function(require,module,exports){module.exports={__depends__:[require("../move")],__init__:["labelSupport"],labelSupport:["type",require("./LabelSupport")]}},{"../move":262,"./LabelSupport":229}],231:[function(require,module,exports){"use strict";function LassoTool(eventBus,canvas,dragging,elementRegistry,selection,toolManager){this._selection=selection,this._dragging=dragging;var self=this,visuals={create:function(context){var frame,container=canvas.getDefaultLayer();frame=context.frame=svgCreate("rect"),svgAttr(frame,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),svgAppend(container,frame)},update:function(context){var frame=context.frame,bbox=context.bbox;svgAttr(frame,{x:bbox.x,y:bbox.y,width:bbox.width,height:bbox.height})},remove:function(context){context.frame&&svgRemove(context.frame)}};toolManager.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),eventBus.on("lasso.selection.end",function(event){var target=event.originalEvent.target;(event.hover||target instanceof SVGElement)&&eventBus.once("lasso.selection.ended",function(){self.activateLasso(event.originalEvent,!0)})}),eventBus.on("lasso.end",function(event){var bbox=toBBox(event),elements=elementRegistry.filter(function(element){return element});self.select(elements,bbox)}),eventBus.on("lasso.start",function(event){var context=event.context;context.bbox=toBBox(event),visuals.create(context)}),eventBus.on("lasso.move",function(event){var context=event.context;context.bbox=toBBox(event),visuals.update(context)}),eventBus.on("lasso.cleanup",function(event){var context=event.context;visuals.remove(context)}),eventBus.on("element.mousedown",1500,function(event){hasSecondaryModifier(event)&&(self.activateLasso(event.originalEvent),event.stopPropagation())})}function toBBox(event){var bbox,start={x:event.x-event.dx,y:event.y-event.dy},end={x:event.x,y:event.y};return bbox=start.x<=end.x&&start.y=end.x&&start.yend.x&&start.y<=end.y?{x:end.x,y:start.y,width:start.x-end.x,height:end.y-start.y}:start.x<=end.x&&start.y>end.y||start.x=end.y?{x:start.x,y:end.y,width:end.x-start.x,height:start.y-end.y}:start.x>=end.x&&start.y>end.y||start.x>end.x&&start.y>=end.y?{x:end.x,y:end.y,width:start.x-end.x,height:start.y-end.y}:{x:end.x,y:end.y,width:0,height:0}}var values=require("lodash/object/values"),getEnclosedElements=require("../../util/Elements").getEnclosedElements,hasSecondaryModifier=require("../../util/Mouse").hasSecondaryModifier,svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create"),svgRemove=require("tiny-svg/lib/remove"),LASSO_TOOL_CURSOR="crosshair";LassoTool.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"],module.exports=LassoTool,LassoTool.prototype.activateLasso=function(event,autoActivate){this._dragging.init(event,"lasso",{autoActivate:autoActivate,cursor:LASSO_TOOL_CURSOR,data:{context:{}}})},LassoTool.prototype.activateSelection=function(event){this._dragging.init(event,"lasso.selection",{trapClick:!1,cursor:LASSO_TOOL_CURSOR,data:{context:{}}})},LassoTool.prototype.select=function(elements,bbox){var selectedElements=getEnclosedElements(elements,bbox);this._selection.select(values(selectedElements))},LassoTool.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},LassoTool.prototype.isActive=function(){var context=this._dragging.context();return context&&/^lasso/.test(context.prefix)}},{"../../util/Elements":322,"../../util/Mouse":330,"lodash/object/values":506,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/create":545,"tiny-svg/lib/remove":548}],232:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../tool-manager")],__init__:["lassoTool"],lassoTool:["type",require("./LassoTool")]}},{"../tool-manager":298,"./LassoTool":231}],233:[function(require,module,exports){"use strict";function Modeling(eventBus,elementFactory,commandStack){this._eventBus=eventBus,this._elementFactory=elementFactory,this._commandStack=commandStack;var self=this;eventBus.on("diagram.init",function(){self.registerHandlers(commandStack)})}var forEach=require("lodash/collection/forEach"),model=require("../../model");Modeling.$inject=["eventBus","elementFactory","commandStack"],module.exports=Modeling,Modeling.prototype.getHandlers=function(){return{"shape.append":require("./cmd/AppendShapeHandler"),"shape.create":require("./cmd/CreateShapeHandler"),"shape.delete":require("./cmd/DeleteShapeHandler"),"shape.move":require("./cmd/MoveShapeHandler"),"shape.resize":require("./cmd/ResizeShapeHandler"),"shape.replace":require("./cmd/ReplaceShapeHandler"),"shape.toggleCollapse":require("./cmd/ToggleShapeCollapseHandler"),spaceTool:require("./cmd/SpaceToolHandler"),"label.create":require("./cmd/CreateLabelHandler"),"connection.create":require("./cmd/CreateConnectionHandler"),"connection.delete":require("./cmd/DeleteConnectionHandler"),"connection.move":require("./cmd/MoveConnectionHandler"),"connection.layout":require("./cmd/LayoutConnectionHandler"),"connection.updateWaypoints":require("./cmd/UpdateWaypointsHandler"),"connection.reconnectStart":require("./cmd/ReconnectConnectionHandler"),"connection.reconnectEnd":require("./cmd/ReconnectConnectionHandler"),"elements.move":require("./cmd/MoveElementsHandler"),"elements.delete":require("./cmd/DeleteElementsHandler"),"elements.distribute":require("./cmd/DistributeElementsHandler"),"elements.align":require("./cmd/AlignElementsHandler"),"element.updateAttachment":require("./cmd/UpdateAttachmentHandler"),"elements.paste":require("./cmd/PasteHandler")}},Modeling.prototype.registerHandlers=function(commandStack){forEach(this.getHandlers(),function(handler,id){commandStack.registerHandler(id,handler)})},Modeling.prototype.moveShape=function(shape,delta,newParent,newParentIndex,hints){"object"==typeof newParentIndex&&(hints=newParentIndex,newParentIndex=null);var context={shape:shape,delta:delta,newParent:newParent,newParentIndex:newParentIndex,hints:hints||{}};this._commandStack.execute("shape.move",context)},Modeling.prototype.updateAttachment=function(shape,newHost){var context={shape:shape,newHost:newHost};this._commandStack.execute("element.updateAttachment",context)},Modeling.prototype.moveElements=function(shapes,delta,target,isAttach,hints){"object"==typeof isAttach&&(hints=isAttach,isAttach=void 0);var newHost,newParent=target;isAttach===!0&&(newHost=target,newParent=target.parent),isAttach===!1&&(newHost=null);var context={shapes:shapes,delta:delta,newParent:newParent,newHost:newHost,hints:hints||{}};this._commandStack.execute("elements.move",context)},Modeling.prototype.moveConnection=function(connection,delta,newParent,newParentIndex,hints){"object"==typeof newParentIndex&&(hints=newParentIndex,newParentIndex=void 0);var context={connection:connection,delta:delta,newParent:newParent,newParentIndex:newParentIndex,hints:hints||{}};this._commandStack.execute("connection.move",context)},Modeling.prototype.layoutConnection=function(connection,hints){var context={connection:connection,hints:hints||{}};this._commandStack.execute("connection.layout",context)},Modeling.prototype.createConnection=function(source,target,targetIndex,connection,parent,hints){"object"==typeof targetIndex&&(hints=parent,parent=connection,connection=targetIndex,targetIndex=void 0),connection=this._create("connection",connection);var context={source:source,target:target,parent:parent,parentIndex:targetIndex,connection:connection,hints:hints};return this._commandStack.execute("connection.create",context),context.connection},Modeling.prototype.createShape=function(shape,position,target,targetIndex,isAttach,hints){"number"!=typeof targetIndex&&(hints=isAttach,isAttach=targetIndex),"boolean"!=typeof isAttach&&(hints=isAttach,isAttach=!1),shape=this._create("shape",shape);var context={position:position,shape:shape,parent:target,parentIndex:targetIndex,host:shape.host,hints:hints||{}};return isAttach&&(context.parent=target.parent,context.host=target),this._commandStack.execute("shape.create",context),context.shape},Modeling.prototype.createLabel=function(labelTarget,position,label,parent){label=this._create("label",label);var context={labelTarget:labelTarget,position:position,parent:parent||labelTarget.parent,shape:label};return this._commandStack.execute("label.create",context),context.shape},Modeling.prototype.appendShape=function(source,shape,position,parent,connection,connectionParent){shape=this._create("shape",shape);var context={source:source,position:position,parent:parent,shape:shape,connection:connection,connectionParent:connectionParent};return this._commandStack.execute("shape.append",context),context.shape},Modeling.prototype.removeElements=function(elements){var context={elements:elements};this._commandStack.execute("elements.delete",context)},Modeling.prototype.distributeElements=function(groups,axis,dimension){var context={groups:groups,axis:axis,dimension:dimension};this._commandStack.execute("elements.distribute",context)},Modeling.prototype.removeShape=function(shape,hints){var context={shape:shape,hints:hints||{}};this._commandStack.execute("shape.delete",context)},Modeling.prototype.removeConnection=function(connection,hints){var context={connection:connection,hints:hints||{}};this._commandStack.execute("connection.delete",context)},Modeling.prototype.replaceShape=function(oldShape,newShape,hints){var context={oldShape:oldShape,newData:newShape,hints:hints||{}};return this._commandStack.execute("shape.replace",context),context.newShape},Modeling.prototype.pasteElements=function(tree,topParent,position){var context={tree:tree,topParent:topParent,position:position};this._commandStack.execute("elements.paste",context)},Modeling.prototype.alignElements=function(elements,alignment){var context={elements:elements,alignment:alignment};this._commandStack.execute("elements.align",context)},Modeling.prototype.resizeShape=function(shape,newBounds){var context={shape:shape,newBounds:newBounds};this._commandStack.execute("shape.resize",context)},Modeling.prototype.createSpace=function(movingShapes,resizingShapes,delta,direction){var context={movingShapes:movingShapes,resizingShapes:resizingShapes,delta:delta,direction:direction};this._commandStack.execute("spaceTool",context)},Modeling.prototype.updateWaypoints=function(connection,newWaypoints,hints){var context={connection:connection,newWaypoints:newWaypoints,hints:hints||{}};this._commandStack.execute("connection.updateWaypoints",context)},Modeling.prototype.reconnectStart=function(connection,newSource,dockingOrPoints){var context={connection:connection,newSource:newSource,dockingOrPoints:dockingOrPoints};this._commandStack.execute("connection.reconnectStart",context)},Modeling.prototype.reconnectEnd=function(connection,newTarget,dockingOrPoints){var context={connection:connection,newTarget:newTarget,dockingOrPoints:dockingOrPoints};this._commandStack.execute("connection.reconnectEnd",context)},Modeling.prototype.connect=function(source,target,attrs,hints){return this.createConnection(source,target,attrs||{},source.parent,hints)},Modeling.prototype._create=function(type,attrs){return attrs instanceof model.Base?attrs:this._elementFactory.create(type,attrs)},Modeling.prototype.toggleCollapse=function(shape,hints){var context={shape:shape,hints:hints||{}};this._commandStack.execute("shape.toggleCollapse",context)}},{"../../model":310,"./cmd/AlignElementsHandler":234,"./cmd/AppendShapeHandler":235,"./cmd/CreateConnectionHandler":236,"./cmd/CreateLabelHandler":237,"./cmd/CreateShapeHandler":238,"./cmd/DeleteConnectionHandler":239,"./cmd/DeleteElementsHandler":240,"./cmd/DeleteShapeHandler":241,"./cmd/DistributeElementsHandler":242,"./cmd/LayoutConnectionHandler":243,"./cmd/MoveConnectionHandler":244,"./cmd/MoveElementsHandler":245,"./cmd/MoveShapeHandler":246,"./cmd/PasteHandler":248,"./cmd/ReconnectConnectionHandler":249,"./cmd/ReplaceShapeHandler":250,"./cmd/ResizeShapeHandler":251,"./cmd/SpaceToolHandler":252,"./cmd/ToggleShapeCollapseHandler":253,"./cmd/UpdateAttachmentHandler":254,"./cmd/UpdateWaypointsHandler":255,"lodash/collection/forEach":362}],234:[function(require,module,exports){"use strict";function AlignElements(modeling,canvas){this._modeling=modeling,this._canvas=canvas}var forEach=require("lodash/collection/forEach");AlignElements.$inject=["modeling","canvas"],module.exports=AlignElements,AlignElements.prototype.preExecute=function(context){var modeling=this._modeling,elements=context.elements,alignment=context.alignment;forEach(elements,function(element){var delta={x:0,y:0};alignment.left?delta.x=alignment.left-element.x:alignment.right?delta.x=alignment.right-element.width-element.x:alignment.center?delta.x=alignment.center-Math.round(element.width/2)-element.x:alignment.top?delta.y=alignment.top-element.y:alignment.bottom?delta.y=alignment.bottom-element.height-element.y:alignment.middle&&(delta.y=alignment.middle-Math.round(element.height/2)-element.y),modeling.moveElements([element],delta,element.parent)})},AlignElements.prototype.postExecute=function(context){}},{"lodash/collection/forEach":362}],235:[function(require,module,exports){"use strict";function AppendShapeHandler(modeling){this._modeling=modeling}function existsConnection(source,target){return any(source.outgoing,function(c){return c.target===target})}var any=require("lodash/collection/any"),inherits=require("inherits");inherits(AppendShapeHandler,require("./NoopHandler")),AppendShapeHandler.$inject=["modeling"],module.exports=AppendShapeHandler,AppendShapeHandler.prototype.preExecute=function(context){if(!context.source)throw new Error("source required");var parent=context.parent||context.source.parent,shape=this._modeling.createShape(context.shape,context.position,parent);context.shape=shape},AppendShapeHandler.prototype.postExecute=function(context){var parent=context.connectionParent||context.shape.parent;existsConnection(context.source,context.shape)||this._modeling.connect(context.source,context.shape,context.connection,parent)}},{"./NoopHandler":247,inherits:347,"lodash/collection/any":358}],236:[function(require,module,exports){"use strict";function CreateConnectionHandler(canvas,layouter){this._canvas=canvas,this._layouter=layouter}CreateConnectionHandler.$inject=["canvas","layouter"],module.exports=CreateConnectionHandler,CreateConnectionHandler.prototype.execute=function(context){var connection=context.connection,source=context.source,target=context.target,parent=context.parent,hints=context.hints;if(!source||!target)throw new Error("source and target required");if(!parent)throw new Error("parent required");return connection.source=source,connection.target=target,connection.waypoints||(connection.waypoints=this._layouter.layoutConnection(connection,hints)),this._canvas.addConnection(connection,parent),connection},CreateConnectionHandler.prototype.revert=function(context){var connection=context.connection;this._canvas.removeConnection(connection),connection.source=null,connection.target=null}},{}],237:[function(require,module,exports){"use strict";function CreateLabelHandler(canvas){CreateShapeHandler.call(this,canvas)}function ensureValidDimensions(label){["width","height"].forEach(function(prop){"undefined"==typeof label[prop]&&(label[prop]=0)})}var inherits=require("inherits"),CreateShapeHandler=require("./CreateShapeHandler");inherits(CreateLabelHandler,CreateShapeHandler),CreateLabelHandler.$inject=["canvas"],module.exports=CreateLabelHandler;var originalExecute=CreateShapeHandler.prototype.execute;CreateLabelHandler.prototype.execute=function(context){var label=context.shape;return ensureValidDimensions(label),label.labelTarget=context.labelTarget,originalExecute.call(this,context)};var originalRevert=CreateShapeHandler.prototype.revert;CreateLabelHandler.prototype.revert=function(context){return context.shape.labelTarget=null,originalRevert.call(this,context)}},{"./CreateShapeHandler":238,inherits:347}],238:[function(require,module,exports){"use strict";function CreateShapeHandler(canvas){this._canvas=canvas}var assign=require("lodash/object/assign"),round=Math.round;CreateShapeHandler.$inject=["canvas"],module.exports=CreateShapeHandler,CreateShapeHandler.prototype.execute=function(context){var shape=context.shape,positionOrBounds=context.position,parent=context.parent,parentIndex=context.parentIndex;if(!parent)throw new Error("parent required");if(!positionOrBounds)throw new Error("position required");return void 0!==positionOrBounds.width?assign(shape,positionOrBounds):assign(shape,{x:positionOrBounds.x-round(shape.width/2),y:positionOrBounds.y-round(shape.height/2)}),this._canvas.addShape(shape,parent,parentIndex),shape},CreateShapeHandler.prototype.revert=function(context){this._canvas.removeShape(context.shape)}},{"lodash/object/assign":495}],239:[function(require,module,exports){"use strict";function DeleteConnectionHandler(canvas,modeling){this._canvas=canvas,this._modeling=modeling}var Collections=require("../../../util/Collections");DeleteConnectionHandler.$inject=["canvas","modeling"],module.exports=DeleteConnectionHandler,DeleteConnectionHandler.prototype.preExecute=function(context){var connection=context.connection;connection.label&&this._modeling.removeShape(connection.label)},DeleteConnectionHandler.prototype.execute=function(context){var connection=context.connection,parent=connection.parent;return context.parent=parent,context.parentIndex=Collections.indexOf(parent.children,connection),context.source=connection.source,context.target=connection.target,this._canvas.removeConnection(connection),connection.source=null,connection.target=null,connection.label=null,connection},DeleteConnectionHandler.prototype.revert=function(context){var connection=context.connection,parent=context.parent,parentIndex=context.parentIndex;return connection.source=context.source,connection.target=context.target,Collections.add(parent.children,connection,parentIndex),this._canvas.addConnection(connection,parent),connection}},{"../../../util/Collections":319}],240:[function(require,module,exports){"use strict";function DeleteElementsHandler(modeling,elementRegistry){this._modeling=modeling,this._elementRegistry=elementRegistry}var forEach=require("lodash/collection/forEach"),inherits=require("inherits");inherits(DeleteElementsHandler,require("./NoopHandler")),DeleteElementsHandler.$inject=["modeling","elementRegistry"],module.exports=DeleteElementsHandler,DeleteElementsHandler.prototype.postExecute=function(context){var modeling=this._modeling,elementRegistry=this._elementRegistry,elements=context.elements;forEach(elements,function(element){elementRegistry.get(element.id)&&(element.waypoints?modeling.removeConnection(element):modeling.removeShape(element))})}},{"./NoopHandler":247,inherits:347,"lodash/collection/forEach":362}],241:[function(require,module,exports){"use strict";function DeleteShapeHandler(canvas,modeling){this._canvas=canvas,this._modeling=modeling}var Collections=require("../../../util/Collections"),saveClear=require("../../../util/Removal").saveClear;DeleteShapeHandler.$inject=["canvas","modeling"],module.exports=DeleteShapeHandler,DeleteShapeHandler.prototype.preExecute=function(context){var modeling=this._modeling,shape=context.shape,label=shape.label;shape.labelTarget&&(context.labelTarget=shape.labelTarget,shape.labelTarget=null),label&&this._modeling.removeShape(label,{nested:!0}),saveClear(shape.incoming,function(connection){modeling.removeConnection(connection,{nested:!0})}),saveClear(shape.outgoing,function(connection){modeling.removeConnection(connection,{nested:!0})}),saveClear(shape.children,function(e){modeling.removeShape(e,{nested:!0})})},DeleteShapeHandler.prototype.execute=function(context){var canvas=this._canvas,shape=context.shape,oldParent=shape.parent;return context.oldParent=oldParent,context.oldParentIndex=Collections.indexOf(oldParent.children,shape),shape.label=null,canvas.removeShape(shape),shape},DeleteShapeHandler.prototype.revert=function(context){var canvas=this._canvas,shape=context.shape,oldParent=context.oldParent,oldParentIndex=context.oldParentIndex,labelTarget=context.labelTarget;return Collections.add(oldParent.children,shape,oldParentIndex),labelTarget&&(labelTarget.label=shape),canvas.addShape(shape,oldParent),shape}},{"../../../util/Collections":319,"../../../util/Removal":333}],242:[function(require,module,exports){"use strict";function DistributeElements(modeling){this._modeling=modeling}var forEach=require("lodash/collection/forEach"),sortBy=require("lodash/collection/sortBy");DistributeElements.$inject=["modeling"],module.exports=DistributeElements;var OFF_AXIS={x:"y",y:"x"};DistributeElements.prototype.preExecute=function(context){function updateRange(group,element){group.range.min=Math.min(element[axis],group.range.min),group.range.max=Math.max(element[axis]+element[dimension],group.range.max)}function center(element){return element[axis]+element[dimension]/2}function lastIdx(arr){return arr.length-1}function rangeDiff(range){return range.max-range.min}function centerElement(refCenter,element){var delta={y:0};delta[axis]=refCenter-center(element),delta[axis]&&(delta[OFF_AXIS[axis]]=0,modeling.moveElements([element],delta,element.parent))}var margin,spaceInBetween,modeling=this._modeling,groups=context.groups,axis=context.axis,dimension=context.dimension,firstGroup=groups[0],lastGroupIdx=lastIdx(groups),lastGroup=groups[lastGroupIdx],groupsSize=0;forEach(groups,function(group,idx){var sortedElements,refElem,refCenter;return group.elements.length<2?void(idx&&idx!==groups.length-1&&(updateRange(group,group.elements[0]),groupsSize+=rangeDiff(group.range))):(sortedElements=sortBy(group.elements,axis),refElem=sortedElements[0],idx===lastGroupIdx&&(refElem=sortedElements[lastIdx(sortedElements)]),refCenter=center(refElem),group.range=null,forEach(sortedElements,function(element){return centerElement(refCenter,element),null===group.range?void(group.range={min:element[axis],max:element[axis]+element[dimension]}):void updateRange(group,element)}),void(idx&&idx!==groups.length-1&&(groupsSize+=rangeDiff(group.range))))}),spaceInBetween=Math.abs(lastGroup.range.min-firstGroup.range.max),margin=Math.round((spaceInBetween-groupsSize)/(groups.length-1)),margin');return parent.insertBefore(root,parent.firstChild),root}function setPosition(el,x,y){assign(el.style,{left:x+"px",top:y+"px"})}function setVisible(el,visible){el.style.display=visible===!1?"none":""}function Overlays(eventBus,canvas,elementRegistry){this._eventBus=eventBus,this._canvas=canvas,this._elementRegistry=elementRegistry,this._ids=ids,this._overlayDefaults={show:{minZoom:.7,maxZoom:5}},this._overlays={},this._overlayContainers=[],this._overlayRoot=createRoot(canvas.getContainer()),this._init()}var isArray=require("lodash/lang/isArray"),isString=require("lodash/lang/isString"),isObject=require("lodash/lang/isObject"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),filter=require("lodash/collection/filter"),domify=require("min-dom/lib/domify"),domClasses=require("min-dom/lib/classes"),domAttr=require("min-dom/lib/attr"),domRemove=require("min-dom/lib/remove"),domClear=require("min-dom/lib/clear"),getBBox=require("../../util/Elements").getBBox,ids=new(require("../../util/IdGenerator"))("ov"),LOW_PRIORITY=500;Overlays.$inject=["eventBus","canvas","elementRegistry"],module.exports=Overlays,Overlays.prototype.get=function(search){if(isString(search)&&(search={id:search}),isString(search.element)&&(search.element=this._elementRegistry.get(search.element)),search.element){var container=this._getOverlayContainer(search.element,!0);return container?search.type?filter(container.overlays,{type:search.type}):container.overlays.slice():[]}return search.type?filter(this._overlays,{type:search.type}):search.id?this._overlays[search.id]:null},Overlays.prototype.add=function(element,type,overlay){if(isObject(type)&&(overlay=type,type=null),element.id||(element=this._elementRegistry.get(element)),!overlay.position)throw new Error("must specifiy overlay position");if(!overlay.html)throw new Error("must specifiy overlay html");if(!element)throw new Error("invalid element specified");var id=this._ids.next();return overlay=assign({},this._overlayDefaults,overlay,{id:id,type:type,element:element,html:overlay.html}),this._addOverlay(overlay),id},Overlays.prototype.remove=function(filter){var overlays=this.get(filter)||[];isArray(overlays)||(overlays=[overlays]);var self=this;forEach(overlays,function(overlay){var container=self._getOverlayContainer(overlay.element,!0);if(overlay&&(domRemove(overlay.html),domRemove(overlay.htmlContainer),delete overlay.htmlContainer,delete overlay.element,delete self._overlays[overlay.id]),container){var idx=container.overlays.indexOf(overlay);idx!==-1&&container.overlays.splice(idx,1)}})},Overlays.prototype.show=function(){setVisible(this._overlayRoot)},Overlays.prototype.hide=function(){setVisible(this._overlayRoot,!1)},Overlays.prototype.clear=function(){this._overlays={},this._overlayContainers=[],domClear(this._overlayRoot)},Overlays.prototype._updateOverlayContainer=function(container){var element=container.element,html=container.html,x=element.x,y=element.y;if(element.waypoints){var bbox=getBBox(element);x=bbox.x,y=bbox.y}setPosition(html,x,y),domAttr(container.html,"data-container-id",element.id)},Overlays.prototype._updateOverlay=function(overlay){var position=overlay.position,htmlContainer=overlay.htmlContainer,element=overlay.element,left=position.left,top=position.top;if(void 0!==position.right){var width;width=element.waypoints?getBBox(element).width:element.width,left=position.right*-1+width}if(void 0!==position.bottom){var height;height=element.waypoints?getBBox(element).height:element.height,top=position.bottom*-1+height}setPosition(htmlContainer,left||0,top||0)},Overlays.prototype._createOverlayContainer=function(element){var html=domify('
');this._overlayRoot.appendChild(html);var container={html:html,element:element,overlays:[]};return this._updateOverlayContainer(container),this._overlayContainers.push(container),container},Overlays.prototype._updateRoot=function(viewbox){var a=viewbox.scale||1,d=viewbox.scale||1,matrix="matrix("+a+",0,0,"+d+","+-1*viewbox.x*a+","+-1*viewbox.y*d+")";this._overlayRoot.style.transform=matrix,this._overlayRoot.style["-ms-transform"]=matrix,this._overlayRoot.style["-webkit-transform"]=matrix},Overlays.prototype._getOverlayContainer=function(element,raw){var container=find(this._overlayContainers,function(c){return c.element===element});return container||raw?container:this._createOverlayContainer(element)},Overlays.prototype._addOverlay=function(overlay){var htmlContainer,overlayContainer,id=overlay.id,element=overlay.element,html=overlay.html;html.get&&(html=html.get(0)),isString(html)&&(html=domify(html)),overlayContainer=this._getOverlayContainer(element),htmlContainer=domify('
'),htmlContainer.appendChild(html),overlay.type&&domClasses(htmlContainer).add("djs-overlay-"+overlay.type),overlay.htmlContainer=htmlContainer,overlayContainer.overlays.push(overlay),overlayContainer.html.appendChild(htmlContainer),this._overlays[id]=overlay,this._updateOverlay(overlay),this._updateOverlayVisibilty(overlay,this._canvas.viewbox())},Overlays.prototype._updateOverlayVisibilty=function(overlay,viewbox){var show=overlay.show,htmlContainer=overlay.htmlContainer,visible=!0;show&&((show.minZoom>viewbox.scale||show.maxZoom
'),entriesContainer.appendChild(container));var html=entry.html||(entry.separator?'
':'
'),control=domify(html);container.appendChild(control),entry.separator||(domAttr(control,"data-action",id),entry.title&&domAttr(control,"title",entry.title),entry.className&&addClasses(control,entry.className),entry.imageUrl&&control.appendChild(domify('')))}),this.open(!0)},Palette.prototype.trigger=function(action,event,autoActivate){var entry,handler,originalEvent,entries=this._entries,button=event.delegateTarget||event.target;return button?(entry=entries[domAttr(button,"data-action")],void(entry&&(handler=entry.action,originalEvent=event.originalEvent||event,isFunction(handler)?"click"===action&&handler(originalEvent,autoActivate):handler[action]&&handler[action](originalEvent,autoActivate),event.preventDefault()))):event.preventDefault()},Palette.prototype.triggerTwoColumn=function(){var canvas=this._canvas,parent=canvas.getContainer();parent.clientHeight<650?domClasses(parent).add("two-column"):domClasses(parent).remove("two-column")},Palette.prototype.close=function(){var canvas=this._canvas,parent=canvas.getContainer();domClasses(this._container).remove("open"),domClasses(parent).remove("two-column")},Palette.prototype.open=function(){domClasses(this._container).add("open"),this.triggerTwoColumn()},Palette.prototype.toggle=function(open){this.isOpen()?this.close():this.open()},Palette.prototype.isActiveTool=function(tool){return tool&&this._activeTool===tool},Palette.prototype.updateToolHighlight=function(name){var entriesContainer,toolsContainer;this._toolsContainer||(entriesContainer=domQuery(".djs-palette-entries",this._container),this._toolsContainer=domQuery("[data-group=tools]",entriesContainer)),toolsContainer=this._toolsContainer,forEach(toolsContainer.children,function(tool){var actionName=tool.getAttribute("data-action");actionName&&(actionName=actionName.replace("-tool",""),tool.classList.contains("entry")&&actionName===name?domClasses(tool).add("highlighted-entry"):domClasses(tool).remove("highlighted-entry"))})},Palette.prototype.isOpen=function(){return this._container&&domClasses(this._container).has("open")},Palette.HTML_MARKUP='
'},{"lodash/collection/forEach":362,"lodash/lang/isArray":485,"lodash/lang/isFunction":487,"min-dom/lib/attr":510,"min-dom/lib/classes":511,"min-dom/lib/clear":512,"min-dom/lib/delegate":514,"min-dom/lib/domify":515,"min-dom/lib/event":516,"min-dom/lib/matches":517,"min-dom/lib/query":518}],269:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../tool-manager")],__init__:["palette"],palette:["type",require("./Palette")]}},{"../tool-manager":298,"./Palette":268}],270:[function(require,module,exports){"use strict";function PopupMenu(eventBus,canvas){this._eventBus=eventBus,this._canvas=canvas,this._providers={}}var forEach=require("lodash/collection/forEach"),assign=require("lodash/object/assign"),find=require("lodash/collection/find"),domDelegate=require("min-dom/lib/delegate"),domify=require("min-dom/lib/domify"),domClasses=require("min-dom/lib/classes"),domAttr=require("min-dom/lib/attr"),domRemove=require("min-dom/lib/remove"),DATA_REF="data-id";PopupMenu.$inject=["eventBus","canvas"],PopupMenu.prototype.registerProvider=function(id,provider){this._providers[id]=provider},PopupMenu.prototype.create=function(id,element){var provider=this._providers[id];if(!provider)throw new Error("Provider is not registered: "+id);if(!element)throw new Error("Element is missing");var current=this._current={provider:provider,className:id,element:element};return provider.getHeaderEntries&&(current.headerEntries=provider.getHeaderEntries(element)),current.entries=provider.getEntries(element),this},PopupMenu.prototype.isEmpty=function(){var current=this._current;return 0===current.entries.length&¤t.headerEntries&&0===current.headerEntries.length},PopupMenu.prototype.open=function(position){if(!position)throw new Error("the position argument is missing");this.isOpen()&&this.close();var current=this._current,canvas=this._canvas,parent=canvas.getContainer();if(current.position=position,current.container=this._createContainer(),current.headerEntries){var headerEntriesContainer=this._createEntries(current.headerEntries,"djs-popup-header");current.container.appendChild(headerEntriesContainer)}if(current.entries){var entriesContainer=this._createEntries(current.entries,"djs-popup-body");current.container.appendChild(entriesContainer)}return this._attachContainer(current.container,parent,position.cursor),this},PopupMenu.prototype.close=function(){this.isOpen()&&(this._unbindHandlers(),domRemove(this._current.container),this._current.container=null)},PopupMenu.prototype.isOpen=function(){return!!this._current.container},PopupMenu.prototype.trigger=function(event){event.preventDefault();var element=event.delegateTarget||event.target,entryId=domAttr(element,DATA_REF),entry=this._getEntry(entryId);if(entry.action)return entry.action.call(null,event,entry)},PopupMenu.prototype._getEntry=function(entryId){var search={id:entryId},entry=find(this._current.entries,search)||find(this._current.headerEntries,search);if(!entry)throw new Error("entry not found");return entry},PopupMenu.prototype._createContainer=function(){var container=domify('
'),position=this._current.position,className=this._current.className;return assign(container.style,{position:"absolute",left:position.x+"px",top:position.y+"px",visibility:"hidden"}),domClasses(container).add(className),container},PopupMenu.prototype._attachContainer=function(container,parent,cursor){var self=this;domDelegate.bind(container,".entry","click",function(event){self.trigger(event)});var zoom=this._canvas.zoom();container.style.transformOrigin="top left",container.style.transform="scale("+zoom+")",parent.appendChild(container),cursor&&this._assureIsInbounds(container,cursor),this._bindHandlers()},PopupMenu.prototype._assureIsInbounds=function(container,cursor){var left,top,canvas=this._canvas,clientRect=canvas._container.getBoundingClientRect(),containerX=container.offsetLeft,containerY=container.offsetTop,containerWidth=container.scrollWidth,containerHeight=container.scrollHeight,overAxis={},cursorPosition={x:cursor.x-clientRect.left,y:cursor.y-clientRect.top};containerX+containerWidth>clientRect.width&&(overAxis.x=!0),containerY+containerHeight>clientRect.height&&(overAxis.y=!0),overAxis.x&&overAxis.y?(left=cursorPosition.x-containerWidth+"px",top=cursorPosition.y-containerHeight+"px"):overAxis.x?(left=cursorPosition.x-containerWidth+"px",top=cursorPosition.y+"px"):overAxis.y&&cursorPosition.y"),self=this;return domClasses(entriesContainer).add(className),forEach(entries,function(entry){var entryContainer=self._createEntry(entry,entriesContainer);entriesContainer.appendChild(entryContainer)}),entriesContainer},PopupMenu.prototype._createEntry=function(entry){if(!entry.id)throw new Error("every entry must have the id property set");var entryContainer=domify("
"),entryClasses=domClasses(entryContainer);if(entryClasses.add("entry"),entry.className&&entryClasses.add(entry.className),domAttr(entryContainer,DATA_REF,entry.id),entry.label){var label=domify("");label.textContent=entry.label,entryContainer.appendChild(label)}return entry.imageUrl&&entryContainer.appendChild(domify('')),entry.active===!0&&entryClasses.add("active"),entry.disabled===!0&&entryClasses.add("disabled"),entry.title&&(entryContainer.title=entry.title),entryContainer},PopupMenu.prototype._bindHandlers=function(){function close(){self.close()}var eventBus=this._eventBus,self=this;eventBus.once("contextPad.close",close),eventBus.once("canvas.viewbox.changing",close),eventBus.once("commandStack.changed",close)},PopupMenu.prototype._unbindHandlers=function(){function close(){self.close()}var eventBus=this._eventBus,self=this;eventBus.off("contextPad.close",close),eventBus.off("canvas.viewbox.changed",close),eventBus.off("commandStack.changed",close)},module.exports=PopupMenu},{"lodash/collection/find":361,"lodash/collection/forEach":362,"lodash/object/assign":495,"min-dom/lib/attr":510,"min-dom/lib/classes":511,"min-dom/lib/delegate":514,"min-dom/lib/domify":515,"min-dom/lib/remove":519}],271:[function(require,module,exports){"use strict";module.exports={__init__:["popupMenu"],popupMenu:["type",require("./PopupMenu")]}},{"./PopupMenu":270}],272:[function(require,module,exports){"use strict";function PreviewSupport(elementRegistry,canvas,styles){this._elementRegistry=elementRegistry,this._canvas=canvas,this._styles=styles}function removeMarkers(gfx){gfx.children&&forEach(gfx.children,function(child){removeMarkers(child)}),gfx.style.markerStart="",gfx.style.markerEnd=""}function isConnection(element){return element.waypoints}var forEach=require("lodash/collection/forEach"),svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClone=require("tiny-svg/lib/clone"),svgCreate=require("tiny-svg/lib/create");module.exports=PreviewSupport,PreviewSupport.$inject=["elementRegistry","canvas","styles"],PreviewSupport.prototype.getGfx=function(element){return this._elementRegistry.getGraphics(element)},PreviewSupport.prototype.addDragger=function(shape,group){var gfx=this.getGfx(shape),dragger=svgClone(gfx),bbox=gfx.getBoundingClientRect();return isConnection(shape)&&removeMarkers(dragger),svgAttr(dragger,this._styles.cls("djs-dragger",[],{x:bbox.top,y:bbox.left})),svgAppend(group,dragger),dragger},PreviewSupport.prototype.addFrame=function(shape,group){var frame=svgCreate("rect",{class:"djs-resize-overlay",width:shape.width,height:shape.height,x:shape.x,y:shape.y});return svgAppend(group,frame),frame}},{"lodash/collection/forEach":362,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/clone":544,"tiny-svg/lib/create":545}],273:[function(require,module,exports){"use strict";module.exports={__init__:["previewSupport"],previewSupport:["type",require("./PreviewSupport")]}},{"./PreviewSupport":272}],274:[function(require,module,exports){"use strict";function Replace(modeling){this._modeling=modeling}module.exports=Replace,Replace.$inject=["modeling"],Replace.prototype.replaceElement=function(oldElement,newElementData,options){var modeling=this._modeling,newElement=null;return oldElement.waypoints||(newElementData.x=Math.ceil(oldElement.x+(newElementData.width||oldElement.width)/2),newElementData.y=Math.ceil(oldElement.y+(newElementData.height||oldElement.height)/2),newElement=modeling.replaceShape(oldElement,newElementData,options)),newElement}},{}],275:[function(require,module,exports){"use strict";module.exports={__init__:["replace"],replace:["type",require("./Replace")]}},{"./Replace":274}],276:[function(require,module,exports){"use strict";function Resize(eventBus,rules,modeling,dragging){this._dragging=dragging,this._rules=rules;var self=this;eventBus.on("resize.start",function(event){var context=event.context,resizeConstraints=context.resizeConstraints,minBounds=context.minBounds;void 0===resizeConstraints&&(void 0===minBounds&&(minBounds=self.computeMinResizeBox(context)),context.resizeConstraints={min:asTRBL(minBounds)})}),eventBus.on("resize.move",function(event){var delta,newBounds,context=event.context,shape=context.shape,direction=context.direction,resizeConstraints=context.resizeConstraints;delta={x:event.dx,y:event.dy},context.delta=delta,newBounds=ResizeUtil.resizeBounds(shape,direction,delta),context.newBounds=ResizeUtil.ensureConstraints(newBounds,resizeConstraints),context.canExecute=self.canResize(context)}),eventBus.on("resize.end",function(event){var context=event.context,shape=context.shape,canExecute=context.canExecute,newBounds=context.newBounds;canExecute&&(newBounds=roundBounds(newBounds),modeling.resizeShape(shape,newBounds))})}var pick=require("lodash/object/pick"),assign=require("lodash/object/assign"),ResizeUtil=require("./ResizeUtil"),asTRBL=require("../../layout/LayoutUtil").asTRBL,roundBounds=require("../../layout/LayoutUtil").roundBounds,DEFAULT_MIN_WIDTH=10;Resize.prototype.canResize=function(context){var rules=this._rules,ctx=pick(context,["newBounds","shape","delta","direction"]);return rules.allowed("shape.resize",ctx)},Resize.prototype.activate=function(event,shape,contextOrDirection){var context,direction,dragging=this._dragging;if("string"==typeof contextOrDirection&&(contextOrDirection={direction:contextOrDirection}),context=assign({shape:shape},contextOrDirection),direction=context.direction,!direction)throw new Error("must provide a direction (nw|se|ne|sw)");dragging.init(event,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(direction)?"nwse":"nesw"),data:{shape:shape,context:context}})},Resize.prototype.computeMinResizeBox=function(context){var minDimensions,childrenBounds,shape=context.shape,direction=context.direction;return minDimensions=context.minDimensions||{width:DEFAULT_MIN_WIDTH,height:DEFAULT_MIN_WIDTH},childrenBounds=ResizeUtil.computeChildrenBBox(shape,context.childrenBoxPadding),ResizeUtil.getMinResizeBounds(direction,shape,minDimensions,childrenBounds)},Resize.$inject=["eventBus","rules","modeling","dragging"],module.exports=Resize},{"../../layout/LayoutUtil":308,"./ResizeUtil":279,"lodash/object/assign":495,"lodash/object/pick":504}],277:[function(require,module,exports){"use strict";function ResizeHandles(eventBus,canvas,selection,resize){this._resize=resize,this._canvas=canvas;var self=this;eventBus.on("selection.changed",function(e){var newSelection=e.newSelection;self.removeResizers(),1===newSelection.length&&forEach(newSelection,self.addResizer,self)}),eventBus.on("shape.changed",function(e){var shape=e.element;selection.isSelected(shape)&&(self.removeResizers(),self.addResizer(shape))})}var forEach=require("lodash/collection/forEach"),HANDLE_OFFSET=-2,HANDLE_SIZE=5,HANDLE_HIT_SIZE=20,CLS_RESIZER="djs-resizer",svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgClear=require("tiny-svg/lib/clear"),svgCreate=require("tiny-svg/lib/create"),domEvent=require("min-dom/lib/event"),isPrimaryButton=require("../../util/Mouse").isPrimaryButton,asTRBL=require("../../layout/LayoutUtil").asTRBL,transform=require("../../util/SvgTransformUtil").transform;ResizeHandles.prototype.makeDraggable=function(element,gfx,direction){function startResize(event){isPrimaryButton(event)&&resize.activate(event,element,direction)}var resize=this._resize;domEvent.bind(gfx,"mousedown",startResize),domEvent.bind(gfx,"touchstart",startResize)},ResizeHandles.prototype._createResizer=function(element,x,y,rotation,direction){var resizersParent=this._getResizersParent(),group=svgCreate("g");svgClasses(group).add(CLS_RESIZER),svgClasses(group).add(CLS_RESIZER+"-"+element.id),svgClasses(group).add(CLS_RESIZER+"-"+direction),svgAppend(resizersParent,group);var origin=-HANDLE_SIZE+HANDLE_OFFSET,visual=svgCreate("rect");svgAttr(visual,{x:origin,y:origin,width:HANDLE_SIZE,height:HANDLE_SIZE}),svgClasses(visual).add(CLS_RESIZER+"-visual"),svgAppend(group,visual);var hit=svgCreate("rect");return svgAttr(hit,{x:origin,y:origin,width:HANDLE_HIT_SIZE,height:HANDLE_HIT_SIZE}),svgClasses(hit).add(CLS_RESIZER+"-hit"),svgAppend(group,hit),transform(group,x,y,rotation),group},ResizeHandles.prototype.createResizer=function(element,direction){var resizer,trbl=asTRBL(element);resizer="nw"===direction?this._createResizer(element,trbl.left,trbl.top,0,direction):"ne"===direction?this._createResizer(element,trbl.right,trbl.top,90,direction):"se"===direction?this._createResizer(element,trbl.right,trbl.bottom,180,direction):this._createResizer(element,trbl.left,trbl.bottom,270,direction),this.makeDraggable(element,resizer,direction)},ResizeHandles.prototype.addResizer=function(shape){var resize=this._resize;resize.canResize({shape:shape})&&(this.createResizer(shape,"nw"),this.createResizer(shape,"ne"),this.createResizer(shape,"se"),this.createResizer(shape,"sw"))},ResizeHandles.prototype.removeResizers=function(){var resizersParent=this._getResizersParent();svgClear(resizersParent)},ResizeHandles.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},ResizeHandles.$inject=["eventBus","canvas","selection","resize"],module.exports=ResizeHandles},{"../../layout/LayoutUtil":308,"../../util/Mouse":330,"../../util/SvgTransformUtil":335,"lodash/collection/forEach":362,"min-dom/lib/event":516,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/classes":542,"tiny-svg/lib/clear":543,"tiny-svg/lib/create":545}],278:[function(require,module,exports){"use strict";function ResizePreview(eventBus,elementRegistry,canvas,styles,previewSupport){eventBus.on("resize.move",LOW_PRIORITY,function(event){var context=event.context,shape=context.shape,bounds=context.newBounds,frame=context.frame;frame||(frame=context.frame=previewSupport.addFrame(shape,canvas.getDefaultLayer()),canvas.addMarker(shape,MARKER_RESIZING)),bounds.width>5&&svgAttr(frame,{x:bounds.x,width:bounds.width}),bounds.height>5&&svgAttr(frame,{y:bounds.y,height:bounds.height}),context.canExecute?svgClasses(frame).remove(MARKER_RESIZE_NOT_OK):svgClasses(frame).add(MARKER_RESIZE_NOT_OK)}),eventBus.on("resize.cleanup",function(event){var context=event.context,shape=context.shape,frame=context.frame;frame&&svgRemove(context.frame),canvas.removeMarker(shape,MARKER_RESIZING)})}var MARKER_RESIZING="djs-resizing",MARKER_RESIZE_NOT_OK="resize-not-ok",LOW_PRIORITY=500,svgAttr=require("tiny-svg/lib/attr"),svgRemove=require("tiny-svg/lib/remove"),svgClasses=require("tiny-svg/lib/classes");ResizePreview.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"],module.exports=ResizePreview},{"tiny-svg/lib/attr":541,"tiny-svg/lib/classes":542,"tiny-svg/lib/remove":548}],279:[function(require,module,exports){"use strict";function isNumber(a){return"number"==typeof a}function applyConstraints(attr,trbl,resizeConstraints){var value=trbl[attr],minValue=resizeConstraints.min&&resizeConstraints.min[attr],maxValue=resizeConstraints.max&&resizeConstraints.max[attr];return isNumber(minValue)&&(value=(/top|left/.test(attr)?min:max)(value,minValue)),isNumber(maxValue)&&(value=(/top|left/.test(attr)?max:min)(value,maxValue)),value}function asPadding(mayBePadding,defaultValue){return"undefined"!=typeof mayBePadding?mayBePadding:DEFAULT_CHILD_BOX_PADDING}function addPadding(bbox,padding){var left,right,top,bottom;return"object"==typeof padding?(left=asPadding(padding.left),right=asPadding(padding.right),top=asPadding(padding.top), -bottom=asPadding(padding.bottom)):left=right=top=bottom=asPadding(padding),{x:bbox.x-left,y:bbox.y-top,width:bbox.width+left+right,height:bbox.height+top+bottom}}function isBBoxChild(element){return!element.waypoints&&"label"!==element.type}function computeChildrenBBox(shapeOrChildren,padding){var elements;if(elements=void 0===shapeOrChildren.length?filter(shapeOrChildren.children,isBBoxChild):shapeOrChildren,elements.length)return addPadding(getBBox(elements),padding)}var filter=require("lodash/collection/filter"),max=Math.max,min=Math.min,DEFAULT_CHILD_BOX_PADDING=20,getBBox=require("../../util/Elements").getBBox,asTRBL=require("../../layout/LayoutUtil").asTRBL,asBounds=require("../../layout/LayoutUtil").asBounds;module.exports.substractTRBL=function(trblA,trblB){return{top:trblA.top-trblB.top,right:trblA.right-trblB.right,bottom:trblA.bottom-trblB.bottom,left:trblA.left-trblB.left}},module.exports.resizeBounds=function(bounds,direction,delta){var dx=delta.x,dy=delta.y;switch(direction){case"nw":return{x:bounds.x+dx,y:bounds.y+dy,width:bounds.width-dx,height:bounds.height-dy};case"sw":return{x:bounds.x+dx,y:bounds.y,width:bounds.width-dx,height:bounds.height+dy};case"ne":return{x:bounds.x,y:bounds.y+dy,width:bounds.width+dx,height:bounds.height-dy};case"se":return{x:bounds.x,y:bounds.y,width:bounds.width+dx,height:bounds.height+dy};default:throw new Error("unrecognized direction: "+direction)}},module.exports.resizeTRBL=function(bounds,resize){return{x:bounds.x+(resize.left||0),y:bounds.y+(resize.top||0),width:bounds.width-(resize.left||0)+(resize.right||0),height:bounds.height-(resize.top||0)+(resize.bottom||0)}},module.exports.reattachPoint=function(bounds,newBounds,point){var sx=bounds.width/newBounds.width,sy=bounds.height/newBounds.height;return{x:Math.round(newBounds.x+newBounds.width/2)-Math.floor((bounds.x+bounds.width/2-point.x)/sx),y:Math.round(newBounds.y+newBounds.height/2)-Math.floor((bounds.y+bounds.height/2-point.y)/sy)}},module.exports.ensureConstraints=function(currentBounds,resizeConstraints){if(!resizeConstraints)return currentBounds;var currentTrbl=asTRBL(currentBounds);return asBounds({top:applyConstraints("top",currentTrbl,resizeConstraints),right:applyConstraints("right",currentTrbl,resizeConstraints),bottom:applyConstraints("bottom",currentTrbl,resizeConstraints),left:applyConstraints("left",currentTrbl,resizeConstraints)})},module.exports.getMinResizeBounds=function(direction,currentBounds,minDimensions,childrenBounds){var currentBox=asTRBL(currentBounds),minBox={top:/n/.test(direction)?currentBox.bottom-minDimensions.height:currentBox.top,left:/w/.test(direction)?currentBox.right-minDimensions.width:currentBox.left,bottom:/s/.test(direction)?currentBox.top+minDimensions.height:currentBox.bottom,right:/e/.test(direction)?currentBox.left+minDimensions.width:currentBox.right},childrenBox=childrenBounds?asTRBL(childrenBounds):minBox,combinedBox={top:min(minBox.top,childrenBox.top),left:min(minBox.left,childrenBox.left),bottom:max(minBox.bottom,childrenBox.bottom),right:max(minBox.right,childrenBox.right)};return asBounds(combinedBox)},module.exports.addPadding=addPadding,module.exports.computeChildrenBBox=computeChildrenBBox},{"../../layout/LayoutUtil":308,"../../util/Elements":322,"lodash/collection/filter":360}],280:[function(require,module,exports){module.exports={__depends__:[require("../rules"),require("../dragging"),require("../preview-support")],__init__:["resize","resizePreview","resizeHandles"],resize:["type",require("./Resize")],resizePreview:["type",require("./ResizePreview")],resizeHandles:["type",require("./ResizeHandles")]}},{"../dragging":218,"../preview-support":273,"../rules":283,"./Resize":276,"./ResizeHandles":277,"./ResizePreview":278}],281:[function(require,module,exports){"use strict";function RuleProvider(eventBus){CommandInterceptor.call(this,eventBus),this.init()}var inherits=require("inherits"),CommandInterceptor=require("../../command/CommandInterceptor");RuleProvider.$inject=["eventBus"],inherits(RuleProvider,CommandInterceptor),module.exports=RuleProvider,RuleProvider.prototype.addRule=function(actions,priority,fn){var self=this;"string"==typeof actions&&(actions=[actions]),actions.forEach(function(action){self.canExecute(action,priority,function(context,action,event){return fn(context)},!0)})},RuleProvider.prototype.init=function(){}},{"../../command/CommandInterceptor":175,inherits:347}],282:[function(require,module,exports){"use strict";function Rules(injector){this._commandStack=injector.get("commandStack",!1)}Rules.$inject=["injector"],module.exports=Rules,Rules.prototype.allowed=function(action,context){var allowed=!0,commandStack=this._commandStack;return commandStack&&(allowed=commandStack.canExecute(action,context)),void 0===allowed||allowed}},{}],283:[function(require,module,exports){module.exports={__init__:["rules"],rules:["type",require("./Rules")]}},{"./Rules":282}],284:[function(require,module,exports){"use strict";function SearchPad(canvas,eventBus,overlays,selection){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=canvas,this._eventBus=eventBus,this._overlays=overlays,this._selection=selection,this._container=domify(SearchPad.BOX_HTML),this._searchInput=domQuery(SearchPad.INPUT_SELECTOR,this._container),this._resultsContainer=domQuery(SearchPad.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),eventBus.on(["canvas.destroy","diagram.destroy"],this.close,this)}function constructOverlay(box){var offset=6,w=box.width+2*offset,h=box.height+2*offset,styles=["width: "+w+"px","height: "+h+"px"].join("; ");return{position:{bottom:h-offset,right:w-offset},show:!0,html:'
'}}function createInnerTextNode(parentNode,tokens,template){var text=createHtmlText(tokens),childNode=domify(template);childNode.innerHTML=text,parentNode.appendChild(childNode)}function createHtmlText(tokens){var htmlText="";return tokens.forEach(function(t){htmlText+=t.matched?''+t.matched+"":t.normal}),""!==htmlText?htmlText:null}var domClear=require("min-dom/lib/clear"),domDelegate=require("min-dom/lib/delegate"),domQuery=require("min-dom/lib/query"),domClasses=require("min-dom/lib/classes"),domAttr=require("min-dom/lib/attr"),domify=require("min-dom/lib/domify"),getBoundingBox=require("../../util/Elements").getBBox;SearchPad.$inject=["canvas","eventBus","overlays","selection"],SearchPad.prototype._bindEvents=function(){function listen(el,selector,type,fn){self._eventMaps.push({el:el,type:type,listener:domDelegate.bind(el,selector,type,fn)})}var self=this;listen(document,"html","click",function(e){self.close()},!0),listen(this._container,SearchPad.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),listen(this._container,SearchPad.RESULT_SELECTOR,"mouseover",function(e){e.stopPropagation(),self._scrollToNode(e.delegateTarget),self._preselect(e.delegateTarget)}),listen(this._container,SearchPad.RESULT_SELECTOR,"click",function(e){e.stopPropagation(),self._select(e.delegateTarget)}),listen(this._container,SearchPad.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),listen(this._container,SearchPad.INPUT_SELECTOR,"keyup",function(e){if(27===e.keyCode)return self.close();if(13===e.keyCode){var selected=self._getCurrentResult();return selected?self._select(selected):self.close()}return 38===e.keyCode?self._scrollToDirection(!0):40===e.keyCode?self._scrollToDirection():void(37!==e.keyCode&&39!==e.keyCode&&self._search(e.delegateTarget.value))})},SearchPad.prototype._unbindEvents=function(){this._eventMaps.forEach(function(m){domDelegate.unbind(m.el,m.type,m.listener)})},SearchPad.prototype._search=function(pattern){var self=this;if(this._clearResults(),pattern&&""!==pattern){var searchResults=this._searchProvider.find(pattern);if(searchResults.length){searchResults.forEach(function(result){var id=result.element.id,node=self._createResultNode(result,id);self._results[id]={element:result.element,node:node}});var node=domQuery(SearchPad.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(node),this._preselect(node)}}},SearchPad.prototype._scrollToDirection=function(previous){var selected=this._getCurrentResult();if(selected){var node=previous?selected.previousElementSibling:selected.nextElementSibling;node&&(this._scrollToNode(node),this._preselect(node))}},SearchPad.prototype._scrollToNode=function(node){if(node&&node!==this._getCurrentResult()){var nodeOffset=node.offsetTop,containerScroll=this._resultsContainer.scrollTop,bottomScroll=nodeOffset-this._resultsContainer.clientHeight+node.clientHeight;nodeOffset0&&createInnerTextNode(node,result.primaryTokens,SearchPad.RESULT_PRIMARY_HTML),createInnerTextNode(node,result.secondaryTokens,SearchPad.RESULT_SECONDARY_HTML),domAttr(node,SearchPad.RESULT_ID_ATTRIBUTE,id),this._resultsContainer.appendChild(node),node},SearchPad.prototype.registerProvider=function(provider){this._searchProvider=provider},SearchPad.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,domClasses(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},SearchPad.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,domClasses(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},SearchPad.prototype.toggle=function(){this.isOpen()?this.close():this.open()},SearchPad.prototype.isOpen=function(){return this._open},SearchPad.prototype._preselect=function(node){var selectedNode=this._getCurrentResult();if(node!==selectedNode){selectedNode&&domClasses(selectedNode).remove(SearchPad.RESULT_SELECTED_CLASS);var id=domAttr(node,SearchPad.RESULT_ID_ATTRIBUTE),element=this._results[id].element;domClasses(node).add(SearchPad.RESULT_SELECTED_CLASS),this._resetOverlay(element),this._centerViewbox(element),this._selection.select(element),this._eventBus.fire("searchPad.preselected",element)}},SearchPad.prototype._select=function(node){var id=domAttr(node,SearchPad.RESULT_ID_ATTRIBUTE),element=this._results[id].element;this.close(),this._resetOverlay(),this._centerViewbox(element),this._selection.select(element),this._eventBus.fire("searchPad.selected",element)},SearchPad.prototype._centerViewbox=function(element){var viewbox=this._canvas.viewbox(),box=getBoundingBox(element),newViewbox={x:box.x+box.width/2-viewbox.outer.width/2,y:box.y+box.height/2-viewbox.outer.height/2,width:viewbox.outer.width,height:viewbox.outer.height};this._canvas.viewbox(newViewbox),this._canvas.zoom(viewbox.scale)},SearchPad.prototype._resetOverlay=function(element){if(this._overlayId&&this._overlays.remove(this._overlayId),element){var box=getBoundingBox(element),overlay=constructOverlay(box);this._overlayId=this._overlays.add(element,overlay)}},module.exports=SearchPad,SearchPad.CONTAINER_SELECTOR=".djs-search-container",SearchPad.INPUT_SELECTOR=".djs-search-input input",SearchPad.RESULTS_CONTAINER_SELECTOR=".djs-search-results",SearchPad.RESULT_SELECTOR=".djs-search-result",SearchPad.RESULT_SELECTED_CLASS="djs-search-result-selected",SearchPad.RESULT_SELECTED_SELECTOR="."+SearchPad.RESULT_SELECTED_CLASS,SearchPad.RESULT_ID_ATTRIBUTE="data-result-id",SearchPad.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",SearchPad.OVERLAY_CLASS="djs-search-overlay",SearchPad.BOX_HTML='
',SearchPad.RESULT_HTML='
',SearchPad.RESULT_PRIMARY_HTML='
',SearchPad.RESULT_SECONDARY_HTML='

'},{"../../util/Elements":322,"min-dom/lib/attr":510,"min-dom/lib/classes":511,"min-dom/lib/clear":512,"min-dom/lib/delegate":514,"min-dom/lib/domify":515,"min-dom/lib/query":518}],285:[function(require,module,exports){module.exports={__depends__:[require("../overlays"),require("../selection")],searchPad:["type",require("./SearchPad")]}},{"../overlays":267,"../selection":289,"./SearchPad":284}],286:[function(require,module,exports){"use strict";function Selection(eventBus){this._eventBus=eventBus,this._selectedElements=[];var self=this;eventBus.on(["shape.remove","connection.remove"],function(e){var element=e.element;self.deselect(element)}),eventBus.on(["diagram.clear"],function(e){self.select(null)})}var isArray=require("lodash/lang/isArray"),forEach=require("lodash/collection/forEach");Selection.$inject=["eventBus"],module.exports=Selection,Selection.prototype.deselect=function(element){var selectedElements=this._selectedElements,idx=selectedElements.indexOf(element);if(idx!==-1){var oldSelection=selectedElements.slice();selectedElements.splice(idx,1),this._eventBus.fire("selection.changed",{oldSelection:oldSelection,newSelection:selectedElements})}},Selection.prototype.get=function(){return this._selectedElements},Selection.prototype.isSelected=function(element){return this._selectedElements.indexOf(element)!==-1},Selection.prototype.select=function(elements,add){var selectedElements=this._selectedElements,oldSelection=selectedElements.slice();isArray(elements)||(elements=elements?[elements]:[]),add?forEach(elements,function(element){selectedElements.indexOf(element)===-1&&selectedElements.push(element)}):this._selectedElements=selectedElements=elements.slice(),this._eventBus.fire("selection.changed",{oldSelection:oldSelection,newSelection:selectedElements})}},{"lodash/collection/forEach":362,"lodash/lang/isArray":485}],287:[function(require,module,exports){"use strict";function SelectionBehavior(eventBus,selection,canvas,elementRegistry){eventBus.on("create.end",500,function(e){e.context.canExecute&&selection.select(e.context.shape)}),eventBus.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&selection.select(e.context.target)}),eventBus.on("shape.move.end",500,function(e){var previousSelection=e.previousSelection||[],shape=elementRegistry.get(e.context.shape.id),inSelection=find(previousSelection,function(selectedShape){return shape.id===selectedShape.id});inSelection||selection.select(shape)}),eventBus.on("element.click",function(event){var element=event.element;element===canvas.getRootElement()&&(element=null);var isSelected=selection.isSelected(element),isMultiSelect=selection.get().length>1,add=hasPrimaryModifier(event);return isSelected&&isMultiSelect?add?selection.deselect(element):selection.select(element):void(isSelected?selection.deselect(element):selection.select(element,add))})}var hasPrimaryModifier=require("../../util/Mouse").hasPrimaryModifier,find=require("lodash/collection/find");SelectionBehavior.$inject=["eventBus","selection","canvas","elementRegistry"],module.exports=SelectionBehavior},{"../../util/Mouse":330,"lodash/collection/find":361}],288:[function(require,module,exports){"use strict";function SelectionVisuals(events,canvas,selection,styles){function addMarker(e,cls){canvas.addMarker(e,cls)}function removeMarker(e,cls){canvas.removeMarker(e,cls)}this._multiSelectionBox=null,events.on("element.hover",function(event){addMarker(event.element,MARKER_HOVER)}),events.on("element.out",function(event){removeMarker(event.element,MARKER_HOVER)}),events.on("selection.changed",function(event){function deselect(s){removeMarker(s,MARKER_SELECTED)}function select(s){addMarker(s,MARKER_SELECTED)}var oldSelection=event.oldSelection,newSelection=event.newSelection;forEach(oldSelection,function(e){newSelection.indexOf(e)===-1&&deselect(e)}),forEach(newSelection,function(e){oldSelection.indexOf(e)===-1&&select(e)})})}var forEach=require("lodash/collection/forEach"),MARKER_HOVER="hover",MARKER_SELECTED="selected";SelectionVisuals.$inject=["eventBus","canvas","selection","styles"],module.exports=SelectionVisuals},{"lodash/collection/forEach":362}],289:[function(require,module,exports){module.exports={__init__:["selectionVisuals","selectionBehavior"],__depends__:[require("../interaction-events"),require("../outline")],selection:["type",require("./Selection")],selectionVisuals:["type",require("./SelectionVisuals")],selectionBehavior:["type",require("./SelectionBehavior")]}},{"../interaction-events":226,"../outline":265,"./Selection":286,"./SelectionBehavior":287,"./SelectionVisuals":288}],290:[function(require,module,exports){"use strict";function SnapContext(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function SnapPoints(defaultSnaps){this._snapValues={}}var forEach=require("lodash/collection/forEach"),snapTo=require("./SnapUtil").snapTo;SnapContext.prototype.getSnapOrigin=function(snapLocation){return this._snapOrigins[snapLocation]},SnapContext.prototype.setSnapOrigin=function(snapLocation,initialValue){this._snapOrigins[snapLocation]=initialValue,this._snapLocations.indexOf(snapLocation)===-1&&this._snapLocations.push(snapLocation)},SnapContext.prototype.addDefaultSnap=function(type,point){var snapValues=this._defaultSnaps[type];snapValues||(snapValues=this._defaultSnaps[type]=[]),snapValues.push(point)},SnapContext.prototype.getSnapLocations=function(){return this._snapLocations},SnapContext.prototype.setSnapLocations=function(snapLocations){this._snapLocations=snapLocations},SnapContext.prototype.pointsForTarget=function(target){var targetId=target.id||target,snapPoints=this._targets[targetId];return snapPoints||(snapPoints=this._targets[targetId]=new SnapPoints,snapPoints.initDefaults(this._defaultSnaps)),snapPoints},module.exports=SnapContext,SnapPoints.prototype.add=function(snapLocation,point){var snapValues=this._snapValues[snapLocation];snapValues||(snapValues=this._snapValues[snapLocation]={x:[],y:[]}),snapValues.x.indexOf(point.x)===-1&&snapValues.x.push(point.x),snapValues.y.indexOf(point.y)===-1&&snapValues.y.push(point.y)},SnapPoints.prototype.snap=function(point,snapLocation,axis,tolerance){var snappingValues=this._snapValues[snapLocation];return snappingValues&&snapTo(point[axis],snappingValues[axis],tolerance)},SnapPoints.prototype.initDefaults=function(defaultSnaps){var self=this;forEach(defaultSnaps||{},function(snapPoints,snapLocation){forEach(snapPoints,function(point){self.add(snapLocation,point)})})}},{"./SnapUtil":291,"lodash/collection/forEach":362}],291:[function(require,module,exports){"use strict";function snapTo(value,values,tolerance){tolerance=void 0===tolerance?10:tolerance;var idx,snapValue;for(idx=0;idxshape.x+shape.width||"e"===direction&&event.xshape.y+shape.height||"s"===direction&&event.yabs(event.dy)?"x":"y",offset=event["d"+axis],spacePos=event[axis]-offset;if(abs(offset)<5)return!1;offset<0&&(offset*=-1),hasPrimaryModifier(event)&&(offset*=-1);var rootShape=this._canvas.getRootElement(),allShapes=getAllChildren(rootShape,!0),adjustments=this.calculateAdjustments(allShapes,axis,offset,spacePos);return assign(context,adjustments,{axis:axis,direction:SpaceUtil.getDirection(axis,offset)}),Cursor.set("resize-"+("x"===axis?"ew":"ns")),!0},SpaceTool.prototype.calculateAdjustments=function(elements,axis,offset,spacePos){var movingShapes=[],resizingShapes=[],rules=this._rules;return elements.forEach(function(shape){var shapeStart=shape[axis],shapeEnd=shapeStart+shape[AXIS_TO_DIMENSION[axis]];if(shape.parent&&!shape.waypoints)return offset>0&&shapeStart>spacePos?movingShapes.push(shape):offset<0&&shapeEndspacePos&&rules.allowed("shape.resize",{shape:shape})?resizingShapes.push(shape):void 0}),{movingShapes:movingShapes,resizingShapes:resizingShapes}},SpaceTool.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},SpaceTool.prototype.isActive=function(){var context=this._dragging.context();return context&&/^spaceTool/.test(context.prefix)}},{"../../util/Cursor":321,"../../util/Elements":322,"../../util/Mouse":330,"./SpaceUtil":295,"lodash/collection/forEach":362,"lodash/object/assign":495}],294:[function(require,module,exports){"use strict";function SpaceToolPreview(eventBus,elementRegistry,canvas,styles,previewSupport){function addPreviewGfx(collection,dragGroup){forEach(collection,function(element){previewSupport.addDragger(element,dragGroup),canvas.addMarker(element,MARKER_DRAGGING)})}eventBus.on("spaceTool.selection.start",function(event){var space=canvas.getLayer("space"),context=event.context,orientation={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},crosshairGroup=svgCreate("g");svgAttr(crosshairGroup,styles.cls("djs-crosshair-group",["no-events"])),svgAppend(space,crosshairGroup);var pathX=svgCreate("path");svgAttr(pathX,"d",orientation.x),svgClasses(pathX).add("djs-crosshair"),svgAppend(crosshairGroup,pathX);var pathY=svgCreate("path");svgAttr(pathY,"d",orientation.y),svgClasses(pathY).add("djs-crosshair"),svgAppend(crosshairGroup,pathY),context.crosshairGroup=crosshairGroup}),eventBus.on("spaceTool.selection.move",function(event){var crosshairGroup=event.context.crosshairGroup;translate(crosshairGroup,event.x,event.y)}),eventBus.on("spaceTool.selection.cleanup",function(event){var context=event.context,crosshairGroup=context.crosshairGroup;crosshairGroup&&svgRemove(crosshairGroup)}),eventBus.on("spaceTool.move",LOW_PRIORITY,function(event){var context=event.context,line=context.line,axis=context.axis,movingShapes=context.movingShapes,resizingShapes=context.resizingShapes;if(context.initialized){if(!context.dragGroup){var spaceLayer=canvas.getLayer("space");line=svgCreate("path"),svgAttr(line,"d","M0,0 L0,0"),svgClasses(line).add("djs-crosshair"),svgAppend(spaceLayer,line),context.line=line;var dragGroup=svgCreate("g");svgAttr(dragGroup,styles.cls("djs-drag-group",["no-events"])),svgAppend(canvas.getDefaultLayer(),dragGroup),addPreviewGfx(movingShapes,dragGroup);var movingConnections=context.movingConnections=elementRegistry.filter(function(element){var sourceIsMoving=!1;forEach(movingShapes,function(shape){forEach(shape.outgoing,function(connection){element===connection&&(sourceIsMoving=!0)})});var targetIsMoving=!1;forEach(movingShapes,function(shape){forEach(shape.incoming,function(connection){element===connection&&(targetIsMoving=!0)})});var sourceIsResizing=!1;forEach(resizingShapes,function(shape){forEach(shape.outgoing,function(connection){element===connection&&(sourceIsResizing=!0)})});var targetIsResizing=!1;return forEach(resizingShapes,function(shape){forEach(shape.incoming,function(connection){element===connection&&(targetIsResizing=!0)})}),isConnection(element)&&(sourceIsMoving||sourceIsResizing)&&(targetIsMoving||targetIsResizing)});addPreviewGfx(movingConnections,dragGroup),context.dragGroup=dragGroup}if(!context.frameGroup){var frameGroup=svgCreate("g");svgAttr(frameGroup,styles.cls("djs-frame-group",["no-events"])),svgAppend(canvas.getDefaultLayer(),frameGroup);var frames=[];forEach(resizingShapes,function(shape){var frame=previewSupport.addFrame(shape,frameGroup);frames.push({element:frame,initialWidth:frame.getBBox().width,initialHeight:frame.getBBox().height}),canvas.addMarker(shape,MARKER_RESIZING)}),context.frameGroup=frameGroup,context.frames=frames}var orientation={x:"M"+event.x+", -10000 L"+event.x+", 10000",y:"M -10000, "+event.y+" L 10000, "+event.y};svgAttr(line,{path:orientation[axis],display:""});var opposite={x:"y",y:"x"},delta={x:event.dx,y:event.dy};delta[opposite[context.axis]]=0,translate(context.dragGroup,delta.x,delta.y), -forEach(context.frames,function(frame){frame.initialWidth+delta.x>5&&svgAttr(frame.element,{width:frame.initialWidth+delta.x}),frame.initialHeight+delta.y>5&&svgAttr(frame.element,{height:frame.initialHeight+delta.y})})}}),eventBus.on("spaceTool.cleanup",function(event){var context=event.context,movingShapes=context.movingShapes,movingConnections=context.movingConnections,resizingShapes=context.resizingShapes,line=context.line,dragGroup=context.dragGroup,frameGroup=context.frameGroup;forEach(movingShapes,function(shape){canvas.removeMarker(shape,MARKER_DRAGGING)}),forEach(movingConnections,function(connection){canvas.removeMarker(connection,MARKER_DRAGGING)}),dragGroup&&(svgRemove(line),svgRemove(dragGroup)),forEach(resizingShapes,function(shape){canvas.removeMarker(shape,MARKER_RESIZING)}),frameGroup&&svgRemove(frameGroup)})}function isConnection(element){return element.waypoints}var forEach=require("lodash/collection/forEach"),MARKER_DRAGGING="djs-dragging",MARKER_RESIZING="djs-resizing",LOW_PRIORITY=250,svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgCreate=require("tiny-svg/lib/create"),svgRemove=require("tiny-svg/lib/remove"),translate=require("../../util/SvgTransformUtil").translate;SpaceToolPreview.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"],module.exports=SpaceToolPreview},{"../../util/SvgTransformUtil":335,"lodash/collection/forEach":362,"tiny-svg/lib/append":539,"tiny-svg/lib/attr":541,"tiny-svg/lib/classes":542,"tiny-svg/lib/create":545,"tiny-svg/lib/remove":548}],295:[function(require,module,exports){"use strict";function getDirection(axis,offset){if("x"===axis){if(offset>0)return"e";if(offset<0)return"w"}if("y"===axis){if(offset>0)return"s";if(offset<0)return"n"}return null}module.exports.getDirection=getDirection,module.exports.resizeBounds=function(bounds,direction,delta){var dx=delta.x,dy=delta.y;switch(direction){case"n":return{x:bounds.x,y:bounds.y+dy,width:bounds.width,height:bounds.height-dy};case"s":return{x:bounds.x,y:bounds.y,width:bounds.width,height:bounds.height+dy};case"w":return{x:bounds.x+dx,y:bounds.y,width:bounds.width-dx,height:bounds.height};case"e":return{x:bounds.x,y:bounds.y,width:bounds.width+dx,height:bounds.height};default:throw new Error("unrecognized direction: "+direction)}}},{}],296:[function(require,module,exports){"use strict";module.exports={__init__:["spaceToolPreview"],__depends__:[require("../dragging"),require("../rules"),require("../tool-manager"),require("../preview-support")],spaceTool:["type",require("./SpaceTool")],spaceToolPreview:["type",require("./SpaceToolPreview")]}},{"../dragging":218,"../preview-support":273,"../rules":283,"../tool-manager":298,"./SpaceTool":293,"./SpaceToolPreview":294}],297:[function(require,module,exports){"use strict";function ToolManager(eventBus,dragging){this._eventBus=eventBus,this._dragging=dragging,this._tools=[],this._active=null}var forEach=require("lodash/collection/forEach"),LOW_PRIORITY=250;ToolManager.$inject=["eventBus","dragging"],module.exports=ToolManager,ToolManager.prototype.registerTool=function(name,events){var tools=this._tools;if(!events)throw new Error('A tool has to be registered with it\'s "events"');tools.push(name),this.bindEvents(name,events)},ToolManager.prototype.isActive=function(tool){return tool&&this._active===tool},ToolManager.prototype.length=function(tool){return this._tools.length},ToolManager.prototype.setActive=function(tool){var eventBus=this._eventBus;this._active!==tool&&(this._active=tool,eventBus.fire("tool-manager.update",{tool:tool}))},ToolManager.prototype.bindEvents=function(name,events){var eventBus=this._eventBus,dragging=this._dragging,eventsToRegister=[];eventBus.on(events.tool+".init",function(event){var context=event.context;return!context.reactivate&&this.isActive(name)?(this.setActive(null),void dragging.cancel()):void this.setActive(name)},this),forEach(events,function(event){eventsToRegister.push(event+".ended"),eventsToRegister.push(event+".canceled")}),eventBus.on(eventsToRegister,LOW_PRIORITY,function(event){var originalEvent=event.originalEvent;!this._active||originalEvent&&"tools"===originalEvent.target.parentNode.getAttribute("data-group")||this.setActive(null)},this)}},{"lodash/collection/forEach":362}],298:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../dragging")],__init__:["toolManager"],toolManager:["type",require("./ToolManager")]}},{"../dragging":218,"./ToolManager":297}],299:[function(require,module,exports){"use strict";function createRoot(parent){var root=domify('
');return parent.insertBefore(root,parent.firstChild),root}function setPosition(el,x,y){assign(el.style,{left:x+"px",top:y+"px"})}function setVisible(el,visible){el.style.display=visible===!1?"none":""}function Tooltips(eventBus,canvas){this._eventBus=eventBus,this._canvas=canvas,this._ids=ids,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=createRoot(canvas.getContainer());var self=this;domDelegate.bind(this._tooltipRoot,tooltipSelector,"mousedown",function(event){event.stopPropagation()}),domDelegate.bind(this._tooltipRoot,tooltipSelector,"mouseover",function(event){self.trigger("mouseover",event)}),domDelegate.bind(this._tooltipRoot,tooltipSelector,"mouseout",function(event){self.trigger("mouseout",event)}),this._init()}var isString=require("lodash/lang/isString"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),domify=require("min-dom/lib/domify"),domAttr=require("min-dom/lib/attr"),domClasses=require("min-dom/lib/classes"),domRemove=require("min-dom/lib/remove"),domDelegate=require("min-dom/lib/delegate"),ids=new(require("../../util/IdGenerator"))("tt"),tooltipClass="djs-tooltip",tooltipSelector="."+tooltipClass;Tooltips.$inject=["eventBus","canvas"],module.exports=Tooltips,Tooltips.prototype.add=function(tooltip){if(!tooltip.position)throw new Error("must specifiy tooltip position");if(!tooltip.html)throw new Error("must specifiy tooltip html");var id=this._ids.next();return tooltip=assign({},this._tooltipDefaults,tooltip,{id:id}),this._addTooltip(tooltip),tooltip.timeout&&this.setTimeout(tooltip),id},Tooltips.prototype.trigger=function(action,event){var node=event.delegateTarget||event.target,tooltip=this.get(domAttr(node,"data-tooltip-id"));tooltip&&("mouseover"===action&&tooltip.timeout&&this.clearTimeout(tooltip),"mouseout"===action&&tooltip.timeout&&(tooltip.timeout=1e3,this.setTimeout(tooltip)))},Tooltips.prototype.get=function(id){return"string"!=typeof id&&(id=id.id),this._tooltips[id]},Tooltips.prototype.clearTimeout=function(tooltip){if(tooltip=this.get(tooltip)){var removeTimer=tooltip.removeTimer;removeTimer&&(clearTimeout(removeTimer),tooltip.removeTimer=null)}},Tooltips.prototype.setTimeout=function(tooltip){if(tooltip=this.get(tooltip)){this.clearTimeout(tooltip);var self=this;tooltip.removeTimer=setTimeout(function(){self.remove(tooltip)},tooltip.timeout)}},Tooltips.prototype.remove=function(id){var tooltip=this.get(id);tooltip&&(domRemove(tooltip.html),domRemove(tooltip.htmlContainer),delete tooltip.htmlContainer,delete this._tooltips[tooltip.id])},Tooltips.prototype.show=function(){setVisible(this._tooltipRoot)},Tooltips.prototype.hide=function(){setVisible(this._tooltipRoot,!1)},Tooltips.prototype._updateRoot=function(viewbox){var a=viewbox.scale||1,d=viewbox.scale||1,matrix="matrix("+a+",0,0,"+d+","+-1*viewbox.x*a+","+-1*viewbox.y*d+")";this._tooltipRoot.style.transform=matrix,this._tooltipRoot.style["-ms-transform"]=matrix},Tooltips.prototype._addTooltip=function(tooltip){var htmlContainer,id=tooltip.id,html=tooltip.html,tooltipRoot=this._tooltipRoot;html.get&&(html=html.get(0)),isString(html)&&(html=domify(html)),htmlContainer=domify('
'),htmlContainer.appendChild(html),tooltip.type&&domClasses(htmlContainer).add("djs-tooltip-"+tooltip.type),tooltip.className&&domClasses(htmlContainer).add(tooltip.className),tooltip.htmlContainer=htmlContainer,tooltipRoot.appendChild(htmlContainer),this._tooltips[id]=tooltip,this._updateTooltip(tooltip)},Tooltips.prototype._updateTooltip=function(tooltip){var position=tooltip.position,htmlContainer=tooltip.htmlContainer;setPosition(htmlContainer,position.x,position.y)},Tooltips.prototype._updateTooltipVisibilty=function(viewbox){forEach(this._tooltips,function(tooltip){var show=tooltip.show,htmlContainer=tooltip.htmlContainer,visible=!0;show&&((show.minZoom>viewbox.scale||show.maxZoom=referenceOrientation.right,bottom=rectOrientation.top-padding.y>=referenceOrientation.bottom,left=rectOrientation.right+padding.x<=referenceOrientation.left,vertical=top?"top":bottom?"bottom":null,horizontal=left?"left":right?"right":null;return horizontal&&vertical?vertical+"-"+horizontal:horizontal||vertical||"intersect"}function getElementLineIntersection(elementPath,linePath,cropStart){var intersections=getIntersections(elementPath,linePath);return 1===intersections.length?roundPoint(intersections[0]):2===intersections.length&&pointDistance(intersections[0],intersections[1])<1?roundPoint(intersections[0]):intersections.length>1?(intersections=sortBy(intersections,function(i){var distance=Math.floor(100*i.t2)||1;return distance=100-distance,distance=(distance<10?"0":"")+distance,i.segment2+"#"+distance}),roundPoint(intersections[cropStart?0:intersections.length-1])):null}function getIntersections(a,b){return intersection(a,b)}var isObject=require("lodash/lang/isObject"),sortBy=require("lodash/collection/sortBy"),pointDistance=require("../util/Geometry").pointDistance,intersection=require("../util/Intersection").intersection;module.exports.roundBounds=roundBounds,module.exports.roundPoint=roundPoint,module.exports.asTRBL=asTRBL,module.exports.asBounds=asBounds,module.exports.getMid=getMid,module.exports.getOrientation=getOrientation,module.exports.getElementLineIntersection=getElementLineIntersection,module.exports.getIntersections=getIntersections},{"../util/Geometry":324,"../util/Intersection":327,"lodash/collection/sortBy":371,"lodash/lang/isObject":490}],309:[function(require,module,exports){"use strict";function inRange(a,start,end){return a>=start&&a<=end}function isInRange(axis,a,b){var size={x:"width",y:"height"};return inRange(a[axis],b[axis],b[axis]+b[size[axis]])}function getDirections(orientation,defaultLayout){switch(orientation){case"intersect":return null;case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return defaultLayout}}var isArray=require("lodash/lang/isArray"),find=require("lodash/collection/find"),without=require("lodash/array/without"),assign=require("lodash/object/assign"),LayoutUtil=require("./LayoutUtil"),Geometry=require("../util/Geometry"),getOrientation=LayoutUtil.getOrientation,getMid=LayoutUtil.getMid,pointsAligned=Geometry.pointsAligned,pointInRect=Geometry.pointInRect,pointDistance=Geometry.pointDistance,INTERSECTION_THRESHOLD=20,ORIENTATION_THRESHOLD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};module.exports.getBendpoints=function(a,b,directions){directions=directions||"h:h";var xmid,ymid;if("h:v"===directions)return[{x:b.x,y:a.y}];if("v:h"===directions)return[{x:a.x,y:b.y}];if("h:h"===directions)return xmid=Math.round((b.x-a.x)/2+a.x),[{x:xmid,y:a.y},{x:xmid,y:b.y}];if("v:v"===directions)return ymid=Math.round((b.y-a.y)/2+a.y),[{x:a.x,y:ymid},{x:b.x,y:ymid}];throw new Error("unknown directions: <"+directions+">: directions must be specified as {a direction}:{b direction} (direction in h|v)")},module.exports.connectPoints=function(a,b,directions){var points=[];return pointsAligned(a,b)||(points=this.getBendpoints(a,b,directions)),points.unshift(a),points.push(b),points},module.exports.connectRectangles=function(source,target,start,end,hints){var preferredLayouts=hints&&hints.preferredLayouts||[],preferredLayout=without(preferredLayouts,"straight")[0]||"h:h",threshold=ORIENTATION_THRESHOLD[preferredLayout]||0,orientation=getOrientation(source,target,threshold),directions=getDirections(orientation,preferredLayout);if(start=start||getMid(source),end=end||getMid(target),directions){if("h:h"===directions)switch(orientation){case"top-right":case"right":case"bottom-right":start={original:start,x:source.x,y:start.y},end={original:end,x:target.x+target.width,y:end.y};break;case"top-left":case"left":case"bottom-left":start={original:start,x:source.x+source.width,y:start.y},end={original:end,x:target.x,y:end.y}}if("v:v"===directions)switch(orientation){case"top-left":case"top":case"top-right":start={original:start,x:start.x,y:source.y+source.height},end={original:end,x:end.x,y:target.y};break;case"bottom-left":case"bottom":case"bottom-right":start={original:start,x:start.x,y:source.y},end={original:end,x:end.x,y:target.y+target.height}}return this.connectPoints(start,end,directions)}},module.exports.repairConnection=function(source,target,start,end,waypoints,hints){isArray(start)&&(waypoints=start,hints=end,start=getMid(source),end=getMid(target)),hints=assign({preferredLayouts:[]},hints),waypoints=waypoints||[];var repairedWaypoints,preferredLayouts=hints.preferredLayouts,layoutStraight=preferredLayouts.indexOf("straight")!==-1;return layoutStraight&&(repairedWaypoints=this.layoutStraight(source,target,start,end,hints)),repairedWaypoints||(hints.connectionEnd?(repairedWaypoints=this._repairConnectionSide(target,source,end,waypoints.slice().reverse()),repairedWaypoints=repairedWaypoints&&repairedWaypoints.reverse()):hints.connectionStart?repairedWaypoints=this._repairConnectionSide(source,target,start,waypoints):waypoints&&waypoints.length&&(repairedWaypoints=waypoints)),repairedWaypoints||(repairedWaypoints=this.connectRectangles(source,target,start,end,hints)),repairedWaypoints},module.exports.layoutStraight=function(source,target,start,end,hints){var primaryAxis,orientation,axis={};return orientation=getOrientation(source,target),/^(top|bottom|left|right)$/.test(orientation)?(/top|bottom/.test(orientation)&&(primaryAxis="x"),/left|right/.test(orientation)&&(primaryAxis="y"),"target"===hints.preserveDocking?isInRange(primaryAxis,end,source)?(axis[primaryAxis]=end[primaryAxis],[{x:void 0!==axis.x?axis.x:start.x,y:void 0!==axis.y?axis.y:start.y,original:{x:void 0!==axis.x?axis.x:start.x,y:void 0!==axis.y?axis.y:start.y}},{x:end.x,y:end.y}]):null:isInRange(primaryAxis,start,target)?(axis[primaryAxis]=start[primaryAxis],[{x:start.x,y:start.y},{x:void 0!==axis.x?axis.x:end.x,y:void 0!==axis.y?axis.y:end.y,original:{x:void 0!==axis.x?axis.x:end.x,y:void 0!==axis.y?axis.y:end.y}}]):null):null},module.exports._repairConnectionSide=function(moved,other,newDocking,points){function needsRelayout(moved,other,points){return points.length<3||!(points.length>4)&&!!find(points,function(p,idx){var q=points[idx-1];return q&&pointDistance(p,q)<3})}function repairBendpoint(candidate,oldPeer,newPeer){var alignment=pointsAligned(oldPeer,candidate);switch(alignment){case"v":return{x:candidate.x,y:newPeer.y};case"h":return{x:newPeer.x,y:candidate.y}}return{x:candidate.x,y:candidate.y}}function removeOverlapping(points,a,b){var i;for(i=points.length-2;0!==i;i--)if(pointInRect(points[i],a,INTERSECTION_THRESHOLD)||pointInRect(points[i],b,INTERSECTION_THRESHOLD))return points.slice(i);return points}if(needsRelayout(moved,other,points))return null;var slicedPoints,oldDocking=points[0],newPoints=points.slice();return newPoints[0]=newDocking,newPoints[1]=repairBendpoint(newPoints[1],oldDocking,newDocking),slicedPoints=removeOverlapping(newPoints,moved,other),slicedPoints!==newPoints?this._repairConnectionSide(moved,other,newDocking,slicedPoints):newPoints}},{"../util/Geometry":324,"./LayoutUtil":308,"lodash/array/without":355,"lodash/collection/find":361,"lodash/lang/isArray":485,"lodash/object/assign":495}],310:[function(require,module,exports){"use strict";function Base(){Object.defineProperty(this,"businessObject",{writable:!0}),parentRefs.bind(this,"parent"),labelRefs.bind(this,"label"),outgoingRefs.bind(this,"outgoing"),incomingRefs.bind(this,"incoming")}function Shape(){Base.call(this),parentRefs.bind(this,"children"),attacherRefs.bind(this,"host"),attacherRefs.bind(this,"attachers")}function Root(){Shape.call(this)}function Label(){Shape.call(this),labelRefs.bind(this,"labelTarget")}function Connection(){Base.call(this),outgoingRefs.bind(this,"source"),incomingRefs.bind(this,"target")}var assign=require("lodash/object/assign"),inherits=require("inherits"),Refs=require("object-refs"),parentRefs=new Refs({name:"children",enumerable:!0,collection:!0},{name:"parent"}),labelRefs=new Refs({name:"label",enumerable:!0},{name:"labelTarget"}),attacherRefs=new Refs({name:"attachers",collection:!0},{name:"host"}),outgoingRefs=new Refs({name:"outgoing",collection:!0},{name:"source"}),incomingRefs=new Refs({name:"incoming",collection:!0},{name:"target"});inherits(Shape,Base),inherits(Root,Shape),inherits(Label,Shape),inherits(Connection,Base);var types={connection:Connection,shape:Shape,label:Label,root:Root};module.exports.create=function(type,attrs){var Type=types[type];if(!Type)throw new Error("unknown type: <"+type+">");return assign(new Type,attrs)},module.exports.Base=Base,module.exports.Root=Root,module.exports.Shape=Shape,module.exports.Connection=Connection,module.exports.Label=Label},{inherits:347,"lodash/object/assign":495,"object-refs":532}],311:[function(require,module,exports){"use strict";function length(point){return Math.sqrt(Math.pow(point.x,2)+Math.pow(point.y,2))}function MoveCanvas(eventBus,canvas){function handleMove(event){var start=context.start,position=EventUtil.toPoint(event),delta=substract(position,start);if(!context.dragging&&length(delta)>THRESHOLD&&(context.dragging=!0,ClickTrap.install(),Cursor.set("grab")),context.dragging){var lastPosition=context.last||context.start;delta=substract(position,lastPosition),canvas.scroll({dx:delta.x,dy:delta.y}),context.last=position}event.preventDefault()}function handleEnd(event){domEvent.unbind(document,"mousemove",handleMove),domEvent.unbind(document,"mouseup",handleEnd),context=null,Cursor.unset()}function handleStart(event){domClosest(event.target,".djs-draggable")||event.button||event.ctrlKey||event.shiftKey||event.altKey||(context={start:EventUtil.toPoint(event)},domEvent.bind(document,"mousemove",handleMove),domEvent.bind(document,"mouseup",handleEnd))}var context,container=canvas._container;domEvent.bind(container,"mousedown",handleStart)}var Cursor=require("../../util/Cursor"),ClickTrap=require("../../util/ClickTrap"),substract=require("../../util/Math").substract,domEvent=require("min-dom/lib/event"),domClosest=require("min-dom/lib/closest"),EventUtil=require("../../util/Event"),THRESHOLD=15;MoveCanvas.$inject=["eventBus","canvas"],module.exports=MoveCanvas},{"../../util/ClickTrap":318,"../../util/Cursor":321,"../../util/Event":323,"../../util/Math":329,"min-dom/lib/closest":513,"min-dom/lib/event":516}],312:[function(require,module,exports){module.exports={__init__:["moveCanvas"],moveCanvas:["type",require("./MoveCanvas")]}},{"./MoveCanvas":311}],313:[function(require,module,exports){module.exports={__depends__:[require("../../features/touch")]}},{"../../features/touch":303}],314:[function(require,module,exports){"use strict";function ZoomScroll(eventBus,canvas,config){this._enabled=!1,this._canvas=canvas,this._container=canvas._container,this._handleWheel=bind(this._handleWheel,this);var newEnabled=!config||config.enabled!==!1,self=this;eventBus.on("canvas.init",function(e){self._init(newEnabled)})}var domEvent=require("min-dom/lib/event"),domClosest=require("min-dom/lib/closest"),hasPrimaryModifier=require("../../util/Mouse").hasPrimaryModifier,hasSecondaryModifier=require("../../util/Mouse").hasSecondaryModifier,isMac=require("../../util/Platform").isMac,getStepRange=require("./ZoomUtil").getStepRange,cap=require("./ZoomUtil").cap,log10=require("../../util/Math").log10,bind=require("lodash/function/bind"),RANGE={min:.2,max:4},NUM_STEPS=10;ZoomScroll.$inject=["eventBus","canvas","config.zoomScroll"],module.exports=ZoomScroll,ZoomScroll.prototype.scroll=function(delta){this._canvas.scroll(delta)},ZoomScroll.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ZoomScroll.prototype.zoom=function(direction,position){var canvas=this._canvas,currentZoom=canvas.zoom(!1),factor=Math.pow(1+Math.abs(direction),direction>0?1:-1);canvas.zoom(cap(RANGE,currentZoom*factor),position)},ZoomScroll.prototype._handleWheel=function(event){if(!domClosest(event.target,".djs-scrollable",!0)){var element=this._container;event.preventDefault();var factor,isVerticalScroll=hasPrimaryModifier(event),isHorizontalScroll=hasSecondaryModifier(event);if(isVerticalScroll||isHorizontalScroll){factor=isMac?0===event.deltaMode?1.25:50:0===event.deltaMode?.025:.5;var delta={};isHorizontalScroll?delta.dx=factor*(event.deltaX||event.deltaY):delta.dy=factor*event.deltaY,this.scroll(delta)}else{factor=0===event.deltaMode?.025:.5;var elementRect=element.getBoundingClientRect(),offset={x:event.clientX-elementRect.left,y:event.clientY-elementRect.top};this.zoom(event.deltaY*factor/-5,offset); -}}},ZoomScroll.prototype.stepZoom=function(direction,position){var canvas=this._canvas,stepRange=getStepRange(RANGE,NUM_STEPS);direction=direction>0?1:-1;var currentLinearZoomLevel=log10(canvas.zoom()),newLinearZoomLevel=Math.round(currentLinearZoomLevel/stepRange)*stepRange;newLinearZoomLevel+=stepRange*direction;var newLogZoomLevel=Math.pow(10,newLinearZoomLevel);canvas.zoom(cap(RANGE,newLogZoomLevel),position)},ZoomScroll.prototype.toggle=function(newEnabled){var element=this._container,handleWheel=this._handleWheel,oldEnabled=this._enabled;return"undefined"==typeof newEnabled&&(newEnabled=!oldEnabled),oldEnabled!==newEnabled&&domEvent[newEnabled?"bind":"unbind"](element,"wheel",handleWheel,!1),this._enabled=newEnabled,newEnabled},ZoomScroll.prototype._init=function(newEnabled){this.toggle(newEnabled)}},{"../../util/Math":329,"../../util/Mouse":330,"../../util/Platform":331,"./ZoomUtil":315,"lodash/function/bind":373,"min-dom/lib/closest":513,"min-dom/lib/event":516}],315:[function(require,module,exports){"use strict";var log10=require("../../util/Math").log10;module.exports.getStepRange=function(range,steps){var minLinearRange=log10(range.min),maxLinearRange=log10(range.max),absoluteLinearRange=Math.abs(minLinearRange)+Math.abs(maxLinearRange);return absoluteLinearRange/steps},module.exports.cap=function(range,scale){return Math.max(range.min,Math.min(range.max,scale))}},{"../../util/Math":329}],316:[function(require,module,exports){module.exports={__init__:["zoomScroll"],zoomScroll:["type",require("./ZoomScroll")]}},{"./ZoomScroll":314}],317:[function(require,module,exports){"use strict";function getNewAttachPoint(point,oldBounds,newBounds){var oldCenter=center(oldBounds),newCenter=center(newBounds),oldDelta=delta(point,oldCenter),newDelta={x:oldDelta.x*(newBounds.width/oldBounds.width),y:oldDelta.y*(newBounds.height/oldBounds.height)};return roundPoint({x:newCenter.x+newDelta.x,y:newCenter.y+newDelta.y})}function getNewAttachShapeDelta(shape,oldBounds,newBounds){var shapeCenter=center(shape),oldCenter=center(oldBounds),newCenter=center(newBounds),shapeDelta=delta(shape,shapeCenter),oldCenterDelta=delta(shapeCenter,oldCenter),newCenterDelta={x:oldCenterDelta.x*(newBounds.width/oldBounds.width),y:oldCenterDelta.y*(newBounds.height/oldBounds.height)},newShapeCenter={x:newCenter.x+newCenterDelta.x,y:newCenter.y+newCenterDelta.y};return roundPoint({x:newShapeCenter.x+shapeDelta.x-shape.x,y:newShapeCenter.y+shapeDelta.y-shape.y})}var roundPoint=require("../layout/LayoutUtil").roundPoint,center=require("./PositionUtil").center,delta=require("./PositionUtil").delta;module.exports.getNewAttachPoint=getNewAttachPoint,module.exports.getNewAttachShapeDelta=getNewAttachShapeDelta},{"../layout/LayoutUtil":308,"./PositionUtil":332}],318:[function(require,module,exports){"use strict";function trap(event){stopEvent(event),toggle(!1)}function toggle(active){domEvent[active?"bind":"unbind"](document.body,"click",trap,!0)}function install(){return toggle(!0),function(){toggle(!1)}}var domEvent=require("min-dom/lib/event"),stopEvent=require("./Event").stopEvent;module.exports.install=install},{"./Event":323,"min-dom/lib/event":516}],319:[function(require,module,exports){"use strict";module.exports.remove=function(collection,element){if(!collection||!element)return-1;var idx=collection.indexOf(element);return idx!==-1&&collection.splice(idx,1),idx},module.exports.add=function(collection,element,idx){if(collection&&element){"number"!=typeof idx&&(idx=-1);var currentIdx=collection.indexOf(element);if(currentIdx!==-1){if(currentIdx===idx)return;if(idx===-1)return;collection.splice(currentIdx,1)}idx!==-1?collection.splice(idx,0,element):collection.push(element)}},module.exports.indexOf=function(collection,element){return collection&&element?collection.indexOf(element):-1}},{}],320:[function(require,module,exports){"use strict";function getTopLevel(elements){var topLevel={},parents=[],result=[],clearedParents=[];return forEach(elements,function(element){var parent=element.parent;topLevel[parent.id]||(topLevel[parent.id]=[]),parents.indexOf(parent.id)===-1&&parents.push(parent.id),topLevel[parent.id].push(element)}),forEach(parents,function(parent){forEach(topLevel[parent],function(element){topLevel[element.id]&&clearedParents.push(element.id)})}),forEach(parents,function(parent){var idx=clearedParents.indexOf(parent);idx===-1&&(result=result.concat(topLevel[parent]))}),result}var forEach=require("lodash/collection/forEach");module.exports.getTopLevel=getTopLevel},{"lodash/collection/forEach":362}],321:[function(require,module,exports){"use strict";var domClasses=require("min-dom/lib/classes"),CURSOR_CLS_PATTERN=/^djs-cursor-.*$/;module.exports.set=function(mode){var classes=domClasses(document.body);classes.removeMatching(CURSOR_CLS_PATTERN),mode&&classes.add("djs-cursor-"+mode)},module.exports.unset=function(){this.set(null)},module.exports.has=function(mode){var classes=domClasses(document.body);return classes.has("djs-cursor-"+mode)}},{"min-dom/lib/classes":511}],322:[function(require,module,exports){"use strict";function add(elements,e,unique){var canAdd=!unique||elements.indexOf(e)===-1;return canAdd&&elements.push(e),canAdd}function eachElement(elements,fn,depth){depth=depth||0,isArray(elements)||(elements=[elements]),forEach(elements,function(s,i){var filter=fn(s,i,depth);isArray(filter)&&filter.length&&eachElement(filter,fn,depth+1)})}function selfAndChildren(elements,unique,maxDepth){var result=[],processedChildren=[];return eachElement(elements,function(element,i,depth){add(result,element,unique);var children=element.children;if((maxDepth===-1||depthmaxX||void 0===maxX)&&(maxX=x+width),(y+height>maxY||void 0===maxY)&&(maxY=y+height)}),{x:minX,y:minY,height:maxY-minY,width:maxX-minX}}function getEnclosedElements(elements,bbox){var filteredElements={};return forEach(elements,function(element){var e=element;e.waypoints&&(e=getBBox(e)),!isNumber(bbox.y)&&e.x>bbox.x&&(filteredElements[element.id]=element),!isNumber(bbox.x)&&e.y>bbox.y&&(filteredElements[element.id]=element),e.x>bbox.x&&e.y>bbox.y&&(isNumber(bbox.width)&&isNumber(bbox.height)&&e.width+e.xrect.x-tolerance&&p.y>rect.y-tolerance&&p.x=1e3&&delete cache[count.shift()],count.push(args),cache[args]=f.apply(scope,arg),postprocessor?postprocessor(cache[args]):cache[args])}return newf}function parsePathString(pathString){if(!pathString)return null;var pth=paths(pathString);if(pth.arr)return clone(pth.arr);var paramCounts={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},data=[];return is(pathString,"array")&&is(pathString[0],"array")&&(data=clone(pathString)),data.length||String(pathString).replace(pathCommand,function(a,b,c){var params=[],name=b.toLowerCase();if(c.replace(pathValues,function(a,b){b&¶ms.push(+b)}),"m"==name&¶ms.length>2&&(data.push([b].concat(params.splice(0,2))),name="l",b="m"==b?"l":"L"),"o"==name&&1==params.length&&data.push([b,params[0]]),"r"==name)data.push([b].concat(params));else for(;params.length>=paramCounts[name]&&(data.push([b].concat(params.splice(0,paramCounts[name]))),paramCounts[name]););}),data.toString=paths.toString,pth.arr=clone(data),data}function paths(ps){var p=paths.ps=paths.ps||{};return p[ps]?p[ps].sleep=100:p[ps]={sleep:100},setTimeout(function(){for(var key in p)p[has](key)&&key!=ps&&(p[key].sleep--,!p[key].sleep&&delete p[key])}),p[ps]}function box(x,y,width,height){return null==x&&(x=y=width=height=0),null==y&&(y=x.y,width=x.width,height=x.height,x=x.x),{x:x,y:y,width:width,w:width,height:height,h:height,x2:x+width,y2:y+height,cx:x+width/2,cy:y+height/2,r1:math.min(width,height)/2,r2:math.max(width,height)/2,r0:math.sqrt(width*width+height*height)/2,path:rectPath(x,y,width,height),vb:[x,y,width,height].join(" ")}}function toString(){return this.join(",").replace(p2s,"$1")}function pathClone(pathArray){var res=clone(pathArray);return res.toString=toString,res}function getPointAtSegmentLength(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,length){return null==length?bezlen(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y):findDotsAtSegment(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,getTotLen(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,length))}function getLengthFactory(istotal,subpath){function O(val){return+(+val).toFixed(3)}return cacher(function(path,length,onlystart){path instanceof Element&&(path=path.attr("d")),path=path2curve(path);for(var x,y,p,l,point,sp="",subpaths={},len=0,i=0,ii=path.length;ilength){if(subpath&&!subpaths.start){if(point=getPointAtSegmentLength(x,y,p[1],p[2],p[3],p[4],p[5],p[6],length-len),sp+=["C"+O(point.start.x),O(point.start.y),O(point.m.x),O(point.m.y),O(point.x),O(point.y)],onlystart)return sp;subpaths.start=sp,sp=["M"+O(point.x),O(point.y)+"C"+O(point.n.x),O(point.n.y),O(point.end.x),O(point.end.y),O(p[5]),O(p[6])].join(),len+=l,x=+p[5],y=+p[6];continue}if(!istotal&&!subpath)return point=getPointAtSegmentLength(x,y,p[1],p[2],p[3],p[4],p[5],p[6],length-len)}len+=l,x=+p[5],y=+p[6]}sp+=p.shift()+p}return subpaths.end=sp,point=istotal?len:subpath?subpaths:findDotsAtSegment(x,y,p[0],p[1],p[2],p[3],p[4],p[5],1)},null,clone)}function findDotsAtSegment(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,t){var t1=1-t,t13=pow(t1,3),t12=pow(t1,2),t2=t*t,t3=t2*t,x=t13*p1x+3*t12*t*c1x+3*t1*t*t*c2x+t3*p2x,y=t13*p1y+3*t12*t*c1y+3*t1*t*t*c2y+t3*p2y,mx=p1x+2*t*(c1x-p1x)+t2*(c2x-2*c1x+p1x),my=p1y+2*t*(c1y-p1y)+t2*(c2y-2*c1y+p1y),nx=c1x+2*t*(c2x-c1x)+t2*(p2x-2*c2x+c1x),ny=c1y+2*t*(c2y-c1y)+t2*(p2y-2*c2y+c1y),ax=t1*p1x+t*c1x,ay=t1*p1y+t*c1y,cx=t1*c2x+t*p2x,cy=t1*c2y+t*p2y,alpha=90-180*math.atan2(mx-nx,my-ny)/PI;return{x:x,y:y,m:{x:mx,y:my},n:{x:nx,y:ny},start:{x:ax,y:ay},end:{x:cx,y:cy},alpha:alpha}}function bezierBBox(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y){is(p1x,"array")||(p1x=[p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y]);var bbox=curveDim.apply(null,p1x);return box(bbox.min.x,bbox.min.y,bbox.max.x-bbox.min.x,bbox.max.y-bbox.min.y)}function isPointInsideBBox(bbox,x,y){return x>=bbox.x&&x<=bbox.x+bbox.width&&y>=bbox.y&&y<=bbox.y+bbox.height}function isBBoxIntersect(bbox1,bbox2){return bbox1=box(bbox1),bbox2=box(bbox2),isPointInsideBBox(bbox2,bbox1.x,bbox1.y)||isPointInsideBBox(bbox2,bbox1.x2,bbox1.y)||isPointInsideBBox(bbox2,bbox1.x,bbox1.y2)||isPointInsideBBox(bbox2,bbox1.x2,bbox1.y2)||isPointInsideBBox(bbox1,bbox2.x,bbox2.y)||isPointInsideBBox(bbox1,bbox2.x2,bbox2.y)||isPointInsideBBox(bbox1,bbox2.x,bbox2.y2)||isPointInsideBBox(bbox1,bbox2.x2,bbox2.y2)||(bbox1.xbbox2.x||bbox2.xbbox1.x)&&(bbox1.ybbox2.y||bbox2.ybbox1.y)}function base3(t,p1,p2,p3,p4){var t1=-3*p1+9*p2-9*p3+3*p4,t2=t*t1+6*p1-12*p2+6*p3;return t*t2-3*p1+3*p2}function bezlen(x1,y1,x2,y2,x3,y3,x4,y4,z){null==z&&(z=1),z=z>1?1:z<0?0:z;for(var z2=z/2,n=12,Tvalues=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],Cvalues=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],sum=0,i=0;ie;)step/=2,t2+=(lmmax(x3,x4)||mmax(y1,y2)mmax(y3,y4))){var nx=(x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4),ny=(x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4),denominator=(x1-x2)*(y3-y4)-(y1-y2)*(x3-x4);if(denominator){var px=nx/denominator,py=ny/denominator,px2=+px.toFixed(2),py2=+py.toFixed(2);if(!(px2<+mmin(x1,x2).toFixed(2)||px2>+mmax(x1,x2).toFixed(2)||px2<+mmin(x3,x4).toFixed(2)||px2>+mmax(x3,x4).toFixed(2)||py2<+mmin(y1,y2).toFixed(2)||py2>+mmax(y1,y2).toFixed(2)||py2<+mmin(y3,y4).toFixed(2)||py2>+mmax(y3,y4).toFixed(2)))return{x:px,y:py}}}}function interHelper(bez1,bez2,justCount){var bbox1=bezierBBox(bez1),bbox2=bezierBBox(bez2);if(!isBBoxIntersect(bbox1,bbox2))return justCount?0:[];for(var l1=bezlen.apply(0,bez1),l2=bezlen.apply(0,bez2),n1=~~(l1/8),n2=~~(l2/8),dots1=[],dots2=[],xy={},res=justCount?0:[],i=0;i=0&&t1<=1&&t2>=0&&t2<=1&&(justCount?res++:res.push({x:is.x,y:is.y,t1:t1,t2:t2}))}}return res}function pathIntersection(path1,path2){return interPathHelper(path1,path2)}function pathIntersectionNumber(path1,path2){return interPathHelper(path1,path2,1)}function interPathHelper(path1,path2,justCount){path1=path2curve(path1),path2=path2curve(path2);for(var x1,y1,x2,y2,x1m,y1m,x2m,y2m,bez1,bez2,res=justCount?0:[],i=0,ii=path1.length;i180),0,x2,y2]];else res=[["M",x,y],["m",0,-ry],["a",rx,ry,0,1,1,0,2*ry],["a",rx,ry,0,1,1,0,-2*ry],["z"]];return res.toString=toString,res}function pathToRelative(pathArray){var pth=paths(pathArray),lowerCase=String.prototype.toLowerCase;if(pth.rel)return pathClone(pth.rel);is(pathArray,"array")&&is(pathArray&&pathArray[0],"array")||(pathArray=parsePathString(pathArray));var res=[],x=0,y=0,mx=0,my=0,start=0;"M"==pathArray[0][0]&&(x=pathArray[0][1],y=pathArray[0][2],mx=x,my=y,start++,res.push(["M",x,y]));for(var i=start,ii=pathArray.length;i1&&(h=math.sqrt(h),rx*=h,ry*=h);var rx2=rx*rx,ry2=ry*ry,k=(large_arc_flag==sweep_flag?-1:1)*math.sqrt(abs((rx2*ry2-rx2*y*y-ry2*x*x)/(rx2*y*y+ry2*x*x))),cx=k*rx*y/ry+(x1+x2)/2,cy=k*-ry*x/rx+(y1+y2)/2,f1=math.asin(((y1-cy)/ry).toFixed(9)),f2=math.asin(((y2-cy)/ry).toFixed(9));f1=x1f2&&(f1-=2*PI),!sweep_flag&&f2>f1&&(f2-=2*PI)}var df=f2-f1;if(abs(df)>_120){var f2old=f2,x2old=x2,y2old=y2;f2=f1+_120*(sweep_flag&&f2>f1?1:-1),x2=cx+rx*math.cos(f2),y2=cy+ry*math.sin(f2),res=a2c(x2,y2,rx,ry,angle,0,sweep_flag,x2old,y2old,[f2,f2old,cx,cy])}df=f2-f1;var c1=math.cos(f1),s1=math.sin(f1),c2=math.cos(f2),s2=math.sin(f2),t=math.tan(df/4),hx=4/3*rx*t,hy=4/3*ry*t,m1=[x1,y1],m2=[x1+hx*s1,y1-hy*c1],m3=[x2+hx*s2,y2-hy*c2],m4=[x2,y2];if(m2[0]=2*m1[0]-m2[0],m2[1]=2*m1[1]-m2[1],recursive)return[m2,m3,m4].concat(res);res=[m2,m3,m4].concat(res).join().split(",");for(var newres=[],i=0,ii=res.length;i7){pp[i].shift();for(var pi=pp[i];pi.length;)pcoms1[i]="A",p2&&(pcoms2[i]="A"),pp.splice(i++,0,["C"].concat(pi.splice(0,6)));pp.splice(i,1),ii=mmax(p.length,p2&&p2.length||0)}},fixM=function(path1,path2,a1,a2,i){path1&&path2&&"M"==path1[i][0]&&"M"!=path2[i][0]&&(path2.splice(i,0,["M",a2.x,a2.y]),a1.bx=0,a1.by=0,a1.x=path1[i][1],a1.y=path1[i][2],ii=mmax(p.length,p2&&p2.length||0))},pcoms1=[],pcoms2=[],pfirst="",pcom="",i=0,ii=mmax(p.length,p2&&p2.length||0);ii;i+=2){var p=[{x:+crp[i-2],y:+crp[i-1]},{x:+crp[i],y:+crp[i+1]},{x:+crp[i+2],y:+crp[i+3]},{x:+crp[i+4],y:+crp[i+5]}];z?i?iLen-4==i?p[3]={x:+crp[0],y:+crp[1]}:iLen-2==i&&(p[2]={x:+crp[0],y:+crp[1]},p[3]={x:+crp[2],y:+crp[3]}):p[0]={x:+crp[iLen-2],y:+crp[iLen-1]}:iLen-4==i?p[3]=p[2]:i||(p[0]={x:+crp[i],y:+crp[i+1]}),d.push(["C",(-p[0].x+6*p[1].x+p[2].x)/6,(-p[0].y+6*p[1].y+p[2].y)/6,(p[1].x+6*p[2].x-p[3].x)/6,(p[1].y+6*p[2].y-p[3].y)/6,p[2].x,p[2].y])}return d}var has="hasOwnProperty",p2s=/,?([a-z]),?/gi,toFloat=parseFloat,math=Math,PI=math.PI,mmin=math.min,mmax=math.max,pow=math.pow,abs=math.abs,pathCommand=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,pathValues=/(-?\d*\.?\d*(?:e[\-+]?\\d+)?)[\s]*,?[\s]*/gi,getTotalLength=getLengthFactory(1),getPointAtLength=getLengthFactory();paths.getTotalLength=getTotalLength,paths.getPointAtLength=getPointAtLength,paths.findDotsAtSegment=findDotsAtSegment,paths.bezierBBox=bezierBBox,paths.isPointInsideBBox=isPointInsideBBox,paths.isBBoxIntersect=isBBoxIntersect,paths.intersection=pathIntersection,paths.intersectionNumber=pathIntersectionNumber,paths.isPointInside=isPointInsidePath,paths.getBBox=pathBBox,paths.toRelative=pathToRelative,paths.toAbsolute=pathToAbsolute,paths.toCubic=path2curve,paths.map=mapPath,paths.toString=toString,paths.clone=pathClone,module.exports.intersection=pathIntersection},{}],328:[function(require,module,exports){"use strict";function circlePath(center,r){var x=center.x,y=center.y;return[["M",x,y],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]]}function linePath(points){var segments=[];return points.forEach(function(p,idx){segments.push([0===idx?"M":"L",p.x,p.y])}),segments}function getBendpointIntersection(waypoints,reference){var i,w;for(i=0;w=waypoints[i];i++)if(pointDistance(w,reference)<=INTERSECTION_THRESHOLD)return{point:waypoints[i],bendpoint:!0,index:i};return null}function getPathIntersection(waypoints,reference){var idx,intersections=intersection(circlePath(reference,INTERSECTION_THRESHOLD),linePath(waypoints)),a=intersections[0],b=intersections[intersections.length-1];return a?a!==b?a.segment2!==b.segment2?(idx=max(a.segment2,b.segment2)-1, -{point:waypoints[idx],bendpoint:!0,index:idx}):{point:{x:round(a.x+b.x)/2,y:round(a.y+b.y)/2},index:a.segment2}:{point:{x:round(a.x),y:round(a.y)},index:a.segment2}:null}var pointDistance=require("./Geometry").pointDistance,intersection=require("./Intersection").intersection,round=Math.round,max=Math.max,INTERSECTION_THRESHOLD=10;module.exports.getApproxIntersection=function(waypoints,reference){return getBendpointIntersection(waypoints,reference)||getPathIntersection(waypoints,reference)}},{"./Geometry":324,"./Intersection":327}],329:[function(require,module,exports){"use strict";function log10(x){return Math.log(x)/Math.log(10)}function substract(p1,p2){return{x:p1.x-p2.x,y:p1.y-p2.y}}module.exports.log10=log10,module.exports.substract=substract},{}],330:[function(require,module,exports){"use strict";function isPrimaryButton(event){return!(getOriginalEvent(event)||event).button}var getOriginalEvent=require("./Event").getOriginal,isMac=require("./Platform").isMac;module.exports.isPrimaryButton=isPrimaryButton,module.exports.isMac=isMac,module.exports.hasPrimaryModifier=function(event){var originalEvent=getOriginalEvent(event)||event;return!!isPrimaryButton(event)&&(isMac()?originalEvent.metaKey:originalEvent.ctrlKey)},module.exports.hasSecondaryModifier=function(event){var originalEvent=getOriginalEvent(event)||event;return isPrimaryButton(event)&&originalEvent.shiftKey}},{"./Event":323,"./Platform":331}],331:[function(require,module,exports){"use strict";module.exports.isMac=function(){return/mac/i.test(navigator.platform)}},{}],332:[function(require,module,exports){"use strict";function center(bounds){return{x:bounds.x+bounds.width/2,y:bounds.y+bounds.height/2}}function delta(a,b){return{x:a.x-b.x,y:a.y-b.y}}module.exports.center=center,module.exports.delta=delta},{}],333:[function(require,module,exports){"use strict";module.exports.saveClear=function(collection,removeFn){if("function"!=typeof removeFn)throw new Error("removeFn iterator must be a function");if(collection){for(var e;e=collection[0];)removeFn(e);return collection}}},{}],334:[function(require,module,exports){"use strict";function toSVGPoints(points){for(var p,result="",i=0;p=points[i];i++)result+=p.x+","+p.y+" ";return result}var svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create");module.exports.componentsToPath=function(elements){return elements.join(",").replace(/,?([A-z]),?/g,"$1")},module.exports.toSVGPoints=toSVGPoints,module.exports.createLine=function(points,attrs){var line=svgCreate("polyline");return svgAttr(line,{points:toSVGPoints(points)}),attrs&&svgAttr(line,attrs),line},module.exports.updateLine=function(gfx,points){return svgAttr(gfx,{points:toSVGPoints(points)}),gfx}},{"tiny-svg/lib/attr":541,"tiny-svg/lib/create":545}],335:[function(require,module,exports){"use strict";var svgTransform=require("tiny-svg/lib/transform"),createTransform=require("tiny-svg/lib/geometry").createTransform;module.exports.transform=function(gfx,x,y,angle,amount){var translate=createTransform();translate.setTranslate(x,y);var rotate=createTransform();rotate.setRotate(angle,0,0);var scale=createTransform();scale.setScale(amount||1,amount||1),svgTransform(gfx,[translate,rotate,scale])},module.exports.translate=function(gfx,x,y){var translate=createTransform();translate.setTranslate(x,y),svgTransform(gfx,translate)},module.exports.rotate=function(gfx,angle){var rotate=createTransform();rotate.setRotate(angle,0,0),svgTransform(gfx,rotate)},module.exports.scale=function(gfx,amount){var scale=createTransform();scale.setScale(amount,amount),svgTransform(gfx,scale)}},{"tiny-svg/lib/geometry":546,"tiny-svg/lib/transform":549}],336:[function(require,module,exports){"use strict";function parseAlign(align){var parts=align.split("-");return{horizontal:parts[0]||"center",vertical:parts[1]||"top"}}function parsePadding(padding){return isObject(padding)?assign({top:0,left:0,right:0,bottom:0},padding):{top:padding,left:padding,right:padding,bottom:padding}}function getTextBBox(text,fakeText){fakeText.textContent=text;try{var bbox,emptyLine=""===text;return fakeText.textContent=emptyLine?"dummy":text,bbox=pick(fakeText.getBBox(),["width","height"]),emptyLine&&(bbox.width=0),bbox}catch(e){return{width:0,height:0}}}function layoutNext(lines,maxWidth,fakeText){for(var textBBox,originalLine=lines.shift(),fitLine=originalLine;;){if(textBBox=getTextBBox(fitLine,fakeText),textBBox.width=fitLine?textBBox.width:0," "===fitLine||""===fitLine||textBBox.width1)for(;part=parts.shift();){if(!(part.length+length ");return currentlyResolving.length=0,new Error(stack?msg+" (Resolving: "+stack+")":msg)},get=function(name,strict){if(!providers[name]&&name.indexOf(".")!==-1){for(var parts=name.split("."),pivot=get(parts.shift());parts.length;)pivot=pivot[parts.shift()];return pivot}if(Object.hasOwnProperty.call(instances,name))return instances[name];if(Object.hasOwnProperty.call(providers,name)){if(currentlyResolving.indexOf(name)!==-1)throw currentlyResolving.push(name),error("Cannot resolve circular dependency!");return currentlyResolving.push(name),instances[name]=providers[name][0](providers[name][1]),currentlyResolving.pop(),instances[name]}return parent.get(name,strict)},instantiate=function(Type){var instance=Object.create(Type.prototype),returned=invoke(Type,instance);return"object"==typeof returned?returned:instance},invoke=function(fn,context){if("function"!=typeof fn){if(!isArray(fn))throw new Error('Cannot invoke "'+fn+'". Expected a function!');fn=annotate(fn.slice())}var inject=fn.$inject&&fn.$inject||autoAnnotate(fn),dependencies=inject.map(function(dep){return get(dep)});return fn.apply(context,dependencies)},createPrivateInjectorFactory=function(privateChildInjector){return annotate(function(key){return privateChildInjector.get(key)})},createChild=function(modules,forceNewInstances){if(forceNewInstances&&forceNewInstances.length){var provider,cacheIdx,privateChildInjector,privateChildInjectorFactory,fromParentModule=Object.create(null),matchedScopes=Object.create(null),privateInjectorsCache=[],privateChildInjectors=[],privateChildFactories=[];for(var name in providers)provider=providers[name],forceNewInstances.indexOf(name)!==-1&&("private"===provider[2]?(cacheIdx=privateInjectorsCache.indexOf(provider[3]),cacheIdx===-1?(privateChildInjector=provider[3].createChild([],forceNewInstances),privateChildInjectorFactory=createPrivateInjectorFactory(privateChildInjector),privateInjectorsCache.push(provider[3]),privateChildInjectors.push(privateChildInjector),privateChildFactories.push(privateChildInjectorFactory),fromParentModule[name]=[privateChildInjectorFactory,name,"private",privateChildInjector]):fromParentModule[name]=[privateChildFactories[cacheIdx],name,"private",privateChildInjectors[cacheIdx]]):fromParentModule[name]=[provider[2],provider[1]],matchedScopes[name]=!0),"factory"!==provider[2]&&"type"!==provider[2]||!provider[1].$scope||forceNewInstances.forEach(function(scope){provider[1].$scope.indexOf(scope)!==-1&&(fromParentModule[name]=[provider[2],provider[1]],matchedScopes[scope]=!0)});forceNewInstances.forEach(function(scope){if(!matchedScopes[scope])throw new Error('No provider for "'+scope+'". Cannot use provider from the parent!')}),modules.unshift(fromParentModule)}return new Injector(modules,self)},factoryMap={factory:invoke,type:instantiate,value:function(value){return value}};modules.forEach(function(module){function arrayUnwrap(type,value){return"value"!==type&&isArray(value)&&(value=annotate(value.slice())),value}if(module instanceof Module)module.forEach(function(provider){var name=provider[0],type=provider[1],value=provider[2];providers[name]=[factoryMap[type],arrayUnwrap(type,value),type]});else if("object"==typeof module)if(module.__exports__){var clonedModule=Object.keys(module).reduce(function(m,key){return"__"!==key.substring(0,2)&&(m[key]=module[key]),m},Object.create(null)),privateInjector=new Injector((module.__modules__||[]).concat([clonedModule]),self),getFromPrivateInjector=annotate(function(key){return privateInjector.get(key)});module.__exports__.forEach(function(key){providers[key]=[getFromPrivateInjector,key,"private",privateInjector]})}else Object.keys(module).forEach(function(name){if("private"===module[name][2])return void(providers[name]=module[name]);var type=module[name][0],value=module[name][1];providers[name]=[factoryMap[type],arrayUnwrap(type,value),type]})}),this.get=get,this.invoke=invoke,this.instantiate=instantiate,this.createChild=createChild};module.exports=Injector},{"./annotation":337,"./module":340}],340:[function(require,module,exports){var Module=function(){var providers=[];this.factory=function(name,factory){return providers.push([name,"factory",factory]),this},this.value=function(name,value){return providers.push([name,"value",value]),this},this.type=function(name,type){return providers.push([name,"type",type]),this},this.forEach=function(iterator){providers.forEach(iterator)}};module.exports=Module},{}],341:[function(require,module,exports){function parse(html,doc){if("string"!=typeof html)throw new TypeError("String expected");doc||(doc=document);var m=/<([\w:]+)/.exec(html);if(!m)return doc.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if("body"==tag){var el=doc.createElement("html");return el.innerHTML=html,el.removeChild(el.lastChild)}var wrap=map[tag]||map._default,depth=wrap[0],prefix=wrap[1],suffix=wrap[2],el=doc.createElement("div");for(el.innerHTML=prefix+html+suffix;depth--;)el=el.lastChild;if(el.firstChild==el.lastChild)return el.removeChild(el.firstChild);for(var fragment=doc.createDocumentFragment();el.firstChild;)fragment.appendChild(el.removeChild(el.firstChild));return fragment}module.exports=parse;var bugTestDiv,innerHTMLBug=!1;"undefined"!=typeof document&&(bugTestDiv=document.createElement("div"),bugTestDiv.innerHTML='
a',innerHTMLBug=!bugTestDiv.getElementsByTagName("link").length,bugTestDiv=void 0);var map={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:innerHTMLBug?[1,"X
","
"]:[0,"",""]};map.td=map.th=[3,"","
"],map.option=map.optgroup=[1,'"],map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"","
"],map.polyline=map.ellipse=map.polygon=map.circle=map.text=map.line=map.path=map.rect=map.g=[1,'',""]},{}],342:[function(require,module,exports){!function(){function Parser(){}function extendDefaultOptions(options){if(options&&options._defaults)return options;var obj={_defaults:!0,types:Object.create(edn.types),converters:Object.create(edn.converters),values:Object.create(edn.values),equal:Object.create(edn.equal),printers:Object.create(edn.printers),tags:Object.create(edn.tags)};return options&&(extend(obj.types,options.types),extend(obj.converters,options.converters),extend(obj.values,options.values),extend(obj.equal,options.equal),extend(obj.printers,options.printers),extend(obj.tags,options.tags)),obj}function extend(target,source){var k;for(k in source)target[k]=source[k]}function compareValues(a,b){return a.valueOf()==b.valueOf()}function compareArrayValues(a,b,isEqual){var aLen=a.length,bLen=b.length;if(aLen!=bLen)return!1;for(var i=0;i2&&expected.push("'"+this.terminals_[p]+"'");errStr=this.lexer.showPosition?"Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(1==symbol?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:this.lexer.match, -token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected})}}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(this.lexer.yytext),lstack.push(this.lexer.yylloc),stack.push(action[1]),symbol=null,preErrorSymbol?(symbol=preErrorSymbol,preErrorSymbol=null):(yyleng=this.lexer.yyleng,yytext=this.lexer.yytext,yylineno=this.lexer.yylineno,yyloc=this.lexer.yylloc,recovering>0&&recovering--);break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack),"undefined"!=typeof r)return r;len&&(stack=stack.slice(0,-1*len*2),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0}},lexer=function(){var lexer={EOF:1,parseError:function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},setInput:function(input){return this._input=input,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var ch=this._input[0];this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);return lines?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},unput:function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len-1),this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),lines.length-1&&(this.yylineno-=lines.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this},more:function(){return this._more=!0,this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var token,match,tempMatch,index,lines;this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;imatch[0].length)||(match=tempMatch,index=i,this.options.flex));i++);return match?(lines=match[0].match(/(?:\r\n?|\n).*/g),lines&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,rules[index],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token?token:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return"undefined"!=typeof r?r:this.lex()},begin:function(condition){this.conditionStack.push(condition)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(condition){this.begin(condition)}};return lexer.options={},lexer.performAction=function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:break;case 1:break;case 2:break;case 3:return 20;case 4:return 25;case 5:return 26;case 6:return 27;case 7:return 28;case 8:return 29;case 9:return 33;case 10:return 32;case 11:return 24;case 12:return 22;case 13:return 23;case 14:return 21;case 15:return 5;case 16:return 34;case 17:return 35;case 18:return 40;case 19:return 38;case 20:return 39;case 21:return 36;case 22:return 37;case 23:return 41;case 24:return 31;case 25:return 30}},lexer.rules=[/^(?:\s+)/,/^(?:,)/,/^(?:;[^\n]+)/,/^(?:#[_])/,/^(?:\\newline\b)/,/^(?:\\return\b)/,/^(?:\\space\b)/,/^(?:\\tab\b)/,/^(?:\\[a-z]\b)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)\b)/,/^(?:(-?([0-9]|[1-9][0-9]+))\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:true\b)/,/^(?:false\b)/,/^(?:nil\b)/,/^(?:$)/,/^(?:\()/,/^(?:\))/,/^(?:#\{)/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:#[a-zA-Z0-9\/]+)/,/^(?::[a-zA-Z0-9\/\.\*\+\!\:\-\_\?\$\=\#]+)/,/^(?:[a-zA-Z\.\*\+\!\-\_\?\$\%\&\=\/][a-zA-Z0-9\#\.\*\+\!\-\_\?\$\%\&\=\/]*)/],lexer.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}},lexer}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}();if("undefined"!=typeof exports)var edn=exports;else var edn=window.edn={};Parser.prototype=parser,edn.parse=function(str,options){var parser=new Parser;return parser.yy.options=extendDefaultOptions(options),parser.parse(str)},edn.printers={},edn.stringify=function(obj,options){if(options=extendDefaultOptions(options),obj&&obj.toEDN)return obj.toEDN();obj=edn.convert(obj,options);var type=edn.typeOf(obj,options);if(type){var printer=options.printers[type];if(printer)return printer(obj);throw new Error("No printer function for type "+type)}throw new Error("No printer function for object "+obj)},edn.values={},edn.valueOf=function(obj,deep,options){function valueOf(obj){var type=edn.typeOf(obj,options);if(type){var f=options.values[type];return f?f(obj,deep,valueOf):obj}return obj}return void 0==deep&&(deep=!0),options=extendDefaultOptions(options),valueOf(obj)},edn.equal={},edn.isEqual=function(a,b,options){function isEqual(a,b){a=edn.convert(a,options),b=edn.convert(b,options);var aType=edn.typeOf(a,options),bType=edn.typeOf(b,options),eq=options.equal[aType];if(a===b)return!0;if(aType!==bType)return!1;if(eq)return eq(a,b,isEqual);throw new Error("No equal function for type "+aType)}return options=extendDefaultOptions(options),isEqual(a,b)},edn.converters={},edn.convert=function(obj,options){if(options=extendDefaultOptions(options),obj&&obj.asEDN)return obj.asEDN();var type=edn.typeOf(obj,options);if(type){var f=options.converters[type];return f?f(obj):obj}throw new Error("No type for object "+obj)},edn.types={},edn.typeOf=function(obj,options){options=extendDefaultOptions(options);var matchedTypes=[];for(var type in options.types)options.types[type](obj)&&matchedTypes.push(type);if(1==matchedTypes.length)return matchedTypes[0];if(matchedTypes.length>1)throw new Error("Conflicted types "+matchedTypes.join(", ")+" for object "+obj);return null};var toString=Object.prototype.toString;!function(){edn.types.nil=function(obj){return null===obj},edn.printers.nil=function(){return"nil"},edn.equal.nil=function(a,b){return!0},edn.types.undefined=function(obj){return void 0===obj},edn.converters.undefined=function(){return null}}(),function(){edn.types.boolean=function(obj){return"[object Boolean]"===toString.call(obj)},edn.printers.boolean=function(bool){return bool.valueOf()?"true":"false"},edn.equal.boolean=compareValues}(),function(){edn.types.string=function(obj){return"[object String]"===toString.call(obj)},edn.printers.string=function(str){return JSON.stringify(str)},edn.equal.string=compareValues}(),edn.Character=function(){function Character(c){if(!(this instanceof Character)){var char=pool[c];return char||(char=new Character(c),Object.freeze(char),pool[c]=char),char}this.char=c}var pool={};return Character.prototype.valueOf=function(){return this.char},Character.prototype.toString=function(){return this.char},Character.prototype.inspect=function(){return"[edn.Character "+require("util").inspect(this.char)+"]"},edn.types.character=function(obj){return obj instanceof Character},edn.printers.character=function(char){switch(char=char.valueOf()){case"\n":return"\\newline";case"\r":return"\\return";case" ":return"\\space";case"\t":return"\\tab";default:return"\\"+char[0]}},edn.values.character=valueOf,edn.equal.character=compareValues,edn.character=Character,parser.yy.Character=Character,Character}(),edn.Symbol=function(){function Symbol(namespace,name){if(!(this instanceof Symbol)){var nsname=joinNamespace(namespace,name),sym=pool[nsname];return sym||(sym=new Symbol(namespace,name),Object.freeze(sym),pool[sym.valueOf()]=sym),sym}var parts=splitNamespacedName(namespace,name);this.namespace=parts[0],this.name=parts[1]}function splitNamespacedName(namespace,name){if(namespace&&name)return[namespace,name];var parts=namespace.split("/",2);return"/"==namespace?[null,"/"]:2==parts.length?parts:[null,parts[0]]}function joinNamespace(namespace,name){return namespace&&name?[namespace,name].join("/"):namespace}var pool={};return Symbol.prototype.valueOf=function(){return this.namespace?[this.namespace,this.name].join("/"):this.name},Symbol.prototype.toString=function(){return this.valueOf()},Symbol.prototype.inspect=function(){return"[edn.Symbol "+this.toString()+"]"},edn.types.symbol=function(obj){return obj instanceof Symbol},edn.printers.symbol=function(symbol){return symbol.toString()},edn.values.symbol=valueOf,edn.equal.symbol=compareValues,edn.symbol=Symbol,parser.yy.Symbol=Symbol,Symbol}(),edn.Keyword=function(){function Keyword(namespace,name){var sym;if(sym=namespace instanceof edn.Symbol?namespace:edn.Symbol(namespace,name),!(this instanceof Keyword)){var key=pool[sym.valueOf()];return key||(key=new Keyword(namespace,name),Object.freeze(key),pool[sym.valueOf()]=key),key}this.symbol=sym,this.namespace=sym.namespace,this.name=sym.name}var pool={};return Keyword.prototype.valueOf=function(){return this.symbol.valueOf()},Keyword.prototype.toString=function(){return":"+this.symbol.toString()},Keyword.prototype.inspect=function(){return"[edn.Keyword "+this.toString()+"]"},edn.types.keyword=function(obj){return obj instanceof Keyword},edn.printers.keyword=function(keyword){return keyword.toString()},edn.values.keyword=valueOf,edn.equal.keyword=compareValues,edn.keyword=Keyword,parser.yy.Keyword=Keyword,Keyword}(),function(){edn.integer=function(n){return n},parser.yy.Integer=edn.integer,edn.types.integer=function(obj){return obj&&obj.type?"integer"==obj.type:"[object Number]"===toString.call(obj)&&Math.floor(obj)==obj},edn.printers.integer=function(n){return n.toString()},edn.values.integer=valueOf,edn.equal.integer=compareValues}(),function(){edn.float=function(n){return n=Object(n),n.type="float",n},parser.yy.Float=edn.float,edn.types.float=function(obj){return obj&&obj.type?"float"==obj.type:"[object Number]"===toString.call(obj)&&Math.floor(obj)!=obj},edn.printers.float=function(n){var s=n.toString();return/\./.test(s)||(s+=".0"),s},edn.values.float=valueOf,edn.equal.float=compareValues}(),function(){edn.list=function(ary){return ary=ary.slice(0),ary.type="list",ary},parser.yy.List=edn.list,edn.types.list=function(obj){return"[object Array]"===toString.call(obj)&&"list"===obj.type},edn.printers.list=function(ary){return"("+ary.map(edn.stringify).join(" ")+")"},edn.values.list=function(ary,deep,valueOf){return deep?ary.map(valueOf):ary.slice(0)},edn.equal.list=compareArrayValues}(),function(){edn.vector=function(ary){return ary=ary.slice(0),ary.type="vector",ary},parser.yy.Vector=edn.vector,edn.types.vector=function(obj){return"[object Array]"===toString.call(obj)&&"vector"===obj.type},edn.printers.vector=function(ary){return"["+ary.map(edn.stringify).join(" ")+"]"},edn.values.vector=function(ary,deep,valueOf){return deep?ary.map(valueOf):ary.slice(0)},edn.equal.vector=compareArrayValues,edn.types.array=function(obj){return"[object Array]"===toString.call(obj)&&"undefined"==typeof obj.type},edn.converters.array=function(ary){return edn.vector(ary)}}(),edn.Map=function(){function Map(){return this instanceof Map?(Object.defineProperty(this,"keys",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(this,"values",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(this,"items",{configurable:!1,enumerable:!1,writable:!1,value:[]}),void Object.defineProperty(this,"_map",{enumerable:!0,get:function(){var obj={};return this.items.forEach(function(item){obj[edn.stringify(item[0])]=item[1]}),obj}})):new Map}function indexOfIdentical(keys,key){for(var i=0,length=keys.length;i=0},Map.prototype.set=function(key,value){var keys=this.keys,values=this.values,items=this.items,index=(this._map,indexOfIdentical(keys,key));return index<0&&(index=keys.length),keys[index]=key,values[index]=value,items[index]=[key,value],value},Map.prototype.delete=function(key){var keys=this.keys,values=this.values,items=this.items,index=(this._map,indexOfIdentical(keys,key));return!(index<0)&&(keys.splice(index,1),values.splice(index,1),items.splice(index,1),!0)},Map.prototype.toString=function(){return"[object Map]"},Map.prototype.inspect=function(){return"[edn.Map "+require("util").inspect(this.items)+"]"},Map}(),function(){edn.map=function(values){for(var map=new edn.Map,i=0;i0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],344:[function(require,module,exports){!function(window,document,exportName,undefined){"use strict";function setTimeoutContext(fn,timeout,context){return setTimeout(bindFn(fn,context),timeout)}function invokeArrayArg(arg,fn,context){return!!Array.isArray(arg)&&(each(arg,context[fn],context),!0)}function each(obj,iterator,context){var i;if(obj)if(obj.forEach)obj.forEach(iterator,context);else if(obj.length!==undefined)for(i=0;i\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",log=window.console&&(window.console.warn||window.console.log);return log&&log.call(window.console,deprecationMessage,stack),method.apply(this,arguments)}}function inherit(child,base,properties){var childP,baseP=base.prototype;childP=child.prototype=Object.create(baseP),childP.constructor=child,childP._super=baseP,properties&&assign(childP,properties)}function bindFn(fn,context){return function(){return fn.apply(context,arguments)}}function boolOrFn(val,args){return typeof val==TYPE_FUNCTION?val.apply(args?args[0]||undefined:undefined,args):val}function ifUndefined(val1,val2){return val1===undefined?val2:val1}function addEventListeners(target,types,handler){each(splitStr(types),function(type){target.addEventListener(type,handler,!1)})}function removeEventListeners(target,types,handler){each(splitStr(types),function(type){target.removeEventListener(type,handler,!1)})}function hasParent(node,parent){for(;node;){if(node==parent)return!0;node=node.parentNode}return!1}function inStr(str,find){return str.indexOf(find)>-1}function splitStr(str){return str.trim().split(/\s+/g)}function inArray(src,find,findByKey){if(src.indexOf&&!findByKey)return src.indexOf(find);for(var i=0;ib[key]}):results.sort()),results}function prefixed(obj,property){for(var prefix,prop,camelProp=property[0].toUpperCase()+property.slice(1),i=0;i1&&!session.firstMultiple?session.firstMultiple=simpleCloneInputData(input):1===pointersLength&&(session.firstMultiple=!1);var firstInput=session.firstInput,firstMultiple=session.firstMultiple,offsetCenter=firstMultiple?firstMultiple.center:firstInput.center,center=input.center=getCenter(pointers);input.timeStamp=now(),input.deltaTime=input.timeStamp-firstInput.timeStamp,input.angle=getAngle(offsetCenter,center),input.distance=getDistance(offsetCenter,center),computeDeltaXY(session,input),input.offsetDirection=getDirection(input.deltaX,input.deltaY);var overallVelocity=getVelocity(input.deltaTime,input.deltaX,input.deltaY);input.overallVelocityX=overallVelocity.x,input.overallVelocityY=overallVelocity.y,input.overallVelocity=abs(overallVelocity.x)>abs(overallVelocity.y)?overallVelocity.x:overallVelocity.y,input.scale=firstMultiple?getScale(firstMultiple.pointers,pointers):1,input.rotation=firstMultiple?getRotation(firstMultiple.pointers,pointers):0,input.maxPointers=session.prevInput?input.pointers.length>session.prevInput.maxPointers?input.pointers.length:session.prevInput.maxPointers:input.pointers.length,computeIntervalInputData(session,input);var target=manager.element;hasParent(input.srcEvent.target,target)&&(target=input.srcEvent.target),input.target=target}function computeDeltaXY(session,input){var center=input.center,offset=session.offsetDelta||{},prevDelta=session.prevDelta||{},prevInput=session.prevInput||{};input.eventType!==INPUT_START&&prevInput.eventType!==INPUT_END||(prevDelta=session.prevDelta={x:prevInput.deltaX||0,y:prevInput.deltaY||0},offset=session.offsetDelta={x:center.x,y:center.y}),input.deltaX=prevDelta.x+(center.x-offset.x),input.deltaY=prevDelta.y+(center.y-offset.y)}function computeIntervalInputData(session,input){var velocity,velocityX,velocityY,direction,last=session.lastInterval||input,deltaTime=input.timeStamp-last.timeStamp;if(input.eventType!=INPUT_CANCEL&&(deltaTime>COMPUTE_INTERVAL||last.velocity===undefined)){var deltaX=input.deltaX-last.deltaX,deltaY=input.deltaY-last.deltaY,v=getVelocity(deltaTime,deltaX,deltaY);velocityX=v.x,velocityY=v.y,velocity=abs(v.x)>abs(v.y)?v.x:v.y,direction=getDirection(deltaX,deltaY),session.lastInterval=input}else velocity=last.velocity,velocityX=last.velocityX,velocityY=last.velocityY,direction=last.direction;input.velocity=velocity,input.velocityX=velocityX,input.velocityY=velocityY,input.direction=direction}function simpleCloneInputData(input){for(var pointers=[],i=0;i=abs(y)?x<0?DIRECTION_LEFT:DIRECTION_RIGHT:y<0?DIRECTION_UP:DIRECTION_DOWN}function getDistance(p1,p2,props){props||(props=PROPS_XY);var x=p2[props[0]]-p1[props[0]],y=p2[props[1]]-p1[props[1]];return Math.sqrt(x*x+y*y)}function getAngle(p1,p2,props){props||(props=PROPS_XY);var x=p2[props[0]]-p1[props[0]],y=p2[props[1]]-p1[props[1]];return 180*Math.atan2(y,x)/Math.PI}function getRotation(start,end){return getAngle(end[1],end[0],PROPS_CLIENT_XY)+getAngle(start[1],start[0],PROPS_CLIENT_XY)}function getScale(start,end){return getDistance(end[0],end[1],PROPS_CLIENT_XY)/getDistance(start[0],start[1],PROPS_CLIENT_XY); -}function MouseInput(){this.evEl=MOUSE_ELEMENT_EVENTS,this.evWin=MOUSE_WINDOW_EVENTS,this.pressed=!1,Input.apply(this,arguments)}function PointerEventInput(){this.evEl=POINTER_ELEMENT_EVENTS,this.evWin=POINTER_WINDOW_EVENTS,Input.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function SingleTouchInput(){this.evTarget=SINGLE_TOUCH_TARGET_EVENTS,this.evWin=SINGLE_TOUCH_WINDOW_EVENTS,this.started=!1,Input.apply(this,arguments)}function normalizeSingleTouches(ev,type){var all=toArray(ev.touches),changed=toArray(ev.changedTouches);return type&(INPUT_END|INPUT_CANCEL)&&(all=uniqueArray(all.concat(changed),"identifier",!0)),[all,changed]}function TouchInput(){this.evTarget=TOUCH_TARGET_EVENTS,this.targetIds={},Input.apply(this,arguments)}function getTouches(ev,type){var allTouches=toArray(ev.touches),targetIds=this.targetIds;if(type&(INPUT_START|INPUT_MOVE)&&1===allTouches.length)return targetIds[allTouches[0].identifier]=!0,[allTouches,allTouches];var i,targetTouches,changedTouches=toArray(ev.changedTouches),changedTargetTouches=[],target=this.target;if(targetTouches=allTouches.filter(function(touch){return hasParent(touch.target,target)}),type===INPUT_START)for(i=0;i-1&<s.splice(i,1)};setTimeout(removeLastTouch,DEDUP_TIMEOUT)}}function isSyntheticEvent(eventData){for(var x=eventData.srcEvent.clientX,y=eventData.srcEvent.clientY,i=0;i-1&&this.requireFail.splice(index,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(otherRecognizer){return!!this.simultaneous[otherRecognizer.id]},emit:function(input){function emit(event){self.manager.emit(event,input)}var self=this,state=this.state;state=STATE_ENDED&&emit(self.options.event+stateStr(state))},tryEmit:function(input){return this.canEmit()?this.emit(input):void(this.state=STATE_FAILED)},canEmit:function(){for(var i=0;ioptions.threshold&&direction&options.direction},attrTest:function(input){return AttrRecognizer.prototype.attrTest.call(this,input)&&(this.state&STATE_BEGAN||!(this.state&STATE_BEGAN)&&this.directionTest(input))},emit:function(input){this.pX=input.deltaX,this.pY=input.deltaY;var direction=directionStr(input.direction);direction&&(input.additionalEvent=this.options.event+direction),this._super.emit.call(this,input)}}),inherit(PinchRecognizer,AttrRecognizer,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[TOUCH_ACTION_NONE]},attrTest:function(input){return this._super.attrTest.call(this,input)&&(Math.abs(input.scale-1)>this.options.threshold||this.state&STATE_BEGAN)},emit:function(input){if(1!==input.scale){var inOut=input.scale<1?"in":"out";input.additionalEvent=this.options.event+inOut}this._super.emit.call(this,input)}}),inherit(PressRecognizer,Recognizer,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[TOUCH_ACTION_AUTO]},process:function(input){var options=this.options,validPointers=input.pointers.length===options.pointers,validMovement=input.distanceoptions.time;if(this._input=input,!validMovement||!validPointers||input.eventType&(INPUT_END|INPUT_CANCEL)&&!validTime)this.reset();else if(input.eventType&INPUT_START)this.reset(),this._timer=setTimeoutContext(function(){this.state=STATE_RECOGNIZED,this.tryEmit()},options.time,this);else if(input.eventType&INPUT_END)return STATE_RECOGNIZED;return STATE_FAILED},reset:function(){clearTimeout(this._timer)},emit:function(input){this.state===STATE_RECOGNIZED&&(input&&input.eventType&INPUT_END?this.manager.emit(this.options.event+"up",input):(this._input.timeStamp=now(),this.manager.emit(this.options.event,this._input)))}}),inherit(RotateRecognizer,AttrRecognizer,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[TOUCH_ACTION_NONE]},attrTest:function(input){return this._super.attrTest.call(this,input)&&(Math.abs(input.rotation)>this.options.threshold||this.state&STATE_BEGAN)}}),inherit(SwipeRecognizer,AttrRecognizer,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:DIRECTION_HORIZONTAL|DIRECTION_VERTICAL,pointers:1},getTouchAction:function(){return PanRecognizer.prototype.getTouchAction.call(this)},attrTest:function(input){var velocity,direction=this.options.direction;return direction&(DIRECTION_HORIZONTAL|DIRECTION_VERTICAL)?velocity=input.overallVelocity:direction&DIRECTION_HORIZONTAL?velocity=input.overallVelocityX:direction&DIRECTION_VERTICAL&&(velocity=input.overallVelocityY),this._super.attrTest.call(this,input)&&direction&input.offsetDirection&&input.distance>this.options.threshold&&input.maxPointers==this.options.pointers&&abs(velocity)>this.options.velocity&&input.eventType&INPUT_END},emit:function(input){var direction=directionStr(input.offsetDirection);direction&&this.manager.emit(this.options.event+direction,input),this.manager.emit(this.options.event,input)}}),inherit(TapRecognizer,Recognizer,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[TOUCH_ACTION_MANIPULATION]},process:function(input){var options=this.options,validPointers=input.pointers.length===options.pointers,validMovement=input.distance=Math.pow(2,bits)?hat(bits,base):res};hat.rack=function(bits,base,expandBy){var fn=function(data){var iters=0;do{if(iters++>10){if(!expandBy)throw new Error("too many ID collisions, use more bits");bits+=expandBy}var id=hat(bits,base)}while(Object.hasOwnProperty.call(hats,id));return hats[id]=data,id},hats=fn.hats={};return fn.get=function(id){return fn.hats[id]},fn.set=function(id,value){return fn.hats[id]=value,fn},fn.bits=bits||128,fn.base=base||16,fn}},{}],346:[function(require,module,exports){"use strict";function Ids(seed){return this instanceof Ids?(seed=seed||[128,36,1],void(this._seed=seed.length?hat.rack(seed[0],seed[1],seed[2]):seed)):new Ids(seed)}var hat=require("hat");module.exports=Ids,Ids.prototype.next=function(element){return this._seed(element||!0)},Ids.prototype.nextPrefixed=function(prefix,element){var id;do id=prefix+this.next(!0);while(this.assigned(id));return this.claim(id,element),id},Ids.prototype.claim=function(id,element){this._seed.set(id,element||!0)},Ids.prototype.assigned=function(id){return this._seed.get(id)||!1},Ids.prototype.unclaim=function(id){delete this._seed.hats[id]},Ids.prototype.clear=function(){var id,hats=this._seed.hats;for(id in hats)this.unclaim(id)}},{hat:345}],347:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],348:[function(require,module,exports){var createFindIndex=require("../internal/createFindIndex"),findIndex=createFindIndex();module.exports=findIndex},{"../internal/createFindIndex":444}],349:[function(require,module,exports){function flatten(array,isDeep,guard){var length=array?array.length:0;return guard&&isIterateeCall(array,isDeep,guard)&&(isDeep=!1),length?baseFlatten(array,isDeep):[]}var baseFlatten=require("../internal/baseFlatten"),isIterateeCall=require("../internal/isIterateeCall");module.exports=flatten},{"../internal/baseFlatten":403,"../internal/isIterateeCall":464}],350:[function(require,module,exports){function flattenDeep(array){var length=array?array.length:0;return length?baseFlatten(array,!0):[]}var baseFlatten=require("../internal/baseFlatten");module.exports=flattenDeep},{"../internal/baseFlatten":403}],351:[function(require,module,exports){function last(array){var length=array?array.length:0;return length?array[length-1]:void 0}module.exports=last},{}],352:[function(require,module,exports){var baseFlatten=require("../internal/baseFlatten"),baseUniq=require("../internal/baseUniq"),restParam=require("../function/restParam"),union=restParam(function(arrays){return baseUniq(baseFlatten(arrays,!1,!0))});module.exports=union},{"../function/restParam":376,"../internal/baseFlatten":403,"../internal/baseUniq":426}],353:[function(require,module,exports){function uniq(array,isSorted,iteratee,thisArg){var length=array?array.length:0;return length?(null!=isSorted&&"boolean"!=typeof isSorted&&(thisArg=iteratee,iteratee=isIterateeCall(array,isSorted,thisArg)?void 0:isSorted,isSorted=!1),iteratee=null==iteratee?iteratee:baseCallback(iteratee,thisArg,3),isSorted?sortedUniq(array,iteratee):baseUniq(array,iteratee)):[]}var baseCallback=require("../internal/baseCallback"),baseUniq=require("../internal/baseUniq"),isIterateeCall=require("../internal/isIterateeCall"),sortedUniq=require("../internal/sortedUniq");module.exports=uniq},{"../internal/baseCallback":391,"../internal/baseUniq":426,"../internal/isIterateeCall":464,"../internal/sortedUniq":479}],354:[function(require,module,exports){module.exports=require("./uniq")},{"./uniq":353}],355:[function(require,module,exports){var baseDifference=require("../internal/baseDifference"),isArrayLike=require("../internal/isArrayLike"),restParam=require("../function/restParam"),without=restParam(function(array,values){return isArrayLike(array)?baseDifference(array,values):[]});module.exports=without},{"../function/restParam":376,"../internal/baseDifference":397,"../internal/isArrayLike":462}],356:[function(require,module,exports){function xor(){for(var index=-1,length=arguments.length;++index-1:!!length&&baseIndexOf(collection,target,fromIndex)>-1}var baseIndexOf=require("../internal/baseIndexOf"),getLength=require("../internal/getLength"),isArray=require("../lang/isArray"),isIterateeCall=require("../internal/isIterateeCall"),isLength=require("../internal/isLength"),isString=require("../lang/isString"),values=require("../object/values"),nativeMax=Math.max;module.exports=includes},{"../internal/baseIndexOf":408,"../internal/getLength":455,"../internal/isIterateeCall":464,"../internal/isLength":467,"../lang/isArray":485,"../lang/isString":492,"../object/values":506}],365:[function(require,module,exports){var createAggregator=require("../internal/createAggregator"),indexBy=createAggregator(function(result,value,key){result[key]=value});module.exports=indexBy},{"../internal/createAggregator":435}],366:[function(require,module,exports){function map(collection,iteratee,thisArg){var func=isArray(collection)?arrayMap:baseMap;return iteratee=baseCallback(iteratee,thisArg,3),func(collection,iteratee)}var arrayMap=require("../internal/arrayMap"),baseCallback=require("../internal/baseCallback"),baseMap=require("../internal/baseMap"),isArray=require("../lang/isArray");module.exports=map},{"../internal/arrayMap":384,"../internal/baseCallback":391,"../internal/baseMap":413,"../lang/isArray":485}],367:[function(require,module,exports){var arrayReduce=require("../internal/arrayReduce"),baseEach=require("../internal/baseEach"),createReduce=require("../internal/createReduce"),reduce=createReduce(arrayReduce,baseEach);module.exports=reduce},{"../internal/arrayReduce":386,"../internal/baseEach":398,"../internal/createReduce":448}],368:[function(require,module,exports){function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;return predicate=baseCallback(predicate,thisArg,3),func(collection,function(value,index,collection){return!predicate(value,index,collection)})}var arrayFilter=require("../internal/arrayFilter"),baseCallback=require("../internal/baseCallback"),baseFilter=require("../internal/baseFilter"),isArray=require("../lang/isArray");module.exports=reject},{"../internal/arrayFilter":383,"../internal/baseCallback":391,"../internal/baseFilter":400,"../lang/isArray":485}],369:[function(require,module,exports){function size(collection){var length=collection?getLength(collection):0;return isLength(length)?length:keys(collection).length}var getLength=require("../internal/getLength"),isLength=require("../internal/isLength"),keys=require("../object/keys");module.exports=size},{"../internal/getLength":455,"../internal/isLength":467,"../object/keys":499}],370:[function(require,module,exports){function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;return thisArg&&isIterateeCall(collection,predicate,thisArg)&&(predicate=void 0),"function"==typeof predicate&&void 0===thisArg||(predicate=baseCallback(predicate,thisArg,3)),func(collection,predicate)}var arraySome=require("../internal/arraySome"),baseCallback=require("../internal/baseCallback"),baseSome=require("../internal/baseSome"),isArray=require("../lang/isArray"),isIterateeCall=require("../internal/isIterateeCall");module.exports=some},{"../internal/arraySome":387,"../internal/baseCallback":391,"../internal/baseSome":423,"../internal/isIterateeCall":464,"../lang/isArray":485}],371:[function(require,module,exports){function sortBy(collection,iteratee,thisArg){if(null==collection)return[];thisArg&&isIterateeCall(collection,iteratee,thisArg)&&(iteratee=void 0);var index=-1;iteratee=baseCallback(iteratee,thisArg,3);var result=baseMap(collection,function(value,key,collection){return{criteria:iteratee(value,key,collection),index:++index,value:value}});return baseSortBy(result,compareAscending)}var baseCallback=require("../internal/baseCallback"),baseMap=require("../internal/baseMap"),baseSortBy=require("../internal/baseSortBy"),compareAscending=require("../internal/compareAscending"),isIterateeCall=require("../internal/isIterateeCall");module.exports=sortBy},{"../internal/baseCallback":391,"../internal/baseMap":413,"../internal/baseSortBy":424,"../internal/compareAscending":432,"../internal/isIterateeCall":464}],372:[function(require,module,exports){var getNative=require("../internal/getNative"),nativeNow=getNative(Date,"now"),now=nativeNow||function(){return(new Date).getTime()};module.exports=now},{"../internal/getNative":457}],373:[function(require,module,exports){var createWrapper=require("../internal/createWrapper"),replaceHolders=require("../internal/replaceHolders"),restParam=require("./restParam"),BIND_FLAG=1,PARTIAL_FLAG=32,bind=restParam(function(func,thisArg,partials){var bitmask=BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,bind.placeholder);bitmask|=PARTIAL_FLAG}return createWrapper(func,bitmask,thisArg,partials,holders)});bind.placeholder={},module.exports=bind},{"../internal/createWrapper":449,"../internal/replaceHolders":476,"./restParam":376}],374:[function(require,module,exports){function debounce(func,wait,options){function cancel(){timeoutId&&clearTimeout(timeoutId),maxTimeoutId&&clearTimeout(maxTimeoutId),lastCalled=0,maxTimeoutId=timeoutId=trailingCall=void 0}function complete(isCalled,id){id&&clearTimeout(id),maxTimeoutId=timeoutId=trailingCall=void 0,isCalled&&(lastCalled=now(),result=func.apply(thisArg,args),timeoutId||maxTimeoutId||(args=thisArg=void 0))}function delayed(){var remaining=wait-(now()-stamp);remaining<=0||remaining>wait?complete(trailingCall,maxTimeoutId):timeoutId=setTimeout(delayed,remaining)}function maxDelayed(){complete(trailing,timeoutId)}function debounced(){if(args=arguments,stamp=now(),thisArg=this,trailingCall=trailing&&(timeoutId||!leading),maxWait===!1)var leadingCall=leading&&!timeoutId;else{maxTimeoutId||leading||(lastCalled=stamp);var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0||remaining>maxWait;isCalled?(maxTimeoutId&&(maxTimeoutId=clearTimeout(maxTimeoutId)),lastCalled=stamp,result=func.apply(thisArg,args)):maxTimeoutId||(maxTimeoutId=setTimeout(maxDelayed,remaining))}return isCalled&&timeoutId?timeoutId=clearTimeout(timeoutId):timeoutId||wait===maxWait||(timeoutId=setTimeout(delayed,wait)),leadingCall&&(isCalled=!0,result=func.apply(thisArg,args)),!isCalled||timeoutId||maxTimeoutId||(args=thisArg=void 0),result}var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=!1,trailing=!0;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);if(wait=wait<0?0:+wait||0,options===!0){var leading=!0;trailing=!1}else isObject(options)&&(leading=!!options.leading,maxWait="maxWait"in options&&nativeMax(+options.maxWait||0,wait),trailing="trailing"in options?!!options.trailing:trailing);return debounced.cancel=cancel,debounced}var isObject=require("../lang/isObject"),now=require("../date/now"),FUNC_ERROR_TEXT="Expected a function",nativeMax=Math.max;module.exports=debounce},{"../date/now":372,"../lang/isObject":490}],375:[function(require,module,exports){var baseDelay=require("../internal/baseDelay"),restParam=require("./restParam"),defer=restParam(function(func,args){return baseDelay(func,1,args)});module.exports=defer},{"../internal/baseDelay":396,"./restParam":376}],376:[function(require,module,exports){function restParam(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(void 0===start?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);++indexother&&!othIsNull||!valIsReflexive||valIsNull&&!othIsUndef&&othIsReflexive||valIsUndef&&othIsReflexive)return 1;if(value=LARGE_ARRAY_SIZE?createCache(values):null,valuesLength=values.length;cache&&(indexOf=cacheIndexOf,isCommon=!1,values=cache);outer:for(;++indexlength?0:length+start),end=void 0===end||end>length?length:+end||0,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index=LARGE_ARRAY_SIZE,seen=isLarge?createCache():null,result=[];seen?(indexOf=cacheIndexOf,isCommon=!1):(isLarge=!1,seen=iteratee?[]:result);outer:for(;++index2?sources[length-2]:void 0,guard=length>2?sources[2]:void 0,thisArg=length>1?sources[length-1]:void 0;for("function"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer="function"==typeof thisArg?thisArg:void 0,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?void 0:customizer,length=1);++index-1?collection[index]:void 0}return baseFind(collection,predicate,eachFunc)}}var baseCallback=require("./baseCallback"),baseFind=require("./baseFind"),baseFindIndex=require("./baseFindIndex"),isArray=require("../lang/isArray");module.exports=createFind},{"../lang/isArray":485,"./baseCallback":391,"./baseFind":401,"./baseFindIndex":402}],444:[function(require,module,exports){function createFindIndex(fromRight){return function(array,predicate,thisArg){return array&&array.length?(predicate=baseCallback(predicate,thisArg,3),baseFindIndex(array,predicate,fromRight)):-1}}var baseCallback=require("./baseCallback"),baseFindIndex=require("./baseFindIndex");module.exports=createFindIndex},{"./baseCallback":391,"./baseFindIndex":402}],445:[function(require,module,exports){function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return"function"==typeof iteratee&&void 0===thisArg&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}var bindCallback=require("./bindCallback"),isArray=require("../lang/isArray");module.exports=createForEach},{"../lang/isArray":485,"./bindCallback":428}],446:[function(require,module,exports){(function(global){function createHybridWrapper(func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity){function wrapper(){for(var length=arguments.length,index=length,args=Array(length);index--;)args[index]=arguments[index];if(partials&&(args=composeArgs(args,partials,holders)),partialsRight&&(args=composeArgsRight(args,partialsRight,holdersRight)),isCurry||isCurryRight){var placeholder=wrapper.placeholder,argsHolders=replaceHolders(args,placeholder);if(length-=argsHolders.length,lengtharrLength))return!1;for(;++index-1&&value%1==0&&value-1&&value%1==0&&value<=MAX_SAFE_INTEGER}var MAX_SAFE_INTEGER=9007199254740991;module.exports=isLength},{}],468:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}module.exports=isObjectLike},{}],469:[function(require,module,exports){function isStrictComparable(value){return value===value&&!isObject(value)}var isObject=require("../lang/isObject");module.exports=isStrictComparable},{"../lang/isObject":490}],470:[function(require,module,exports){function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask,isCommon=newBitmask0){if(++count>=HOT_COUNT)return key}else count=0;return baseSetData(key,value)}}();module.exports=setData},{"../date/now":372,"./baseSetData":421}],478:[function(require,module,exports){function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,allowIndexes=!!length&&isLength(length)&&(isArray(object)||isArguments(object)),index=-1,result=[];++index0;++index");elementsById[id]=element}},this.addWarning=function(warning){this.warnings.push(warning)}}function BaseHandler(){}function NoopHandler(){}function BodyHandler(){}function ReferenceHandler(property,context){this.property=property,this.context=context}function ValueHandler(propertyDesc,element){this.element=element,this.propertyDesc=propertyDesc}function BaseElementHandler(){}function ElementHandler(model,type,context){this.model=model,this.type=model.getType(type),this.context=context}function GenericElementHandler(model,type,context){this.model=model,this.context=context}function XMLReader(options){options instanceof Moddle&&(options={model:options}),assign(this,{lax:!1},options)}var reduce=require("lodash/collection/reduce"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),assign=require("lodash/object/assign"),defer=require("lodash/function/defer"),Stack=require("tiny-stack"),SaxParser=require("sax").parser,Moddle=require("moddle"),parseNameNs=require("moddle/lib/ns").parseName,Types=require("moddle/lib/types"),coerceType=Types.coerceType,isSimpleType=Types.isSimple,common=require("./common"),XSI_TYPE=common.XSI_TYPE,XSI_URI=common.DEFAULT_NS_MAP.xsi,serializeAsType=common.serializeAsType,aliasToName=common.aliasToName;BaseHandler.prototype.handleEnd=function(){},BaseHandler.prototype.handleText=function(){},BaseHandler.prototype.handleNode=function(){},NoopHandler.prototype=new BaseHandler,NoopHandler.prototype.handleNode=function(){return this},BodyHandler.prototype=new BaseHandler,BodyHandler.prototype.handleText=function(text){this.body=(this.body||"")+text},ReferenceHandler.prototype=new BodyHandler,ReferenceHandler.prototype.handleNode=function(node){if(this.element)throw error("expected no sub nodes");return this.element=this.createReference(node),this},ReferenceHandler.prototype.handleEnd=function(){this.element.id=this.body},ReferenceHandler.prototype.createReference=function(node){return{property:this.property.ns.name,id:""}},ValueHandler.prototype=new BodyHandler,ValueHandler.prototype.handleEnd=function(){var value=this.body,element=this.element,propertyDesc=this.propertyDesc;value=coerceType(propertyDesc.type,value),propertyDesc.isMany?element.get(propertyDesc.name).push(value):element.set(propertyDesc.name,value)},BaseElementHandler.prototype=Object.create(BodyHandler.prototype),BaseElementHandler.prototype.handleNode=function(node){var parser=this,element=this.element;return element?parser=this.handleChild(node):(element=this.element=this.createElement(node),this.context.addElement(element)),parser},ElementHandler.prototype=new BaseElementHandler,ElementHandler.prototype.addReference=function(reference){this.context.addReference(reference)},ElementHandler.prototype.handleEnd=function(){var value=this.body,element=this.element,descriptor=getModdleDescriptor(element),bodyProperty=descriptor.bodyProperty;bodyProperty&&void 0!==value&&(value=coerceType(bodyProperty.type,value),element.set(bodyProperty.name,value))},ElementHandler.prototype.createElement=function(node){var attributes=parseNodeAttributes(node),Type=this.type,descriptor=getModdleDescriptor(Type),context=this.context,instance=new Type({});return forEach(attributes,function(value,name){var values,prop=descriptor.propertiesByName[name];prop&&prop.isReference?prop.isMany?(values=value.split(" "),forEach(values,function(v){context.addReference({element:instance,property:prop.ns.name,id:v})})):context.addReference({element:instance,property:prop.ns.name,id:value}):(prop&&(value=coerceType(prop.type,value)),instance.set(name,value))}),instance},ElementHandler.prototype.getPropertyForNode=function(node){var elementTypeName,elementType,typeAnnotation,nameNs=parseNameNs(node.local,node.prefix),type=this.type,model=this.model,descriptor=getModdleDescriptor(type),propertyName=nameNs.name,property=descriptor.propertiesByName[propertyName];if(property)return serializeAsType(property)&&(typeAnnotation=node.attributes[XSI_TYPE])?(elementTypeName=typeAnnotation.value,elementType=model.getType(elementTypeName),assign({},property,{effectiveType:getModdleDescriptor(elementType).name})):property;var pkg=model.getPackage(nameNs.prefix);if(pkg){if(elementTypeName=nameNs.prefix+":"+aliasToName(nameNs.localName,descriptor.$pkg),elementType=model.getType(elementTypeName),property=find(descriptor.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&elementType.hasType(p.type)}))return assign({},property,{effectiveType:getModdleDescriptor(elementType).name})}else if(property=find(descriptor.properties,function(p){return!p.isReference&&!p.isAttribute&&"Element"===p.type}))return property;throw error("unrecognized element <"+nameNs.name+">")},ElementHandler.prototype.toString=function(){return"ElementDescriptor["+getModdleDescriptor(this.type).name+"]"},ElementHandler.prototype.valueHandler=function(propertyDesc,element){return new ValueHandler(propertyDesc,element)},ElementHandler.prototype.referenceHandler=function(propertyDesc){return new ReferenceHandler(propertyDesc,this.context)},ElementHandler.prototype.handler=function(type){return"Element"===type?new GenericElementHandler(this.model,type,this.context):new ElementHandler(this.model,type,this.context)},ElementHandler.prototype.handleChild=function(node){var propertyDesc,type,element,childHandler;if(propertyDesc=this.getPropertyForNode(node),element=this.element,type=propertyDesc.effectiveType||propertyDesc.type,isSimpleType(type))return this.valueHandler(propertyDesc,element);childHandler=propertyDesc.isReference?this.referenceHandler(propertyDesc).handleNode(node):this.handler(type).handleNode(node);var newElement=childHandler.element;return void 0!==newElement&&(propertyDesc.isMany?element.get(propertyDesc.name).push(newElement):element.set(propertyDesc.name,newElement),propertyDesc.isReference?(assign(newElement,{element:element}),this.context.addReference(newElement)):newElement.$parent=element),childHandler},GenericElementHandler.prototype=Object.create(BaseElementHandler.prototype),GenericElementHandler.prototype.createElement=function(node){var name=node.name,prefix=node.prefix,uri=node.ns[prefix],attributes=node.attributes;return this.model.createAny(name,uri,attributes)},GenericElementHandler.prototype.handleChild=function(node){var children,handler=new GenericElementHandler(this.model,"Element",this.context).handleNode(node),element=this.element,newElement=handler.element;return void 0!==newElement&&(children=element.$children=element.$children||[],children.push(newElement),newElement.$parent=element),handler},GenericElementHandler.prototype.handleText=function(text){this.body=this.body||""+text},GenericElementHandler.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},XMLReader.prototype.fromXML=function(xml,options,done){function resolveReferences(){var i,r,elementsById=context.elementsById,references=context.references;for(i=0;r=references[i];i++){var element=r.element,reference=elementsById[r.id],property=getModdleDescriptor(element).propertiesByName[r.property];if(reference||context.addWarning({message:"unresolved reference <"+r.id+">",element:r.element,property:r.property,value:r.id}),property.isMany){var collection=element.get(property.name),idx=collection.indexOf(r);idx===-1&&(idx=collection.length),reference?collection[idx]=reference:collection.splice(idx,1)}else element.set(property.name,reference)}}function handleClose(tagName){stack.pop().handleEnd()}function handleOpen(node){var handler=stack.peek();normalizeNamespaces(node,model);try{stack.push(handler.handleNode(node))}catch(e){var line=this.line,column=this.column,message="unparsable content <"+node.name+"> detected\n\tline: "+line+"\n\tcolumn: "+column+"\n\tnested error: "+e.message;if(!lax)throw console.error("could not parse document"),console.error(e),error(message);context.addWarning({message:message,error:e}),console.warn("could not parse node"),console.warn(e),stack.push(new NoopHandler)}}function handleText(text){stack.peek().handleText(text)}var rootHandler=options.rootHandler;options instanceof ElementHandler?(rootHandler=options,options={}):"string"==typeof options?(rootHandler=this.handler(options),options={}):"string"==typeof rootHandler&&(rootHandler=this.handler(rootHandler));var model=this.model,lax=this.lax,context=new Context(assign({},options,{rootHandler:rootHandler})),parser=new SaxParser(!0,{xmlns:!0,trim:!0}),stack=new Stack;rootHandler.context=context,stack.push(rootHandler),parser.onopentag=handleOpen,parser.oncdata=parser.ontext=handleText,parser.onclosetag=handleClose,parser.onend=resolveReferences,defer(function(){var error;try{parser.write(xml).close()}catch(e){error=e}done(error,error?void 0:rootHandler.element,context)})},XMLReader.prototype.handler=function(name){return new ElementHandler(this.model,name)},module.exports=XMLReader,module.exports.ElementHandler=ElementHandler},{"./common":520,"lodash/collection/find":361,"lodash/collection/forEach":362,"lodash/collection/reduce":367,"lodash/function/defer":375,"lodash/object/assign":495,moddle:523,"moddle/lib/ns":528,"moddle/lib/types":531,sax:535,"tiny-stack":538}],522:[function(require,module,exports){"use strict";function nsName(ns){return isString(ns)?ns:(ns.prefix?ns.prefix+":":"")+ns.localName}function getNsAttrs(namespaces){function isUsed(ns){return namespaces.used[ns.uri]}function toAttr(ns){var name="xmlns"+(ns.prefix?":"+ns.prefix:"");return{name:name,value:ns.uri}}var allNs=[].concat(namespaces.wellknown,namespaces.custom);return map(filter(allNs,isUsed),toAttr)}function getElementNs(ns,descriptor){return descriptor.isGeneric?descriptor.name:assign({localName:nameToAlias(descriptor.ns.localName,descriptor.$pkg)},ns)}function getPropertyNs(ns,descriptor){return assign({localName:descriptor.ns.localName},ns)}function getSerializableProperties(element){var descriptor=element.$descriptor;return filter(descriptor.properties,function(p){var name=p.name;if(p.isVirtual)return!1;if(!element.hasOwnProperty(name))return!1;var value=element[name];return value!==p.default&&(null!==value&&(!p.isMany||value.length))})}function escapeAttr(str){return str=isString(str)?str:""+str,str.replace(ESCAPE_CHARS,function(str){return"&#"+ESCAPE_MAP[str]+";"})}function filterAttributes(props){return filter(props,function(p){return p.isAttr})}function filterContained(props){return filter(props,function(p){return!p.isAttr})}function ReferenceSerializer(parent,ns){this.ns=ns}function BodySerializer(){}function ValueSerializer(ns){this.ns=ns}function ElementSerializer(parent,ns){this.body=[],this.attrs=[],this.parent=parent,this.ns=ns}function TypeSerializer(parent,ns){ElementSerializer.call(this,parent,ns)}function SavingWriter(){this.value="",this.write=function(str){this.value+=str}}function FormatingWriter(out,format){var indent=[""];this.append=function(str){return out.write(str),this},this.appendNewLine=function(){return format&&out.write("\n"),this},this.appendIndent=function(){return format&&out.write(indent.join(" ")),this},this.indent=function(){return indent.push(""),this},this.unindent=function(){return indent.pop(),this}}function XMLWriter(options){function toXML(tree,writer){var internalWriter=writer||new SavingWriter,formatingWriter=new FormatingWriter(internalWriter,options.format);if(options.preamble&&formatingWriter.append(XML_PREAMBLE),(new ElementSerializer).build(tree).serializeTo(formatingWriter),!writer)return internalWriter.value}return options=assign({format:!1,preamble:!0},options||{}),{toXML:toXML}}var map=require("lodash/collection/map"),forEach=require("lodash/collection/forEach"),isString=require("lodash/lang/isString"),filter=require("lodash/collection/filter"),assign=require("lodash/object/assign"),Types=require("moddle/lib/types"),parseNameNs=require("moddle/lib/ns").parseName,common=require("./common"),nameToAlias=common.nameToAlias,serializeAsType=common.serializeAsType,serializeAsProperty=common.serializeAsProperty,XML_PREAMBLE='\n',ESCAPE_CHARS=/(<|>|'|"|&|\n\r|\n)/g,DEFAULT_NS_MAP=common.DEFAULT_NS_MAP,XSI_TYPE=common.XSI_TYPE,ESCAPE_MAP={"\n":"10","\n\r":"10",'"':"34","'":"39","<":"60",">":"62","&":"38"};ReferenceSerializer.prototype.build=function(element){return this.element=element, -this},ReferenceSerializer.prototype.serializeTo=function(writer){writer.appendIndent().append("<"+nsName(this.ns)+">"+this.element.id+"").appendNewLine()},BodySerializer.prototype.serializeValue=BodySerializer.prototype.serializeTo=function(writer){var escape=this.escape;escape&&writer.append("")},BodySerializer.prototype.build=function(prop,value){return this.value=value,"String"===prop.type&&value.search(ESCAPE_CHARS)!==-1&&(this.escape=!0),this},ValueSerializer.prototype=new BodySerializer,ValueSerializer.prototype.serializeTo=function(writer){writer.appendIndent().append("<"+nsName(this.ns)+">"),this.serializeValue(writer),writer.append("").appendNewLine()},ElementSerializer.prototype.build=function(element){this.element=element;var otherAttrs=this.parseNsAttributes(element);if(this.ns||(this.ns=this.nsTagName(element.$descriptor)),element.$descriptor.isGeneric)this.parseGeneric(element);else{var properties=getSerializableProperties(element);this.parseAttributes(filterAttributes(properties)),this.parseContainments(filterContained(properties)),this.parseGenericAttributes(element,otherAttrs)}return this},ElementSerializer.prototype.nsTagName=function(descriptor){var effectiveNs=this.logNamespaceUsed(descriptor.ns);return getElementNs(effectiveNs,descriptor)},ElementSerializer.prototype.nsPropertyTagName=function(descriptor){var effectiveNs=this.logNamespaceUsed(descriptor.ns);return getPropertyNs(effectiveNs,descriptor)},ElementSerializer.prototype.isLocalNs=function(ns){return ns.uri===this.ns.uri},ElementSerializer.prototype.nsAttributeName=function(element){var ns;if(ns=isString(element)?parseNameNs(element):element.ns,element.inherited)return{localName:ns.localName};var effectiveNs=this.logNamespaceUsed(ns);return this.isLocalNs(effectiveNs)?{localName:ns.localName}:assign({localName:ns.localName},effectiveNs)},ElementSerializer.prototype.parseGeneric=function(element){var self=this,body=this.body,attrs=this.attrs;forEach(element,function(val,key){"$body"===key?body.push((new BodySerializer).build({type:"String"},val)):"$children"===key?forEach(val,function(child){body.push(new ElementSerializer(self).build(child))}):0!==key.indexOf("$")&&attrs.push({name:key,value:escapeAttr(val)})})},ElementSerializer.prototype.parseNsAttributes=function(element){var self=this,genericAttrs=element.$attrs,model=element.$model,attributes=[];return forEach(genericAttrs,function(value,name){var ns,nameNs=parseNameNs(name);"xmlns"===nameNs.prefix&&(ns={prefix:nameNs.localName,uri:value}),nameNs.prefix||"xmlns"!==nameNs.localName||(ns={uri:value}),ns?model.getPackage(value)?self.logNamespace(ns,!0):self.logNamespaceUsed(ns):attributes.push({name:name,value:value})}),attributes},ElementSerializer.prototype.parseGenericAttributes=function(element,attributes){var self=this;forEach(attributes,function(attr){if(attr.name!==XSI_TYPE)try{self.addAttribute(self.nsAttributeName(attr.name),attr.value)}catch(e){console.warn("missing namespace information for ",attr.name,"=",attr.value,"on",element,e)}})},ElementSerializer.prototype.parseContainments=function(properties){var self=this,body=this.body,element=this.element;forEach(properties,function(p){var value=element.get(p.name),isReference=p.isReference,isMany=p.isMany,ns=self.nsPropertyTagName(p);if(isMany||(value=[value]),p.isBody)body.push((new BodySerializer).build(p,value[0]));else if(Types.isSimple(p.type))forEach(value,function(v){body.push(new ValueSerializer(ns).build(p,v))});else if(isReference)forEach(value,function(v){body.push(new ReferenceSerializer(self,ns).build(v))});else{var asType=serializeAsType(p),asProperty=serializeAsProperty(p);forEach(value,function(v){var serializer;serializer=asType?new TypeSerializer(self,ns):asProperty?new ElementSerializer(self,ns):new ElementSerializer(self),body.push(serializer.build(v))})}})},ElementSerializer.prototype.getNamespaces=function(){var namespaces=this.namespaces,parent=this.parent;return namespaces||(namespaces=this.namespaces=parent?parent.getNamespaces():{prefixMap:{},uriMap:{},used:{},wellknown:[],custom:[]}),namespaces},ElementSerializer.prototype.logNamespace=function(ns,wellknown){var namespaces=this.getNamespaces(),nsUri=ns.uri,existing=namespaces.uriMap[nsUri];return existing||(namespaces.uriMap[nsUri]=ns,wellknown?namespaces.wellknown.push(ns):namespaces.custom.push(ns)),namespaces.prefixMap[ns.prefix]=nsUri,ns},ElementSerializer.prototype.logNamespaceUsed=function(ns){var element=this.element,model=element.$model,namespaces=this.getNamespaces(),prefix=ns.prefix,wellknownUri=DEFAULT_NS_MAP[prefix]||model&&(model.getPackage(prefix)||{}).uri,uri=ns.uri||namespaces.prefixMap[prefix]||wellknownUri;if(!uri)throw new Error("no namespace uri given for prefix <"+ns.prefix+">");return ns=namespaces.uriMap[uri],ns||(ns=this.logNamespace({prefix:prefix,uri:uri},wellknownUri)),namespaces.used[ns.uri]||(namespaces.used[ns.uri]=ns),ns},ElementSerializer.prototype.parseAttributes=function(properties){var self=this,element=this.element;forEach(properties,function(p){var value=element.get(p.name);if(p.isReference)if(p.isMany){var values=[];forEach(value,function(v){values.push(v.id)}),value=values.join(" ")}else value=value.id;self.addAttribute(self.nsAttributeName(p),value)})},ElementSerializer.prototype.addAttribute=function(name,value){var attrs=this.attrs;isString(value)&&(value=escapeAttr(value)),attrs.push({name:name,value:value})},ElementSerializer.prototype.serializeAttributes=function(writer){var attrs=this.attrs,root=!this.parent;root&&(attrs=getNsAttrs(this.namespaces).concat(attrs)),forEach(attrs,function(a){writer.append(" ").append(nsName(a.name)).append('="').append(a.value).append('"')})},ElementSerializer.prototype.serializeTo=function(writer){var hasBody=this.body.length,indent=!(1===this.body.length&&this.body[0]instanceof BodySerializer);writer.appendIndent().append("<"+nsName(this.ns)),this.serializeAttributes(writer),writer.append(hasBody?">":" />"),hasBody&&(indent&&writer.appendNewLine().indent(),forEach(this.body,function(b){b.serializeTo(writer)}),indent&&writer.unindent().appendIndent(),writer.append("")),writer.appendNewLine()},TypeSerializer.prototype=new ElementSerializer,TypeSerializer.prototype.build=function(element){var descriptor=element.$descriptor;this.element=element,this.typeNs=this.nsTagName(descriptor);var typeNs=this.typeNs,pkg=element.$model.getPackage(typeNs.uri),typePrefix=pkg.xml&&pkg.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(XSI_TYPE),(typeNs.prefix?typeNs.prefix+":":"")+typePrefix+descriptor.ns.localName),ElementSerializer.prototype.build.call(this,element)},TypeSerializer.prototype.isLocalNs=function(ns){return ns.uri===this.typeNs.uri},module.exports=XMLWriter},{"./common":520,"lodash/collection/filter":360,"lodash/collection/forEach":362,"lodash/collection/map":366,"lodash/lang/isString":492,"lodash/object/assign":495,"moddle/lib/ns":528,"moddle/lib/types":531}],523:[function(require,module,exports){module.exports=require("./lib/moddle")},{"./lib/moddle":527}],524:[function(require,module,exports){"use strict";function Base(){}Base.prototype.get=function(name){return this.$model.properties.get(this,name)},Base.prototype.set=function(name,value){this.$model.properties.set(this,name,value)},module.exports=Base},{}],525:[function(require,module,exports){"use strict";function DescriptorBuilder(nameNs){this.ns=nameNs,this.name=nameNs.name,this.allTypes=[],this.properties=[],this.propertiesByName={}}var pick=require("lodash/object/pick"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),parseNameNs=require("./ns").parseName;module.exports=DescriptorBuilder,DescriptorBuilder.prototype.build=function(){return pick(this,["ns","name","allTypes","properties","propertiesByName","bodyProperty","idProperty"])},DescriptorBuilder.prototype.addProperty=function(p,idx,validate){"boolean"==typeof idx&&(validate=idx,idx=void 0),this.addNamedProperty(p,validate!==!1);var properties=this.properties;void 0!==idx?properties.splice(idx,0,p):properties.push(p)},DescriptorBuilder.prototype.replaceProperty=function(oldProperty,newProperty,replace){var oldNameNs=oldProperty.ns,props=this.properties,propertiesByName=this.propertiesByName,rename=oldProperty.name!==newProperty.name;if(oldProperty.isId){if(!newProperty.isId)throw new Error("property <"+newProperty.ns.name+"> must be id property to refine <"+oldProperty.ns.name+">");this.setIdProperty(newProperty,!1)}if(oldProperty.isBody){if(!newProperty.isBody)throw new Error("property <"+newProperty.ns.name+"> must be body property to refine <"+oldProperty.ns.name+">");this.setBodyProperty(newProperty,!1)}var idx=props.indexOf(oldProperty);if(idx===-1)throw new Error("property <"+oldNameNs.name+"> not found in property list");props.splice(idx,1),this.addProperty(newProperty,replace?void 0:idx,rename),propertiesByName[oldNameNs.name]=propertiesByName[oldNameNs.localName]=newProperty},DescriptorBuilder.prototype.redefineProperty=function(p,targetPropertyName,replace){var nsPrefix=p.ns.prefix,parts=targetPropertyName.split("#"),name=parseNameNs(parts[0],nsPrefix),attrName=parseNameNs(parts[1],name.prefix).name,redefinedProperty=this.propertiesByName[attrName];if(!redefinedProperty)throw new Error("refined property <"+attrName+"> not found");this.replaceProperty(redefinedProperty,p,replace),delete p.redefines},DescriptorBuilder.prototype.addNamedProperty=function(p,validate){var ns=p.ns,propsByName=this.propertiesByName;validate&&(this.assertNotDefined(p,ns.name),this.assertNotDefined(p,ns.localName)),propsByName[ns.name]=propsByName[ns.localName]=p},DescriptorBuilder.prototype.removeNamedProperty=function(p){var ns=p.ns,propsByName=this.propertiesByName;delete propsByName[ns.name],delete propsByName[ns.localName]},DescriptorBuilder.prototype.setBodyProperty=function(p,validate){if(validate&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+p.ns.name+">)");this.bodyProperty=p},DescriptorBuilder.prototype.setIdProperty=function(p,validate){if(validate&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+p.ns.name+">)");this.idProperty=p},DescriptorBuilder.prototype.assertNotDefined=function(p,name){var propertyName=p.name,definedProperty=this.propertiesByName[propertyName];if(definedProperty)throw new Error("property <"+propertyName+"> already defined; override of <"+definedProperty.definedBy.ns.name+"#"+definedProperty.ns.name+"> by <"+p.definedBy.ns.name+"#"+p.ns.name+"> not allowed without redefines")},DescriptorBuilder.prototype.hasProperty=function(name){return this.propertiesByName[name]},DescriptorBuilder.prototype.addTrait=function(t,inherited){var allTypes=this.allTypes;allTypes.indexOf(t)===-1&&(forEach(t.properties,function(p){p=assign({},p,{name:p.ns.localName,inherited:inherited}),Object.defineProperty(p,"definedBy",{value:t});var replaces=p.replaces,redefines=p.redefines;replaces||redefines?this.redefineProperty(p,replaces||redefines,replaces):(p.isBody&&this.setBodyProperty(p),p.isId&&this.setIdProperty(p),this.addProperty(p))},this),allTypes.push(t))}},{"./ns":528,"lodash/collection/forEach":362,"lodash/object/assign":495,"lodash/object/pick":504}],526:[function(require,module,exports){"use strict";function Factory(model,properties){this.model=model,this.properties=properties}var forEach=require("lodash/collection/forEach"),Base=require("./base");module.exports=Factory,Factory.prototype.createType=function(descriptor){function ModdleElement(attrs){props.define(this,"$type",{value:name,enumerable:!0}),props.define(this,"$attrs",{value:{}}),props.define(this,"$parent",{writable:!0}),forEach(attrs,function(val,key){this.set(key,val)},this)}var model=this.model,props=this.properties,prototype=Object.create(Base.prototype);forEach(descriptor.properties,function(p){p.isMany||void 0===p.default||(prototype[p.name]=p.default)}),props.defineModel(prototype,model),props.defineDescriptor(prototype,descriptor);var name=descriptor.ns.name;return ModdleElement.prototype=prototype,ModdleElement.hasType=prototype.$instanceOf=this.model.hasType,props.defineModel(ModdleElement,model),props.defineDescriptor(ModdleElement,descriptor),ModdleElement}},{"./base":524,"lodash/collection/forEach":362}],527:[function(require,module,exports){"use strict";function Moddle(packages){this.properties=new Properties(this),this.factory=new Factory(this,this.properties),this.registry=new Registry(packages,this.properties),this.typeCache={}}var isString=require("lodash/lang/isString"),isObject=require("lodash/lang/isObject"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),Factory=require("./factory"),Registry=require("./registry"),Properties=require("./properties"),parseNameNs=require("./ns").parseName;module.exports=Moddle,Moddle.prototype.create=function(descriptor,attrs){var Type=this.getType(descriptor);if(!Type)throw new Error("unknown type <"+descriptor+">");return new Type(attrs)},Moddle.prototype.getType=function(descriptor){var cache=this.typeCache,name=isString(descriptor)?descriptor:descriptor.ns.name,type=cache[name];return type||(descriptor=this.registry.getEffectiveDescriptor(name),type=cache[name]=this.factory.createType(descriptor)),type},Moddle.prototype.createAny=function(name,nsUri,properties){var nameNs=parseNameNs(name),element={$type:name},descriptor={name:name,isGeneric:!0,ns:{prefix:nameNs.prefix,localName:nameNs.localName,uri:nsUri}};return this.properties.defineDescriptor(element,descriptor),this.properties.defineModel(element,this),this.properties.define(element,"$parent",{enumerable:!1,writable:!0}),forEach(properties,function(a,key){isObject(a)&&void 0!==a.value?element[a.name]=a.value:element[key]=a}),element},Moddle.prototype.getPackage=function(uriOrPrefix){return this.registry.getPackage(uriOrPrefix)},Moddle.prototype.getPackages=function(){return this.registry.getPackages()},Moddle.prototype.getElementDescriptor=function(element){return element.$descriptor},Moddle.prototype.hasType=function(element,type){void 0===type&&(type=element,element=this);var descriptor=element.$model.getElementDescriptor(element);return!!find(descriptor.allTypes,function(t){return t.name===type})},Moddle.prototype.getPropertyDescriptor=function(element,property){return this.getElementDescriptor(element).propertiesByName[property]}},{"./factory":526,"./ns":528,"./properties":529,"./registry":530,"lodash/collection/find":361,"lodash/collection/forEach":362,"lodash/lang/isObject":490,"lodash/lang/isString":492}],528:[function(require,module,exports){"use strict";module.exports.parseName=function(name,defaultPrefix){var localName,prefix,parts=name.split(/:/);if(1===parts.length)localName=name,prefix=defaultPrefix;else{if(2!==parts.length)throw new Error("expected or , got "+name);localName=parts[1],prefix=parts[0]}return name=(prefix?prefix+":":"")+localName,{name:name,prefix:prefix,localName:localName}}},{}],529:[function(require,module,exports){"use strict";function Properties(model){this.model=model}function isUndefined(val){return"undefined"==typeof val}function defineProperty(target,property,value){Object.defineProperty(target,property.name,{enumerable:!property.isReference,writable:!0,value:value,configurable:!0})}module.exports=Properties,Properties.prototype.set=function(target,name,value){var property=this.model.getPropertyDescriptor(target,name),propertyName=property&&property.name;isUndefined(value)?property?delete target[propertyName]:delete target.$attrs[name]:property?propertyName in target?target[propertyName]=value:defineProperty(target,property,value):target.$attrs[name]=value},Properties.prototype.get=function(target,name){var property=this.model.getPropertyDescriptor(target,name);if(!property)return target.$attrs[name];var propertyName=property.name;return!target[propertyName]&&property.isMany&&defineProperty(target,property,[]),target[propertyName]},Properties.prototype.define=function(target,name,options){Object.defineProperty(target,name,options)},Properties.prototype.defineDescriptor=function(target,descriptor){this.define(target,"$descriptor",{value:descriptor})},Properties.prototype.defineModel=function(target,model){this.define(target,"$model",{value:model})}},{}],530:[function(require,module,exports){"use strict";function Registry(packages,properties){this.packageMap={},this.typeMap={},this.packages=[],this.properties=properties,forEach(packages,this.registerPackage,this)}var assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),Types=require("./types"),DescriptorBuilder=require("./descriptor-builder"),parseNameNs=require("./ns").parseName,isBuiltInType=Types.isBuiltIn;module.exports=Registry,Registry.prototype.getPackage=function(uriOrPrefix){return this.packageMap[uriOrPrefix]},Registry.prototype.getPackages=function(){return this.packages},Registry.prototype.registerPackage=function(pkg){pkg=assign({},pkg),forEach(pkg.types,function(descriptor){this.registerType(descriptor,pkg)},this),this.packageMap[pkg.uri]=this.packageMap[pkg.prefix]=pkg,this.packages.push(pkg)},Registry.prototype.registerType=function(type,pkg){type=assign({},type,{superClass:(type.superClass||[]).slice(),extends:(type.extends||[]).slice(),properties:(type.properties||[]).slice()});var ns=parseNameNs(type.name,pkg.prefix),name=ns.name,propertiesByName={};forEach(type.properties,function(p){var propertyNs=parseNameNs(p.name,ns.prefix),propertyName=propertyNs.name;isBuiltInType(p.type)||(p.type=parseNameNs(p.type,propertyNs.prefix).name),assign(p,{ns:propertyNs,name:propertyName}),propertiesByName[propertyName]=p}),assign(type,{ns:ns,name:name,propertiesByName:propertiesByName}),forEach(type.extends,function(extendsName){var extended=this.typeMap[extendsName];extended.traits=extended.traits||[],extended.traits.push(name)},this),this.definePackage(type,pkg),this.typeMap[name]=type},Registry.prototype.mapTypes=function(nsName,iterator,trait){function traverseTrait(cls){return traverseSuper(cls,!0)}function traverseSuper(cls,trait){var parentNs=parseNameNs(cls,isBuiltInType(cls)?"":nsName.prefix);self.mapTypes(parentNs,iterator,trait)}var type=isBuiltInType(nsName.name)?{name:nsName.name}:this.typeMap[nsName.name],self=this;if(!type)throw new Error("unknown type <"+nsName.name+">");forEach(type.superClass,trait?traverseTrait:traverseSuper),iterator(type,!trait),forEach(type.traits,traverseTrait)},Registry.prototype.getEffectiveDescriptor=function(name){var nsName=parseNameNs(name),builder=new DescriptorBuilder(nsName);this.mapTypes(nsName,function(type,inherited){builder.addTrait(type,inherited)});var descriptor=builder.build();return this.definePackage(descriptor,descriptor.allTypes[descriptor.allTypes.length-1].$pkg),descriptor},Registry.prototype.definePackage=function(target,pkg){this.properties.define(target,"$pkg",{value:pkg})}},{"./descriptor-builder":525,"./ns":528,"./types":531,"lodash/collection/forEach":362,"lodash/object/assign":495}],531:[function(require,module,exports){"use strict";var BUILTINS={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},TYPE_CONVERTERS={String:function(s){return s},Boolean:function(s){return"true"===s},Integer:function(s){return parseInt(s,10)},Real:function(s){return parseFloat(s,10)}};module.exports.coerceType=function(type,value){var converter=TYPE_CONVERTERS[type];return converter?converter(value):value},module.exports.isBuiltIn=function(type){return!!BUILTINS[type]},module.exports.isSimple=function(type){return!!TYPE_CONVERTERS[type]}},{}],532:[function(require,module,exports){module.exports=require("./lib/refs"),module.exports.Collection=require("./lib/collection")},{"./lib/collection":533,"./lib/refs":534}],533:[function(require,module,exports){"use strict";function extend(collection,refs,property,target){var inverseProperty=property.inverse;return Object.defineProperty(collection,"remove",{value:function(element){var idx=this.indexOf(element);return idx!==-1&&(this.splice(idx,1),refs.unset(element,inverseProperty,target)),element}}),Object.defineProperty(collection,"contains",{value:function(element){return this.indexOf(element)!==-1}}),Object.defineProperty(collection,"add",{value:function(element){this.contains(element)||(this.push(element),refs.set(element,inverseProperty,target))}}),Object.defineProperty(collection,"__refs_collection",{value:!0}),collection}function isExtended(collection){return collection.__refs_collection===!0}module.exports.extend=extend,module.exports.isExtended=isExtended},{}],534:[function(require,module,exports){"use strict";function hasOwnProperty(e,property){return Object.prototype.hasOwnProperty.call(e,property.name||property)}function defineCollectionProperty(ref,property,target){Object.defineProperty(target,property.name,{enumerable:property.enumerable,value:Collection.extend(target[property.name]||[],ref,property,target)})}function defineProperty(ref,property,target){var inverseProperty=property.inverse,_value=target[property.name];Object.defineProperty(target,property.name,{enumerable:property.enumerable,get:function(){return _value},set:function(value){if(value!==_value){var old=_value;_value=null,old&&ref.unset(old,inverseProperty,target),_value=value,ref.set(_value,inverseProperty,target)}}})}function Refs(a,b){return this instanceof Refs?(a.inverse=b,b.inverse=a,this.props={},this.props[a.name]=a,void(this.props[b.name]=b)):new Refs(a,b)}var Collection=require("./collection");Refs.prototype.bind=function(target,property){if("string"==typeof property){if(!this.props[property])throw new Error("no property <"+property+"> in ref");property=this.props[property]}property.collection?defineCollectionProperty(this,property,target):defineProperty(this,property,target)},Refs.prototype.ensureRefsCollection=function(target,property){var collection=target[property.name];return Collection.isExtended(collection)||defineCollectionProperty(this,property,target),collection},Refs.prototype.ensureBound=function(target,property){hasOwnProperty(target,property)||this.bind(target,property)},Refs.prototype.unset=function(target,property,value){target&&(this.ensureBound(target,property),property.collection?this.ensureRefsCollection(target,property).remove(value):target[property.name]=void 0)},Refs.prototype.set=function(target,property,value){target&&(this.ensureBound(target,property),property.collection?this.ensureRefsCollection(target,property).add(value):target[property.name]=value)},module.exports=Refs},{"./collection":533}],535:[function(require,module,exports){(function(Buffer){!function(sax){function SAXParser(strict,opt){if(!(this instanceof SAXParser))return new SAXParser(strict,opt);var parser=this;clearBuffers(parser),parser.q=parser.c="",parser.bufferCheckPosition=sax.MAX_BUFFER_LENGTH,parser.opt=opt||{},parser.opt.lowercase=parser.opt.lowercase||parser.opt.lowercasetags,parser.looseCase=parser.opt.lowercase?"toLowerCase":"toUpperCase",parser.tags=[],parser.closed=parser.closedRoot=parser.sawRoot=!1,parser.tag=parser.error=null,parser.strict=!!strict,parser.noscript=!(!strict&&!parser.opt.noscript),parser.state=S.BEGIN,parser.ENTITIES=Object.create(sax.ENTITIES),parser.attribList=[],parser.opt.xmlns&&(parser.ns=Object.create(rootNS)),parser.trackPosition=parser.opt.position!==!1,parser.trackPosition&&(parser.position=parser.line=parser.column=0),emit(parser,"onready")}function checkBufferLength(parser){for(var maxAllowed=Math.max(sax.MAX_BUFFER_LENGTH,10),maxActual=0,i=0,l=buffers.length;imaxAllowed)switch(buffers[i]){case"textNode":closeText(parser);break;case"cdata":emitNode(parser,"oncdata",parser.cdata),parser.cdata="";break;case"script":emitNode(parser,"onscript",parser.script),parser.script="";break;default:error(parser,"Max buffer length exceeded: "+buffers[i])}maxActual=Math.max(maxActual,len)}parser.bufferCheckPosition=sax.MAX_BUFFER_LENGTH-maxActual+parser.position}function clearBuffers(parser){for(var i=0,l=buffers.length;i",parser.tagName="",void(parser.state=S.SCRIPT);emitNode(parser,"onscript",parser.script),parser.script=""}var t=parser.tags.length,tagName=parser.tagName;parser.strict||(tagName=tagName[parser.looseCase]());for(var closeTo=tagName;t--;){var close=parser.tags[t];if(close.name===closeTo)break;strictFail(parser,"Unexpected close tag")}if(t<0)return strictFail(parser,"Unmatched closing tag: "+parser.tagName),parser.textNode+="",void(parser.state=S.TEXT);parser.tagName=tagName;for(var s=parser.tags.length;s-- >t;){var tag=parser.tag=parser.tags.pop();parser.tagName=parser.tag.name,emitNode(parser,"onclosetag",parser.tagName);var x={};for(var i in tag.ns)x[i]=tag.ns[i];var parent=parser.tags[parser.tags.length-1]||parser;parser.opt.xmlns&&tag.ns!==parent.ns&&Object.keys(tag.ns).forEach(function(p){var n=tag.ns[p];emitNode(parser,"onclosenamespace",{prefix:p,uri:n})})}0===t&&(parser.closedRoot=!0),parser.tagName=parser.attribValue=parser.attribName="",parser.attribList.length=0,parser.state=S.TEXT}function parseEntity(parser){var num,entity=parser.entity,entityLC=entity.toLowerCase(),numStr="";return parser.ENTITIES[entity]?parser.ENTITIES[entity]:parser.ENTITIES[entityLC]?parser.ENTITIES[entityLC]:(entity=entityLC,"#"===entity.charAt(0)&&("x"===entity.charAt(1)?(entity=entity.slice(2),num=parseInt(entity,16),numStr=num.toString(16)):(entity=entity.slice(1),num=parseInt(entity,10),numStr=num.toString(10))),entity=entity.replace(/^0+/,""),numStr.toLowerCase()!==entity?(strictFail(parser,"Invalid character entity"),"&"+parser.entity+";"):String.fromCodePoint(num))}function write(chunk){var parser=this;if(this.error)throw this.error;if(parser.closed)return error(parser,"Cannot write after close. Assign an onready handler.");if(null===chunk)return end(parser);for(var i=0,c="";parser.c=c=chunk.charAt(i++);)switch(parser.trackPosition&&(parser.position++,"\n"===c?(parser.line++,parser.column=0):parser.column++),parser.state){case S.BEGIN:"<"===c?(parser.state=S.OPEN_WAKA,parser.startTagPosition=parser.position):not(whitespace,c)&&(strictFail(parser,"Non-whitespace before first tag."),parser.textNode=c,parser.state=S.TEXT);continue;case S.TEXT:if(parser.sawRoot&&!parser.closedRoot){for(var starti=i-1;c&&"<"!==c&&"&"!==c;)c=chunk.charAt(i++),c&&parser.trackPosition&&(parser.position++,"\n"===c?(parser.line++,parser.column=0):parser.column++); -parser.textNode+=chunk.substring(starti,i-1)}"<"===c?(parser.state=S.OPEN_WAKA,parser.startTagPosition=parser.position):(!not(whitespace,c)||parser.sawRoot&&!parser.closedRoot||strictFail(parser,"Text data outside of root node."),"&"===c?parser.state=S.TEXT_ENTITY:parser.textNode+=c);continue;case S.SCRIPT:"<"===c?parser.state=S.SCRIPT_ENDING:parser.script+=c;continue;case S.SCRIPT_ENDING:"/"===c?parser.state=S.CLOSE_TAG:(parser.script+="<"+c,parser.state=S.SCRIPT);continue;case S.OPEN_WAKA:if("!"===c)parser.state=S.SGML_DECL,parser.sgmlDecl="";else if(is(whitespace,c));else if(is(nameStart,c))parser.state=S.OPEN_TAG,parser.tagName=c;else if("/"===c)parser.state=S.CLOSE_TAG,parser.tagName="";else if("?"===c)parser.state=S.PROC_INST,parser.procInstName=parser.procInstBody="";else{if(strictFail(parser,"Unencoded <"),parser.startTagPosition+1"===c?(emitNode(parser,"onsgmldeclaration",parser.sgmlDecl),parser.sgmlDecl="",parser.state=S.TEXT):is(quote,c)?(parser.state=S.SGML_DECL_QUOTED,parser.sgmlDecl+=c):parser.sgmlDecl+=c;continue;case S.SGML_DECL_QUOTED:c===parser.q&&(parser.state=S.SGML_DECL,parser.q=""),parser.sgmlDecl+=c;continue;case S.DOCTYPE:">"===c?(parser.state=S.TEXT,emitNode(parser,"ondoctype",parser.doctype),parser.doctype=!0):(parser.doctype+=c,"["===c?parser.state=S.DOCTYPE_DTD:is(quote,c)&&(parser.state=S.DOCTYPE_QUOTED,parser.q=c));continue;case S.DOCTYPE_QUOTED:parser.doctype+=c,c===parser.q&&(parser.q="",parser.state=S.DOCTYPE);continue;case S.DOCTYPE_DTD:parser.doctype+=c,"]"===c?parser.state=S.DOCTYPE:is(quote,c)&&(parser.state=S.DOCTYPE_DTD_QUOTED,parser.q=c);continue;case S.DOCTYPE_DTD_QUOTED:parser.doctype+=c,c===parser.q&&(parser.state=S.DOCTYPE_DTD,parser.q="");continue;case S.COMMENT:"-"===c?parser.state=S.COMMENT_ENDING:parser.comment+=c;continue;case S.COMMENT_ENDING:"-"===c?(parser.state=S.COMMENT_ENDED,parser.comment=textopts(parser.opt,parser.comment),parser.comment&&emitNode(parser,"oncomment",parser.comment),parser.comment=""):(parser.comment+="-"+c,parser.state=S.COMMENT);continue;case S.COMMENT_ENDED:">"!==c?(strictFail(parser,"Malformed comment"),parser.comment+="--"+c,parser.state=S.COMMENT):parser.state=S.TEXT;continue;case S.CDATA:"]"===c?parser.state=S.CDATA_ENDING:parser.cdata+=c;continue;case S.CDATA_ENDING:"]"===c?parser.state=S.CDATA_ENDING_2:(parser.cdata+="]"+c,parser.state=S.CDATA);continue;case S.CDATA_ENDING_2:">"===c?(parser.cdata&&emitNode(parser,"oncdata",parser.cdata),emitNode(parser,"onclosecdata"),parser.cdata="",parser.state=S.TEXT):"]"===c?parser.cdata+="]":(parser.cdata+="]]"+c,parser.state=S.CDATA);continue;case S.PROC_INST:"?"===c?parser.state=S.PROC_INST_ENDING:is(whitespace,c)?parser.state=S.PROC_INST_BODY:parser.procInstName+=c;continue;case S.PROC_INST_BODY:if(!parser.procInstBody&&is(whitespace,c))continue;"?"===c?parser.state=S.PROC_INST_ENDING:parser.procInstBody+=c;continue;case S.PROC_INST_ENDING:">"===c?(emitNode(parser,"onprocessinginstruction",{name:parser.procInstName,body:parser.procInstBody}),parser.procInstName=parser.procInstBody="",parser.state=S.TEXT):(parser.procInstBody+="?"+c,parser.state=S.PROC_INST_BODY);continue;case S.OPEN_TAG:is(nameBody,c)?parser.tagName+=c:(newTag(parser),">"===c?openTag(parser):"/"===c?parser.state=S.OPEN_TAG_SLASH:(not(whitespace,c)&&strictFail(parser,"Invalid character in tag name"),parser.state=S.ATTRIB));continue;case S.OPEN_TAG_SLASH:">"===c?(openTag(parser,!0),closeTag(parser)):(strictFail(parser,"Forward-slash in opening tag not followed by >"),parser.state=S.ATTRIB);continue;case S.ATTRIB:if(is(whitespace,c))continue;">"===c?openTag(parser):"/"===c?parser.state=S.OPEN_TAG_SLASH:is(nameStart,c)?(parser.attribName=c,parser.attribValue="",parser.state=S.ATTRIB_NAME):strictFail(parser,"Invalid attribute name");continue;case S.ATTRIB_NAME:"="===c?parser.state=S.ATTRIB_VALUE:">"===c?(strictFail(parser,"Attribute without value"),parser.attribValue=parser.attribName,attrib(parser),openTag(parser)):is(whitespace,c)?parser.state=S.ATTRIB_NAME_SAW_WHITE:is(nameBody,c)?parser.attribName+=c:strictFail(parser,"Invalid attribute name");continue;case S.ATTRIB_NAME_SAW_WHITE:if("="===c)parser.state=S.ATTRIB_VALUE;else{if(is(whitespace,c))continue;strictFail(parser,"Attribute without value"),parser.tag.attributes[parser.attribName]="",parser.attribValue="",emitNode(parser,"onattribute",{name:parser.attribName,value:""}),parser.attribName="",">"===c?openTag(parser):is(nameStart,c)?(parser.attribName=c,parser.state=S.ATTRIB_NAME):(strictFail(parser,"Invalid attribute name"),parser.state=S.ATTRIB)}continue;case S.ATTRIB_VALUE:if(is(whitespace,c))continue;is(quote,c)?(parser.q=c,parser.state=S.ATTRIB_VALUE_QUOTED):(strictFail(parser,"Unquoted attribute value"),parser.state=S.ATTRIB_VALUE_UNQUOTED,parser.attribValue=c);continue;case S.ATTRIB_VALUE_QUOTED:if(c!==parser.q){"&"===c?parser.state=S.ATTRIB_VALUE_ENTITY_Q:parser.attribValue+=c;continue}attrib(parser),parser.q="",parser.state=S.ATTRIB_VALUE_CLOSED;continue;case S.ATTRIB_VALUE_CLOSED:is(whitespace,c)?parser.state=S.ATTRIB:">"===c?openTag(parser):"/"===c?parser.state=S.OPEN_TAG_SLASH:is(nameStart,c)?(strictFail(parser,"No whitespace between attributes"),parser.attribName=c,parser.attribValue="",parser.state=S.ATTRIB_NAME):strictFail(parser,"Invalid attribute name");continue;case S.ATTRIB_VALUE_UNQUOTED:if(not(attribEnd,c)){"&"===c?parser.state=S.ATTRIB_VALUE_ENTITY_U:parser.attribValue+=c;continue}attrib(parser),">"===c?openTag(parser):parser.state=S.ATTRIB;continue;case S.CLOSE_TAG:if(parser.tagName)">"===c?closeTag(parser):is(nameBody,c)?parser.tagName+=c:parser.script?(parser.script+=""===c?closeTag(parser):strictFail(parser,"Invalid characters in closing tag");continue;case S.TEXT_ENTITY:case S.ATTRIB_VALUE_ENTITY_Q:case S.ATTRIB_VALUE_ENTITY_U:switch(parser.state){case S.TEXT_ENTITY:var returnState=S.TEXT,buffer="textNode";break;case S.ATTRIB_VALUE_ENTITY_Q:var returnState=S.ATTRIB_VALUE_QUOTED,buffer="attribValue";break;case S.ATTRIB_VALUE_ENTITY_U:var returnState=S.ATTRIB_VALUE_UNQUOTED,buffer="attribValue"}";"===c?(parser[buffer]+=parseEntity(parser),parser.entity="",parser.state=returnState):is(entity,c)?parser.entity+=c:(strictFail(parser,"Invalid character entity"),parser[buffer]+="&"+parser.entity+c,parser.entity="",parser.state=returnState);continue;default:throw new Error(parser,"Unknown state: "+parser.state)}return parser.position>=parser.bufferCheckPosition&&checkBufferLength(parser),parser}sax.parser=function(strict,opt){return new SAXParser(strict,opt)},sax.SAXParser=SAXParser,sax.SAXStream=SAXStream,sax.createStream=createStream,sax.MAX_BUFFER_LENGTH=65536;var buffers=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];sax.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(o){function f(){this.__proto__=o}return f.prototype=o,new f}),Object.getPrototypeOf||(Object.getPrototypeOf=function(o){return o.__proto__}),Object.keys||(Object.keys=function(o){var a=[];for(var i in o)o.hasOwnProperty(i)&&a.push(i);return a}),SAXParser.prototype={end:function(){end(this)},write:write,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){flushBuffers(this)}};try{var Stream=require("stream").Stream}catch(ex){var Stream=function(){}}var streamWraps=sax.EVENTS.filter(function(ev){return"error"!==ev&&"end"!==ev});SAXStream.prototype=Object.create(Stream.prototype,{constructor:{value:SAXStream}}),SAXStream.prototype.write=function(data){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(data)){if(!this._decoder){var SD=require("string_decoder").StringDecoder;this._decoder=new SD("utf8")}data=this._decoder.write(data)}return this._parser.write(data.toString()),this.emit("data",data),!0},SAXStream.prototype.end=function(chunk){return chunk&&chunk.length&&this.write(chunk),this._parser.end(),!0},SAXStream.prototype.on=function(ev,handler){var me=this;return me._parser["on"+ev]||streamWraps.indexOf(ev)===-1||(me._parser["on"+ev]=function(){var args=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);args.splice(0,0,ev),me.emit.apply(me,args)}),Stream.prototype.on.call(me,ev,handler)};var whitespace="\r\n\t ",number="0124356789",letter="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",quote="'\"",entity=number+letter+"#",attribEnd=whitespace+">",CDATA="[CDATA[",DOCTYPE="DOCTYPE",XML_NAMESPACE="http://www.w3.org/XML/1998/namespace",XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/",rootNS={xml:XML_NAMESPACE,xmlns:XMLNS_NAMESPACE};whitespace=charClass(whitespace),number=charClass(number),letter=charClass(letter);var nameStart=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,nameBody=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;quote=charClass(quote),entity=charClass(entity),attribEnd=charClass(attribEnd);var S=0;sax.STATE={BEGIN:S++,TEXT:S++,TEXT_ENTITY:S++,OPEN_WAKA:S++,SGML_DECL:S++,SGML_DECL_QUOTED:S++,DOCTYPE:S++,DOCTYPE_QUOTED:S++,DOCTYPE_DTD:S++,DOCTYPE_DTD_QUOTED:S++,COMMENT_STARTING:S++,COMMENT:S++,COMMENT_ENDING:S++,COMMENT_ENDED:S++,CDATA:S++,CDATA_ENDING:S++,CDATA_ENDING_2:S++,PROC_INST:S++,PROC_INST_BODY:S++,PROC_INST_ENDING:S++,OPEN_TAG:S++,OPEN_TAG_SLASH:S++,ATTRIB:S++,ATTRIB_NAME:S++,ATTRIB_NAME_SAW_WHITE:S++,ATTRIB_VALUE:S++,ATTRIB_VALUE_QUOTED:S++,ATTRIB_VALUE_CLOSED:S++,ATTRIB_VALUE_UNQUOTED:S++,ATTRIB_VALUE_ENTITY_Q:S++,ATTRIB_VALUE_ENTITY_U:S++,CLOSE_TAG:S++,CLOSE_TAG_SAW_WHITE:S++,SCRIPT:S++,SCRIPT_ENDING:S++},sax.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(sax.ENTITIES).forEach(function(key){var e=sax.ENTITIES[key],s="number"==typeof e?String.fromCharCode(e):e;sax.ENTITIES[key]=s});for(var S in sax.STATE)sax.STATE[sax.STATE[S]]=S;S=sax.STATE,String.fromCodePoint||!function(){var stringFromCharCode=String.fromCharCode,floor=Math.floor,fromCodePoint=function(){var highSurrogate,lowSurrogate,MAX_SIZE=16384,codeUnits=[],index=-1,length=arguments.length;if(!length)return"";for(var result="";++index1114111||floor(codePoint)!=codePoint)throw RangeError("Invalid code point: "+codePoint);codePoint<=65535?codeUnits.push(codePoint):(codePoint-=65536,highSurrogate=(codePoint>>10)+55296,lowSurrogate=codePoint%1024+56320,codeUnits.push(highSurrogate,lowSurrogate)),(index+1==length||codeUnits.length>MAX_SIZE)&&(result+=stringFromCharCode.apply(null,codeUnits),codeUnits.length=0)}return result};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:fromCodePoint,configurable:!0,writable:!0}):String.fromCodePoint=fromCodePoint}()}("undefined"==typeof exports?sax={}:exports)}).call(this,void 0)},{stream:void 0,string_decoder:void 0}],536:[function(require,module,exports){"use strict";function ScrollTabs($el,options){EventEmitter.call(this),this.options=options=assign({},DEFAULT_OPTIONS,options),this.container=$el,this._createScrollButtons($el,options),this._bindEvents($el)}function create($el,options){var scrollTabs=get($el);return scrollTabs||(scrollTabs=new ScrollTabs($el,options),$el.__scrollTabs=scrollTabs),scrollTabs}function get($el){return $el.__scrollTabs}var domify=require("min-dom/lib/domify"),domClasses=require("min-dom/lib/classes"),domMatches=require("min-dom/lib/matches"),domDelegate=require("min-dom/lib/delegate"),domQuery=require("min-dom/lib/query"),domEvent=require("min-dom/lib/event"),domAttr=require("min-dom/lib/attr"),filter=require("lodash/collection/filter"),assign=require("lodash/object/assign"),inherits=require("inherits"),EventEmitter=require("events"),DEFAULT_OPTIONS={scrollSymbolLeft:"‹",scrollSymbolRight:"›"};inherits(ScrollTabs,EventEmitter),ScrollTabs.prototype._createButton=function(parentNode,options){var className=options.className,direction=options.direction,button=domQuery("."+className,parentNode);return button||(button=domify(''+options.label+""),parentNode.insertBefore(button,parentNode.childNodes[0])),domAttr(button,"data-direction",direction),button},ScrollTabs.prototype._createScrollButtons=function(parentNode,options){this._createButton(parentNode,{className:"scroll-tabs-left",label:options.scrollSymbolLeft,direction:-1}),this._createButton(parentNode,{className:"scroll-tabs-right",label:options.scrollSymbolRight,direction:1})},ScrollTabs.prototype.getActiveTabNode=function(){return domQuery(this.options.selectors.active,this.container)},ScrollTabs.prototype.getTabsContainerNode=function(){return domQuery(this.options.selectors.tabsContainer,this.container)},ScrollTabs.prototype.getAllTabNodes=function(){return domQuery.all(this.options.selectors.tab,this.container)},ScrollTabs.prototype.getVisibleTabs=function(){var allTabs=this.getAllTabNodes(),ignore=this.options.selectors.ignore;return filter(allTabs,function(tabNode){return!domMatches(tabNode,ignore)})},ScrollTabs.prototype.getAdjacentTab=function(referenceTabNode,n){var visibleTabs=this.getVisibleTabs(),index=visibleTabs.indexOf(referenceTabNode);return visibleTabs[index+n]},ScrollTabs.prototype._bindEvents=function(node){this._bindWheelEvent(node),this._bindTabClickEvents(node),this._bindScrollButtonEvents(node)},ScrollTabs.prototype._bindTabClickEvents=function(node){var selector=this.options.selectors.tab,self=this;domDelegate.bind(node,selector,"click",function(event){self.scrollToTabNode(event.delegateTarget)})},ScrollTabs.prototype._bindWheelEvent=function(node){var self=this;domEvent.bind(node,"wheel",function(e){var direction=Math.sign(e.deltaY),oldActiveTab=self.getActiveTabNode(),newActiveTab=self.getAdjacentTab(oldActiveTab,direction);newActiveTab&&(self.scrollToTabNode(newActiveTab),self.emit("scroll",newActiveTab,oldActiveTab,direction)),e.preventDefault()})},ScrollTabs.prototype._bindScrollButtonEvents=function(node){var self=this;domDelegate.bind(node,".scroll-tabs-button","click",function(event){var target=event.delegateTarget,direction=parseInt(domAttr(target,"data-direction"),10),oldActiveTabNode=self.getActiveTabNode(),newActiveTabNode=self.getAdjacentTab(oldActiveTabNode,direction);newActiveTabNode&&(self.scrollToTabNode(newActiveTabNode),self.emit("scroll",newActiveTabNode,oldActiveTabNode,direction)),event.preventDefault()})},ScrollTabs.prototype.scrollToTabNode=function(tabNode){if(tabNode){var tabsContainerNode=tabNode.parentNode,tabWidth=tabNode.offsetWidth,tabOffsetLeft=tabNode.offsetLeft,tabOffsetRight=tabOffsetLeft+tabWidth,containerWidth=tabsContainerNode.offsetWidth,containerScrollLeft=tabsContainerNode.scrollLeft;containerScrollLeft>tabOffsetLeft?tabsContainerNode.scrollLeft=0:tabOffsetRight>containerWidth&&(tabsContainerNode.scrollLeft=tabOffsetRight-containerWidth)}},ScrollTabs.prototype.update=function(){var tabsContainerNode=this.getTabsContainerNode(),overflow=tabsContainerNode.scrollWidth>tabsContainerNode.offsetWidth,overflowClass="scroll-tabs-overflow";domClasses(this.container).toggle(overflowClass,overflow),overflow&&this.scrollToTabNode(this.getActiveTabNode())},module.exports=create,module.exports.get=get},{events:343,inherits:347,"lodash/collection/filter":360,"lodash/object/assign":495,"min-dom/lib/attr":510,"min-dom/lib/classes":511,"min-dom/lib/delegate":514,"min-dom/lib/domify":515,"min-dom/lib/event":516,"min-dom/lib/matches":517,"min-dom/lib/query":518}],537:[function(require,module,exports){"use strict";function calculateUpdate(currentSelection,currentValue,newValue){var currentCursor=currentSelection.start,newCursor=currentCursor,diff=newValue.length-currentValue.length,currentTail=(newValue.length-currentValue.length,currentValue.substring(currentCursor));newValue.lastIndexOf(currentTail)===newValue.length-currentTail.length&&(currentValue=currentValue.substring(0,currentValue.length-currentTail.length),newValue=newValue.substring(0,newValue.length-currentTail.length));var diff=createDiff(currentValue,newValue);return diff&&(newCursor="remove"===diff.type?diff.newStart:diff.newEnd),range(newCursor)}function createDiff(currentValue,newValue){var insert,l_str,l_char,s_str,s_char,l_idx=0,s_idx=0;for(newValue.length>currentValue.length?(l_str=newValue,s_str=currentValue):(l_str=currentValue,s_str=newValue);l_idxcurrentValue.length?{newStart:insert.l_start,newEnd:insert.l_end,type:"add"}:{newStart:insert.s_start,newEnd:insert.s_end,type:newValue.length0?(this.top--,this.data.pop()):void 0},TinyStack.prototype.push=function(arg){return this.data[++this.top]=arg,this},"undefined"!=typeof exports?module.exports=factory:"function"==typeof define?define(function(){return factory}):global.stack=factory}(this)},{}],539:[function(require,module,exports){function append(element,node){return appendTo(node,element),element}module.exports=append;var appendTo=require("./appendTo")},{"./appendTo":540}],540:[function(require,module,exports){function appendTo(element,target){return target.appendChild(ensureImported(element,target)),element}module.exports=appendTo;var ensureImported=require("./util/ensureImported")},{"./util/ensureImported":550}],541:[function(require,module,exports){function getAttribute(node,name){return CSS_PROPERTIES[name]?node.style[name]:node.getAttributeNS(null,name)}function setAttribute(node,name,value){var hyphenated=name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),type=CSS_PROPERTIES[hyphenated];type?(type===LENGTH_ATTR&&"number"==typeof value&&(value=String(value)+"px"),node.style[hyphenated]=value):node.setAttributeNS(null,name,value)}function setAttributes(node,attrs){var i,name,names=Object.keys(attrs);for(i=0,name;name=names[i];i++)setAttribute(node,name,attrs[name])}function attr(node,name,value){if("string"==typeof name){if(void 0===value)return getAttribute(node,name);setAttribute(node,name,value)}else setAttributes(node,name);return node}module.exports=attr;var LENGTH_ATTR=2,CSS_PROPERTIES={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":LENGTH_ATTR,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":LENGTH_ATTR,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1}},{}],542:[function(require,module,exports){function defined(o){return"undefined"!=typeof o}function classes(el){return new ClassList(el)}function ClassList(el){if(!el||!el.nodeType)throw new Error("A DOM element reference is required");this.el=el,this.list=el.classList}module.exports=classes;var index=function(arr,obj){if(arr.indexOf)return arr.indexOf(obj);for(var i=0;i"+svg+"",parseDocument(svg)}function parseDocument(svg){var parser;return parser=new DOMParser,parser.async=!1,parser.parseFromString(svg,"text/xml")}module.exports=parse;var ns=require("./ns"),SVG_START='"),childNodes=node.childNodes,i=0,len=childNodes.length;i")}else output.push("/>");break;case 8:output.push("");break;case 4:output.push("",node.nodeValue,"");break;default:throw new Error("unable to handle node "+node.nodeType)}return output}module.exports=serialize;var TEXT_ENTITIES=/([&<>]{1})/g,ATTR_ENTITIES=/([\n\r"]{1})/g,ENTITY_REPLACEMENT={"&":"&","<":"<",">":">",'"':"'"}},{}]},{},[1]); +!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;otargetAspectRatio){var height=newBounds.width*(1/targetAspectRatio),y=newBounds.y-(height-newBounds.height)/2;assign(newBounds,{y:y,height:height})}else if(aspectRatio
'),this._bindListeners(this._container),config&&config.parent&&this.attachTo(config.parent)},PropertiesPanel.prototype.attachTo=function(parentNode){if(!parentNode)throw new Error("parentNode required");this.detach(),parentNode.get&&(parentNode=parentNode.get(0)),"string"==typeof parentNode&&(parentNode=domQuery(parentNode));var container=this._container;parentNode.appendChild(container),this._emit("attach")},PropertiesPanel.prototype.detach=function(){var container=this._container,parentNode=container.parentNode;parentNode&&(this._emit("detach"),parentNode.removeChild(container))},PropertiesPanel.prototype.activateTab=function(tab){var tabId="string"==typeof tab?tab:tab.id,current=this._current,panelNode=current.panel,allTabNodes=domQuery.all(".bpp-properties-tab",panelNode),allTabLinkNodes=domQuery.all(".bpp-properties-tab-link",panelNode);forEach(allTabNodes,function(tabNode){var currentTabId=domAttr(tabNode,"data-tab");domClasses(tabNode).toggle("bpp-active",tabId===currentTabId)}),forEach(allTabLinkNodes,function(tabLinkNode){var tabLink=domQuery("[data-tab-target]",tabLinkNode),currentTabId=domAttr(tabLink,"data-tab-target");domClasses(tabLinkNode).toggle("bpp-active",tabId===currentTabId)})},PropertiesPanel.prototype.update=function(element){var current=this._current,needsCreate=!0;void 0===element&&(element=this._canvas.getRootElement());var newTabs=this._propertiesProvider.getTabs(element);if(current&¤t.element===element&&(needsCreate=this._entriesChanged(current,newTabs)),needsCreate){if(current){var activeTabId,activeTabNode=domQuery(".bpp-properties-tab.bpp-active",current.panel);activeTabNode&&(activeTabId=domAttr(activeTabNode,"data-tab")),domRemove(current.panel)}this._current=this._create(element,newTabs),activeTabId?this.activateTab(activeTabId):this.activateTab(this._current.tabs[0])}this._current&&this._updateActivation(this._current),this._emit("changed")},PropertiesPanel.prototype._entriesChanged=function(current,newTabs){var oldEntryIds=keys(current.entries),newEntryIds=keys(extractEntries(newTabs));return!isEmpty(xor(oldEntryIds,newEntryIds))},PropertiesPanel.prototype._emit=function(event){this._eventBus.fire("propertiesPanel."+event,{panel:this,current:this._current})},PropertiesPanel.prototype._bindListeners=function(container){function handleInput(event,element){var inputNode=event.delegateTarget,entryNode=domClosest(inputNode,"[data-entry]");if(entryNode){var eventHandlerId=domAttr(inputNode,"data-blur"),entryId=domAttr(entryNode,"data-entry"),entry=self.getEntry(entryId);if(self.executeAction(entry,entryNode,eventHandlerId,event)){var values=getFormControlValues(entryNode);self.applyChanges(entry,values,entryNode)}self.updateState(entry,entryNode)}}var self=this,handleChange=function(event){var entryId,entry,node=domClosest(event.delegateTarget,"[data-entry]");if(node){entryId=domAttr(node,"data-entry"),entry=self.getEntry(entryId);var values=getFormControlValues(node);if("change"===event.type){var onChangeAction=event.delegateTarget.getAttribute("data-on-change");if(onChangeAction){if(!self.executeAction(entry,node,onChangeAction,event))return self.update(self._current.element)}}self.applyChanges(entry,values,node),self.updateState(entry,node)}};domDelegate.bind(container,"input, textarea, [contenteditable]","input",debounce(handleChange,300)),domDelegate.bind(container,"input, textarea, select, [contenteditable]","change",handleChange),domDelegate.bind(container,"[data-action]","click",function(event){var inputNode=event.delegateTarget,entryNode=domClosest(inputNode,"[data-entry]"),actionId=domAttr(inputNode,"data-action"),entryId=domAttr(entryNode,"data-entry"),entry=self.getEntry(entryId);if(self.executeAction(entry,entryNode,actionId,event)){var values=getFormControlValues(entryNode);self.applyChanges(entry,values,entryNode)}self.updateState(entry,entryNode)}),domDelegate.bind(container,"[data-blur]","blur",handleInput,!0), +domDelegate.bind(container,".bpp-properties-tabs-links [data-tab-target]","click",function(event){event.preventDefault();var delegateTarget=event.delegateTarget,tabId=domAttr(delegateTarget,"data-tab-target");self.activateTab(tabId)})},PropertiesPanel.prototype.updateState=function(entry,entryNode){this.updateShow(entry,entryNode),this.updateDisable(entry,entryNode)},PropertiesPanel.prototype.updateShow=function(entry,node){var current=this._current;if(current){var showNodes=domQuery.all("[data-show]",node)||[];forEach(showNodes,function(showNode){var expr=domAttr(showNode,"data-show"),fn=get(entry,expr);if(fn){var scope=domClosest(showNode,"[data-scope]")||node,shouldShow=fn(current.element,node,showNode,scope)||!1,hasClass=domClasses(showNode).has(HIDE_CLASS);shouldShow?hasClass&&domClasses(showNode).remove(HIDE_CLASS):domClasses(showNode).add(HIDE_CLASS)}})}},PropertiesPanel.prototype.updateDisable=function(entry,node){var current=this._current;if(current){var nodes=domQuery.all("[data-disable]",node)||[];forEach(nodes,function(currentNode){var expr=domAttr(currentNode,"data-disable"),fn=get(entry,expr);if(fn){var scope=domClosest(currentNode,"[data-scope]")||node,shouldDisable=fn(current.element,node,currentNode,scope)||!1;domAttr(currentNode,"disabled",shouldDisable?"":null)}})}},PropertiesPanel.prototype.executeAction=function(entry,entryNode,actionId,event){var current=this._current;if(current){var fn=get(entry,actionId);if(fn){var scopeNode=domClosest(event.target,"[data-scope]")||entryNode;return fn.apply(entry,[current.element,entryNode,event,scopeNode])}}},PropertiesPanel.prototype.applyChanges=function(entry,values,containerElement){var element=this._current.element;if(!valuesEqual(values,entry.oldValues)){var commandToExecute,command=entry.set(element,values,containerElement);isArray(command)?command.length&&(commandToExecute={cmd:"properties-panel.multi-command-executor",context:flattenDeep(command)}):commandToExecute=command,commandToExecute?this._commandStack.execute(commandToExecute.cmd,commandToExecute.context||{element:element}):this.update(element)}},PropertiesPanel.prototype.applyValidationErrors=function(validationErrors,entryNode){var valid=!0,controlNodes=getFormControls(entryNode,!0);return forEach(controlNodes,function(controlNode){var name=domAttr(controlNode,"name")||domAttr(controlNode,"data-name"),error=validationErrors&&validationErrors[name],errorMessageNode=domQuery(".bpp-error-message",controlNode.parentNode);error?(valid=!1,errorMessageNode||(errorMessageNode=domify("
"),domClasses(errorMessageNode).add("bpp-error-message"),controlNode.parentNode.insertBefore(errorMessageNode,controlNode.nextSibling)),errorMessageNode.innerHTML=error,domClasses(controlNode).add("invalid")):(domClasses(controlNode).remove("invalid"),errorMessageNode&&controlNode.parentNode.removeChild(errorMessageNode))}),valid},PropertiesPanel.prototype.validate=function(entry,values,entryNode){var self=this,current=this._current,valid=!0;if(entryNode=entryNode||domQuery('[data-entry="'+entry.id+'"]',current.panel),values instanceof Array)for(var listContainer=domQuery("[data-list-entry-container]",entryNode),listEntryNodes=listContainer.children||[],i=0;i
'),headerNode=domify('
'),tabBarNode=domify('
'),tabLinksNode=domify(''),tabContainerNode=domify('
');return panelNode.appendChild(headerNode),forEach(tabs,function(tab,tabIndex){if(!tab.id)throw new Error("tab must have an id");var tabNode=domify('
'),tabLinkNode=domify('"),groups=tab.groups;forEach(groups,function(group){if(!group.id)throw new Error("group must have an id");var groupNode=domify('
'+group.label+"
");groupNode.querySelector(".group-toggle").addEventListener("click",function(evt){domClasses(groupNode).toggle("group-closed"),evt.preventDefault(),evt.stopPropagation()}),groupNode.addEventListener("click",function(evt){!evt.defaultPrevented&&domClasses(groupNode).has("group-closed")&&domClasses(groupNode).remove("group-closed")}),forEach(group.entries,function(entry){if(!entry.id)throw new Error("entry must have an id");var html=entry.html;"string"==typeof html&&(html=domify(html)),html.get&&(html=html.get(0));var entryNode=domify('
');forEach(entry.cssClasses||[],function(cssClass){domClasses(entryNode).add(cssClass)}),entryNode.appendChild(html),groupNode.appendChild(entryNode),self.updateState(entry,entryNode)}),tabNode.appendChild(groupNode)}),tabLinksNode.appendChild(tabLinkNode),tabContainerNode.appendChild(tabNode)}),tabBarNode.appendChild(tabLinksNode),panelNode.appendChild(tabBarNode),panelNode.appendChild(tabContainerNode),panelNode}},{"bpmn-js/lib/util/ModelUtil":157,"lodash/array/flattenDeep":354,"lodash/array/xor":360,"lodash/collection/filter":364,"lodash/collection/forEach":366,"lodash/collection/indexBy":369,"lodash/collection/map":370,"lodash/function/debounce":378,"lodash/lang/isArray":489,"lodash/lang/isEmpty":490,"lodash/object/get":501,"lodash/object/keys":503,"min-dom/lib/attr":514,"min-dom/lib/classes":515,"min-dom/lib/closest":517,"min-dom/lib/delegate":518,"min-dom/lib/domify":519,"min-dom/lib/matches":521,"min-dom/lib/query":522,"min-dom/lib/remove":523,"scroll-tabs":540,"selection-update":541}],28:[function(require,module,exports){"use strict";function selectedOption(selectBox){if(selectBox.selectedIndex>=0)return selectBox.options[selectBox.selectedIndex].value}function selectedType(elementSyntax,inputNode){return selectedOption(domQuery(elementSyntax,inputNode))}function getRoot(businessObject){for(var parent=businessObject;parent.$parent;)parent=parent.$parent;return parent}function filterElementsByType(objectList,type){var list=objectList||[],result=[];return forEach(list,function(obj){is(obj,type)&&result.push(obj)}),result}function findRootElementsByType(businessObject,referencedType){return filterElementsByType(getRoot(businessObject).rootElements,referencedType)}function removeAllChildren(domElement){for(;domElement.firstChild;)domElement.removeChild(domElement.firstChild)}function addEmptyParameter(list){return list.push({label:"",value:"",name:""})}function refreshOptionsModel(businessObject,referencedType){var model=[],referableObjects=findRootElementsByType(businessObject,referencedType);return forEach(referableObjects,function(obj){model.push({label:(obj.name||"")+" (id="+obj.id+")",value:obj.id,name:obj.name})}),model}function updateOptionsDropDown(domSelector,businessObject,referencedType,entryNode){var options=refreshOptionsModel(businessObject,referencedType);addEmptyParameter(options);var selectBox=domQuery(domSelector,entryNode);return domClear(selectBox),forEach(options,function(option){var optionEntry=domify('");selectBox.appendChild(optionEntry)}),options}function isIdValid(bo,idValue){var assigned=bo.$model.ids.assigned(idValue),idExists=assigned&&assigned!==bo;return!idValue||idExists?"Element must have an unique id.":validateId(idValue)}function validateId(idValue){return idValue=stripPlaceholders(idValue),containsSpace(idValue)?"Id must not contain spaces.":ID_REGEX.test(idValue)?void 0:QNAME_REGEX.test(idValue)?"Id must not contain prefix.":"Id must be a valid QName."}function containsSpace(value){return SPACE_REGEX.test(value)}function stripPlaceholders(idValue){return idValue.replace(PLACEHOLDER_REGEX,"$1")}function nextId(prefix){return new Ids([32,32,1]).nextPrefixed(prefix)}function triggerClickEvent(element){var evt;if(document.createEvent){try{evt=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0})}catch(e){evt=document.createEvent("MouseEvent"),evt.initEvent("click",!0,!0)}return element.dispatchEvent(evt)}return evt=document.createEventObject(),element.fireEvent("onclick",evt)}var domQuery=require("min-dom/lib/query"),domClear=require("min-dom/lib/clear"),is=require("bpmn-js/lib/util/ModelUtil").is,forEach=require("lodash/collection/forEach"),domify=require("min-dom/lib/domify"),Ids=require("ids"),SPACE_REGEX=/\s/,QNAME_REGEX=/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i,ID_REGEX=/^[a-z_][\w-.]*$/i,PLACEHOLDER_REGEX=/\$\{([^\}]*)\}/g;module.exports.selectedOption=selectedOption,module.exports.selectedType=selectedType,module.exports.getRoot=getRoot,module.exports.filterElementsByType=filterElementsByType,module.exports.findRootElementsByType=findRootElementsByType,module.exports.removeAllChildren=removeAllChildren,module.exports.addEmptyParameter=addEmptyParameter,module.exports.refreshOptionsModel=refreshOptionsModel,module.exports.updateOptionsDropDown=updateOptionsDropDown,module.exports.isIdValid=isIdValid,module.exports.validateId=validateId,module.exports.containsSpace=containsSpace,module.exports.nextId=nextId,module.exports.triggerClickEvent=triggerClickEvent},{"bpmn-js/lib/util/ModelUtil":157,ids:350,"lodash/collection/forEach":366,"min-dom/lib/clear":516,"min-dom/lib/domify":519,"min-dom/lib/query":522}],29:[function(require,module,exports){"use strict";function CreateAndReferenceElementHandler(elementRegistry,bpmnFactory){this._elementRegistry=elementRegistry,this._bpmnFactory=bpmnFactory}function ensureNotNull(prop,name){if(!prop)throw new Error(name+" required");return prop}var elementHelper=require("../helper/ElementHelper");CreateAndReferenceElementHandler.$inject=["elementRegistry","bpmnFactory"],module.exports=CreateAndReferenceElementHandler,CreateAndReferenceElementHandler.prototype.execute=function(context){var referencingObject=ensureNotNull(context.referencingObject,"referencingObject"),referenceProperty=ensureNotNull(context.referenceProperty,"referenceProperty"),newObject=ensureNotNull(context.newObject,"newObject"),newObjectContainer=ensureNotNull(context.newObjectContainer,"newObjectContainer"),newObjectParent=ensureNotNull(context.newObjectParent,"newObjectParent"),changed=[context.element],referencedObject=elementHelper.createElement(newObject.type,newObject.properties,newObjectParent,this._bpmnFactory);return context.referencedObject=referencedObject,newObjectContainer.push(referencedObject),context.previousReference=referencingObject[referenceProperty],referencingObject[referenceProperty]=referencedObject,context.changed=changed,changed},CreateAndReferenceElementHandler.prototype.revert=function(context){var referencingObject=context.referencingObject,referenceProperty=context.referenceProperty,previousReference=context.previousReference,referencedObject=context.referencedObject,newObjectContainer=context.newObjectContainer;return referencingObject.set(referenceProperty,previousReference),newObjectContainer.splice(newObjectContainer.indexOf(referencedObject),1),context.changed}},{"../helper/ElementHelper":47}],30:[function(require,module,exports){"use strict";function CreateBusinessObjectListHandler(elementRegistry,bpmnFactory){this._elementRegistry=elementRegistry,this._bpmnFactory=bpmnFactory}function ensureNotNull(prop,name){if(!prop)throw new Error(name+" required");return prop}function ensureList(prop,name){if(!prop||"[object Array]"!==Object.prototype.toString.call(prop))throw new Error(name+" needs to be a list");return prop}var forEach=require("lodash/collection/forEach"),elementHelper=require("../helper/ElementHelper");CreateBusinessObjectListHandler.$inject=["elementRegistry","bpmnFactory"],module.exports=CreateBusinessObjectListHandler,CreateBusinessObjectListHandler.prototype.execute=function(context){var currentObject=ensureNotNull(context.currentObject,"currentObject"),propertyName=ensureNotNull(context.propertyName,"propertyName"),newObjects=ensureList(context.newObjects,"newObjects"),changed=[context.element],childObjects=[],self=this;return forEach(newObjects,function(obj){var element=elementHelper.createElement(obj.type,obj.properties,currentObject,self._bpmnFactory);childObjects.push(element)}),context.childObject=childObjects,context.previousChilds=currentObject[propertyName],currentObject[propertyName]=childObjects,context.changed=changed,changed},CreateBusinessObjectListHandler.prototype.revert=function(context){var currentObject=context.currentObject,propertyName=context.propertyName,previousChilds=context.previousChilds;return currentObject.set(propertyName,previousChilds),context.changed}},{"../helper/ElementHelper":47,"lodash/collection/forEach":366}],31:[function(require,module,exports){"use strict";function MultiCommandHandler(commandStack){this._commandStack=commandStack}var forEach=require("lodash/collection/forEach");MultiCommandHandler.$inject=["commandStack"],module.exports=MultiCommandHandler,MultiCommandHandler.prototype.preExecute=function(context){var commandStack=this._commandStack;forEach(context,function(command){commandStack.execute(command.cmd,command.context)})}},{"lodash/collection/forEach":366}],32:[function(require,module,exports){"use strict";function UpdateBusinessObjectHandler(elementRegistry){this._elementRegistry=elementRegistry}function getRoot(businessObject){for(var parent=businessObject;parent.$parent;)parent=parent.$parent;return parent}function getProperties(businessObject,propertyNames){return reduce(propertyNames,function(result,key){return result[key]=businessObject.get(key),result},{})}function setProperties(businessObject,properties){forEach(properties,function(value,key){businessObject.set(key,value)})}var reduce=require("lodash/object/transform"),is=require("bpmn-js/lib/util/ModelUtil").is,keys=require("lodash/object/keys"),forEach=require("lodash/collection/forEach");UpdateBusinessObjectHandler.$inject=["elementRegistry"],module.exports=UpdateBusinessObjectHandler,UpdateBusinessObjectHandler.prototype.execute=function(context){var element=context.element,businessObject=context.businessObject,rootElements=getRoot(businessObject).rootElements,referenceType=context.referenceType,referenceProperty=context.referenceProperty,changed=[element];if(!element)throw new Error("element required");if(!businessObject)throw new Error("businessObject required");var properties=context.properties,oldProperties=context.oldProperties||getProperties(businessObject,keys(properties));return void 0!==referenceType&&void 0!==referenceProperty&&forEach(rootElements,function(rootElement){is(rootElement,referenceType)&&rootElement.id===properties[referenceProperty]&&(properties[referenceProperty]=rootElement)}),setProperties(businessObject,properties),context.oldProperties=oldProperties,context.changed=changed,changed},UpdateBusinessObjectHandler.prototype.revert=function(context){var oldProperties=context.oldProperties;return setProperties(context.businessObject,oldProperties),context.changed}},{"bpmn-js/lib/util/ModelUtil":157,"lodash/collection/forEach":366,"lodash/object/keys":503,"lodash/object/transform":509}],33:[function(require,module,exports){"use strict";function UpdateBusinessObjectListHandler(elementRegistry,bpmnFactory){this._elementRegistry=elementRegistry,this._bpmnFactory=bpmnFactory}function ensureNotNull(prop,name){if(!prop)throw new Error(name+"required");return prop}var forEach=require("lodash/collection/forEach");UpdateBusinessObjectListHandler.$inject=["elementRegistry","bpmnFactory"],module.exports=UpdateBusinessObjectListHandler,UpdateBusinessObjectListHandler.prototype.execute=function(context){var referencePropertyName,currentObject=ensureNotNull(context.currentObject,"currentObject"),propertyName=ensureNotNull(context.propertyName,"propertyName"),updatedObjectList=context.updatedObjectList,objectsToRemove=context.objectsToRemove||[],objectsToAdd=context.objectsToAdd||[],changed=[context.element];context.referencePropertyName&&(referencePropertyName=context.referencePropertyName);var objectList=currentObject[propertyName];if(context.previousList=currentObject[propertyName],updatedObjectList)currentObject[propertyName]=updatedObjectList;else{var listCopy=[];if(forEach(objectList,function(object){-1==objectsToRemove.indexOf(object)&&listCopy.push(object)}),listCopy=listCopy.concat(objectsToAdd),listCopy.length>0||!referencePropertyName)currentObject[propertyName]=listCopy;else if(referencePropertyName){var parentObject=currentObject.$parent;parentObject.set(referencePropertyName,void 0)}}return context.changed=changed,changed},UpdateBusinessObjectListHandler.prototype.revert=function(context){var currentObject=context.currentObject,propertyName=context.propertyName,previousList=context.previousList,parentObject=currentObject.$parent;return context.referencePropertyName&&parentObject.set(context.referencePropertyName,currentObject),currentObject.set(propertyName,previousList),context.changed}},{"lodash/collection/forEach":366}],34:[function(require,module,exports){"use strict";function CommandInitializer(eventBus,commandStack){eventBus.on("diagram.init",function(){forEach(HANDLERS,function(handler,id){commandStack.registerHandler(id,handler)})})}var forEach=require("lodash/collection/forEach"),HANDLERS={"properties-panel.update-businessobject":require("./UpdateBusinessObjectHandler"),"properties-panel.create-and-reference":require("./CreateAndReferenceHandler"),"properties-panel.create-businessobject-list":require("./CreateBusinessObjectListHandler"),"properties-panel.update-businessobject-list":require("./UpdateBusinessObjectListHandler"),"properties-panel.multi-command-executor":require("./MultiCommandHandler")};CommandInitializer.$inject=["eventBus","commandStack"],module.exports={__init__:[CommandInitializer]}},{"./CreateAndReferenceHandler":29,"./CreateBusinessObjectListHandler":30,"./MultiCommandHandler":31,"./UpdateBusinessObjectHandler":32,"./UpdateBusinessObjectListHandler":33,"lodash/collection/forEach":366}],35:[function(require,module,exports){"use strict";var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,cmdHelper=require("../helper/CmdHelper"),entryFieldDescription=require("./EntryFieldDescription"),checkbox=function(options,defaultParameters){var resource=defaultParameters,label=options.label||resource.id,canBeDisabled=!!options.disabled&&"function"==typeof options.disabled,description=options.description;return resource.html='",description&&(resource.html+=entryFieldDescription(description)),resource.get=function(element){var bo=getBusinessObject(element),res={};return res[options.modelProperty]=bo.get(options.modelProperty),res},resource.set=function(element,values){var res={};return res[options.modelProperty]=!!values[options.modelProperty],cmdHelper.updateProperties(element,res)},"function"==typeof options.set&&(resource.set=options.set),"function"==typeof options.get&&(resource.get=options.get),canBeDisabled&&(resource.isDisabled=function(){return!options.disabled.apply(resource,arguments)}),resource.cssClasses=["bpp-checkbox"],resource};module.exports=checkbox},{"../helper/CmdHelper":46,"./EntryFieldDescription":38,"bpmn-js/lib/util/ModelUtil":157}],36:[function(require,module,exports){"use strict";var assign=require("lodash/object/assign"),find=require("lodash/collection/find"),domQuery=require("min-dom/lib/query"),selectEntryFactory=require("./SelectEntryFactory"),entryFieldDescription=require("./EntryFieldDescription"),comboBox=function(options){var selectOptions=options.selectOptions,modelProperty=options.modelProperty,customValue=options.customValue||"custom",customName=options.customName||"custom "+modelProperty,description=options.description,isCustomValue=function(value){return void 0!==value[modelProperty]&&!find(selectOptions,function(option){return value[modelProperty]===option.value})},comboOptions=assign({},options);comboOptions.showCustomInput=function(element,node){var selectBox=domQuery('[data-entry="'+options.id+'"] select',node.parentNode);return!!selectBox&&selectBox.value===customValue},comboOptions.get=function(element,node){var value=options.get(element,node),modifiedValues={};return isCustomValue(value)?(modifiedValues[modelProperty]=customValue,modifiedValues["custom-"+modelProperty]=value[modelProperty],modifiedValues):(modifiedValues[modelProperty]=value[modelProperty]||"",modifiedValues)},comboOptions.set=function(element,values,node){var modifiedValues={};return values[modelProperty]===customValue?modifiedValues[modelProperty]=values["custom-"+modelProperty]||"":options.emptyParameter&&""===values[modelProperty]?modifiedValues[modelProperty]=void 0:modifiedValues[modelProperty]=values[modelProperty],options.set(element,modifiedValues,node)},comboOptions.selectOptions.push({name:customName,value:customValue});var comboBoxEntry=assign({},selectEntryFactory(comboOptions,comboOptions));return comboBoxEntry.html+='
',description&&(comboBoxEntry.html+=entryFieldDescription(description)),comboBoxEntry};module.exports=comboBox},{"./EntryFieldDescription":38,"./SelectEntryFactory":41,"lodash/collection/find":365,"lodash/object/assign":499,"min-dom/lib/query":522}],37:[function(require,module,exports){"use strict";function ensureNotNull(prop){if(!prop)throw new Error(prop+" must be set.");return prop}function EntryFactory(){}var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,textInputField=require("./TextInputEntryFactory"),checkboxField=require("./CheckboxEntryFactory"),selectBoxField=require("./SelectEntryFactory"),comboBoxField=require("./ComboEntryFactory"),textBoxField=require("./TextBoxEntryFactory"),validationAwareTextInputField=require("./ValidationAwareTextInput"),tableField=require("./TableEntryFactory"),labelEntry=require("./LabelFactory"),link=require("./LinkEntryFactory"),cmdHelper=require("../helper/CmdHelper"),setDefaultParameters=function(options){var defaultGet=function(element){var bo=getBusinessObject(element),res={},prop=ensureNotNull(options.modelProperty);return res[prop]=bo.get(prop),res},defaultSet=function(element,values){var res={},prop=ensureNotNull(options.modelProperty);return""!==values[prop]?res[prop]=values[prop]:res[prop]=void 0,cmdHelper.updateProperties(element,res)},defaultValidate=function(){return{}};return{id:options.id,description:options.description||"",get:options.get||defaultGet,set:options.set||defaultSet,validate:options.validate||defaultValidate,html:""}};EntryFactory.textField=function(options){return textInputField(options,setDefaultParameters(options))},EntryFactory.validationAwareTextField=function(options){return validationAwareTextInputField(options,setDefaultParameters(options))},EntryFactory.checkbox=function(options){return checkboxField(options,setDefaultParameters(options))},EntryFactory.textBox=function(options){return textBoxField(options,setDefaultParameters(options))},EntryFactory.selectBox=function(options){return selectBoxField(options,setDefaultParameters(options))},EntryFactory.comboBox=function(options){return comboBoxField(options)},EntryFactory.table=function(options){return tableField(options)},EntryFactory.label=function(options){return labelEntry(options)},EntryFactory.link=function(options){return link(options)},module.exports=EntryFactory},{"../helper/CmdHelper":46,"./CheckboxEntryFactory":35,"./ComboEntryFactory":36,"./LabelFactory":39,"./LinkEntryFactory":40,"./SelectEntryFactory":41,"./TableEntryFactory":42,"./TextBoxEntryFactory":43,"./TextInputEntryFactory":44,"./ValidationAwareTextInput":45,"bpmn-js/lib/util/ModelUtil":157}],38:[function(require,module,exports){"use strict";function linkify(text){return text.replace(MARKDOWN_LINK_REGEX,'$1')}var MARKDOWN_LINK_REGEX=/\[([^\)]+)\]\(([^\]]+)\)/g;module.exports=function(description){return'
'+(description=linkify(description))+"
"}},{}],39:[function(require,module,exports){"use strict";var label=function(options){return{id:options.id,html:'',get:function(element,node){return"function"==typeof options.get?options.get(element,node):{label:options.labelText}},showLabel:function(element,node){return"function"!=typeof options.showLabel||options.showLabel(element,node)}}};module.exports=label},{}],40:[function(require,module,exports){"use strict";var utils=require("../Utils"),entryFieldDescription=require("./EntryFieldDescription"),link=function(options,defaultParameters){var id=options.id,label=options.label||id,hideLink=options.hideLink,canBeHidden="function"==typeof hideLink,getClickableElement=options.getClickableElement,description=options.description,resource={id:id};return resource.html=''+label+"",description&&(resource.html+=entryFieldDescription(description)),resource.linkSelected=function(element,node,event,scopeNode){if("function"==typeof getClickableElement){var link=getClickableElement.apply(resource,[element,node,event,scopeNode]);link&&utils.triggerClickEvent(link)}return!1},canBeHidden&&(resource.hideLink=function(){return!hideLink.apply(resource,arguments)}),resource};module.exports=link},{"../Utils":28,"./EntryFieldDescription":38}],41:[function(require,module,exports){"use strict";var domify=require("min-dom/lib/domify"),forEach=require("lodash/collection/forEach"),entryFieldDescription=require("./EntryFieldDescription"),isList=function(list){return!(!list||"[object Array]"!==Object.prototype.toString.call(list))},addEmptyParameter=function(list){return list.concat([{name:"",value:""}])},createOption=function(option){return'"},selectbox=function(options,defaultParameters){var resource=defaultParameters,label=options.label||resource.id,selectOptions=options.selectOptions||[{name:"",value:""}],modelProperty=options.modelProperty,emptyParameter=options.emptyParameter,canBeDisabled=!!options.disabled&&"function"==typeof options.disabled,description=options.description;return emptyParameter&&(selectOptions=addEmptyParameter(selectOptions)), +resource.html='",description&&"function"===(options.showCustomInput,!1)&&(resource.html+=entryFieldDescription(description)),resource.setControlValue=function(element,entryNode,inputNode,inputName,newValue){if("function"==typeof selectOptions){var options=selectOptions(element,inputNode);if(options){for(;inputNode.firstChild;)inputNode.removeChild(inputNode.firstChild);forEach(options,function(option){var template=domify(createOption(option));inputNode.appendChild(template)})}}void 0!==newValue&&(inputNode.value=newValue)},canBeDisabled&&(resource.isDisabled=function(){return!options.disabled.apply(resource,arguments)}),resource.cssClasses=["dropdown"],resource};module.exports=selectbox},{"./EntryFieldDescription":38,"lodash/collection/forEach":366,"min-dom/lib/domify":519}],42:[function(require,module,exports){"use strict";function createInputRowTemplate(properties,canRemove){var template=TABLE_ROW_DIV_SNIPPET;return template+=createInputTemplate(properties,canRemove),template+=canRemove?DELETE_ROW_BUTTON_SNIPPET:"",template+="
"}function createInputTemplate(properties,canRemove){var columns=properties.length,template="";return forEach(properties,function(prop){template+=''}),template}function createLabelRowTemplate(labels){var template=TABLE_ROW_DIV_SNIPPET;return template+=createLabelTemplate(labels),template+="
"}function createLabelTemplate(labels){var columns=labels.length,template="";return forEach(labels,function(label){template+='"}),template}function pick(elements,properties){return(elements||[]).map(function(elem){var newElement={};return forEach(properties,function(prop){newElement[prop]=elem[prop]||""}),newElement})}function diff(element,node,values,oldValues,editable){return filter(values,function(value,idx){return!valueEqual(element,node,value,oldValues[idx],editable,idx)})}function valueEqual(element,node,value,oldValue,editable,idx){return!(value&&!oldValue)&&keys(value).concat(keys(oldValue)).every(function(key){var n=value[key]||void 0,o=oldValue[key]||void 0;return!editable(element,node,key,idx)||n===o})}function getEntryNode(node){return domClosest(node,"[data-entry]",!0)}function getContainer(node){return domQuery("div[data-list-entry-container]",node)}function getSelection(node){return{start:node.selectionStart,end:node.selectionEnd}}function setSelection(node,selection){node.selectionStart=selection.start,node.selectionEnd=selection.end}var cmdHelper=require("../helper/CmdHelper"),domQuery=require("min-dom/lib/query"),domAttr=require("min-dom/lib/attr"),domClosest=require("min-dom/lib/closest"),filter=require("lodash/collection/filter"),forEach=require("lodash/collection/forEach"),keys=require("lodash/object/keys"),domify=require("min-dom/lib/domify"),entryFieldDescription=require("./EntryFieldDescription"),updateSelection=require("selection-update"),TABLE_ROW_DIV_SNIPPET='
',DELETE_ROW_BUTTON_SNIPPET='';module.exports=function(options){var id=options.id,modelProperties=options.modelProperties,labels=options.labels,description=options.description,labelRow=createLabelRowTemplate(labels),getElements=options.getElements,removeElement=options.removeElement,canRemove="function"==typeof removeElement,addElement=options.addElement,canAdd="function"==typeof addElement,addLabel=options.addLabel||"Add Value",updateElement=options.updateElement,canUpdate="function"==typeof updateElement,editable=options.editable||function(){return!0},setControlValue=options.setControlValue,show=options.show,canBeShown="function"==typeof show,elements=function(element,node){return pick(getElements(element,node),modelProperties)},factory={id:id,html:(canAdd?'
':"")+'
'+labelRow+"
"+(description?entryFieldDescription(description):""),get:function(element,node){var boElements=elements(element,node,this.__invalidValues),invalidValues=this.__invalidValues;return delete this.__invalidValues,forEach(invalidValues,function(value,idx){var element=boElements[idx];forEach(modelProperties,function(prop){element[prop]=value[prop]})}),boElements},set:function(element,values,node){var action=this.__action||{};if(delete this.__action,"delete-element"===action.id)return removeElement(element,node,action.idx);if("add-element"===action.id)return addElement(element,node);if(canUpdate){var commands=[],valuesToValidate=values;"function"!=typeof options.validate&&(valuesToValidate=diff(element,node,values,elements(element,node),editable));var self=this;return forEach(valuesToValidate,function(value){var validationError,idx=values.indexOf(value);if("function"==typeof options.validate&&(validationError=options.validate(element,value,node,idx)),validationError)self.__invalidValues=self.__invalidValues||{},self.__invalidValues[idx]=value,commands.push(cmdHelper.updateProperties(element,{}));else{var cmd=updateElement(element,value,node,idx);cmd&&commands.push(cmd)}}),commands}},createListEntryTemplate:function(value,index,selectBox){return createInputRowTemplate(modelProperties,canRemove)},addElement:function(element,node,event,scopeNode){var template=domify(createInputRowTemplate(modelProperties,canRemove));return getContainer(node).appendChild(template),this.__action={id:"add-element"},!0},deleteElement:function(element,node,event,scopeNode){var container=getContainer(node),rowToDelete=event.delegateTarget.parentNode,idx=parseInt(domAttr(rowToDelete,"data-index"),10);return container.removeChild(rowToDelete),this.__action={id:"delete-element",idx:idx},!0},editable:function(element,rowNode,input,prop,value,idx){var entryNode=domClosest(rowNode,"[data-entry]");return editable(element,entryNode,prop,idx)},show:function(element,entryNode,node,scopeNode){return entryNode=getEntryNode(entryNode),show(element,entryNode,node,scopeNode)},showTable:function(element,entryNode,node,scopeNode){entryNode=getEntryNode(entryNode);var elems=elements(element,entryNode);return elems&&elems.length&&(!canBeShown||show(element,entryNode,node,scopeNode))},validateListItem:function(element,value,node,idx){if("function"==typeof options.validate)return options.validate(element,value,node,idx)}};return setControlValue&&(factory.setControlValue=function(element,rowNode,input,prop,value,idx){var selection,entryNode=getEntryNode(rowNode),isReadOnly=domAttr(input,"readonly"),oldValue=input.value;void 0===value&&(value=""),isReadOnly&&oldValue===value||(document.activeElement===input&&(selection=updateSelection(getSelection(input),oldValue,value)),setControlValue(element,entryNode,input,prop,value,idx),selection&&setSelection(input,selection))}),factory}},{"../helper/CmdHelper":46,"./EntryFieldDescription":38,"lodash/collection/filter":364,"lodash/collection/forEach":366,"lodash/object/keys":503,"min-dom/lib/attr":514,"min-dom/lib/closest":517,"min-dom/lib/domify":519,"min-dom/lib/query":522,"selection-update":541}],43:[function(require,module,exports){"use strict";var entryFieldDescription=require("./EntryFieldDescription"),textBox=function(options,defaultParameters){var resource=defaultParameters,label=options.label||resource.id,canBeShown=!!options.show&&"function"==typeof options.show,description=options.description;return resource.html='
',description&&(resource.html+=entryFieldDescription(description)),canBeShown&&(resource.isShown=function(){return options.show.apply(resource,arguments)}),resource.cssClasses=["bpp-textbox"],resource};module.exports=textBox},{"./EntryFieldDescription":38}],44:[function(require,module,exports){"use strict";var domQuery=require("min-dom/lib/query"),entryFieldDescription=require("./EntryFieldDescription"),textField=function(options,defaultParameters){var defaultButtonAction=function(element,inputNode){return domQuery('input[name="'+options.modelProperty+'"]',inputNode).value="",!0},defaultButtonShow=function(element,inputNode){return""!==domQuery('input[name="'+options.modelProperty+'"]',inputNode).value},resource=defaultParameters,label=options.label||resource.id,dataValueLabel=options.dataValueLabel,buttonLabel=options.buttonLabel||"X",actionName=void 0!==options.buttonAction?options.buttonAction.name:"clear",actionMethod=void 0!==options.buttonAction?options.buttonAction.method:defaultButtonAction,showName=void 0!==options.buttonShow?options.buttonShow.name:"canClear",showMethod=void 0!==options.buttonShow?options.buttonShow.method:defaultButtonShow,canBeDisabled=!!options.disabled&&"function"==typeof options.disabled,description=options.description;return resource.html='
",description&&(resource.html+=entryFieldDescription(description)),resource[actionName]=actionMethod,resource[showName]=showMethod,canBeDisabled&&(resource.isDisabled=function(){return!options.disabled.apply(resource,arguments)}),resource.cssClasses=["bpp-textfield"],resource};module.exports=textField},{"./EntryFieldDescription":38,"min-dom/lib/query":522}],45:[function(require,module,exports){"use strict";var textField=require("./TextInputEntryFactory"),validationAwareTextField=function(options,defaultParameters){var modelProperty=options.modelProperty;defaultParameters.get=function(element,node){var value=this.__lastInvalidValue;delete this.__lastInvalidValue;var properties={};return properties[modelProperty]=void 0!==value?value:options.getProperty(element,node),properties},defaultParameters.set=function(element,values,node){var validationErrors=validate.apply(this,[element,values,node]),propertyValue=values[modelProperty];if(validationErrors&&validationErrors[modelProperty])return this.__lastInvalidValue=propertyValue,options.setProperty(element,{},node);var properties={};return properties[modelProperty]=propertyValue,options.setProperty(element,properties,node)};var validate=defaultParameters.validate=function(element,values,node){var value=values[modelProperty]||this.__lastInvalidValue,property={};return property[modelProperty]=value,options.validate(element,property,node)};return textField(options,defaultParameters)};module.exports=validationAwareTextField},{"./TextInputEntryFactory":44}],46:[function(require,module,exports){"use strict";var CmdHelper={};module.exports=CmdHelper,CmdHelper.updateProperties=function(element,properties){return{cmd:"element.updateProperties",context:{element:element,properties:properties}}},CmdHelper.updateBusinessObject=function(element,businessObject,newProperties){return{cmd:"properties-panel.update-businessobject",context:{element:element,businessObject:businessObject,properties:newProperties}}},CmdHelper.addElementsTolist=function(element,businessObject,listPropertyName,objectsToAdd){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject,propertyName:listPropertyName,objectsToAdd:objectsToAdd}}},CmdHelper.removeElementsFromList=function(element,businessObject,listPropertyName,referencePropertyName,objectsToRemove){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject,propertyName:listPropertyName,referencePropertyName:referencePropertyName,objectsToRemove:objectsToRemove}}},CmdHelper.addAndRemoveElementsFromList=function(element,businessObject,listPropertyName,referencePropertyName,objectsToAdd,objectsToRemove){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject,propertyName:listPropertyName,referencePropertyName:referencePropertyName,objectsToAdd:objectsToAdd,objectsToRemove:objectsToRemove}}},CmdHelper.setList=function(element,businessObject,listPropertyName,updatedObjectList){return{cmd:"properties-panel.update-businessobject-list",context:{element:element,currentObject:businessObject,propertyName:listPropertyName,updatedObjectList:updatedObjectList}}}},{}],47:[function(require,module,exports){"use strict";var ElementHelper={};module.exports=ElementHelper,ElementHelper.createElement=function(elementType,properties,parent,factory){var element=factory.create(elementType,properties);return element.$parent=parent,element}},{}],48:[function(require,module,exports){"use strict";var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,is=require("bpmn-js/lib/util/ModelUtil").is,forEach=require("lodash/collection/forEach"),EventDefinitionHelper={};module.exports=EventDefinitionHelper,EventDefinitionHelper.getEventDefinition=function(element,eventType){var bo=getBusinessObject(element),eventDefinition=null;return bo.eventDefinitions&&forEach(bo.eventDefinitions,function(event){is(event,eventType)&&(eventDefinition=event)}),eventDefinition},EventDefinitionHelper.getTimerEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:TimerEventDefinition")},EventDefinitionHelper.getMessageEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:MessageEventDefinition")},EventDefinitionHelper.getSignalEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:SignalEventDefinition")},EventDefinitionHelper.getErrorEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:ErrorEventDefinition")},EventDefinitionHelper.getEscalationEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:EscalationEventDefinition")},EventDefinitionHelper.getCompensateEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:CompensateEventDefinition")},EventDefinitionHelper.getLinkEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:LinkEventDefinition")},EventDefinitionHelper.getConditionalEventDefinition=function(element){return this.getEventDefinition(element,"bpmn:ConditionalEventDefinition")}},{"bpmn-js/lib/util/ModelUtil":157,"lodash/collection/forEach":366}],49:[function(require,module,exports){"use strict";var cmdHelper=require("./CmdHelper"),elementHelper=require("./ElementHelper"),is=require("bpmn-js/lib/util/ModelUtil").is,ExtensionElementsHelper={},getExtensionElements=function(bo){return bo.get("extensionElements")};ExtensionElementsHelper.getExtensionElements=function(bo,type){var extensionElements=getExtensionElements(bo);if(void 0!==extensionElements){var extensionValues=extensionElements.get("values");if(void 0!==extensionValues){var elements=extensionValues.filter(function(value){return is(value,type)});if(elements.length)return elements}}},ExtensionElementsHelper.addEntry=function(bo,element,entry,bpmnFactory){var extensionElements=bo.get("extensionElements");return extensionElements?cmdHelper.addElementsTolist(element,extensionElements,"values",[entry]):(extensionElements=elementHelper.createElement("bpmn:ExtensionElements",{values:[entry]},bo,bpmnFactory),{extensionElements:extensionElements})},ExtensionElementsHelper.removeEntry=function(bo,element,entry){var extensionElements=bo.get("extensionElements");return extensionElements?cmdHelper.removeElementsFromList(element,extensionElements,"values","extensionElements",[entry]):{}},module.exports=ExtensionElementsHelper},{"./CmdHelper":46,"./ElementHelper":47,"bpmn-js/lib/util/ModelUtil":157}],50:[function(require,module,exports){module.exports={__depends__:[require("./cmd")],__init__:["propertiesPanel"],propertiesPanel:["type",require("./PropertiesPanel")]}},{"./PropertiesPanel":27,"./cmd":34}],51:[function(require,module,exports){"use strict";var entryFactory=require("../../../factory/EntryFactory"),cmdHelper=require("../../../helper/CmdHelper"),ModelUtil=require("bpmn-js/lib/util/ModelUtil"),is=ModelUtil.is,getBusinessObject=ModelUtil.getBusinessObject;module.exports=function(group,element,bpmnFactory){var getValue=function(businessObject){return function(element){var documentations=businessObject&&businessObject.get("documentation");return{documentation:documentations&&documentations.length>0?documentations[0].text:""}}},setValue=function(businessObject){return function(element,values){var newObjectList=[];return void 0!==values.documentation&&""!==values.documentation&&newObjectList.push(bpmnFactory.create("bpmn:Documentation",{text:values.documentation})),cmdHelper.setList(element,businessObject,"documentation",newObjectList)}},elementDocuEntry=entryFactory.textBox({id:"documentation",label:"Element Documentation",modelProperty:"documentation"});elementDocuEntry.set=setValue(getBusinessObject(element)),elementDocuEntry.get=getValue(getBusinessObject(element)),group.entries.push(elementDocuEntry);var processRef;if(is(element,"bpmn:Participant")&&(processRef=getBusinessObject(element).processRef)){var processDocuEntry=entryFactory.textBox({id:"process-documentation",label:"Process Documentation",modelProperty:"documentation"});processDocuEntry.set=setValue(processRef),processDocuEntry.get=getValue(processRef),group.entries.push(processDocuEntry)}}},{"../../../factory/EntryFactory":37,"../../../helper/CmdHelper":46,"bpmn-js/lib/util/ModelUtil":157}],52:[function(require,module,exports){"use strict";var is=require("bpmn-js/lib/util/ModelUtil").is,isAny=require("bpmn-js/lib/features/modeling/util/ModelingUtil").isAny,isEventSubProcess=require("bpmn-js/lib/util/DiUtil").isEventSubProcess,getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,eventDefinitionHelper=require("../../../helper/EventDefinitionHelper"),forEach=require("lodash/collection/forEach"),message=require("./implementation/MessageEventDefinition"),signal=require("./implementation/SignalEventDefinition"),error=require("./implementation/ErrorEventDefinition"),escalation=require("./implementation/EscalationEventDefinition"),timer=require("./implementation/TimerEventDefinition"),compensation=require("./implementation/CompensateEventDefinition"),condition=require("./implementation/ConditionalEventDefinition");module.exports=function(group,element,bpmnFactory,elementRegistry){if(forEach(["bpmn:StartEvent","bpmn:EndEvent","bpmn:IntermediateThrowEvent","bpmn:BoundaryEvent","bpmn:IntermediateCatchEvent"],function(event){if(is(element,event)){var messageEventDefinition=eventDefinitionHelper.getMessageEventDefinition(element),signalEventDefinition=eventDefinitionHelper.getSignalEventDefinition(element);messageEventDefinition&&message(group,element,bpmnFactory,messageEventDefinition),signalEventDefinition&&signal(group,element,bpmnFactory,signalEventDefinition)}}),is(element,"bpmn:ReceiveTask")&&message(group,element,bpmnFactory,getBusinessObject(element)),forEach(["bpmn:StartEvent","bpmn:BoundaryEvent","bpmn:EndEvent"],function(event){if(is(element,event)){var errorEventDefinition=eventDefinitionHelper.getErrorEventDefinition(element);if(errorEventDefinition){var isCatchingErrorEvent=is(element,"bpmn:StartEvent")||is(element,"bpmn:BoundaryEvent");error(group,element,bpmnFactory,errorEventDefinition,isCatchingErrorEvent,isCatchingErrorEvent)}}}),forEach(["bpmn:StartEvent","bpmn:BoundaryEvent","bpmn:IntermediateThrowEvent","bpmn:EndEvent"],function(event){if(is(element,event)){var showEscalationCodeVariable=is(element,"bpmn:StartEvent")||is(element,"bpmn:BoundaryEvent"),escalationEventDefinition=eventDefinitionHelper.getEscalationEventDefinition(element);escalationEventDefinition&&escalation(group,element,bpmnFactory,escalationEventDefinition,showEscalationCodeVariable)}}),forEach(["bpmn:StartEvent","bpmn:BoundaryEvent","bpmn:IntermediateCatchEvent"],function(event){if(is(element,event)){var timerEventDefinition=eventDefinitionHelper.getTimerEventDefinition(element);timerEventDefinition&&timer(group,element,bpmnFactory,timerEventDefinition)}}),forEach(["bpmn:EndEvent","bpmn:IntermediateThrowEvent"],function(event){if(is(element,event)){var compensateEventDefinition=eventDefinitionHelper.getCompensateEventDefinition(element);compensateEventDefinition&&compensation(group,element,bpmnFactory,compensateEventDefinition,elementRegistry)}}),isAny(element,["bpmn:BoundaryEvent","bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])||is(element,"bpmn:StartEvent")&&isEventSubProcess(element.parent)){var conditionalEventDefinition=eventDefinitionHelper.getConditionalEventDefinition(element);conditionalEventDefinition&&condition(group,element,bpmnFactory,conditionalEventDefinition,elementRegistry)}}},{"../../../helper/EventDefinitionHelper":48,"./implementation/CompensateEventDefinition":54,"./implementation/ConditionalEventDefinition":55,"./implementation/ErrorEventDefinition":57,"./implementation/EscalationEventDefinition":58,"./implementation/MessageEventDefinition":60,"./implementation/SignalEventDefinition":61,"./implementation/TimerEventDefinition":62,"bpmn-js/lib/features/modeling/util/ModelingUtil":130,"bpmn-js/lib/util/DiUtil":155,"bpmn-js/lib/util/ModelUtil":157,"lodash/collection/forEach":366}],53:[function(require,module,exports){"use strict";function getLinkEventDefinition(element){var bo=getBusinessObject(element),linkEventDefinition=null;return bo.eventDefinitions&&forEach(bo.eventDefinitions,function(eventDefinition){is(eventDefinition,"bpmn:LinkEventDefinition")&&(linkEventDefinition=eventDefinition)}),linkEventDefinition}var is=require("bpmn-js/lib/util/ModelUtil").is,getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,entryFactory=require("../../../factory/EntryFactory"),cmdHelper=require("../../../helper/CmdHelper"),forEach=require("lodash/collection/forEach");module.exports=function(group,element){forEach(["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"],function(event){if(is(element,event)){var linkEventDefinition=getLinkEventDefinition(element);if(linkEventDefinition){var entry=entryFactory.textField({id:"link-event",label:"Link Name",modelProperty:"link-name"});entry.get=function(){return{"link-name":linkEventDefinition.get("name")}},entry.set=function(element,values){var newProperties={name:values["link-name"]};return cmdHelper.updateBusinessObject(element,linkEventDefinition,newProperties)},group.entries.push(entry)}}})}},{"../../../factory/EntryFactory":37,"../../../helper/CmdHelper":46,"bpmn-js/lib/util/ModelUtil":157,"lodash/collection/forEach":366}],54:[function(require,module,exports){"use strict";function getContainedActivities(element){return getFlowElements(element,"bpmn:Activity")}function getContainedBoundaryEvents(element){return getFlowElements(element,"bpmn:BoundaryEvent")}function getFlowElements(element,type){return utils.filterElementsByType(element.flowElements,type)}function isCompensationEventAttachedToActivity(activity,boundaryEvents){var activityId=activity.id;return!!find(boundaryEvents,function(boundaryEvent){var compensateEventDefinition=eventDefinitionHelper.getCompensateEventDefinition(boundaryEvent),attachedToRef=boundaryEvent.attachedToRef;return compensateEventDefinition&&attachedToRef&&attachedToRef.id===activityId})}function canActivityBeCompensated(activity,boundaryEvents){return is(activity,"bpmn:SubProcess")&&!activity.triggeredByEvent||is(activity,"bpmn:CallActivity")||isCompensationEventAttachedToActivity(activity,boundaryEvents)}function getActivitiesForCompensation(element){var boundaryEvents=getContainedBoundaryEvents(element);return filter(getContainedActivities(element),function(activity){return canActivityBeCompensated(activity,boundaryEvents)})}function getActivitiesForActivityRef(element){var bo=getBusinessObject(element),parent=bo.$parent,activitiesForActivityRef=getActivitiesForCompensation(parent);return is(parent,"bpmn:SubProcess")&&parent.triggeredByEvent&&(parent=parent.$parent)&&(activitiesForActivityRef=activitiesForActivityRef.concat(getActivitiesForCompensation(parent))),activitiesForActivityRef}function createActivityRefOptions(element){var options=[{value:""}],activities=getActivitiesForActivityRef(element);return forEach(activities,function(activity){var activityId=activity.id,name=(activity.name?activity.name+" ":"")+"(id="+activityId+")";options.push({value:activityId,name:name})}),options}var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper"),eventDefinitionHelper=require("../../../../helper/EventDefinitionHelper"),utils=require("../../../../Utils"),getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,is=require("bpmn-js/lib/util/ModelUtil").is,forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),filter=require("lodash/collection/filter");module.exports=function(group,element,bpmnFactory,compensateEventDefinition,elementRegistry){group.entries.push(entryFactory.checkbox({id:"wait-for-completion",label:"Wait for Completion",modelProperty:"waitForCompletion",get:function(element,node){return{waitForCompletion:compensateEventDefinition.waitForCompletion}},set:function(element,values){return values.waitForCompletion=values.waitForCompletion||void 0,cmdHelper.updateBusinessObject(element,compensateEventDefinition,values)}})),group.entries.push(entryFactory.selectBox({id:"activity-ref",label:"Activity Ref",selectOptions:createActivityRefOptions(element),modelProperty:"activityRef",get:function(element,node){var activityRef=compensateEventDefinition.activityRef;return activityRef=activityRef&&activityRef.id,{activityRef:activityRef||""}},set:function(element,values){var activityRef=values.activityRef||void 0;return activityRef=activityRef&&getBusinessObject(elementRegistry.get(activityRef)),cmdHelper.updateBusinessObject(element,compensateEventDefinition,{activityRef:activityRef})}}))}},{"../../../../Utils":28,"../../../../factory/EntryFactory":37,"../../../../helper/CmdHelper":46,"../../../../helper/EventDefinitionHelper":48,"bpmn-js/lib/util/ModelUtil":157,"lodash/collection/filter":364,"lodash/collection/find":365,"lodash/collection/forEach":366}],55:[function(require,module,exports){"use strict";function createFormalExpression(parent,body,bpmnFactory){return body=body||void 0,elementHelper.createElement("bpmn:FormalExpression",{body:body},parent,bpmnFactory)}var entryFactory=require("../../../../factory/EntryFactory"),elementHelper=require("../../../../helper/ElementHelper"),cmdHelper=require("../../../../helper/CmdHelper");module.exports=function(group,element,bpmnFactory,conditionalEventDefinition){var getValue=function(modelProperty){return function(element){var modelPropertyValue=conditionalEventDefinition.get("camunda:"+modelProperty),value={};return value[modelProperty]=modelPropertyValue,value}},setValue=function(modelProperty){return function(element,values){var props={};return props["camunda:"+modelProperty]=values[modelProperty]||void 0,cmdHelper.updateBusinessObject(element,conditionalEventDefinition,props)}};group.entries.push(entryFactory.textField({id:"condition",label:"Condition",modelProperty:"condition",get:function(element){var condition=conditionalEventDefinition.get("condition");return{condition:condition&&condition.get("body")||""}},set:function(element,values){var condition=conditionalEventDefinition.get("condition");return""===values.condition?cmdHelper.updateBusinessObject(element,conditionalEventDefinition,{condition:void 0}):condition?cmdHelper.updateBusinessObject(element,condition,{body:values.condition||void 0}):(condition=createFormalExpression(conditionalEventDefinition,values.condition,bpmnFactory),cmdHelper.updateBusinessObject(element,conditionalEventDefinition,{condition:condition}))},validate:function(element,values){if(""===values.condition)return{condition:"Must provide a value"}}})),group.entries.push(entryFactory.textField({id:"variableName",label:"Variable Name",modelProperty:"variableName",get:getValue("variableName"),set:setValue("variableName")})),group.entries.push(entryFactory.textField({id:"variableEvent",label:"Variable Event",description:"Specify more than one variable change event as a comma separated list.",modelProperty:"variableEvent",get:getValue("variableEvent"),set:setValue("variableEvent")}))}},{"../../../../factory/EntryFactory":37,"../../../../helper/CmdHelper":46,"../../../../helper/ElementHelper":47}],56:[function(require,module,exports){"use strict";var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper");module.exports=function(element,definition,bpmnFactory,options){var id=options.id||"element-property",label=options.label,referenceProperty=options.referenceProperty,modelProperty=options.modelProperty||"name",shouldValidate=options.shouldValidate||!1,entry=entryFactory.textField({id:id,label:label,modelProperty:modelProperty,get:function(element,node){var reference=definition.get(referenceProperty),props={};return props[modelProperty]=reference&&reference.get(modelProperty),props},set:function(element,values,node){var reference=definition.get(referenceProperty),props={};return props[modelProperty]=values[modelProperty]||void 0,cmdHelper.updateBusinessObject(element,reference,props)},disabled:function(element,node){return!definition.get(referenceProperty)}});return shouldValidate&&(entry.validate=function(element,values,node){if(definition.get(referenceProperty)&&!values[modelProperty]){var validationErrors={};return validationErrors[modelProperty]="Must provide a value",validationErrors}}),[entry]}},{"../../../../factory/EntryFactory":37,"../../../../helper/CmdHelper":46}],57:[function(require,module,exports){"use strict";var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper"),eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,errorEventDefinition,showErrorCodeVariable,showErrorMessageVariable){var getValue=function(modelProperty){return function(element){var modelPropertyValue=errorEventDefinition.get("camunda:"+modelProperty),value={};return value[modelProperty]=modelPropertyValue,value}},setValue=function(modelProperty){return function(element,values){var props={};return props["camunda:"+modelProperty]=values[modelProperty]||void 0,cmdHelper.updateBusinessObject(element,errorEventDefinition,props)}};group.entries=group.entries.concat(eventDefinitionReference(element,errorEventDefinition,bpmnFactory,{label:"Error",elementName:"error",elementType:"bpmn:Error",referenceProperty:"errorRef",newElementIdPrefix:"Error_"})),group.entries=group.entries.concat(elementReferenceProperty(element,errorEventDefinition,bpmnFactory,{id:"error-element-name", +label:"Error Name",referenceProperty:"errorRef",modelProperty:"name",shouldValidate:!0})),group.entries=group.entries.concat(elementReferenceProperty(element,errorEventDefinition,bpmnFactory,{id:"error-element-code",label:"Error Code",referenceProperty:"errorRef",modelProperty:"errorCode"})),showErrorCodeVariable&&group.entries.push(entryFactory.textField({id:"errorCodeVariable",label:"Error Code Variable",modelProperty:"errorCodeVariable",get:getValue("errorCodeVariable"),set:setValue("errorCodeVariable")})),showErrorMessageVariable&&group.entries.push(entryFactory.textField({id:"errorMessageVariable",label:"Error Message Variable",modelProperty:"errorMessageVariable",get:getValue("errorMessageVariable"),set:setValue("errorMessageVariable")}))}},{"../../../../factory/EntryFactory":37,"../../../../helper/CmdHelper":46,"./ElementReferenceProperty":56,"./EventDefinitionReference":59}],58:[function(require,module,exports){"use strict";var entryFactory=require("../../../../factory/EntryFactory"),cmdHelper=require("../../../../helper/CmdHelper"),eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,escalationEventDefinition,showEscalationCodeVariable){group.entries=group.entries.concat(eventDefinitionReference(element,escalationEventDefinition,bpmnFactory,{label:"Escalation",elementName:"escalation",elementType:"bpmn:Escalation",referenceProperty:"escalationRef",newElementIdPrefix:"Escalation_"})),group.entries=group.entries.concat(elementReferenceProperty(element,escalationEventDefinition,bpmnFactory,{id:"escalation-element-name",label:"Escalation Name",referenceProperty:"escalationRef",modelProperty:"name",shouldValidate:!0})),group.entries=group.entries.concat(elementReferenceProperty(element,escalationEventDefinition,bpmnFactory,{id:"escalation-element-code",label:"Escalation Code",referenceProperty:"escalationRef",modelProperty:"escalationCode"})),showEscalationCodeVariable&&group.entries.push(entryFactory.textField({id:"escalationCodeVariable",label:"Escalation Code Variable",modelProperty:"escalationCodeVariable",get:function(element){return{escalationCodeVariable:escalationEventDefinition.get("camunda:escalationCodeVariable")}},set:function(element,values){return cmdHelper.updateBusinessObject(element,escalationEventDefinition,{"camunda:escalationCodeVariable":values.escalationCodeVariable||void 0})}}))}},{"../../../../factory/EntryFactory":37,"../../../../helper/CmdHelper":46,"./ElementReferenceProperty":56,"./EventDefinitionReference":59}],59:[function(require,module,exports){"use strict";function getSelectBox(node){return domQuery(selector,node.parentElement)}function findElementById(eventDefinition,type,id){var elements=utils.findRootElementsByType(eventDefinition,type);return find(elements,function(element){return element.id===id})}var cmdHelper=require("../../../../helper/CmdHelper"),domQuery=require("min-dom/lib/query"),domify=require("min-dom/lib/domify"),domAttr=require("min-dom/lib/attr"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),elementHelper=require("../../../../helper/ElementHelper"),utils=require("../../../../Utils"),selector="select[name=selectedElement]";module.exports=function(element,definition,bpmnFactory,options){var elementName=options.elementName||"",elementType=options.elementType,referenceProperty=options.referenceProperty,newElementIdPrefix=options.newElementIdPrefix||"elem_",label=options.label||"",description=options.description||"",entries=[];return entries.push({id:"event-definitions-"+elementName,description:description,html:'
',get:function(element,entryNode){utils.updateOptionsDropDown(selector,definition,elementType,entryNode);var reference=definition.get(referenceProperty);return{selectedElement:reference&&reference.id||""}},set:function(element,values){var selection=values.selectedElement,props={};if(!selection||void 0===selection)return props[referenceProperty]=void 0,cmdHelper.updateBusinessObject(element,definition,props);var commands=[],selectedElement=findElementById(definition,elementType,selection);if(!selectedElement){var root=utils.getRoot(definition);selectedElement=elementHelper.createElement(elementType,{name:selection},root,bpmnFactory),commands.push(cmdHelper.addAndRemoveElementsFromList(element,root,"rootElements",null,[selectedElement]))}return props[referenceProperty]=selectedElement,commands.push(cmdHelper.updateBusinessObject(element,definition,props)),commands},addElement:function(element,inputNode){var id=utils.nextId(newElementIdPrefix),optionTemplate=domify('"),selectBox=getSelectBox(inputNode);return selectBox.insertBefore(optionTemplate,selectBox.firstChild),forEach(selectBox,function(option){option.value===id?domAttr(option,"selected","selected"):domAttr(option,"selected",null)}),!0}}),entries}},{"../../../../Utils":28,"../../../../helper/CmdHelper":46,"../../../../helper/ElementHelper":47,"lodash/collection/find":365,"lodash/collection/forEach":366,"min-dom/lib/attr":514,"min-dom/lib/domify":519,"min-dom/lib/query":522}],60:[function(require,module,exports){"use strict";var eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,messageEventDefinition){group.entries=group.entries.concat(eventDefinitionReference(element,messageEventDefinition,bpmnFactory,{label:"Message",elementName:"message",elementType:"bpmn:Message",referenceProperty:"messageRef",newElementIdPrefix:"Message_"})),group.entries=group.entries.concat(elementReferenceProperty(element,messageEventDefinition,bpmnFactory,{id:"message-element-name",label:"Message Name",referenceProperty:"messageRef",modelProperty:"name",shouldValidate:!0}))}},{"./ElementReferenceProperty":56,"./EventDefinitionReference":59}],61:[function(require,module,exports){"use strict";var eventDefinitionReference=require("./EventDefinitionReference"),elementReferenceProperty=require("./ElementReferenceProperty");module.exports=function(group,element,bpmnFactory,signalEventDefinition){group.entries=group.entries.concat(eventDefinitionReference(element,signalEventDefinition,bpmnFactory,{label:"Signal",elementName:"signal",elementType:"bpmn:Signal",referenceProperty:"signalRef",newElementIdPrefix:"Signal_"})),group.entries=group.entries.concat(elementReferenceProperty(element,signalEventDefinition,bpmnFactory,{id:"signal-element-name",label:"Signal Name",referenceProperty:"signalRef",modelProperty:"name",shouldValidate:!0}))}},{"./ElementReferenceProperty":56,"./EventDefinitionReference":59}],62:[function(require,module,exports){"use strict";function getTimerDefinitionType(timer){return void 0!==timer.get("timeDate")?"timeDate":void 0!==timer.get("timeCycle")?"timeCycle":void 0!==timer.get("timeDuration")?"timeDuration":void 0}function createFormalExpression(parent,body,bpmnFactory){return body=body||void 0,elementHelper.createElement("bpmn:FormalExpression",{body:body},parent,bpmnFactory)}function TimerEventDefinition(group,element,bpmnFactory,timerEventDefinition){var selectOptions=[{value:"timeDate",name:"Date"},{value:"timeDuration",name:"Duration"},{value:"timeCycle",name:"Cycle"}];group.entries.push(entryFactory.selectBox({id:"timer-event-definition-type",label:"Timer Definition Type",selectOptions:selectOptions,emptyParameter:!0,modelProperty:"timerDefinitionType",get:function(element,node){return{timerDefinitionType:getTimerDefinitionType(timerEventDefinition)||""}},set:function(element,values){var props={timeDuration:void 0,timeDate:void 0,timeCycle:void 0},newType=values.timerDefinitionType;if(values.timerDefinitionType){var value,oldType=getTimerDefinitionType(timerEventDefinition);if(oldType){value=timerEventDefinition.get(oldType).get("body")}props[newType]=createFormalExpression(timerEventDefinition,value,bpmnFactory)}return cmdHelper.updateBusinessObject(element,timerEventDefinition,props)}})),group.entries.push(entryFactory.textField({id:"timer-event-definition",label:"Timer Definition",modelProperty:"timerDefinition",get:function(element,node){var type=getTimerDefinitionType(timerEventDefinition),definition=type&&timerEventDefinition.get(type);return{timerDefinition:definition&&definition.get("body")}},set:function(element,values){var type=getTimerDefinitionType(timerEventDefinition),definition=type&&timerEventDefinition.get(type);if(definition)return cmdHelper.updateBusinessObject(element,definition,{body:values.timerDefinition||void 0})},validate:function(element){var type=getTimerDefinitionType(timerEventDefinition),definition=type&&timerEventDefinition.get(type);if(definition){if(!definition.get("body"))return{timerDefinition:"Must provide a value"}}},disabled:function(element){return!getTimerDefinitionType(timerEventDefinition)}}))}var elementHelper=require("../../../../helper/ElementHelper"),cmdHelper=require("../../../../helper/CmdHelper"),entryFactory=require("../../../../factory/EntryFactory");module.exports=TimerEventDefinition},{"../../../../factory/EntryFactory":37,"../../../../helper/CmdHelper":46,"../../../../helper/ElementHelper":47}],63:[function(require,module,exports){"use strict";var properties=require("./implementation/Properties"),elementHelper=require("../../../helper/ElementHelper"),cmdHelper=require("../../../helper/CmdHelper");module.exports=function(group,element,bpmnFactory){var propertiesEntry=properties(element,bpmnFactory,{id:"properties",modelProperties:["name","value"],labels:["Name","Value"],getParent:function(element,node,bo){return bo.extensionElements},createParent:function(element,bo){var parent=elementHelper.createElement("bpmn:ExtensionElements",{values:[]},bo,bpmnFactory);return{cmd:cmdHelper.updateBusinessObject(element,bo,{extensionElements:parent}),parent:parent}}});propertiesEntry&&group.entries.push(propertiesEntry)}},{"../../../helper/CmdHelper":46,"../../../helper/ElementHelper":47,"./implementation/Properties":64}],64:[function(require,module,exports){"use strict";function generatePropertyId(){return utils.nextId("Property_")}function getPropertyValues(parent){var properties=parent&&getPropertiesElement(parent);return properties&&properties.values?properties.values:[]}function getPropertiesElement(element){return isExtensionElements(element)?getPropertiesElementInsideExtensionElements(element):element.properties}function getPropertiesElementInsideExtensionElements(extensionElements){return find(extensionElements.values,function(elem){return is(elem,"camunda:Properties")})}function isExtensionElements(element){return is(element,"bpmn:ExtensionElements")}var getBusinessObject=require("bpmn-js/lib/util/ModelUtil").getBusinessObject,is=require("bpmn-js/lib/util/ModelUtil").is,factory=require("../../../../factory/EntryFactory"),elementHelper=require("../../../../helper/ElementHelper"),extensionElementsHelper=require("../../../../helper/ExtensionElementsHelper"),cmdHelper=require("../../../../helper/CmdHelper"),utils=require("../../../../Utils"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find");module.exports=function(element,bpmnFactory,options){var getParent=options.getParent,modelProperties=options.modelProperties,createParent=options.createParent,bo=getBusinessObject(element);if(is(element,"bpmn:Participant")&&(bo=bo.get("processRef")),bo)return assign(options,{addLabel:"Add Property",getElements:function(element,node){return getPropertyValues(getParent(element,node,bo))},addElement:function(element,node){var commands=[],parent=getParent(element,node,bo);if(!parent&&"function"==typeof createParent){var result=createParent(element,bo);parent=result.parent,commands.push(result.cmd)}var properties=getPropertiesElement(parent);properties||(properties=elementHelper.createElement("camunda:Properties",{},parent,bpmnFactory),isExtensionElements(parent)?commands.push(cmdHelper.addAndRemoveElementsFromList(element,parent,"values","extensionElements",[properties],[])):commands.push(cmdHelper.updateBusinessObject(element,parent,{properties:properties})));var propertyProps={};forEach(modelProperties,function(prop){propertyProps[prop]=void 0}),modelProperties.indexOf("id")>=0&&(propertyProps.id=generatePropertyId());var property=elementHelper.createElement("camunda:Property",propertyProps,properties,bpmnFactory);return commands.push(cmdHelper.addElementsTolist(element,properties,"values",[property])),commands},updateElement:function(element,value,node,idx){var parent=getParent(element,node,bo),property=getPropertyValues(parent)[idx];return forEach(modelProperties,function(prop){value[prop]=value[prop]||void 0}),cmdHelper.updateBusinessObject(element,property,value)},validate:function(element,value,node,idx){if(modelProperties.indexOf("id")>=0){var parent=getParent(element,node,bo),properties=getPropertyValues(parent),property=properties[idx];if(property){var validationError=utils.isIdValid(property,value.id);if(validationError)return{id:validationError}}}},removeElement:function(element,node,idx){var commands=[],parent=getParent(element,node,bo),properties=getPropertiesElement(parent),propertyValues=getPropertyValues(parent),currentProperty=propertyValues[idx];return commands.push(cmdHelper.removeElementsFromList(element,properties,"values",null,[currentProperty])),1===propertyValues.length&&(isExtensionElements(parent)?forEach(parent.values,function(value){is(value,"camunda:Properties")&&commands.push(extensionElementsHelper.removeEntry(bo,element,value))}):commands.push(cmdHelper.updateBusinessObject(element,parent,{properties:void 0}))),commands}}),factory.table(options)}},{"../../../../Utils":28,"../../../../factory/EntryFactory":37,"../../../../helper/CmdHelper":46,"../../../../helper/ElementHelper":47,"../../../../helper/ExtensionElementsHelper":49,"bpmn-js/lib/util/ModelUtil":157,"lodash/collection/find":365,"lodash/collection/forEach":366,"lodash/object/assign":499}],65:[function(require,module,exports){"use strict";function Modeler(options){Viewer.call(this,options),this.on("import.parse.complete",function(event){event.error||this._collectIds(event.definitions,event.context)},this),this.on("diagram.destroy",function(){this.moddle.ids.clear()},this)}var inherits=require("inherits"),Ids=require("ids"),Viewer=require("./Viewer"),NavigatedViewer=require("./NavigatedViewer");inherits(Modeler,Viewer),module.exports=Modeler,module.exports.Viewer=Viewer,module.exports.NavigatedViewer=NavigatedViewer,Modeler.prototype.createDiagram=function(done){return this.importXML('',done)},Modeler.prototype._createModdle=function(options){var moddle=Viewer.prototype._createModdle.call(this,options);return moddle.ids=new Ids([32,36,1]),moddle},Modeler.prototype._collectIds=function(definitions,context){var id,moddle=definitions.$model,ids=moddle.ids;ids.clear();for(id in context.elementsById)ids.claim(id,context.elementsById[id])},Modeler.prototype._interactionModules=[require("diagram-js/lib/navigation/movecanvas"),require("diagram-js/lib/navigation/touch"),require("diagram-js/lib/navigation/zoomscroll")],Modeler.prototype._modelingModules=[require("diagram-js/lib/features/auto-scroll"),require("diagram-js/lib/features/bendpoints"),require("diagram-js/lib/features/move"),require("diagram-js/lib/features/resize"),require("./features/auto-resize"),require("./features/editor-actions"),require("./features/context-pad"),require("./features/keyboard"),require("./features/label-editing"),require("./features/modeling"),require("./features/palette"),require("./features/replace-preview"),require("./features/snapping")],Modeler.prototype._modules=[].concat(Modeler.prototype._modules,Modeler.prototype._interactionModules,Modeler.prototype._modelingModules)},{"./NavigatedViewer":66,"./Viewer":67,"./features/auto-resize":74,"./features/context-pad":76,"./features/editor-actions":82,"./features/keyboard":86,"./features/label-editing":90,"./features/modeling":128,"./features/palette":134,"./features/replace-preview":139,"./features/snapping":149,"diagram-js/lib/features/auto-scroll":199,"diagram-js/lib/features/bendpoints":205,"diagram-js/lib/features/move":266,"diagram-js/lib/features/resize":284,"diagram-js/lib/navigation/movecanvas":316,"diagram-js/lib/navigation/touch":317,"diagram-js/lib/navigation/zoomscroll":320,ids:350,inherits:351}],66:[function(require,module,exports){"use strict";function NavigatedViewer(options){Viewer.call(this,options)}var inherits=require("inherits"),Viewer=require("./Viewer");inherits(NavigatedViewer,Viewer),module.exports=NavigatedViewer,NavigatedViewer.prototype._navigationModules=[require("diagram-js/lib/navigation/zoomscroll"),require("diagram-js/lib/navigation/movecanvas")],NavigatedViewer.prototype._modules=[].concat(NavigatedViewer.prototype._modules,NavigatedViewer.prototype._navigationModules)},{"./Viewer":67,"diagram-js/lib/navigation/movecanvas":316,"diagram-js/lib/navigation/zoomscroll":320,inherits:351}],67:[function(require,module,exports){"use strict";function checkValidationError(err){var pattern=/unparsable content <([^>]+)> detected([\s\S]*)$/,match=pattern.exec(err.message);return match&&(err.message="unparsable content <"+match[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+match[2]),err}function ensureUnit(val){return val+(isNumber(val)?"px":"")}function Viewer(options){options=assign({},DEFAULT_OPTIONS,options),this.moddle=this._createModdle(options),this.container=this._createContainer(options),addProjectLogo(this.container),this._init(this.container,this.moddle,options)}function addProjectLogo(container){var logoData=PoweredBy.BPMNIO_LOGO,linkMarkup='',linkElement=domify(linkMarkup);container.appendChild(linkElement),domEvent.bind(linkElement,"click",function(event){PoweredBy.open(),event.preventDefault()})}var assign=require("lodash/object/assign"),omit=require("lodash/object/omit"),isString=require("lodash/lang/isString"),isNumber=require("lodash/lang/isNumber"),domify=require("min-dom/lib/domify"),domQuery=require("min-dom/lib/query"),domRemove=require("min-dom/lib/remove"),innerSVG=require("tiny-svg/lib/innerSVG"),Diagram=require("diagram-js"),BpmnModdle=require("bpmn-moddle"),inherits=require("inherits"),Importer=require("./import/Importer"),DEFAULT_OPTIONS={width:"100%",height:"100%",position:"relative",container:"body"};inherits(Viewer,Diagram),module.exports=Viewer,Viewer.prototype.importXML=function(xml,done){done=done||function(){};var self=this;xml=this._emit("import.parse.start",{xml:xml})||xml,this.moddle.fromXML(xml,"bpmn:Definitions",function(err,definitions,context){if(definitions=self._emit("import.parse.complete",{error:err,definitions:definitions,context:context})||definitions,err)return err=checkValidationError(err),self._emit("import.done",{error:err}),done(err);var parseWarnings=context.warnings;self.importDefinitions(definitions,function(err,importWarnings){var allWarnings=[].concat(parseWarnings,importWarnings||[]);self._emit("import.done",{error:err,warnings:allWarnings}),done(err,allWarnings)})})},Viewer.prototype.saveXML=function(options,done){done||(done=options,options={});var definitions=this.definitions;if(!definitions)return done(new Error("no definitions loaded"));this.moddle.toXML(definitions,options,done)},Viewer.prototype.saveSVG=function(options,done){done||(done=options,options={});var canvas=this.get("canvas"),contentNode=canvas.getDefaultLayer(),defsNode=domQuery("defs",canvas._svg),contents=innerSVG(contentNode),defs=defsNode&&defsNode.outerHTML||"",bbox=contentNode.getBBox();done(null,'\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n\n'+defs+contents+"")},Viewer.prototype.importDefinitions=function(definitions,done){try{this.definitions&&this.clear(),this.definitions=definitions,Importer.importBpmnDiagram(this,definitions,done)}catch(e){done(e)}},Viewer.prototype.getModules=function(){return this._modules},Viewer.prototype.destroy=function(){Diagram.prototype.destroy.call(this),domRemove(this.container)},Viewer.prototype.on=function(event,priority,callback,target){return this.get("eventBus").on(event,priority,callback,target)},Viewer.prototype.off=function(event,callback){this.get("eventBus").off(event,callback)},Viewer.prototype._init=function(container,moddle,options){var baseModules=options.modules||this.getModules(),additionalModules=options.additionalModules||[],staticModules=[{bpmnjs:["value",this],moddle:["value",moddle]}],diagramModules=[].concat(staticModules,baseModules,additionalModules),diagramOptions=assign(omit(options,"additionalModules"),{canvas:assign({},options.canvas,{container:container}),modules:diagramModules});Diagram.call(this,diagramOptions)},Viewer.prototype._emit=function(type,event){return this.get("eventBus").fire(type,event)},Viewer.prototype._createContainer=function(options){var container,parent=options.container;return parent.get&&(parent=parent.get(0)),isString(parent)&&(parent=domQuery(parent)),container=domify('
'),assign(container.style,{width:ensureUnit(options.width),height:ensureUnit(options.height),position:options.position}),parent.appendChild(container),container},Viewer.prototype._createModdle=function(options){var moddleOptions=assign({},this._moddleExtensions,options.moddleExtensions);return new BpmnModdle(moddleOptions)},Viewer.prototype._modules=[require("./core"),require("diagram-js/lib/i18n/translate"),require("diagram-js/lib/features/selection"),require("diagram-js/lib/features/overlays")],Viewer.prototype._moddleExtensions={};var PoweredBy=require("./util/PoweredByUtil"),domEvent=require("min-dom/lib/event")},{"./core":68,"./import/Importer":152,"./util/PoweredByUtil":158,"bpmn-moddle":159,"diagram-js":177,"diagram-js/lib/features/overlays":271,"diagram-js/lib/features/selection":293,"diagram-js/lib/i18n/translate":308,inherits:351,"lodash/lang/isNumber":493,"lodash/lang/isString":496,"lodash/object/assign":499,"lodash/object/omit":506,"min-dom/lib/domify":519,"min-dom/lib/event":520,"min-dom/lib/query":522,"min-dom/lib/remove":523,"tiny-svg/lib/innerSVG":551}],68:[function(require,module,exports){module.exports={__depends__:[require("../draw"),require("../import")]}},{"../draw":71,"../import":154}],69:[function(require,module,exports){"use strict";function BpmnRenderer(eventBus,styles,pathMap,priority){function addMarker(id,element){markers[id]=element}function marker(id){return"url(#"+markers[id].id+")"}function initMarkers(svg){function createMarker(id,options){var attrs=assign({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},options.attrs),ref=options.ref||{x:0,y:0},scale=options.scale||1;"none"===attrs.strokeDasharray&&(attrs.strokeDasharray=[1e4,1]);var marker=svgCreate("marker");svgAttr(options.element,attrs),svgAppend(marker,options.element),svgAttr(marker,{id:id,viewBox:"0 0 20 20",refX:ref.x,refY:ref.y,markerWidth:20*scale,markerHeight:20*scale,orient:"auto"});var defs=domQuery("defs",svg);return defs||(defs=svgCreate("defs"),svgAppend(svg,defs)),svgAppend(defs,marker),addMarker(id,marker)}var sequenceflowEnd=svgCreate("path");svgAttr(sequenceflowEnd,{d:"M 1 5 L 11 10 L 1 15 Z"}),createMarker("sequenceflow-end",{element:sequenceflowEnd,ref:{x:11,y:10},scale:.5});var messageflowStart=svgCreate("circle");svgAttr(messageflowStart,{cx:6,cy:6,r:3.5}),createMarker("messageflow-start",{element:messageflowStart,attrs:{fill:"white",stroke:"black"},ref:{x:6,y:6}});var messageflowEnd=svgCreate("path");svgAttr(messageflowEnd,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),createMarker("messageflow-end",{element:messageflowEnd,attrs:{fill:"white",stroke:"black",strokeLinecap:"butt"},ref:{x:8.5,y:5}});var associationStart=svgCreate("path");svgAttr(associationStart,{d:"M 11 5 L 1 10 L 11 15"}),createMarker("association-start",{element:associationStart,attrs:{fill:"none",stroke:"black",strokeWidth:1.5},ref:{x:1,y:10},scale:.5});var associationEnd=svgCreate("path");svgAttr(associationEnd,{d:"M 1 5 L 11 10 L 1 15"}),createMarker("association-end",{element:associationEnd,attrs:{fill:"none",stroke:"black",strokeWidth:1.5},ref:{x:12,y:10},scale:.5});var conditionalflowMarker=svgCreate("path");svgAttr(conditionalflowMarker,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),createMarker("conditional-flow-marker",{element:conditionalflowMarker,attrs:{fill:"white",stroke:"black"},ref:{x:-1,y:10},scale:.5});var conditionaldefaultflowMarker=svgCreate("path");svgAttr(conditionaldefaultflowMarker,{d:"M 1 4 L 5 16"}),createMarker("conditional-default-flow-marker",{element:conditionaldefaultflowMarker,attrs:{stroke:"black"},ref:{x:-5,y:10},scale:.5})}function drawCircle(parentGfx,width,height,offset,attrs){isObject(offset)&&(attrs=offset,offset=0),offset=offset||0,attrs=computeStyle(attrs,{stroke:"black",strokeWidth:2,fill:"white"});var cx=width/2,cy=height/2,circle=svgCreate("circle");return svgAttr(circle,{cx:cx,cy:cy,r:Math.round((width+height)/4-offset)}),svgAttr(circle,attrs),svgAppend(parentGfx,circle),circle}function drawRect(parentGfx,width,height,r,offset,attrs){isObject(offset)&&(attrs=offset,offset=0),offset=offset||0,attrs=computeStyle(attrs,{stroke:"black",strokeWidth:2,fill:"white"});var rect=svgCreate("rect");return svgAttr(rect,{x:offset,y:offset,width:width-2*offset,height:height-2*offset,rx:r,ry:r}),svgAttr(rect,attrs),svgAppend(parentGfx,rect),rect}function drawDiamond(parentGfx,width,height,attrs){var x_2=width/2,y_2=height/2,points=[{x:x_2,y:0},{x:width,y:y_2},{x:x_2,y:height},{x:0,y:y_2}],pointsString=points.map(function(point){return point.x+","+point.y}).join(" ");attrs=computeStyle(attrs,{stroke:"black",strokeWidth:2,fill:"white"});var polygon=svgCreate("polygon");return svgAttr(polygon,{points:pointsString}),svgAttr(polygon,attrs),svgAppend(parentGfx,polygon),polygon}function drawLine(parentGfx,waypoints,attrs){attrs=computeStyle(attrs,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"});var line=createLine(waypoints,attrs);return svgAppend(parentGfx,line),line}function drawPath(parentGfx,d,attrs){attrs=computeStyle(attrs,["no-fill"],{strokeWidth:2,stroke:"black"});var path=svgCreate("path");return svgAttr(path,{d:d}),svgAttr(path,attrs),svgAppend(parentGfx,path),path}function drawMarker(type,parentGfx,path,attrs){return drawPath(parentGfx,path,assign({"data-marker":type},attrs))}function as(type){return function(parentGfx,element){return handlers[type](parentGfx,element)}}function renderer(type){return handlers[type]}function renderEventContent(element,parentGfx){var event=getSemantic(element),isThrowing=isThrowEvent(event);return isTypedEvent(event,"bpmn:MessageEventDefinition")?renderer("bpmn:MessageEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:TimerEventDefinition")?renderer("bpmn:TimerEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:ConditionalEventDefinition")?renderer("bpmn:ConditionalEventDefinition")(parentGfx,element):isTypedEvent(event,"bpmn:SignalEventDefinition")?renderer("bpmn:SignalEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CancelEventDefinition")&&isTypedEvent(event,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?renderer("bpmn:MultipleEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CancelEventDefinition")&&isTypedEvent(event,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?renderer("bpmn:ParallelMultipleEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:EscalationEventDefinition")?renderer("bpmn:EscalationEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:LinkEventDefinition")?renderer("bpmn:LinkEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:ErrorEventDefinition")?renderer("bpmn:ErrorEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CancelEventDefinition")?renderer("bpmn:CancelEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:CompensateEventDefinition")?renderer("bpmn:CompensateEventDefinition")(parentGfx,element,isThrowing):isTypedEvent(event,"bpmn:TerminateEventDefinition")?renderer("bpmn:TerminateEventDefinition")(parentGfx,element,isThrowing):null}function renderLabel(parentGfx,label,options){var text=textUtil.createText(parentGfx,label||"",options);return svgClasses(text).add("djs-label"),text}function renderEmbeddedLabel(parentGfx,element,align){return renderLabel(parentGfx,getSemantic(element).name,{box:element,align:align,padding:5})}function renderExternalLabel(parentGfx,element){var semantic=getSemantic(element),box={width:90,height:30,x:element.width/2+element.x,y:element.height/2+element.y};return renderLabel(parentGfx,semantic.name,{box:box,style:{fontSize:"11px"}})}function renderLaneLabel(parentGfx,text,element){var textBox=renderLabel(parentGfx,text,{box:{height:30,width:element.height},align:"center-middle"}),top=-1*element.height;transform(textBox,0,-top,270)}function createPathFromConnection(connection){for(var waypoints=connection.waypoints,pathData="m "+waypoints[0].x+","+waypoints[0].y,i=1;i=120&&assign(actions,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:translate("Divide into two Lanes"),action:{click:splitLaneHandler(2)}}}),element.height>=180&&assign(actions,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:translate("Divide into three Lanes"),action:{click:splitLaneHandler(3)}}})),assign(actions,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:translate("Add Lane below"),action:{click:function(event,element){modeling.addLane(element,"bottom")}}}})}is(businessObject,"bpmn:FlowNode")&&(is(businessObject,"bpmn:EventBasedGateway")?assign(actions,{"append.receive-task":appendAction("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":appendAction("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",{eventDefinitionType:"bpmn:SignalEventDefinition"})}):isEventType(businessObject,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?assign(actions,{"append.compensation-activity":appendAction("bpmn:Task","bpmn-icon-task",translate("Append compensation activity"),{isForCompensation:!0})}):is(businessObject,"bpmn:EndEvent")||businessObject.isForCompensation||isEventType(businessObject,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||isEventSubProcess(businessObject)||assign(actions,{"append.end-event":appendAction("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":appendAction("bpmn:ExclusiveGateway","bpmn-icon-gateway-xor"),"append.append-task":appendAction("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":appendAction("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none")}));var replaceMenu;popupMenu._providers["bpmn-replace"]&&(replaceMenu=popupMenu.create("bpmn-replace",element)),replaceMenu&&!replaceMenu.isEmpty()&&assign(actions,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:translate("Change type"),action:{click:function(event,element){replaceMenu.open(assign(getReplaceMenuPosition(element),{cursor:{x:event.x,y:event.y}}),element)}}}}),isAny(businessObject,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&assign(actions,{"append.text-annotation":appendAction("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:translate("Connect using "+(businessObject.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:startConnect,dragstart:startConnect}}}),isAny(businessObject,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&assign(actions,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:translate("Connect using DataInputAssociation"),action:{click:startConnect,dragstart:startConnect}}});var deleteAllowed=rules.allowed("elements.delete",{elements:[element]});return isArray(deleteAllowed)&&(deleteAllowed=deleteAllowed[0]===element),deleteAllowed&&assign(actions,{delete:{group:"edit",className:"bpmn-icon-trash",title:translate("Remove"),action:{click:removeElement,dragstart:removeElement}}}),actions}},{"../../util/DiUtil":155,"../../util/ModelUtil":157,"../modeling/util/LaneUtil":129,"../modeling/util/ModelingUtil":130,"diagram-js/lib/util/Mouse":334,"lodash/collection/forEach":366,"lodash/lang/isArray":489,"lodash/object/assign":499}],76:[function(require,module,exports){module.exports={__depends__:[require("diagram-js-direct-editing"),require("diagram-js/lib/features/context-pad"),require("diagram-js/lib/features/selection"),require("diagram-js/lib/features/connect"),require("diagram-js/lib/features/create"),require("../popup-menu")],__init__:["contextPadProvider"],contextPadProvider:["type",require("./ContextPadProvider")]}},{"../popup-menu":136,"./ContextPadProvider":75,"diagram-js-direct-editing":174,"diagram-js/lib/features/connect":211,"diagram-js/lib/features/context-pad":213,"diagram-js/lib/features/create":217,"diagram-js/lib/features/selection":293}],77:[function(require,module,exports){"use strict";function setProperties(descriptor,data,properties){forEach(properties,function(property){void 0!==data[property]&&(descriptor[property]=data[property])})}function removeProperties(element,properties){forEach(properties,function(prop){element[prop]&&delete element[prop]})}function BpmnCopyPaste(bpmnFactory,eventBus,copyPaste,clipboard,moddle,canvas,bpmnRules){copyPaste.registerDescriptor(function(element,descriptor){var conditionExpression,eventDefinitions,businessObject=getBusinessObject(element);return descriptor.type=element.type,"label"===element.type?descriptor:(setProperties(descriptor,businessObject,["name","text","processRef","isInterrupting","isForCompensation","associationDirection","triggeredByEvent","cancelActivity"]),businessObject.default&&(descriptor.default=businessObject.default.id),businessObject.loopCharacteristics&&(descriptor.loopCharacteristics={type:businessObject.loopCharacteristics.$type,isSequential:businessObject.loopCharacteristics.isSequential}),setProperties(descriptor,businessObject.di,["isExpanded"]),is(businessObject,"bpmn:SequenceFlow")&&(conditionExpression=businessObject.get("conditionExpression"))&&(descriptor.conditionExpression={type:conditionExpression.$type,body:conditionExpression.body}),eventDefinitions=businessObject.get("eventDefinitions")||[],eventDefinitions.length&&(descriptor.eventDefinitions=map(eventDefinitions,function(defs){return defs.$type})),descriptor)}),eventBus.on("element.paste",function(context){var businessObject,newEventDefinition,conditionExpression,loopCharacteristics,source,target,canConnect,descriptor=context.descriptor,createdElements=context.createdElements,parent=descriptor.parent,rootElement=canvas.getRootElement();"label"!==descriptor.type&&(is(parent,"bpmn:Process")&&(descriptor.parent=is(rootElement,"bpmn:Collaboration")?rootElement:parent),"bpmn:DataOutputAssociation"!==descriptor.type&&"bpmn:DataInputAssociation"!==descriptor.type&&"bpmn:MessageFlow"!==descriptor.type||(descriptor.parent=rootElement),is(parent,"bpmn:Lane")&&(descriptor.parent=parent.parent),descriptor.waypoints&&(source=createdElements[descriptor.source],target=createdElements[descriptor.target],source&&target&&(source=source.element,target=target.element),(canConnect=bpmnRules.canConnect(source,target))&&(descriptor.type=canConnect.type)),descriptor.businessObject=businessObject=bpmnFactory.create(descriptor.type),"bpmn:Participant"===descriptor.type&&descriptor.processRef&&(descriptor.processRef=businessObject.processRef=bpmnFactory.create("bpmn:Process")),setProperties(businessObject,descriptor,["name","text","isExpanded","isInterrupting","cancelActivity","triggeredByEvent"]),descriptor.loopCharacteristics&&(loopCharacteristics=descriptor.loopCharacteristics,businessObject.loopCharacteristics=moddle.create(loopCharacteristics.type),loopCharacteristics.isSequential&&(businessObject.loopCharacteristics.isSequential=!0),businessObject.loopCharacteristics.$parent=businessObject),descriptor.conditionExpression&&(conditionExpression=descriptor.conditionExpression,businessObject.conditionExpression=moddle.create(conditionExpression.type,{body:conditionExpression.body}),businessObject.conditionExpression.$parent=businessObject),descriptor.eventDefinitions&&(businessObject.eventDefinitions=map(descriptor.eventDefinitions,function(type){return newEventDefinition=moddle.create(type),newEventDefinition.$parent=businessObject,newEventDefinition})),removeProperties(descriptor,["name","text","eventDefinitions","conditionExpression","loopCharacteristics","isInterrupting","cancelActivity","triggeredByEvent"]))})}var ModelUtil=require("../../util/ModelUtil"),getBusinessObject=ModelUtil.getBusinessObject,is=ModelUtil.is,map=require("lodash/collection/map"),forEach=require("lodash/collection/forEach");BpmnCopyPaste.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","moddle","canvas","bpmnRules"],module.exports=BpmnCopyPaste},{"../../util/ModelUtil":157,"lodash/collection/forEach":366,"lodash/collection/map":370}],78:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/copy-paste")],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",require("./BpmnCopyPaste")]}},{"./BpmnCopyPaste":77,"diagram-js/lib/features/copy-paste":215}],79:[function(require,module,exports){"use strict";function BpmnDistributeElements(distributeElements){distributeElements.registerFilter(function(elements){return filter(elements,function(element){var cannotDistribute=isAny(element,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(element.labelTarget||cannotDistribute)})})}var filter=require("lodash/collection/filter"),isAny=require("../modeling/util/ModelingUtil").isAny;BpmnDistributeElements.$inject=["distributeElements"],module.exports=BpmnDistributeElements},{"../modeling/util/ModelingUtil":130,"lodash/collection/filter":364}],80:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/distribute-elements")],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",require("./BpmnDistributeElements")]}},{"./BpmnDistributeElements":79,"diagram-js/lib/features/distribute-elements":219}],81:[function(require,module,exports){"use strict";function BpmnEditorActions(injector,canvas,elementRegistry,selection,spaceTool,lassoTool,handTool,globalConnect,distributeElements,alignElements,directEditing,searchPad,modeling){injector.invoke(EditorActions,this),this.register({selectElements:function(){var rootElement=canvas.getRootElement(),elements=elementRegistry.filter(function(element){return element!==rootElement});return selection.select(elements),elements},spaceTool:function(){spaceTool.toggle()},lassoTool:function(){lassoTool.toggle()},handTool:function(){handTool.toggle()},globalConnectTool:function(){globalConnect.toggle()},distributeElements:function(opts){var currentSelection=selection.get(),type=opts.type;currentSelection.length&&distributeElements.trigger(currentSelection,type)},alignElements:function(opts){var currentSelection=selection.get(),aligneableElements=[],type=opts.type;currentSelection.length&&(aligneableElements=filter(currentSelection,function(element){return!is(element,"bpmn:Lane")}),alignElements.trigger(aligneableElements,type))},directEditing:function(){var currentSelection=selection.get();currentSelection.length&&directEditing.activate(currentSelection[0])},find:function(){searchPad.toggle()},moveToOrigin:function(){var boundingBox,elements,rootElement=canvas.getRootElement();elements=is(rootElement,"bpmn:Collaboration")?elementRegistry.filter(function(element){return is(element.parent,"bpmn:Collaboration")}):elementRegistry.filter(function(element){return element!==rootElement}),boundingBox=getBBox(elements),modeling.moveElements(elements,{x:-boundingBox.x,y:-boundingBox.y},rootElement)}})}var inherits=require("inherits"),EditorActions=require("diagram-js/lib/features/editor-actions/EditorActions"),filter=require("lodash/collection/filter"),is=require("../../util/ModelUtil").is,getBBox=require("diagram-js/lib/util/Elements").getBBox;inherits(BpmnEditorActions,EditorActions),BpmnEditorActions.$inject=["injector","canvas","elementRegistry","selection","spaceTool","lassoTool","handTool","globalConnect","distributeElements","alignElements","directEditing","searchPad","modeling"],module.exports=BpmnEditorActions},{"../../util/ModelUtil":157,"diagram-js/lib/features/editor-actions/EditorActions":223,"diagram-js/lib/util/Elements":326,inherits:351,"lodash/collection/filter":364}],82:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/align-elements"),require("diagram-js/lib/features/editor-actions"),require("diagram-js/lib/features/hand-tool"),require("diagram-js/lib/features/lasso-tool"),require("diagram-js/lib/features/space-tool"),require("../global-connect"),require("../copy-paste"),require("../distribute-elements"),require("../search"),require("../modeling")],editorActions:["type",require("./BpmnEditorActions")]}},{"../copy-paste":78,"../distribute-elements":80,"../global-connect":84,"../modeling":128,"../search":146,"./BpmnEditorActions":81,"diagram-js/lib/features/align-elements":193,"diagram-js/lib/features/editor-actions":224,"diagram-js/lib/features/hand-tool":228,"diagram-js/lib/features/lasso-tool":236,"diagram-js/lib/features/space-tool":300}],83:[function(require,module,exports){"use strict";function BpmnGlobalConnect(globalConnect){globalConnect.registerProvider(this)}function nonExistantOrLabel(element){return!element||isLabel(element)}function isLabel(element){return element.labelTarget}var isAny=require("../modeling/util/ModelingUtil").isAny;BpmnGlobalConnect.$inject=["globalConnect"],module.exports=BpmnGlobalConnect,BpmnGlobalConnect.prototype.canStartConnect=function(source){if(nonExistantOrLabel(source))return null;var businessObject=source.businessObject;return isAny(businessObject,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])}},{"../modeling/util/ModelingUtil":130}],84:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/global-connect")],__init__:["bpmnGlobalConnect"],bpmnGlobalConnect:["type",require("./BpmnGlobalConnect")]}},{"./BpmnGlobalConnect":83,"diagram-js/lib/features/global-connect":226}],85:[function(require,module,exports){"use strict";function BpmnKeyBindings(keyboard,editorActions){keyboard.addListener(function(key,modifiers){if(65===key&&keyboard.isCmd(modifiers))return editorActions.trigger("selectElements"),!0;if(70===key&&keyboard.isCmd(modifiers))return editorActions.trigger("find"),!0;if(!keyboard.hasModifier(modifiers))return 83===key?(editorActions.trigger("spaceTool"),!0):76===key?(editorActions.trigger("lassoTool"),!0):72===key?(editorActions.trigger("handTool"),!0):67===key?(editorActions.trigger("globalConnectTool"),!0):69===key?(editorActions.trigger("directEditing"),!0):void 0})}BpmnKeyBindings.$inject=["keyboard","editorActions"],module.exports=BpmnKeyBindings},{}],86:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/keyboard")],__init__:["bpmnKeyBindings"],bpmnKeyBindings:["type",require("./BpmnKeyBindings")]}},{"./BpmnKeyBindings":85,"diagram-js/lib/features/keyboard":232}],87:[function(require,module,exports){"use strict";function LabelEditingProvider(eventBus,canvas,directEditing,commandStack){this._canvas=canvas,this._commandStack=commandStack,directEditing.registerProvider(this),commandStack.registerHandler("element.updateLabel",UpdateLabelHandler),eventBus.on("element.dblclick",function(event){directEditing.activate(event.element)}),eventBus.on(["element.mousedown","drag.init","canvas.viewbox.changed"],function(event){directEditing.complete()}),eventBus.on(["commandStack.changed"],function(){directEditing.cancel()}),"ontouchstart"in document.documentElement||eventBus.on("create.end",500,function(e){var element=e.shape;e.context.canExecute&&(is(element,"bpmn:Task")||is(element,"bpmn:TextAnnotation")||is(element,"bpmn:SubProcess")&&!isExpanded(element))&&directEditing.activate(element)})}var UpdateLabelHandler=require("./cmd/UpdateLabelHandler"),LabelUtil=require("./LabelUtil"),is=require("../../util/ModelUtil").is,isExpanded=require("../../util/DiUtil").isExpanded;LabelEditingProvider.$inject=["eventBus","canvas","directEditing","commandStack"],module.exports=LabelEditingProvider,LabelEditingProvider.prototype.activate=function(element){var text=LabelUtil.getLabel(element);if(void 0!==text){var properties=this.getEditingBBox(element);return properties.text=text,properties}},LabelEditingProvider.prototype.getEditingBBox=function(element){var zoom,canvas=this._canvas,target=element.label||element,bbox=canvas.getAbsoluteBBox(target),mid={x:bbox.x+bbox.width/2,y:bbox.y+bbox.height/2},bounds={x:bbox.x,y:bbox.y},style={};return(is(element,"bpmn:Participant")&&isExpanded(element)||is(element,"bpmn:Lane"))&&(bounds.width=150,bounds.minHeight=20,bounds.maxHeight=34,bounds.x=bbox.x-bounds.width/2,bounds.y=mid.y-bounds.minHeight/2),(is(element,"bpmn:Task")||is(element,"bpmn:CallActivity")&&!isExpanded(element)||is(element,"bpmn:SubProcess")&&!isExpanded(element)||is(element,"bpmn:Participant")&&!isExpanded(element))&&(zoom=canvas.zoom(),zoom>1?(bounds.width=bbox.width,bounds.height=bbox.height):(bounds.width=bbox.width/zoom,bounds.height=bbox.height/zoom),zoom<1&&(bounds.x=bbox.x-(bounds.width/2-bbox.width/2),bounds.y=bbox.y-(bounds.height/2-bbox.height/2))),is(element,"bpmn:SubProcess")&&isExpanded(element)&&(bounds.width=element.width,bounds.maxHeight=48,bounds.x=mid.x-element.width/2),target.labelTarget&&(bounds.width=150,bounds.minHeight=20,bounds.x=mid.x-bounds.width/2),is(element,"bpmn:TextAnnotation")&&(bounds.minWidth=100,bounds.height=element.height,style.textAlign="left"),{bounds:bounds,style:style}},LabelEditingProvider.prototype.update=function(element,newLabel){this._commandStack.execute("element.updateLabel",{element:element,newLabel:newLabel})}},{"../../util/DiUtil":155,"../../util/ModelUtil":157,"./LabelUtil":88,"./cmd/UpdateLabelHandler":89}],88:[function(require,module,exports){"use strict";function getLabelAttr(semantic){return is(semantic,"bpmn:FlowElement")||is(semantic,"bpmn:Participant")||is(semantic,"bpmn:Lane")||is(semantic,"bpmn:SequenceFlow")||is(semantic,"bpmn:MessageFlow")?"name":is(semantic,"bpmn:TextAnnotation")?"text":void 0}var is=require("../../util/ModelUtil").is;module.exports.getLabel=function(element){var semantic=element.businessObject,attr=getLabelAttr(semantic);if(attr)return semantic[attr]||""},module.exports.setLabel=function(element,text,isExternal){var semantic=element.businessObject,attr=getLabelAttr(semantic);return attr&&(semantic[attr]=text),isExternal&&(element.hidden=!text),element}},{"../../util/ModelUtil":157}],89:[function(require,module,exports){"use strict";function UpdateLabelHandler(){function setText(element,text){var label=element.label||element,labelTarget=element.labelTarget||element;return LabelUtil.setLabel(label,text,labelTarget!==label),[label,labelTarget]}function execute(ctx){return ctx.oldLabel=LabelUtil.getLabel(ctx.element),setText(ctx.element,ctx.newLabel)}function revert(ctx){return setText(ctx.element,ctx.oldLabel)}this.execute=execute,this.revert=revert}var LabelUtil=require("../LabelUtil");module.exports=UpdateLabelHandler},{"../LabelUtil":88}],90:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/command"),require("diagram-js/lib/features/change-support"),require("diagram-js-direct-editing")],__init__:["labelEditingProvider"],labelEditingProvider:["type",require("./LabelEditingProvider")]}},{"./LabelEditingProvider":87,"diagram-js-direct-editing":174,"diagram-js/lib/command":181,"diagram-js/lib/features/change-support":207}],91:[function(require,module,exports){"use strict";function BpmnFactory(moddle){this._model=moddle}var map=require("lodash/collection/map"),assign=require("lodash/object/assign"),pick=require("lodash/object/pick");BpmnFactory.$inject=["moddle"],BpmnFactory.prototype._needsId=function(element){return element.$instanceOf("bpmn:RootElement")||element.$instanceOf("bpmn:FlowElement")||element.$instanceOf("bpmn:MessageFlow")||element.$instanceOf("bpmn:DataAssociation")||element.$instanceOf("bpmn:Artifact")||element.$instanceOf("bpmn:Participant")||element.$instanceOf("bpmn:Lane")||element.$instanceOf("bpmn:Process")||element.$instanceOf("bpmn:Collaboration")||element.$instanceOf("bpmndi:BPMNShape")||element.$instanceOf("bpmndi:BPMNEdge")||element.$instanceOf("bpmndi:BPMNDiagram")||element.$instanceOf("bpmndi:BPMNPlane")||element.$instanceOf("bpmn:Property")},BpmnFactory.prototype._ensureId=function(element){var prefix=(element.$type||"").replace(/^[^:]*:/g,"")+"_";!element.id&&this._needsId(element)&&(element.id=this._model.ids.nextPrefixed(prefix,element))},BpmnFactory.prototype.create=function(type,attrs){var element=this._model.create(type,attrs||{});return this._ensureId(element),element},BpmnFactory.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},BpmnFactory.prototype.createDiShape=function(semantic,bounds,attrs){return this.create("bpmndi:BPMNShape",assign({bpmnElement:semantic,bounds:this.createDiBounds(bounds)},attrs))},BpmnFactory.prototype.createDiBounds=function(bounds){return this.create("dc:Bounds",bounds)},BpmnFactory.prototype.createDiWaypoints=function(waypoints){return map(waypoints,function(pos){return this.createDiWaypoint(pos)},this)},BpmnFactory.prototype.createDiWaypoint=function(point){return this.create("dc:Point",pick(point,["x","y"]))},BpmnFactory.prototype.createDiEdge=function(semantic,waypoints,attrs){return this.create("bpmndi:BPMNEdge",assign({bpmnElement:semantic},attrs))},BpmnFactory.prototype.createDiPlane=function(semantic){return this.create("bpmndi:BPMNPlane",{bpmnElement:semantic})},module.exports=BpmnFactory},{"lodash/collection/map":370,"lodash/object/assign":499,"lodash/object/pick":508}],92:[function(require,module,exports){"use strict";function BpmnLayouter(){}function getAttachOrientation(attachedElement){var hostElement=attachedElement.host;return getOrientation(getMid(attachedElement),hostElement,-10)}function getConnectionDocking(point,shape){return point?point.original||point:getMid(shape)}function isCompensationAssociation(connection){var source=connection.source,target=connection.target;return is(target,"bpmn:Activity")&&is(source,"bpmn:BoundaryEvent")&&target.businessObject.isForCompensation}function isExpandedSubProcess(element){return is(element,"bpmn:SubProcess")&&isExpanded(element)}var inherits=require("inherits"),assign=require("lodash/object/assign"),BaseLayouter=require("diagram-js/lib/layout/BaseLayouter"),ManhattanLayout=require("diagram-js/lib/layout/ManhattanLayout"),LayoutUtil=require("diagram-js/lib/layout/LayoutUtil"),isExpanded=require("../../util/DiUtil").isExpanded,getMid=LayoutUtil.getMid,getOrientation=LayoutUtil.getOrientation,is=require("../../util/ModelUtil").is;inherits(BpmnLayouter,BaseLayouter),module.exports=BpmnLayouter,BpmnLayouter.prototype.layoutConnection=function(connection,hints){hints=hints||{};var manhattanOptions,updatedWaypoints,source=connection.source,target=connection.target,waypoints=connection.waypoints,start=hints.connectionStart,end=hints.connectionEnd;if(start||(start=getConnectionDocking(waypoints&&waypoints[0],source)), +end||(end=getConnectionDocking(waypoints&&waypoints[waypoints.length-1],target)),(is(connection,"bpmn:Association")||is(connection,"bpmn:DataAssociation"))&&waypoints&&!isCompensationAssociation(connection))return[].concat([start],waypoints.slice(1,-1),[end]);if(is(connection,"bpmn:MessageFlow"))manhattanOptions={preferredLayouts:["v:v"]},is(target,"bpmn:Participant")&&(manhattanOptions={preferredLayouts:["straight","v:v"]}),isExpandedSubProcess(target)&&(manhattanOptions={preferredLayouts:["straight","v:v"]}),isExpandedSubProcess(source)&&is(target,"bpmn:FlowNode")&&(manhattanOptions={preferredLayouts:["straight","v:v"],preserveDocking:isExpandedSubProcess(target)?"source":"target"}),is(source,"bpmn:Participant")&&is(target,"bpmn:FlowNode")&&(manhattanOptions={preferredLayouts:["straight","v:v"],preserveDocking:"target"}),is(target,"bpmn:Event")&&(manhattanOptions={preferredLayouts:["v:v"]});else if(is(connection,"bpmn:SequenceFlow")||isCompensationAssociation(connection))if(is(source,"bpmn:BoundaryEvent")){var orientation=getAttachOrientation(source);/left|right/.test(orientation)?manhattanOptions={preferredLayouts:["h:v"]}:/top|bottom/.test(orientation)&&(manhattanOptions={preferredLayouts:["v:h"]})}else manhattanOptions=is(source,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:is(target,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]};return manhattanOptions&&(manhattanOptions=assign(manhattanOptions,hints),updatedWaypoints=ManhattanLayout.repairConnection(source,target,start,end,waypoints,manhattanOptions)),updatedWaypoints||[start,end]}},{"../../util/DiUtil":155,"../../util/ModelUtil":157,"diagram-js/lib/layout/BaseLayouter":310,"diagram-js/lib/layout/LayoutUtil":312,"diagram-js/lib/layout/ManhattanLayout":313,inherits:351,"lodash/object/assign":499}],93:[function(require,module,exports){"use strict";function BpmnUpdater(eventBus,bpmnFactory,connectionDocking,translate){function cropConnection(e){var connection,context=e.context;context.cropped||(connection=context.connection,connection.waypoints=connectionDocking.getCroppedWaypoints(connection),context.cropped=!0)}function updateParent(e){var context=e.context;self.updateParent(context.shape||context.connection,context.oldParent)}function reverseUpdateParent(e){var context=e.context,element=context.shape||context.connection,oldParent=context.parent||context.newParent;self.updateParent(element,oldParent)}function updateRoot(event){var context=event.context,oldRoot=context.oldRoot,children=oldRoot.children;forEach(children,function(child){is(child,"bpmn:BaseElement")&&self.updateParent(child)})}function updateBounds(e){var shape=e.context.shape;is(shape,"bpmn:BaseElement")&&self.updateBounds(shape)}function updateConnection(e){self.updateConnection(e.context)}function updateConnectionWaypoints(e){self.updateConnectionWaypoints(e.context.connection)}function updateAttachment(e){self.updateAttachment(e.context)}CommandInterceptor.call(this,eventBus),this._bpmnFactory=bpmnFactory,this._translate=translate;var self=this;this.executed(["connection.layout","connection.create","connection.reconnectEnd","connection.reconnectStart"],cropConnection),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ifBpmn(updateParent)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ifBpmn(reverseUpdateParent)),this.executed(["canvas.updateRoot"],updateRoot),this.reverted(["canvas.updateRoot"],updateRoot),this.executed(["shape.move","shape.create","shape.resize"],ifBpmn(function(event){"label"!==event.context.shape.type&&updateBounds(event)})),this.reverted(["shape.move","shape.create","shape.resize"],ifBpmn(function(event){"label"!==event.context.shape.type&&updateBounds(event)})),eventBus.on("shape.changed",function(event){"label"===event.element.type&&updateBounds({context:{shape:event.element}})}),this.executed(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnection)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnection)),this.executed(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnectionWaypoints)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],ifBpmn(updateConnectionWaypoints)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],ifBpmn(function(e){var context=e.context,connection=context.connection,businessObject=getBusinessObject(connection),oldSource=getBusinessObject(context.oldSource),oldTarget=getBusinessObject(context.oldTarget),newSource=getBusinessObject(connection.source),newTarget=getBusinessObject(connection.target);oldSource!==newSource&&oldTarget!==newTarget&&(oldSource&&oldSource.default===businessObject&&(context.default=oldSource.default,oldSource.default=void 0),businessObject.sourceRef&&businessObject.sourceRef.default&&!(is(newTarget,"bpmn:Activity")||is(newTarget,"bpmn:EndEvent")||is(newTarget,"bpmn:Gateway")||is(newTarget,"bpmn:IntermediateThrowEvent"))&&(context.default=businessObject.sourceRef.default,businessObject.sourceRef.default=void 0),oldSource&&businessObject.conditionExpression&&!is(newSource,"bpmn:Activity")&&!is(newSource,"bpmn:Gateway")&&(context.conditionExpression=businessObject.conditionExpression,businessObject.conditionExpression=void 0),oldTarget&&businessObject.conditionExpression&&!(is(newTarget,"bpmn:Activity")||is(newTarget,"bpmn:EndEvent")||is(newTarget,"bpmn:Gateway")||is(newTarget,"bpmn:IntermediateThrowEvent"))&&(context.conditionExpression=businessObject.conditionExpression,businessObject.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],ifBpmn(function(e){var context=e.context,connection=context.connection,businessObject=getBusinessObject(connection),newSource=getBusinessObject(connection.source);context.default&&(is(newSource,"bpmn:ExclusiveGateway")||is(newSource,"bpmn:InclusiveGateway")||is(newSource,"bpmn:Activity"))&&(newSource.default=context.default),context.conditionExpression&&is(newSource,"bpmn:Activity")&&(businessObject.conditionExpression=context.conditionExpression)})),this.executed(["element.updateAttachment"],ifBpmn(updateAttachment)),this.reverted(["element.updateAttachment"],ifBpmn(updateAttachment))}function getDefinitions(element){for(;element&&!is(element,"bpmn:Definitions");)element=element.$parent;return element}function ifBpmn(fn){return function(event){var context=event.context,element=context.shape||context.connection;is(element,"bpmn:BaseElement")&&fn(event)}}var assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),inherits=require("inherits"),Collections=require("diagram-js/lib/util/Collections"),Model=require("diagram-js/lib/model"),getBusinessObject=require("../../util/ModelUtil").getBusinessObject,is=require("../../util/ModelUtil").is,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");inherits(BpmnUpdater,CommandInterceptor),module.exports=BpmnUpdater,BpmnUpdater.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],BpmnUpdater.prototype.updateAttachment=function(context){var shape=context.shape,businessObject=shape.businessObject,host=shape.host;businessObject.attachedToRef=host&&host.businessObject},BpmnUpdater.prototype.updateParent=function(element,oldParent){if(!(element instanceof Model.Label)){var parentShape=element.parent,businessObject=element.businessObject,parentBusinessObject=parentShape&&parentShape.businessObject,parentDi=parentBusinessObject&&parentBusinessObject.di;is(element,"bpmn:FlowNode")&&this.updateFlowNodeRefs(businessObject,parentBusinessObject,oldParent&&oldParent.businessObject),is(element,"bpmn:DataOutputAssociation")&&(parentBusinessObject=element.source?element.source.businessObject:null),is(element,"bpmn:DataInputAssociation")&&(parentBusinessObject=element.target?element.target.businessObject:null),this.updateSemanticParent(businessObject,parentBusinessObject),is(element,"bpmn:DataObjectReference")&&businessObject.dataObjectRef&&this.updateSemanticParent(businessObject.dataObjectRef,parentBusinessObject),this.updateDiParent(businessObject.di,parentDi)}},BpmnUpdater.prototype.updateBounds=function(shape){var di=shape.businessObject.di,bounds=shape instanceof Model.Label?this._getLabel(di).bounds:di.bounds;assign(bounds,{x:shape.x,y:shape.y,width:shape.width,height:shape.height})},BpmnUpdater.prototype.updateFlowNodeRefs=function(businessObject,newContainment,oldContainment){if(oldContainment!==newContainment){var oldRefs,newRefs;is(oldContainment,"bpmn:Lane")&&(oldRefs=oldContainment.get("flowNodeRef"),Collections.remove(oldRefs,businessObject)),is(newContainment,"bpmn:Lane")&&(newRefs=newContainment.get("flowNodeRef"),Collections.add(newRefs,businessObject))}},BpmnUpdater.prototype.updateDiConnection=function(di,newSource,newTarget){di.sourceElement&&di.sourceElement.bpmnElement!==newSource&&(di.sourceElement=newSource&&newSource.di),di.targetElement&&di.targetElement.bpmnElement!==newTarget&&(di.targetElement=newTarget&&newTarget.di)},BpmnUpdater.prototype.updateDiParent=function(di,parentDi){if(parentDi&&!is(parentDi,"bpmndi:BPMNPlane")&&(parentDi=parentDi.$parent),di.$parent!==parentDi){var planeElements=(parentDi||di.$parent).get("planeElement");parentDi?(planeElements.push(di),di.$parent=parentDi):(Collections.remove(planeElements,di),di.$parent=null)}},BpmnUpdater.prototype.getLaneSet=function(container){var laneSet,laneSets;return is(container,"bpmn:Lane")?(laneSet=container.childLaneSet,laneSet||(laneSet=this._bpmnFactory.create("bpmn:LaneSet"),container.childLaneSet=laneSet,laneSet.$parent=container),laneSet):(is(container,"bpmn:Participant")&&(container=container.processRef),laneSets=container.get("laneSets"),laneSet=laneSets[0],laneSet||(laneSet=this._bpmnFactory.create("bpmn:LaneSet"),laneSet.$parent=container,laneSets.push(laneSet)),laneSet)},BpmnUpdater.prototype.updateSemanticParent=function(businessObject,newParent,visualParent){var containment,translate=this._translate;if(businessObject.$parent!==newParent){if(is(businessObject,"bpmn:Lane"))newParent&&(newParent=this.getLaneSet(newParent)),containment="lanes";else if(is(businessObject,"bpmn:FlowElement")){if(newParent)if(is(newParent,"bpmn:Participant"))newParent=newParent.processRef;else if(is(newParent,"bpmn:Lane"))do{newParent=newParent.$parent.$parent}while(is(newParent,"bpmn:Lane"));containment="flowElements"}else if(is(businessObject,"bpmn:Artifact")){for(;newParent&&!is(newParent,"bpmn:Process")&&!is(newParent,"bpmn:SubProcess")&&!is(newParent,"bpmn:Collaboration");){if(is(newParent,"bpmn:Participant")){newParent=newParent.processRef;break}newParent=newParent.$parent}containment="artifacts"}else if(is(businessObject,"bpmn:MessageFlow"))containment="messageFlows";else if(is(businessObject,"bpmn:Participant")){containment="participants";var definitions,process=businessObject.processRef;process&&(definitions=getDefinitions(businessObject.$parent||newParent),businessObject.$parent&&(Collections.remove(definitions.get("rootElements"),process),process.$parent=null),newParent&&(Collections.add(definitions.get("rootElements"),process),process.$parent=definitions))}else is(businessObject,"bpmn:DataOutputAssociation")?containment="dataOutputAssociations":is(businessObject,"bpmn:DataInputAssociation")&&(containment="dataInputAssociations");if(!containment)throw new Error(translate("no parent for {element} in {parent}",{element:businessObject.id,parent:newParent.id}));var children;if(businessObject.$parent&&(children=businessObject.$parent.get(containment),Collections.remove(children,businessObject)),newParent?(children=newParent.get(containment),children.push(businessObject),businessObject.$parent=newParent):businessObject.$parent=null,visualParent){var diChildren=visualParent.get(containment);Collections.remove(children,businessObject),newParent&&(diChildren||(diChildren=[],newParent.set(containment,diChildren)),diChildren.push(businessObject))}}},BpmnUpdater.prototype.updateConnectionWaypoints=function(connection){connection.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(connection.waypoints))},BpmnUpdater.prototype.updateConnection=function(context){var visualParent,connection=context.connection,businessObject=getBusinessObject(connection),newSource=getBusinessObject(connection.source),newTarget=getBusinessObject(connection.target);if(is(businessObject,"bpmn:DataAssociation"))is(businessObject,"bpmn:DataInputAssociation")?(businessObject.get("sourceRef")[0]=newSource,visualParent=context.parent||context.newParent||newTarget,this.updateSemanticParent(businessObject,newTarget,parent.businessObject)):is(businessObject,"bpmn:DataOutputAssociation")&&(visualParent=context.parent||context.newParent||newSource,this.updateSemanticParent(businessObject,newSource,visualParent),businessObject.targetRef=newTarget);else{var inverseSet=is(businessObject,"bpmn:SequenceFlow");businessObject.sourceRef!==newSource&&(inverseSet&&(Collections.remove(businessObject.sourceRef&&businessObject.sourceRef.get("outgoing"),businessObject),newSource&&newSource.get("outgoing")&&newSource.get("outgoing").push(businessObject)),businessObject.sourceRef=newSource),businessObject.targetRef!==newTarget&&(inverseSet&&(Collections.remove(businessObject.targetRef&&businessObject.targetRef.get("incoming"),businessObject),newTarget&&newTarget.get("incoming")&&newTarget.get("incoming").push(businessObject)),businessObject.targetRef=newTarget)}this.updateConnectionWaypoints(connection),this.updateDiConnection(businessObject.di,newSource,newTarget)},BpmnUpdater.prototype._getLabel=function(di){return di.label||(di.label=this._bpmnFactory.createDiLabel()),di.label}},{"../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,"diagram-js/lib/model":314,"diagram-js/lib/util/Collections":323,inherits:351,"lodash/collection/forEach":366,"lodash/object/assign":499}],94:[function(require,module,exports){"use strict";function ElementFactory(bpmnFactory,moddle,translate){BaseElementFactory.call(this),this._bpmnFactory=bpmnFactory,this._moddle=moddle,this._translate=translate}var assign=require("lodash/object/assign"),inherits=require("inherits"),is=require("../../util/ModelUtil").is,isExpanded=require("../../util/DiUtil").isExpanded,BaseElementFactory=require("diagram-js/lib/core/ElementFactory"),LabelUtil=require("../../util/LabelUtil");inherits(ElementFactory,BaseElementFactory),ElementFactory.$inject=["bpmnFactory","moddle","translate"],module.exports=ElementFactory,ElementFactory.prototype.baseCreate=BaseElementFactory.prototype.create,ElementFactory.prototype.create=function(elementType,attrs){return"label"===elementType?this.baseCreate(elementType,assign({type:"label"},LabelUtil.DEFAULT_LABEL_SIZE,attrs)):this.createBpmnElement(elementType,attrs)},ElementFactory.prototype.createBpmnElement=function(elementType,attrs){var size,translate=this._translate;attrs=attrs||{};var businessObject=attrs.businessObject;if(!businessObject){if(!attrs.type)throw new Error(translate("no shape type specified"));businessObject=this._bpmnFactory.create(attrs.type)}businessObject.di||(businessObject.di="root"===elementType?this._bpmnFactory.createDiPlane(businessObject,[],{id:businessObject.id+"_di"}):"connection"===elementType?this._bpmnFactory.createDiEdge(businessObject,[],{id:businessObject.id+"_di"}):this._bpmnFactory.createDiShape(businessObject,{},{id:businessObject.id+"_di"})),attrs.processRef&&(businessObject.processRef=attrs.processRef),attrs.isExpanded&&(businessObject.di.isExpanded=attrs.isExpanded),is(businessObject,"bpmn:ExclusiveGateway")&&(businessObject.di.isMarkerVisible=!0),!1===attrs.isInterrupting&&(businessObject.isInterrupting=!1),attrs.associationDirection&&(businessObject.associationDirection=attrs.associationDirection);var eventDefinitions,newEventDefinition;return attrs.eventDefinitionType&&(eventDefinitions=businessObject.get("eventDefinitions")||[],newEventDefinition=this._moddle.create(attrs.eventDefinitionType),eventDefinitions.push(newEventDefinition),newEventDefinition.$parent=businessObject,businessObject.eventDefinitions=eventDefinitions),attrs.isForCompensation&&(businessObject.isForCompensation=!0),size=this._getDefaultSize(businessObject),attrs=assign({businessObject:businessObject,id:businessObject.id},size,attrs),this.baseCreate(elementType,attrs)},ElementFactory.prototype._getDefaultSize=function(semantic){return is(semantic,"bpmn:SubProcess")?isExpanded(semantic)?{width:350,height:200}:{width:100,height:80}:is(semantic,"bpmn:Task")?{width:100,height:80}:is(semantic,"bpmn:Gateway")?{width:50,height:50}:is(semantic,"bpmn:Event")?{width:36,height:36}:is(semantic,"bpmn:Participant")?isExpanded(semantic)?{width:600,height:250}:{width:400,height:100}:is(semantic,"bpmn:Lane")?{width:400,height:100}:is(semantic,"bpmn:DataObjectReference")?{width:36,height:50}:is(semantic,"bpmn:DataStoreReference")?{width:50,height:50}:is(semantic,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},ElementFactory.prototype.createParticipantShape=function(collapsed){var attrs={type:"bpmn:Participant"};return collapsed||(attrs.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(attrs)}},{"../../util/DiUtil":155,"../../util/LabelUtil":156,"../../util/ModelUtil":157,"diagram-js/lib/core/ElementFactory":183,inherits:351,"lodash/object/assign":499}],95:[function(require,module,exports){"use strict";function Modeling(eventBus,elementFactory,commandStack,bpmnRules){BaseModeling.call(this,eventBus,elementFactory,commandStack),this._bpmnRules=bpmnRules}var inherits=require("inherits"),BaseModeling=require("diagram-js/lib/features/modeling/Modeling"),UpdatePropertiesHandler=require("./cmd/UpdatePropertiesHandler"),UpdateCanvasRootHandler=require("./cmd/UpdateCanvasRootHandler"),AddLaneHandler=require("./cmd/AddLaneHandler"),SplitLaneHandler=require("./cmd/SplitLaneHandler"),ResizeLaneHandler=require("./cmd/ResizeLaneHandler"),UpdateFlowNodeRefsHandler=require("./cmd/UpdateFlowNodeRefsHandler"),IdClaimHandler=require("./cmd/IdClaimHandler");inherits(Modeling,BaseModeling),Modeling.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],module.exports=Modeling,Modeling.prototype.getHandlers=function(){var handlers=BaseModeling.prototype.getHandlers.call(this);return handlers["element.updateProperties"]=UpdatePropertiesHandler,handlers["canvas.updateRoot"]=UpdateCanvasRootHandler,handlers["lane.add"]=AddLaneHandler,handlers["lane.resize"]=ResizeLaneHandler,handlers["lane.split"]=SplitLaneHandler,handlers["lane.updateRefs"]=UpdateFlowNodeRefsHandler,handlers["id.updateClaim"]=IdClaimHandler,handlers},Modeling.prototype.updateLabel=function(element,newLabel){this._commandStack.execute("element.updateLabel",{element:element,newLabel:newLabel})},Modeling.prototype.connect=function(source,target,attrs,hints){var bpmnRules=this._bpmnRules;return attrs||(attrs=bpmnRules.canConnect(source,target)||{type:"bpmn:Association"}),this.createConnection(source,target,attrs,source.parent,hints)},Modeling.prototype.updateProperties=function(element,properties){this._commandStack.execute("element.updateProperties",{element:element,properties:properties})},Modeling.prototype.resizeLane=function(laneShape,newBounds,balanced){this._commandStack.execute("lane.resize",{shape:laneShape,newBounds:newBounds,balanced:balanced})},Modeling.prototype.addLane=function(targetLaneShape,location){var context={shape:targetLaneShape,location:location};return this._commandStack.execute("lane.add",context),context.newLane},Modeling.prototype.splitLane=function(targetLane,count){this._commandStack.execute("lane.split",{shape:targetLane,count:count})},Modeling.prototype.makeCollaboration=function(){var collaborationElement=this._create("root",{type:"bpmn:Collaboration"}),context={newRoot:collaborationElement};return this._commandStack.execute("canvas.updateRoot",context),collaborationElement},Modeling.prototype.updateLaneRefs=function(flowNodeShapes,laneShapes){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:flowNodeShapes,laneShapes:laneShapes})},Modeling.prototype.makeProcess=function(){var processElement=this._create("root",{type:"bpmn:Process"}),context={newRoot:processElement};this._commandStack.execute("canvas.updateRoot",context)},Modeling.prototype.claimId=function(id,moddleElement){this._commandStack.execute("id.updateClaim",{id:id,element:moddleElement,claiming:!0})},Modeling.prototype.unclaimId=function(id,moddleElement){this._commandStack.execute("id.updateClaim",{id:id,element:moddleElement})}},{"./cmd/AddLaneHandler":121,"./cmd/IdClaimHandler":122,"./cmd/ResizeLaneHandler":123,"./cmd/SplitLaneHandler":124,"./cmd/UpdateCanvasRootHandler":125,"./cmd/UpdateFlowNodeRefsHandler":126,"./cmd/UpdatePropertiesHandler":127,"diagram-js/lib/features/modeling/Modeling":237,inherits:351}],96:[function(require,module,exports){"use strict";function AppendBehavior(eventBus,elementFactory,bpmnRules){CommandInterceptor.call(this,eventBus),this.preExecute("shape.append",function(context){var source=context.source,shape=context.shape;context.position||(is(shape,"bpmn:TextAnnotation")?context.position={x:source.x+source.width/2+75,y:source.y-50-shape.height/2}:context.position={x:source.x+source.width+80+shape.width/2,y:source.y+source.height/2})},!0)}var inherits=require("inherits"),is=require("../../../util/ModelUtil").is,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");AppendBehavior.$inject=["eventBus","elementFactory","bpmnRules"],inherits(AppendBehavior,CommandInterceptor),module.exports=AppendBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],97:[function(require,module,exports){"use strict";function CopyPasteBehavior(eventBus,modeling,canvas){CommandInterceptor.call(this,eventBus),this.preExecute("elements.paste",1500,function(context){var topParent=context.topParent;if(topParent.parent||(context.topParent=canvas.getRootElement()),is(topParent,"bpmn:Lane"))do{topParent=context.topParent=topParent.parent}while(is(topParent,"bpmn:Lane")||!is(topParent,"bpmn:Participant"))},!0),this.postExecute("elements.paste",function(context){var tree=context.tree,createdElements=tree.createdElements;forEach(createdElements,function(data){var defaultFlow,element=data.element,businessObject=element.businessObject,descriptor=data.descriptor;(is(businessObject,"bpmn:ExclusiveGateway")||is(businessObject,"bpmn:InclusiveGateway")||is(businessObject,"bpmn:Activity"))&&descriptor.default&&(defaultFlow=createdElements[descriptor.default],defaultFlow=defaultFlow?defaultFlow.element:void 0,delete element.default,modeling.updateProperties(element,{default:defaultFlow}))})},!0)}var inherits=require("inherits"),forEach=require("lodash/collection/forEach"),is=require("../../../util/ModelUtil").is,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");CopyPasteBehavior.$inject=["eventBus","modeling","canvas"],inherits(CopyPasteBehavior,CommandInterceptor),module.exports=CopyPasteBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351,"lodash/collection/forEach":366}],98:[function(require,module,exports){"use strict";function CreateBoundaryEventBehavior(eventBus,modeling,elementFactory,bpmnFactory){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(context){var businessObject,boundaryEvent,shape=context.shape,host=context.host,attrs={cancelActivity:!0};host&&is(shape,"bpmn:IntermediateThrowEvent")&&(attrs.attachedToRef=host.businessObject,businessObject=bpmnFactory.create("bpmn:BoundaryEvent",attrs),boundaryEvent={type:"bpmn:BoundaryEvent",businessObject:businessObject},context.shape=elementFactory.createShape(boundaryEvent))},!0)}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;CreateBoundaryEventBehavior.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],inherits(CreateBoundaryEventBehavior,CommandInterceptor),module.exports=CreateBoundaryEventBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],99:[function(require,module,exports){"use strict";function CreateDataObjectBehavior(eventBus,bpmnFactory,moddle){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(event){var context=event.context,shape=context.shape;if(is(shape,"bpmn:DataObjectReference")&&"label"!==shape.type){var dataObject=bpmnFactory.create("bpmn:DataObject");shape.businessObject.dataObjectRef=dataObject}})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;CreateDataObjectBehavior.$inject=["eventBus","bpmnFactory","moddle"],inherits(CreateDataObjectBehavior,CommandInterceptor),module.exports=CreateDataObjectBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],100:[function(require,module,exports){"use strict";function copy(obj){return assign({},obj)}function CreateOnFlowBehavior(eventBus,bpmnRules,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(context){var parent=context.parent,shape=context.shape;bpmnRules.canInsert(shape,parent)&&(context.targetFlow=parent,context.parent=parent.parent)},!0),this.postExecute("shape.create",function(context){var source,target,reconnected,intersection,waypoints,waypointsBefore,waypointsAfter,dockingPoint,shape=context.shape,targetFlow=context.targetFlow,position=context.position;targetFlow&&(waypoints=targetFlow.waypoints,intersection=getApproxIntersection(waypoints,position),intersection&&(waypointsBefore=waypoints.slice(0,intersection.index),waypointsAfter=waypoints.slice(intersection.index+(intersection.bendpoint?1:0)),dockingPoint=intersection.bendpoint?waypoints[intersection.index]:position,waypointsBefore.push(copy(dockingPoint)),waypointsAfter.unshift(copy(dockingPoint))),source=targetFlow.source,target=targetFlow.target,bpmnRules.canConnect(source,shape,targetFlow)&&(modeling.reconnectEnd(targetFlow,shape,waypointsBefore||copy(position)),reconnected=!0),bpmnRules.canConnect(shape,target,targetFlow)&&(reconnected?modeling.connect(shape,target,{type:targetFlow.type,waypoints:waypointsAfter}):modeling.reconnectStart(targetFlow,shape,waypointsAfter||copy(position))))},!0)}var inherits=require("inherits"),assign=require("lodash/object/assign"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),getApproxIntersection=require("diagram-js/lib/util/LineIntersection").getApproxIntersection;inherits(CreateOnFlowBehavior,CommandInterceptor),CreateOnFlowBehavior.$inject=["eventBus","bpmnRules","modeling"],module.exports=CreateOnFlowBehavior},{"diagram-js/lib/command/CommandInterceptor":179,"diagram-js/lib/util/LineIntersection":332,inherits:351,"lodash/object/assign":499}],101:[function(require,module,exports){"use strict";function CreateParticipantBehavior(eventBus,modeling,elementFactory,bpmnFactory,canvas){CommandInterceptor.call(this,eventBus),this.preExecute("shape.create",function(context){var parent=context.parent,shape=context.shape,position=context.position,rootElement=canvas.getRootElement();if(is(parent,"bpmn:Process")&&is(shape,"bpmn:Participant")&&!is(rootElement,"bpmn:Collaboration")){var collaborationElement=modeling.makeCollaboration();context.position=position,context.parent=collaborationElement,context.processRoot=parent}},!0),this.execute("shape.create",function(context){var processRoot=context.processRoot,shape=context.shape;processRoot&&(context.oldProcessRef=shape.businessObject.processRef,shape.businessObject.processRef=processRoot.businessObject)},!0),this.revert("shape.create",function(context){var processRoot=context.processRoot,shape=context.shape;processRoot&&(shape.businessObject.processRef=context.oldProcessRef)},!0),this.postExecute("shape.create",function(context){var processRoot=context.processRoot,shape=context.shape;if(processRoot){var processChildren=processRoot.children.slice();modeling.moveElements(processChildren,{x:0,y:0},shape)}},!0)}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;CreateParticipantBehavior.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],inherits(CreateParticipantBehavior,CommandInterceptor),module.exports=CreateParticipantBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],102:[function(require,module,exports){"use strict";function DataInputAssociationBehavior(eventBus,bpmnFactory){function usesTargetRef(element,targetRef,removedConnection){var inputAssociations=element.get("dataInputAssociations");return find(inputAssociations,function(association){return association!==removedConnection&&association.targetRef===targetRef})}function getTargetRef(element,create){var properties=element.get("properties"),targetRefProp=find(properties,function(p){return p.name===TARGET_REF_PLACEHOLDER_NAME});return!targetRefProp&&create&&(targetRefProp=bpmnFactory.create("bpmn:Property",{name:TARGET_REF_PLACEHOLDER_NAME}),Collections.add(properties,targetRefProp)),targetRefProp}function cleanupTargetRef(element,connection){var targetRefProp=getTargetRef(element);targetRefProp&&(usesTargetRef(element,targetRefProp,connection)||Collections.remove(element.get("properties"),targetRefProp))}function fixTargetRef(event){var targetRefProp,context=event.context,connection=context.connection,connectionBo=connection.businessObject,target=connection.target,targetBo=target&&target.businessObject,newTarget=context.newTarget,newTargetBo=newTarget&&newTarget.businessObject,oldTarget=context.oldTarget||context.target,oldTargetBo=oldTarget&&oldTarget.businessObject,dataAssociation=connection.businessObject;oldTargetBo&&oldTargetBo!==targetBo&&cleanupTargetRef(oldTargetBo,connectionBo),newTargetBo&&newTargetBo!==targetBo&&cleanupTargetRef(newTargetBo,connectionBo),targetBo?(targetRefProp=getTargetRef(targetBo,!0),dataAssociation.targetRef=targetRefProp):dataAssociation.targetRef=null}CommandInterceptor.call(this,eventBus),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],ifDataInputAssociation(fixTargetRef)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],ifDataInputAssociation(fixTargetRef))}function ifDataInputAssociation(fn){return function(event){var context=event.context,connection=context.connection;if(is(connection,"bpmn:DataInputAssociation"))return fn(event)}}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),Collections=require("diagram-js/lib/util/Collections"),find=require("lodash/collection/find"),is=require("../../../util/ModelUtil").is,TARGET_REF_PLACEHOLDER_NAME="__targetRef_placeholder";DataInputAssociationBehavior.$inject=["eventBus","bpmnFactory"],inherits(DataInputAssociationBehavior,CommandInterceptor),module.exports=DataInputAssociationBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,"diagram-js/lib/util/Collections":323,inherits:351,"lodash/collection/find":365}],103:[function(require,module,exports){"use strict";function DeleteLaneBehavior(eventBus,modeling,spaceTool){function compensateLaneDelete(shape,oldParent){ +var siblings=getChildLanes(oldParent),topAffected=[],bottomAffected=[];if(eachElement(siblings,function(element){return element.y>shape.y?bottomAffected.push(element):topAffected.push(element),element.children}),siblings.length){var offset;offset=bottomAffected.length&&topAffected.length?shape.height/2:shape.height;var topAdjustments,bottomAdjustments;topAffected.length&&(topAdjustments=spaceTool.calculateAdjustments(topAffected,"y",offset,shape.y-10),spaceTool.makeSpace(topAdjustments.movingShapes,topAdjustments.resizingShapes,{x:0,y:offset},"s")),bottomAffected.length&&(bottomAdjustments=spaceTool.calculateAdjustments(bottomAffected,"y",-offset,shape.y+shape.height+10),spaceTool.makeSpace(bottomAdjustments.movingShapes,bottomAdjustments.resizingShapes,{x:0,y:-offset},"n"))}}CommandInterceptor.call(this,eventBus),this.postExecuted("shape.delete",LOW_PRIORITY,function(event){var context=event.context,hints=context.hints,shape=context.shape,oldParent=context.oldParent;is(shape,"bpmn:Lane")&&(hints&&hints.nested||compensateLaneDelete(shape,oldParent))})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is,getChildLanes=require("../util/LaneUtil").getChildLanes,eachElement=require("diagram-js/lib/util/Elements").eachElement,LOW_PRIORITY=500;DeleteLaneBehavior.$inject=["eventBus","modeling","spaceTool"],inherits(DeleteLaneBehavior,CommandInterceptor),module.exports=DeleteLaneBehavior},{"../../../util/ModelUtil":157,"../util/LaneUtil":129,"diagram-js/lib/command/CommandInterceptor":179,"diagram-js/lib/util/Elements":326,inherits:351}],104:[function(require,module,exports){"use strict";function ImportDockingFix(eventBus){function adjustDocking(startPoint,nextPoint,elementMid){var centerIntersect,elementTop={x:elementMid.x,y:elementMid.y-50},elementLeft={x:elementMid.x-50,y:elementMid.y},verticalIntersect=lineIntersect(startPoint,nextPoint,elementMid,elementTop),horizontalIntersect=lineIntersect(startPoint,nextPoint,elementMid,elementLeft);centerIntersect=verticalIntersect&&horizontalIntersect?getDistance(verticalIntersect,elementMid)>getDistance(horizontalIntersect,elementMid)?horizontalIntersect:verticalIntersect:verticalIntersect||horizontalIntersect,startPoint.original=centerIntersect}function fixDockings(connection){var waypoints=connection.waypoints;adjustDocking(waypoints[0],waypoints[1],getMid(connection.source)),adjustDocking(waypoints[waypoints.length-1],waypoints[waypoints.length-2],getMid(connection.target))}eventBus.on("bpmnElement.added",function(e){var element=e.element;element.waypoints&&fixDockings(element)})}function getDistance(p1,p2){return Math.sqrt(Math.pow(p1.x-p2.x,2)+Math.pow(p1.y-p2.y,2))}var getMid=require("diagram-js/lib/layout/LayoutUtil").getMid,lineIntersect=require("./util/LineIntersect");ImportDockingFix.$inject=["eventBus"],module.exports=ImportDockingFix},{"./util/LineIntersect":120,"diagram-js/lib/layout/LayoutUtil":312}],105:[function(require,module,exports){"use strict";function LabelSupport(eventBus,modeling,bpmnFactory){function getHiddenLabelAdjustment(event){var context=event.context,connection=context.connection,label=connection.label,labelPosition=getExternalLabelMid(connection);return{x:labelPosition.x-label.x-label.width/2,y:labelPosition.y-label.y-label.height/2}}function getVisibleLabelAdjustment(event){var command=event.command,context=event.context,connection=context.connection,label=connection.label,hints=assign({},context.hints),newWaypoints=context.newWaypoints||connection.waypoints,oldWaypoints=context.oldWaypoints;return void 0===hints.startChanged&&(hints.startChanged="connection.reconnectStart"===command),void 0===hints.endChanged&&(hints.endChanged="connection.reconnectEnd"===command),getLabelAdjustment(label,newWaypoints,oldWaypoints,hints)}CommandInterceptor.call(this,eventBus),this.postExecute(["shape.create","connection.create"],function(e){var position,context=e.context,element=context.shape||context.connection,businessObject=element.businessObject;hasExternalLabel(businessObject)&&(position=getExternalLabelMid(element),modeling.createLabel(element,position,{id:businessObject.id+"_label",hidden:!businessObject.name,businessObject:businessObject}))}),this.executed(["label.create"],function(event){var businessObject,di,element=event.context.shape;element.labelTarget&&is(element.labelTarget||element,"bpmn:BaseElement")&&(businessObject=element.businessObject,di=businessObject.di,di.label||(di.label=bpmnFactory.create("bpmndi:BPMNLabel",{bounds:bpmnFactory.create("dc:Bounds")})),assign(di.label.bounds,{x:element.x,y:element.y,width:element.width,height:element.height}))}),this.postExecute(["connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(event){var labelAdjustment,label=event.context.connection.label;label&&(labelAdjustment=label.hidden?getHiddenLabelAdjustment(event):getVisibleLabelAdjustment(event),modeling.moveShape(label,labelAdjustment))}),this.postExecute(["shape.replace"],function(event){var context=event.context,newShape=context.newShape,oldShape=context.oldShape,businessObject=getBusinessObject(newShape);businessObject&&hasExternalLabel(businessObject)&&(newShape.label.x=oldShape.label.x,newShape.label.y=oldShape.label.y)})}var assign=require("lodash/object/assign"),inherits=require("inherits"),LabelUtil=require("../../../util/LabelUtil"),LabelLayoutUtil=require("./util/LabelLayoutUtil"),ModelUtil=require("../../../util/ModelUtil"),is=ModelUtil.is,getBusinessObject=ModelUtil.getBusinessObject,hasExternalLabel=LabelUtil.hasExternalLabel,getExternalLabelMid=LabelUtil.getExternalLabelMid,getLabelAdjustment=LabelLayoutUtil.getLabelAdjustment,CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");inherits(LabelSupport,CommandInterceptor),LabelSupport.$inject=["eventBus","modeling","bpmnFactory"],module.exports=LabelSupport},{"../../../util/LabelUtil":156,"../../../util/ModelUtil":157,"./util/LabelLayoutUtil":118,"diagram-js/lib/command/CommandInterceptor":179,inherits:351,"lodash/object/assign":499}],106:[function(require,module,exports){"use strict";function ModelingFeedback(eventBus,tooltips,translate){function showError(position,message,timeout){tooltips.add({position:{x:position.x+5,y:position.y+5},type:"error",timeout:timeout||2e3,html:"
"+message+"
"})}eventBus.on(["shape.move.rejected","create.rejected"],function(event){var context=event.context,shape=context.shape,target=context.target;is(target,"bpmn:Collaboration")&&is(shape,"bpmn:FlowNode")&&showError(event,translate(COLLAB_ERR_MSG))}),eventBus.on(["elements.paste.rejected"],function(event){var context=event.context,position=context.position,target=context.target;is(target,"bpmn:Collaboration")&&showError(position,translate(COLLAB_ERR_MSG)),is(target,"bpmn:Process")&&showError(position,translate(PROCESS_ERR_MSG),3e3)})}var is=require("../../../util/ModelUtil").is,COLLAB_ERR_MSG="flow elements must be children of pools/participants",PROCESS_ERR_MSG="participants cannot be pasted onto a non-empty process diagram";ModelingFeedback.$inject=["eventBus","tooltips","translate"],module.exports=ModelingFeedback},{"../../../util/ModelUtil":157}],107:[function(require,module,exports){"use strict";function RemoveElementBehavior(eventBus,bpmnRules,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("shape.delete",function(e){var shape=e.context.shape;if(1==shape.incoming.length&&1==shape.outgoing.length){var inConnection=shape.incoming[0],outConnection=shape.outgoing[0];if(bpmnRules.canConnect(inConnection.source,outConnection.target,inConnection)){var newWaypoints=getNewWaypoints(inConnection.waypoints,outConnection.waypoints);modeling.reconnectEnd(inConnection,outConnection.target,newWaypoints)}}})}function getDocking(point){return point.original||point}function getNewWaypoints(inWaypoints,outWaypoints){var intersection=lineIntersect(getDocking(inWaypoints[inWaypoints.length-2]),getDocking(inWaypoints[inWaypoints.length-1]),getDocking(outWaypoints[1]),getDocking(outWaypoints[0]));return intersection?[].concat(inWaypoints.slice(0,inWaypoints.length-1),[intersection],outWaypoints.slice(1)):[getDocking(inWaypoints[0]),getDocking(outWaypoints[outWaypoints.length-1])]}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),lineIntersect=require("./util/LineIntersect");inherits(RemoveElementBehavior,CommandInterceptor),RemoveElementBehavior.$inject=["eventBus","bpmnRules","modeling"],module.exports=RemoveElementBehavior},{"./util/LineIntersect":120,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],108:[function(require,module,exports){"use strict";function RemoveParticipantBehavior(eventBus,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("shape.delete",function(context){var shape=context.shape,parent=shape.parent;is(shape,"bpmn:Participant")&&(context.collaborationRoot=parent)},!0),this.postExecute("shape.delete",function(context){var collaborationRoot=context.collaborationRoot;collaborationRoot&&!collaborationRoot.businessObject.participants.length&&modeling.makeProcess()},!0)}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;RemoveParticipantBehavior.$inject=["eventBus","modeling"],inherits(RemoveParticipantBehavior,CommandInterceptor),module.exports=RemoveParticipantBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],109:[function(require,module,exports){"use strict";function ReplaceConnectionBehavior(eventBus,modeling,bpmnRules){function fixConnection(connection){var source=connection.source,target=connection.target;if(connection.parent){var replacementType,remove;is(connection,"bpmn:SequenceFlow")&&(bpmnRules.canConnectSequenceFlow(source,target)||(remove=!0),bpmnRules.canConnectMessageFlow(source,target)&&(replacementType="bpmn:MessageFlow")),is(connection,"bpmn:MessageFlow")&&(bpmnRules.canConnectMessageFlow(source,target)||(remove=!0),bpmnRules.canConnectSequenceFlow(source,target)&&(replacementType="bpmn:SequenceFlow")),is(connection,"bpmn:Association")&&!bpmnRules.canConnectAssociation(source,target)&&(remove=!0),remove&&modeling.removeConnection(connection),replacementType&&modeling.connect(source,target,{type:replacementType,waypoints:connection.waypoints.slice()})}}CommandInterceptor.call(this,eventBus),this.postExecuted("elements.move",function(context){var closure=context.closure,allConnections=closure.allConnections;forEach(allConnections,fixConnection)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(event){fixConnection(event.context.connection)}),this.postExecuted("element.updateProperties",function(event){var connection,context=event.context,properties=context.properties,element=context.element,businessObject=element.businessObject;properties.default&&(connection=find(element.outgoing,{id:element.businessObject.default.id}))&&modeling.updateProperties(connection,{conditionExpression:void 0}),properties.conditionExpression&&businessObject.sourceRef.default===businessObject&&modeling.updateProperties(element.source,{default:void 0})})}var forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is;inherits(ReplaceConnectionBehavior,CommandInterceptor),ReplaceConnectionBehavior.$inject=["eventBus","modeling","bpmnRules"],module.exports=ReplaceConnectionBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351,"lodash/collection/find":365,"lodash/collection/forEach":366}],110:[function(require,module,exports){"use strict";function ReplaceElementBehaviour(eventBus,bpmnReplace,bpmnRules,elementRegistry,selection,modeling){CommandInterceptor.call(this,eventBus),this._bpmnReplace=bpmnReplace,this._elementRegistry=elementRegistry,this._selection=selection,this._modeling=modeling,this.postExecuted(["elements.move"],500,function(event){var context=event.context,target=context.newParent,newHost=context.newHost,elements=[];forEach(context.closure.topLevel,function(topLevelElements){elements=isEventSubProcess(topLevelElements)?elements.concat(topLevelElements.children):elements.concat(topLevelElements)}),1===elements.length&&newHost&&(target=newHost);var canReplace=bpmnRules.canReplace(elements,target);canReplace&&this.replaceElements(elements,canReplace.replacements,newHost)},this),this.postExecute(["shape.replace"],1500,function(e){var canReplace,context=e.context,oldShape=context.oldShape,newShape=context.newShape,attachers=oldShape.attachers;attachers&&attachers.length&&(canReplace=bpmnRules.canReplace(attachers,newShape),this.replaceElements(attachers,canReplace.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var context=e.context,oldShape=context.oldShape,newShape=context.newShape;modeling.unclaimId(oldShape.businessObject.id,oldShape.businessObject),modeling.updateProperties(newShape,{id:oldShape.id})})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),forEach=require("lodash/collection/forEach"),isEventSubProcess=require("../../../util/DiUtil").isEventSubProcess,is=require("../../../util/ModelUtil").is;inherits(ReplaceElementBehaviour,CommandInterceptor),ReplaceElementBehaviour.prototype.replaceElements=function(elements,newElements,newHost){var elementRegistry=this._elementRegistry,bpmnReplace=this._bpmnReplace,selection=this._selection,modeling=this._modeling;forEach(newElements,function(replacement){var newElement={type:replacement.newElementType},oldElement=elementRegistry.get(replacement.oldElementId);newHost&&is(oldElement,"bpmn:BoundaryEvent")&&modeling.updateAttachment(oldElement,null);var idx=elements.indexOf(oldElement);elements[idx]=bpmnReplace.replaceElement(oldElement,newElement,{select:!1}),newHost&&is(elements[idx],"bpmn:BoundaryEvent")&&modeling.updateAttachment(elements[idx],newHost)}),newElements&&selection.select(elements)},ReplaceElementBehaviour.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"],module.exports=ReplaceElementBehaviour},{"../../../util/DiUtil":155,"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351,"lodash/collection/forEach":366}],111:[function(require,module,exports){"use strict";function ResizeLaneBehavior(eventBus,modeling){eventBus.on("resize.start",SLIGHTLY_HIGHER_PRIORITY+500,function(event){var context=event.context,shape=context.shape;(is(shape,"bpmn:Lane")||is(shape,"bpmn:Participant"))&&(context.balanced=!hasPrimaryModifier(event))}),eventBus.on("resize.end",SLIGHTLY_HIGHER_PRIORITY,function(event){var context=event.context,shape=context.shape,canExecute=context.canExecute,newBounds=context.newBounds;if(is(shape,"bpmn:Lane")||is(shape,"bpmn:Participant"))return canExecute&&(newBounds=roundBounds(newBounds),modeling.resizeLane(shape,newBounds,context.balanced)),!1})}var is=require("../../../util/ModelUtil").is,roundBounds=require("diagram-js/lib/layout/LayoutUtil").roundBounds,hasPrimaryModifier=require("diagram-js/lib/util/Mouse").hasPrimaryModifier,SLIGHTLY_HIGHER_PRIORITY=1001;ResizeLaneBehavior.$inject=["eventBus","modeling"],module.exports=ResizeLaneBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/layout/LayoutUtil":312,"diagram-js/lib/util/Mouse":334}],112:[function(require,module,exports){"use strict";function ToggleElementCollapseBehaviour(eventBus,elementFactory,modeling,resize){function hideEmptyLables(children){children.length&&children.forEach(function(child){"label"!==child.type||child.businessObject.name||(child.hidden=!0)})}function expandedBounds(shape,defaultSize){var visibleElements,visibleBBox,children=shape.children,newBounds=defaultSize;return visibleElements=filterVisible(children).concat([shape]),visibleBBox=computeChildrenBBox(visibleElements),visibleBBox?(newBounds.width=Math.max(visibleBBox.width,newBounds.width),newBounds.height=Math.max(visibleBBox.height,newBounds.height),newBounds.x=visibleBBox.x+(visibleBBox.width-newBounds.width)/2,newBounds.y=visibleBBox.y+(visibleBBox.height-newBounds.height)/2):(newBounds.x=shape.x+(shape.width-newBounds.width)/2,newBounds.y=shape.y+(shape.height-newBounds.height)/2),newBounds}function collapsedBounds(shape,defaultSize){return{x:shape.x+(shape.width-defaultSize.width)/2,y:shape.y+(shape.height-defaultSize.height)/2,width:defaultSize.width,height:defaultSize.height}}CommandInterceptor.call(this,eventBus),this.executed(["shape.toggleCollapse"],LOW_PRIORITY,function(e){var context=e.context,shape=context.shape;is(shape,"bpmn:SubProcess")&&(shape.collapsed?getBusinessObject(shape).di.isExpanded=!1:(hideEmptyLables(shape.children),getBusinessObject(shape).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],LOW_PRIORITY,function(e){var context=e.context,shape=context.shape;shape.collapsed?getBusinessObject(shape).di.isExpanded=!1:getBusinessObject(shape).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],LOW_PRIORITY,function(e){var newBounds,shape=e.context.shape,defaultSize=elementFactory._getDefaultSize(shape);newBounds=shape.collapsed?collapsedBounds(shape,defaultSize):expandedBounds(shape,defaultSize),modeling.resizeShape(shape,newBounds)})}function filterVisible(elements){return elements.filter(function(e){return!e.hidden})}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),getBusinessObject=require("../../../util/ModelUtil").getBusinessObject,is=require("../../../util/ModelUtil").is,computeChildrenBBox=require("diagram-js/lib/features/resize/ResizeUtil").computeChildrenBBox,LOW_PRIORITY=500;inherits(ToggleElementCollapseBehaviour,CommandInterceptor),ToggleElementCollapseBehaviour.$inject=["eventBus","elementFactory","modeling"],module.exports=ToggleElementCollapseBehaviour},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,"diagram-js/lib/features/resize/ResizeUtil":283,inherits:351}],113:[function(require,module,exports){"use strict";function UnclaimIdBehavior(eventBus,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("elements.delete",function(event){var context=event.context,elements=context.elements;forEach(elements,function(element){modeling.unclaimId(element.businessObject.id,element.businessObject)})})}var forEach=require("lodash/collection/forEach"),inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor");inherits(UnclaimIdBehavior,CommandInterceptor),UnclaimIdBehavior.$inject=["eventBus","modeling"],module.exports=UnclaimIdBehavior},{"diagram-js/lib/command/CommandInterceptor":179,inherits:351,"lodash/collection/forEach":366}],114:[function(require,module,exports){"use strict";function DeleteSequenceFlowBehavior(eventBus,modeling){CommandInterceptor.call(this,eventBus),this.preExecute("connection.delete",function(event){var context=event.context,connection=context.connection,source=connection.source;isDefaultFlow(connection,source)&&modeling.updateProperties(source,{default:null})})}function isDefaultFlow(connection,source){if(!is(connection,"bpmn:SequenceFlow"))return!1;var sourceBo=getBusinessObject(source),sequenceFlow=getBusinessObject(connection);return sourceBo.get("default")===sequenceFlow}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is,getBusinessObject=require("../../../util/ModelUtil").getBusinessObject;inherits(DeleteSequenceFlowBehavior,CommandInterceptor),DeleteSequenceFlowBehavior.$inject=["eventBus","modeling"],module.exports=DeleteSequenceFlowBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],115:[function(require,module,exports){"use strict";function UpdateFlowNodeRefsBehavior(eventBus,modeling,translate){function initContext(){return context=context||new UpdateContext,context.enter(),context}function getContext(){if(!context)throw new Error(translate("out of bounds release"));return context}function releaseContext(){if(!context)throw new Error(translate("out of bounds release"));var triggerUpdate=context.leave();return triggerUpdate&&(modeling.updateLaneRefs(context.flowNodes,context.lanes),context=null),triggerUpdate}CommandInterceptor.call(this,eventBus);var context,laneRefUpdateEvents=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(laneRefUpdateEvents,HIGH_PRIORITY,function(event){initContext()}),this.postExecuted(laneRefUpdateEvents,LOW_PRIORITY,function(event){releaseContext()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(event){var context=event.context,shape=context.shape,updateContext=getContext();shape.labelTarget||(is(shape,"bpmn:Lane")&&updateContext.addLane(shape),is(shape,"bpmn:FlowNode")&&updateContext.addFlowNode(shape))})}function UpdateContext(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(lane){this.lanes.push(lane)},this.addFlowNode=function(flowNode){this.flowNodes.push(flowNode)},this.enter=function(){this.counter++},this.leave=function(){return!--this.counter}}var inherits=require("inherits"),CommandInterceptor=require("diagram-js/lib/command/CommandInterceptor"),is=require("../../../util/ModelUtil").is,LOW_PRIORITY=500,HIGH_PRIORITY=5e3;UpdateFlowNodeRefsBehavior.$inject=["eventBus","modeling","translate"],inherits(UpdateFlowNodeRefsBehavior,CommandInterceptor),module.exports=UpdateFlowNodeRefsBehavior},{"../../../util/ModelUtil":157,"diagram-js/lib/command/CommandInterceptor":179,inherits:351}],116:[function(require,module,exports){module.exports={__init__:["appendBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createOnFlowBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","importDockingFix","labelBehavior","modelingFeedback","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior","removeElementBehavior","unclaimIdBehavior","toggleElementCollapseBehaviour"],appendBehavior:["type",require("./AppendBehavior")],copyPasteBehavior:["type",require("./CopyPasteBehavior")],createBoundaryEventBehavior:["type",require("./CreateBoundaryEventBehavior")],createDataObjectBehavior:["type",require("./CreateDataObjectBehavior")],createOnFlowBehavior:["type",require("./CreateOnFlowBehavior")],createParticipantBehavior:["type",require("./CreateParticipantBehavior")],dataInputAssociationBehavior:["type",require("./DataInputAssociationBehavior")],deleteLaneBehavior:["type",require("./DeleteLaneBehavior")],importDockingFix:["type",require("./ImportDockingFix")],labelBehavior:["type",require("./LabelBehavior")],modelingFeedback:["type",require("./ModelingFeedback")],removeParticipantBehavior:["type",require("./RemoveParticipantBehavior")],replaceConnectionBehavior:["type",require("./ReplaceConnectionBehavior")],replaceElementBehaviour:["type",require("./ReplaceElementBehaviour")],resizeLaneBehavior:["type",require("./ResizeLaneBehavior")],unsetDefaultFlowBehavior:["type",require("./UnsetDefaultFlowBehavior")],updateFlowNodeRefsBehavior:["type",require("./UpdateFlowNodeRefsBehavior")],removeElementBehavior:["type",require("./RemoveElementBehavior")],unclaimIdBehavior:["type",require("./UnclaimIdBehavior")],toggleElementCollapseBehaviour:["type",require("./ToggleElementCollapseBehaviour")]}},{"./AppendBehavior":96,"./CopyPasteBehavior":97,"./CreateBoundaryEventBehavior":98,"./CreateDataObjectBehavior":99,"./CreateOnFlowBehavior":100,"./CreateParticipantBehavior":101,"./DataInputAssociationBehavior":102,"./DeleteLaneBehavior":103,"./ImportDockingFix":104,"./LabelBehavior":105,"./ModelingFeedback":106,"./RemoveElementBehavior":107,"./RemoveParticipantBehavior":108,"./ReplaceConnectionBehavior":109,"./ReplaceElementBehaviour":110,"./ResizeLaneBehavior":111,"./ToggleElementCollapseBehaviour":112,"./UnclaimIdBehavior":113,"./UnsetDefaultFlowBehavior":114,"./UpdateFlowNodeRefsBehavior":115}],117:[function(require,module,exports){"use strict";function vectorLength(v){return Math.sqrt(Math.pow(v.x,2)+Math.pow(v.y,2))}function getAngle(line){return Math.atan((line[1].y-line[0].y)/(line[1].x-line[0].x))}function rotateVector(vector,angle){return angle?{x:Math.cos(angle)*vector.x-Math.sin(angle)*vector.y,y:Math.sin(angle)*vector.x+Math.cos(angle)*vector.y}:vector}function solveLambaSystem(a,b,c){var system=[{n:a[0]-c[0],lambda:b[0]},{n:a[1]-c[1],lambda:b[1]}];return-(system[0].n*b[0]+system[1].n*b[1])/(system[0].lambda*b[0]+system[1].lambda*b[1])}function perpendicularFoot(point,line){var a=line[0],b=line[1],bd={x:b.x-a.x,y:b.y-a.y},r=solveLambaSystem([a.x,a.y],[bd.x,bd.y],[point.x,point.y]);return{x:a.x+r*bd.x,y:a.y+r*bd.y}}function getDistancePointLine(point,line){var pfPoint=perpendicularFoot(point,line);return vectorLength({x:pfPoint.x-point.x,y:pfPoint.y-point.y})}function getDistancePointPoint(point1,point2){return vectorLength({x:point1.x-point2.x,y:point1.y-point2.y})}module.exports.vectorLength=vectorLength,module.exports.getAngle=getAngle,module.exports.rotateVector=rotateVector,module.exports.perpendicularFoot=perpendicularFoot,module.exports.getDistancePointLine=getDistancePointLine,module.exports.getDistancePointPoint=getDistancePointPoint},{}],118:[function(require,module,exports){"use strict";function findNewLabelLineStartIndex(oldWaypoints,newWaypoints,attachment,hints){var index=attachment.segmentIndex,offset=newWaypoints.length-oldWaypoints.length;if(hints.segmentMove){var oldSegmentStartIndex=hints.segmentMove.segmentStartIndex,newSegmentStartIndex=hints.segmentMove.newSegmentStartIndex;return index===oldSegmentStartIndex?newSegmentStartIndex:index>=newSegmentStartIndex?index+offset=bendpointIndex&&(newIndex=insert?index+1:index-1),indexnewWaypoints.length-2)return{x:x,y:y};var oldLabelLine=getLine(oldWaypoints,oldLabelLineIndex),newLabelLine=getLine(newWaypoints,newLabelLineIndex),oldFoot=attachment.position,relativeFootPosition=getRelativeFootPosition(oldLabelLine,oldFoot),angleDelta=getAngleDelta(oldLabelLine,newLabelLine);if("bendpoint"===attachment.type){var offset=newWaypoints.length-oldWaypoints.length,oldBendpointIndex=attachment.bendpointIndex,oldBendpoint=oldWaypoints[oldBendpointIndex];if(-1!==newWaypoints.indexOf(oldBendpoint))return{x:x,y:y};if(0===offset){var newBendpoint=newWaypoints[oldBendpointIndex];return{x:newBendpoint.x-attachment.position.x,y:newBendpoint.y-attachment.position.y}}offset<0&&0!==oldBendpointIndex&&oldBendpointIndex line intersections");1===intersections.length&&(attachment={type:"bendpoint",position:intersections[0],segmentIndex:idx,bendpointIndex:pointsEqual(segmentStart,intersections[0])?idx:idx+1}),2===intersections.length&&(attachmentPosition=mid(intersections[0],intersections[1]),attachment={type:"segment",position:attachmentPosition,segmentIndex:idx,relativeLocation:getDistance(segmentStart,attachmentPosition)/getDistance(segmentStart,segmentEnd)}),attachmentDistance=getDistance(attachment.position,point),(!closestAttachment||closestAttachmentDistance>attachmentDistance)&&(closestAttachment=attachment,closestAttachmentDistance=attachmentDistance)}return closestAttachment}function getCircleSegmentIntersections(s1,s2,cc,cr){s1=roundPoint(s1),s2=roundPoint(s2),cc=roundPoint(cc),cr=min(getDistance(s1,cc),getDistance(s2,cc));var baX=s2.x-s1.x,baY=s2.y-s1.y,caX=cc.x-s1.x,caY=cc.y-s1.y,a=baX*baX+baY*baY,bBy2=baX*caX+baY*caY,c=caX*caX+caY*caY-cr*cr,pBy2=bBy2/a,q=c/a,disc=pBy2*pBy2-q;if(disc<0)return[];var tmpSqrt=sqrt(disc),abScalingFactor1=-pBy2+tmpSqrt,abScalingFactor2=-pBy2-tmpSqrt,i1={x:round(s1.x-baX*abScalingFactor1),y:round(s1.y-baY*abScalingFactor1)};return 0===disc?[i1]:[i1,{x:round(s1.x-baX*abScalingFactor2),y:round(s1.y-baY*abScalingFactor2)}].filter(function(p){return isPointInSegment(p,s1,s2)})}function isPointInSegment(p,segmentStart,segmentEnd){return fenced(p.x,segmentStart.x,segmentEnd.x)&&fenced(p.y,segmentStart.y,segmentEnd.y)}function fenced(n,rangeStart,rangeEnd){return min(rangeStart,rangeEnd)<=n&&n<=max(rangeStart,rangeEnd)}function mid(p1,p2){return{x:(p1.x+p2.x)/2,y:(p1.y+p2.y)/2}}function round(n){return Math.round(1e3*n)/1e3}function roundPoint(p){return{x:round(p.x),y:round(p.y)}} +function pointsEqual(p1,p2){return p1.x===p2.x&&p1.y===p2.y}var sqrt=Math.sqrt,min=Math.min,max=Math.max;module.exports.getAttachment=getAttachment},{}],120:[function(require,module,exports){"use strict";module.exports=function(l1s,l1e,l2s,l2e){var denominator,a,b,c,numerator;return 0==(denominator=(l2e.y-l2s.y)*(l1e.x-l1s.x)-(l2e.x-l2s.x)*(l1e.y-l1s.y))?null:(a=l1s.y-l2s.y,b=l1s.x-l2s.x,numerator=(l2e.x-l2s.x)*a-(l2e.y-l2s.y)*b,c=numerator/denominator,{x:Math.round(l1s.x+c*(l1e.x-l1s.x)),y:Math.round(l1s.y+c*(l1e.y-l1s.y))})}},{}],121:[function(require,module,exports){"use strict";function AddLaneHandler(modeling,spaceTool){this._modeling=modeling,this._spaceTool=spaceTool}var filter=require("lodash/collection/filter"),Elements=require("diagram-js/lib/util/Elements"),getLanesRoot=require("../util/LaneUtil").getLanesRoot,getChildLanes=require("../util/LaneUtil").getChildLanes,LANE_INDENTATION=require("../util/LaneUtil").LANE_INDENTATION;AddLaneHandler.$inject=["modeling","spaceTool"],module.exports=AddLaneHandler,AddLaneHandler.prototype.preExecute=function(context){var spaceTool=this._spaceTool,modeling=this._modeling,shape=context.shape,location=context.location,lanesRoot=getLanesRoot(shape),isRoot=lanesRoot===shape,laneParent=isRoot?shape:shape.parent;getChildLanes(laneParent).length||modeling.createShape({type:"bpmn:Lane"},{x:shape.x+LANE_INDENTATION,y:shape.y,width:shape.width-LANE_INDENTATION,height:shape.height},laneParent);var allAffected=[];Elements.eachElement(lanesRoot,function(element){return allAffected.push(element),element===shape?[]:filter(element.children,function(c){return c!==shape})});var offset="top"===location?-120:120,lanePosition="top"===location?shape.y:shape.y+shape.height,spacePos=lanePosition+("top"===location?10:-10),direction="top"===location?"n":"s",adjustments=spaceTool.calculateAdjustments(allAffected,"y",offset,spacePos);spaceTool.makeSpace(adjustments.movingShapes,adjustments.resizingShapes,{x:0,y:offset},direction),context.newLane=modeling.createShape({type:"bpmn:Lane"},{x:shape.x+(isRoot?LANE_INDENTATION:0),y:lanePosition-("top"===location?120:0),width:shape.width-(isRoot?LANE_INDENTATION:0),height:120},laneParent)}},{"../util/LaneUtil":129,"diagram-js/lib/util/Elements":326,"lodash/collection/filter":364}],122:[function(require,module,exports){"use strict";function IdClaimHandler(moddle){this._moddle=moddle}IdClaimHandler.$inject=["moddle"],module.exports=IdClaimHandler,IdClaimHandler.prototype.execute=function(context){var ids=this._moddle.ids,id=context.id,element=context.element;context.claiming?ids.claim(id,element):ids.unclaim(id)},IdClaimHandler.prototype.revert=function(context){var ids=this._moddle.ids,id=context.id,element=context.element;context.claiming?ids.unclaim(id):ids.claim(id,element)}},{}],123:[function(require,module,exports){"use strict";function ResizeLaneHandler(modeling,spaceTool){this._modeling=modeling,this._spaceTool=spaceTool}var is=require("../../../util/ModelUtil").is,getLanesRoot=require("../util/LaneUtil").getLanesRoot,computeLanesResize=require("../util/LaneUtil").computeLanesResize,eachElement=require("diagram-js/lib/util/Elements").eachElement,asTRBL=require("diagram-js/lib/layout/LayoutUtil").asTRBL,substractTRBL=require("diagram-js/lib/features/resize/ResizeUtil").substractTRBL;ResizeLaneHandler.$inject=["modeling","spaceTool"],module.exports=ResizeLaneHandler,ResizeLaneHandler.prototype.preExecute=function(context){var shape=context.shape,newBounds=context.newBounds;!1!==context.balanced?this.resizeBalanced(shape,newBounds):this.resizeSpace(shape,newBounds)},ResizeLaneHandler.prototype.resizeBalanced=function(shape,newBounds){var modeling=this._modeling,resizeNeeded=computeLanesResize(shape,newBounds);modeling.resizeShape(shape,newBounds),resizeNeeded.forEach(function(r){modeling.resizeShape(r.shape,r.newBounds)})},ResizeLaneHandler.prototype.resizeSpace=function(shape,newBounds){var spaceTool=this._spaceTool,shapeTrbl=asTRBL(shape),newTrbl=asTRBL(newBounds),trblDiff=substractTRBL(newTrbl,shapeTrbl),lanesRoot=getLanesRoot(shape),allAffected=[],allLanes=[];eachElement(lanesRoot,function(element){return allAffected.push(element),(is(element,"bpmn:Lane")||is(element,"bpmn:Participant"))&&allLanes.push(element),element.children});var change,spacePos,direction,offset,adjustments;(trblDiff.bottom||trblDiff.top)&&(change=trblDiff.bottom||trblDiff.top,spacePos=shape.y+(trblDiff.bottom?shape.height:0)+(trblDiff.bottom?-10:10),direction=trblDiff.bottom?"s":"n",offset=trblDiff.top>0||trblDiff.bottom<0?-change:change,adjustments=spaceTool.calculateAdjustments(allAffected,"y",offset,spacePos),spaceTool.makeSpace(adjustments.movingShapes,adjustments.resizingShapes,{x:0,y:change},direction)),(trblDiff.left||trblDiff.right)&&(change=trblDiff.right||trblDiff.left,spacePos=shape.x+(trblDiff.right?shape.width:0)+(trblDiff.right?-10:100),direction=trblDiff.right?"e":"w",offset=trblDiff.left>0||trblDiff.right<0?-change:change,adjustments=spaceTool.calculateAdjustments(allLanes,"x",offset,spacePos),spaceTool.makeSpace(adjustments.movingShapes,adjustments.resizingShapes,{x:change,y:0},direction))}},{"../../../util/ModelUtil":157,"../util/LaneUtil":129,"diagram-js/lib/features/resize/ResizeUtil":283,"diagram-js/lib/layout/LayoutUtil":312,"diagram-js/lib/util/Elements":326}],124:[function(require,module,exports){"use strict";function SplitLaneHandler(modeling,translate){this._modeling=modeling,this._translate=translate}var getChildLanes=require("../util/LaneUtil").getChildLanes,LANE_INDENTATION=require("../util/LaneUtil").LANE_INDENTATION;SplitLaneHandler.$inject=["modeling","translate"],module.exports=SplitLaneHandler,SplitLaneHandler.prototype.preExecute=function(context){var modeling=this._modeling,translate=this._translate,shape=context.shape,newLanesCount=context.count,childLanes=getChildLanes(shape),existingLanesCount=childLanes.length;if(existingLanesCount>newLanesCount)throw new Error(translate("more than {count} child lanes",{count:newLanesCount}));var laneY,laneHeight,laneBounds,newLaneAttrs,idx,newLanesHeight=Math.round(shape.height/newLanesCount);for(idx=0;idxlaneTrbl.left&&elementMid.xlaneTrbl.top&&elementMid.y0):!(is(target,"bpmn:Participant")&&!isExpanded(target))&&(is(target,"bpmn:FlowElementsContainer")?isExpanded(target):isAny(target,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]))}function isBoundaryEvent(element){return!isLabel(element)&&is(element,"bpmn:BoundaryEvent")}function isLane(element){return is(element,"bpmn:Lane")}function isBoundaryCandidate(element){return isBoundaryEvent(element)||is(element,"bpmn:IntermediateThrowEvent")&&!element.parent}function canAttach(elements,target,source,position){if(Array.isArray(elements)||(elements=[elements]),source)return!1;if(1!==elements.length)return!1;var element=elements[0];return!isLabel(element)&&(!!isBoundaryCandidate(element)&&(!target||!isEventSubProcess(target)&&(!(!is(target,"bpmn:Activity")||isForCompensation(target))&&(!(position&&!isBoundaryAttachment(position,target))&&"attach"))))}function canReplace(elements,target,position){if(!target)return!1;var canExecute={replacements:[]};return forEach(elements,function(element){isEventSubProcess(target)||is(element,"bpmn:StartEvent")&&"label"!==element.type&&canDrop(element,target)&&(isInterrupting(element)||canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:StartEvent"}), +(hasErrorEventDefinition(element)||hasEscalationEventDefinition(element)||hasCompensateEventDefinition(element))&&canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:StartEvent"})),is(target,"bpmn:Transaction")||hasEventDefinition(element,"bpmn:CancelEventDefinition")&&"label"!==element.type&&(is(element,"bpmn:EndEvent")&&canDrop(element,target)&&canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:EndEvent"}),is(element,"bpmn:BoundaryEvent")&&canAttach(element,target,null,position)&&canExecute.replacements.push({oldElementId:element.id,newElementType:"bpmn:BoundaryEvent"}))}),!!canExecute.replacements.length&&canExecute}function canMove(elements,target){return!any(elements,isBoundaryEvent)&&(!any(elements,isLane)&&(!target||elements.every(function(element){return canDrop(element,target)})))}function canCreate(shape,target,source,position){return!!target&&(isLabel(target)?null:!isSame(source,target)&&((!source||!isParent(source,target))&&(canDrop(shape,target,position)||canInsert(shape,target,position))))}function canResize(shape,newBounds){return is(shape,"bpmn:SubProcess")?!!isExpanded(shape)&&(!newBounds||newBounds.width>=100&&newBounds.height>=80):is(shape,"bpmn:Lane")?!newBounds||newBounds.width>=130&&newBounds.height>=60:is(shape,"bpmn:Participant")?!newBounds||newBounds.width>=250&&newBounds.height>=50:!!isTextAnnotation(shape)}function canConnectAssociation(source,target){return!isConnection(source)&&!isConnection(target)&&(!isParent(target,source)&&!isParent(source,target))}function canConnectMessageFlow(source,target){return isMessageFlowSource(source)&&isMessageFlowTarget(target)&&!isSameOrganization(source,target)}function canConnectSequenceFlow(source,target){return isSequenceFlowSource(source)&&isSequenceFlowTarget(target)&&isSameScope(source,target)&&!(is(source,"bpmn:EventBasedGateway")&&!isEventBasedTarget(target))}function canConnectDataAssociation(source,target){return isAny(source,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&isAny(target,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!isAny(target,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!isAny(source,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function canInsert(shape,flow,position){return isAny(flow,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&is(shape,"bpmn:FlowNode")&&!is(shape,"bpmn:BoundaryEvent")&&canDrop(shape,flow.parent,position)}function contains(collection,element){return collection&&element&&-1!==collection.indexOf(element)}function canCopy(collection,element){return!(is(element,"bpmn:Lane")&&!contains(collection,element.parent))&&!(is(element,"bpmn:BoundaryEvent")&&!contains(collection,element.host))}var find=require("lodash/collection/find"),any=require("lodash/collection/any"),every=require("lodash/collection/every"),filter=require("lodash/collection/filter"),forEach=require("lodash/collection/forEach"),inherits=require("inherits"),getParents=require("../modeling/util/ModelingUtil").getParents,is=require("../../util/ModelUtil").is,isAny=require("../modeling/util/ModelingUtil").isAny,getBusinessObject=require("../../util/ModelUtil").getBusinessObject,isExpanded=require("../../util/DiUtil").isExpanded,isEventSubProcess=require("../../util/DiUtil").isEventSubProcess,isInterrupting=require("../../util/DiUtil").isInterrupting,hasErrorEventDefinition=require("../../util/DiUtil").hasErrorEventDefinition,hasEscalationEventDefinition=require("../../util/DiUtil").hasEscalationEventDefinition,hasCompensateEventDefinition=require("../../util/DiUtil").hasCompensateEventDefinition,RuleProvider=require("diagram-js/lib/features/rules/RuleProvider"),isBoundaryAttachment=require("../snapping/BpmnSnappingUtil").getBoundaryAttachment;inherits(BpmnRules,RuleProvider),BpmnRules.$inject=["eventBus"],module.exports=BpmnRules,BpmnRules.prototype.init=function(){this.addRule("connection.create",function(context){return canConnect(context.source,context.target)}),this.addRule("connection.reconnectStart",function(context){var connection=context.connection;return canConnect(context.hover||context.source,connection.target,connection)}),this.addRule("connection.reconnectEnd",function(context){var connection=context.connection;return canConnect(connection.source,context.hover||context.target,connection)}),this.addRule("connection.updateWaypoints",function(context){return null}),this.addRule("shape.resize",function(context){return canResize(context.shape,context.newBounds)}),this.addRule("elements.move",function(context){var target=context.target,shapes=context.shapes,position=context.position;return canAttach(shapes,target,null,position)||canReplace(shapes,target,position)||canMove(shapes,target)}),this.addRule(["shape.create","shape.append"],function(context){var target=context.target,shape=context.shape,source=context.source,position=context.position;return canAttach([shape],target,source,position)||canCreate(shape,target,source,position)}),this.addRule("element.copy",function(context){return canCopy(context.collection,context.element)}),this.addRule("element.paste",function(context){var parent=context.parent,element=context.element,position=context.position,source=context.source,target=context.target;return source||target?canConnect(source,target):canAttach([element],parent,null,position)||canCreate(element,parent,null,position)}),this.addRule("elements.paste",function(context){return canPaste(context.tree,context.target)}),this.addRule(["elements.delete"],function(context){return filter(context.elements,function(e){return!isLabel(e)})})},BpmnRules.prototype.canConnectMessageFlow=canConnectMessageFlow,BpmnRules.prototype.canConnectSequenceFlow=canConnectSequenceFlow,BpmnRules.prototype.canConnectDataAssociation=canConnectDataAssociation,BpmnRules.prototype.canConnectAssociation=canConnectAssociation,BpmnRules.prototype.canMove=canMove,BpmnRules.prototype.canAttach=canAttach,BpmnRules.prototype.canReplace=canReplace,BpmnRules.prototype.canDrop=canDrop,BpmnRules.prototype.canInsert=canInsert,BpmnRules.prototype.canCreate=canCreate,BpmnRules.prototype.canConnect=canConnect,BpmnRules.prototype.canResize=canResize,BpmnRules.prototype.canCopy=canCopy},{"../../util/DiUtil":155,"../../util/ModelUtil":157,"../modeling/util/ModelingUtil":130,"../snapping/BpmnSnappingUtil":148,"diagram-js/lib/features/rules/RuleProvider":285,inherits:351,"lodash/collection/any":362,"lodash/collection/every":363,"lodash/collection/filter":364,"lodash/collection/find":365,"lodash/collection/forEach":366}],144:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/features/rules")],__init__:["bpmnRules"],bpmnRules:["type",require("./BpmnRules")]}},{"./BpmnRules":143,"diagram-js/lib/features/rules":287}],145:[function(require,module,exports){"use strict";function BpmnSearchProvider(elementRegistry,searchPad,canvas){this._elementRegistry=elementRegistry,this._canvas=canvas,searchPad.registerProvider(this)}function hasMatched(tokens){return filter(tokens,function(t){return!!t.matched}).length>0}function matchAndSplit(text,pattern){var tokens=[],originalText=text;if(!text)return tokens;text=text.toLowerCase(),pattern=pattern.toLowerCase();var i=text.indexOf(pattern);return i>-1?(0!==i&&tokens.push({normal:originalText.substr(0,i)}),tokens.push({matched:originalText.substr(i,pattern.length)}),pattern.length+iy&&(insert=abs(laneTrbl.top-y)>abs(laneTrbl.bottom-y)?assign(insert||{},{after:{element:l,y:laneTrbl.bottom}}):assign(insert||{},{before:{element:l,y:laneTrbl.top}})),insert},!1);insert||(targetTrbl=asTRBL(target),insert=abs(targetTrbl.top-y)<30?{before:{element:target,y:targetTrbl.top}}:abs(targetTrbl.bottom-y)<30?{after:{element:target,y:targetTrbl.bottom}}:{into:{element:target,y:(targetTrbl.top+targetTrbl.bottom)/2}}),insert.before&&insert.after?(console.log("insert between",insert.before.element.id,"and",insert.after.element.id),setSnapped(event,"x",insert.before.element.x+insert.before.element.width/2),setSnapped(event,"y",insert.before.y)):insert.after?(console.log("insert after",insert.after.element.id),setSnapped(event,"x",insert.after.element.x+insert.after.element.width/2),setSnapped(event,"y",insert.after.y)):insert.before?(console.log("insert before",insert.before.element.id),setSnapped(event,"x",insert.before.element.x+insert.before.element.width/2),setSnapped(event,"y",insert.before.y)):insert.into&&(console.log("insert into",insert.into.element.id),setSnapped(event,"x",insert.into.element.x+insert.into.element.width/2),setSnapped(event,"y",insert.into.y))}}),eventBus.on("resize.start",HIGH_PRIORITY,function(event){var context=event.context,shape=context.shape;is(shape,"bpmn:SubProcess")&&isExpanded(shape)&&(context.minDimensions={width:140,height:120}),is(shape,"bpmn:Participant")&&(context.minDimensions={width:300,height:150}),(is(shape,"bpmn:Lane")||is(shape,"bpmn:Participant"))&&(context.resizeConstraints=getParticipantSizeConstraints(shape,context.direction,context.balanced)),is(shape,"bpmn:TextAnnotation")&&(context.minDimensions={width:50,height:30})})}function initParticipantSnapping(context,shape,elements){if(elements.length){var snapBox=getBoundingBox(elements.filter(function(e){return!e.labelTarget&&!e.waypoints}));snapBox.x-=50,snapBox.y-=20,snapBox.width+=70,snapBox.height+=40,shape.width=Math.max(shape.width,snapBox.width),shape.height=Math.max(shape.height,snapBox.height),context.participantSnapBox=snapBox}}function snapParticipant(snapBox,shape,event,offset){offset=offset||0;var shapeHalfWidth=shape.width/2-offset,shapeHalfHeight=shape.height/2,currentTopLeft={x:event.x-shapeHalfWidth-offset,y:event.y-shapeHalfHeight},currentBottomRight={x:event.x+shapeHalfWidth+offset,y:event.y+shapeHalfHeight},snapTopLeft=snapBox,snapBottomRight=bottomRight(snapBox);currentTopLeft.x>=snapTopLeft.x?setSnapped(event,"x",snapTopLeft.x+offset+shapeHalfWidth):currentBottomRight.x<=snapBottomRight.x&&setSnapped(event,"x",snapBottomRight.x-offset-shapeHalfWidth),currentTopLeft.y>=snapTopLeft.y?setSnapped(event,"y",snapTopLeft.y+shapeHalfHeight):currentBottomRight.y<=snapBottomRight.y&&setSnapped(event,"y",snapBottomRight.y-shapeHalfHeight)}function snapBoundaryEvent(event,shape,target){var targetTRBL=asTRBL(target),direction=getBoundaryAttachment(event,target);/top/.test(direction)?setSnapped(event,"y",targetTRBL.top):/bottom/.test(direction)&&setSnapped(event,"y",targetTRBL.bottom),/left/.test(direction)?setSnapped(event,"x",targetTRBL.left):/right/.test(direction)&&setSnapped(event,"x",targetTRBL.right)}var inherits=require("inherits"),abs=Math.abs,forEach=require("lodash/collection/forEach"),filter=require("lodash/collection/filter"),assign=require("lodash/object/assign"),getBoundingBox=require("diagram-js/lib/util/Elements").getBBox,is=require("../../util/ModelUtil").is,isAny=require("../modeling/util/ModelingUtil").isAny,isExpanded=require("../../util/DiUtil").isExpanded,Snapping=require("diagram-js/lib/features/snapping/Snapping"),SnapUtil=require("diagram-js/lib/features/snapping/SnapUtil"),asTRBL=require("diagram-js/lib/layout/LayoutUtil").asTRBL,round=Math.round,mid=SnapUtil.mid,topLeft=SnapUtil.topLeft,bottomRight=SnapUtil.bottomRight,isSnapped=SnapUtil.isSnapped,setSnapped=SnapUtil.setSnapped,getBoundaryAttachment=require("./BpmnSnappingUtil").getBoundaryAttachment,getParticipantSizeConstraints=require("./BpmnSnappingUtil").getParticipantSizeConstraints,getLanesRoot=require("../modeling/util/LaneUtil").getLanesRoot,HIGH_PRIORITY=1500;inherits(BpmnSnapping,Snapping),BpmnSnapping.$inject=["eventBus","canvas","bpmnRules","elementRegistry"],module.exports=BpmnSnapping,BpmnSnapping.prototype.initSnap=function(event){var shapeMid,shapeBounds,shapeTopLeft,shapeBottomRight,snapContext,context=event.context,shape=event.shape;snapContext=Snapping.prototype.initSnap.call(this,event),is(shape,"bpmn:Participant")&&snapContext.setSnapLocations(["top-left","bottom-right","mid"]),shape&&(shapeMid=mid(shape,event),shapeBounds={width:shape.width,height:shape.height,x:isNaN(shape.x)?round(shapeMid.x-shape.width/2):shape.x,y:isNaN(shape.y)?round(shapeMid.y-shape.height/2):shape.y},shapeTopLeft=topLeft(shapeBounds),shapeBottomRight=bottomRight(shapeBounds),snapContext.setSnapOrigin("top-left",{x:shapeTopLeft.x-event.x,y:shapeTopLeft.y-event.y}),snapContext.setSnapOrigin("bottom-right",{x:shapeBottomRight.x-event.x,y:shapeBottomRight.y-event.y}),forEach(shape.outgoing,function(c){var docking=c.waypoints[0];docking=docking.original||docking,snapContext.setSnapOrigin(c.id+"-docking",{x:docking.x-event.x,y:docking.y-event.y})}),forEach(shape.incoming,function(c){var docking=c.waypoints[c.waypoints.length-1];docking=docking.original||docking,snapContext.setSnapOrigin(c.id+"-docking",{x:docking.x-event.x,y:docking.y-event.y})}));var source=context.source;source&&snapContext.addDefaultSnap("mid",mid(source))},BpmnSnapping.prototype.addTargetSnaps=function(snapPoints,shape,target){is(shape,"bpmn:BoundaryEvent")&&"label"!==shape.type&&(target=target.parent),is(target,"bpmn:SequenceFlow")&&this.addTargetSnaps(snapPoints,shape,target.parent);var siblings=this.getSiblings(shape,target)||[];forEach(siblings,function(s){is(s,"bpmn:Lane")||(snapPoints.add("mid",mid(s)),is(s,"bpmn:Participant")&&(snapPoints.add("top-left",topLeft(s)),snapPoints.add("bottom-right",bottomRight(s))))}),forEach(shape.incoming,function(c){-1===siblings.indexOf(c.source)&&snapPoints.add("mid",mid(c.source));var docking=c.waypoints[0];snapPoints.add(c.id+"-docking",docking.original||docking)}),forEach(shape.outgoing,function(c){-1===siblings.indexOf(c.target)&&snapPoints.add("mid",mid(c.target));var docking=c.waypoints[c.waypoints.length-1];snapPoints.add(c.id+"-docking",docking.original||docking)})}},{"../../util/DiUtil":155,"../../util/ModelUtil":157,"../modeling/util/LaneUtil":129,"../modeling/util/ModelingUtil":130,"./BpmnSnappingUtil":148,"diagram-js/lib/features/snapping/SnapUtil":295,"diagram-js/lib/features/snapping/Snapping":296,"diagram-js/lib/layout/LayoutUtil":312,"diagram-js/lib/util/Elements":326,inherits:351,"lodash/collection/filter":364,"lodash/collection/forEach":366,"lodash/object/assign":499}],148:[function(require,module,exports){"use strict";function getBoundaryAttachment(position,targetBounds){var orientation=getOrientation(position,targetBounds,-15);return"intersect"!==orientation?orientation:null}function addToTrbl(trbl,attr,value,choice){var current=trbl[attr];trbl[attr]=void 0===current?value:choice(value,current)}function addMin(trbl,attr,value){return addToTrbl(trbl,attr,value,min)}function addMax(trbl,attr,value){return addToTrbl(trbl,attr,value,max)}function getParticipantSizeConstraints(laneShape,resizeDirection,balanced){var lanesRoot=getLanesRoot(laneShape),isFirst=!0,isLast=!0,allLanes=collectLanes(lanesRoot,[lanesRoot]),laneTrbl=asTRBL(laneShape),maxTrbl={},minTrbl={};return/e/.test(resizeDirection)?minTrbl.right=laneTrbl.left+LANE_MIN_WIDTH:/w/.test(resizeDirection)&&(minTrbl.left=laneTrbl.right-LANE_MIN_WIDTH),allLanes.forEach(function(other){var otherTrbl=asTRBL(other);/n/.test(resizeDirection)&&(otherTrbl.toplaneTrbl.bottom+10&&(isLast=!1),balanced&&abs(laneTrbl.bottom-otherTrbl.top)<10&&addMin(maxTrbl,"bottom",otherTrbl.bottom-LANE_MIN_HEIGHT),abs(laneTrbl.bottom-otherTrbl.bottom)<5&&addMax(minTrbl,"bottom",otherTrbl.top+LANE_MIN_HEIGHT))}),lanesRoot.children.filter(function(s){return!s.hidden&&!s.waypoints&&(is(s,"bpmn:FlowElement")||is(s,"bpmn:Artifact"))}).forEach(function(flowElement){var flowElementTrbl=asTRBL(flowElement);isFirst&&/n/.test(resizeDirection)&&addMin(minTrbl,"top",flowElementTrbl.top-LANE_TOP_PADDING),/e/.test(resizeDirection)&&addMax(minTrbl,"right",flowElementTrbl.right+LANE_RIGHT_PADDING),isLast&&/s/.test(resizeDirection)&&addMax(minTrbl,"bottom",flowElementTrbl.bottom+LANE_BOTTOM_PADDING),/w/.test(resizeDirection)&&addMin(minTrbl,"left",flowElementTrbl.left-LANE_LEFT_PADDING)}),{min:minTrbl,max:maxTrbl}}var getOrientation=require("diagram-js/lib/layout/LayoutUtil").getOrientation;module.exports.getBoundaryAttachment=getBoundaryAttachment;var is=require("../../util/ModelUtil").is,asTRBL=require("diagram-js/lib/layout/LayoutUtil").asTRBL,collectLanes=require("../modeling/util/LaneUtil").collectLanes,getLanesRoot=require("../modeling/util/LaneUtil").getLanesRoot,abs=Math.abs,min=Math.min,max=Math.max,LANE_MIN_HEIGHT=60,LANE_MIN_WIDTH=300,LANE_RIGHT_PADDING=20,LANE_LEFT_PADDING=50,LANE_TOP_PADDING=20,LANE_BOTTOM_PADDING=20;module.exports.getParticipantSizeConstraints=getParticipantSizeConstraints},{"../../util/ModelUtil":157,"../modeling/util/LaneUtil":129,"diagram-js/lib/layout/LayoutUtil":312}],149:[function(require,module,exports){module.exports={__init__:["snapping"],snapping:["type",require("./BpmnSnapping")]}},{"./BpmnSnapping":147}],150:[function(require,module,exports){"use strict";function elementData(semantic,attrs){return assign({id:semantic.id,type:semantic.$type,businessObject:semantic},attrs)}function collectWaypoints(waypoints){return map(waypoints,function(p){return{x:p.x,y:p.y}})}function notYetDrawn(translate,semantic,refSemantic,property){return new Error(translate("element {element} referenced by {referenced}#{property} not yet drawn",{element:elementToString(refSemantic),referenced:elementToString(semantic),property:property}))}function BpmnImporter(eventBus,canvas,elementFactory,elementRegistry,translate){this._eventBus=eventBus,this._canvas=canvas,this._elementFactory=elementFactory,this._elementRegistry=elementRegistry,this._translate=translate}var assign=require("lodash/object/assign"),map=require("lodash/collection/map"),LabelUtil=require("../util/LabelUtil"),is=require("../util/ModelUtil").is,hasExternalLabel=LabelUtil.hasExternalLabel,getExternalLabelBounds=LabelUtil.getExternalLabelBounds,isExpanded=require("../util/DiUtil").isExpanded,elementToString=require("./Util").elementToString;BpmnImporter.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate"],module.exports=BpmnImporter,BpmnImporter.prototype.add=function(semantic,parentElement){var element,hidden,di=semantic.di,translate=this._translate;if(is(di,"bpmndi:BPMNPlane"))element=this._elementFactory.createRoot(elementData(semantic)),this._canvas.setRootElement(element);else if(is(di,"bpmndi:BPMNShape")){var collapsed=!isExpanded(semantic);hidden=parentElement&&(parentElement.hidden||parentElement.collapsed);var bounds=semantic.di.bounds;element=this._elementFactory.createShape(elementData(semantic,{collapsed:collapsed,hidden:hidden,x:Math.round(bounds.x),y:Math.round(bounds.y),width:Math.round(bounds.width),height:Math.round(bounds.height)})),is(semantic,"bpmn:BoundaryEvent")&&this._attachBoundary(semantic,element),this._canvas.addShape(element,parentElement)}else{if(!is(di,"bpmndi:BPMNEdge"))throw new Error(translate("unknown di {di} for element {semantic}",{di:elementToString(di),semantic:elementToString(semantic)}));var source=this._getSource(semantic),target=this._getTarget(semantic);hidden=parentElement&&(parentElement.hidden||parentElement.collapsed),element=this._elementFactory.createConnection(elementData(semantic,{hidden:hidden,source:source,target:target,waypoints:collectWaypoints(semantic.di.waypoint)})),(is(semantic,"bpmn:DataInputAssociation")||is(semantic,"bpmn:DataOutputAssociation"))&&(parentElement=null),this._canvas.addConnection(element,parentElement)}return hasExternalLabel(semantic)&&this.addLabel(semantic,element),this._eventBus.fire("bpmnElement.added",{element:element}),element},BpmnImporter.prototype._attachBoundary=function(boundarySemantic,boundaryElement){var translate=this._translate,hostSemantic=boundarySemantic.attachedToRef;if(!hostSemantic)throw new Error(translate("missing {semantic}#attachedToRef",{semantic:elementToString(boundarySemantic)}));var host=this._elementRegistry.get(hostSemantic.id),attachers=host&&host.attachers;if(!host)throw notYetDrawn(translate,boundarySemantic,hostSemantic,"attachedToRef");boundaryElement.host=host,attachers||(host.attachers=attachers=[]),-1===attachers.indexOf(boundaryElement)&&attachers.push(boundaryElement)},BpmnImporter.prototype.addLabel=function(semantic,element){var bounds=getExternalLabelBounds(semantic,element),label=this._elementFactory.createLabel(elementData(semantic,{id:semantic.id+"_label",labelTarget:element,type:"label",hidden:element.hidden||!semantic.name,x:Math.round(bounds.x),y:Math.round(bounds.y),width:Math.round(bounds.width),height:Math.round(bounds.height)}));return this._canvas.addShape(label,element.parent)},BpmnImporter.prototype._getEnd=function(semantic,side){var element,refSemantic,type=semantic.$type,translate=this._translate;if(refSemantic=semantic[side+"Ref"],"source"===side&&"bpmn:DataInputAssociation"===type&&(refSemantic=refSemantic&&refSemantic[0]),("source"===side&&"bpmn:DataOutputAssociation"===type||"target"===side&&"bpmn:DataInputAssociation"===type)&&(refSemantic=semantic.$parent),element=refSemantic&&this._getElement(refSemantic))return element;throw refSemantic?notYetDrawn(translate,semantic,refSemantic,side+"Ref"):new Error(translate("{semantic}#{side} Ref not specified",{semantic:elementToString(semantic),side:side}))},BpmnImporter.prototype._getSource=function(semantic){return this._getEnd(semantic,"source")},BpmnImporter.prototype._getTarget=function(semantic){return this._getEnd(semantic,"target")},BpmnImporter.prototype._getElement=function(semantic){return this._elementRegistry.get(semantic.id)}},{"../util/DiUtil":155,"../util/LabelUtil":156,"../util/ModelUtil":157,"./Util":153,"lodash/collection/map":370,"lodash/object/assign":499}],151:[function(require,module,exports){"use strict";function is(element,type){return element.$instanceOf(type)}function findDisplayCandidate(definitions){return find(definitions.rootElements,function(e){return is(e,"bpmn:Process")||is(e,"bpmn:Collaboration")})}function BpmnTreeWalker(handler,translate){function contextual(fn,ctx){return function(e){fn(e,ctx)}}function handled(element){handledElements[element.id]=element}function isHandled(element){return handledElements[element.id]}function visit(element,ctx){if(element.gfx)throw new Error(translate("already rendered {element}",{element:elementToString(element)}));return handler.element(element,ctx)}function visitRoot(element,diagram){return handler.root(element,diagram)}function visitIfDi(element,ctx){try{var gfx=element.di&&visit(element,ctx);return handled(element),gfx}catch(e){logError(e.message,{element:element,error:e}),console.error(translate("failed to import {element}",{element:elementToString(element)})),console.error(e)}}function logError(message,context){handler.error(message,context)}function registerDi(di){var bpmnElement=di.bpmnElement;bpmnElement?bpmnElement.di?logError(translate("multiple DI elements defined for {element}",{element:elementToString(bpmnElement)}),{element:bpmnElement}):(diRefs.bind(bpmnElement,"di"),bpmnElement.di=di):logError(translate("no bpmnElement referenced in {element}",{element:elementToString(di)}),{element:di})}function handleDiagram(diagram){handlePlane(diagram.plane)}function handlePlane(plane){registerDi(plane),forEach(plane.planeElement,handlePlaneElement)}function handlePlaneElement(planeElement){registerDi(planeElement)}function handleDefinitions(definitions,diagram){var diagrams=definitions.diagrams;if(diagram&&-1===diagrams.indexOf(diagram))throw new Error(translate("diagram not part of bpmn:Definitions"));if(!diagram&&diagrams&&diagrams.length&&(diagram=diagrams[0]),!diagram)throw new Error(translate("no diagram to display"));handleDiagram(diagram);var plane=diagram.plane;if(!plane)throw new Error(translate("no plane for {element}",{element:elementToString(diagram)}));var rootElement=plane.bpmnElement;if(!rootElement){if(!(rootElement=findDisplayCandidate(definitions)))throw new Error(translate("no process or collaboration to display"));logError(translate("correcting missing bpmnElement on {plane} to {rootElement}",{plane:elementToString(plane),rootElement:elementToString(rootElement)})),plane.bpmnElement=rootElement,registerDi(plane)}var ctx=visitRoot(rootElement,plane);if(is(rootElement,"bpmn:Process"))handleProcess(rootElement,ctx);else{if(!is(rootElement,"bpmn:Collaboration"))throw new Error(translate("unsupported bpmnElement for {plane}: {rootElement}",{plane:elementToString(plane),rootElement:elementToString(rootElement)}));handleCollaboration(rootElement),handleUnhandledProcesses(definitions.rootElements)}handleDeferred(deferred)}function handleDeferred(deferred){forEach(deferred,function(d){d()})}function handleProcess(process,context){handleFlowElementsContainer(process,context),handleIoSpecification(process.ioSpecification,context),handleArtifacts(process.artifacts,context),handled(process)}function handleUnhandledProcesses(rootElements){filter(rootElements,function(e){return!isHandled(e)&&is(e,"bpmn:Process")&&e.laneSets}).forEach(contextual(handleProcess))}function handleMessageFlow(messageFlow,context){visitIfDi(messageFlow,context)}function handleMessageFlows(messageFlows,context){forEach(messageFlows,contextual(handleMessageFlow,context))}function handleDataAssociation(association,context){visitIfDi(association,context)}function handleDataInput(dataInput,context){visitIfDi(dataInput,context)}function handleDataOutput(dataOutput,context){visitIfDi(dataOutput,context)}function handleArtifact(artifact,context){visitIfDi(artifact,context)}function handleArtifacts(artifacts,context){forEach(artifacts,function(e){is(e,"bpmn:Association")?deferred.push(function(){handleArtifact(e,context)}):handleArtifact(e,context)})}function handleIoSpecification(ioSpecification,context){ioSpecification&&(forEach(ioSpecification.dataInputs,contextual(handleDataInput,context)),forEach(ioSpecification.dataOutputs,contextual(handleDataOutput,context)))}function handleSubProcess(subProcess,context){handleFlowElementsContainer(subProcess,context),handleArtifacts(subProcess.artifacts,context)}function handleFlowNode(flowNode,context){var childCtx=visitIfDi(flowNode,context);is(flowNode,"bpmn:SubProcess")&&handleSubProcess(flowNode,childCtx||context),is(flowNode,"bpmn:Activity")&&handleIoSpecification(flowNode.ioSpecification,context),deferred.push(function(){forEach(flowNode.dataInputAssociations,contextual(handleDataAssociation,context)),forEach(flowNode.dataOutputAssociations,contextual(handleDataAssociation,context))})}function handleSequenceFlow(sequenceFlow,context){visitIfDi(sequenceFlow,context)}function handleDataElement(dataObject,context){visitIfDi(dataObject,context)}function handleBoundaryEvent(dataObject,context){visitIfDi(dataObject,context)}function handleLane(lane,context){var newContext=visitIfDi(lane,context);lane.childLaneSet&&handleLaneSet(lane.childLaneSet,newContext||context),wireFlowNodeRefs(lane)}function handleLaneSet(laneSet,context){forEach(laneSet.lanes,contextual(handleLane,context))}function handleLaneSets(laneSets,context){forEach(laneSets,contextual(handleLaneSet,context))}function handleFlowElementsContainer(container,context){container.laneSets&&handleLaneSets(container.laneSets,context),handleFlowElements(container.flowElements,context)}function handleFlowElements(flowElements,context){forEach(flowElements,function(e){is(e,"bpmn:SequenceFlow")?deferred.push(function(){handleSequenceFlow(e,context)}):is(e,"bpmn:BoundaryEvent")?deferred.unshift(function(){handleBoundaryEvent(e,context) +}):is(e,"bpmn:FlowNode")?handleFlowNode(e,context):is(e,"bpmn:DataObject")||(is(e,"bpmn:DataStoreReference")?handleDataElement(e,context):is(e,"bpmn:DataObjectReference")?handleDataElement(e,context):logError(translate("unrecognized flowElement {element} in context {context}",{element:elementToString(e),context:context?elementToString(context.businessObject):"null"}),{element:e,context:context}))})}function handleParticipant(participant,context){var newCtx=visitIfDi(participant,context),process=participant.processRef;process&&handleProcess(process,newCtx||context)}function handleCollaboration(collaboration){forEach(collaboration.participants,contextual(handleParticipant)),handleArtifacts(collaboration.artifacts),deferred.push(function(){handleMessageFlows(collaboration.messageFlows)})}function wireFlowNodeRefs(lane){forEach(lane.flowNodeRef,function(flowNode){var lanes=flowNode.get("lanes");lanes&&lanes.push(lane)})}var handledElements={},deferred=[];return{handleDefinitions:handleDefinitions}}var filter=require("lodash/collection/filter"),find=require("lodash/collection/find"),forEach=require("lodash/collection/forEach"),Refs=require("object-refs"),elementToString=require("./Util").elementToString,diRefs=new Refs({name:"bpmnElement",enumerable:!0},{name:"di"});module.exports=BpmnTreeWalker},{"./Util":153,"lodash/collection/filter":364,"lodash/collection/find":365,"lodash/collection/forEach":366,"object-refs":536}],152:[function(require,module,exports){"use strict";function importBpmnDiagram(diagram,definitions,done){var error,importer=diagram.get("bpmnImporter"),eventBus=diagram.get("eventBus"),translate=diagram.get("translate"),warnings=[];eventBus.fire("import.render.start",{definitions:definitions});try{!function(definitions){new BpmnTreeWalker({root:function(element){return importer.add(element)},element:function(element,parentShape){return importer.add(element,parentShape)},error:function(message,context){warnings.push({message:message,context:context})}},translate).handleDefinitions(definitions)}(definitions)}catch(e){error=e}eventBus.fire("import.render.complete",{error:error,warnings:warnings}),done(error,warnings)}var BpmnTreeWalker=require("./BpmnTreeWalker");module.exports.importBpmnDiagram=importBpmnDiagram},{"./BpmnTreeWalker":151}],153:[function(require,module,exports){"use strict";module.exports.elementToString=function(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':""}},{}],154:[function(require,module,exports){module.exports={__depends__:[require("diagram-js/lib/i18n/translate")],bpmnImporter:["type",require("./BpmnImporter")]}},{"./BpmnImporter":150,"diagram-js/lib/i18n/translate":308}],155:[function(require,module,exports){"use strict";function hasEventDefinition(element,eventType){var bo=getBusinessObject(element),hasEventDefinition=!1;return bo.eventDefinitions&&forEach(bo.eventDefinitions,function(event){is(event,eventType)&&(hasEventDefinition=!0)}),hasEventDefinition}var is=require("./ModelUtil").is,getBusinessObject=require("./ModelUtil").getBusinessObject,forEach=require("lodash/collection/forEach");module.exports.isExpanded=function(element){return!is(element,"bpmn:CallActivity")&&(is(element,"bpmn:SubProcess")?!!getBusinessObject(element).di.isExpanded:!is(element,"bpmn:Participant")||!!getBusinessObject(element).processRef)},module.exports.isInterrupting=function(element){return element&&!1!==getBusinessObject(element).isInterrupting},module.exports.isEventSubProcess=function(element){return element&&!!getBusinessObject(element).triggeredByEvent},module.exports.hasEventDefinition=hasEventDefinition,module.exports.hasErrorEventDefinition=function(element){return hasEventDefinition(element,"bpmn:ErrorEventDefinition")},module.exports.hasEscalationEventDefinition=function(element){return hasEventDefinition(element,"bpmn:EscalationEventDefinition")},module.exports.hasCompensateEventDefinition=function(element){return hasEventDefinition(element,"bpmn:CompensateEventDefinition")}},{"./ModelUtil":157,"lodash/collection/forEach":366}],156:[function(require,module,exports){"use strict";function getFlowLabelPosition(waypoints){var mid=waypoints.length/2-1,first=waypoints[Math.floor(mid)],second=waypoints[Math.ceil(mid+.01)],position=getWaypointsMid(waypoints),angle=Math.atan((second.y-first.y)/(second.x-first.x)),x=position.x,y=position.y;return Math.abs(angle)
Web-based tooling for BPMN, DMN and CMMN diagrams powered by bpmn.io.
';module.exports.open=open},{"min-dom/lib/delegate":518,"min-dom/lib/domify":519}],159:[function(require,module,exports){module.exports=require("./lib/simple")},{"./lib/simple":161}],160:[function(require,module,exports){"use strict";function BpmnModdle(packages,options){Moddle.call(this,packages,options)}var isString=require("lodash/lang/isString"),isFunction=require("lodash/lang/isFunction"),assign=require("lodash/object/assign"),Moddle=require("moddle"),XmlReader=require("moddle-xml/lib/reader"),XmlWriter=require("moddle-xml/lib/writer");BpmnModdle.prototype=Object.create(Moddle.prototype),module.exports=BpmnModdle,BpmnModdle.prototype.fromXML=function(xmlStr,typeName,options,done){isString(typeName)||(done=options,options=typeName,typeName="bpmn:Definitions"),isFunction(options)&&(done=options,options={});var reader=new XmlReader(assign({model:this,lax:!0},options)),rootHandler=reader.handler(typeName);reader.fromXML(xmlStr,rootHandler,done)},BpmnModdle.prototype.toXML=function(element,options,done){isFunction(options)&&(done=options,options={});var writer=new XmlWriter(options);try{var result=writer.toXML(element);done(null,result)}catch(e){done(e)}}},{"lodash/lang/isFunction":491,"lodash/lang/isString":496,"lodash/object/assign":499,moddle:527,"moddle-xml/lib/reader":525,"moddle-xml/lib/writer":526}],161:[function(require,module,exports){"use strict";var assign=require("lodash/object/assign"),BpmnModdle=require("./bpmn-moddle"),packages={bpmn:require("../resources/bpmn/json/bpmn.json"),bpmndi:require("../resources/bpmn/json/bpmndi.json"),dc:require("../resources/bpmn/json/dc.json"),di:require("../resources/bpmn/json/di.json")};module.exports=function(additionalPackages,options){return new BpmnModdle(assign({},packages,additionalPackages),options)}},{"../resources/bpmn/json/bpmn.json":162,"../resources/bpmn/json/bpmndi.json":163,"../resources/bpmn/json/dc.json":164,"../resources/bpmn/json/di.json":165,"./bpmn-moddle":160,"lodash/object/assign":499}],162:[function(require,module,exports){module.exports={name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean"},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",type:"String",isBody:!0}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",type:"String",isAttr:!0},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRefs",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["FlowElementsContainer","Collaboration"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0, +isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isVirtual:!0,isMany:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"CallActivity",superClass:["Activity"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],emumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}}},{}],163:[function(require,module,exports){module.exports={name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],emumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[],prefix:"bpmndi"}},{}],164:[function(require,module,exports){module.exports={name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]}},{}],165:[function(require,module,exports){module.exports={name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",xml:{tagAlias:"lowerCase"}}},{}],166:[function(require,module,exports){module.exports={name:"Camunda",uri:"http://camunda.org/schema/1.0/bpmn",prefix:"camunda",xml:{tagAlias:"lowerCase"},associations:[],types:[{name:"InOutBinding",superClass:["Element"],isAbstract:!0,properties:[{name:"source",isAttr:!0,type:"String"},{name:"sourceExpression",isAttr:!0,type:"String"},{name:"target",isAttr:!0,type:"String"},{name:"businessKey",isAttr:!0,type:"String"},{name:"local",isAttr:!0,type:"Boolean",default:!1},{name:"variables",isAttr:!0,type:"String"}]},{name:"In",superClass:["InOutBinding"]},{name:"Out",superClass:["InOutBinding"]},{name:"AsyncCapable",isAbstract:!0,extends:["bpmn:Activity","bpmn:Gateway","bpmn:Event"],properties:[{name:"async",isAttr:!0,type:"Boolean",default:!1},{name:"asyncBefore",isAttr:!0,type:"Boolean",default:!1},{name:"asyncAfter",isAttr:!0,type:"Boolean",default:!1},{name:"exclusive",isAttr:!0,type:"Boolean",default:!0}]},{name:"JobPriorized",isAbstract:!0,extends:["bpmn:Process","camunda:AsyncCapable"],properties:[{name:"jobPriority",isAttr:!0,type:"String"}]},{name:"SignalEventDefinition",isAbstract:!0,extends:["bpmn:SignalEventDefinition"],properties:[{name:"async",isAttr:!0,type:"Boolean",default:!1}]},{name:"ErrorEventDefinition",isAbstract:!0,extends:["bpmn:ErrorEventDefinition"],properties:[{name:"errorCodeVariable",isAttr:!0,type:"String"},{name:"errorMessageVariable",isAttr:!0,type:"String"}]},{name:"PotentialStarter",superClass:["Element"],properties:[{name:"resourceAssignmentExpression",type:"bpmn:ResourceAssignmentExpression"}]},{name:"FormSupported",isAbstract:!0,extends:["bpmn:StartEvent","bpmn:UserTask"],properties:[{name:"formHandlerClass",isAttr:!0,type:"String"},{name:"formKey",isAttr:!0,type:"String"}]},{name:"Initiator",isAbstract:!0,extends:["bpmn:StartEvent"],properties:[{name:"initiator",isAttr:!0,type:"String"}]},{name:"ScriptTask",isAbstract:!0,extends:["bpmn:ScriptTask"],properties:[{name:"resultVariable",isAttr:!0,type:"String"},{name:"resource",isAttr:!0,type:"String"}]},{name:"Process",isAbstract:!0,extends:["bpmn:Process"],properties:[{name:"candidateStarterGroups",isAttr:!0,type:"String"},{name:"candidateStarterUsers",isAttr:!0,type:"String"},{name:"versionTag",isAttr:!0,type:"String"}]},{name:"EscalationEventDefinition",isAbstract:!0,extends:["bpmn:EscalationEventDefinition"],properties:[{name:"escalationCodeVariable",isAttr:!0,type:"String"}]},{name:"FormalExpression",isAbstract:!0,extends:["bpmn:FormalExpression"],properties:[{name:"resource",isAttr:!0,type:"String"}]},{name:"Assignable",extends:["bpmn:UserTask"],properties:[{name:"assignee",isAttr:!0,type:"String"},{name:"candidateUsers",isAttr:!0,type:"String"},{name:"candidateGroups",isAttr:!0,type:"String"},{name:"dueDate",isAttr:!0,type:"String"},{name:"followUpDate",isAttr:!0,type:"String"},{name:"priority",isAttr:!0,type:"String"}]},{name:"CallActivity",extends:["bpmn:CallActivity"],properties:[{name:"calledElementBinding",isAttr:!0,type:"String",default:"latest"},{name:"calledElementVersion",isAttr:!0,type:"String"},{name:"calledElementTenantId",isAttr:!0,type:"String"},{name:"caseRef",isAttr:!0,type:"String"},{name:"caseBinding",isAttr:!0,type:"String",default:"latest"},{name:"caseVersion",isAttr:!0,type:"String"},{name:"caseTenantId",isAttr:!0,type:"String"},{name:"variableMappingClass",isAttr:!0,type:"String"},{name:"variableMappingDelegateExpression",isAttr:!0,type:"String"}]},{name:"ServiceTaskLike",extends:["bpmn:ServiceTask","bpmn:BusinessRuleTask","bpmn:SendTask","bpmn:MessageEventDefinition"],properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"resultVariable",isAttr:!0,type:"String"}]},{name:"DmnCapable",extends:["bpmn:BusinessRuleTask"],properties:[{name:"decisionRef",isAttr:!0,type:"String"},{name:"decisionRefBinding",isAttr:!0,type:"String",default:"latest"},{name:"decisionRefVersion",isAttr:!0,type:"String"},{name:"mapDecisionResult",isAttr:!0,type:"String",default:"resultList"},{name:"decisionRefTenantId",isAttr:!0,type:"String"}]},{name:"ExternalCapable",extends:["camunda:ServiceTaskLike"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"topic",isAttr:!0,type:"String"}]},{name:"TaskPriorized",extends:["bpmn:Process","camunda:ExternalCapable"],properties:[{name:"taskPriority",isAttr:!0,type:"String"}]},{name:"Properties",superClass:["Element"],properties:[{name:"values",type:"Property",isMany:!0}]},{name:"Property",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"name",type:"String",isAttr:!0},{name:"value",type:"String",isAttr:!0}]},{name:"Connector",superClass:["Element"],properties:[{name:"inputOutput",type:"InputOutput"},{name:"connectorId",type:"String"}]},{name:"InputOutput",superClass:["Element"],properties:[{name:"inputOutput",type:"InputOutput"},{name:"connectorId",type:"String"},{name:"inputParameters",isMany:!0,type:"InputParameter"},{name:"outputParameters",isMany:!0,type:"OutputParameter"}]},{name:"InputOutputParameter",properties:[{name:"name",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"},{name:"definition",type:"InputOutputParameterDefinition"}]},{name:"InputOutputParameterDefinition",isAbstract:!0},{name:"List",superClass:["InputOutputParameterDefinition"],properties:[{name:"items",isMany:!0,type:"InputOutputParameterDefinition"}]},{name:"Map",superClass:["InputOutputParameterDefinition"],properties:[{name:"entries",isMany:!0,type:"Entry"}]},{name:"Entry",properties:[{name:"key",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"},{name:"definition",type:"InputOutputParameterDefinition"}]},{name:"Value",superClass:["InputOutputParameterDefinition"],properties:[{name:"id",isAttr:!0,type:"String"},{name:"name",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"}]},{name:"Script",superClass:["InputOutputParameterDefinition"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"resource",isAttr:!0,type:"String"},{name:"value",isBody:!0,type:"String"}]},{name:"Field",superClass:["Element"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"expression",type:"String"},{name:"stringValue",isAttr:!0,type:"String"},{name:"string",type:"String"}]},{name:"InputParameter",superClass:["InputOutputParameter"]},{name:"OutputParameter",superClass:["InputOutputParameter"]},{name:"Collectable",isAbstract:!0,extends:["bpmn:MultiInstanceLoopCharacteristics"],superClass:["camunda:AsyncCapable"],properties:[{name:"collection",isAttr:!0,type:"String"},{name:"elementVariable",isAttr:!0,type:"String"}]},{name:"FailedJobRetryTimeCycle",superClass:["Element"],properties:[{name:"body",isBody:!0,type:"String"}]},{name:"ExecutionListener",superClass:["Element"],properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"event",isAttr:!0,type:"String"},{name:"script",type:"Script"},{name:"fields",type:"Field",isMany:!0}]},{name:"TaskListener",superClass:["Element"],properties:[{name:"expression",isAttr:!0,type:"String"},{name:"class",isAttr:!0,type:"String"},{name:"delegateExpression",isAttr:!0,type:"String"},{name:"event",isAttr:!0,type:"String"},{name:"script",type:"Script"},{name:"fields",type:"Field",isMany:!0}]},{name:"FormProperty",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"name",type:"String",isAttr:!0},{name:"type",type:"String",isAttr:!0},{name:"required",type:"String",isAttr:!0},{name:"readable",type:"String",isAttr:!0},{name:"writable",type:"String",isAttr:!0},{name:"variable",type:"String",isAttr:!0},{name:"expression",type:"String",isAttr:!0},{name:"datePattern",type:"String",isAttr:!0},{name:"default",type:"String",isAttr:!0},{name:"values",type:"Value",isMany:!0}]},{name:"FormData",superClass:["Element"],properties:[{name:"fields",type:"FormField",isMany:!0},{name:"businessKey",type:"String",isAttr:!0}]},{name:"FormField",superClass:["Element"],properties:[{name:"id",type:"String",isAttr:!0},{name:"label",type:"String",isAttr:!0},{name:"type",type:"String",isAttr:!0},{name:"datePattern",type:"String",isAttr:!0},{name:"defaultValue",type:"String",isAttr:!0},{name:"properties",type:"Properties"},{name:"validation",type:"Validation"},{name:"values",type:"Value",isMany:!0}]},{name:"Validation",superClass:["Element"],properties:[{name:"constraints",type:"Constraint",isMany:!0}]},{name:"Constraint",superClass:["Element"],properties:[{name:"name",type:"String",isAttr:!0},{name:"config",type:"String",isAttr:!0}]},{name:"ConditionalEventDefinition",isAbstract:!0,extends:["bpmn:ConditionalEventDefinition"],properties:[{name:"variableName",isAttr:!0,type:"String"},{name:"variableEvent",isAttr:!0,type:"String"}]}],emumerations:[]}},{}],167:[function(require,module,exports){function ClassList(el){if(!el||!el.nodeType)throw new Error("A DOM element reference is required");this.el=el,this.list=el.classList}try{var index=require("indexof")}catch(err){var index=require("component-indexof")}var re=/\s+/,toString=Object.prototype.toString;module.exports=function(el){return new ClassList(el)},ClassList.prototype.add=function(name){if(this.list)return this.list.add(name),this;var arr=this.array();return~index(arr,name)||arr.push(name),this.el.className=arr.join(" "),this},ClassList.prototype.remove=function(name){if("[object RegExp]"==toString.call(name))return this.removeMatching(name);if(this.list)return this.list.remove(name),this;var arr=this.array(),i=index(arr,name);return~i&&arr.splice(i,1),this.el.className=arr.join(" "),this},ClassList.prototype.removeMatching=function(re){for(var arr=this.array(),i=0;i=0}function addModule(m){modules.push(m)}function visit(m){hasModule(m)||((m.__depends__||[]).forEach(visit),hasModule(m)||(addModule(m),(m.__init__||[]).forEach(function(c){components.push(c)})))}var modules=[],components=[];bootstrapModules.forEach(visit);var injector=new di.Injector(modules);return components.forEach(function(c){try{injector["string"==typeof c?"get":"invoke"](c)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),injector}function createInjector(options){return options=options||{},bootstrap([{config:["value",options]},require("./core")].concat(options.modules||[]))}function Diagram(options,injector){this.injector=injector=injector||createInjector(options),this.get=injector.get,this.invoke=injector.invoke,this.get("eventBus").fire("diagram.init")}var di=require("didi");module.exports=Diagram,Diagram.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Diagram.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")}},{"./core":187,didi:342}],179:[function(require,module,exports){"use strict";function isObject(element){return"object"==typeof element}function CommandInterceptor(eventBus){this._eventBus=eventBus}function unwrapEvent(fn,that){return function(event){return fn.call(that||null,event.context,event.command,event)}}var forEach=require("lodash/collection/forEach"),isFunction=require("lodash/lang/isFunction"),isArray=require("lodash/lang/isArray"),isNumber=require("lodash/lang/isNumber");CommandInterceptor.$inject=["eventBus"],module.exports=CommandInterceptor,CommandInterceptor.prototype.on=function(events,hook,priority,handlerFn,unwrap,that){if((isFunction(hook)||isNumber(hook))&&(that=unwrap,unwrap=handlerFn,handlerFn=priority,priority=hook,hook=null),isFunction(priority)&&(that=unwrap,unwrap=handlerFn,handlerFn=priority,priority=1e3),isObject(unwrap)&&(that=unwrap,unwrap=!1),!isFunction(handlerFn))throw new Error("handlerFn must be a function");isArray(events)||(events=[events]);var eventBus=this._eventBus;forEach(events,function(event){var fullEvent=["commandStack",event,hook].filter(function(e){return e}).join(".");eventBus.on(fullEvent,priority,unwrap?unwrapEvent(handlerFn,that):handlerFn,that)})},forEach(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(hook){CommandInterceptor.prototype[hook]=function(events,priority,handlerFn,unwrap,that){ +(isFunction(events)||isNumber(events))&&(that=unwrap,unwrap=handlerFn,handlerFn=priority,priority=events,events=null),this.on(events,hook,priority,handlerFn,unwrap,that)}})},{"lodash/collection/forEach":366,"lodash/lang/isArray":489,"lodash/lang/isFunction":491,"lodash/lang/isNumber":493}],180:[function(require,module,exports){"use strict";function CommandStack(eventBus,injector){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=injector,this._eventBus=eventBus,this._uid=1,eventBus.on(["diagram.destroy","diagram.clear"],this.clear,this)}var unique=require("lodash/array/unique"),isArray=require("lodash/lang/isArray"),assign=require("lodash/object/assign"),InternalEvent=require("../core/EventBus").Event;CommandStack.$inject=["eventBus","injector"],module.exports=CommandStack,CommandStack.prototype.execute=function(command,context){if(!command)throw new Error("command required");var action={command:command,context:context};this._pushAction(action),this._internalExecute(action),this._popAction(action)},CommandStack.prototype.canExecute=function(command,context){var action={command:command,context:context},handler=this._getHandler(command),result=this._fire(command,"canExecute",action);if(void 0===result){if(!handler)return!1;handler.canExecute&&(result=handler.canExecute(context))}return result},CommandStack.prototype.clear=function(){this._stack.length=0,this._stackIdx=-1,this._fire("changed")},CommandStack.prototype.undo=function(){var next,action=this._getUndoAction();if(action){for(this._pushAction(action);action&&(this._internalUndo(action),(next=this._getUndoAction())&&next.id===action.id);)action=next;this._popAction()}},CommandStack.prototype.redo=function(){var next,action=this._getRedoAction();if(action){for(this._pushAction(action);action&&(this._internalExecute(action,!0),(next=this._getRedoAction())&&next.id===action.id);)action=next;this._popAction()}},CommandStack.prototype.register=function(command,handler){this._setHandler(command,handler)},CommandStack.prototype.registerHandler=function(command,handlerCls){if(!command||!handlerCls)throw new Error("command and handlerCls must be defined");var handler=this._injector.instantiate(handlerCls);this.register(command,handler)},CommandStack.prototype.canUndo=function(){return!!this._getUndoAction()},CommandStack.prototype.canRedo=function(){return!!this._getRedoAction()},CommandStack.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},CommandStack.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},CommandStack.prototype._internalUndo=function(action){var self=this,command=action.command,context=action.context,handler=this._getHandler(command);this._atomicDo(function(){self._fire(command,"revert",action),handler.revert&&self._markDirty(handler.revert(context)),self._revertedAction(action),self._fire(command,"reverted",action)})},CommandStack.prototype._fire=function(command,qualifier,event){arguments.length<3&&(event=qualifier,qualifier=null);var i,name,result,names=qualifier?[command+"."+qualifier,qualifier]:[command];for(event=assign(new InternalEvent,event),i=0;(name=names[i])&&(result=this._eventBus.fire("commandStack."+name,event),!event.cancelBubble);i++);return result},CommandStack.prototype._createId=function(){return this._uid++},CommandStack.prototype._atomicDo=function(fn){var execution=this._currentExecution;execution.atomic=!0;try{fn()}finally{execution.atomic=!1}},CommandStack.prototype._internalExecute=function(action,redo){var self=this,command=action.command,context=action.context,handler=this._getHandler(command);if(!handler)throw new Error("no command handler registered for <"+command+">");this._pushAction(action),redo||(this._fire(command,"preExecute",action),handler.preExecute&&handler.preExecute(context),this._fire(command,"preExecuted",action)),this._atomicDo(function(){self._fire(command,"execute",action),handler.execute&&self._markDirty(handler.execute(context)),self._executedAction(action,redo),self._fire(command,"executed",action)}),redo||(this._fire(command,"postExecute",action),handler.postExecute&&handler.postExecute(context),this._fire(command,"postExecuted",action)),this._popAction(action)},CommandStack.prototype._pushAction=function(action){var execution=this._currentExecution,actions=execution.actions,baseAction=actions[0];if(execution.atomic)throw new Error("illegal invocation in or phase (action: "+action.command+")");action.id||(action.id=baseAction&&baseAction.id||this._createId()),actions.push(action)},CommandStack.prototype._popAction=function(){var execution=this._currentExecution,actions=execution.actions,dirty=execution.dirty;actions.pop(),actions.length||(this._eventBus.fire("elements.changed",{elements:unique(dirty)}),dirty.length=0,this._fire("changed"))},CommandStack.prototype._markDirty=function(elements){var execution=this._currentExecution;elements&&(elements=isArray(elements)?elements:[elements],execution.dirty=execution.dirty.concat(elements))},CommandStack.prototype._executedAction=function(action,redo){var stackIdx=++this._stackIdx;redo||this._stack.splice(stackIdx,this._stack.length,action)},CommandStack.prototype._revertedAction=function(action){this._stackIdx--},CommandStack.prototype._getHandler=function(command){return this._handlerMap[command]},CommandStack.prototype._setHandler=function(command,handler){if(!command||!handler)throw new Error("command and handler required");if(this._handlerMap[command])throw new Error("overriding handler for command <"+command+">");this._handlerMap[command]=handler}},{"../core/EventBus":185,"lodash/array/unique":358,"lodash/lang/isArray":489,"lodash/object/assign":499}],181:[function(require,module,exports){module.exports={commandStack:["type",require("./CommandStack")]}},{"./CommandStack":180}],182:[function(require,module,exports){"use strict";function round(number,resolution){return Math.round(number*resolution)/resolution}function ensurePx(number){return isNumber(number)?number+"px":number}function createContainer(options){options=assign({},{width:"100%",height:"100%"},options);var container=options.container||document.body,parent=document.createElement("div");return parent.setAttribute("class","djs-container"),assign(parent.style,{position:"relative",overflow:"hidden",width:ensurePx(options.width),height:ensurePx(options.height)}),container.appendChild(parent),parent}function createGroup(parent,cls){var group=svgCreate("g");return svgClasses(group).add(cls),svgAppend(parent,group),group}function Canvas(config,eventBus,graphicsFactory,elementRegistry){this._eventBus=eventBus,this._elementRegistry=elementRegistry,this._graphicsFactory=graphicsFactory,this._init(config||{})}function setCTM(node,m){var mstr="matrix("+m.a+","+m.b+","+m.c+","+m.d+","+m.e+","+m.f+")";node.setAttribute("transform",mstr)}var isNumber=require("lodash/lang/isNumber"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),every=require("lodash/collection/every"),debounce=require("lodash/function/debounce"),Collections=require("../util/Collections"),Elements=require("../util/Elements"),svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgCreate=require("tiny-svg/lib/create"),svgTransform=require("tiny-svg/lib/transform"),createMatrix=require("tiny-svg/lib/geometry").createMatrix,REQUIRED_MODEL_ATTRS={shape:["x","y","width","height"],connection:["waypoints"]};Canvas.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],module.exports=Canvas,Canvas.prototype._init=function(config){var eventBus=this._eventBus,container=this._container=createContainer(config),svg=this._svg=svgCreate("svg");svgAttr(svg,{width:"100%",height:"100%"}),svgAppend(container,svg);var viewport=this._viewport=createGroup(svg,"viewport");this._layers={},!1!==config.deferUpdate&&(this._viewboxChanged=debounce(this._viewboxChanged,300)),eventBus.on("diagram.init",function(){eventBus.fire("canvas.init",{svg:svg,viewport:viewport}),this.resized()},this),eventBus.on("diagram.destroy",500,this._destroy,this),eventBus.on("diagram.clear",500,this._clear,this)},Canvas.prototype._destroy=function(emit){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var parent=this._container.parentNode;parent&&parent.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._rootElement,delete this._viewport},Canvas.prototype._clear=function(){var self=this;this._elementRegistry.getAll().forEach(function(element){var type=Elements.getType(element);"root"===type?self.setRootElement(null,!0):self._removeElement(element,type)}),delete this._cachedViewbox},Canvas.prototype.getDefaultLayer=function(){return this.getLayer("base")},Canvas.prototype.getLayer=function(name){if(!name)throw new Error("must specify a name");var layer=this._layers[name];return layer||(layer=this._layers[name]=createGroup(this._viewport,"layer-"+name)),layer},Canvas.prototype.getContainer=function(){return this._container},Canvas.prototype._updateMarker=function(element,marker,add){var container;element.id||(element=this._elementRegistry.get(element)),(container=this._elementRegistry._elements[element.id])&&(forEach([container.gfx,container.secondaryGfx],function(gfx){gfx&&(add?svgClasses(gfx).add(marker):svgClasses(gfx).remove(marker))}),this._eventBus.fire("element.marker.update",{element:element,gfx:container.gfx,marker:marker,add:!!add}))},Canvas.prototype.addMarker=function(element,marker){this._updateMarker(element,marker,!0)},Canvas.prototype.removeMarker=function(element,marker){this._updateMarker(element,marker,!1)},Canvas.prototype.hasMarker=function(element,marker){element.id||(element=this._elementRegistry.get(element));var gfx=this.getGraphics(element);return svgClasses(gfx).has(marker)},Canvas.prototype.toggleMarker=function(element,marker){this.hasMarker(element,marker)?this.removeMarker(element,marker):this.addMarker(element,marker)},Canvas.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Canvas.prototype.setRootElement=function(element,override){element&&this._ensureValid("root",element);var currentRoot=this._rootElement,elementRegistry=this._elementRegistry,eventBus=this._eventBus;if(currentRoot){if(!override)throw new Error("rootElement already set, need to specify override");eventBus.fire("root.remove",{element:currentRoot}),eventBus.fire("root.removed",{element:currentRoot}),elementRegistry.remove(currentRoot)}if(element){var gfx=this.getDefaultLayer();eventBus.fire("root.add",{element:element}),elementRegistry.add(element,gfx,this._svg),eventBus.fire("root.added",{element:element,gfx:gfx})}return this._rootElement=element,element},Canvas.prototype._ensureValid=function(type,element){if(!element.id)throw new Error("element must have an id");if(this._elementRegistry.get(element.id))throw new Error("element with id "+element.id+" already exists");var requiredAttrs=REQUIRED_MODEL_ATTRS[type];if(!every(requiredAttrs,function(attr){return void 0!==element[attr]}))throw new Error("must supply { "+requiredAttrs.join(", ")+" } with "+type)},Canvas.prototype._setParent=function(element,parent,parentIndex){Collections.add(parent.children,element,parentIndex),element.parent=parent},Canvas.prototype._addElement=function(type,element,parent,parentIndex){parent=parent||this.getRootElement();var eventBus=this._eventBus,graphicsFactory=this._graphicsFactory;this._ensureValid(type,element),eventBus.fire(type+".add",{element:element,parent:parent}),this._setParent(element,parent,parentIndex);var gfx=graphicsFactory.create(type,element);return this._elementRegistry.add(element,gfx),graphicsFactory.update(type,element,gfx),eventBus.fire(type+".added",{element:element,gfx:gfx}),element},Canvas.prototype.addShape=function(shape,parent,parentIndex){return this._addElement("shape",shape,parent,parentIndex)},Canvas.prototype.addConnection=function(connection,parent,parentIndex){return this._addElement("connection",connection,parent,parentIndex)},Canvas.prototype._removeElement=function(element,type){var elementRegistry=this._elementRegistry,graphicsFactory=this._graphicsFactory,eventBus=this._eventBus;if(element=elementRegistry.get(element.id||element))return eventBus.fire(type+".remove",{element:element}),graphicsFactory.remove(element),Collections.remove(element.parent&&element.parent.children,element),element.parent=null,eventBus.fire(type+".removed",{element:element}),elementRegistry.remove(element),element},Canvas.prototype.removeShape=function(shape){return this._removeElement(shape,"shape")},Canvas.prototype.removeConnection=function(connection){return this._removeElement(connection,"connection")},Canvas.prototype.getGraphics=function(element,secondary){return this._elementRegistry.getGraphics(element,secondary)},Canvas.prototype._changeViewbox=function(changeFn){this._eventBus.fire("canvas.viewbox.changing"),changeFn.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Canvas.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Canvas.prototype.viewbox=function(box){if(void 0===box&&this._cachedViewbox)return this._cachedViewbox;var innerBox,matrix,scale,x,y,viewport=this._viewport,outerBox=this.getSize();if(!box){innerBox=this.getDefaultLayer().getBBox();var transform=svgTransform(viewport);return matrix=transform?transform.matrix:createMatrix(),scale=round(matrix.a,1e3),x=round(-matrix.e||0,1e3),y=round(-matrix.f||0,1e3),box=this._cachedViewbox={x:x?x/scale:0,y:y?y/scale:0,width:outerBox.width/scale,height:outerBox.height/scale,scale:scale,inner:{width:innerBox.width,height:innerBox.height,x:innerBox.x,y:innerBox.y},outer:outerBox}}return this._changeViewbox(function(){scale=Math.min(outerBox.width/box.width,outerBox.height/box.height);var matrix=this._svg.createSVGMatrix().scale(scale).translate(-box.x,-box.y);svgTransform(viewport,matrix)}),box},Canvas.prototype.scroll=function(delta){var node=this._viewport,matrix=node.getCTM();return delta&&this._changeViewbox(function(){delta=assign({dx:0,dy:0},delta||{}),matrix=this._svg.createSVGMatrix().translate(delta.dx,delta.dy).multiply(matrix),setCTM(node,matrix)}),{x:matrix.e,y:matrix.f}},Canvas.prototype.zoom=function(newScale,center){if(!newScale)return this.viewbox(newScale).scale;if("fit-viewport"===newScale)return this._fitViewport(center);var outer,matrix;return this._changeViewbox(function(){"object"!=typeof center&&(outer=this.viewbox().outer,center={x:outer.width/2,y:outer.height/2}),matrix=this._setZoom(newScale,center)}),round(matrix.a,1e3)},Canvas.prototype._fitViewport=function(center){var newScale,newViewbox,vbox=this.viewbox(),outer=vbox.outer,inner=vbox.inner;return inner.x>=0&&inner.y>=0&&inner.x+inner.width<=outer.width&&inner.y+inner.height<=outer.height&&!center?newViewbox={x:0,y:0,width:Math.max(inner.width+inner.x,outer.width),height:Math.max(inner.height+inner.y,outer.height)}:(newScale=Math.min(1,outer.width/inner.width,outer.height/inner.height),newViewbox={x:inner.x+(center?inner.width/2-outer.width/newScale/2:0),y:inner.y+(center?inner.height/2-outer.height/newScale/2:0),width:outer.width/newScale,height:outer.height/newScale}),this.viewbox(newViewbox),this.viewbox(!1).scale},Canvas.prototype._setZoom=function(scale,center){var centerPoint,originalPoint,currentMatrix,scaleMatrix,newMatrix,svg=this._svg,viewport=this._viewport,matrix=svg.createSVGMatrix(),point=svg.createSVGPoint();currentMatrix=viewport.getCTM();var currentScale=currentMatrix.a;return center?(centerPoint=assign(point,center),originalPoint=centerPoint.matrixTransform(currentMatrix.inverse()),scaleMatrix=matrix.translate(originalPoint.x,originalPoint.y).scale(1/currentScale*scale).translate(-originalPoint.x,-originalPoint.y),newMatrix=currentMatrix.multiply(scaleMatrix)):newMatrix=matrix.scale(scale),setCTM(this._viewport,newMatrix),newMatrix},Canvas.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Canvas.prototype.getAbsoluteBBox=function(element){var bbox,vbox=this.viewbox();if(element.waypoints){var gfx=this.getGraphics(element),transformBBox=gfx.getBBox(!0);bbox=gfx.getBBox(),bbox.x-=transformBBox.x,bbox.y-=transformBBox.y,bbox.width+=2*transformBBox.x,bbox.height+=2*transformBBox.y}else bbox=element;return{x:bbox.x*vbox.scale-vbox.x*vbox.scale,y:bbox.y*vbox.scale-vbox.y*vbox.scale,width:bbox.width*vbox.scale,height:bbox.height*vbox.scale}},Canvas.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")}},{"../util/Collections":323,"../util/Elements":326,"lodash/collection/every":363,"lodash/collection/forEach":366,"lodash/function/debounce":378,"lodash/lang/isNumber":493,"lodash/object/assign":499,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/classes":546,"tiny-svg/lib/create":549,"tiny-svg/lib/geometry":550,"tiny-svg/lib/transform":553}],183:[function(require,module,exports){"use strict";function ElementFactory(){this._uid=12}var Model=require("../model"),assign=require("lodash/object/assign");module.exports=ElementFactory,ElementFactory.prototype.createRoot=function(attrs){return this.create("root",attrs)},ElementFactory.prototype.createLabel=function(attrs){return this.create("label",attrs)},ElementFactory.prototype.createShape=function(attrs){return this.create("shape",attrs)},ElementFactory.prototype.createConnection=function(attrs){return this.create("connection",attrs)},ElementFactory.prototype.create=function(type,attrs){return attrs=assign({},attrs||{}),attrs.id||(attrs.id=type+"_"+this._uid++),Model.create(type,attrs)}},{"../model":314,"lodash/object/assign":499}],184:[function(require,module,exports){"use strict";function ElementRegistry(){this._elements={}}var ELEMENT_ID="data-element-id",svgAttr=require("tiny-svg/lib/attr");module.exports=ElementRegistry,ElementRegistry.prototype.add=function(element,gfx,secondaryGfx){var id=element.id;this._validateId(id),svgAttr(gfx,ELEMENT_ID,id),secondaryGfx&&svgAttr(secondaryGfx,ELEMENT_ID,id),this._elements[id]={element:element,gfx:gfx,secondaryGfx:secondaryGfx}},ElementRegistry.prototype.remove=function(element){var elements=this._elements,id=element.id||element,container=id&&elements[id];container&&(svgAttr(container.gfx,ELEMENT_ID,""),container.secondaryGfx&&svgAttr(container.secondaryGfx,ELEMENT_ID,""),delete elements[id])},ElementRegistry.prototype.updateId=function(element,newId){this._validateId(newId),"string"==typeof element&&(element=this.get(element));var gfx=this.getGraphics(element),secondaryGfx=this.getGraphics(element,!0);this.remove(element),element.id=newId,this.add(element,gfx,secondaryGfx)},ElementRegistry.prototype.get=function(filter){var id;id="string"==typeof filter?filter:filter&&svgAttr(filter,ELEMENT_ID);var container=this._elements[id];return container&&container.element},ElementRegistry.prototype.filter=function(fn){var filtered=[];return this.forEach(function(element,gfx){fn(element,gfx)&&filtered.push(element)}),filtered},ElementRegistry.prototype.getAll=function(){return this.filter(function(e){return e})},ElementRegistry.prototype.forEach=function(fn){var map=this._elements;Object.keys(map).forEach(function(id){var container=map[id],element=container.element,gfx=container.gfx;return fn(element,gfx)})},ElementRegistry.prototype.getGraphics=function(filter,secondary){var id=filter.id||filter,container=this._elements[id];return container&&(secondary?container.secondaryGfx:container.gfx)},ElementRegistry.prototype._validateId=function(id){if(!id)throw new Error("element must have an id");if(this._elements[id])throw new Error("element with id "+id+" already added")}},{"tiny-svg/lib/attr":545}],185:[function(require,module,exports){"use strict";function EventBus(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Event(){}function invokeFunction(fn,args){return fn.apply(null,args)}var isFunction=require("lodash/lang/isFunction"),isArray=require("lodash/lang/isArray"),isNumber=require("lodash/lang/isNumber"),bind=require("lodash/function/bind"),assign=require("lodash/object/assign"),slice=Array.prototype.slice;module.exports=EventBus,EventBus.prototype.on=function(events,priority,callback,that){if(events=isArray(events)?events:[events],isFunction(priority)&&(that=callback,callback=priority,priority=1e3),!isNumber(priority))throw new Error("priority must be a number");var actualCallback=callback;that&&(actualCallback=bind(callback,that),actualCallback.__fn=callback.__fn||callback);var self=this,listener={priority:priority,callback:actualCallback};events.forEach(function(e){self._addListener(e,listener)})},EventBus.prototype.once=function(event,priority,callback,that){function wrappedCallback(){return self.off(event,wrappedCallback),callback.apply(that,arguments)}var self=this;if(isFunction(priority)&&(that=callback,callback=priority,priority=1e3),!isNumber(priority))throw new Error("priority must be a number");wrappedCallback.__fn=callback,this.on(event,priority,wrappedCallback)},EventBus.prototype.off=function(event,callback){var listener,listenerCallback,idx,listeners=this._getListeners(event);if(callback)for(idx=listeners.length-1;listener=listeners[idx];idx--)(listenerCallback=listener.callback)!==callback&&listenerCallback.__fn!==callback||listeners.splice(idx,1);else listeners.length=0},EventBus.prototype.fire=function(type,data){var event,listeners,returnValue,args;if(args=slice.call(arguments),"object"==typeof type&&(event=type,type=event.type),!type)throw new Error("no event type specified");if(listeners=this._listeners[type]){data instanceof Event?event=data:(event=new Event,event.init(data)),args[0]=event;var originalType=event.type;type!==originalType&&(event.type=type);try{returnValue=this._invokeListeners(event,args,listeners)}finally{type!==originalType&&(event.type=originalType)}return void 0===returnValue&&event.defaultPrevented&&(returnValue=!1),returnValue}},EventBus.prototype.handleError=function(error){return!1===this.fire("error",{error:error})},EventBus.prototype._destroy=function(){this._listeners={}},EventBus.prototype._invokeListeners=function(event,args,listeners){var idx,listener,returnValue;for(idx=0;(listener=listeners[idx])&&!event.cancelBubble;idx++)returnValue=this._invokeListener(event,args,listener);return returnValue},EventBus.prototype._invokeListener=function(event,args,listener){var returnValue;try{returnValue=invokeFunction(listener.callback,args),void 0!==returnValue&&(event.returnValue=returnValue,event.stopPropagation()),!1===returnValue&&event.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return returnValue},EventBus.prototype._addListener=function(event,newListener){var existingListener,idx,listeners=this._getListeners(event);for(idx=0;existingListener=listeners[idx];idx++)if(existingListener.priority1&&(hasSharedCenters=!0),center.elements.length}),hasSharedCenters)return alignment[type]=last(centeredElements).center,alignment;firstElement=sortedElements[0],sortedElements=sortBy(sortedElements,function(element){return element[axis]+element[dimension]}),lastElement=last(sortedElements),alignment[type]=function(first,last){return Math.round((first[axis]+last[axis]+last[dimension])/2)}(firstElement,lastElement)}return alignment},AlignElements.prototype.trigger=function(elements,type){var modeling=this._modeling,filteredElements=filter(elements,function(element){return!(element.waypoints||element.host||element.labelTarget)}),sortFn=ALIGNMENT_SORTING[type],sortedElements=sortBy(filteredElements,sortFn),alignment=this._alignmentPosition(type,sortedElements);modeling.alignElements(sortedElements,alignment)}},{"lodash/collection/filter":364,"lodash/collection/forEach":366,"lodash/collection/sortBy":375}],193:[function(require,module,exports){"use strict";module.exports={__init__:["alignElements"],alignElements:["type",require("./AlignElements")]}},{"./AlignElements":192}],194:[function(require,module,exports){"use strict";function AttachSupport(eventBus,modeling,movePreview,rules){CommandInterceptor.call(this,eventBus),eventBus.on("shape.move.start",HIGH_PRIORITY,function(e){var context=e.context,shapes=context.shapes,validatedShapes=context.validatedShapes;context.shapes=addAttached(shapes),context.validatedShapes=removeAttached(validatedShapes)}),this.postExecuted(["elements.move"],function(event){var context=event.context,delta=context.delta,newParent=context.newParent,closure=context.closure,enclosedElements=closure.enclosedElements,attachers=getAttachers(enclosedElements);forEach(attachers,function(attacher){enclosedElements[attacher.id]||modeling.moveShape(attacher,delta,newParent)})}),this.postExecuted(["elements.move"],function(e){var attachers,context=e.context,shapes=context.shapes,newHost=context.newHost;shapes.length>1||(attachers=newHost?shapes:filter(shapes,function(s){return!!s.host}),forEach(attachers,function(attacher){modeling.updateAttachment(attacher,newHost)}))}),this.postExecuted(["elements.move"],function(e){var shapes=e.context.shapes;forEach(shapes,function(shape){forEach(shape.attachers,function(attacher){forEach(attacher.outgoing.slice(),function(connection){rules.allowed("connection.reconnectStart",{connection:connection,source:connection.source,target:connection.target})||modeling.removeConnection(connection)}),forEach(attacher.incoming.slice(),function(connection){rules.allowed("connection.reconnectEnd",{connection:connection,source:connection.source,target:connection.target})||modeling.removeConnection(connection)})})})}),this.postExecute(["shape.create"],function(e){var context=e.context,shape=context.shape,host=context.host;host&&modeling.updateAttachment(shape,host)}),this.postExecute(["shape.replace"],function(e){var context=e.context,oldShape=context.oldShape,newShape=context.newShape;saveClear(oldShape.attachers,function(attacher){"attach"===rules.allowed("elements.move",{target:newShape,shapes:[attacher]})?modeling.updateAttachment(attacher,newShape):modeling.removeShape(attacher)}),newShape.attachers.length&&forEach(newShape.attachers,function(attacher){var delta=getNewAttachShapeDelta(attacher,oldShape,newShape);modeling.moveShape(attacher,delta,attacher.parent)})}),this.postExecute(["shape.resize"],function(event){var context=event.context,shape=context.shape,oldBounds=context.oldBounds,newBounds=context.newBounds,attachers=shape.attachers;attachers.length&&forEach(attachers,function(attacher){var delta=getNewAttachShapeDelta(attacher,oldBounds,newBounds);modeling.moveShape(attacher,delta,attacher.parent),attacher.label&&modeling.moveShape(attacher.label,delta,attacher.label.parent)})}),this.preExecute(["shape.delete"],function(event){var shape=event.context.shape;saveClear(shape.attachers,function(attacher){modeling.removeShape(attacher)}),shape.host&&modeling.updateAttachment(shape,null)}),eventBus.on("spaceTool.move",function(event){var movingShapes=event.context.movingShapes,movingAttachers=filter(movingShapes,function(shape){return shape.host&&shape.host.id});forEach(movingAttachers,function(shape){Collections.remove(movingShapes,shape),shape.label&&Collections.remove(movingShapes,shape.label)})})}function getAttachers(shapes){return flatten(map(shapes,function(s){return s.attachers||[]}))}function addAttached(elements){var attachers=getAttachers(elements);return union(elements,attachers)}function removeAttached(elements){var ids=groupBy(elements,"id");return filter(elements,function(element){for(;element;){if(element.host&&ids[element.host.id])return!1;element=element.parent}return!0})}var forEach=require("lodash/collection/forEach"),flatten=require("lodash/array/flatten"),union=require("lodash/array/union"),filter=require("lodash/collection/filter"),groupBy=require("lodash/collection/groupBy"),map=require("lodash/collection/map"),saveClear=require("../../util/Removal").saveClear,Collections=require("../../util/Collections"),getNewAttachShapeDelta=require("../../util/AttachUtil").getNewAttachShapeDelta,inherits=require("inherits"),HIGH_PRIORITY=1500,CommandInterceptor=require("../../command/CommandInterceptor");inherits(AttachSupport,CommandInterceptor),AttachSupport.$inject=["eventBus","modeling","movePreview","rules"],module.exports=AttachSupport},{"../../command/CommandInterceptor":179,"../../util/AttachUtil":321,"../../util/Collections":323,"../../util/Removal":337,inherits:351,"lodash/array/flatten":353,"lodash/array/union":356,"lodash/collection/filter":364,"lodash/collection/forEach":366,"lodash/collection/groupBy":367,"lodash/collection/map":370}],195:[function(require,module,exports){module.exports={__depends__:[require("../move"),require("../label-support")],__init__:["attachSupport"],attachSupport:["type",require("./AttachSupport")]}},{"../label-support":234,"../move":266,"./AttachSupport":194}],196:[function(require,module,exports){"use strict";function AutoResize(eventBus,elementRegistry,modeling,rules){CommandInterceptor.call(this,eventBus),this._elementRegistry=elementRegistry,this._modeling=modeling,this._rules=rules;var self=this;this.postExecuted(["shape.create"],function(event){var context=event.context,hints=context.hints,shape=context.shape,parent=context.parent||context.newParent;hints&&!1===hints.root||self._expand([shape],parent)}),this.postExecuted(["elements.move"],function(event){var context=event.context,elements=flatten(values(context.closure.topLevel)),hints=context.hints;if(!hints||!1!==hints.autoResize){var expandings=groupBy(elements,function(element){return element.parent.id});forEach(expandings,function(elements,parentId){self._expand(elements,parentId)})}})}var inherits=require("inherits"),getBoundingBox=require("../../util/Elements").getBBox,asTRBL=require("../../layout/LayoutUtil").asTRBL,asBounds=require("../../layout/LayoutUtil").asBounds,assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),values=require("lodash/object/values"),flatten=require("lodash/array/flatten"),groupBy=require("lodash/collection/groupBy"),CommandInterceptor=require("../../command/CommandInterceptor");AutoResize.$inject=["eventBus","elementRegistry","modeling","rules"],inherits(AutoResize,CommandInterceptor),module.exports=AutoResize,AutoResize.prototype._getOptimalBounds=function(elements,target){var offset=this.getOffset(target),padding=this.getPadding(target),elementsTrbl=asTRBL(getBoundingBox(elements)),targetTrbl=asTRBL(target),newTrbl={};return elementsTrbl.top-targetTrbl.topvalues-TOLERANCE)return value-rem+values}return value}function mid(element){if(element.width)return{x:round(element.width/2+element.x),y:round(element.height/2+element.y)}}function getConnectionSegmentSnaps(context){var snapPoints=context.snapPoints,connection=context.connection,waypoints=connection.waypoints,segmentStart=context.segmentStart,segmentStartIndex=context.segmentStartIndex,segmentEnd=context.segmentEnd,segmentEndIndex=context.segmentEndIndex,axis=context.axis;if(snapPoints)return snapPoints;var referenceWaypoints=[waypoints[segmentStartIndex-1],segmentStart,segmentEnd,waypoints[segmentEndIndex+1]];return segmentStartIndex<2&&referenceWaypoints.unshift(mid(connection.source)),segmentEndIndex>waypoints.length-3&&referenceWaypoints.unshift(mid(connection.target)),context.snapPoints=snapPoints={horizontal:[],vertical:[]},forEach(referenceWaypoints,function(p){p&&(p=p.original||p,"y"===axis&&snapPoints.horizontal.push(p.y),"x"===axis&&snapPoints.vertical.push(p.x))}),snapPoints}function getBendpointSnaps(context){var snapPoints=context.snapPoints,waypoints=context.connection.waypoints,bendpointIndex=context.bendpointIndex;if(snapPoints)return snapPoints;var referenceWaypoints=[waypoints[bendpointIndex-1],waypoints[bendpointIndex+1]];return context.snapPoints=snapPoints={horizontal:[],vertical:[]},forEach(referenceWaypoints,function(p){p&&(p=p.original||p,snapPoints.horizontal.push(p.y),snapPoints.vertical.push(p.x))}),snapPoints}eventBus.on("connectionSegment.move.move",1500,function(event){var sx,sy,context=event.context,snapPoints=getConnectionSegmentSnaps(context),x=event.x,y=event.y;if(snapPoints){sx=snapTo(snapPoints.vertical,x),sy=snapTo(snapPoints.horizontal,y);var cx=x-sx,cy=y-sy;assign(event,{dx:event.dx-cx,dy:event.dy-cy,x:sx,y:sy})}}),eventBus.on("bendpoint.move.move",1500,function(event){var sx,sy,context=event.context,snapPoints=getBendpointSnaps(context),target=context.target,targetMid=target&&mid(target),x=event.x,y=event.y;if(snapPoints){sx=snapTo(targetMid?snapPoints.vertical.concat([targetMid.x]):snapPoints.vertical,x),sy=snapTo(targetMid?snapPoints.horizontal.concat([targetMid.y]):snapPoints.horizontal,y);var cx=x-sx,cy=y-sy;assign(event,{dx:event.dx-cx,dy:event.dy-cy,x:event.x-cx,y:event.y-cy})}})}var assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),isArray=require("lodash/lang/isArray"),abs=Math.abs,round=Math.round,TOLERANCE=10;BendpointSnapping.$inject=["eventBus"],module.exports=BendpointSnapping},{"lodash/collection/forEach":366,"lodash/lang/isArray":489,"lodash/object/assign":499}],202:[function(require,module,exports){"use strict";function createParallelDragger(parentGfx,position,alignment){var draggerGfx=svgCreate("g");svgAppend(parentGfx,draggerGfx);var visual=svgCreate("rect");svgAttr(visual,{x:-7,y:-1.5,width:14,height:3}),svgClasses(visual).add("djs-visual"),svgAppend(draggerGfx,visual);var hit=svgCreate("rect");return svgAttr(hit,{x:-10,y:-4.5,width:20,height:9}),svgClasses(hit).add("djs-hit"),svgAppend(draggerGfx,hit),rotate(draggerGfx,"h"===alignment?90:0,0,0),draggerGfx}var Events=require("../../util/Event"),Geometry=require("../../util/Geometry"),BENDPOINT_CLS=module.exports.BENDPOINT_CLS="djs-bendpoint",SEGMENT_DRAGGER_CLS=module.exports.SEGMENT_DRAGGER_CLS="djs-segment-dragger",svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgCreate=require("tiny-svg/lib/create"),rotate=require("../../util/SvgTransformUtil").rotate,translate=require("../../util/SvgTransformUtil").translate;module.exports.toCanvasCoordinates=function(canvas,event){var offset,position=Events.toPoint(event),clientRect=canvas._container.getBoundingClientRect();offset={x:clientRect.left,y:clientRect.top};var viewbox=canvas.viewbox();return{x:viewbox.x+(position.x-offset.x)/viewbox.scale,y:viewbox.y+(position.y-offset.y)/viewbox.scale}},module.exports.addBendpoint=function(parentGfx,cls){var groupGfx=svgCreate("g");svgClasses(groupGfx).add(BENDPOINT_CLS),svgAppend(parentGfx,groupGfx);var visual=svgCreate("circle");svgAttr(visual,{cx:0,cy:0,r:4}),svgClasses(visual).add("djs-visual"),svgAppend(groupGfx,visual);var hit=svgCreate("circle");return svgAttr(hit,{cx:0,cy:0,r:10}),svgClasses(hit).add("djs-hit"),svgAppend(groupGfx,hit),cls&&svgClasses(groupGfx).add(cls),groupGfx},module.exports.addSegmentDragger=function(parentGfx,segmentStart,segmentEnd){var groupGfx=svgCreate("g"),mid=Geometry.getMidPoint(segmentStart,segmentEnd),alignment=Geometry.pointsAligned(segmentStart,segmentEnd);return svgAppend(parentGfx,groupGfx),createParallelDragger(groupGfx,mid,alignment),svgClasses(groupGfx).add(SEGMENT_DRAGGER_CLS),svgClasses(groupGfx).add("h"===alignment?"vertical":"horizontal"),translate(groupGfx,mid.x,mid.y),groupGfx}},{"../../util/Event":327,"../../util/Geometry":328,"../../util/SvgTransformUtil":339,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/classes":546,"tiny-svg/lib/create":549}],203:[function(require,module,exports){"use strict";function Bendpoints(eventBus,canvas,interactionEvents,bendpointMove,connectionSegmentMove){function getConnectionIntersection(waypoints,event){var localPosition=BendpointUtil.toCanvasCoordinates(canvas,event);return getApproxIntersection(waypoints,localPosition)}function isIntersectionMiddle(intersection,waypoints,treshold){var p0,p1,mid,aligned,xDelta,yDelta,idx=intersection.index,p=intersection.point;return!(idx<=0||intersection.bendpoint)&&(p0=waypoints[idx-1],p1=waypoints[idx],mid=getMidPoint(p0,p1),aligned=pointsAligned(p0,p1),xDelta=Math.abs(p.x-mid.x),yDelta=Math.abs(p.y-mid.y),aligned&&xDelta<=treshold&&yDelta<=treshold)}function activateBendpointMove(event,connection){var waypoints=connection.waypoints,intersection=getConnectionIntersection(waypoints,event);intersection&&(isIntersectionMiddle(intersection,waypoints,10)?connectionSegmentMove.start(event,connection,intersection.index):bendpointMove.start(event,connection,intersection.index,!intersection.bendpoint))}function bindInteractionEvents(node,eventName,element){domEvent.bind(node,eventName,function(event){interactionEvents.triggerMouseEvent(eventName,event,element),event.stopPropagation()})}function getBendpointsContainer(element,create){var layer=canvas.getLayer("overlays"),gfx=domQuery(".djs-bendpoints[data-element-id="+element.id+"]",layer);return!gfx&&create&&(gfx=svgCreate("g"),svgAttr(gfx,{"data-element-id":element.id}),svgClasses(gfx).add("djs-bendpoints"),svgAppend(layer,gfx),bindInteractionEvents(gfx,"mousedown",element),bindInteractionEvents(gfx,"click",element),bindInteractionEvents(gfx,"dblclick",element)),gfx}function createBendpoints(gfx,connection){connection.waypoints.forEach(function(p,idx){var bendpoint=BendpointUtil.addBendpoint(gfx);svgAppend(gfx,bendpoint),translate(bendpoint,p.x,p.y)}),BendpointUtil.addBendpoint(gfx,"floating")}function createSegmentDraggers(gfx,connection){for(var segmentStart,segmentEnd,waypoints=connection.waypoints,i=1;iwaypointCount-3&&(targetToSegmentOrientation=LayoutUtil.getOrientation(connection.target,newSegmentEnd),segmentEndIndex===waypointCount-2?"intersect"===targetToSegmentOrientation&&(newWaypoints.pop(),newWaypoints[newWaypoints.length-1]=newSegmentEnd):"intersect"!==targetToSegmentOrientation&&newWaypoints.push(segmentEnd)),context.newWaypoints=connection.waypoints=cropConnection(connection,newWaypoints),updateDragger(context,segmentOffset,e),context.newSegmentStartIndex=segmentStartIndex+segmentOffset,redrawConnection(e)}),eventBus.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,canvas.addMarker(e.hover,MARKER_CONNECT_HOVER)}),eventBus.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var hover=e.context.hover;hover&&canvas.removeMarker(hover,MARKER_CONNECT_HOVER)}),eventBus.on("connectionSegment.move.cleanup",function(e){var context=e.context,connection=context.connection;context.draggerGfx&&svgRemove(context.draggerGfx),canvas.removeMarker(connection,MARKER_CONNECT_UPDATING)}),eventBus.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var context=e.context;context.connection.waypoints=context.originalWaypoints,redrawConnection(e)}),eventBus.on("connectionSegment.move.end",function(e){var context=e.context,connection=context.connection,newWaypoints=context.newWaypoints,newSegmentStartIndex=context.newSegmentStartIndex;newWaypoints=newWaypoints.map(function(p){return{original:p.original,x:Math.round(p.x),y:Math.round(p.y)}});var filtered=filterRedundantWaypoints(newWaypoints,newSegmentStartIndex),filteredWaypoints=filtered.waypoints,croppedWaypoints=cropConnection(connection,filteredWaypoints),segmentOffset=filtered.segmentOffset,hints={segmentMove:{segmentStartIndex:context.segmentStartIndex,newSegmentStartIndex:newSegmentStartIndex+segmentOffset}};modeling.updateWaypoints(connection,croppedWaypoints,hints)})}var Geometry=require("../../util/Geometry"),BendpointUtil=require("./BendpointUtil"),LayoutUtil=require("../../layout/LayoutUtil"),MARKER_CONNECT_HOVER="connect-hover",MARKER_CONNECT_UPDATING="djs-updating",svgClasses=require("tiny-svg/lib/classes"),svgRemove=require("tiny-svg/lib/remove"),translate=require("../../util/SvgTransformUtil").translate;ConnectionSegmentMove.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"],module.exports=ConnectionSegmentMove},{"../../layout/LayoutUtil":312,"../../util/Geometry":328,"../../util/SvgTransformUtil":339,"./BendpointUtil":202,"tiny-svg/lib/classes":546,"tiny-svg/lib/remove":552}],205:[function(require,module,exports){module.exports={__depends__:[require("../dragging"),require("../rules")],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",require("./Bendpoints")],bendpointMove:["type",require("./BendpointMove")],connectionSegmentMove:["type",require("./ConnectionSegmentMove")],bendpointSnapping:["type",require("./BendpointSnapping")]}},{"../dragging":222,"../rules":287,"./BendpointMove":200,"./BendpointSnapping":201,"./Bendpoints":203,"./ConnectionSegmentMove":204}],206:[function(require,module,exports){"use strict";function ChangeSupport(eventBus,canvas,elementRegistry,graphicsFactory){eventBus.on("element.changed",function(event){var element=event.element;(element.parent||element===canvas.getRootElement())&&(event.gfx=elementRegistry.getGraphics(element)),event.gfx&&eventBus.fire(getElementType(element)+".changed",event)}),eventBus.on("elements.changed",function(event){var elements=event.elements;elements.forEach(function(e){eventBus.fire("element.changed",{element:e})}),graphicsFactory.updateContainments(elements)}),eventBus.on("shape.changed",function(event){graphicsFactory.update("shape",event.element,event.gfx)}),eventBus.on("connection.changed",function(event){graphicsFactory.update("connection",event.element,event.gfx)})}var getElementType=require("../../util/Elements").getType;ChangeSupport.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"],module.exports=ChangeSupport},{"../../util/Elements":326}],207:[function(require,module,exports){module.exports={__init__:["changeSupport"],changeSupport:["type",require("./ChangeSupport")]}},{"./ChangeSupport":206}],208:[function(require,module,exports){"use strict";function Clipboard(){}module.exports=Clipboard,Clipboard.prototype.get=function(){return this._data},Clipboard.prototype.set=function(data){this._data=data},Clipboard.prototype.clear=function(){var data=this._data;return delete this._data,data},Clipboard.prototype.isEmpty=function(){return!this._data}},{}],209:[function(require,module,exports){module.exports={clipboard:["type",require("./Clipboard")]}},{"./Clipboard":208}],210:[function(require,module,exports){"use strict";function Connect(eventBus,dragging,modeling,rules,canvas,graphicsFactory){function canConnect(source,target){return rules.allowed("connection.create",{source:source,target:target})}function crop(start,end,source,target){var sourcePath=graphicsFactory.getShapePath(source),targetPath=target&&graphicsFactory.getShapePath(target),connectionPath=graphicsFactory.getConnectionPath({waypoints:[start,end]});return start=LayoutUtil.getElementLineIntersection(sourcePath,connectionPath,!0)||start,end=target&&LayoutUtil.getElementLineIntersection(targetPath,connectionPath,!1)||end,[start,end]}eventBus.on("connect.move",function(event){var endPosition,waypoints,context=event.context,source=context.source,target=context.target,visual=context.visual,sourcePosition=context.sourcePosition;endPosition={x:event.x,y:event.y},waypoints=crop(sourcePosition,endPosition,source,target),svgAttr(visual,{points:[waypoints[0].x,waypoints[0].y,waypoints[1].x,waypoints[1].y]})}),eventBus.on("connect.hover",function(event){var canExecute,context=event.context,source=context.source,hover=event.hover;null!==(canExecute=context.canExecute=canConnect(source,hover))&&(context.target=hover,canvas.addMarker(hover,canExecute?MARKER_OK:MARKER_NOT_OK))}),eventBus.on(["connect.out","connect.cleanup"],function(event){var context=event.context;context.target&&canvas.removeMarker(context.target,context.canExecute?MARKER_OK:MARKER_NOT_OK),context.target=null}),eventBus.on("connect.cleanup",function(event){var context=event.context;context.visual&&svgRemove(context.visual)}),eventBus.on("connect.start",function(event){var visual,context=event.context;visual=svgCreate("polyline"),svgAttr(visual,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),svgAppend(canvas.getDefaultLayer(),visual),context.visual=visual}),eventBus.on("connect.end",function(event){var context=event.context,source=context.source,sourcePosition=context.sourcePosition,target=context.target,targetPosition={x:event.x,y:event.y},canExecute=context.canExecute||canConnect(source,target);if(!canExecute)return!1;var attrs=null,hints={connectionStart:sourcePosition,connectionEnd:targetPosition};"object"==typeof canExecute&&(attrs=canExecute),modeling.connect(source,target,attrs,hints)}),this.start=function(event,source,sourcePosition,autoActivate){"object"!=typeof sourcePosition&&(autoActivate=sourcePosition,sourcePosition=LayoutUtil.getMid(source)),dragging.init(event,"connect",{autoActivate:autoActivate,data:{shape:source,context:{source:source,sourcePosition:sourcePosition}}})}}var LayoutUtil=require("../../layout/LayoutUtil"),MARKER_OK="connect-ok",MARKER_NOT_OK="connect-not-ok",svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create"),svgRemove=require("tiny-svg/lib/remove");Connect.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"],module.exports=Connect},{"../../layout/LayoutUtil":312,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/create":549,"tiny-svg/lib/remove":552}],211:[function(require,module,exports){module.exports={__depends__:[require("../selection"),require("../rules"),require("../dragging")],connect:["type",require("./Connect")]}},{"../dragging":222,"../rules":287,"../selection":293,"./Connect":210}],212:[function(require,module,exports){"use strict";function ContextPad(eventBus,overlays){this._providers=[],this._eventBus=eventBus,this._overlays=overlays,this._current=null,this._init()}function addClasses(element,classNames){var classes=domClasses(element);(isArray(classNames)?classNames:classNames.split(/\s+/g)).forEach(function(cls){classes.add(cls)})}var isFunction=require("lodash/lang/isFunction"),isArray=require("lodash/lang/isArray"),forEach=require("lodash/collection/forEach"),domDelegate=require("min-dom/lib/delegate"),domEvent=require("min-dom/lib/event"),domAttr=require("min-dom/lib/attr"),domQuery=require("min-dom/lib/query"),domClasses=require("min-dom/lib/classes"),domify=require("min-dom/lib/domify");ContextPad.$inject=["eventBus","overlays"],module.exports=ContextPad,ContextPad.prototype._init=function(){var eventBus=this._eventBus,self=this;eventBus.on("selection.changed",function(e){var selection=e.newSelection;1===selection.length?self.open(selection[0]):self.close()}),eventBus.on("elements.delete",function(event){var elements=event.elements;forEach(elements,function(e){self.isOpen(e)&&self.close()})}),eventBus.on("element.changed",function(event){var element=event.element,current=self._current;current&¤t.element===element&&self.open(element,!0)})},ContextPad.prototype.registerProvider=function(provider){this._providers.push(provider)},ContextPad.prototype.getEntries=function(element){var entries={};return forEach(this._providers,function(provider){var e=provider.getContextPadEntries(element);forEach(e,function(entry,id){entries[id]=entry})}),entries},ContextPad.prototype.trigger=function(action,event,autoActivate){var entry,handler,originalEvent,element=this._current.element,entries=this._current.entries,button=event.delegateTarget||event.target;if(!button)return event.preventDefault();if(entry=entries[domAttr(button,"data-action")],handler=entry.action,originalEvent=event.originalEvent||event,isFunction(handler)){if("click"===action)return handler(originalEvent,element,autoActivate)}else if(handler[action])return handler[action](originalEvent,element,autoActivate);event.preventDefault()},ContextPad.prototype.open=function(element,force){!force&&this.isOpen(element)||(this.close(),this._updateAndOpen(element))},ContextPad.prototype._updateAndOpen=function(element){var entries=this.getEntries(element),pad=this.getPad(element),html=pad.html;forEach(entries,function(entry,id){var container,grouping=entry.group||"default",control=domify(entry.html||'
');domAttr(control,"data-action",id),container=domQuery("[data-group="+grouping+"]",html),container||(container=domify('
'),html.appendChild(container)),container.appendChild(control),entry.className&&addClasses(control,entry.className),entry.title&&domAttr(control,"title",entry.title),entry.imageUrl&&control.appendChild(domify(''))}),domClasses(html).add("open"),this._current={element:element,pad:pad,entries:entries},this._eventBus.fire("contextPad.open",{current:this._current})},ContextPad.prototype.getPad=function(element){if(this.isOpen())return this._current.pad;var self=this,overlays=this._overlays,html=domify('
');domDelegate.bind(html,".entry","click",function(event){self.trigger("click",event)}),domDelegate.bind(html,".entry","dragstart",function(event){self.trigger("dragstart",event)}),domEvent.bind(html,"mousedown",function(event){event.stopPropagation()}),this._overlayId=overlays.add(element,"context-pad",{position:{right:-9,top:-6},html:html});var pad=overlays.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:element,pad:pad}),pad},ContextPad.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ContextPad.prototype.isOpen=function(element){return!(!this._current||element&&this._current.element!==element)}},{"lodash/collection/forEach":366,"lodash/lang/isArray":489,"lodash/lang/isFunction":491,"min-dom/lib/attr":514,"min-dom/lib/classes":515,"min-dom/lib/delegate":518,"min-dom/lib/domify":519,"min-dom/lib/event":520,"min-dom/lib/query":522}],213:[function(require,module,exports){module.exports={__depends__:[require("../interaction-events"),require("../overlays")],contextPad:["type",require("./ContextPad")]}},{"../interaction-events":230,"../overlays":271,"./ContextPad":212}],214:[function(require,module,exports){"use strict";function CopyPaste(eventBus,modeling,elementFactory,rules,clipboard,canvas){this._eventBus=eventBus,this._modeling=modeling,this._elementFactory=elementFactory,this._rules=rules,this._canvas=canvas,this._clipboard=clipboard,this._descriptors=[],this.registerDescriptor(function(element,descriptor){return descriptor.priority=1,descriptor.id=element.id,element.parent&&(descriptor.parent=element.parent.id),element.labelTarget&&(descriptor.priority=4,descriptor.labelTarget=element.labelTarget.id),element.host&&(descriptor.priority=2,descriptor.host=element.host.id),"number"==typeof element.x&&(descriptor.x=element.x,descriptor.y=element.y),element.width&&(descriptor.width=element.width,descriptor.height=element.height),element.waypoints&&(descriptor.priority=3,descriptor.waypoints=[],forEach(element.waypoints,function(waypoint){var wp={x:waypoint.x,y:waypoint.y};waypoint.original&&(wp.original={x:waypoint.original.x,y:waypoint.original.y}),descriptor.waypoints.push(wp)})),element.source&&element.target&&(descriptor.source=element.source.id,descriptor.target=element.target.id),descriptor})}var isArray=require("lodash/lang/isArray"),forEach=require("lodash/collection/forEach"),map=require("lodash/collection/map"),find=require("lodash/collection/find"),findIndex=require("lodash/array/findIndex"),sortBy=require("lodash/collection/sortBy"),reduce=require("lodash/collection/reduce"),getBBox=require("../../util/Elements").getBBox,PositionUtil=require("../../util/PositionUtil"),CopyPasteUtil=require("../../util/CopyPasteUtil"),ElementsUtil=require("../../util/Elements");CopyPaste.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"],module.exports=CopyPaste,CopyPaste.prototype.copy=function(selectedElements){var tree,bbox,clipboard=this._clipboard;if(isArray(selectedElements)||(selectedElements=selectedElements?[selectedElements]:[]),selectedElements.length)return tree=this.createTree(selectedElements),bbox=this._bbox=PositionUtil.center(getBBox(tree.allShapes)),delete tree.allShapes,forEach(tree,function(elements){forEach(elements,function(element){var delta,labelTarget;element.labelTarget?(labelTarget=find(elements,{id:element.labelTarget}),delta=labelTarget.waypoints?PositionUtil.delta(element,labelTarget.waypoints[0]):PositionUtil.delta(element,labelTarget)):3===element.priority?(delta=[],forEach(element.waypoints,function(waypoint){var waypointDelta=PositionUtil.delta(waypoint,bbox);delta.push(waypointDelta)},this)):delta=PositionUtil.delta(element,bbox),element.delta=delta})}),this._eventBus.fire("elements.copy",{context:{tree:tree}}),0===Object.keys(tree).length?clipboard.clear():clipboard.set(tree),this._eventBus.fire("elements.copied",{context:{tree:tree}}),tree},CopyPaste.prototype.paste=function(context){var newTree,clipboard=this._clipboard,modeling=this._modeling,eventBus=this._eventBus,rules=this._rules,tree=clipboard.get(),topParent=context.element,position=context.point;if(!clipboard.isEmpty()){if(newTree=reduce(tree,function(pasteTree,elements,depthStr){var depth=parseInt(depthStr,10);return isNaN(depth)?pasteTree:(pasteTree[depth]=elements,pasteTree)},{},this),!rules.allowed("elements.paste",{tree:newTree,target:topParent}))return void eventBus.fire("elements.paste.rejected",{context:{tree:newTree,position:position,target:topParent}});modeling.pasteElements(newTree,topParent,position)}},CopyPaste.prototype._computeDelta=function(elements,element){var bbox=this._bbox,delta={};return element.labelTarget?(console.log(elements),PositionUtil.delta(element,element.labelTarget)):(3===element.priority?(delta=[],forEach(element.waypoints,function(waypoint){var waypointDelta=PositionUtil.delta(waypoint,bbox);delta.push(waypointDelta)},this)):delta=PositionUtil.delta(element,bbox),delta)},CopyPaste.prototype.hasRelations=function(elements,element){var source,target;return!(element.waypoints&&(source=find(elements,{id:element.source.id}),target=find(elements,{id:element.target.id}),!source||!target))&&!(element.labelTarget&&!find(elements,{id:element.labelTarget.id}))},CopyPaste.prototype.registerDescriptor=function(descriptor){if("function"!=typeof descriptor)throw new Error("the descriptor must be a function");if(-1!==this._descriptors.indexOf(descriptor))throw new Error("this descriptor is already registered");this._descriptors.push(descriptor)},CopyPaste.prototype._executeDescriptors=function(data){return data.descriptor||(data.descriptor={}),forEach(this._descriptors,function(descriptor){data.descriptor=descriptor(data.element,data.descriptor)}),data},CopyPaste.prototype.createTree=function(elements){function canCopy(collection,element){return rules.allowed("element.copy",{collection:collection,element:element})}function includeElement(data){var element,idx=findIndex(includedElements,{element:data.element});if(-1===idx)return includedElements.push(data);element=includedElements[idx],element.depth=Math.min(rangeB.min,rangeB.max)&&Math.min(rangeA.min,rangeA.max)<=Math.max(rangeB.min,rangeB.max)},DistributeElements.prototype._findRange=function(element){var axis=element[this._axis];return{min:axis+5,max:axis+element[this._dimension]-5}}},{"lodash/collection/filter":364,"lodash/collection/forEach":366,"lodash/collection/sortBy":375}],219:[function(require,module,exports){"use strict";module.exports={__init__:["distributeElements"],distributeElements:["type",require("./DistributeElements")]}},{"./DistributeElements":218}],220:[function(require,module,exports){"use strict";function suppressEvent(event){event instanceof MouseEvent?Event.stopEvent(event,!0):Event.preventDefault(event)}function getLength(point){return Math.sqrt(Math.pow(point.x,2)+Math.pow(point.y,2))}function substract(p1,p2){return{x:p1.x-p2.x,y:p1.y-p2.y}}function Dragging(eventBus,canvas,selection){function toLocalPoint(globalPosition){var viewbox=canvas.viewbox(),clientRect=canvas._container.getBoundingClientRect();return{x:viewbox.x+round((globalPosition.x-clientRect.left)/viewbox.scale),y:viewbox.y+round((globalPosition.y-clientRect.top)/viewbox.scale)}}function fire(type,dragContext){dragContext=dragContext||context;var event=assign(new EventBusEvent,dragContext.payload,dragContext.data);return!1!==eventBus.fire("drag."+type,event)&&eventBus.fire(dragContext.prefix+"."+type,event)}function move(event,activate){var payload=context.payload,displacement=context.displacement,globalStart=context.globalStart,globalCurrent=Event.toPoint(event),globalDelta=substract(globalCurrent,globalStart),localStart=context.localStart,localCurrent=toLocalPoint(globalCurrent),localDelta=substract(localCurrent,localStart);if(!context.active&&(activate||getLength(globalDelta)>context.threshold)){if(assign(payload,{x:localStart.x+displacement.x,y:localStart.y+displacement.y,dx:0,dy:0},{originalEvent:event}),!1===fire("start"))return cancel();context.active=!0,context.keepSelection||(payload.previousSelection=selection.get(),selection.select(null)),context.cursor&&Cursor.set(context.cursor),canvas.addMarker(canvas.getRootElement(),DRAG_ACTIVE_CLS)}suppressEvent(event),context.active&&(assign(payload,{x:localCurrent.x+displacement.x,y:localCurrent.y+displacement.y,dx:localDelta.x,dy:localDelta.y},{originalEvent:event}),fire("move"))}function end(event){var previousContext,returnValue=!0;context.active&&(event&&(context.payload.originalEvent=event,suppressEvent(event)),returnValue=fire("end")),!1===returnValue&&fire("rejected"),previousContext=cleanup(!0!==returnValue),fire("ended",previousContext)}function checkCancel(event){27===event.which&&(event.preventDefault(),cancel())}function trapClickAndEnd(event){var untrap;context.active&&(untrap=ClickTrap.install(),setTimeout(untrap,400)),end(event)}function trapTouch(event){move(event)}function hover(event){var payload=context.payload;payload.hoverGfx=event.gfx,payload.hover=event.element,fire("hover")}function out(event){fire("out");var payload=context.payload;payload.hoverGfx=null,payload.hover=null}function cancel(restore){var previousContext;if(context){var wasActive=context.active;wasActive&&fire("cancel"),previousContext=cleanup(restore),wasActive&&fire("canceled",previousContext)}}function cleanup(restore){var previousContext,endDrag;fire("cleanup"),Cursor.unset(),endDrag=context.trapClick?trapClickAndEnd:end,domEvent.unbind(document,"mousemove",move),domEvent.unbind(document,"mousedown",endDrag,!0),domEvent.unbind(document,"mouseup",endDrag,!0),domEvent.unbind(document,"keyup",checkCancel),domEvent.unbind(document,"touchstart",trapTouch,!0),domEvent.unbind(document,"touchcancel",cancel,!0),domEvent.unbind(document,"touchmove",move,!0),domEvent.unbind(document,"touchend",end,!0),eventBus.off("element.hover",hover),eventBus.off("element.out",out),canvas.removeMarker(canvas.getRootElement(),DRAG_ACTIVE_CLS);var previousSelection=context.payload.previousSelection;return!1!==restore&&previousSelection&&!selection.get().length&&selection.select(previousSelection),previousContext=context,context=null,previousContext}function init(event,relativeTo,prefix,options){context&&cancel(!1),"string"==typeof relativeTo&&(options=prefix,prefix=relativeTo,relativeTo=null),options=assign({},defaultOptions,options||{});var originalEvent,globalStart,endDrag,data=options.data||{};endDrag=options.trapClick?trapClickAndEnd:end,event?(originalEvent=Event.getOriginal(event)||event,globalStart=Event.toPoint(event),suppressEvent(event)):(originalEvent=null,globalStart={x:0,y:0});var localStart=toLocalPoint(globalStart);relativeTo||(relativeTo=localStart),context=assign({prefix:prefix,data:data,payload:{},globalStart:globalStart,displacement:substract(relativeTo,localStart),localStart:localStart},options),options.manual||("undefined"!=typeof TouchEvent&&originalEvent instanceof TouchEvent?(domEvent.bind(document,"touchstart",trapTouch,!0),domEvent.bind(document,"touchcancel",cancel,!0),domEvent.bind(document,"touchmove",move,!0),domEvent.bind(document,"touchend",end,!0)):(domEvent.bind(document,"mousemove",move),domEvent.bind(document,"mousedown",endDrag,!0),domEvent.bind(document,"mouseup",endDrag,!0)),domEvent.bind(document,"keyup",checkCancel),eventBus.on("element.hover",hover),eventBus.on("element.out",out)),fire("init"),options.autoActivate&&move(event,!0)}var context,defaultOptions={threshold:5,trapClick:!0} +;eventBus.on("diagram.destroy",cancel),this.init=init,this.move=move,this.hover=hover,this.out=out,this.end=end,this.cancel=cancel,this.context=function(){return context},this.setOptions=function(options){assign(defaultOptions,options)}}var round=Math.round,assign=require("lodash/object/assign"),domEvent=require("min-dom/lib/event"),Event=require("../../util/Event"),ClickTrap=require("../../util/ClickTrap"),Cursor=require("../../util/Cursor"),EventBusEvent=require("../../core/EventBus").Event,DRAG_ACTIVE_CLS="djs-drag-active";Dragging.$inject=["eventBus","canvas","selection"],module.exports=Dragging},{"../../core/EventBus":185,"../../util/ClickTrap":322,"../../util/Cursor":325,"../../util/Event":327,"lodash/object/assign":499,"min-dom/lib/event":520}],221:[function(require,module,exports){"use strict";function getGfx(target){return domClosest(target,"svg, .djs-element",!0)}function HoverFix(eventBus,dragging,elementRegistry){var self=this;eventBus.on("drag.start",function(event){eventBus.once("drag.move",function(){eventBus.once("drag.move",function(event){self.ensureHover(event)})})}),this.ensureHover=function(event){if(!event.hover){var position,target,element,gfx,originalEvent=event.originalEvent;originalEvent instanceof MouseEvent&&(position=Event.toPoint(originalEvent),target=document.elementFromPoint(position.x,position.y),(gfx=getGfx(target))&&(element=elementRegistry.get(gfx),dragging.hover({element:element,gfx:gfx})))}}}var domClosest=require("min-dom/lib/closest"),Event=require("../../util/Event");HoverFix.$inject=["eventBus","dragging","elementRegistry"],module.exports=HoverFix},{"../../util/Event":327,"min-dom/lib/closest":517}],222:[function(require,module,exports){module.exports={__init__:["hoverFix"],__depends__:[require("../selection")],dragging:["type",require("./Dragging")],hoverFix:["type",require("./HoverFix")]}},{"../selection":293,"./Dragging":220,"./HoverFix":221}],223:[function(require,module,exports){"use strict";function EditorActions(eventBus,commandStack,modeling,selection,zoomScroll,copyPaste,canvas,rules,mouseTracking){this._actions={undo:function(){commandStack.undo()},redo:function(){commandStack.redo()},copy:function(){var selectedElements=selection.get();copyPaste.copy(selectedElements)},paste:function(){var context=mouseTracking.getHoverContext();copyPaste.paste(context)},stepZoom:function(opts){zoomScroll.stepZoom(opts.value)},zoom:function(opts){canvas.zoom(opts.value)},removeSelection:function(){var selectedElements=selection.get();if(selectedElements.length){var removableElements,allowed=rules.allowed("elements.delete",{elements:selectedElements});if(!1===allowed)return;removableElements=isArray(allowed)?allowed:selectedElements,removableElements.length&&modeling.removeElements(removableElements.slice())}},moveCanvas:function(opts){var dx=0,dy=0,invertY=opts.invertY,speed=opts.speed,actualSpeed=speed/Math.min(Math.sqrt(canvas.viewbox().scale),1);switch(opts.direction){case"left":dx=actualSpeed;break;case"up":dy=actualSpeed;break;case"right":dx=-actualSpeed;break;case"down":dy=-actualSpeed}dy&&invertY&&(dy=-dy),canvas.scroll({dx:dx,dy:dy})}}}function error(action,message){return new Error(action+" "+message)}var forEach=require("lodash/collection/forEach"),isArray=require("lodash/lang/isArray");EditorActions.$inject=["eventBus","commandStack","modeling","selection","zoomScroll","copyPaste","canvas","rules","mouseTracking"],module.exports=EditorActions,EditorActions.prototype.trigger=function(action,opts){if(!this._actions[action])throw error(action,"is not a registered action");return this._actions[action](opts)},EditorActions.prototype.register=function(actions,listener){if("string"==typeof actions)return this._registerAction(actions,listener);forEach(actions,function(listener,action){this._registerAction(action,listener)},this)},EditorActions.prototype._registerAction=function(action,listener){if(this.isRegistered(action))throw error(action,"is already registered");this._actions[action]=listener},EditorActions.prototype.unregister=function(action){if(!this.isRegistered(action))throw error(action,"is not a registered action");this._actions[action]=void 0},EditorActions.prototype.length=function(){return Object.keys(this._actions).length},EditorActions.prototype.isRegistered=function(action){return!!this._actions[action]}},{"lodash/collection/forEach":366,"lodash/lang/isArray":489}],224:[function(require,module,exports){module.exports={__depends__:[require("../selection"),require("../copy-paste"),require("../../navigation/zoomscroll")],__init__:["editorActions"],editorActions:["type",require("./EditorActions")]}},{"../../navigation/zoomscroll":320,"../copy-paste":215,"../selection":293,"./EditorActions":223}],225:[function(require,module,exports){"use strict";function GlobalConnect(eventBus,dragging,connect,canvas,toolManager){var self=this;this._dragging=dragging,toolManager.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),eventBus.on("global-connect.hover",function(event){var context=event.context,startTarget=event.hover,canStartConnect=context.canStartConnect=self.canStartConnect(startTarget);null!==canStartConnect&&(context.startTarget=startTarget,canvas.addMarker(startTarget,canStartConnect?MARKER_OK:MARKER_NOT_OK))}),eventBus.on(["global-connect.out","global-connect.cleanup"],function(event){var startTarget=event.context.startTarget,canStartConnect=event.context.canStartConnect;startTarget&&canvas.removeMarker(startTarget,canStartConnect?MARKER_OK:MARKER_NOT_OK)}),eventBus.on(["global-connect.ended"],function(event){var context=event.context,startTarget=context.startTarget,startPosition={x:event.x,y:event.y};if(self.canStartConnect(startTarget))return eventBus.once("element.out",function(){eventBus.once(["connect.ended","connect.canceled"],function(){eventBus.fire("global-connect.drag.ended")}),connect.start(null,startTarget,startPosition)}),!1})}var MARKER_OK="connect-ok",MARKER_NOT_OK="connect-not-ok";GlobalConnect.$inject=["eventBus","dragging","connect","canvas","toolManager"],module.exports=GlobalConnect,GlobalConnect.prototype.start=function(event){this._dragging.init(event,"global-connect",{trapClick:!1,data:{context:{}}})},GlobalConnect.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},GlobalConnect.prototype.isActive=function(){var context=this._dragging.context();return context&&/^global-connect/.test(context.prefix)},GlobalConnect.prototype.registerProvider=function(provider){this._provider=provider},GlobalConnect.prototype.canStartConnect=function(startTarget){return this._provider.canStartConnect(startTarget)}},{}],226:[function(require,module,exports){module.exports={__depends__:[require("../connect"),require("../rules"),require("../dragging"),require("../tool-manager")],globalConnect:["type",require("./GlobalConnect")]}},{"../connect":211,"../dragging":222,"../rules":287,"../tool-manager":302,"./GlobalConnect":225}],227:[function(require,module,exports){"use strict";function HandTool(eventBus,canvas,dragging,toolManager){this._dragging=dragging,toolManager.registerTool("hand",{tool:"hand",dragging:"hand.move"}),eventBus.on("element.mousedown",HIGH_PRIORITY,function(event){if(hasPrimaryModifier(event))return this.activateMove(event.originalEvent),!1},this),eventBus.on("hand.end",function(event){var target=event.originalEvent.target;if(!(event.hover||target instanceof SVGElement))return!1;eventBus.once("hand.ended",function(){this.activateMove(event.originalEvent,{reactivate:!0})},this)},this),eventBus.on("hand.move.move",function(event){var scale=canvas.viewbox().scale;canvas.scroll({dx:event.dx*scale,dy:event.dy*scale})}),eventBus.on("hand.move.end",function(event){var context=event.context,reactivate=context.reactivate;return!hasPrimaryModifier(event)&&reactivate&&eventBus.once("hand.move.ended",function(event){this.activateHand(event.originalEvent,!0,!0)},this),!1},this)}var hasPrimaryModifier=require("../../util/Mouse").hasPrimaryModifier,HIGH_PRIORITY=1500;HandTool.$inject=["eventBus","canvas","dragging","toolManager"],module.exports=HandTool,HandTool.prototype.activateMove=function(event,autoActivate,context){"object"==typeof autoActivate&&(context=autoActivate,autoActivate=!1),this._dragging.init(event,"hand.move",{autoActivate:autoActivate,cursor:"grab",data:{context:context||{}}})},HandTool.prototype.activateHand=function(event,autoActivate,reactivate){this._dragging.init(event,"hand",{trapClick:!1,autoActivate:autoActivate,cursor:"grab",data:{context:{reactivate:reactivate}}})},HandTool.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},HandTool.prototype.isActive=function(){var context=this._dragging.context();return context&&/^hand/.test(context.prefix)}},{"../../util/Mouse":334}],228:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../tool-manager")],__init__:["handTool"],handTool:["type",require("./HandTool")]}},{"../tool-manager":302,"./HandTool":227}],229:[function(require,module,exports){"use strict";function InteractionEvents(eventBus,elementRegistry,styles){function fire(type,event,element){if(isPrimaryButton(event)){var target,gfx;element?gfx=elementRegistry.getGraphics(element):(target=event.delegateTarget||event.target)&&(gfx=target,element=elementRegistry.get(gfx)),gfx&&element&&!1===eventBus.fire(type,{element:element,gfx:gfx,originalEvent:event})&&(event.stopPropagation(),event.preventDefault())}}function mouseHandler(type){var fn=handlers[type];return fn||(fn=handlers[type]=function(event){fire(type,event)}),fn}function triggerMouseEvent(eventName,event,targetElement){var localEventName=bindings[eventName];if(!localEventName)throw new Error("unmapped DOM event name <"+eventName+">");return fire(localEventName,event,targetElement)}function registerEvent(node,event,localEvent){var handler=mouseHandler(localEvent);handler.$delegate=domDelegate.bind(node,elementSelector,event,handler)}function unregisterEvent(node,event,localEvent){domDelegate.unbind(node,event,mouseHandler(localEvent).$delegate)}function registerEvents(svg){forEach(bindings,function(val,key){registerEvent(svg,key,val)})}function unregisterEvents(svg){forEach(bindings,function(val,key){unregisterEvent(svg,key,val)})}var HIT_STYLE=styles.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15}),handlers={},bindings={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup"},elementSelector="svg, .djs-element";eventBus.on("canvas.destroy",function(event){unregisterEvents(event.svg)}),eventBus.on("canvas.init",function(event){registerEvents(event.svg)}),eventBus.on(["shape.added","connection.added"],function(event){var hit,element=event.element,gfx=event.gfx;element.waypoints?hit=createLine(element.waypoints):(hit=svgCreate("rect"),svgAttr(hit,{x:0,y:0,width:element.width,height:element.height})),svgAttr(hit,HIT_STYLE),svgAppend(gfx,hit)}),eventBus.on("shape.changed",LOW_PRIORITY,function(event){var element=event.element,gfx=event.gfx,hit=domQuery(".djs-hit",gfx);svgAttr(hit,{width:element.width,height:element.height})}),eventBus.on("connection.changed",function(event){var element=event.element,gfx=event.gfx,hit=domQuery(".djs-hit",gfx);updateLine(hit,element.waypoints)}),this.fire=fire,this.triggerMouseEvent=triggerMouseEvent,this.mouseHandler=mouseHandler,this.registerEvent=registerEvent,this.unregisterEvent=unregisterEvent}var forEach=require("lodash/collection/forEach"),domDelegate=require("min-dom/lib/delegate"),isPrimaryButton=require("../../util/Mouse").isPrimaryButton,svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create"),domQuery=require("min-dom/lib/query"),renderUtil=require("../../util/RenderUtil"),createLine=renderUtil.createLine,updateLine=renderUtil.updateLine,LOW_PRIORITY=500;InteractionEvents.$inject=["eventBus","elementRegistry","styles"],module.exports=InteractionEvents},{"../../util/Mouse":334,"../../util/RenderUtil":338,"lodash/collection/forEach":366,"min-dom/lib/delegate":518,"min-dom/lib/query":522,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/create":549}],230:[function(require,module,exports){module.exports={__init__:["interactionEvents"],interactionEvents:["type",require("./InteractionEvents")]}},{"./InteractionEvents":229}],231:[function(require,module,exports){"use strict";function Keyboard(config,eventBus,editorActions){var self=this;this._config=config||{},this._eventBus=eventBus,this._editorActions=editorActions,this._listeners=[],this._keyHandler=function(event){var i,l,target=event.target,listeners=self._listeners,code=event.keyCode||event.charCode||-1;if(!target||!domMatches(target,"input, textarea")&&"true"!==target.contentEditable)for(i=0;l=listeners[i];i++)l(code,event)&&(event.preventDefault(),event.stopPropagation())},eventBus.on("diagram.destroy",function(){self._fire("destroy"),self.unbind(),self._listeners=null}),eventBus.on("diagram.init",function(){self._fire("init"),config&&config.bindTo&&self.bind(config.bindTo)}),this._init()}function hasModifier(modifiers){return modifiers.ctrlKey||modifiers.metaKey||modifiers.shiftKey||modifiers.altKey}function isCmd(modifiers){return modifiers.ctrlKey||modifiers.metaKey}function isShift(modifiers){return modifiers.shiftKey}var domEvent=require("min-dom/lib/event"),domMatches=require("min-dom/lib/matches");Keyboard.$inject=["config.keyboard","eventBus","editorActions"],module.exports=Keyboard,Keyboard.prototype.bind=function(node){this.unbind(),this._node=node,domEvent.bind(node,"keydown",this._keyHandler,!0),this._fire("bind")},Keyboard.prototype.getBinding=function(){return this._node},Keyboard.prototype.unbind=function(){var node=this._node;node&&(this._fire("unbind"),domEvent.unbind(node,"keydown",this._keyHandler,!0)),this._node=null},Keyboard.prototype._fire=function(event){this._eventBus.fire("keyboard."+event,{node:this._node,listeners:this._listeners})},Keyboard.prototype._init=function(){function undo(key,modifiers){if(isCmd(modifiers)&&!isShift(modifiers)&&90===key)return editorActions.trigger("undo"),!0}function redo(key,modifiers){if(isCmd(modifiers)&&(89===key||90===key&&isShift(modifiers)))return editorActions.trigger("redo"),!0}function copy(key,modifiers){if(isCmd(modifiers)&&67===key)return editorActions.trigger("copy"),!0}function paste(key,modifiers){if(isCmd(modifiers)&&86===key)return editorActions.trigger("paste"),!0}function zoomIn(key,modifiers){if((107===key||187===key||171===key||61===key)&&isCmd(modifiers))return editorActions.trigger("stepZoom",{value:1}),!0}function zoomOut(key,modifiers){if((109===key||189===key||173===key)&&isCmd(modifiers))return editorActions.trigger("stepZoom",{value:-1}),!0}function zoomDefault(key,modifiers){if((96===key||48===key)&&isCmd(modifiers))return editorActions.trigger("zoom",{value:1}),!0}function removeSelection(key,modifiers){if(46===key)return editorActions.trigger("removeSelection"),!0}function moveCanvas(key,modifiers){if([37,38,39,40].indexOf(key)>=0){var opts={invertY:config.invertY,speed:config.speed||50};switch(key){case 37:opts.direction="left";break;case 38:opts.direction="up";break;case 39:opts.direction="right";break;case 40:opts.direction="down"}return editorActions.trigger("moveCanvas",opts),!0}}var listeners=this._listeners,editorActions=this._editorActions,config=this._config;listeners.push(undo),listeners.push(redo),listeners.push(copy),listeners.push(paste),listeners.push(removeSelection),listeners.push(zoomIn),listeners.push(zoomOut),listeners.push(zoomDefault),listeners.push(moveCanvas)},Keyboard.prototype.addListener=function(listenerFn){this._listeners.push(listenerFn)},Keyboard.prototype.hasModifier=hasModifier,Keyboard.prototype.isCmd=isCmd,Keyboard.prototype.isShift=isShift},{"min-dom/lib/event":520,"min-dom/lib/matches":521}],232:[function(require,module,exports){module.exports={__init__:["keyboard"],keyboard:["type",require("./Keyboard")]}},{"./Keyboard":231}],233:[function(require,module,exports){"use strict";function LabelSupport(eventBus,modeling,movePreview){CommandInterceptor.call(this,eventBus),eventBus.on("shape.move.start",HIGH_PRIORITY,function(e){var context=e.context,shapes=context.shapes,validatedShapes=context.validatedShapes;context.shapes=removeLabels(shapes),context.validatedShapes=removeLabels(validatedShapes)}),eventBus.on("shape.move.start",LOW_PRIORITY,function(e){var context=e.context,shapes=context.shapes,labels=[];forEach(shapes,function(element){var label=element.label;label&&!label.hidden&&-1===context.shapes.indexOf(label)&&labels.push(label),element.labelTarget&&labels.push(element)}),forEach(labels,function(label){movePreview.makeDraggable(context,label,!0)})}),this.postExecuted(["elements.move"],function(e){var context=e.context,closure=context.closure,enclosedElements=closure.enclosedElements;forEach(enclosedElements,function(e){e.label&&!enclosedElements[e.label.id]&&modeling.moveShape(e.label,context.delta,e.parent)})})}function removeLabels(elements){return filter(elements,function(element){return-1===elements.indexOf(element.labelTarget)})}var forEach=require("lodash/collection/forEach"),filter=require("lodash/collection/filter"),inherits=require("inherits"),LOW_PRIORITY=250,HIGH_PRIORITY=1400,CommandInterceptor=require("../../command/CommandInterceptor");inherits(LabelSupport,CommandInterceptor),LabelSupport.$inject=["eventBus","modeling","movePreview"],module.exports=LabelSupport},{"../../command/CommandInterceptor":179,inherits:351,"lodash/collection/filter":364,"lodash/collection/forEach":366}],234:[function(require,module,exports){module.exports={__depends__:[require("../move")],__init__:["labelSupport"],labelSupport:["type",require("./LabelSupport")]}},{"../move":266,"./LabelSupport":233}],235:[function(require,module,exports){"use strict";function LassoTool(eventBus,canvas,dragging,elementRegistry,selection,toolManager){this._selection=selection,this._dragging=dragging;var self=this,visuals={create:function(context){var frame,container=canvas.getDefaultLayer();frame=context.frame=svgCreate("rect"),svgAttr(frame,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),svgAppend(container,frame)},update:function(context){var frame=context.frame,bbox=context.bbox;svgAttr(frame,{x:bbox.x,y:bbox.y,width:bbox.width,height:bbox.height})},remove:function(context){context.frame&&svgRemove(context.frame)}};toolManager.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),eventBus.on("lasso.selection.end",function(event){var target=event.originalEvent.target;(event.hover||target instanceof SVGElement)&&eventBus.once("lasso.selection.ended",function(){self.activateLasso(event.originalEvent,!0)})}),eventBus.on("lasso.end",function(event){var bbox=toBBox(event),elements=elementRegistry.filter(function(element){return element});self.select(elements,bbox)}),eventBus.on("lasso.start",function(event){var context=event.context;context.bbox=toBBox(event),visuals.create(context)}),eventBus.on("lasso.move",function(event){var context=event.context;context.bbox=toBBox(event),visuals.update(context)}),eventBus.on("lasso.cleanup",function(event){var context=event.context;visuals.remove(context)}),eventBus.on("element.mousedown",1500,function(event){hasSecondaryModifier(event)&&(self.activateLasso(event.originalEvent),event.stopPropagation())})}function toBBox(event){var start={x:event.x-event.dx,y:event.y-event.dy},end={x:event.x,y:event.y};return start.x<=end.x&&start.y=end.x&&start.yend.x&&start.y<=end.y?{x:end.x,y:start.y,width:start.x-end.x,height:end.y-start.y}:start.x<=end.x&&start.y>end.y||start.x=end.y?{x:start.x,y:end.y,width:end.x-start.x,height:start.y-end.y}:start.x>=end.x&&start.y>end.y||start.x>end.x&&start.y>=end.y?{x:end.x,y:end.y,width:start.x-end.x,height:start.y-end.y}:{x:end.x,y:end.y,width:0,height:0}}var values=require("lodash/object/values"),getEnclosedElements=require("../../util/Elements").getEnclosedElements,hasSecondaryModifier=require("../../util/Mouse").hasSecondaryModifier,svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create"),svgRemove=require("tiny-svg/lib/remove");LassoTool.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"],module.exports=LassoTool,LassoTool.prototype.activateLasso=function(event,autoActivate){this._dragging.init(event,"lasso",{autoActivate:autoActivate,cursor:"crosshair",data:{context:{}}})},LassoTool.prototype.activateSelection=function(event){this._dragging.init(event,"lasso.selection",{trapClick:!1,cursor:"crosshair",data:{context:{}}})},LassoTool.prototype.select=function(elements,bbox){var selectedElements=getEnclosedElements(elements,bbox);this._selection.select(values(selectedElements))},LassoTool.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},LassoTool.prototype.isActive=function(){var context=this._dragging.context();return context&&/^lasso/.test(context.prefix)}},{"../../util/Elements":326,"../../util/Mouse":334,"lodash/object/values":510,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/create":549,"tiny-svg/lib/remove":552}],236:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../tool-manager")],__init__:["lassoTool"],lassoTool:["type",require("./LassoTool")]}},{"../tool-manager":302,"./LassoTool":235}],237:[function(require,module,exports){"use strict";function Modeling(eventBus,elementFactory,commandStack){this._eventBus=eventBus,this._elementFactory=elementFactory,this._commandStack=commandStack;var self=this;eventBus.on("diagram.init",function(){self.registerHandlers(commandStack)})}var forEach=require("lodash/collection/forEach"),model=require("../../model");Modeling.$inject=["eventBus","elementFactory","commandStack"],module.exports=Modeling,Modeling.prototype.getHandlers=function(){return{"shape.append":require("./cmd/AppendShapeHandler"),"shape.create":require("./cmd/CreateShapeHandler"),"shape.delete":require("./cmd/DeleteShapeHandler"),"shape.move":require("./cmd/MoveShapeHandler"),"shape.resize":require("./cmd/ResizeShapeHandler"),"shape.replace":require("./cmd/ReplaceShapeHandler"),"shape.toggleCollapse":require("./cmd/ToggleShapeCollapseHandler"),spaceTool:require("./cmd/SpaceToolHandler"),"label.create":require("./cmd/CreateLabelHandler"),"connection.create":require("./cmd/CreateConnectionHandler"),"connection.delete":require("./cmd/DeleteConnectionHandler"),"connection.move":require("./cmd/MoveConnectionHandler"),"connection.layout":require("./cmd/LayoutConnectionHandler"),"connection.updateWaypoints":require("./cmd/UpdateWaypointsHandler"),"connection.reconnectStart":require("./cmd/ReconnectConnectionHandler"),"connection.reconnectEnd":require("./cmd/ReconnectConnectionHandler"),"elements.move":require("./cmd/MoveElementsHandler"),"elements.delete":require("./cmd/DeleteElementsHandler"),"elements.distribute":require("./cmd/DistributeElementsHandler"),"elements.align":require("./cmd/AlignElementsHandler"),"element.updateAttachment":require("./cmd/UpdateAttachmentHandler"),"elements.paste":require("./cmd/PasteHandler")}},Modeling.prototype.registerHandlers=function(commandStack){forEach(this.getHandlers(),function(handler,id){commandStack.registerHandler(id,handler)})},Modeling.prototype.moveShape=function(shape,delta,newParent,newParentIndex,hints){"object"==typeof newParentIndex&&(hints=newParentIndex,newParentIndex=null);var context={shape:shape,delta:delta,newParent:newParent,newParentIndex:newParentIndex,hints:hints||{}};this._commandStack.execute("shape.move",context)},Modeling.prototype.updateAttachment=function(shape,newHost){var context={shape:shape,newHost:newHost};this._commandStack.execute("element.updateAttachment",context)},Modeling.prototype.moveElements=function(shapes,delta,target,isAttach,hints){"object"==typeof isAttach&&(hints=isAttach,isAttach=void 0);var newHost,newParent=target;!0===isAttach&&(newHost=target,newParent=target.parent),!1===isAttach&&(newHost=null);var context={shapes:shapes,delta:delta,newParent:newParent,newHost:newHost,hints:hints||{}};this._commandStack.execute("elements.move",context)},Modeling.prototype.moveConnection=function(connection,delta,newParent,newParentIndex,hints){"object"==typeof newParentIndex&&(hints=newParentIndex,newParentIndex=void 0);var context={connection:connection,delta:delta,newParent:newParent,newParentIndex:newParentIndex,hints:hints||{}};this._commandStack.execute("connection.move",context)},Modeling.prototype.layoutConnection=function(connection,hints){var context={connection:connection,hints:hints||{}};this._commandStack.execute("connection.layout",context)},Modeling.prototype.createConnection=function(source,target,targetIndex,connection,parent,hints){"object"==typeof targetIndex&&(hints=parent,parent=connection,connection=targetIndex,targetIndex=void 0),connection=this._create("connection",connection);var context={source:source,target:target,parent:parent,parentIndex:targetIndex,connection:connection,hints:hints};return this._commandStack.execute("connection.create",context),context.connection},Modeling.prototype.createShape=function(shape,position,target,targetIndex,isAttach,hints){"number"!=typeof targetIndex&&(hints=isAttach,isAttach=targetIndex),"boolean"!=typeof isAttach&&(hints=isAttach,isAttach=!1),shape=this._create("shape",shape);var context={position:position,shape:shape,parent:target,parentIndex:targetIndex,host:shape.host,hints:hints||{}};return isAttach&&(context.parent=target.parent,context.host=target),this._commandStack.execute("shape.create",context),context.shape},Modeling.prototype.createLabel=function(labelTarget,position,label,parent){label=this._create("label",label);var context={labelTarget:labelTarget,position:position,parent:parent||labelTarget.parent,shape:label};return this._commandStack.execute("label.create",context),context.shape},Modeling.prototype.appendShape=function(source,shape,position,parent,connection,connectionParent){shape=this._create("shape",shape);var context={source:source,position:position,parent:parent,shape:shape,connection:connection,connectionParent:connectionParent};return this._commandStack.execute("shape.append",context),context.shape},Modeling.prototype.removeElements=function(elements){var context={elements:elements};this._commandStack.execute("elements.delete",context)},Modeling.prototype.distributeElements=function(groups,axis,dimension){var context={groups:groups,axis:axis,dimension:dimension};this._commandStack.execute("elements.distribute",context)},Modeling.prototype.removeShape=function(shape,hints){var context={shape:shape,hints:hints||{}};this._commandStack.execute("shape.delete",context)},Modeling.prototype.removeConnection=function(connection,hints){var context={connection:connection,hints:hints||{}};this._commandStack.execute("connection.delete",context)},Modeling.prototype.replaceShape=function(oldShape,newShape,hints){var context={oldShape:oldShape,newData:newShape,hints:hints||{}};return this._commandStack.execute("shape.replace",context),context.newShape},Modeling.prototype.pasteElements=function(tree,topParent,position){var context={tree:tree,topParent:topParent,position:position};this._commandStack.execute("elements.paste",context)},Modeling.prototype.alignElements=function(elements,alignment){var context={elements:elements,alignment:alignment};this._commandStack.execute("elements.align",context)},Modeling.prototype.resizeShape=function(shape,newBounds){var context={shape:shape,newBounds:newBounds};this._commandStack.execute("shape.resize",context)},Modeling.prototype.createSpace=function(movingShapes,resizingShapes,delta,direction){var context={movingShapes:movingShapes,resizingShapes:resizingShapes,delta:delta,direction:direction};this._commandStack.execute("spaceTool",context)},Modeling.prototype.updateWaypoints=function(connection,newWaypoints,hints){var context={connection:connection,newWaypoints:newWaypoints,hints:hints||{}};this._commandStack.execute("connection.updateWaypoints",context)},Modeling.prototype.reconnectStart=function(connection,newSource,dockingOrPoints){var context={connection:connection,newSource:newSource,dockingOrPoints:dockingOrPoints};this._commandStack.execute("connection.reconnectStart",context)},Modeling.prototype.reconnectEnd=function(connection,newTarget,dockingOrPoints){var context={connection:connection,newTarget:newTarget,dockingOrPoints:dockingOrPoints};this._commandStack.execute("connection.reconnectEnd",context)},Modeling.prototype.connect=function(source,target,attrs,hints){return this.createConnection(source,target,attrs||{},source.parent,hints)},Modeling.prototype._create=function(type,attrs){return attrs instanceof model.Base?attrs:this._elementFactory.create(type,attrs)},Modeling.prototype.toggleCollapse=function(shape,hints){var context={shape:shape,hints:hints||{}};this._commandStack.execute("shape.toggleCollapse",context)}},{"../../model":314,"./cmd/AlignElementsHandler":238,"./cmd/AppendShapeHandler":239,"./cmd/CreateConnectionHandler":240,"./cmd/CreateLabelHandler":241,"./cmd/CreateShapeHandler":242,"./cmd/DeleteConnectionHandler":243,"./cmd/DeleteElementsHandler":244,"./cmd/DeleteShapeHandler":245,"./cmd/DistributeElementsHandler":246,"./cmd/LayoutConnectionHandler":247,"./cmd/MoveConnectionHandler":248,"./cmd/MoveElementsHandler":249,"./cmd/MoveShapeHandler":250,"./cmd/PasteHandler":252,"./cmd/ReconnectConnectionHandler":253,"./cmd/ReplaceShapeHandler":254,"./cmd/ResizeShapeHandler":255,"./cmd/SpaceToolHandler":256,"./cmd/ToggleShapeCollapseHandler":257,"./cmd/UpdateAttachmentHandler":258,"./cmd/UpdateWaypointsHandler":259,"lodash/collection/forEach":366}],238:[function(require,module,exports){"use strict";function AlignElements(modeling,canvas){this._modeling=modeling,this._canvas=canvas}var forEach=require("lodash/collection/forEach");AlignElements.$inject=["modeling","canvas"],module.exports=AlignElements,AlignElements.prototype.preExecute=function(context){var modeling=this._modeling,elements=context.elements,alignment=context.alignment;forEach(elements,function(element){var delta={x:0,y:0};alignment.left?delta.x=alignment.left-element.x:alignment.right?delta.x=alignment.right-element.width-element.x:alignment.center?delta.x=alignment.center-Math.round(element.width/2)-element.x:alignment.top?delta.y=alignment.top-element.y:alignment.bottom?delta.y=alignment.bottom-element.height-element.y:alignment.middle&&(delta.y=alignment.middle-Math.round(element.height/2)-element.y),modeling.moveElements([element],delta,element.parent)})},AlignElements.prototype.postExecute=function(context){}},{"lodash/collection/forEach":366}],239:[function(require,module,exports){"use strict";function AppendShapeHandler(modeling){this._modeling=modeling}function existsConnection(source,target){return any(source.outgoing,function(c){return c.target===target})}var any=require("lodash/collection/any");require("inherits")(AppendShapeHandler,require("./NoopHandler")),AppendShapeHandler.$inject=["modeling"],module.exports=AppendShapeHandler,AppendShapeHandler.prototype.preExecute=function(context){if(!context.source)throw new Error("source required");var parent=context.parent||context.source.parent,shape=this._modeling.createShape(context.shape,context.position,parent);context.shape=shape},AppendShapeHandler.prototype.postExecute=function(context){var parent=context.connectionParent||context.shape.parent;existsConnection(context.source,context.shape)||this._modeling.connect(context.source,context.shape,context.connection,parent)}},{"./NoopHandler":251,inherits:351,"lodash/collection/any":362}],240:[function(require,module,exports){ +"use strict";function CreateConnectionHandler(canvas,layouter){this._canvas=canvas,this._layouter=layouter}CreateConnectionHandler.$inject=["canvas","layouter"],module.exports=CreateConnectionHandler,CreateConnectionHandler.prototype.execute=function(context){var connection=context.connection,source=context.source,target=context.target,parent=context.parent,hints=context.hints;if(!source||!target)throw new Error("source and target required");if(!parent)throw new Error("parent required");return connection.source=source,connection.target=target,connection.waypoints||(connection.waypoints=this._layouter.layoutConnection(connection,hints)),this._canvas.addConnection(connection,parent),connection},CreateConnectionHandler.prototype.revert=function(context){var connection=context.connection;this._canvas.removeConnection(connection),connection.source=null,connection.target=null}},{}],241:[function(require,module,exports){"use strict";function CreateLabelHandler(canvas){CreateShapeHandler.call(this,canvas)}function ensureValidDimensions(label){["width","height"].forEach(function(prop){void 0===label[prop]&&(label[prop]=0)})}var inherits=require("inherits"),CreateShapeHandler=require("./CreateShapeHandler");inherits(CreateLabelHandler,CreateShapeHandler),CreateLabelHandler.$inject=["canvas"],module.exports=CreateLabelHandler;var originalExecute=CreateShapeHandler.prototype.execute;CreateLabelHandler.prototype.execute=function(context){var label=context.shape;return ensureValidDimensions(label),label.labelTarget=context.labelTarget,originalExecute.call(this,context)};var originalRevert=CreateShapeHandler.prototype.revert;CreateLabelHandler.prototype.revert=function(context){return context.shape.labelTarget=null,originalRevert.call(this,context)}},{"./CreateShapeHandler":242,inherits:351}],242:[function(require,module,exports){"use strict";function CreateShapeHandler(canvas){this._canvas=canvas}var assign=require("lodash/object/assign"),round=Math.round;CreateShapeHandler.$inject=["canvas"],module.exports=CreateShapeHandler,CreateShapeHandler.prototype.execute=function(context){var shape=context.shape,positionOrBounds=context.position,parent=context.parent,parentIndex=context.parentIndex;if(!parent)throw new Error("parent required");if(!positionOrBounds)throw new Error("position required");return void 0!==positionOrBounds.width?assign(shape,positionOrBounds):assign(shape,{x:positionOrBounds.x-round(shape.width/2),y:positionOrBounds.y-round(shape.height/2)}),this._canvas.addShape(shape,parent,parentIndex),shape},CreateShapeHandler.prototype.revert=function(context){this._canvas.removeShape(context.shape)}},{"lodash/object/assign":499}],243:[function(require,module,exports){"use strict";function DeleteConnectionHandler(canvas,modeling){this._canvas=canvas,this._modeling=modeling}var Collections=require("../../../util/Collections");DeleteConnectionHandler.$inject=["canvas","modeling"],module.exports=DeleteConnectionHandler,DeleteConnectionHandler.prototype.preExecute=function(context){var connection=context.connection;connection.label&&this._modeling.removeShape(connection.label)},DeleteConnectionHandler.prototype.execute=function(context){var connection=context.connection,parent=connection.parent;return context.parent=parent,context.parentIndex=Collections.indexOf(parent.children,connection),context.source=connection.source,context.target=connection.target,this._canvas.removeConnection(connection),connection.source=null,connection.target=null,connection.label=null,connection},DeleteConnectionHandler.prototype.revert=function(context){var connection=context.connection,parent=context.parent,parentIndex=context.parentIndex;return connection.source=context.source,connection.target=context.target,Collections.add(parent.children,connection,parentIndex),this._canvas.addConnection(connection,parent),connection}},{"../../../util/Collections":323}],244:[function(require,module,exports){"use strict";function DeleteElementsHandler(modeling,elementRegistry){this._modeling=modeling,this._elementRegistry=elementRegistry}var forEach=require("lodash/collection/forEach");require("inherits")(DeleteElementsHandler,require("./NoopHandler")),DeleteElementsHandler.$inject=["modeling","elementRegistry"],module.exports=DeleteElementsHandler,DeleteElementsHandler.prototype.postExecute=function(context){var modeling=this._modeling,elementRegistry=this._elementRegistry,elements=context.elements;forEach(elements,function(element){elementRegistry.get(element.id)&&(element.waypoints?modeling.removeConnection(element):modeling.removeShape(element))})}},{"./NoopHandler":251,inherits:351,"lodash/collection/forEach":366}],245:[function(require,module,exports){"use strict";function DeleteShapeHandler(canvas,modeling){this._canvas=canvas,this._modeling=modeling}var Collections=require("../../../util/Collections"),saveClear=require("../../../util/Removal").saveClear;DeleteShapeHandler.$inject=["canvas","modeling"],module.exports=DeleteShapeHandler,DeleteShapeHandler.prototype.preExecute=function(context){var modeling=this._modeling,shape=context.shape,label=shape.label;shape.labelTarget&&(context.labelTarget=shape.labelTarget,shape.labelTarget=null),label&&this._modeling.removeShape(label,{nested:!0}),saveClear(shape.incoming,function(connection){modeling.removeConnection(connection,{nested:!0})}),saveClear(shape.outgoing,function(connection){modeling.removeConnection(connection,{nested:!0})}),saveClear(shape.children,function(e){modeling.removeShape(e,{nested:!0})})},DeleteShapeHandler.prototype.execute=function(context){var canvas=this._canvas,shape=context.shape,oldParent=shape.parent;return context.oldParent=oldParent,context.oldParentIndex=Collections.indexOf(oldParent.children,shape),shape.label=null,canvas.removeShape(shape),shape},DeleteShapeHandler.prototype.revert=function(context){var canvas=this._canvas,shape=context.shape,oldParent=context.oldParent,oldParentIndex=context.oldParentIndex,labelTarget=context.labelTarget;return Collections.add(oldParent.children,shape,oldParentIndex),labelTarget&&(labelTarget.label=shape),canvas.addShape(shape,oldParent),shape}},{"../../../util/Collections":323,"../../../util/Removal":337}],246:[function(require,module,exports){"use strict";function DistributeElements(modeling){this._modeling=modeling}var forEach=require("lodash/collection/forEach"),sortBy=require("lodash/collection/sortBy");DistributeElements.$inject=["modeling"],module.exports=DistributeElements;var OFF_AXIS={x:"y",y:"x"};DistributeElements.prototype.preExecute=function(context){function updateRange(group,element){group.range.min=Math.min(element[axis],group.range.min),group.range.max=Math.max(element[axis]+element[dimension],group.range.max)}function center(element){return element[axis]+element[dimension]/2}function lastIdx(arr){return arr.length-1}function rangeDiff(range){return range.max-range.min}function centerElement(refCenter,element){var delta={y:0};delta[axis]=refCenter-center(element),delta[axis]&&(delta[OFF_AXIS[axis]]=0,modeling.moveElements([element],delta,element.parent))}var margin,spaceInBetween,modeling=this._modeling,groups=context.groups,axis=context.axis,dimension=context.dimension,firstGroup=groups[0],lastGroupIdx=lastIdx(groups),lastGroup=groups[lastGroupIdx],groupsSize=0;forEach(groups,function(group,idx){var sortedElements,refElem,refCenter;if(group.elements.length<2)return void(idx&&idx!==groups.length-1&&(updateRange(group,group.elements[0]),groupsSize+=rangeDiff(group.range)));sortedElements=sortBy(group.elements,axis),refElem=sortedElements[0],idx===lastGroupIdx&&(refElem=sortedElements[lastIdx(sortedElements)]),refCenter=center(refElem),group.range=null,forEach(sortedElements,function(element){if(centerElement(refCenter,element),null===group.range)return void(group.range={min:element[axis],max:element[axis]+element[dimension]});updateRange(group,element)}),idx&&idx!==groups.length-1&&(groupsSize+=rangeDiff(group.range))}),spaceInBetween=Math.abs(lastGroup.range.min-firstGroup.range.max),(margin=Math.round((spaceInBetween-groupsSize)/(groups.length-1)))');return parent.insertBefore(root,parent.firstChild),root}function setPosition(el,x,y){assign(el.style,{left:x+"px",top:y+"px"})}function setVisible(el,visible){el.style.display=!1===visible?"none":""}function Overlays(eventBus,canvas,elementRegistry){this._eventBus=eventBus,this._canvas=canvas,this._elementRegistry=elementRegistry,this._ids=ids,this._overlayDefaults={show:{minZoom:.7,maxZoom:5}},this._overlays={},this._overlayContainers=[],this._overlayRoot=createRoot(canvas.getContainer()),this._init()}var isArray=require("lodash/lang/isArray"),isString=require("lodash/lang/isString"),isObject=require("lodash/lang/isObject"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),filter=require("lodash/collection/filter"),domify=require("min-dom/lib/domify"),domClasses=require("min-dom/lib/classes"),domAttr=require("min-dom/lib/attr"),domRemove=require("min-dom/lib/remove"),domClear=require("min-dom/lib/clear"),getBBox=require("../../util/Elements").getBBox,ids=new(require("../../util/IdGenerator"))("ov");Overlays.$inject=["eventBus","canvas","elementRegistry"],module.exports=Overlays,Overlays.prototype.get=function(search){if(isString(search)&&(search={id:search}),isString(search.element)&&(search.element=this._elementRegistry.get(search.element)),search.element){var container=this._getOverlayContainer(search.element,!0);return container?search.type?filter(container.overlays,{type:search.type}):container.overlays.slice():[]}return search.type?filter(this._overlays,{type:search.type}):search.id?this._overlays[search.id]:null},Overlays.prototype.add=function(element,type,overlay){if(isObject(type)&&(overlay=type,type=null),element.id||(element=this._elementRegistry.get(element)),!overlay.position)throw new Error("must specifiy overlay position");if(!overlay.html)throw new Error("must specifiy overlay html");if(!element)throw new Error("invalid element specified");var id=this._ids.next();return overlay=assign({},this._overlayDefaults,overlay,{id:id,type:type,element:element,html:overlay.html}),this._addOverlay(overlay),id},Overlays.prototype.remove=function(filter){var overlays=this.get(filter)||[];isArray(overlays)||(overlays=[overlays]);var self=this;forEach(overlays,function(overlay){var container=self._getOverlayContainer(overlay.element,!0);if(overlay&&(domRemove(overlay.html),domRemove(overlay.htmlContainer),delete overlay.htmlContainer,delete overlay.element,delete self._overlays[overlay.id]),container){var idx=container.overlays.indexOf(overlay);-1!==idx&&container.overlays.splice(idx,1)}})},Overlays.prototype.show=function(){setVisible(this._overlayRoot)},Overlays.prototype.hide=function(){setVisible(this._overlayRoot,!1)},Overlays.prototype.clear=function(){this._overlays={},this._overlayContainers=[],domClear(this._overlayRoot)},Overlays.prototype._updateOverlayContainer=function(container){var element=container.element,html=container.html,x=element.x,y=element.y;if(element.waypoints){var bbox=getBBox(element);x=bbox.x,y=bbox.y}setPosition(html,x,y),domAttr(container.html,"data-container-id",element.id)},Overlays.prototype._updateOverlay=function(overlay){var position=overlay.position,htmlContainer=overlay.htmlContainer,element=overlay.element,left=position.left,top=position.top;if(void 0!==position.right){var width;width=element.waypoints?getBBox(element).width:element.width,left=-1*position.right+width}if(void 0!==position.bottom){var height;height=element.waypoints?getBBox(element).height:element.height,top=-1*position.bottom+height}setPosition(htmlContainer,left||0,top||0)},Overlays.prototype._createOverlayContainer=function(element){var html=domify('
');this._overlayRoot.appendChild(html);var container={html:html,element:element,overlays:[]};return this._updateOverlayContainer(container),this._overlayContainers.push(container),container},Overlays.prototype._updateRoot=function(viewbox){var a=viewbox.scale||1,d=viewbox.scale||1,matrix="matrix("+a+",0,0,"+d+","+-1*viewbox.x*a+","+-1*viewbox.y*d+")";this._overlayRoot.style.transform=matrix,this._overlayRoot.style["-ms-transform"]=matrix,this._overlayRoot.style["-webkit-transform"]=matrix},Overlays.prototype._getOverlayContainer=function(element,raw){var container=find(this._overlayContainers,function(c){return c.element===element});return container||raw?container:this._createOverlayContainer(element)},Overlays.prototype._addOverlay=function(overlay){var htmlContainer,overlayContainer,id=overlay.id,element=overlay.element,html=overlay.html;html.get&&(html=html.get(0)),isString(html)&&(html=domify(html)),overlayContainer=this._getOverlayContainer(element),htmlContainer=domify('
'),htmlContainer.appendChild(html),overlay.type&&domClasses(htmlContainer).add("djs-overlay-"+overlay.type),overlay.htmlContainer=htmlContainer,overlayContainer.overlays.push(overlay),overlayContainer.html.appendChild(htmlContainer),this._overlays[id]=overlay,this._updateOverlay(overlay),this._updateOverlayVisibilty(overlay,this._canvas.viewbox())},Overlays.prototype._updateOverlayVisibilty=function(overlay,viewbox){var show=overlay.show,htmlContainer=overlay.htmlContainer,visible=!0;show&&((show.minZoom>viewbox.scale||show.maxZoom
'),entriesContainer.appendChild(container));var html=entry.html||(entry.separator?'
':'
'),control=domify(html);container.appendChild(control),entry.separator||(domAttr(control,"data-action",id),entry.title&&domAttr(control,"title",entry.title),entry.className&&addClasses(control,entry.className),entry.imageUrl&&control.appendChild(domify('')))}),this.open(!0)},Palette.prototype.trigger=function(action,event,autoActivate){var entry,handler,originalEvent,entries=this._entries,button=event.delegateTarget||event.target;if(!button)return event.preventDefault();(entry=entries[domAttr(button,"data-action")])&&(handler=entry.action,originalEvent=event.originalEvent||event,isFunction(handler)?"click"===action&&handler(originalEvent,autoActivate):handler[action]&&handler[action](originalEvent,autoActivate),event.preventDefault())},Palette.prototype.triggerTwoColumn=function(){var canvas=this._canvas,parent=canvas.getContainer();parent.clientHeight<650?domClasses(parent).add("two-column"):domClasses(parent).remove("two-column")},Palette.prototype.close=function(){var canvas=this._canvas,parent=canvas.getContainer();domClasses(this._container).remove("open"),domClasses(parent).remove("two-column")},Palette.prototype.open=function(){domClasses(this._container).add("open"),this.triggerTwoColumn()},Palette.prototype.toggle=function(open){this.isOpen()?this.close():this.open()},Palette.prototype.isActiveTool=function(tool){return tool&&this._activeTool===tool},Palette.prototype.updateToolHighlight=function(name){var entriesContainer,toolsContainer;this._toolsContainer||(entriesContainer=domQuery(".djs-palette-entries",this._container),this._toolsContainer=domQuery("[data-group=tools]",entriesContainer)),toolsContainer=this._toolsContainer,forEach(toolsContainer.children,function(tool){var actionName=tool.getAttribute("data-action");actionName&&(actionName=actionName.replace("-tool",""),tool.classList.contains("entry")&&actionName===name?domClasses(tool).add("highlighted-entry"):domClasses(tool).remove("highlighted-entry"))})},Palette.prototype.isOpen=function(){return this._container&&domClasses(this._container).has("open")},Palette.HTML_MARKUP='
'},{"lodash/collection/forEach":366,"lodash/lang/isArray":489,"lodash/lang/isFunction":491,"min-dom/lib/attr":514,"min-dom/lib/classes":515,"min-dom/lib/clear":516,"min-dom/lib/delegate":518,"min-dom/lib/domify":519,"min-dom/lib/event":520,"min-dom/lib/matches":521,"min-dom/lib/query":522}],273:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../tool-manager")],__init__:["palette"],palette:["type",require("./Palette")]}},{"../tool-manager":302,"./Palette":272}],274:[function(require,module,exports){"use strict";function PopupMenu(eventBus,canvas){this._eventBus=eventBus,this._canvas=canvas,this._providers={}}var forEach=require("lodash/collection/forEach"),assign=require("lodash/object/assign"),find=require("lodash/collection/find"),domDelegate=require("min-dom/lib/delegate"),domify=require("min-dom/lib/domify"),domClasses=require("min-dom/lib/classes"),domAttr=require("min-dom/lib/attr"),domRemove=require("min-dom/lib/remove");PopupMenu.$inject=["eventBus","canvas"],PopupMenu.prototype.registerProvider=function(id,provider){this._providers[id]=provider},PopupMenu.prototype.create=function(id,element){var provider=this._providers[id];if(!provider)throw new Error("Provider is not registered: "+id);if(!element)throw new Error("Element is missing");var current=this._current={provider:provider,className:id,element:element};return provider.getHeaderEntries&&(current.headerEntries=provider.getHeaderEntries(element)),current.entries=provider.getEntries(element),this},PopupMenu.prototype.isEmpty=function(){var current=this._current;return 0===current.entries.length&¤t.headerEntries&&0===current.headerEntries.length},PopupMenu.prototype.open=function(position){if(!position)throw new Error("the position argument is missing");this.isOpen()&&this.close();var current=this._current,canvas=this._canvas,parent=canvas.getContainer();if(current.position=position,current.container=this._createContainer(),current.headerEntries){var headerEntriesContainer=this._createEntries(current.headerEntries,"djs-popup-header");current.container.appendChild(headerEntriesContainer)}if(current.entries){var entriesContainer=this._createEntries(current.entries,"djs-popup-body");current.container.appendChild(entriesContainer)}return this._attachContainer(current.container,parent,position.cursor),this},PopupMenu.prototype.close=function(){this.isOpen()&&(this._unbindHandlers(),domRemove(this._current.container),this._current.container=null)},PopupMenu.prototype.isOpen=function(){return!!this._current.container},PopupMenu.prototype.trigger=function(event){event.preventDefault();var element=event.delegateTarget||event.target,entryId=domAttr(element,"data-id"),entry=this._getEntry(entryId);if(entry.action)return entry.action.call(null,event,entry)},PopupMenu.prototype._getEntry=function(entryId){var search={id:entryId},entry=find(this._current.entries,search)||find(this._current.headerEntries,search);if(!entry)throw new Error("entry not found");return entry},PopupMenu.prototype._createContainer=function(){var container=domify('
'),position=this._current.position,className=this._current.className;return assign(container.style,{position:"absolute",left:position.x+"px",top:position.y+"px",visibility:"hidden"}),domClasses(container).add(className),container},PopupMenu.prototype._attachContainer=function(container,parent,cursor){var self=this;domDelegate.bind(container,".entry","click",function(event){self.trigger(event)});var zoom=this._canvas.zoom();container.style.transformOrigin="top left",container.style.transform="scale("+zoom+")",parent.appendChild(container),cursor&&this._assureIsInbounds(container,cursor),this._bindHandlers()},PopupMenu.prototype._assureIsInbounds=function(container,cursor){var left,top,canvas=this._canvas,clientRect=canvas._container.getBoundingClientRect(),containerX=container.offsetLeft,containerY=container.offsetTop,containerWidth=container.scrollWidth,containerHeight=container.scrollHeight,overAxis={},cursorPosition={x:cursor.x-clientRect.left,y:cursor.y-clientRect.top};containerX+containerWidth>clientRect.width&&(overAxis.x=!0),containerY+containerHeight>clientRect.height&&(overAxis.y=!0),overAxis.x&&overAxis.y?(left=cursorPosition.x-containerWidth+"px",top=cursorPosition.y-containerHeight+"px"):overAxis.x?(left=cursorPosition.x-containerWidth+"px",top=cursorPosition.y+"px"):overAxis.y&&cursorPosition.y"),self=this;return domClasses(entriesContainer).add(className),forEach(entries,function(entry){var entryContainer=self._createEntry(entry,entriesContainer);entriesContainer.appendChild(entryContainer)}),entriesContainer},PopupMenu.prototype._createEntry=function(entry){if(!entry.id)throw new Error("every entry must have the id property set");var entryContainer=domify("
"),entryClasses=domClasses(entryContainer);if(entryClasses.add("entry"),entry.className&&entryClasses.add(entry.className),domAttr(entryContainer,"data-id",entry.id),entry.label){var label=domify("");label.textContent=entry.label,entryContainer.appendChild(label)}return entry.imageUrl&&entryContainer.appendChild(domify('')),!0===entry.active&&entryClasses.add("active"),!0===entry.disabled&&entryClasses.add("disabled"),entry.title&&(entryContainer.title=entry.title),entryContainer},PopupMenu.prototype._bindHandlers=function(){function close(){self.close()}var eventBus=this._eventBus,self=this;eventBus.once("contextPad.close",close),eventBus.once("canvas.viewbox.changing",close),eventBus.once("commandStack.changed",close)},PopupMenu.prototype._unbindHandlers=function(){function close(){self.close()}var eventBus=this._eventBus,self=this;eventBus.off("contextPad.close",close),eventBus.off("canvas.viewbox.changed",close),eventBus.off("commandStack.changed",close)},module.exports=PopupMenu},{"lodash/collection/find":365,"lodash/collection/forEach":366,"lodash/object/assign":499,"min-dom/lib/attr":514,"min-dom/lib/classes":515,"min-dom/lib/delegate":518,"min-dom/lib/domify":519,"min-dom/lib/remove":523}],275:[function(require,module,exports){"use strict";module.exports={__init__:["popupMenu"],popupMenu:["type",require("./PopupMenu")]}},{"./PopupMenu":274}],276:[function(require,module,exports){"use strict";function PreviewSupport(elementRegistry,canvas,styles){this._elementRegistry=elementRegistry,this._canvas=canvas,this._styles=styles}function removeMarkers(gfx){gfx.children&&forEach(gfx.children,function(child){removeMarkers(child)}),gfx.style.markerStart="",gfx.style.markerEnd=""}function isConnection(element){return element.waypoints}var forEach=require("lodash/collection/forEach"),svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClone=require("tiny-svg/lib/clone"),svgCreate=require("tiny-svg/lib/create");module.exports=PreviewSupport,PreviewSupport.$inject=["elementRegistry","canvas","styles"],PreviewSupport.prototype.getGfx=function(element){return this._elementRegistry.getGraphics(element)},PreviewSupport.prototype.addDragger=function(shape,group){var gfx=this.getGfx(shape),dragger=svgClone(gfx),bbox=gfx.getBoundingClientRect();return isConnection(shape)&&removeMarkers(dragger),svgAttr(dragger,this._styles.cls("djs-dragger",[],{x:bbox.top,y:bbox.left})),svgAppend(group,dragger),dragger},PreviewSupport.prototype.addFrame=function(shape,group){var frame=svgCreate("rect",{class:"djs-resize-overlay",width:shape.width,height:shape.height,x:shape.x,y:shape.y});return svgAppend(group,frame),frame}},{"lodash/collection/forEach":366,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/clone":548,"tiny-svg/lib/create":549}],277:[function(require,module,exports){"use strict";module.exports={__init__:["previewSupport"],previewSupport:["type",require("./PreviewSupport")]}},{"./PreviewSupport":276}],278:[function(require,module,exports){"use strict";function Replace(modeling){this._modeling=modeling}module.exports=Replace,Replace.$inject=["modeling"],Replace.prototype.replaceElement=function(oldElement,newElementData,options){var modeling=this._modeling,newElement=null +;return oldElement.waypoints||(newElementData.x=Math.ceil(oldElement.x+(newElementData.width||oldElement.width)/2),newElementData.y=Math.ceil(oldElement.y+(newElementData.height||oldElement.height)/2),newElement=modeling.replaceShape(oldElement,newElementData,options)),newElement}},{}],279:[function(require,module,exports){"use strict";module.exports={__init__:["replace"],replace:["type",require("./Replace")]}},{"./Replace":278}],280:[function(require,module,exports){"use strict";function Resize(eventBus,rules,modeling,dragging){this._dragging=dragging,this._rules=rules;var self=this;eventBus.on("resize.start",function(event){var context=event.context,resizeConstraints=context.resizeConstraints,minBounds=context.minBounds;void 0===resizeConstraints&&(void 0===minBounds&&(minBounds=self.computeMinResizeBox(context)),context.resizeConstraints={min:asTRBL(minBounds)})}),eventBus.on("resize.move",function(event){var delta,newBounds,context=event.context,shape=context.shape,direction=context.direction,resizeConstraints=context.resizeConstraints;delta={x:event.dx,y:event.dy},context.delta=delta,newBounds=ResizeUtil.resizeBounds(shape,direction,delta),context.newBounds=ResizeUtil.ensureConstraints(newBounds,resizeConstraints),context.canExecute=self.canResize(context)}),eventBus.on("resize.end",function(event){var context=event.context,shape=context.shape,canExecute=context.canExecute,newBounds=context.newBounds;canExecute&&(newBounds=roundBounds(newBounds),modeling.resizeShape(shape,newBounds))})}var pick=require("lodash/object/pick"),assign=require("lodash/object/assign"),ResizeUtil=require("./ResizeUtil"),asTRBL=require("../../layout/LayoutUtil").asTRBL,roundBounds=require("../../layout/LayoutUtil").roundBounds;Resize.prototype.canResize=function(context){var rules=this._rules,ctx=pick(context,["newBounds","shape","delta","direction"]);return rules.allowed("shape.resize",ctx)},Resize.prototype.activate=function(event,shape,contextOrDirection){var context,direction,dragging=this._dragging;if("string"==typeof contextOrDirection&&(contextOrDirection={direction:contextOrDirection}),context=assign({shape:shape},contextOrDirection),!(direction=context.direction))throw new Error("must provide a direction (nw|se|ne|sw)");dragging.init(event,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(direction)?"nwse":"nesw"),data:{shape:shape,context:context}})},Resize.prototype.computeMinResizeBox=function(context){var minDimensions,childrenBounds,shape=context.shape,direction=context.direction;return minDimensions=context.minDimensions||{width:10,height:10},childrenBounds=ResizeUtil.computeChildrenBBox(shape,context.childrenBoxPadding),ResizeUtil.getMinResizeBounds(direction,shape,minDimensions,childrenBounds)},Resize.$inject=["eventBus","rules","modeling","dragging"],module.exports=Resize},{"../../layout/LayoutUtil":312,"./ResizeUtil":283,"lodash/object/assign":499,"lodash/object/pick":508}],281:[function(require,module,exports){"use strict";function ResizeHandles(eventBus,canvas,selection,resize){this._resize=resize,this._canvas=canvas;var self=this;eventBus.on("selection.changed",function(e){var newSelection=e.newSelection;self.removeResizers(),1===newSelection.length&&forEach(newSelection,self.addResizer,self)}),eventBus.on("shape.changed",function(e){var shape=e.element;selection.isSelected(shape)&&(self.removeResizers(),self.addResizer(shape))})}var forEach=require("lodash/collection/forEach"),svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgClear=require("tiny-svg/lib/clear"),svgCreate=require("tiny-svg/lib/create"),domEvent=require("min-dom/lib/event"),isPrimaryButton=require("../../util/Mouse").isPrimaryButton,asTRBL=require("../../layout/LayoutUtil").asTRBL,transform=require("../../util/SvgTransformUtil").transform;ResizeHandles.prototype.makeDraggable=function(element,gfx,direction){function startResize(event){isPrimaryButton(event)&&resize.activate(event,element,direction)}var resize=this._resize;domEvent.bind(gfx,"mousedown",startResize),domEvent.bind(gfx,"touchstart",startResize)},ResizeHandles.prototype._createResizer=function(element,x,y,rotation,direction){var resizersParent=this._getResizersParent(),group=svgCreate("g");svgClasses(group).add("djs-resizer"),svgClasses(group).add("djs-resizer-"+element.id),svgClasses(group).add("djs-resizer-"+direction),svgAppend(resizersParent,group);var visual=svgCreate("rect");svgAttr(visual,{x:-7,y:-7,width:5,height:5}),svgClasses(visual).add("djs-resizer-visual"),svgAppend(group,visual);var hit=svgCreate("rect");return svgAttr(hit,{x:-7,y:-7,width:20,height:20}),svgClasses(hit).add("djs-resizer-hit"),svgAppend(group,hit),transform(group,x,y,rotation),group},ResizeHandles.prototype.createResizer=function(element,direction){var resizer,trbl=asTRBL(element);resizer="nw"===direction?this._createResizer(element,trbl.left,trbl.top,0,direction):"ne"===direction?this._createResizer(element,trbl.right,trbl.top,90,direction):"se"===direction?this._createResizer(element,trbl.right,trbl.bottom,180,direction):this._createResizer(element,trbl.left,trbl.bottom,270,direction),this.makeDraggable(element,resizer,direction)},ResizeHandles.prototype.addResizer=function(shape){this._resize.canResize({shape:shape})&&(this.createResizer(shape,"nw"),this.createResizer(shape,"ne"),this.createResizer(shape,"se"),this.createResizer(shape,"sw"))},ResizeHandles.prototype.removeResizers=function(){var resizersParent=this._getResizersParent();svgClear(resizersParent)},ResizeHandles.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},ResizeHandles.$inject=["eventBus","canvas","selection","resize"],module.exports=ResizeHandles},{"../../layout/LayoutUtil":312,"../../util/Mouse":334,"../../util/SvgTransformUtil":339,"lodash/collection/forEach":366,"min-dom/lib/event":520,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/classes":546,"tiny-svg/lib/clear":547,"tiny-svg/lib/create":549}],282:[function(require,module,exports){"use strict";function ResizePreview(eventBus,elementRegistry,canvas,styles,previewSupport){eventBus.on("resize.move",LOW_PRIORITY,function(event){var context=event.context,shape=context.shape,bounds=context.newBounds,frame=context.frame;frame||(frame=context.frame=previewSupport.addFrame(shape,canvas.getDefaultLayer()),canvas.addMarker(shape,MARKER_RESIZING)),bounds.width>5&&svgAttr(frame,{x:bounds.x,width:bounds.width}),bounds.height>5&&svgAttr(frame,{y:bounds.y,height:bounds.height}),context.canExecute?svgClasses(frame).remove(MARKER_RESIZE_NOT_OK):svgClasses(frame).add(MARKER_RESIZE_NOT_OK)}),eventBus.on("resize.cleanup",function(event){var context=event.context,shape=context.shape;context.frame&&svgRemove(context.frame),canvas.removeMarker(shape,MARKER_RESIZING)})}var MARKER_RESIZING="djs-resizing",MARKER_RESIZE_NOT_OK="resize-not-ok",LOW_PRIORITY=500,svgAttr=require("tiny-svg/lib/attr"),svgRemove=require("tiny-svg/lib/remove"),svgClasses=require("tiny-svg/lib/classes");ResizePreview.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"],module.exports=ResizePreview},{"tiny-svg/lib/attr":545,"tiny-svg/lib/classes":546,"tiny-svg/lib/remove":552}],283:[function(require,module,exports){"use strict";function isNumber(a){return"number"==typeof a}function applyConstraints(attr,trbl,resizeConstraints){var value=trbl[attr],minValue=resizeConstraints.min&&resizeConstraints.min[attr],maxValue=resizeConstraints.max&&resizeConstraints.max[attr];return isNumber(minValue)&&(value=(/top|left/.test(attr)?min:max)(value,minValue)),isNumber(maxValue)&&(value=(/top|left/.test(attr)?max:min)(value,maxValue)),value}function asPadding(mayBePadding,defaultValue){return void 0!==mayBePadding?mayBePadding:DEFAULT_CHILD_BOX_PADDING}function addPadding(bbox,padding){var left,right,top,bottom;return"object"==typeof padding?(left=asPadding(padding.left),right=asPadding(padding.right),top=asPadding(padding.top),bottom=asPadding(padding.bottom)):left=right=top=bottom=asPadding(padding),{x:bbox.x-left,y:bbox.y-top,width:bbox.width+left+right,height:bbox.height+top+bottom}}function isBBoxChild(element){return!element.waypoints&&"label"!==element.type}function computeChildrenBBox(shapeOrChildren,padding){var elements;if(elements=void 0===shapeOrChildren.length?filter(shapeOrChildren.children,isBBoxChild):shapeOrChildren,elements.length)return addPadding(getBBox(elements),padding)}var filter=require("lodash/collection/filter"),max=Math.max,min=Math.min,DEFAULT_CHILD_BOX_PADDING=20,getBBox=require("../../util/Elements").getBBox,asTRBL=require("../../layout/LayoutUtil").asTRBL,asBounds=require("../../layout/LayoutUtil").asBounds;module.exports.substractTRBL=function(trblA,trblB){return{top:trblA.top-trblB.top,right:trblA.right-trblB.right,bottom:trblA.bottom-trblB.bottom,left:trblA.left-trblB.left}},module.exports.resizeBounds=function(bounds,direction,delta){var dx=delta.x,dy=delta.y;switch(direction){case"nw":return{x:bounds.x+dx,y:bounds.y+dy,width:bounds.width-dx,height:bounds.height-dy};case"sw":return{x:bounds.x+dx,y:bounds.y,width:bounds.width-dx,height:bounds.height+dy};case"ne":return{x:bounds.x,y:bounds.y+dy,width:bounds.width+dx,height:bounds.height-dy};case"se":return{x:bounds.x,y:bounds.y,width:bounds.width+dx,height:bounds.height+dy};default:throw new Error("unrecognized direction: "+direction)}},module.exports.resizeTRBL=function(bounds,resize){return{x:bounds.x+(resize.left||0),y:bounds.y+(resize.top||0),width:bounds.width-(resize.left||0)+(resize.right||0),height:bounds.height-(resize.top||0)+(resize.bottom||0)}},module.exports.reattachPoint=function(bounds,newBounds,point){var sx=bounds.width/newBounds.width,sy=bounds.height/newBounds.height;return{x:Math.round(newBounds.x+newBounds.width/2)-Math.floor((bounds.x+bounds.width/2-point.x)/sx),y:Math.round(newBounds.y+newBounds.height/2)-Math.floor((bounds.y+bounds.height/2-point.y)/sy)}},module.exports.ensureConstraints=function(currentBounds,resizeConstraints){if(!resizeConstraints)return currentBounds;var currentTrbl=asTRBL(currentBounds);return asBounds({top:applyConstraints("top",currentTrbl,resizeConstraints),right:applyConstraints("right",currentTrbl,resizeConstraints),bottom:applyConstraints("bottom",currentTrbl,resizeConstraints),left:applyConstraints("left",currentTrbl,resizeConstraints)})},module.exports.getMinResizeBounds=function(direction,currentBounds,minDimensions,childrenBounds){var currentBox=asTRBL(currentBounds),minBox={top:/n/.test(direction)?currentBox.bottom-minDimensions.height:currentBox.top,left:/w/.test(direction)?currentBox.right-minDimensions.width:currentBox.left,bottom:/s/.test(direction)?currentBox.top+minDimensions.height:currentBox.bottom,right:/e/.test(direction)?currentBox.left+minDimensions.width:currentBox.right},childrenBox=childrenBounds?asTRBL(childrenBounds):minBox,combinedBox={top:min(minBox.top,childrenBox.top),left:min(minBox.left,childrenBox.left),bottom:max(minBox.bottom,childrenBox.bottom),right:max(minBox.right,childrenBox.right)};return asBounds(combinedBox)},module.exports.addPadding=addPadding,module.exports.computeChildrenBBox=computeChildrenBBox},{"../../layout/LayoutUtil":312,"../../util/Elements":326,"lodash/collection/filter":364}],284:[function(require,module,exports){module.exports={__depends__:[require("../rules"),require("../dragging"),require("../preview-support")],__init__:["resize","resizePreview","resizeHandles"],resize:["type",require("./Resize")],resizePreview:["type",require("./ResizePreview")],resizeHandles:["type",require("./ResizeHandles")]}},{"../dragging":222,"../preview-support":277,"../rules":287,"./Resize":280,"./ResizeHandles":281,"./ResizePreview":282}],285:[function(require,module,exports){"use strict";function RuleProvider(eventBus){CommandInterceptor.call(this,eventBus),this.init()}var inherits=require("inherits"),CommandInterceptor=require("../../command/CommandInterceptor");RuleProvider.$inject=["eventBus"],inherits(RuleProvider,CommandInterceptor),module.exports=RuleProvider,RuleProvider.prototype.addRule=function(actions,priority,fn){var self=this;"string"==typeof actions&&(actions=[actions]),actions.forEach(function(action){self.canExecute(action,priority,function(context,action,event){return fn(context)},!0)})},RuleProvider.prototype.init=function(){}},{"../../command/CommandInterceptor":179,inherits:351}],286:[function(require,module,exports){"use strict";function Rules(injector){this._commandStack=injector.get("commandStack",!1)}Rules.$inject=["injector"],module.exports=Rules,Rules.prototype.allowed=function(action,context){var allowed=!0,commandStack=this._commandStack;return commandStack&&(allowed=commandStack.canExecute(action,context)),void 0===allowed||allowed}},{}],287:[function(require,module,exports){module.exports={__init__:["rules"],rules:["type",require("./Rules")]}},{"./Rules":286}],288:[function(require,module,exports){"use strict";function SearchPad(canvas,eventBus,overlays,selection){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=canvas,this._eventBus=eventBus,this._overlays=overlays,this._selection=selection,this._container=domify(SearchPad.BOX_HTML),this._searchInput=domQuery(SearchPad.INPUT_SELECTOR,this._container),this._resultsContainer=domQuery(SearchPad.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),eventBus.on(["canvas.destroy","diagram.destroy"],this.close,this)}function constructOverlay(box){var w=box.width+12,h=box.height+12;return{position:{bottom:h-6,right:w-6},show:!0,html:'
'}}function createInnerTextNode(parentNode,tokens,template){var text=createHtmlText(tokens),childNode=domify(template);childNode.innerHTML=text,parentNode.appendChild(childNode)}function createHtmlText(tokens){var htmlText="";return tokens.forEach(function(t){t.matched?htmlText+=''+t.matched+"":htmlText+=t.normal}),""!==htmlText?htmlText:null}var domClear=require("min-dom/lib/clear"),domDelegate=require("min-dom/lib/delegate"),domQuery=require("min-dom/lib/query"),domClasses=require("min-dom/lib/classes"),domAttr=require("min-dom/lib/attr"),domify=require("min-dom/lib/domify"),getBoundingBox=require("../../util/Elements").getBBox;SearchPad.$inject=["canvas","eventBus","overlays","selection"],SearchPad.prototype._bindEvents=function(){function listen(el,selector,type,fn){self._eventMaps.push({el:el,type:type,listener:domDelegate.bind(el,selector,type,fn)})}var self=this;listen(document,"html","click",function(e){self.close()}),listen(this._container,SearchPad.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),listen(this._container,SearchPad.RESULT_SELECTOR,"mouseover",function(e){e.stopPropagation(),self._scrollToNode(e.delegateTarget),self._preselect(e.delegateTarget)}),listen(this._container,SearchPad.RESULT_SELECTOR,"click",function(e){e.stopPropagation(),self._select(e.delegateTarget)}),listen(this._container,SearchPad.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),listen(this._container,SearchPad.INPUT_SELECTOR,"keyup",function(e){if(27===e.keyCode)return self.close();if(13===e.keyCode){var selected=self._getCurrentResult();return selected?self._select(selected):self.close()}return 38===e.keyCode?self._scrollToDirection(!0):40===e.keyCode?self._scrollToDirection():void(37!==e.keyCode&&39!==e.keyCode&&self._search(e.delegateTarget.value))})},SearchPad.prototype._unbindEvents=function(){this._eventMaps.forEach(function(m){domDelegate.unbind(m.el,m.type,m.listener)})},SearchPad.prototype._search=function(pattern){var self=this;if(this._clearResults(),pattern&&""!==pattern){var searchResults=this._searchProvider.find(pattern);if(searchResults.length){searchResults.forEach(function(result){var id=result.element.id,node=self._createResultNode(result,id);self._results[id]={element:result.element,node:node}});var node=domQuery(SearchPad.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(node),this._preselect(node)}}},SearchPad.prototype._scrollToDirection=function(previous){var selected=this._getCurrentResult();if(selected){var node=previous?selected.previousElementSibling:selected.nextElementSibling;node&&(this._scrollToNode(node),this._preselect(node))}},SearchPad.prototype._scrollToNode=function(node){if(node&&node!==this._getCurrentResult()){var nodeOffset=node.offsetTop,containerScroll=this._resultsContainer.scrollTop,bottomScroll=nodeOffset-this._resultsContainer.clientHeight+node.clientHeight;nodeOffset0&&createInnerTextNode(node,result.primaryTokens,SearchPad.RESULT_PRIMARY_HTML),createInnerTextNode(node,result.secondaryTokens,SearchPad.RESULT_SECONDARY_HTML),domAttr(node,SearchPad.RESULT_ID_ATTRIBUTE,id),this._resultsContainer.appendChild(node),node},SearchPad.prototype.registerProvider=function(provider){this._searchProvider=provider},SearchPad.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,domClasses(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},SearchPad.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,domClasses(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},SearchPad.prototype.toggle=function(){this.isOpen()?this.close():this.open()},SearchPad.prototype.isOpen=function(){return this._open},SearchPad.prototype._preselect=function(node){var selectedNode=this._getCurrentResult();if(node!==selectedNode){selectedNode&&domClasses(selectedNode).remove(SearchPad.RESULT_SELECTED_CLASS);var id=domAttr(node,SearchPad.RESULT_ID_ATTRIBUTE),element=this._results[id].element;domClasses(node).add(SearchPad.RESULT_SELECTED_CLASS),this._resetOverlay(element),this._centerViewbox(element),this._selection.select(element),this._eventBus.fire("searchPad.preselected",element)}},SearchPad.prototype._select=function(node){var id=domAttr(node,SearchPad.RESULT_ID_ATTRIBUTE),element=this._results[id].element;this.close(),this._resetOverlay(),this._centerViewbox(element),this._selection.select(element),this._eventBus.fire("searchPad.selected",element)},SearchPad.prototype._centerViewbox=function(element){var viewbox=this._canvas.viewbox(),box=getBoundingBox(element),newViewbox={x:box.x+box.width/2-viewbox.outer.width/2,y:box.y+box.height/2-viewbox.outer.height/2,width:viewbox.outer.width,height:viewbox.outer.height};this._canvas.viewbox(newViewbox),this._canvas.zoom(viewbox.scale)},SearchPad.prototype._resetOverlay=function(element){if(this._overlayId&&this._overlays.remove(this._overlayId),element){var box=getBoundingBox(element),overlay=constructOverlay(box);this._overlayId=this._overlays.add(element,overlay)}},module.exports=SearchPad,SearchPad.CONTAINER_SELECTOR=".djs-search-container",SearchPad.INPUT_SELECTOR=".djs-search-input input",SearchPad.RESULTS_CONTAINER_SELECTOR=".djs-search-results",SearchPad.RESULT_SELECTOR=".djs-search-result",SearchPad.RESULT_SELECTED_CLASS="djs-search-result-selected",SearchPad.RESULT_SELECTED_SELECTOR="."+SearchPad.RESULT_SELECTED_CLASS,SearchPad.RESULT_ID_ATTRIBUTE="data-result-id",SearchPad.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",SearchPad.OVERLAY_CLASS="djs-search-overlay",SearchPad.BOX_HTML='
',SearchPad.RESULT_HTML='
',SearchPad.RESULT_PRIMARY_HTML='
',SearchPad.RESULT_SECONDARY_HTML='

'},{"../../util/Elements":326,"min-dom/lib/attr":514,"min-dom/lib/classes":515,"min-dom/lib/clear":516,"min-dom/lib/delegate":518,"min-dom/lib/domify":519,"min-dom/lib/query":522}],289:[function(require,module,exports){module.exports={__depends__:[require("../overlays"),require("../selection")],searchPad:["type",require("./SearchPad")]}},{"../overlays":271,"../selection":293,"./SearchPad":288}],290:[function(require,module,exports){"use strict";function Selection(eventBus){this._eventBus=eventBus,this._selectedElements=[];var self=this;eventBus.on(["shape.remove","connection.remove"],function(e){var element=e.element;self.deselect(element)}),eventBus.on(["diagram.clear"],function(e){self.select(null)})}var isArray=require("lodash/lang/isArray"),forEach=require("lodash/collection/forEach");Selection.$inject=["eventBus"],module.exports=Selection,Selection.prototype.deselect=function(element){var selectedElements=this._selectedElements,idx=selectedElements.indexOf(element);if(-1!==idx){var oldSelection=selectedElements.slice();selectedElements.splice(idx,1),this._eventBus.fire("selection.changed",{oldSelection:oldSelection,newSelection:selectedElements})}},Selection.prototype.get=function(){return this._selectedElements},Selection.prototype.isSelected=function(element){return-1!==this._selectedElements.indexOf(element)},Selection.prototype.select=function(elements,add){var selectedElements=this._selectedElements,oldSelection=selectedElements.slice();isArray(elements)||(elements=elements?[elements]:[]),add?forEach(elements,function(element){-1===selectedElements.indexOf(element)&&selectedElements.push(element)}):this._selectedElements=selectedElements=elements.slice(),this._eventBus.fire("selection.changed",{oldSelection:oldSelection,newSelection:selectedElements})}},{"lodash/collection/forEach":366,"lodash/lang/isArray":489}],291:[function(require,module,exports){"use strict";function SelectionBehavior(eventBus,selection,canvas,elementRegistry){eventBus.on("create.end",500,function(e){e.context.canExecute&&selection.select(e.context.shape)}),eventBus.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&selection.select(e.context.target)}),eventBus.on("shape.move.end",500,function(e){var previousSelection=e.previousSelection||[],shape=elementRegistry.get(e.context.shape.id);find(previousSelection,function(selectedShape){return shape.id===selectedShape.id})||selection.select(shape)}),eventBus.on("element.click",function(event){var element=event.element;element===canvas.getRootElement()&&(element=null);var isSelected=selection.isSelected(element),isMultiSelect=selection.get().length>1,add=hasPrimaryModifier(event);if(isSelected&&isMultiSelect)return add?selection.deselect(element):selection.select(element);isSelected?selection.deselect(element):selection.select(element,add)})}var hasPrimaryModifier=require("../../util/Mouse").hasPrimaryModifier,find=require("lodash/collection/find");SelectionBehavior.$inject=["eventBus","selection","canvas","elementRegistry"],module.exports=SelectionBehavior},{"../../util/Mouse":334,"lodash/collection/find":365}],292:[function(require,module,exports){"use strict";function SelectionVisuals(events,canvas,selection,styles){function addMarker(e,cls){canvas.addMarker(e,cls)}function removeMarker(e,cls){canvas.removeMarker(e,cls)}this._multiSelectionBox=null,events.on("element.hover",function(event){addMarker(event.element,MARKER_HOVER)}),events.on("element.out",function(event){removeMarker(event.element,MARKER_HOVER)}),events.on("selection.changed",function(event){function deselect(s){removeMarker(s,MARKER_SELECTED)}function select(s){addMarker(s,MARKER_SELECTED)}var oldSelection=event.oldSelection,newSelection=event.newSelection;forEach(oldSelection,function(e){-1===newSelection.indexOf(e)&&deselect(e)}),forEach(newSelection,function(e){-1===oldSelection.indexOf(e)&&select(e)})})}var forEach=require("lodash/collection/forEach"),MARKER_HOVER="hover",MARKER_SELECTED="selected";SelectionVisuals.$inject=["eventBus","canvas","selection","styles"],module.exports=SelectionVisuals},{"lodash/collection/forEach":366}],293:[function(require,module,exports){module.exports={__init__:["selectionVisuals","selectionBehavior"],__depends__:[require("../interaction-events"),require("../outline")],selection:["type",require("./Selection")],selectionVisuals:["type",require("./SelectionVisuals")],selectionBehavior:["type",require("./SelectionBehavior")]}},{"../interaction-events":230,"../outline":269,"./Selection":290,"./SelectionBehavior":291,"./SelectionVisuals":292}],294:[function(require,module,exports){"use strict";function SnapContext(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function SnapPoints(defaultSnaps){this._snapValues={}}var forEach=require("lodash/collection/forEach"),snapTo=require("./SnapUtil").snapTo;SnapContext.prototype.getSnapOrigin=function(snapLocation){return this._snapOrigins[snapLocation]},SnapContext.prototype.setSnapOrigin=function(snapLocation,initialValue){this._snapOrigins[snapLocation]=initialValue,-1===this._snapLocations.indexOf(snapLocation)&&this._snapLocations.push(snapLocation)},SnapContext.prototype.addDefaultSnap=function(type,point){var snapValues=this._defaultSnaps[type];snapValues||(snapValues=this._defaultSnaps[type]=[]),snapValues.push(point)},SnapContext.prototype.getSnapLocations=function(){return this._snapLocations},SnapContext.prototype.setSnapLocations=function(snapLocations){this._snapLocations=snapLocations},SnapContext.prototype.pointsForTarget=function(target){var targetId=target.id||target,snapPoints=this._targets[targetId];return snapPoints||(snapPoints=this._targets[targetId]=new SnapPoints,snapPoints.initDefaults(this._defaultSnaps)),snapPoints},module.exports=SnapContext,SnapPoints.prototype.add=function(snapLocation,point){var snapValues=this._snapValues[snapLocation];snapValues||(snapValues=this._snapValues[snapLocation]={x:[],y:[]}),-1===snapValues.x.indexOf(point.x)&&snapValues.x.push(point.x),-1===snapValues.y.indexOf(point.y)&&snapValues.y.push(point.y)},SnapPoints.prototype.snap=function(point,snapLocation,axis,tolerance){var snappingValues=this._snapValues[snapLocation];return snappingValues&&snapTo(point[axis],snappingValues[axis],tolerance)},SnapPoints.prototype.initDefaults=function(defaultSnaps){var self=this;forEach(defaultSnaps||{},function(snapPoints,snapLocation){forEach(snapPoints,function(point){self.add(snapLocation,point)})})}},{"./SnapUtil":295,"lodash/collection/forEach":366}],295:[function(require,module,exports){"use strict";function snapTo(value,values,tolerance){tolerance=void 0===tolerance?10:tolerance;var idx,snapValue;for(idx=0;idxshape.x+shape.width||"e"===direction&&event.xshape.y+shape.height||"s"===direction&&event.yabs(event.dy)?"x":"y",offset=event["d"+axis],spacePos=event[axis]-offset;if(abs(offset)<5)return!1;offset<0&&(offset*=-1),hasPrimaryModifier(event)&&(offset*=-1);var rootShape=this._canvas.getRootElement(),allShapes=getAllChildren(rootShape,!0),adjustments=this.calculateAdjustments(allShapes,axis,offset,spacePos);return assign(context,adjustments,{axis:axis,direction:SpaceUtil.getDirection(axis,offset)}),Cursor.set("resize-"+("x"===axis?"ew":"ns")),!0},SpaceTool.prototype.calculateAdjustments=function(elements,axis,offset,spacePos){var movingShapes=[],resizingShapes=[],rules=this._rules;return elements.forEach(function(shape){var shapeStart=shape[axis],shapeEnd=shapeStart+shape[AXIS_TO_DIMENSION[axis]];if(shape.parent&&!shape.waypoints)return offset>0&&shapeStart>spacePos?movingShapes.push(shape):offset<0&&shapeEndspacePos&&rules.allowed("shape.resize",{shape:shape})?resizingShapes.push(shape):void 0}),{movingShapes:movingShapes,resizingShapes:resizingShapes}},SpaceTool.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},SpaceTool.prototype.isActive=function(){var context=this._dragging.context();return context&&/^spaceTool/.test(context.prefix)}},{"../../util/Cursor":325,"../../util/Elements":326,"../../util/Mouse":334,"./SpaceUtil":299,"lodash/collection/forEach":366,"lodash/object/assign":499}],298:[function(require,module,exports){"use strict";function SpaceToolPreview(eventBus,elementRegistry,canvas,styles,previewSupport){function addPreviewGfx(collection,dragGroup){forEach(collection,function(element){previewSupport.addDragger(element,dragGroup),canvas.addMarker(element,MARKER_DRAGGING)})}eventBus.on("spaceTool.selection.start",function(event){var space=canvas.getLayer("space"),context=event.context,orientation={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},crosshairGroup=svgCreate("g");svgAttr(crosshairGroup,styles.cls("djs-crosshair-group",["no-events"])),svgAppend(space,crosshairGroup);var pathX=svgCreate("path");svgAttr(pathX,"d",orientation.x),svgClasses(pathX).add("djs-crosshair"),svgAppend(crosshairGroup,pathX);var pathY=svgCreate("path");svgAttr(pathY,"d",orientation.y),svgClasses(pathY).add("djs-crosshair"),svgAppend(crosshairGroup,pathY),context.crosshairGroup=crosshairGroup}),eventBus.on("spaceTool.selection.move",function(event){var crosshairGroup=event.context.crosshairGroup;translate(crosshairGroup,event.x,event.y)}),eventBus.on("spaceTool.selection.cleanup",function(event){var context=event.context,crosshairGroup=context.crosshairGroup;crosshairGroup&&svgRemove(crosshairGroup)}),eventBus.on("spaceTool.move",LOW_PRIORITY,function(event){var context=event.context,line=context.line,axis=context.axis,movingShapes=context.movingShapes,resizingShapes=context.resizingShapes;if(context.initialized){if(!context.dragGroup){var spaceLayer=canvas.getLayer("space");line=svgCreate("path"),svgAttr(line,"d","M0,0 L0,0"),svgClasses(line).add("djs-crosshair"),svgAppend(spaceLayer,line),context.line=line;var dragGroup=svgCreate("g");svgAttr(dragGroup,styles.cls("djs-drag-group",["no-events"])),svgAppend(canvas.getDefaultLayer(),dragGroup),addPreviewGfx(movingShapes,dragGroup);addPreviewGfx(context.movingConnections=elementRegistry.filter(function(element){var sourceIsMoving=!1;forEach(movingShapes,function(shape){forEach(shape.outgoing,function(connection){element===connection&&(sourceIsMoving=!0)})});var targetIsMoving=!1;forEach(movingShapes,function(shape){forEach(shape.incoming,function(connection){element===connection&&(targetIsMoving=!0)})});var sourceIsResizing=!1;forEach(resizingShapes,function(shape){forEach(shape.outgoing,function(connection){element===connection&&(sourceIsResizing=!0)})});var targetIsResizing=!1;return forEach(resizingShapes,function(shape){forEach(shape.incoming,function(connection){element===connection&&(targetIsResizing=!0)})}),isConnection(element)&&(sourceIsMoving||sourceIsResizing)&&(targetIsMoving||targetIsResizing)}),dragGroup),context.dragGroup=dragGroup}if(!context.frameGroup){var frameGroup=svgCreate("g");svgAttr(frameGroup,styles.cls("djs-frame-group",["no-events"])),svgAppend(canvas.getDefaultLayer(),frameGroup);var frames=[];forEach(resizingShapes,function(shape){var frame=previewSupport.addFrame(shape,frameGroup);frames.push({element:frame,initialWidth:frame.getBBox().width,initialHeight:frame.getBBox().height}),canvas.addMarker(shape,MARKER_RESIZING)}),context.frameGroup=frameGroup,context.frames=frames}var orientation={x:"M"+event.x+", -10000 L"+event.x+", 10000",y:"M -10000, "+event.y+" L 10000, "+event.y};svgAttr(line,{path:orientation[axis],display:""});var opposite={x:"y",y:"x"},delta={x:event.dx,y:event.dy};delta[opposite[context.axis]]=0,translate(context.dragGroup,delta.x,delta.y),forEach(context.frames,function(frame){frame.initialWidth+delta.x>5&&svgAttr(frame.element,{width:frame.initialWidth+delta.x}),frame.initialHeight+delta.y>5&&svgAttr(frame.element,{height:frame.initialHeight+delta.y})})}}),eventBus.on("spaceTool.cleanup",function(event){var context=event.context,movingShapes=context.movingShapes,movingConnections=context.movingConnections,resizingShapes=context.resizingShapes,line=context.line,dragGroup=context.dragGroup,frameGroup=context.frameGroup;forEach(movingShapes,function(shape){canvas.removeMarker(shape,MARKER_DRAGGING)}),forEach(movingConnections,function(connection){canvas.removeMarker(connection,MARKER_DRAGGING)}),dragGroup&&(svgRemove(line),svgRemove(dragGroup)),forEach(resizingShapes,function(shape){canvas.removeMarker(shape,MARKER_RESIZING)}),frameGroup&&svgRemove(frameGroup)})}function isConnection(element){return element.waypoints}var forEach=require("lodash/collection/forEach"),MARKER_DRAGGING="djs-dragging",MARKER_RESIZING="djs-resizing",LOW_PRIORITY=250,svgAppend=require("tiny-svg/lib/append"),svgAttr=require("tiny-svg/lib/attr"),svgClasses=require("tiny-svg/lib/classes"),svgCreate=require("tiny-svg/lib/create"),svgRemove=require("tiny-svg/lib/remove"),translate=require("../../util/SvgTransformUtil").translate;SpaceToolPreview.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"],module.exports=SpaceToolPreview},{"../../util/SvgTransformUtil":339,"lodash/collection/forEach":366,"tiny-svg/lib/append":543,"tiny-svg/lib/attr":545,"tiny-svg/lib/classes":546,"tiny-svg/lib/create":549,"tiny-svg/lib/remove":552}],299:[function(require,module,exports){"use strict";function getDirection(axis,offset){if("x"===axis){if(offset>0)return"e";if(offset<0)return"w"}if("y"===axis){if(offset>0)return"s";if(offset<0)return"n"}return null}module.exports.getDirection=getDirection,module.exports.resizeBounds=function(bounds,direction,delta){var dx=delta.x,dy=delta.y;switch(direction){case"n":return{x:bounds.x,y:bounds.y+dy,width:bounds.width,height:bounds.height-dy};case"s":return{x:bounds.x,y:bounds.y,width:bounds.width,height:bounds.height+dy};case"w":return{x:bounds.x+dx,y:bounds.y,width:bounds.width-dx,height:bounds.height};case"e":return{x:bounds.x,y:bounds.y,width:bounds.width+dx,height:bounds.height};default:throw new Error("unrecognized direction: "+direction)}}},{}],300:[function(require,module,exports){"use strict";module.exports={__init__:["spaceToolPreview"],__depends__:[require("../dragging"),require("../rules"),require("../tool-manager"),require("../preview-support")],spaceTool:["type",require("./SpaceTool")],spaceToolPreview:["type",require("./SpaceToolPreview")]}},{"../dragging":222,"../preview-support":277,"../rules":287,"../tool-manager":302,"./SpaceTool":297,"./SpaceToolPreview":298}],301:[function(require,module,exports){"use strict";function ToolManager(eventBus,dragging){this._eventBus=eventBus,this._dragging=dragging,this._tools=[],this._active=null}var forEach=require("lodash/collection/forEach");ToolManager.$inject=["eventBus","dragging"],module.exports=ToolManager,ToolManager.prototype.registerTool=function(name,events){var tools=this._tools;if(!events)throw new Error('A tool has to be registered with it\'s "events"');tools.push(name),this.bindEvents(name,events)},ToolManager.prototype.isActive=function(tool){return tool&&this._active===tool},ToolManager.prototype.length=function(tool){return this._tools.length},ToolManager.prototype.setActive=function(tool){var eventBus=this._eventBus;this._active!==tool&&(this._active=tool,eventBus.fire("tool-manager.update",{tool:tool}))},ToolManager.prototype.bindEvents=function(name,events){var eventBus=this._eventBus,dragging=this._dragging,eventsToRegister=[];eventBus.on(events.tool+".init",function(event){if(!event.context.reactivate&&this.isActive(name))return this.setActive(null),void dragging.cancel();this.setActive(name)},this),forEach(events,function(event){eventsToRegister.push(event+".ended"),eventsToRegister.push(event+".canceled")}),eventBus.on(eventsToRegister,250,function(event){var originalEvent=event.originalEvent;!this._active||originalEvent&&"tools"===originalEvent.target.parentNode.getAttribute("data-group")||this.setActive(null)},this)}},{"lodash/collection/forEach":366}],302:[function(require,module,exports){"use strict";module.exports={__depends__:[require("../dragging")],__init__:["toolManager"],toolManager:["type",require("./ToolManager")]}},{"../dragging":222,"./ToolManager":301}],303:[function(require,module,exports){"use strict";function createRoot(parent){var root=domify('
');return parent.insertBefore(root,parent.firstChild),root}function setPosition(el,x,y){assign(el.style,{left:x+"px",top:y+"px"})}function setVisible(el,visible){el.style.display=!1===visible?"none":""}function Tooltips(eventBus,canvas){this._eventBus=eventBus,this._canvas=canvas,this._ids=ids,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=createRoot(canvas.getContainer());var self=this;domDelegate.bind(this._tooltipRoot,tooltipSelector,"mousedown",function(event){event.stopPropagation()}),domDelegate.bind(this._tooltipRoot,tooltipSelector,"mouseover",function(event){self.trigger("mouseover",event)}),domDelegate.bind(this._tooltipRoot,tooltipSelector,"mouseout",function(event){self.trigger("mouseout",event)}),this._init()}var isString=require("lodash/lang/isString"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),domify=require("min-dom/lib/domify"),domAttr=require("min-dom/lib/attr"),domClasses=require("min-dom/lib/classes"),domRemove=require("min-dom/lib/remove"),domDelegate=require("min-dom/lib/delegate"),ids=new(require("../../util/IdGenerator"))("tt"),tooltipSelector=".djs-tooltip";Tooltips.$inject=["eventBus","canvas"],module.exports=Tooltips,Tooltips.prototype.add=function(tooltip){if(!tooltip.position)throw new Error("must specifiy tooltip position");if(!tooltip.html)throw new Error("must specifiy tooltip html");var id=this._ids.next();return tooltip=assign({},this._tooltipDefaults,tooltip,{id:id}),this._addTooltip(tooltip),tooltip.timeout&&this.setTimeout(tooltip),id},Tooltips.prototype.trigger=function(action,event){var node=event.delegateTarget||event.target,tooltip=this.get(domAttr(node,"data-tooltip-id"));tooltip&&("mouseover"===action&&tooltip.timeout&&this.clearTimeout(tooltip),"mouseout"===action&&tooltip.timeout&&(tooltip.timeout=1e3,this.setTimeout(tooltip)))},Tooltips.prototype.get=function(id){return"string"!=typeof id&&(id=id.id),this._tooltips[id]},Tooltips.prototype.clearTimeout=function(tooltip){if(tooltip=this.get(tooltip)){var removeTimer=tooltip.removeTimer;removeTimer&&(clearTimeout(removeTimer),tooltip.removeTimer=null)}},Tooltips.prototype.setTimeout=function(tooltip){if(tooltip=this.get(tooltip)){this.clearTimeout(tooltip);var self=this;tooltip.removeTimer=setTimeout(function(){self.remove(tooltip)},tooltip.timeout)}},Tooltips.prototype.remove=function(id){var tooltip=this.get(id);tooltip&&(domRemove(tooltip.html),domRemove(tooltip.htmlContainer),delete tooltip.htmlContainer,delete this._tooltips[tooltip.id])},Tooltips.prototype.show=function(){setVisible(this._tooltipRoot)},Tooltips.prototype.hide=function(){setVisible(this._tooltipRoot,!1)},Tooltips.prototype._updateRoot=function(viewbox){var a=viewbox.scale||1,d=viewbox.scale||1,matrix="matrix("+a+",0,0,"+d+","+-1*viewbox.x*a+","+-1*viewbox.y*d+")";this._tooltipRoot.style.transform=matrix,this._tooltipRoot.style["-ms-transform"]=matrix},Tooltips.prototype._addTooltip=function(tooltip){var htmlContainer,id=tooltip.id,html=tooltip.html,tooltipRoot=this._tooltipRoot;html.get&&(html=html.get(0)),isString(html)&&(html=domify(html)),htmlContainer=domify('
'),htmlContainer.appendChild(html),tooltip.type&&domClasses(htmlContainer).add("djs-tooltip-"+tooltip.type),tooltip.className&&domClasses(htmlContainer).add(tooltip.className),tooltip.htmlContainer=htmlContainer,tooltipRoot.appendChild(htmlContainer),this._tooltips[id]=tooltip,this._updateTooltip(tooltip)},Tooltips.prototype._updateTooltip=function(tooltip){var position=tooltip.position;setPosition(tooltip.htmlContainer,position.x,position.y)},Tooltips.prototype._updateTooltipVisibilty=function(viewbox){forEach(this._tooltips,function(tooltip){var show=tooltip.show,htmlContainer=tooltip.htmlContainer,visible=!0;show&&((show.minZoom>viewbox.scale||show.maxZoom=referenceOrientation.right,bottom=rectOrientation.top-padding.y>=referenceOrientation.bottom,left=rectOrientation.right+padding.x<=referenceOrientation.left,vertical=top?"top":bottom?"bottom":null,horizontal=left?"left":right?"right":null;return horizontal&&vertical?vertical+"-"+horizontal:horizontal||vertical||"intersect"}function getElementLineIntersection(elementPath,linePath,cropStart){var intersections=getIntersections(elementPath,linePath);return 1===intersections.length?roundPoint(intersections[0]):2===intersections.length&&pointDistance(intersections[0],intersections[1])<1?roundPoint(intersections[0]):intersections.length>1?(intersections=sortBy(intersections,function(i){var distance=Math.floor(100*i.t2)||1;return distance=100-distance,distance=(distance<10?"0":"")+distance,i.segment2+"#"+distance}),roundPoint(intersections[cropStart?0:intersections.length-1])):null}function getIntersections(a,b){return intersection(a,b)}var isObject=require("lodash/lang/isObject"),sortBy=require("lodash/collection/sortBy"),pointDistance=require("../util/Geometry").pointDistance,intersection=require("../util/Intersection").intersection;module.exports.roundBounds=roundBounds,module.exports.roundPoint=roundPoint,module.exports.asTRBL=asTRBL,module.exports.asBounds=asBounds,module.exports.getMid=getMid,module.exports.getOrientation=getOrientation,module.exports.getElementLineIntersection=getElementLineIntersection,module.exports.getIntersections=getIntersections},{"../util/Geometry":328,"../util/Intersection":331,"lodash/collection/sortBy":375,"lodash/lang/isObject":494}],313:[function(require,module,exports){"use strict";function inRange(a,start,end){return a>=start&&a<=end}function isInRange(axis,a,b){var size={x:"width",y:"height"};return inRange(a[axis],b[axis],b[axis]+b[size[axis]])}function getDirections(orientation,defaultLayout){switch(orientation){case"intersect":return null;case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return defaultLayout}}var isArray=require("lodash/lang/isArray"),find=require("lodash/collection/find"),without=require("lodash/array/without"),assign=require("lodash/object/assign"),LayoutUtil=require("./LayoutUtil"),Geometry=require("../util/Geometry"),getOrientation=LayoutUtil.getOrientation,getMid=LayoutUtil.getMid,pointsAligned=Geometry.pointsAligned,pointInRect=Geometry.pointInRect,pointDistance=Geometry.pointDistance,INTERSECTION_THRESHOLD=20,ORIENTATION_THRESHOLD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};module.exports.getBendpoints=function(a,b,directions){directions=directions||"h:h";var xmid,ymid;if("h:v"===directions)return[{x:b.x,y:a.y}];if("v:h"===directions)return[{x:a.x,y:b.y}];if("h:h"===directions)return xmid=Math.round((b.x-a.x)/2+a.x),[{x:xmid,y:a.y},{x:xmid,y:b.y}];if("v:v"===directions)return ymid=Math.round((b.y-a.y)/2+a.y),[{x:a.x,y:ymid},{x:b.x,y:ymid}];throw new Error("unknown directions: <"+directions+">: directions must be specified as {a direction}:{b direction} (direction in h|v)")},module.exports.connectPoints=function(a,b,directions){var points=[];return pointsAligned(a,b)||(points=this.getBendpoints(a,b,directions)),points.unshift(a),points.push(b),points},module.exports.connectRectangles=function(source,target,start,end,hints){var preferredLayouts=hints&&hints.preferredLayouts||[],preferredLayout=without(preferredLayouts,"straight")[0]||"h:h",threshold=ORIENTATION_THRESHOLD[preferredLayout]||0,orientation=getOrientation(source,target,threshold),directions=getDirections(orientation,preferredLayout);if(start=start||getMid(source),end=end||getMid(target),directions){if("h:h"===directions)switch(orientation){case"top-right":case"right":case"bottom-right":start={original:start,x:source.x,y:start.y},end={original:end,x:target.x+target.width,y:end.y};break;case"top-left":case"left":case"bottom-left":start={original:start,x:source.x+source.width,y:start.y},end={original:end,x:target.x,y:end.y}}if("v:v"===directions)switch(orientation){case"top-left":case"top":case"top-right":start={original:start,x:start.x,y:source.y+source.height},end={original:end,x:end.x,y:target.y};break;case"bottom-left":case"bottom":case"bottom-right":start={original:start,x:start.x,y:source.y},end={original:end,x:end.x,y:target.y+target.height}}return this.connectPoints(start,end,directions)}},module.exports.repairConnection=function(source,target,start,end,waypoints,hints){isArray(start)&&(waypoints=start,hints=end,start=getMid(source),end=getMid(target)),hints=assign({preferredLayouts:[]},hints),waypoints=waypoints||[];var repairedWaypoints,preferredLayouts=hints.preferredLayouts,layoutStraight=-1!==preferredLayouts.indexOf("straight");return layoutStraight&&(repairedWaypoints=this.layoutStraight(source,target,start,end,hints)), +repairedWaypoints||(hints.connectionEnd?(repairedWaypoints=this._repairConnectionSide(target,source,end,waypoints.slice().reverse()),repairedWaypoints=repairedWaypoints&&repairedWaypoints.reverse()):hints.connectionStart?repairedWaypoints=this._repairConnectionSide(source,target,start,waypoints):waypoints&&waypoints.length&&(repairedWaypoints=waypoints)),repairedWaypoints||(repairedWaypoints=this.connectRectangles(source,target,start,end,hints)),repairedWaypoints},module.exports.layoutStraight=function(source,target,start,end,hints){var primaryAxis,orientation,axis={};return orientation=getOrientation(source,target),/^(top|bottom|left|right)$/.test(orientation)?(/top|bottom/.test(orientation)&&(primaryAxis="x"),/left|right/.test(orientation)&&(primaryAxis="y"),"target"===hints.preserveDocking?isInRange(primaryAxis,end,source)?(axis[primaryAxis]=end[primaryAxis],[{x:void 0!==axis.x?axis.x:start.x,y:void 0!==axis.y?axis.y:start.y,original:{x:void 0!==axis.x?axis.x:start.x,y:void 0!==axis.y?axis.y:start.y}},{x:end.x,y:end.y}]):null:isInRange(primaryAxis,start,target)?(axis[primaryAxis]=start[primaryAxis],[{x:start.x,y:start.y},{x:void 0!==axis.x?axis.x:end.x,y:void 0!==axis.y?axis.y:end.y,original:{x:void 0!==axis.x?axis.x:end.x,y:void 0!==axis.y?axis.y:end.y}}]):null):null},module.exports._repairConnectionSide=function(moved,other,newDocking,points){if(function(moved,other,points){return points.length<3||!(points.length>4)&&!!find(points,function(p,idx){var q=points[idx-1];return q&&pointDistance(p,q)<3})}(moved,other,points))return null;var slicedPoints,oldDocking=points[0],newPoints=points.slice();return newPoints[0]=newDocking,newPoints[1]=function(candidate,oldPeer,newPeer){switch(pointsAligned(oldPeer,candidate)){case"v":return{x:candidate.x,y:newPeer.y};case"h":return{x:newPeer.x,y:candidate.y}}return{x:candidate.x,y:candidate.y}}(newPoints[1],oldDocking,newDocking),slicedPoints=function(points,a,b){var i;for(i=points.length-2;0!==i;i--)if(pointInRect(points[i],a,INTERSECTION_THRESHOLD)||pointInRect(points[i],b,INTERSECTION_THRESHOLD))return points.slice(i);return points}(newPoints,moved,other),slicedPoints!==newPoints?this._repairConnectionSide(moved,other,newDocking,slicedPoints):newPoints}},{"../util/Geometry":328,"./LayoutUtil":312,"lodash/array/without":359,"lodash/collection/find":365,"lodash/lang/isArray":489,"lodash/object/assign":499}],314:[function(require,module,exports){"use strict";function Base(){Object.defineProperty(this,"businessObject",{writable:!0}),parentRefs.bind(this,"parent"),labelRefs.bind(this,"label"),outgoingRefs.bind(this,"outgoing"),incomingRefs.bind(this,"incoming")}function Shape(){Base.call(this),parentRefs.bind(this,"children"),attacherRefs.bind(this,"host"),attacherRefs.bind(this,"attachers")}function Root(){Shape.call(this)}function Label(){Shape.call(this),labelRefs.bind(this,"labelTarget")}function Connection(){Base.call(this),outgoingRefs.bind(this,"source"),incomingRefs.bind(this,"target")}var assign=require("lodash/object/assign"),inherits=require("inherits"),Refs=require("object-refs"),parentRefs=new Refs({name:"children",enumerable:!0,collection:!0},{name:"parent"}),labelRefs=new Refs({name:"label",enumerable:!0},{name:"labelTarget"}),attacherRefs=new Refs({name:"attachers",collection:!0},{name:"host"}),outgoingRefs=new Refs({name:"outgoing",collection:!0},{name:"source"}),incomingRefs=new Refs({name:"incoming",collection:!0},{name:"target"});inherits(Shape,Base),inherits(Root,Shape),inherits(Label,Shape),inherits(Connection,Base);var types={connection:Connection,shape:Shape,label:Label,root:Root};module.exports.create=function(type,attrs){var Type=types[type];if(!Type)throw new Error("unknown type: <"+type+">");return assign(new Type,attrs)},module.exports.Base=Base,module.exports.Root=Root,module.exports.Shape=Shape,module.exports.Connection=Connection,module.exports.Label=Label},{inherits:351,"lodash/object/assign":499,"object-refs":536}],315:[function(require,module,exports){"use strict";function length(point){return Math.sqrt(Math.pow(point.x,2)+Math.pow(point.y,2))}function MoveCanvas(eventBus,canvas){function handleMove(event){var start=context.start,position=EventUtil.toPoint(event),delta=substract(position,start);if(!context.dragging&&length(delta)>THRESHOLD&&(context.dragging=!0,ClickTrap.install(),Cursor.set("grab")),context.dragging){var lastPosition=context.last||context.start;delta=substract(position,lastPosition),canvas.scroll({dx:delta.x,dy:delta.y}),context.last=position}event.preventDefault()}function handleEnd(event){domEvent.unbind(document,"mousemove",handleMove),domEvent.unbind(document,"mouseup",handleEnd),context=null,Cursor.unset()}function handleStart(event){domClosest(event.target,".djs-draggable")||event.button||event.ctrlKey||event.shiftKey||event.altKey||(context={start:EventUtil.toPoint(event)},domEvent.bind(document,"mousemove",handleMove),domEvent.bind(document,"mouseup",handleEnd))}var context,container=canvas._container;domEvent.bind(container,"mousedown",handleStart)}var Cursor=require("../../util/Cursor"),ClickTrap=require("../../util/ClickTrap"),substract=require("../../util/Math").substract,domEvent=require("min-dom/lib/event"),domClosest=require("min-dom/lib/closest"),EventUtil=require("../../util/Event"),THRESHOLD=15;MoveCanvas.$inject=["eventBus","canvas"],module.exports=MoveCanvas},{"../../util/ClickTrap":322,"../../util/Cursor":325,"../../util/Event":327,"../../util/Math":333,"min-dom/lib/closest":517,"min-dom/lib/event":520}],316:[function(require,module,exports){module.exports={__init__:["moveCanvas"],moveCanvas:["type",require("./MoveCanvas")]}},{"./MoveCanvas":315}],317:[function(require,module,exports){module.exports={__depends__:[require("../../features/touch")]}},{"../../features/touch":307}],318:[function(require,module,exports){"use strict";function ZoomScroll(eventBus,canvas,config){this._enabled=!1,this._canvas=canvas,this._container=canvas._container,this._handleWheel=bind(this._handleWheel,this);var newEnabled=!config||!1!==config.enabled,self=this;eventBus.on("canvas.init",function(e){self._init(newEnabled)})}var domEvent=require("min-dom/lib/event"),domClosest=require("min-dom/lib/closest"),hasPrimaryModifier=require("../../util/Mouse").hasPrimaryModifier,hasSecondaryModifier=require("../../util/Mouse").hasSecondaryModifier,isMac=require("../../util/Platform").isMac,getStepRange=require("./ZoomUtil").getStepRange,cap=require("./ZoomUtil").cap,log10=require("../../util/Math").log10,bind=require("lodash/function/bind"),RANGE={min:.2,max:4};ZoomScroll.$inject=["eventBus","canvas","config.zoomScroll"],module.exports=ZoomScroll,ZoomScroll.prototype.scroll=function(delta){this._canvas.scroll(delta)},ZoomScroll.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ZoomScroll.prototype.zoom=function(direction,position){var canvas=this._canvas,currentZoom=canvas.zoom(!1),factor=Math.pow(1+Math.abs(direction),direction>0?1:-1);canvas.zoom(cap(RANGE,currentZoom*factor),position)},ZoomScroll.prototype._handleWheel=function(event){if(!domClosest(event.target,".djs-scrollable",!0)){var element=this._container;event.preventDefault();var factor,isVerticalScroll=hasPrimaryModifier(event),isHorizontalScroll=hasSecondaryModifier(event);if(isVerticalScroll||isHorizontalScroll){factor=isMac?0===event.deltaMode?1.25:50:0===event.deltaMode?.025:.5;var delta={};isHorizontalScroll?delta.dx=factor*(event.deltaX||event.deltaY):delta.dy=factor*event.deltaY,this.scroll(delta)}else{factor=0===event.deltaMode?.025:.5;var elementRect=element.getBoundingClientRect(),offset={x:event.clientX-elementRect.left,y:event.clientY-elementRect.top};this.zoom(event.deltaY*factor/-5,offset)}}},ZoomScroll.prototype.stepZoom=function(direction,position){var canvas=this._canvas,stepRange=getStepRange(RANGE,10);direction=direction>0?1:-1;var currentLinearZoomLevel=log10(canvas.zoom()),newLinearZoomLevel=Math.round(currentLinearZoomLevel/stepRange)*stepRange;newLinearZoomLevel+=stepRange*direction;var newLogZoomLevel=Math.pow(10,newLinearZoomLevel);canvas.zoom(cap(RANGE,newLogZoomLevel),position)},ZoomScroll.prototype.toggle=function(newEnabled){var element=this._container,handleWheel=this._handleWheel,oldEnabled=this._enabled;return void 0===newEnabled&&(newEnabled=!oldEnabled),oldEnabled!==newEnabled&&domEvent[newEnabled?"bind":"unbind"](element,"wheel",handleWheel,!1),this._enabled=newEnabled,newEnabled},ZoomScroll.prototype._init=function(newEnabled){this.toggle(newEnabled)}},{"../../util/Math":333,"../../util/Mouse":334,"../../util/Platform":335,"./ZoomUtil":319,"lodash/function/bind":377,"min-dom/lib/closest":517,"min-dom/lib/event":520}],319:[function(require,module,exports){"use strict";var log10=require("../../util/Math").log10;module.exports.getStepRange=function(range,steps){var minLinearRange=log10(range.min),maxLinearRange=log10(range.max);return(Math.abs(minLinearRange)+Math.abs(maxLinearRange))/steps},module.exports.cap=function(range,scale){return Math.max(range.min,Math.min(range.max,scale))}},{"../../util/Math":333}],320:[function(require,module,exports){module.exports={__init__:["zoomScroll"],zoomScroll:["type",require("./ZoomScroll")]}},{"./ZoomScroll":318}],321:[function(require,module,exports){"use strict";function getNewAttachPoint(point,oldBounds,newBounds){var oldCenter=center(oldBounds),newCenter=center(newBounds),oldDelta=delta(point,oldCenter),newDelta={x:oldDelta.x*(newBounds.width/oldBounds.width),y:oldDelta.y*(newBounds.height/oldBounds.height)};return roundPoint({x:newCenter.x+newDelta.x,y:newCenter.y+newDelta.y})}function getNewAttachShapeDelta(shape,oldBounds,newBounds){var shapeCenter=center(shape),oldCenter=center(oldBounds),newCenter=center(newBounds),shapeDelta=delta(shape,shapeCenter),oldCenterDelta=delta(shapeCenter,oldCenter),newCenterDelta={x:oldCenterDelta.x*(newBounds.width/oldBounds.width),y:oldCenterDelta.y*(newBounds.height/oldBounds.height)},newShapeCenter={x:newCenter.x+newCenterDelta.x,y:newCenter.y+newCenterDelta.y};return roundPoint({x:newShapeCenter.x+shapeDelta.x-shape.x,y:newShapeCenter.y+shapeDelta.y-shape.y})}var roundPoint=require("../layout/LayoutUtil").roundPoint,center=require("./PositionUtil").center,delta=require("./PositionUtil").delta;module.exports.getNewAttachPoint=getNewAttachPoint,module.exports.getNewAttachShapeDelta=getNewAttachShapeDelta},{"../layout/LayoutUtil":312,"./PositionUtil":336}],322:[function(require,module,exports){"use strict";function trap(event){stopEvent(event),toggle(!1)}function toggle(active){domEvent[active?"bind":"unbind"](document.body,"click",trap,!0)}function install(){return toggle(!0),function(){toggle(!1)}}var domEvent=require("min-dom/lib/event"),stopEvent=require("./Event").stopEvent;module.exports.install=install},{"./Event":327,"min-dom/lib/event":520}],323:[function(require,module,exports){"use strict";module.exports.remove=function(collection,element){if(!collection||!element)return-1;var idx=collection.indexOf(element);return-1!==idx&&collection.splice(idx,1),idx},module.exports.add=function(collection,element,idx){if(collection&&element){"number"!=typeof idx&&(idx=-1);var currentIdx=collection.indexOf(element);if(-1!==currentIdx){if(currentIdx===idx)return;if(-1===idx)return;collection.splice(currentIdx,1)}-1!==idx?collection.splice(idx,0,element):collection.push(element)}},module.exports.indexOf=function(collection,element){return collection&&element?collection.indexOf(element):-1}},{}],324:[function(require,module,exports){"use strict";function getTopLevel(elements){var topLevel={},parents=[],result=[],clearedParents=[];return forEach(elements,function(element){var parent=element.parent;topLevel[parent.id]||(topLevel[parent.id]=[]),-1===parents.indexOf(parent.id)&&parents.push(parent.id),topLevel[parent.id].push(element)}),forEach(parents,function(parent){forEach(topLevel[parent],function(element){topLevel[element.id]&&clearedParents.push(element.id)})}),forEach(parents,function(parent){-1===clearedParents.indexOf(parent)&&(result=result.concat(topLevel[parent]))}),result}var forEach=require("lodash/collection/forEach");module.exports.getTopLevel=getTopLevel},{"lodash/collection/forEach":366}],325:[function(require,module,exports){"use strict";var domClasses=require("min-dom/lib/classes"),CURSOR_CLS_PATTERN=/^djs-cursor-.*$/;module.exports.set=function(mode){var classes=domClasses(document.body);classes.removeMatching(CURSOR_CLS_PATTERN),mode&&classes.add("djs-cursor-"+mode)},module.exports.unset=function(){this.set(null)},module.exports.has=function(mode){return domClasses(document.body).has("djs-cursor-"+mode)}},{"min-dom/lib/classes":515}],326:[function(require,module,exports){"use strict";function add(elements,e,unique){var canAdd=!unique||-1===elements.indexOf(e);return canAdd&&elements.push(e),canAdd}function eachElement(elements,fn,depth){depth=depth||0,isArray(elements)||(elements=[elements]),forEach(elements,function(s,i){var filter=fn(s,i,depth);isArray(filter)&&filter.length&&eachElement(filter,fn,depth+1)})}function selfAndChildren(elements,unique,maxDepth){var result=[],processedChildren=[];return eachElement(elements,function(element,i,depth){add(result,element,unique);var children=element.children;if((-1===maxDepth||depthmaxX||void 0===maxX)&&(maxX=x+width),(y+height>maxY||void 0===maxY)&&(maxY=y+height)}),{x:minX,y:minY,height:maxY-minY,width:maxX-minX}}function getEnclosedElements(elements,bbox){var filteredElements={};return forEach(elements,function(element){var e=element;e.waypoints&&(e=getBBox(e)),!isNumber(bbox.y)&&e.x>bbox.x&&(filteredElements[element.id]=element),!isNumber(bbox.x)&&e.y>bbox.y&&(filteredElements[element.id]=element),e.x>bbox.x&&e.y>bbox.y&&(isNumber(bbox.width)&&isNumber(bbox.height)&&e.width+e.xrect.x-tolerance&&p.y>rect.y-tolerance&&p.x=1e3&&delete cache[count.shift()],count.push(args),cache[args]=f.apply(scope,arg),postprocessor?postprocessor(cache[args]):cache[args])}return newf}function parsePathString(pathString){if(!pathString)return null;var pth=paths(pathString);if(pth.arr)return clone(pth.arr);var paramCounts={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},data=[];return is(pathString,"array")&&is(pathString[0],"array")&&(data=clone(pathString)),data.length||String(pathString).replace(pathCommand,function(a,b,c){var params=[],name=b.toLowerCase();if(c.replace(pathValues,function(a,b){b&¶ms.push(+b)}),"m"==name&¶ms.length>2&&(data.push([b].concat(params.splice(0,2))),name="l",b="m"==b?"l":"L"),"o"==name&&1==params.length&&data.push([b,params[0]]),"r"==name)data.push([b].concat(params));else for(;params.length>=paramCounts[name]&&(data.push([b].concat(params.splice(0,paramCounts[name]))),paramCounts[name]););}),data.toString=paths.toString,pth.arr=clone(data),data}function paths(ps){var p=paths.ps=paths.ps||{};return p[ps]?p[ps].sleep=100:p[ps]={sleep:100},setTimeout(function(){for(var key in p)p[has](key)&&key!=ps&&!--p[key].sleep&&delete p[key]}),p[ps]}function box(x,y,width,height){return null==x&&(x=y=width=height=0),null==y&&(y=x.y,width=x.width,height=x.height,x=x.x),{x:x,y:y,width:width,w:width,height:height,h:height,x2:x+width,y2:y+height,cx:x+width/2,cy:y+height/2,r1:math.min(width,height)/2,r2:math.max(width,height)/2,r0:math.sqrt(width*width+height*height)/2,path:rectPath(x,y,width,height),vb:[x,y,width,height].join(" ")}}function toString(){return this.join(",").replace(p2s,"$1")}function pathClone(pathArray){var res=clone(pathArray);return res.toString=toString,res}function getPointAtSegmentLength(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,length){return null==length?bezlen(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y):findDotsAtSegment(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,getTotLen(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,length))}function getLengthFactory(istotal,subpath){function O(val){return+(+val).toFixed(3)}return cacher(function(path,length,onlystart){path instanceof Element&&(path=path.attr("d")),path=path2curve(path);for(var x,y,p,l,point,sp="",subpaths={},len=0,i=0,ii=path.length;ilength){if(subpath&&!subpaths.start){if(point=getPointAtSegmentLength(x,y,p[1],p[2],p[3],p[4],p[5],p[6],length-len),sp+=["C"+O(point.start.x),O(point.start.y),O(point.m.x),O(point.m.y),O(point.x),O(point.y)],onlystart)return sp;subpaths.start=sp,sp=["M"+O(point.x),O(point.y)+"C"+O(point.n.x),O(point.n.y),O(point.end.x),O(point.end.y),O(p[5]),O(p[6])].join(),len+=l,x=+p[5],y=+p[6];continue}if(!istotal&&!subpath)return point=getPointAtSegmentLength(x,y,p[1],p[2],p[3],p[4],p[5],p[6],length-len)}len+=l,x=+p[5],y=+p[6]}sp+=p.shift()+p}return subpaths.end=sp,point=istotal?len:subpath?subpaths:findDotsAtSegment(x,y,p[0],p[1],p[2],p[3],p[4],p[5],1)},null,clone)}function findDotsAtSegment(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y,t){var t1=1-t,t13=pow(t1,3),t12=pow(t1,2),t2=t*t,t3=t2*t,x=t13*p1x+3*t12*t*c1x+3*t1*t*t*c2x+t3*p2x,y=t13*p1y+3*t12*t*c1y+3*t1*t*t*c2y+t3*p2y,mx=p1x+2*t*(c1x-p1x)+t2*(c2x-2*c1x+p1x),my=p1y+2*t*(c1y-p1y)+t2*(c2y-2*c1y+p1y),nx=c1x+2*t*(c2x-c1x)+t2*(p2x-2*c2x+c1x),ny=c1y+2*t*(c2y-c1y)+t2*(p2y-2*c2y+c1y);return{x:x,y:y,m:{x:mx,y:my},n:{x:nx,y:ny},start:{x:t1*p1x+t*c1x,y:t1*p1y+t*c1y},end:{x:t1*c2x+t*p2x,y:t1*c2y+t*p2y},alpha:90-180*math.atan2(mx-nx,my-ny)/PI}}function bezierBBox(p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y){is(p1x,"array")||(p1x=[p1x,p1y,c1x,c1y,c2x,c2y,p2x,p2y]);var bbox=curveDim.apply(null,p1x);return box(bbox.min.x,bbox.min.y,bbox.max.x-bbox.min.x,bbox.max.y-bbox.min.y)}function isPointInsideBBox(bbox,x,y){return x>=bbox.x&&x<=bbox.x+bbox.width&&y>=bbox.y&&y<=bbox.y+bbox.height}function isBBoxIntersect(bbox1,bbox2){return bbox1=box(bbox1),bbox2=box(bbox2),isPointInsideBBox(bbox2,bbox1.x,bbox1.y)||isPointInsideBBox(bbox2,bbox1.x2,bbox1.y)||isPointInsideBBox(bbox2,bbox1.x,bbox1.y2)||isPointInsideBBox(bbox2,bbox1.x2,bbox1.y2)||isPointInsideBBox(bbox1,bbox2.x,bbox2.y)||isPointInsideBBox(bbox1,bbox2.x2,bbox2.y)||isPointInsideBBox(bbox1,bbox2.x,bbox2.y2)||isPointInsideBBox(bbox1,bbox2.x2,bbox2.y2)||(bbox1.xbbox2.x||bbox2.xbbox1.x)&&(bbox1.ybbox2.y||bbox2.ybbox1.y)}function base3(t,p1,p2,p3,p4){return t*(t*(-3*p1+9*p2-9*p3+3*p4)+6*p1-12*p2+6*p3)-3*p1+3*p2}function bezlen(x1,y1,x2,y2,x3,y3,x4,y4,z){null==z&&(z=1),z=z>1?1:z<0?0:z;for(var z2=z/2,Tvalues=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],Cvalues=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],sum=0,i=0;i<12;i++){var ct=z2*Tvalues[i]+z2,xbase=base3(ct,x1,x2,x3,x4),ybase=base3(ct,y1,y2,y3,y4),comb=xbase*xbase+ybase*ybase;sum+=Cvalues[i]*math.sqrt(comb)}return z2*sum}function getTotLen(x1,y1,x2,y2,x3,y3,x4,y4,ll){if(!(ll<0||bezlen(x1,y1,x2,y2,x3,y3,x4,y4).01;)step/=2,t2+=(lmmax(x3,x4)||mmax(y1,y2)mmax(y3,y4))){var nx=(x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4),ny=(x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4),denominator=(x1-x2)*(y3-y4)-(y1-y2)*(x3-x4);if(denominator){var px=nx/denominator,py=ny/denominator,px2=+px.toFixed(2),py2=+py.toFixed(2);if(!(px2<+mmin(x1,x2).toFixed(2)||px2>+mmax(x1,x2).toFixed(2)||px2<+mmin(x3,x4).toFixed(2)||px2>+mmax(x3,x4).toFixed(2)||py2<+mmin(y1,y2).toFixed(2)||py2>+mmax(y1,y2).toFixed(2)||py2<+mmin(y3,y4).toFixed(2)||py2>+mmax(y3,y4).toFixed(2)))return{x:px,y:py}}}}function interHelper(bez1,bez2,justCount){if(!isBBoxIntersect(bezierBBox(bez1),bezierBBox(bez2)))return justCount?0:[];for(var l1=bezlen.apply(0,bez1),l2=bezlen.apply(0,bez2),n1=~~(l1/8),n2=~~(l2/8),dots1=[],dots2=[],xy={},res=justCount?0:[],i=0;i=0&&t1<=1&&t2>=0&&t2<=1&&(justCount?res++:res.push({x:is.x,y:is.y,t1:t1,t2:t2}))}}return res}function pathIntersection(path1,path2){return interPathHelper(path1,path2)}function pathIntersectionNumber(path1,path2){return interPathHelper(path1,path2,1)}function interPathHelper(path1,path2,justCount){path1=path2curve(path1),path2=path2curve(path2);for(var x1,y1,x2,y2,x1m,y1m,x2m,y2m,bez1,bez2,res=justCount?0:[],i=0,ii=path1.length;i180),0,x2,y2]];else res=[["M",x,y],["m",0,-ry],["a",rx,ry,0,1,1,0,2*ry],["a",rx,ry,0,1,1,0,-2*ry],["z"]];return res.toString=toString,res}function pathToRelative(pathArray){var pth=paths(pathArray),lowerCase=String.prototype.toLowerCase;if(pth.rel)return pathClone(pth.rel);is(pathArray,"array")&&is(pathArray&&pathArray[0],"array")||(pathArray=parsePathString(pathArray));var res=[],x=0,y=0,mx=0,my=0,start=0;"M"==pathArray[0][0]&&(x=pathArray[0][1],y=pathArray[0][2],mx=x,my=y,start++,res.push(["M",x,y]));for(var i=start,ii=pathArray.length;i1&&(h=math.sqrt(h),rx*=h,ry*=h);var rx2=rx*rx,ry2=ry*ry,k=(large_arc_flag==sweep_flag?-1:1)*math.sqrt(abs((rx2*ry2-rx2*y*y-ry2*x*x)/(rx2*y*y+ry2*x*x))),cx=k*rx*y/ry+(x1+x2)/2,cy=k*-ry*x/rx+(y1+y2)/2,f1=math.asin(((y1-cy)/ry).toFixed(9)),f2=math.asin(((y2-cy)/ry).toFixed(9));f1=x1f2&&(f1-=2*PI),!sweep_flag&&f2>f1&&(f2-=2*PI)}var df=f2-f1;if(abs(df)>_120){var f2old=f2,x2old=x2,y2old=y2;f2=f1+_120*(sweep_flag&&f2>f1?1:-1),x2=cx+rx*math.cos(f2),y2=cy+ry*math.sin(f2),res=a2c(x2,y2,rx,ry,angle,0,sweep_flag,x2old,y2old,[f2,f2old,cx,cy])}df=f2-f1;var c1=math.cos(f1),s1=math.sin(f1),c2=math.cos(f2),s2=math.sin(f2),t=math.tan(df/4),hx=4/3*rx*t,hy=4/3*ry*t,m1=[x1,y1],m2=[x1+hx*s1,y1-hy*c1],m3=[x2+hx*s2,y2-hy*c2],m4=[x2,y2];if(m2[0]=2*m1[0]-m2[0],m2[1]=2*m1[1]-m2[1],recursive)return[m2,m3,m4].concat(res);res=[m2,m3,m4].concat(res).join().split(",");for(var newres=[],i=0,ii=res.length;i7){pp[i].shift();for(var pi=pp[i];pi.length;)pcoms1[i]="A",p2&&(pcoms2[i]="A"),pp.splice(i++,0,["C"].concat(pi.splice(0,6)));pp.splice(i,1),ii=mmax(p.length,p2&&p2.length||0)}},fixM=function(path1,path2,a1,a2,i){path1&&path2&&"M"==path1[i][0]&&"M"!=path2[i][0]&&(path2.splice(i,0,["M",a2.x,a2.y]),a1.bx=0,a1.by=0,a1.x=path1[i][1],a1.y=path1[i][2],ii=mmax(p.length,p2&&p2.length||0))},pcoms1=[],pcoms2=[],pfirst="",pcom="",i=0,ii=mmax(p.length,p2&&p2.length||0);ii;i+=2){var p=[{x:+crp[i-2],y:+crp[i-1]},{x:+crp[i],y:+crp[i+1]},{x:+crp[i+2],y:+crp[i+3]},{x:+crp[i+4],y:+crp[i+5]}];z?i?iLen-4==i?p[3]={x:+crp[0],y:+crp[1]}:iLen-2==i&&(p[2]={x:+crp[0],y:+crp[1]},p[3]={x:+crp[2],y:+crp[3]}):p[0]={x:+crp[iLen-2],y:+crp[iLen-1]}:iLen-4==i?p[3]=p[2]:i||(p[0]={x:+crp[i],y:+crp[i+1]}),d.push(["C",(-p[0].x+6*p[1].x+p[2].x)/6,(-p[0].y+6*p[1].y+p[2].y)/6,(p[1].x+6*p[2].x-p[3].x)/6,(p[1].y+6*p[2].y-p[3].y)/6,p[2].x,p[2].y])}return d}var has="hasOwnProperty",p2s=/,?([a-z]),?/gi,toFloat=parseFloat,math=Math,PI=math.PI,mmin=math.min,mmax=math.max,pow=math.pow,abs=math.abs,pathCommand=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,pathValues=/(-?\d*\.?\d*(?:e[\-+]?\\d+)?)[\s]*,?[\s]*/gi,getTotalLength=getLengthFactory(1),getPointAtLength=getLengthFactory();paths.getTotalLength=getTotalLength,paths.getPointAtLength=getPointAtLength,paths.findDotsAtSegment=findDotsAtSegment,paths.bezierBBox=bezierBBox,paths.isPointInsideBBox=isPointInsideBBox,paths.isBBoxIntersect=isBBoxIntersect,paths.intersection=pathIntersection,paths.intersectionNumber=pathIntersectionNumber,paths.isPointInside=isPointInsidePath,paths.getBBox=pathBBox,paths.toRelative=pathToRelative,paths.toAbsolute=pathToAbsolute,paths.toCubic=path2curve,paths.map=mapPath,paths.toString=toString,paths.clone=pathClone,module.exports.intersection=pathIntersection},{}],332:[function(require,module,exports){"use strict";function circlePath(center,r){return[["M",center.x,center.y],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]]}function linePath(points){var segments=[];return points.forEach(function(p,idx){segments.push([0===idx?"M":"L",p.x,p.y])}),segments}function getBendpointIntersection(waypoints,reference){var i,w;for(i=0;w=waypoints[i];i++)if(pointDistance(w,reference)<=INTERSECTION_THRESHOLD)return{point:waypoints[i],bendpoint:!0,index:i};return null}function getPathIntersection(waypoints,reference){var idx,intersections=intersection(circlePath(reference,INTERSECTION_THRESHOLD),linePath(waypoints)),a=intersections[0],b=intersections[intersections.length-1];return a?a!==b?a.segment2!==b.segment2?(idx=max(a.segment2,b.segment2)-1,{point:waypoints[idx],bendpoint:!0,index:idx}):{point:{x:round(a.x+b.x)/2,y:round(a.y+b.y)/2},index:a.segment2}:{point:{x:round(a.x),y:round(a.y)},index:a.segment2}:null}var pointDistance=require("./Geometry").pointDistance,intersection=require("./Intersection").intersection,round=Math.round,max=Math.max,INTERSECTION_THRESHOLD=10;module.exports.getApproxIntersection=function(waypoints,reference){return getBendpointIntersection(waypoints,reference)||getPathIntersection(waypoints,reference)}},{"./Geometry":328,"./Intersection":331}],333:[function(require,module,exports){"use strict";function log10(x){return Math.log(x)/Math.log(10)}function substract(p1,p2){return{x:p1.x-p2.x,y:p1.y-p2.y}}module.exports.log10=log10,module.exports.substract=substract},{}],334:[function(require,module,exports){"use strict";function isPrimaryButton(event){return!(getOriginalEvent(event)||event).button}var getOriginalEvent=require("./Event").getOriginal,isMac=require("./Platform").isMac;module.exports.isPrimaryButton=isPrimaryButton,module.exports.isMac=isMac,module.exports.hasPrimaryModifier=function(event){var originalEvent=getOriginalEvent(event)||event;return!!isPrimaryButton(event)&&(isMac()?originalEvent.metaKey:originalEvent.ctrlKey)},module.exports.hasSecondaryModifier=function(event){var originalEvent=getOriginalEvent(event)||event;return isPrimaryButton(event)&&originalEvent.shiftKey}},{"./Event":327,"./Platform":335}],335:[function(require,module,exports){"use strict";module.exports.isMac=function(){return/mac/i.test(navigator.platform)}},{}],336:[function(require,module,exports){"use strict";function center(bounds){return{x:bounds.x+bounds.width/2,y:bounds.y+bounds.height/2}}function delta(a,b){return{x:a.x-b.x,y:a.y-b.y}}module.exports.center=center,module.exports.delta=delta},{}],337:[function(require,module,exports){"use strict";module.exports.saveClear=function(collection,removeFn){if("function"!=typeof removeFn)throw new Error("removeFn iterator must be a function");if(collection){for(var e;e=collection[0];)removeFn(e);return collection}}},{}],338:[function(require,module,exports){"use strict";function toSVGPoints(points){for(var p,result="",i=0;p=points[i];i++)result+=p.x+","+p.y+" ";return result}var svgAttr=require("tiny-svg/lib/attr"),svgCreate=require("tiny-svg/lib/create");module.exports.componentsToPath=function(elements){return elements.join(",").replace(/,?([A-z]),?/g,"$1")},module.exports.toSVGPoints=toSVGPoints,module.exports.createLine=function(points,attrs){var line=svgCreate("polyline");return svgAttr(line,{points:toSVGPoints(points)}),attrs&&svgAttr(line,attrs),line},module.exports.updateLine=function(gfx,points){return svgAttr(gfx,{points:toSVGPoints(points)}),gfx}},{"tiny-svg/lib/attr":545,"tiny-svg/lib/create":549}],339:[function(require,module,exports){"use strict";var svgTransform=require("tiny-svg/lib/transform"),createTransform=require("tiny-svg/lib/geometry").createTransform;module.exports.transform=function(gfx,x,y,angle,amount){var translate=createTransform();translate.setTranslate(x,y);var rotate=createTransform();rotate.setRotate(angle,0,0);var scale=createTransform();scale.setScale(amount||1,amount||1),svgTransform(gfx,[translate,rotate,scale])},module.exports.translate=function(gfx,x,y){var translate=createTransform();translate.setTranslate(x,y),svgTransform(gfx,translate)},module.exports.rotate=function(gfx,angle){var rotate=createTransform();rotate.setRotate(angle,0,0),svgTransform(gfx,rotate)},module.exports.scale=function(gfx,amount){var scale=createTransform();scale.setScale(amount,amount),svgTransform(gfx,scale)}},{"tiny-svg/lib/geometry":550,"tiny-svg/lib/transform":553}],340:[function(require,module,exports){"use strict";function parseAlign(align){var parts=align.split("-");return{horizontal:parts[0]||"center",vertical:parts[1]||"top"}}function parsePadding(padding){return isObject(padding)?assign({top:0,left:0,right:0,bottom:0},padding):{top:padding,left:padding,right:padding,bottom:padding}}function getTextBBox(text,fakeText){fakeText.textContent=text;try{var bbox,emptyLine=""===text;return fakeText.textContent=emptyLine?"dummy":text,bbox=pick(fakeText.getBBox(),["width","height"]),emptyLine&&(bbox.width=0),bbox}catch(e){return{width:0,height:0}}}function layoutNext(lines,maxWidth,fakeText){for(var textBBox,originalLine=lines.shift(),fitLine=originalLine;;){if(textBBox=getTextBBox(fitLine,fakeText),textBBox.width=fitLine?textBBox.width:0," "===fitLine||""===fitLine||textBBox.width1)for(;part=parts.shift();){if(!(part.length+length ");return currentlyResolving.length=0,new Error(stack?msg+" (Resolving: "+stack+")":msg)},get=function(name,strict){if(!providers[name]&&-1!==name.indexOf(".")){for(var parts=name.split("."),pivot=get(parts.shift());parts.length;)pivot=pivot[parts.shift()];return pivot}if(Object.hasOwnProperty.call(instances,name))return instances[name];if(Object.hasOwnProperty.call(providers,name)){if(-1!==currentlyResolving.indexOf(name))throw currentlyResolving.push(name),error("Cannot resolve circular dependency!");return currentlyResolving.push(name),instances[name]=providers[name][0](providers[name][1]),currentlyResolving.pop(),instances[name]}return parent.get(name,strict)},instantiate=function(Type){var instance=Object.create(Type.prototype),returned=invoke(Type,instance);return"object"==typeof returned?returned:instance},invoke=function(fn,context){if("function"!=typeof fn){if(!isArray(fn))throw new Error('Cannot invoke "'+fn+'". Expected a function!');fn=annotate(fn.slice())}var inject=fn.$inject&&fn.$inject||autoAnnotate(fn),dependencies=inject.map(function(dep){return get(dep)});return fn.apply(context,dependencies)},createPrivateInjectorFactory=function(privateChildInjector){return annotate(function(key){return privateChildInjector.get(key)})},createChild=function(modules,forceNewInstances){if(forceNewInstances&&forceNewInstances.length){var provider,cacheIdx,privateChildInjector,privateChildInjectorFactory,fromParentModule=Object.create(null),matchedScopes=Object.create(null),privateInjectorsCache=[],privateChildInjectors=[],privateChildFactories=[];for(var name in providers)provider=providers[name],-1!==forceNewInstances.indexOf(name)&&("private"===provider[2]?(cacheIdx=privateInjectorsCache.indexOf(provider[3]),-1===cacheIdx?(privateChildInjector=provider[3].createChild([],forceNewInstances),privateChildInjectorFactory=createPrivateInjectorFactory(privateChildInjector),privateInjectorsCache.push(provider[3]),privateChildInjectors.push(privateChildInjector),privateChildFactories.push(privateChildInjectorFactory),fromParentModule[name]=[privateChildInjectorFactory,name,"private",privateChildInjector]):fromParentModule[name]=[privateChildFactories[cacheIdx],name,"private",privateChildInjectors[cacheIdx]]):fromParentModule[name]=[provider[2],provider[1]],matchedScopes[name]=!0),"factory"!==provider[2]&&"type"!==provider[2]||!provider[1].$scope||forceNewInstances.forEach(function(scope){-1!==provider[1].$scope.indexOf(scope)&&(fromParentModule[name]=[provider[2],provider[1]],matchedScopes[scope]=!0)});forceNewInstances.forEach(function(scope){if(!matchedScopes[scope])throw new Error('No provider for "'+scope+'". Cannot use provider from the parent!')}),modules.unshift(fromParentModule)}return new Injector(modules,self)},factoryMap={factory:invoke,type:instantiate,value:function(value){return value}};modules.forEach(function(module){function arrayUnwrap(type,value){return"value"!==type&&isArray(value)&&(value=annotate(value.slice())),value}if(module instanceof Module)module.forEach(function(provider){var name=provider[0],type=provider[1],value=provider[2];providers[name]=[factoryMap[type],arrayUnwrap(type,value),type]});else if("object"==typeof module)if(module.__exports__){var clonedModule=Object.keys(module).reduce(function(m,key){return"__"!==key.substring(0,2)&&(m[key]=module[key]),m},Object.create(null)),privateInjector=new Injector((module.__modules__||[]).concat([clonedModule]),self),getFromPrivateInjector=annotate(function(key){return privateInjector.get(key)});module.__exports__.forEach(function(key){providers[key]=[getFromPrivateInjector,key,"private",privateInjector]})}else Object.keys(module).forEach(function(name){if("private"===module[name][2])return void(providers[name]=module[name]);var type=module[name][0],value=module[name][1];providers[name]=[factoryMap[type],arrayUnwrap(type,value),type]})}),this.get=get,this.invoke=invoke,this.instantiate=instantiate,this.createChild=createChild};module.exports=Injector},{"./annotation":341,"./module":344}],344:[function(require,module,exports){var Module=function(){var providers=[];this.factory=function(name,factory){return providers.push([name,"factory",factory]),this},this.value=function(name,value){return providers.push([name,"value",value]),this},this.type=function(name,type){return providers.push([name,"type",type]),this},this.forEach=function(iterator){providers.forEach(iterator)}};module.exports=Module},{}],345:[function(require,module,exports){function parse(html,doc){if("string"!=typeof html)throw new TypeError("String expected");doc||(doc=document);var m=/<([\w:]+)/.exec(html);if(!m)return doc.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if("body"==tag){var el=doc.createElement("html");return el.innerHTML=html,el.removeChild(el.lastChild)}var wrap=map[tag]||map._default,depth=wrap[0],prefix=wrap[1],suffix=wrap[2],el=doc.createElement("div");for(el.innerHTML=prefix+html+suffix;depth--;)el=el.lastChild;if(el.firstChild==el.lastChild)return el.removeChild(el.firstChild);for(var fragment=doc.createDocumentFragment();el.firstChild;)fragment.appendChild(el.removeChild(el.firstChild));return fragment}module.exports=parse;var bugTestDiv,innerHTMLBug=!1;"undefined"!=typeof document&&(bugTestDiv=document.createElement("div"),bugTestDiv.innerHTML='
a',innerHTMLBug=!bugTestDiv.getElementsByTagName("link").length,bugTestDiv=void 0);var map={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:innerHTMLBug?[1,"X
","
"]:[0,"",""]};map.td=map.th=[3,"","
"],map.option=map.optgroup=[1,'"],map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"","
"],map.polyline=map.ellipse=map.polygon=map.circle=map.text=map.line=map.path=map.rect=map.g=[1,'',""]},{}],346:[function(require,module,exports){!function(){function Parser(){}function extendDefaultOptions(options){if(options&&options._defaults)return options;var obj={_defaults:!0,types:Object.create(edn.types),converters:Object.create(edn.converters),values:Object.create(edn.values),equal:Object.create(edn.equal),printers:Object.create(edn.printers),tags:Object.create(edn.tags)};return options&&(extend(obj.types,options.types),extend(obj.converters,options.converters),extend(obj.values,options.values),extend(obj.equal,options.equal),extend(obj.printers,options.printers),extend(obj.tags,options.tags)),obj}function extend(target,source){var k;for(k in source)target[k]=source[k]}function compareValues(a,b){return a.valueOf()==b.valueOf()}function compareArrayValues(a,b,isEqual){var aLen=a.length;if(aLen!=b.length)return!1;for(var i=0;i2&&expected.push("'"+this.terminals_[p]+"'");errStr=this.lexer.showPosition?"Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(1==symbol?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected})}}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(this.lexer.yytext),lstack.push(this.lexer.yylloc),stack.push(action[1]),symbol=null,preErrorSymbol?(symbol=preErrorSymbol,preErrorSymbol=null):(yyleng=this.lexer.yyleng,yytext=this.lexer.yytext,yylineno=this.lexer.yylineno,yyloc=this.lexer.yylloc,recovering>0&&recovering--);break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),void 0!==(r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack)))return r;len&&(stack=stack.slice(0,-1*len*2),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0}},lexer=function(){var lexer={EOF:1,parseError:function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},setInput:function(input){return this._input=input,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var ch=this._input[0];return this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch,ch.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},unput:function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len-1),this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),lines.length-1&&(this.yylineno-=lines.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this},more:function(){return this._more=!0,this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var token,match,tempMatch,index,lines;this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;imatch[0].length)||(match=tempMatch,index=i,this.options.flex));i++);return match?(lines=match[0].match(/(?:\r\n?|\n).*/g),lines&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,rules[index],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return void 0!==r?r:this.lex()},begin:function(condition){this.conditionStack.push(condition)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(condition){this.begin(condition)}};return lexer.options={},lexer.performAction=function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:case 1:case 2:break;case 3:return 20;case 4:return 25;case 5:return 26;case 6:return 27;case 7:return 28;case 8:return 29;case 9:return 33;case 10:return 32;case 11:return 24;case 12:return 22;case 13:return 23;case 14:return 21;case 15:return 5;case 16:return 34;case 17:return 35;case 18:return 40;case 19:return 38;case 20:return 39;case 21:return 36;case 22:return 37;case 23:return 41;case 24:return 31;case 25:return 30}},lexer.rules=[/^(?:\s+)/,/^(?:,)/,/^(?:;[^\n]+)/,/^(?:#[_])/,/^(?:\\newline\b)/,/^(?:\\return\b)/,/^(?:\\space\b)/,/^(?:\\tab\b)/,/^(?:\\[a-z]\b)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)\b)/,/^(?:(-?([0-9]|[1-9][0-9]+))\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:true\b)/,/^(?:false\b)/,/^(?:nil\b)/,/^(?:$)/,/^(?:\()/,/^(?:\))/,/^(?:#\{)/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:#[a-zA-Z0-9\/]+)/,/^(?::[a-zA-Z0-9\/\.\*\+\!\:\-\_\?\$\=\#]+)/,/^(?:[a-zA-Z\.\*\+\!\-\_\?\$\%\&\=\/][a-zA-Z0-9\#\.\*\+\!\-\_\?\$\%\&\=\/]*)/],lexer.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}},lexer}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}();if(void 0!==exports)var edn=exports;else var edn=window.edn={};Parser.prototype=parser,edn.parse=function(str,options){var parser=new Parser;return parser.yy.options=extendDefaultOptions(options),parser.parse(str)},edn.printers={},edn.stringify=function(obj,options){if(options=extendDefaultOptions(options),obj&&obj.toEDN)return obj.toEDN();obj=edn.convert(obj,options);var type=edn.typeOf(obj,options);if(type){var printer=options.printers[type];if(printer)return printer(obj);throw new Error("No printer function for type "+type)}throw new Error("No printer function for object "+obj)},edn.values={},edn.valueOf=function(obj,deep,options){function valueOf(obj){var type=edn.typeOf(obj,options);if(type){var f=options.values[type];return f?f(obj,deep,valueOf):obj}return obj}return void 0==deep&&(deep=!0),options=extendDefaultOptions(options),valueOf(obj)},edn.equal={},edn.isEqual=function(a,b,options){function isEqual(a,b){a=edn.convert(a,options),b=edn.convert(b,options);var aType=edn.typeOf(a,options),bType=edn.typeOf(b,options),eq=options.equal[aType];if(a===b)return!0;if(aType!==bType)return!1;if(eq)return eq(a,b,isEqual);throw new Error("No equal function for type "+aType)}return options=extendDefaultOptions(options),isEqual(a,b)},edn.converters={},edn.convert=function(obj,options){if(options=extendDefaultOptions(options),obj&&obj.asEDN)return obj.asEDN();var type=edn.typeOf(obj,options);if(type){var f=options.converters[type];return f?f(obj):obj}throw new Error("No type for object "+obj)},edn.types={},edn.typeOf=function(obj,options){options=extendDefaultOptions(options);var matchedTypes=[];for(var type in options.types)options.types[type](obj)&&matchedTypes.push(type);if(1==matchedTypes.length)return matchedTypes[0];if(matchedTypes.length>1)throw new Error("Conflicted types "+matchedTypes.join(", ")+" for object "+obj);return null};var toString=Object.prototype.toString;!function(){edn.types.nil=function(obj){return null===obj},edn.printers.nil=function(){return"nil"},edn.equal.nil=function(a,b){return!0},edn.types.undefined=function(obj){return void 0===obj},edn.converters.undefined=function(){return null}}(),function(){edn.types.boolean=function(obj){return"[object Boolean]"===toString.call(obj)},edn.printers.boolean=function(bool){return bool.valueOf()?"true":"false"},edn.equal.boolean=compareValues}(),function(){edn.types.string=function(obj){return"[object String]"===toString.call(obj)},edn.printers.string=function(str){return JSON.stringify(str)},edn.equal.string=compareValues}(),edn.Character=function(){function Character(c){if(!(this instanceof Character)){var char=pool[c];return char||(char=new Character(c),Object.freeze(char),pool[c]=char),char}this.char=c}var pool={};return Character.prototype.valueOf=function(){return this.char},Character.prototype.toString=function(){return this.char},Character.prototype.inspect=function(){return"[edn.Character "+require("util").inspect(this.char)+"]"},edn.types.character=function(obj){return obj instanceof Character},edn.printers.character=function(char){switch(char=char.valueOf()){case"\n":return"\\newline";case"\r":return"\\return";case" ":return"\\space";case"\t":return"\\tab";default:return"\\"+char[0]}},edn.values.character=valueOf,edn.equal.character=compareValues,edn.character=Character,parser.yy.Character=Character,Character}(),edn.Symbol=function(){function Symbol(namespace,name){if(!(this instanceof Symbol)){var nsname=joinNamespace(namespace,name),sym=pool[nsname];return sym||(sym=new Symbol(namespace,name),Object.freeze(sym),pool[sym.valueOf()]=sym),sym}var parts=splitNamespacedName(namespace,name);this.namespace=parts[0],this.name=parts[1]}function splitNamespacedName(namespace,name){if(namespace&&name)return[namespace,name];var parts=namespace.split("/",2);return"/"==namespace?[null,"/"]:2==parts.length?parts:[null,parts[0]]}function joinNamespace(namespace,name){return namespace&&name?[namespace,name].join("/"):namespace}var pool={};return Symbol.prototype.valueOf=function(){return this.namespace?[this.namespace,this.name].join("/"):this.name},Symbol.prototype.toString=function(){return this.valueOf()},Symbol.prototype.inspect=function(){return"[edn.Symbol "+this.toString()+"]"},edn.types.symbol=function(obj){return obj instanceof Symbol},edn.printers.symbol=function(symbol){return symbol.toString()},edn.values.symbol=valueOf,edn.equal.symbol=compareValues,edn.symbol=Symbol,parser.yy.Symbol=Symbol,Symbol}(),edn.Keyword=function(){function Keyword(namespace,name){var sym;if(sym=namespace instanceof edn.Symbol?namespace:edn.Symbol(namespace,name),!(this instanceof Keyword)){var key=pool[sym.valueOf()];return key||(key=new Keyword(namespace,name),Object.freeze(key),pool[sym.valueOf()]=key),key}this.symbol=sym,this.namespace=sym.namespace,this.name=sym.name}var pool={};return Keyword.prototype.valueOf=function(){return this.symbol.valueOf()},Keyword.prototype.toString=function(){return":"+this.symbol.toString()},Keyword.prototype.inspect=function(){return"[edn.Keyword "+this.toString()+"]"},edn.types.keyword=function(obj){return obj instanceof Keyword},edn.printers.keyword=function(keyword){return keyword.toString()},edn.values.keyword=valueOf,edn.equal.keyword=compareValues,edn.keyword=Keyword,parser.yy.Keyword=Keyword,Keyword}(),function(){edn.integer=function(n){return n},parser.yy.Integer=edn.integer,edn.types.integer=function(obj){return obj&&obj.type?"integer"==obj.type:"[object Number]"===toString.call(obj)&&Math.floor(obj)==obj},edn.printers.integer=function(n){return n.toString()},edn.values.integer=valueOf,edn.equal.integer=compareValues}(),function(){edn.float=function(n){return n=Object(n),n.type="float",n},parser.yy.Float=edn.float,edn.types.float=function(obj){return obj&&obj.type?"float"==obj.type:"[object Number]"===toString.call(obj)&&Math.floor(obj)!=obj},edn.printers.float=function(n){var s=n.toString();return/\./.test(s)||(s+=".0"),s},edn.values.float=valueOf,edn.equal.float=compareValues}(),function(){edn.list=function(ary){return ary=ary.slice(0),ary.type="list",ary},parser.yy.List=edn.list,edn.types.list=function(obj){return"[object Array]"===toString.call(obj)&&"list"===obj.type},edn.printers.list=function(ary){return"("+ary.map(edn.stringify).join(" ")+")"},edn.values.list=function(ary,deep,valueOf){return deep?ary.map(valueOf):ary.slice(0)},edn.equal.list=compareArrayValues}(),function(){edn.vector=function(ary){return ary=ary.slice(0),ary.type="vector",ary},parser.yy.Vector=edn.vector,edn.types.vector=function(obj){return"[object Array]"===toString.call(obj)&&"vector"===obj.type},edn.printers.vector=function(ary){return"["+ary.map(edn.stringify).join(" ")+"]"},edn.values.vector=function(ary,deep,valueOf){return deep?ary.map(valueOf):ary.slice(0)},edn.equal.vector=compareArrayValues,edn.types.array=function(obj){return"[object Array]"===toString.call(obj)&&void 0===obj.type},edn.converters.array=function(ary){return edn.vector(ary)}}(),edn.Map=function(){function Map(){if(!(this instanceof Map))return new Map;Object.defineProperty(this,"keys",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(this,"values",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(this,"items",{configurable:!1,enumerable:!1,writable:!1,value:[]}),Object.defineProperty(this,"_map",{enumerable:!0,get:function(){var obj={};return this.items.forEach(function(item){obj[edn.stringify(item[0])]=item[1]}),obj}})}function indexOfIdentical(keys,key){for(var i=0,length=keys.length;i=0},Map.prototype.set=function(key,value){var keys=this.keys,values=this.values,items=this.items,index=(this._map,indexOfIdentical(keys,key));return index<0&&(index=keys.length),keys[index]=key,values[index]=value,items[index]=[key,value],value},Map.prototype.delete=function(key){var keys=this.keys,values=this.values,items=this.items,index=(this._map,indexOfIdentical(keys,key));return!(index<0)&&(keys.splice(index,1),values.splice(index,1),items.splice(index,1),!0)},Map.prototype.toString=function(){return"[object Map]"},Map.prototype.inspect=function(){return"[edn.Map "+require("util").inspect(this.items)+"]"},Map}(),function(){edn.map=function(values){for(var map=new edn.Map,i=0;i0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){return this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],348:[function(require,module,exports){!function(window,document,exportName,undefined){"use strict";function setTimeoutContext(fn,timeout,context){return setTimeout(bindFn(fn,context),timeout)}function invokeArrayArg(arg,fn,context){return!!Array.isArray(arg)&&(each(arg,context[fn],context),!0)}function each(obj,iterator,context){var i;if(obj)if(obj.forEach)obj.forEach(iterator,context);else if(obj.length!==undefined)for(i=0;i\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",log=window.console&&(window.console.warn||window.console.log);return log&&log.call(window.console,deprecationMessage,stack),method.apply(this,arguments)}}function inherit(child,base,properties){var childP,baseP=base.prototype;childP=child.prototype=Object.create(baseP),childP.constructor=child,childP._super=baseP,properties&&assign(childP,properties)}function bindFn(fn,context){return function(){return fn.apply(context,arguments)}}function boolOrFn(val,args){return typeof val==TYPE_FUNCTION?val.apply(args?args[0]||undefined:undefined,args):val}function ifUndefined(val1,val2){return val1===undefined?val2:val1}function addEventListeners(target,types,handler){each(splitStr(types),function(type){target.addEventListener(type,handler,!1)})}function removeEventListeners(target,types,handler){each(splitStr(types),function(type){target.removeEventListener(type,handler,!1)})}function hasParent(node,parent){for(;node;){if(node==parent)return!0;node=node.parentNode}return!1}function inStr(str,find){return str.indexOf(find)>-1}function splitStr(str){return str.trim().split(/\s+/g)}function inArray(src,find,findByKey){if(src.indexOf&&!findByKey)return src.indexOf(find);for(var i=0;ib[key]}):results.sort()),results}function prefixed(obj,property){for(var prefix,prop,camelProp=property[0].toUpperCase()+property.slice(1),i=0;i1&&!session.firstMultiple?session.firstMultiple=simpleCloneInputData(input):1===pointersLength&&(session.firstMultiple=!1);var firstInput=session.firstInput,firstMultiple=session.firstMultiple,offsetCenter=firstMultiple?firstMultiple.center:firstInput.center,center=input.center=getCenter(pointers);input.timeStamp=now(),input.deltaTime=input.timeStamp-firstInput.timeStamp,input.angle=getAngle(offsetCenter,center),input.distance=getDistance(offsetCenter,center),computeDeltaXY(session,input),input.offsetDirection=getDirection(input.deltaX,input.deltaY);var overallVelocity=getVelocity(input.deltaTime,input.deltaX,input.deltaY);input.overallVelocityX=overallVelocity.x,input.overallVelocityY=overallVelocity.y,input.overallVelocity=abs(overallVelocity.x)>abs(overallVelocity.y)?overallVelocity.x:overallVelocity.y,input.scale=firstMultiple?getScale(firstMultiple.pointers,pointers):1,input.rotation=firstMultiple?getRotation(firstMultiple.pointers,pointers):0,input.maxPointers=session.prevInput?input.pointers.length>session.prevInput.maxPointers?input.pointers.length:session.prevInput.maxPointers:input.pointers.length,computeIntervalInputData(session,input);var target=manager.element;hasParent(input.srcEvent.target,target)&&(target=input.srcEvent.target),input.target=target}function computeDeltaXY(session,input){var center=input.center,offset=session.offsetDelta||{},prevDelta=session.prevDelta||{},prevInput=session.prevInput||{};input.eventType!==INPUT_START&&prevInput.eventType!==INPUT_END||(prevDelta=session.prevDelta={x:prevInput.deltaX||0,y:prevInput.deltaY||0},offset=session.offsetDelta={x:center.x,y:center.y}),input.deltaX=prevDelta.x+(center.x-offset.x),input.deltaY=prevDelta.y+(center.y-offset.y)}function computeIntervalInputData(session,input){var velocity,velocityX,velocityY,direction,last=session.lastInterval||input,deltaTime=input.timeStamp-last.timeStamp;if(input.eventType!=INPUT_CANCEL&&(deltaTime>COMPUTE_INTERVAL||last.velocity===undefined)){var deltaX=input.deltaX-last.deltaX,deltaY=input.deltaY-last.deltaY,v=getVelocity(deltaTime,deltaX,deltaY);velocityX=v.x,velocityY=v.y,velocity=abs(v.x)>abs(v.y)?v.x:v.y,direction=getDirection(deltaX,deltaY),session.lastInterval=input}else velocity=last.velocity,velocityX=last.velocityX,velocityY=last.velocityY,direction=last.direction;input.velocity=velocity,input.velocityX=velocityX,input.velocityY=velocityY,input.direction=direction}function simpleCloneInputData(input){for(var pointers=[],i=0;i=abs(y)?x<0?DIRECTION_LEFT:DIRECTION_RIGHT:y<0?DIRECTION_UP:DIRECTION_DOWN}function getDistance(p1,p2,props){props||(props=PROPS_XY);var x=p2[props[0]]-p1[props[0]],y=p2[props[1]]-p1[props[1]];return Math.sqrt(x*x+y*y)}function getAngle(p1,p2,props){props||(props=PROPS_XY);var x=p2[props[0]]-p1[props[0]],y=p2[props[1]]-p1[props[1]];return 180*Math.atan2(y,x)/Math.PI}function getRotation(start,end){return getAngle(end[1],end[0],PROPS_CLIENT_XY)+getAngle(start[1],start[0],PROPS_CLIENT_XY)}function getScale(start,end){return getDistance(end[0],end[1],PROPS_CLIENT_XY)/getDistance(start[0],start[1],PROPS_CLIENT_XY)}function MouseInput(){this.evEl=MOUSE_ELEMENT_EVENTS,this.evWin=MOUSE_WINDOW_EVENTS,this.pressed=!1,Input.apply(this,arguments)}function PointerEventInput(){this.evEl=POINTER_ELEMENT_EVENTS,this.evWin=POINTER_WINDOW_EVENTS,Input.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function SingleTouchInput(){this.evTarget=SINGLE_TOUCH_TARGET_EVENTS,this.evWin=SINGLE_TOUCH_WINDOW_EVENTS,this.started=!1,Input.apply(this,arguments)}function normalizeSingleTouches(ev,type){var all=toArray(ev.touches),changed=toArray(ev.changedTouches);return type&(INPUT_END|INPUT_CANCEL)&&(all=uniqueArray(all.concat(changed),"identifier",!0)),[all,changed]}function TouchInput(){this.evTarget=TOUCH_TARGET_EVENTS,this.targetIds={},Input.apply(this,arguments)}function getTouches(ev,type){var allTouches=toArray(ev.touches),targetIds=this.targetIds;if(type&(INPUT_START|INPUT_MOVE)&&1===allTouches.length)return targetIds[allTouches[0].identifier]=!0,[allTouches,allTouches];var i,targetTouches,changedTouches=toArray(ev.changedTouches),changedTargetTouches=[],target=this.target;if(targetTouches=allTouches.filter(function(touch){return hasParent(touch.target,target)}),type===INPUT_START)for(i=0;i-1&<s.splice(i,1)};setTimeout(removeLastTouch,DEDUP_TIMEOUT)}}function isSyntheticEvent(eventData){for(var x=eventData.srcEvent.clientX,y=eventData.srcEvent.clientY,i=0;i-1&&this.requireFail.splice(index,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(otherRecognizer){return!!this.simultaneous[otherRecognizer.id]},emit:function(input){function emit(event){self.manager.emit(event,input)}var self=this,state=this.state;state=STATE_ENDED&&emit(self.options.event+stateStr(state))},tryEmit:function(input){if(this.canEmit())return this.emit(input);this.state=32},canEmit:function(){for(var i=0;ioptions.threshold&&direction&options.direction},attrTest:function(input){return AttrRecognizer.prototype.attrTest.call(this,input)&&(this.state&STATE_BEGAN||!(this.state&STATE_BEGAN)&&this.directionTest(input))},emit:function(input){this.pX=input.deltaX,this.pY=input.deltaY;var direction=directionStr(input.direction);direction&&(input.additionalEvent=this.options.event+direction),this._super.emit.call(this,input)}}),inherit(PinchRecognizer,AttrRecognizer,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[TOUCH_ACTION_NONE]},attrTest:function(input){return this._super.attrTest.call(this,input)&&(Math.abs(input.scale-1)>this.options.threshold||this.state&STATE_BEGAN)},emit:function(input){if(1!==input.scale){var inOut=input.scale<1?"in":"out";input.additionalEvent=this.options.event+inOut}this._super.emit.call(this,input)}}),inherit(PressRecognizer,Recognizer,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[TOUCH_ACTION_AUTO]},process:function(input){var options=this.options,validPointers=input.pointers.length===options.pointers,validMovement=input.distanceoptions.time;if(this._input=input,!validMovement||!validPointers||input.eventType&(INPUT_END|INPUT_CANCEL)&&!validTime)this.reset();else if(input.eventType&INPUT_START)this.reset(),this._timer=setTimeoutContext(function(){this.state=STATE_RECOGNIZED,this.tryEmit()},options.time,this);else if(input.eventType&INPUT_END)return STATE_RECOGNIZED;return 32},reset:function(){clearTimeout(this._timer)},emit:function(input){this.state===STATE_RECOGNIZED&&(input&&input.eventType&INPUT_END?this.manager.emit(this.options.event+"up",input):(this._input.timeStamp=now(),this.manager.emit(this.options.event,this._input)))}}),inherit(RotateRecognizer,AttrRecognizer,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[TOUCH_ACTION_NONE]},attrTest:function(input){return this._super.attrTest.call(this,input)&&(Math.abs(input.rotation)>this.options.threshold||this.state&STATE_BEGAN)}}),inherit(SwipeRecognizer,AttrRecognizer,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:DIRECTION_HORIZONTAL|DIRECTION_VERTICAL,pointers:1},getTouchAction:function(){return PanRecognizer.prototype.getTouchAction.call(this)},attrTest:function(input){var velocity,direction=this.options.direction;return direction&(DIRECTION_HORIZONTAL|DIRECTION_VERTICAL)?velocity=input.overallVelocity:direction&DIRECTION_HORIZONTAL?velocity=input.overallVelocityX:direction&DIRECTION_VERTICAL&&(velocity=input.overallVelocityY),this._super.attrTest.call(this,input)&&direction&input.offsetDirection&&input.distance>this.options.threshold&&input.maxPointers==this.options.pointers&&abs(velocity)>this.options.velocity&&input.eventType&INPUT_END},emit:function(input){var direction=directionStr(input.offsetDirection);direction&&this.manager.emit(this.options.event+direction,input),this.manager.emit(this.options.event,input)}}),inherit(TapRecognizer,Recognizer,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[TOUCH_ACTION_MANIPULATION]},process:function(input){var options=this.options,validPointers=input.pointers.length===options.pointers,validMovement=input.distance=Math.pow(2,bits)?hat(bits,base):res};hat.rack=function(bits,base,expandBy){var fn=function(data){var iters=0;do{if(iters++>10){if(!expandBy)throw new Error("too many ID collisions, use more bits");bits+=expandBy}var id=hat(bits,base)}while(Object.hasOwnProperty.call(hats,id));return hats[id]=data,id},hats=fn.hats={};return fn.get=function(id){return fn.hats[id]},fn.set=function(id,value){return fn.hats[id]=value,fn},fn.bits=bits||128,fn.base=base||16,fn}},{}],350:[function(require,module,exports){"use strict";function Ids(seed){if(!(this instanceof Ids))return new Ids(seed);seed=seed||[128,36,1],this._seed=seed.length?hat.rack(seed[0],seed[1],seed[2]):seed}var hat=require("hat");module.exports=Ids,Ids.prototype.next=function(element){return this._seed(element||!0)},Ids.prototype.nextPrefixed=function(prefix,element){var id;do{id=prefix+this.next(!0)}while(this.assigned(id));return this.claim(id,element),id},Ids.prototype.claim=function(id,element){this._seed.set(id,element||!0)},Ids.prototype.assigned=function(id){return this._seed.get(id)||!1},Ids.prototype.unclaim=function(id){delete this._seed.hats[id]},Ids.prototype.clear=function(){var id,hats=this._seed.hats;for(id in hats)this.unclaim(id)}},{hat:349}],351:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],352:[function(require,module,exports){var createFindIndex=require("../internal/createFindIndex"),findIndex=createFindIndex();module.exports=findIndex},{"../internal/createFindIndex":448}],353:[function(require,module,exports){function flatten(array,isDeep,guard){var length=array?array.length:0;return guard&&isIterateeCall(array,isDeep,guard)&&(isDeep=!1),length?baseFlatten(array,isDeep):[]}var baseFlatten=require("../internal/baseFlatten"),isIterateeCall=require("../internal/isIterateeCall");module.exports=flatten},{"../internal/baseFlatten":407,"../internal/isIterateeCall":468}],354:[function(require,module,exports){function flattenDeep(array){return(array?array.length:0)?baseFlatten(array,!0):[]}var baseFlatten=require("../internal/baseFlatten");module.exports=flattenDeep},{"../internal/baseFlatten":407}],355:[function(require,module,exports){function last(array){var length=array?array.length:0;return length?array[length-1]:void 0}module.exports=last},{}],356:[function(require,module,exports){var baseFlatten=require("../internal/baseFlatten"),baseUniq=require("../internal/baseUniq"),restParam=require("../function/restParam"),union=restParam(function(arrays){return baseUniq(baseFlatten(arrays,!1,!0))});module.exports=union},{"../function/restParam":380,"../internal/baseFlatten":407,"../internal/baseUniq":430}],357:[function(require,module,exports){function uniq(array,isSorted,iteratee,thisArg){return(array?array.length:0)?(null!=isSorted&&"boolean"!=typeof isSorted&&(thisArg=iteratee,iteratee=isIterateeCall(array,isSorted,thisArg)?void 0:isSorted,isSorted=!1),iteratee=null==iteratee?iteratee:baseCallback(iteratee,thisArg,3),isSorted?sortedUniq(array,iteratee):baseUniq(array,iteratee)):[]}var baseCallback=require("../internal/baseCallback"),baseUniq=require("../internal/baseUniq"),isIterateeCall=require("../internal/isIterateeCall"),sortedUniq=require("../internal/sortedUniq");module.exports=uniq},{"../internal/baseCallback":395,"../internal/baseUniq":430,"../internal/isIterateeCall":468,"../internal/sortedUniq":483}],358:[function(require,module,exports){module.exports=require("./uniq")},{"./uniq":357}],359:[function(require,module,exports){var baseDifference=require("../internal/baseDifference"),isArrayLike=require("../internal/isArrayLike"),restParam=require("../function/restParam"),without=restParam(function(array,values){return isArrayLike(array)?baseDifference(array,values):[]});module.exports=without},{"../function/restParam":380,"../internal/baseDifference":401,"../internal/isArrayLike":466}],360:[function(require,module,exports){function xor(){for(var index=-1,length=arguments.length;++index-1:!!length&&baseIndexOf(collection,target,fromIndex)>-1}var baseIndexOf=require("../internal/baseIndexOf"),getLength=require("../internal/getLength"),isArray=require("../lang/isArray"),isIterateeCall=require("../internal/isIterateeCall"),isLength=require("../internal/isLength"),isString=require("../lang/isString"),values=require("../object/values"),nativeMax=Math.max;module.exports=includes},{"../internal/baseIndexOf":412,"../internal/getLength":459,"../internal/isIterateeCall":468,"../internal/isLength":471,"../lang/isArray":489,"../lang/isString":496,"../object/values":510}],369:[function(require,module,exports){var createAggregator=require("../internal/createAggregator"),indexBy=createAggregator(function(result,value,key){result[key]=value});module.exports=indexBy},{"../internal/createAggregator":439}],370:[function(require,module,exports){function map(collection,iteratee,thisArg){var func=isArray(collection)?arrayMap:baseMap;return iteratee=baseCallback(iteratee,thisArg,3),func(collection,iteratee)}var arrayMap=require("../internal/arrayMap"),baseCallback=require("../internal/baseCallback"),baseMap=require("../internal/baseMap"),isArray=require("../lang/isArray");module.exports=map},{"../internal/arrayMap":388,"../internal/baseCallback":395,"../internal/baseMap":417,"../lang/isArray":489}],371:[function(require,module,exports){var arrayReduce=require("../internal/arrayReduce"),baseEach=require("../internal/baseEach"),createReduce=require("../internal/createReduce"),reduce=createReduce(arrayReduce,baseEach);module.exports=reduce},{"../internal/arrayReduce":390,"../internal/baseEach":402,"../internal/createReduce":452}],372:[function(require,module,exports){function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;return predicate=baseCallback(predicate,thisArg,3),func(collection,function(value,index,collection){return!predicate(value,index,collection)})}var arrayFilter=require("../internal/arrayFilter"),baseCallback=require("../internal/baseCallback"),baseFilter=require("../internal/baseFilter"),isArray=require("../lang/isArray");module.exports=reject},{"../internal/arrayFilter":387,"../internal/baseCallback":395,"../internal/baseFilter":404,"../lang/isArray":489}],373:[function(require,module,exports){function size(collection){var length=collection?getLength(collection):0;return isLength(length)?length:keys(collection).length}var getLength=require("../internal/getLength"),isLength=require("../internal/isLength"),keys=require("../object/keys");module.exports=size},{"../internal/getLength":459,"../internal/isLength":471,"../object/keys":503}],374:[function(require,module,exports){function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;return thisArg&&isIterateeCall(collection,predicate,thisArg)&&(predicate=void 0),"function"==typeof predicate&&void 0===thisArg||(predicate=baseCallback(predicate,thisArg,3)),func(collection,predicate)}var arraySome=require("../internal/arraySome"),baseCallback=require("../internal/baseCallback"),baseSome=require("../internal/baseSome"),isArray=require("../lang/isArray"),isIterateeCall=require("../internal/isIterateeCall");module.exports=some},{"../internal/arraySome":391,"../internal/baseCallback":395,"../internal/baseSome":427,"../internal/isIterateeCall":468,"../lang/isArray":489}],375:[function(require,module,exports){function sortBy(collection,iteratee,thisArg){if(null==collection)return[];thisArg&&isIterateeCall(collection,iteratee,thisArg)&&(iteratee=void 0);var index=-1;iteratee=baseCallback(iteratee,thisArg,3);var result=baseMap(collection,function(value,key,collection){return{criteria:iteratee(value,key,collection),index:++index,value:value}});return baseSortBy(result,compareAscending)}var baseCallback=require("../internal/baseCallback"),baseMap=require("../internal/baseMap"),baseSortBy=require("../internal/baseSortBy"),compareAscending=require("../internal/compareAscending"),isIterateeCall=require("../internal/isIterateeCall");module.exports=sortBy},{"../internal/baseCallback":395,"../internal/baseMap":417,"../internal/baseSortBy":428,"../internal/compareAscending":436,"../internal/isIterateeCall":468}],376:[function(require,module,exports){var getNative=require("../internal/getNative"),nativeNow=getNative(Date,"now"),now=nativeNow||function(){return(new Date).getTime()};module.exports=now},{"../internal/getNative":461}],377:[function(require,module,exports){var createWrapper=require("../internal/createWrapper"),replaceHolders=require("../internal/replaceHolders"),restParam=require("./restParam"),bind=restParam(function(func,thisArg,partials){var bitmask=1;if(partials.length){var holders=replaceHolders(partials,bind.placeholder);bitmask|=32}return createWrapper(func,bitmask,thisArg,partials,holders)});bind.placeholder={},module.exports=bind},{"../internal/createWrapper":453,"../internal/replaceHolders":480,"./restParam":380}],378:[function(require,module,exports){function debounce(func,wait,options){function cancel(){timeoutId&&clearTimeout(timeoutId),maxTimeoutId&&clearTimeout(maxTimeoutId),lastCalled=0,maxTimeoutId=timeoutId=trailingCall=void 0}function complete(isCalled,id){id&&clearTimeout(id),maxTimeoutId=timeoutId=trailingCall=void 0,isCalled&&(lastCalled=now(),result=func.apply(thisArg,args),timeoutId||maxTimeoutId||(args=thisArg=void 0))}function delayed(){var remaining=wait-(now()-stamp);remaining<=0||remaining>wait?complete(trailingCall,maxTimeoutId):timeoutId=setTimeout(delayed,remaining)}function maxDelayed(){complete(trailing,timeoutId)}function debounced(){if(args=arguments,stamp=now(),thisArg=this,trailingCall=trailing&&(timeoutId||!leading),!1===maxWait)var leadingCall=leading&&!timeoutId;else{maxTimeoutId||leading||(lastCalled=stamp);var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0||remaining>maxWait;isCalled?(maxTimeoutId&&(maxTimeoutId=clearTimeout(maxTimeoutId)),lastCalled=stamp,result=func.apply(thisArg,args)):maxTimeoutId||(maxTimeoutId=setTimeout(maxDelayed,remaining))}return isCalled&&timeoutId?timeoutId=clearTimeout(timeoutId):timeoutId||wait===maxWait||(timeoutId=setTimeout(delayed,wait)),leadingCall&&(isCalled=!0,result=func.apply(thisArg,args)),!isCalled||timeoutId||maxTimeoutId||(args=thisArg=void 0),result}var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=!1,trailing=!0;if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);if(wait=wait<0?0:+wait||0,!0===options){var leading=!0;trailing=!1}else isObject(options)&&(leading=!!options.leading,maxWait="maxWait"in options&&nativeMax(+options.maxWait||0,wait),trailing="trailing"in options?!!options.trailing:trailing);return debounced.cancel=cancel,debounced}var isObject=require("../lang/isObject"),now=require("../date/now"),FUNC_ERROR_TEXT="Expected a function",nativeMax=Math.max;module.exports=debounce},{"../date/now":376,"../lang/isObject":494}],379:[function(require,module,exports){var baseDelay=require("../internal/baseDelay"),restParam=require("./restParam"),defer=restParam(function(func,args){return baseDelay(func,1,args)});module.exports=defer},{"../internal/baseDelay":400,"./restParam":380}],380:[function(require,module,exports){function restParam(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(void 0===start?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);++indexother&&!othIsNull||!valIsReflexive||valIsNull&&!othIsUndef&&othIsReflexive||valIsUndef&&othIsReflexive)return 1;if(value=LARGE_ARRAY_SIZE?createCache(values):null,valuesLength=values.length;cache&&(indexOf=cacheIndexOf,isCommon=!1,values=cache);outer:for(;++indexlength?0:length+start),end=void 0===end||end>length?length:+end||0,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index=LARGE_ARRAY_SIZE,seen=isLarge?createCache():null,result=[];seen?(indexOf=cacheIndexOf,isCommon=!1):(isLarge=!1,seen=iteratee?[]:result);outer:for(;++index2?sources[length-2]:void 0,guard=length>2?sources[2]:void 0,thisArg=length>1?sources[length-1]:void 0;for("function"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer="function"==typeof thisArg?thisArg:void 0,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?void 0:customizer,length=1);++index-1?collection[index]:void 0}return baseFind(collection,predicate,eachFunc)}}var baseCallback=require("./baseCallback"),baseFind=require("./baseFind"),baseFindIndex=require("./baseFindIndex"),isArray=require("../lang/isArray");module.exports=createFind},{"../lang/isArray":489,"./baseCallback":395,"./baseFind":405,"./baseFindIndex":406}],448:[function(require,module,exports){function createFindIndex(fromRight){return function(array,predicate,thisArg){return array&&array.length?(predicate=baseCallback(predicate,thisArg,3),baseFindIndex(array,predicate,fromRight)):-1}}var baseCallback=require("./baseCallback"),baseFindIndex=require("./baseFindIndex");module.exports=createFindIndex},{"./baseCallback":395,"./baseFindIndex":406}],449:[function(require,module,exports){function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return"function"==typeof iteratee&&void 0===thisArg&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}var bindCallback=require("./bindCallback"),isArray=require("../lang/isArray");module.exports=createForEach},{"../lang/isArray":489,"./bindCallback":432}],450:[function(require,module,exports){(function(global){function createHybridWrapper(func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity){function wrapper(){for(var length=arguments.length,index=length,args=Array(length);index--;)args[index]=arguments[index];if(partials&&(args=composeArgs(args,partials,holders)),partialsRight&&(args=composeArgsRight(args,partialsRight,holdersRight)),isCurry||isCurryRight){var placeholder=wrapper.placeholder,argsHolders=replaceHolders(args,placeholder);if((length-=argsHolders.length)arrLength))return!1;for(;++index-1&&value%1==0&&value-1&&value%1==0&&value<=MAX_SAFE_INTEGER}var MAX_SAFE_INTEGER=9007199254740991;module.exports=isLength},{}],472:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}module.exports=isObjectLike},{}],473:[function(require,module,exports){function isStrictComparable(value){return value===value&&!isObject(value)}var isObject=require("../lang/isObject");module.exports=isStrictComparable},{"../lang/isObject":494}],474:[function(require,module,exports){function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask,isCommon=newBitmask0){if(++count>=150)return key}else count=0;return baseSetData(key,value)}}();module.exports=setData},{"../date/now":376,"./baseSetData":425}],482:[function(require,module,exports){function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,allowIndexes=!!length&&isLength(length)&&(isArray(object)||isArguments(object)),index=-1,result=[];++index0;++index");elementsById[id]=element}},this.addWarning=function(warning){this.warnings.push(warning)}}function BaseHandler(){}function NoopHandler(){}function BodyHandler(){}function ReferenceHandler(property,context){this.property=property,this.context=context}function ValueHandler(propertyDesc,element){this.element=element,this.propertyDesc=propertyDesc}function BaseElementHandler(){}function ElementHandler(model,type,context){this.model=model,this.type=model.getType(type),this.context=context}function GenericElementHandler(model,type,context){this.model=model,this.context=context}function XMLReader(options){options instanceof Moddle&&(options={model:options}),assign(this,{lax:!1},options)}var reduce=require("lodash/collection/reduce"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),assign=require("lodash/object/assign"),defer=require("lodash/function/defer"),Stack=require("tiny-stack"),SaxParser=require("sax").parser,Moddle=require("moddle"),parseNameNs=require("moddle/lib/ns").parseName,Types=require("moddle/lib/types"),coerceType=Types.coerceType,isSimpleType=Types.isSimple,common=require("./common"),XSI_TYPE=common.XSI_TYPE,XSI_URI=common.DEFAULT_NS_MAP.xsi,serializeAsType=common.serializeAsType,aliasToName=common.aliasToName;BaseHandler.prototype.handleEnd=function(){},BaseHandler.prototype.handleText=function(){},BaseHandler.prototype.handleNode=function(){},NoopHandler.prototype=new BaseHandler,NoopHandler.prototype.handleNode=function(){return this},BodyHandler.prototype=new BaseHandler,BodyHandler.prototype.handleText=function(text){this.body=(this.body||"")+text},ReferenceHandler.prototype=new BodyHandler,ReferenceHandler.prototype.handleNode=function(node){if(this.element)throw error("expected no sub nodes");return this.element=this.createReference(node),this},ReferenceHandler.prototype.handleEnd=function(){this.element.id=this.body},ReferenceHandler.prototype.createReference=function(node){return{property:this.property.ns.name,id:""}},ValueHandler.prototype=new BodyHandler,ValueHandler.prototype.handleEnd=function(){var value=this.body,element=this.element,propertyDesc=this.propertyDesc;value=coerceType(propertyDesc.type,value),propertyDesc.isMany?element.get(propertyDesc.name).push(value):element.set(propertyDesc.name,value)},BaseElementHandler.prototype=Object.create(BodyHandler.prototype),BaseElementHandler.prototype.handleNode=function(node){var parser=this,element=this.element;return element?parser=this.handleChild(node):(element=this.element=this.createElement(node),this.context.addElement(element)),parser},ElementHandler.prototype=new BaseElementHandler,ElementHandler.prototype.addReference=function(reference){this.context.addReference(reference)},ElementHandler.prototype.handleEnd=function(){var value=this.body,element=this.element,descriptor=getModdleDescriptor(element),bodyProperty=descriptor.bodyProperty;bodyProperty&&void 0!==value&&(value=coerceType(bodyProperty.type,value),element.set(bodyProperty.name,value))},ElementHandler.prototype.createElement=function(node){var attributes=parseNodeAttributes(node),Type=this.type,descriptor=getModdleDescriptor(Type),context=this.context,instance=new Type({});return forEach(attributes,function(value,name){var values,prop=descriptor.propertiesByName[name];prop&&prop.isReference?prop.isMany?(values=value.split(" "),forEach(values,function(v){context.addReference({element:instance,property:prop.ns.name,id:v})})):context.addReference({element:instance,property:prop.ns.name,id:value}):(prop&&(value=coerceType(prop.type,value)),instance.set(name,value))}),instance},ElementHandler.prototype.getPropertyForNode=function(node){var elementTypeName,elementType,typeAnnotation,nameNs=parseNameNs(node.local,node.prefix),type=this.type,model=this.model,descriptor=getModdleDescriptor(type),propertyName=nameNs.name,property=descriptor.propertiesByName[propertyName];if(property)return serializeAsType(property)&&(typeAnnotation=node.attributes[XSI_TYPE])?(elementTypeName=typeAnnotation.value,elementType=model.getType(elementTypeName),assign({},property,{effectiveType:getModdleDescriptor(elementType).name})):property;if(model.getPackage(nameNs.prefix)){if(elementTypeName=nameNs.prefix+":"+aliasToName(nameNs.localName,descriptor.$pkg),elementType=model.getType(elementTypeName),property=find(descriptor.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&elementType.hasType(p.type)}))return assign({},property,{effectiveType:getModdleDescriptor(elementType).name})}else if(property=find(descriptor.properties,function(p){return!p.isReference&&!p.isAttribute&&"Element"===p.type}))return property;throw error("unrecognized element <"+nameNs.name+">")},ElementHandler.prototype.toString=function(){return"ElementDescriptor["+getModdleDescriptor(this.type).name+"]"},ElementHandler.prototype.valueHandler=function(propertyDesc,element){return new ValueHandler(propertyDesc,element)},ElementHandler.prototype.referenceHandler=function(propertyDesc){return new ReferenceHandler(propertyDesc,this.context)},ElementHandler.prototype.handler=function(type){return"Element"===type?new GenericElementHandler(this.model,type,this.context):new ElementHandler(this.model,type,this.context)},ElementHandler.prototype.handleChild=function(node){var propertyDesc,type,element,childHandler;if(propertyDesc=this.getPropertyForNode(node),element=this.element,type=propertyDesc.effectiveType||propertyDesc.type,isSimpleType(type))return this.valueHandler(propertyDesc,element);childHandler=propertyDesc.isReference?this.referenceHandler(propertyDesc).handleNode(node):this.handler(type).handleNode(node);var newElement=childHandler.element;return void 0!==newElement&&(propertyDesc.isMany?element.get(propertyDesc.name).push(newElement):element.set(propertyDesc.name,newElement),propertyDesc.isReference?(assign(newElement,{element:element}),this.context.addReference(newElement)):newElement.$parent=element),childHandler},GenericElementHandler.prototype=Object.create(BaseElementHandler.prototype),GenericElementHandler.prototype.createElement=function(node){var name=node.name,prefix=node.prefix,uri=node.ns[prefix],attributes=node.attributes;return this.model.createAny(name,uri,attributes)},GenericElementHandler.prototype.handleChild=function(node){ +var children,handler=new GenericElementHandler(this.model,"Element",this.context).handleNode(node),element=this.element,newElement=handler.element;return void 0!==newElement&&(children=element.$children=element.$children||[],children.push(newElement),newElement.$parent=element),handler},GenericElementHandler.prototype.handleText=function(text){this.body=this.body||""+text},GenericElementHandler.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},XMLReader.prototype.fromXML=function(xml,options,done){function resolveReferences(){var i,r,elementsById=context.elementsById,references=context.references;for(i=0;r=references[i];i++){var element=r.element,reference=elementsById[r.id],property=getModdleDescriptor(element).propertiesByName[r.property];if(reference||context.addWarning({message:"unresolved reference <"+r.id+">",element:r.element,property:r.property,value:r.id}),property.isMany){var collection=element.get(property.name),idx=collection.indexOf(r);-1===idx&&(idx=collection.length),reference?collection[idx]=reference:collection.splice(idx,1)}else element.set(property.name,reference)}}function handleClose(tagName){stack.pop().handleEnd()}function handleOpen(node){var handler=stack.peek();normalizeNamespaces(node,model);try{stack.push(handler.handleNode(node))}catch(e){var line=this.line,column=this.column,message="unparsable content <"+node.name+"> detected\n\tline: "+line+"\n\tcolumn: "+column+"\n\tnested error: "+e.message;if(!lax)throw console.error("could not parse document"),console.error(e),error(message);context.addWarning({message:message,error:e}),console.warn("could not parse node"),console.warn(e),stack.push(new NoopHandler)}}function handleText(text){stack.peek().handleText(text)}var rootHandler=options.rootHandler;options instanceof ElementHandler?(rootHandler=options,options={}):"string"==typeof options?(rootHandler=this.handler(options),options={}):"string"==typeof rootHandler&&(rootHandler=this.handler(rootHandler));var model=this.model,lax=this.lax,context=new Context(assign({},options,{rootHandler:rootHandler})),parser=new SaxParser(!0,{xmlns:!0,trim:!0}),stack=new Stack;rootHandler.context=context,stack.push(rootHandler),parser.onopentag=handleOpen,parser.oncdata=parser.ontext=handleText,parser.onclosetag=handleClose,parser.onend=resolveReferences,defer(function(){var error;try{parser.write(xml).close()}catch(e){error=e}done(error,error?void 0:rootHandler.element,context)})},XMLReader.prototype.handler=function(name){return new ElementHandler(this.model,name)},module.exports=XMLReader,module.exports.ElementHandler=ElementHandler},{"./common":524,"lodash/collection/find":365,"lodash/collection/forEach":366,"lodash/collection/reduce":371,"lodash/function/defer":379,"lodash/object/assign":499,moddle:527,"moddle/lib/ns":532,"moddle/lib/types":535,sax:539,"tiny-stack":542}],526:[function(require,module,exports){"use strict";function nsName(ns){return isString(ns)?ns:(ns.prefix?ns.prefix+":":"")+ns.localName}function getNsAttrs(namespaces){function isUsed(ns){return namespaces.used[ns.uri]}function toAttr(ns){return{name:"xmlns"+(ns.prefix?":"+ns.prefix:""),value:ns.uri}}var allNs=[].concat(namespaces.wellknown,namespaces.custom);return map(filter(allNs,isUsed),toAttr)}function getElementNs(ns,descriptor){return descriptor.isGeneric?descriptor.name:assign({localName:nameToAlias(descriptor.ns.localName,descriptor.$pkg)},ns)}function getPropertyNs(ns,descriptor){return assign({localName:descriptor.ns.localName},ns)}function getSerializableProperties(element){var descriptor=element.$descriptor;return filter(descriptor.properties,function(p){var name=p.name;if(p.isVirtual)return!1;if(!element.hasOwnProperty(name))return!1;var value=element[name];return value!==p.default&&(null!==value&&(!p.isMany||value.length))})}function escapeAttr(str){return str=isString(str)?str:""+str,str.replace(ESCAPE_CHARS,function(str){return"&#"+ESCAPE_MAP[str]+";"})}function filterAttributes(props){return filter(props,function(p){return p.isAttr})}function filterContained(props){return filter(props,function(p){return!p.isAttr})}function ReferenceSerializer(parent,ns){this.ns=ns}function BodySerializer(){}function ValueSerializer(ns){this.ns=ns}function ElementSerializer(parent,ns){this.body=[],this.attrs=[],this.parent=parent,this.ns=ns}function TypeSerializer(parent,ns){ElementSerializer.call(this,parent,ns)}function SavingWriter(){this.value="",this.write=function(str){this.value+=str}}function FormatingWriter(out,format){var indent=[""];this.append=function(str){return out.write(str),this},this.appendNewLine=function(){return format&&out.write("\n"),this},this.appendIndent=function(){return format&&out.write(indent.join(" ")),this},this.indent=function(){return indent.push(""),this},this.unindent=function(){return indent.pop(),this}}function XMLWriter(options){function toXML(tree,writer){var internalWriter=writer||new SavingWriter,formatingWriter=new FormatingWriter(internalWriter,options.format);if(options.preamble&&formatingWriter.append(XML_PREAMBLE),(new ElementSerializer).build(tree).serializeTo(formatingWriter),!writer)return internalWriter.value}return options=assign({format:!1,preamble:!0},options||{}),{toXML:toXML}}var map=require("lodash/collection/map"),forEach=require("lodash/collection/forEach"),isString=require("lodash/lang/isString"),filter=require("lodash/collection/filter"),assign=require("lodash/object/assign"),Types=require("moddle/lib/types"),parseNameNs=require("moddle/lib/ns").parseName,common=require("./common"),nameToAlias=common.nameToAlias,serializeAsType=common.serializeAsType,serializeAsProperty=common.serializeAsProperty,XML_PREAMBLE='\n',ESCAPE_CHARS=/(<|>|'|"|&|\n\r|\n)/g,DEFAULT_NS_MAP=common.DEFAULT_NS_MAP,XSI_TYPE=common.XSI_TYPE,ESCAPE_MAP={"\n":"10","\n\r":"10",'"':"34","'":"39","<":"60",">":"62","&":"38"};ReferenceSerializer.prototype.build=function(element){return this.element=element,this},ReferenceSerializer.prototype.serializeTo=function(writer){writer.appendIndent().append("<"+nsName(this.ns)+">"+this.element.id+"").appendNewLine()},BodySerializer.prototype.serializeValue=BodySerializer.prototype.serializeTo=function(writer){var escape=this.escape;escape&&writer.append("")},BodySerializer.prototype.build=function(prop,value){return this.value=value,"String"===prop.type&&-1!==value.search(ESCAPE_CHARS)&&(this.escape=!0),this},ValueSerializer.prototype=new BodySerializer,ValueSerializer.prototype.serializeTo=function(writer){writer.appendIndent().append("<"+nsName(this.ns)+">"),this.serializeValue(writer),writer.append("").appendNewLine()},ElementSerializer.prototype.build=function(element){this.element=element;var otherAttrs=this.parseNsAttributes(element);if(this.ns||(this.ns=this.nsTagName(element.$descriptor)),element.$descriptor.isGeneric)this.parseGeneric(element);else{var properties=getSerializableProperties(element);this.parseAttributes(filterAttributes(properties)),this.parseContainments(filterContained(properties)),this.parseGenericAttributes(element,otherAttrs)}return this},ElementSerializer.prototype.nsTagName=function(descriptor){return getElementNs(this.logNamespaceUsed(descriptor.ns),descriptor)},ElementSerializer.prototype.nsPropertyTagName=function(descriptor){return getPropertyNs(this.logNamespaceUsed(descriptor.ns),descriptor)},ElementSerializer.prototype.isLocalNs=function(ns){return ns.uri===this.ns.uri},ElementSerializer.prototype.nsAttributeName=function(element){var ns;if(ns=isString(element)?parseNameNs(element):element.ns,element.inherited)return{localName:ns.localName};var effectiveNs=this.logNamespaceUsed(ns);return this.isLocalNs(effectiveNs)?{localName:ns.localName}:assign({localName:ns.localName},effectiveNs)},ElementSerializer.prototype.parseGeneric=function(element){var self=this,body=this.body,attrs=this.attrs;forEach(element,function(val,key){"$body"===key?body.push((new BodySerializer).build({type:"String"},val)):"$children"===key?forEach(val,function(child){body.push(new ElementSerializer(self).build(child))}):0!==key.indexOf("$")&&attrs.push({name:key,value:escapeAttr(val)})})},ElementSerializer.prototype.parseNsAttributes=function(element){var self=this,genericAttrs=element.$attrs,model=element.$model,attributes=[];return forEach(genericAttrs,function(value,name){var ns,nameNs=parseNameNs(name);"xmlns"===nameNs.prefix&&(ns={prefix:nameNs.localName,uri:value}),nameNs.prefix||"xmlns"!==nameNs.localName||(ns={uri:value}),ns?model.getPackage(value)?self.logNamespace(ns,!0):self.logNamespaceUsed(ns):attributes.push({name:name,value:value})}),attributes},ElementSerializer.prototype.parseGenericAttributes=function(element,attributes){var self=this;forEach(attributes,function(attr){if(attr.name!==XSI_TYPE)try{self.addAttribute(self.nsAttributeName(attr.name),attr.value)}catch(e){console.warn("missing namespace information for ",attr.name,"=",attr.value,"on",element,e)}})},ElementSerializer.prototype.parseContainments=function(properties){var self=this,body=this.body,element=this.element;forEach(properties,function(p){var value=element.get(p.name),isReference=p.isReference,isMany=p.isMany,ns=self.nsPropertyTagName(p);if(isMany||(value=[value]),p.isBody)body.push((new BodySerializer).build(p,value[0]));else if(Types.isSimple(p.type))forEach(value,function(v){body.push(new ValueSerializer(ns).build(p,v))});else if(isReference)forEach(value,function(v){body.push(new ReferenceSerializer(self,ns).build(v))});else{var asType=serializeAsType(p),asProperty=serializeAsProperty(p);forEach(value,function(v){var serializer;serializer=asType?new TypeSerializer(self,ns):asProperty?new ElementSerializer(self,ns):new ElementSerializer(self),body.push(serializer.build(v))})}})},ElementSerializer.prototype.getNamespaces=function(){var namespaces=this.namespaces,parent=this.parent;return namespaces||(namespaces=this.namespaces=parent?parent.getNamespaces():{prefixMap:{},uriMap:{},used:{},wellknown:[],custom:[]}),namespaces},ElementSerializer.prototype.logNamespace=function(ns,wellknown){var namespaces=this.getNamespaces(),nsUri=ns.uri;return namespaces.uriMap[nsUri]||(namespaces.uriMap[nsUri]=ns,wellknown?namespaces.wellknown.push(ns):namespaces.custom.push(ns)),namespaces.prefixMap[ns.prefix]=nsUri,ns},ElementSerializer.prototype.logNamespaceUsed=function(ns){var element=this.element,model=element.$model,namespaces=this.getNamespaces(),prefix=ns.prefix,wellknownUri=DEFAULT_NS_MAP[prefix]||model&&(model.getPackage(prefix)||{}).uri,uri=ns.uri||namespaces.prefixMap[prefix]||wellknownUri;if(!uri)throw new Error("no namespace uri given for prefix <"+ns.prefix+">");return ns=namespaces.uriMap[uri],ns||(ns=this.logNamespace({prefix:prefix,uri:uri},wellknownUri)),namespaces.used[ns.uri]||(namespaces.used[ns.uri]=ns),ns},ElementSerializer.prototype.parseAttributes=function(properties){var self=this,element=this.element;forEach(properties,function(p){var value=element.get(p.name);if(p.isReference)if(p.isMany){var values=[];forEach(value,function(v){values.push(v.id)}),value=values.join(" ")}else value=value.id;self.addAttribute(self.nsAttributeName(p),value)})},ElementSerializer.prototype.addAttribute=function(name,value){var attrs=this.attrs;isString(value)&&(value=escapeAttr(value)),attrs.push({name:name,value:value})},ElementSerializer.prototype.serializeAttributes=function(writer){var attrs=this.attrs;!this.parent&&(attrs=getNsAttrs(this.namespaces).concat(attrs)),forEach(attrs,function(a){writer.append(" ").append(nsName(a.name)).append('="').append(a.value).append('"')})},ElementSerializer.prototype.serializeTo=function(writer){var hasBody=this.body.length,indent=!(1===this.body.length&&this.body[0]instanceof BodySerializer);writer.appendIndent().append("<"+nsName(this.ns)),this.serializeAttributes(writer),writer.append(hasBody?">":" />"),hasBody&&(indent&&writer.appendNewLine().indent(),forEach(this.body,function(b){b.serializeTo(writer)}),indent&&writer.unindent().appendIndent(),writer.append("")),writer.appendNewLine()},TypeSerializer.prototype=new ElementSerializer,TypeSerializer.prototype.build=function(element){var descriptor=element.$descriptor;this.element=element,this.typeNs=this.nsTagName(descriptor);var typeNs=this.typeNs,pkg=element.$model.getPackage(typeNs.uri),typePrefix=pkg.xml&&pkg.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(XSI_TYPE),(typeNs.prefix?typeNs.prefix+":":"")+typePrefix+descriptor.ns.localName),ElementSerializer.prototype.build.call(this,element)},TypeSerializer.prototype.isLocalNs=function(ns){return ns.uri===this.typeNs.uri},module.exports=XMLWriter},{"./common":524,"lodash/collection/filter":364,"lodash/collection/forEach":366,"lodash/collection/map":370,"lodash/lang/isString":496,"lodash/object/assign":499,"moddle/lib/ns":532,"moddle/lib/types":535}],527:[function(require,module,exports){module.exports=require("./lib/moddle")},{"./lib/moddle":531}],528:[function(require,module,exports){"use strict";function Base(){}Base.prototype.get=function(name){return this.$model.properties.get(this,name)},Base.prototype.set=function(name,value){this.$model.properties.set(this,name,value)},module.exports=Base},{}],529:[function(require,module,exports){"use strict";function DescriptorBuilder(nameNs){this.ns=nameNs,this.name=nameNs.name,this.allTypes=[],this.properties=[],this.propertiesByName={}}var pick=require("lodash/object/pick"),assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),parseNameNs=require("./ns").parseName;module.exports=DescriptorBuilder,DescriptorBuilder.prototype.build=function(){return pick(this,["ns","name","allTypes","properties","propertiesByName","bodyProperty","idProperty"])},DescriptorBuilder.prototype.addProperty=function(p,idx,validate){"boolean"==typeof idx&&(validate=idx,idx=void 0),this.addNamedProperty(p,!1!==validate);var properties=this.properties;void 0!==idx?properties.splice(idx,0,p):properties.push(p)},DescriptorBuilder.prototype.replaceProperty=function(oldProperty,newProperty,replace){var oldNameNs=oldProperty.ns,props=this.properties,propertiesByName=this.propertiesByName,rename=oldProperty.name!==newProperty.name;if(oldProperty.isId){if(!newProperty.isId)throw new Error("property <"+newProperty.ns.name+"> must be id property to refine <"+oldProperty.ns.name+">");this.setIdProperty(newProperty,!1)}if(oldProperty.isBody){if(!newProperty.isBody)throw new Error("property <"+newProperty.ns.name+"> must be body property to refine <"+oldProperty.ns.name+">");this.setBodyProperty(newProperty,!1)}var idx=props.indexOf(oldProperty);if(-1===idx)throw new Error("property <"+oldNameNs.name+"> not found in property list");props.splice(idx,1),this.addProperty(newProperty,replace?void 0:idx,rename),propertiesByName[oldNameNs.name]=propertiesByName[oldNameNs.localName]=newProperty},DescriptorBuilder.prototype.redefineProperty=function(p,targetPropertyName,replace){var nsPrefix=p.ns.prefix,parts=targetPropertyName.split("#"),name=parseNameNs(parts[0],nsPrefix),attrName=parseNameNs(parts[1],name.prefix).name,redefinedProperty=this.propertiesByName[attrName];if(!redefinedProperty)throw new Error("refined property <"+attrName+"> not found");this.replaceProperty(redefinedProperty,p,replace),delete p.redefines},DescriptorBuilder.prototype.addNamedProperty=function(p,validate){var ns=p.ns,propsByName=this.propertiesByName;validate&&(this.assertNotDefined(p,ns.name),this.assertNotDefined(p,ns.localName)),propsByName[ns.name]=propsByName[ns.localName]=p},DescriptorBuilder.prototype.removeNamedProperty=function(p){var ns=p.ns,propsByName=this.propertiesByName;delete propsByName[ns.name],delete propsByName[ns.localName]},DescriptorBuilder.prototype.setBodyProperty=function(p,validate){if(validate&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+p.ns.name+">)");this.bodyProperty=p},DescriptorBuilder.prototype.setIdProperty=function(p,validate){if(validate&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+p.ns.name+">)");this.idProperty=p},DescriptorBuilder.prototype.assertNotDefined=function(p,name){var propertyName=p.name,definedProperty=this.propertiesByName[propertyName];if(definedProperty)throw new Error("property <"+propertyName+"> already defined; override of <"+definedProperty.definedBy.ns.name+"#"+definedProperty.ns.name+"> by <"+p.definedBy.ns.name+"#"+p.ns.name+"> not allowed without redefines")},DescriptorBuilder.prototype.hasProperty=function(name){return this.propertiesByName[name]},DescriptorBuilder.prototype.addTrait=function(t,inherited){var allTypes=this.allTypes;-1===allTypes.indexOf(t)&&(forEach(t.properties,function(p){p=assign({},p,{name:p.ns.localName,inherited:inherited}),Object.defineProperty(p,"definedBy",{value:t});var replaces=p.replaces,redefines=p.redefines;replaces||redefines?this.redefineProperty(p,replaces||redefines,replaces):(p.isBody&&this.setBodyProperty(p),p.isId&&this.setIdProperty(p),this.addProperty(p))},this),allTypes.push(t))}},{"./ns":532,"lodash/collection/forEach":366,"lodash/object/assign":499,"lodash/object/pick":508}],530:[function(require,module,exports){"use strict";function Factory(model,properties){this.model=model,this.properties=properties}var forEach=require("lodash/collection/forEach"),Base=require("./base");module.exports=Factory,Factory.prototype.createType=function(descriptor){function ModdleElement(attrs){props.define(this,"$type",{value:name,enumerable:!0}),props.define(this,"$attrs",{value:{}}),props.define(this,"$parent",{writable:!0}),forEach(attrs,function(val,key){this.set(key,val)},this)}var model=this.model,props=this.properties,prototype=Object.create(Base.prototype);forEach(descriptor.properties,function(p){p.isMany||void 0===p.default||(prototype[p.name]=p.default)}),props.defineModel(prototype,model),props.defineDescriptor(prototype,descriptor);var name=descriptor.ns.name;return ModdleElement.prototype=prototype,ModdleElement.hasType=prototype.$instanceOf=this.model.hasType,props.defineModel(ModdleElement,model),props.defineDescriptor(ModdleElement,descriptor),ModdleElement}},{"./base":528,"lodash/collection/forEach":366}],531:[function(require,module,exports){"use strict";function Moddle(packages){this.properties=new Properties(this),this.factory=new Factory(this,this.properties),this.registry=new Registry(packages,this.properties),this.typeCache={}}var isString=require("lodash/lang/isString"),isObject=require("lodash/lang/isObject"),forEach=require("lodash/collection/forEach"),find=require("lodash/collection/find"),Factory=require("./factory"),Registry=require("./registry"),Properties=require("./properties"),parseNameNs=require("./ns").parseName;module.exports=Moddle,Moddle.prototype.create=function(descriptor,attrs){var Type=this.getType(descriptor);if(!Type)throw new Error("unknown type <"+descriptor+">");return new Type(attrs)},Moddle.prototype.getType=function(descriptor){var cache=this.typeCache,name=isString(descriptor)?descriptor:descriptor.ns.name,type=cache[name];return type||(descriptor=this.registry.getEffectiveDescriptor(name),type=cache[name]=this.factory.createType(descriptor)),type},Moddle.prototype.createAny=function(name,nsUri,properties){var nameNs=parseNameNs(name),element={$type:name},descriptor={name:name,isGeneric:!0,ns:{prefix:nameNs.prefix,localName:nameNs.localName,uri:nsUri}};return this.properties.defineDescriptor(element,descriptor),this.properties.defineModel(element,this),this.properties.define(element,"$parent",{enumerable:!1,writable:!0}),forEach(properties,function(a,key){isObject(a)&&void 0!==a.value?element[a.name]=a.value:element[key]=a}),element},Moddle.prototype.getPackage=function(uriOrPrefix){return this.registry.getPackage(uriOrPrefix)},Moddle.prototype.getPackages=function(){return this.registry.getPackages()},Moddle.prototype.getElementDescriptor=function(element){return element.$descriptor},Moddle.prototype.hasType=function(element,type){void 0===type&&(type=element,element=this);var descriptor=element.$model.getElementDescriptor(element);return!!find(descriptor.allTypes,function(t){return t.name===type})},Moddle.prototype.getPropertyDescriptor=function(element,property){return this.getElementDescriptor(element).propertiesByName[property]}},{"./factory":530,"./ns":532,"./properties":533,"./registry":534,"lodash/collection/find":365,"lodash/collection/forEach":366,"lodash/lang/isObject":494,"lodash/lang/isString":496}],532:[function(require,module,exports){"use strict";module.exports.parseName=function(name,defaultPrefix){var localName,prefix,parts=name.split(/:/);if(1===parts.length)localName=name,prefix=defaultPrefix;else{if(2!==parts.length)throw new Error("expected or , got "+name);localName=parts[1],prefix=parts[0]}return name=(prefix?prefix+":":"")+localName,{name:name,prefix:prefix,localName:localName}}},{}],533:[function(require,module,exports){"use strict";function Properties(model){this.model=model}function isUndefined(val){return void 0===val}function defineProperty(target,property,value){Object.defineProperty(target,property.name,{enumerable:!property.isReference,writable:!0,value:value,configurable:!0})}module.exports=Properties,Properties.prototype.set=function(target,name,value){var property=this.model.getPropertyDescriptor(target,name),propertyName=property&&property.name;isUndefined(value)?property?delete target[propertyName]:delete target.$attrs[name]:property?propertyName in target?target[propertyName]=value:defineProperty(target,property,value):target.$attrs[name]=value},Properties.prototype.get=function(target,name){var property=this.model.getPropertyDescriptor(target,name);if(!property)return target.$attrs[name];var propertyName=property.name;return!target[propertyName]&&property.isMany&&defineProperty(target,property,[]),target[propertyName]},Properties.prototype.define=function(target,name,options){Object.defineProperty(target,name,options)},Properties.prototype.defineDescriptor=function(target,descriptor){this.define(target,"$descriptor",{value:descriptor})},Properties.prototype.defineModel=function(target,model){this.define(target,"$model",{value:model})}},{}],534:[function(require,module,exports){"use strict";function Registry(packages,properties){this.packageMap={},this.typeMap={},this.packages=[],this.properties=properties,forEach(packages,this.registerPackage,this)}var assign=require("lodash/object/assign"),forEach=require("lodash/collection/forEach"),Types=require("./types"),DescriptorBuilder=require("./descriptor-builder"),parseNameNs=require("./ns").parseName,isBuiltInType=Types.isBuiltIn;module.exports=Registry,Registry.prototype.getPackage=function(uriOrPrefix){return this.packageMap[uriOrPrefix]},Registry.prototype.getPackages=function(){return this.packages},Registry.prototype.registerPackage=function(pkg){pkg=assign({},pkg),forEach(pkg.types,function(descriptor){this.registerType(descriptor,pkg)},this),this.packageMap[pkg.uri]=this.packageMap[pkg.prefix]=pkg,this.packages.push(pkg)},Registry.prototype.registerType=function(type,pkg){type=assign({},type,{superClass:(type.superClass||[]).slice(),extends:(type.extends||[]).slice(),properties:(type.properties||[]).slice()});var ns=parseNameNs(type.name,pkg.prefix),name=ns.name,propertiesByName={};forEach(type.properties,function(p){var propertyNs=parseNameNs(p.name,ns.prefix),propertyName=propertyNs.name;isBuiltInType(p.type)||(p.type=parseNameNs(p.type,propertyNs.prefix).name),assign(p,{ns:propertyNs,name:propertyName}),propertiesByName[propertyName]=p}),assign(type,{ns:ns,name:name,propertiesByName:propertiesByName}),forEach(type.extends,function(extendsName){var extended=this.typeMap[extendsName];extended.traits=extended.traits||[],extended.traits.push(name)},this),this.definePackage(type,pkg),this.typeMap[name]=type},Registry.prototype.mapTypes=function(nsName,iterator,trait){function traverseTrait(cls){return traverseSuper(cls,!0)}function traverseSuper(cls,trait){var parentNs=parseNameNs(cls,isBuiltInType(cls)?"":nsName.prefix);self.mapTypes(parentNs,iterator,trait)}var type=isBuiltInType(nsName.name)?{name:nsName.name}:this.typeMap[nsName.name],self=this;if(!type)throw new Error("unknown type <"+nsName.name+">");forEach(type.superClass,trait?traverseTrait:traverseSuper),iterator(type,!trait),forEach(type.traits,traverseTrait)},Registry.prototype.getEffectiveDescriptor=function(name){var nsName=parseNameNs(name),builder=new DescriptorBuilder(nsName);this.mapTypes(nsName,function(type,inherited){builder.addTrait(type,inherited)});var descriptor=builder.build();return this.definePackage(descriptor,descriptor.allTypes[descriptor.allTypes.length-1].$pkg),descriptor},Registry.prototype.definePackage=function(target,pkg){this.properties.define(target,"$pkg",{value:pkg})}},{"./descriptor-builder":529,"./ns":532,"./types":535,"lodash/collection/forEach":366,"lodash/object/assign":499}],535:[function(require,module,exports){"use strict";var BUILTINS={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},TYPE_CONVERTERS={String:function(s){return s},Boolean:function(s){return"true"===s},Integer:function(s){return parseInt(s,10)},Real:function(s){return parseFloat(s,10)}};module.exports.coerceType=function(type,value){var converter=TYPE_CONVERTERS[type];return converter?converter(value):value},module.exports.isBuiltIn=function(type){return!!BUILTINS[type]},module.exports.isSimple=function(type){return!!TYPE_CONVERTERS[type]}},{}],536:[function(require,module,exports){module.exports=require("./lib/refs"),module.exports.Collection=require("./lib/collection")},{"./lib/collection":537,"./lib/refs":538}],537:[function(require,module,exports){"use strict";function extend(collection,refs,property,target){var inverseProperty=property.inverse;return Object.defineProperty(collection,"remove",{value:function(element){var idx=this.indexOf(element);return-1!==idx&&(this.splice(idx,1),refs.unset(element,inverseProperty,target)),element}}),Object.defineProperty(collection,"contains",{value:function(element){return-1!==this.indexOf(element)}}),Object.defineProperty(collection,"add",{value:function(element){this.contains(element)||(this.push(element),refs.set(element,inverseProperty,target))}}),Object.defineProperty(collection,"__refs_collection",{value:!0}),collection}function isExtended(collection){return!0===collection.__refs_collection}module.exports.extend=extend,module.exports.isExtended=isExtended},{}],538:[function(require,module,exports){"use strict";function hasOwnProperty(e,property){return Object.prototype.hasOwnProperty.call(e,property.name||property)}function defineCollectionProperty(ref,property,target){Object.defineProperty(target,property.name,{enumerable:property.enumerable,value:Collection.extend(target[property.name]||[],ref,property,target)})}function defineProperty(ref,property,target){var inverseProperty=property.inverse,_value=target[property.name];Object.defineProperty(target,property.name,{enumerable:property.enumerable,get:function(){return _value},set:function(value){if(value!==_value){var old=_value;_value=null,old&&ref.unset(old,inverseProperty,target),_value=value,ref.set(_value,inverseProperty,target)}}})}function Refs(a,b){if(!(this instanceof Refs))return new Refs(a,b);a.inverse=b,b.inverse=a,this.props={},this.props[a.name]=a,this.props[b.name]=b}var Collection=require("./collection");Refs.prototype.bind=function(target,property){if("string"==typeof property){if(!this.props[property])throw new Error("no property <"+property+"> in ref");property=this.props[property]}property.collection?defineCollectionProperty(this,property,target):defineProperty(this,property,target)},Refs.prototype.ensureRefsCollection=function(target,property){var collection=target[property.name];return Collection.isExtended(collection)||defineCollectionProperty(this,property,target),collection},Refs.prototype.ensureBound=function(target,property){hasOwnProperty(target,property)||this.bind(target,property)},Refs.prototype.unset=function(target,property,value){target&&(this.ensureBound(target,property),property.collection?this.ensureRefsCollection(target,property).remove(value):target[property.name]=void 0)},Refs.prototype.set=function(target,property,value){target&&(this.ensureBound(target,property),property.collection?this.ensureRefsCollection(target,property).add(value):target[property.name]=value)},module.exports=Refs},{"./collection":537}],539:[function(require,module,exports){(function(Buffer){!function(sax){function SAXParser(strict,opt){if(!(this instanceof SAXParser))return new SAXParser(strict,opt);var parser=this;clearBuffers(parser),parser.q=parser.c="",parser.bufferCheckPosition=sax.MAX_BUFFER_LENGTH,parser.opt=opt||{},parser.opt.lowercase=parser.opt.lowercase||parser.opt.lowercasetags,parser.looseCase=parser.opt.lowercase?"toLowerCase":"toUpperCase",parser.tags=[],parser.closed=parser.closedRoot=parser.sawRoot=!1,parser.tag=parser.error=null,parser.strict=!!strict,parser.noscript=!(!strict&&!parser.opt.noscript),parser.state=S.BEGIN,parser.ENTITIES=Object.create(sax.ENTITIES),parser.attribList=[],parser.opt.xmlns&&(parser.ns=Object.create(rootNS)),parser.trackPosition=!1!==parser.opt.position,parser.trackPosition&&(parser.position=parser.line=parser.column=0),emit(parser,"onready")}function checkBufferLength(parser){for(var maxAllowed=Math.max(sax.MAX_BUFFER_LENGTH,10),maxActual=0,i=0,l=buffers.length;imaxAllowed)switch(buffers[i]){case"textNode":closeText(parser);break;case"cdata":emitNode(parser,"oncdata",parser.cdata),parser.cdata="";break;case"script":emitNode(parser,"onscript",parser.script),parser.script="";break;default:error(parser,"Max buffer length exceeded: "+buffers[i])}maxActual=Math.max(maxActual,len)}parser.bufferCheckPosition=sax.MAX_BUFFER_LENGTH-maxActual+parser.position}function clearBuffers(parser){for(var i=0,l=buffers.length;i",parser.tagName="",void(parser.state=S.SCRIPT);emitNode(parser,"onscript",parser.script),parser.script=""}var t=parser.tags.length,tagName=parser.tagName;parser.strict||(tagName=tagName[parser.looseCase]());for(var closeTo=tagName;t--;){if(parser.tags[t].name===closeTo)break;strictFail(parser,"Unexpected close tag")}if(t<0)return strictFail(parser,"Unmatched closing tag: "+parser.tagName),parser.textNode+="",void(parser.state=S.TEXT);parser.tagName=tagName;for(var s=parser.tags.length;s-- >t;){var tag=parser.tag=parser.tags.pop();parser.tagName=parser.tag.name,emitNode(parser,"onclosetag",parser.tagName);var x={};for(var i in tag.ns)x[i]=tag.ns[i];var parent=parser.tags[parser.tags.length-1]||parser;parser.opt.xmlns&&tag.ns!==parent.ns&&Object.keys(tag.ns).forEach(function(p){var n=tag.ns[p];emitNode(parser,"onclosenamespace",{prefix:p,uri:n})})}0===t&&(parser.closedRoot=!0),parser.tagName=parser.attribValue=parser.attribName="",parser.attribList.length=0,parser.state=S.TEXT}function parseEntity(parser){var num,entity=parser.entity,entityLC=entity.toLowerCase(),numStr="";return parser.ENTITIES[entity]?parser.ENTITIES[entity]:parser.ENTITIES[entityLC]?parser.ENTITIES[entityLC]:(entity=entityLC,"#"===entity.charAt(0)&&("x"===entity.charAt(1)?(entity=entity.slice(2),num=parseInt(entity,16),numStr=num.toString(16)):(entity=entity.slice(1),num=parseInt(entity,10),numStr=num.toString(10))),entity=entity.replace(/^0+/,""),numStr.toLowerCase()!==entity?(strictFail(parser,"Invalid character entity"),"&"+parser.entity+";"):String.fromCodePoint(num))}function write(chunk){var parser=this;if(this.error)throw this.error;if(parser.closed)return error(parser,"Cannot write after close. Assign an onready handler.");if(null===chunk)return end(parser);for(var i=0,c="";parser.c=c=chunk.charAt(i++);)switch(parser.trackPosition&&(parser.position++,"\n"===c?(parser.line++,parser.column=0):parser.column++),parser.state){case S.BEGIN:"<"===c?(parser.state=S.OPEN_WAKA,parser.startTagPosition=parser.position):not(whitespace,c)&&(strictFail(parser,"Non-whitespace before first tag."),parser.textNode=c,parser.state=S.TEXT);continue;case S.TEXT:if(parser.sawRoot&&!parser.closedRoot){for(var starti=i-1;c&&"<"!==c&&"&"!==c;)(c=chunk.charAt(i++))&&parser.trackPosition&&(parser.position++,"\n"===c?(parser.line++,parser.column=0):parser.column++);parser.textNode+=chunk.substring(starti,i-1)}"<"===c?(parser.state=S.OPEN_WAKA,parser.startTagPosition=parser.position):(!not(whitespace,c)||parser.sawRoot&&!parser.closedRoot||strictFail(parser,"Text data outside of root node."),"&"===c?parser.state=S.TEXT_ENTITY:parser.textNode+=c);continue;case S.SCRIPT:"<"===c?parser.state=S.SCRIPT_ENDING:parser.script+=c;continue;case S.SCRIPT_ENDING:"/"===c?parser.state=S.CLOSE_TAG:(parser.script+="<"+c,parser.state=S.SCRIPT);continue;case S.OPEN_WAKA:if("!"===c)parser.state=S.SGML_DECL,parser.sgmlDecl="";else if(is(whitespace,c));else if(is(nameStart,c))parser.state=S.OPEN_TAG,parser.tagName=c;else if("/"===c)parser.state=S.CLOSE_TAG,parser.tagName="";else if("?"===c)parser.state=S.PROC_INST,parser.procInstName=parser.procInstBody="";else{if(strictFail(parser,"Unencoded <"),parser.startTagPosition+1"===c?(emitNode(parser,"onsgmldeclaration",parser.sgmlDecl),parser.sgmlDecl="",parser.state=S.TEXT):is(quote,c)?(parser.state=S.SGML_DECL_QUOTED,parser.sgmlDecl+=c):parser.sgmlDecl+=c;continue;case S.SGML_DECL_QUOTED:c===parser.q&&(parser.state=S.SGML_DECL,parser.q=""),parser.sgmlDecl+=c;continue;case S.DOCTYPE:">"===c?(parser.state=S.TEXT,emitNode(parser,"ondoctype",parser.doctype),parser.doctype=!0):(parser.doctype+=c,"["===c?parser.state=S.DOCTYPE_DTD:is(quote,c)&&(parser.state=S.DOCTYPE_QUOTED,parser.q=c));continue;case S.DOCTYPE_QUOTED:parser.doctype+=c,c===parser.q&&(parser.q="",parser.state=S.DOCTYPE);continue;case S.DOCTYPE_DTD:parser.doctype+=c,"]"===c?parser.state=S.DOCTYPE:is(quote,c)&&(parser.state=S.DOCTYPE_DTD_QUOTED,parser.q=c);continue;case S.DOCTYPE_DTD_QUOTED:parser.doctype+=c,c===parser.q&&(parser.state=S.DOCTYPE_DTD,parser.q="");continue;case S.COMMENT:"-"===c?parser.state=S.COMMENT_ENDING:parser.comment+=c;continue;case S.COMMENT_ENDING:"-"===c?(parser.state=S.COMMENT_ENDED,parser.comment=textopts(parser.opt,parser.comment),parser.comment&&emitNode(parser,"oncomment",parser.comment),parser.comment=""):(parser.comment+="-"+c,parser.state=S.COMMENT);continue;case S.COMMENT_ENDED:">"!==c?(strictFail(parser,"Malformed comment"),parser.comment+="--"+c,parser.state=S.COMMENT):parser.state=S.TEXT;continue;case S.CDATA:"]"===c?parser.state=S.CDATA_ENDING:parser.cdata+=c;continue;case S.CDATA_ENDING:"]"===c?parser.state=S.CDATA_ENDING_2:(parser.cdata+="]"+c,parser.state=S.CDATA);continue;case S.CDATA_ENDING_2:">"===c?(parser.cdata&&emitNode(parser,"oncdata",parser.cdata),emitNode(parser,"onclosecdata"),parser.cdata="",parser.state=S.TEXT):"]"===c?parser.cdata+="]":(parser.cdata+="]]"+c,parser.state=S.CDATA);continue;case S.PROC_INST:"?"===c?parser.state=S.PROC_INST_ENDING:is(whitespace,c)?parser.state=S.PROC_INST_BODY:parser.procInstName+=c;continue;case S.PROC_INST_BODY:if(!parser.procInstBody&&is(whitespace,c))continue;"?"===c?parser.state=S.PROC_INST_ENDING:parser.procInstBody+=c;continue;case S.PROC_INST_ENDING:">"===c?(emitNode(parser,"onprocessinginstruction",{name:parser.procInstName,body:parser.procInstBody}),parser.procInstName=parser.procInstBody="",parser.state=S.TEXT):(parser.procInstBody+="?"+c,parser.state=S.PROC_INST_BODY);continue;case S.OPEN_TAG:is(nameBody,c)?parser.tagName+=c:(newTag(parser),">"===c?openTag(parser):"/"===c?parser.state=S.OPEN_TAG_SLASH:(not(whitespace,c)&&strictFail(parser,"Invalid character in tag name"),parser.state=S.ATTRIB));continue;case S.OPEN_TAG_SLASH:">"===c?(openTag(parser,!0),closeTag(parser)):(strictFail(parser,"Forward-slash in opening tag not followed by >"),parser.state=S.ATTRIB);continue;case S.ATTRIB:if(is(whitespace,c))continue;">"===c?openTag(parser):"/"===c?parser.state=S.OPEN_TAG_SLASH:is(nameStart,c)?(parser.attribName=c,parser.attribValue="",parser.state=S.ATTRIB_NAME):strictFail(parser,"Invalid attribute name");continue;case S.ATTRIB_NAME:"="===c?parser.state=S.ATTRIB_VALUE:">"===c?(strictFail(parser,"Attribute without value"),parser.attribValue=parser.attribName,attrib(parser),openTag(parser)):is(whitespace,c)?parser.state=S.ATTRIB_NAME_SAW_WHITE:is(nameBody,c)?parser.attribName+=c:strictFail(parser,"Invalid attribute name");continue;case S.ATTRIB_NAME_SAW_WHITE:if("="===c)parser.state=S.ATTRIB_VALUE;else{if(is(whitespace,c))continue;strictFail(parser,"Attribute without value"),parser.tag.attributes[parser.attribName]="",parser.attribValue="",emitNode(parser,"onattribute",{name:parser.attribName,value:""}),parser.attribName="",">"===c?openTag(parser):is(nameStart,c)?(parser.attribName=c,parser.state=S.ATTRIB_NAME):(strictFail(parser,"Invalid attribute name"),parser.state=S.ATTRIB)}continue;case S.ATTRIB_VALUE:if(is(whitespace,c))continue;is(quote,c)?(parser.q=c,parser.state=S.ATTRIB_VALUE_QUOTED):(strictFail(parser,"Unquoted attribute value"),parser.state=S.ATTRIB_VALUE_UNQUOTED,parser.attribValue=c);continue;case S.ATTRIB_VALUE_QUOTED:if(c!==parser.q){"&"===c?parser.state=S.ATTRIB_VALUE_ENTITY_Q:parser.attribValue+=c;continue}attrib(parser),parser.q="",parser.state=S.ATTRIB_VALUE_CLOSED;continue;case S.ATTRIB_VALUE_CLOSED:is(whitespace,c)?parser.state=S.ATTRIB:">"===c?openTag(parser):"/"===c?parser.state=S.OPEN_TAG_SLASH:is(nameStart,c)?(strictFail(parser,"No whitespace between attributes"),parser.attribName=c,parser.attribValue="",parser.state=S.ATTRIB_NAME):strictFail(parser,"Invalid attribute name");continue;case S.ATTRIB_VALUE_UNQUOTED:if(not(attribEnd,c)){"&"===c?parser.state=S.ATTRIB_VALUE_ENTITY_U:parser.attribValue+=c;continue}attrib(parser),">"===c?openTag(parser):parser.state=S.ATTRIB;continue;case S.CLOSE_TAG:if(parser.tagName)">"===c?closeTag(parser):is(nameBody,c)?parser.tagName+=c:parser.script?(parser.script+=""===c?closeTag(parser):strictFail(parser,"Invalid characters in closing tag");continue;case S.TEXT_ENTITY:case S.ATTRIB_VALUE_ENTITY_Q:case S.ATTRIB_VALUE_ENTITY_U:switch(parser.state){case S.TEXT_ENTITY:var returnState=S.TEXT,buffer="textNode";break;case S.ATTRIB_VALUE_ENTITY_Q:var returnState=S.ATTRIB_VALUE_QUOTED,buffer="attribValue";break;case S.ATTRIB_VALUE_ENTITY_U:var returnState=S.ATTRIB_VALUE_UNQUOTED,buffer="attribValue"}";"===c?(parser[buffer]+=parseEntity(parser),parser.entity="",parser.state=returnState):is(entity,c)?parser.entity+=c:(strictFail(parser,"Invalid character entity"),parser[buffer]+="&"+parser.entity+c,parser.entity="",parser.state=returnState);continue;default:throw new Error(parser,"Unknown state: "+parser.state)}return parser.position>=parser.bufferCheckPosition&&checkBufferLength(parser),parser}sax.parser=function(strict,opt){return new SAXParser(strict,opt)},sax.SAXParser=SAXParser,sax.SAXStream=SAXStream,sax.createStream=createStream,sax.MAX_BUFFER_LENGTH=65536;var buffers=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];sax.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(o){function f(){this.__proto__=o}return f.prototype=o,new f}),Object.getPrototypeOf||(Object.getPrototypeOf=function(o){return o.__proto__}),Object.keys||(Object.keys=function(o){var a=[];for(var i in o)o.hasOwnProperty(i)&&a.push(i);return a}),SAXParser.prototype={end:function(){end(this)},write:write,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){flushBuffers(this)}};try{var Stream=require("stream").Stream}catch(ex){var Stream=function(){}}var streamWraps=sax.EVENTS.filter(function(ev){return"error"!==ev&&"end"!==ev});SAXStream.prototype=Object.create(Stream.prototype,{constructor:{value:SAXStream}}),SAXStream.prototype.write=function(data){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(data)){if(!this._decoder){var SD=require("string_decoder").StringDecoder;this._decoder=new SD("utf8")}data=this._decoder.write(data)}return this._parser.write(data.toString()),this.emit("data",data),!0},SAXStream.prototype.end=function(chunk){return chunk&&chunk.length&&this.write(chunk),this._parser.end(),!0},SAXStream.prototype.on=function(ev,handler){var me=this;return me._parser["on"+ev]||-1===streamWraps.indexOf(ev)||(me._parser["on"+ev]=function(){var args=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);args.splice(0,0,ev),me.emit.apply(me,args)}),Stream.prototype.on.call(me,ev,handler)};var whitespace="\r\n\t ",number="0124356789",letter="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",quote="'\"",entity=number+letter+"#",attribEnd=whitespace+">",CDATA="[CDATA[",DOCTYPE="DOCTYPE",XML_NAMESPACE="http://www.w3.org/XML/1998/namespace",XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/",rootNS={xml:XML_NAMESPACE,xmlns:XMLNS_NAMESPACE};whitespace=charClass(whitespace),number=charClass(number),letter=charClass(letter);var nameStart=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,nameBody=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;quote=charClass(quote),entity=charClass(entity),attribEnd=charClass(attribEnd);var S=0;sax.STATE={BEGIN:S++,TEXT:S++,TEXT_ENTITY:S++,OPEN_WAKA:S++,SGML_DECL:S++,SGML_DECL_QUOTED:S++,DOCTYPE:S++,DOCTYPE_QUOTED:S++,DOCTYPE_DTD:S++,DOCTYPE_DTD_QUOTED:S++,COMMENT_STARTING:S++,COMMENT:S++,COMMENT_ENDING:S++,COMMENT_ENDED:S++,CDATA:S++,CDATA_ENDING:S++,CDATA_ENDING_2:S++,PROC_INST:S++,PROC_INST_BODY:S++,PROC_INST_ENDING:S++,OPEN_TAG:S++,OPEN_TAG_SLASH:S++,ATTRIB:S++,ATTRIB_NAME:S++,ATTRIB_NAME_SAW_WHITE:S++,ATTRIB_VALUE:S++,ATTRIB_VALUE_QUOTED:S++,ATTRIB_VALUE_CLOSED:S++,ATTRIB_VALUE_UNQUOTED:S++,ATTRIB_VALUE_ENTITY_Q:S++,ATTRIB_VALUE_ENTITY_U:S++,CLOSE_TAG:S++,CLOSE_TAG_SAW_WHITE:S++,SCRIPT:S++,SCRIPT_ENDING:S++},sax.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(sax.ENTITIES).forEach(function(key){var e=sax.ENTITIES[key],s="number"==typeof e?String.fromCharCode(e):e;sax.ENTITIES[key]=s});for(var S in sax.STATE)sax.STATE[sax.STATE[S]]=S;S=sax.STATE,String.fromCodePoint||function(){var stringFromCharCode=String.fromCharCode,floor=Math.floor,fromCodePoint=function(){var highSurrogate,lowSurrogate,codeUnits=[],index=-1,length=arguments.length;if(!length)return"";for(var result="";++index1114111||floor(codePoint)!=codePoint)throw RangeError("Invalid code point: "+codePoint);codePoint<=65535?codeUnits.push(codePoint):(codePoint-=65536,highSurrogate=55296+(codePoint>>10),lowSurrogate=codePoint%1024+56320,codeUnits.push(highSurrogate,lowSurrogate)),(index+1==length||codeUnits.length>16384)&&(result+=stringFromCharCode.apply(null,codeUnits),codeUnits.length=0)}return result};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:fromCodePoint,configurable:!0,writable:!0}):String.fromCodePoint=fromCodePoint}()}(void 0===exports?sax={}:exports)}).call(this,void 0)},{stream:void 0,string_decoder:void 0}],540:[function(require,module,exports){"use strict";function ScrollTabs($el,options){EventEmitter.call(this),this.options=options=assign({},DEFAULT_OPTIONS,options),this.container=$el,this._createScrollButtons($el,options),this._bindEvents($el)}function create($el,options){var scrollTabs=get($el);return scrollTabs||(scrollTabs=new ScrollTabs($el,options),$el.__scrollTabs=scrollTabs),scrollTabs}function get($el){return $el.__scrollTabs}var domify=require("min-dom/lib/domify"),domClasses=require("min-dom/lib/classes"),domMatches=require("min-dom/lib/matches"),domDelegate=require("min-dom/lib/delegate"),domQuery=require("min-dom/lib/query"),domEvent=require("min-dom/lib/event"),domAttr=require("min-dom/lib/attr"),filter=require("lodash/collection/filter"),assign=require("lodash/object/assign"),inherits=require("inherits"),EventEmitter=require("events"),DEFAULT_OPTIONS={scrollSymbolLeft:"‹",scrollSymbolRight:"›"};inherits(ScrollTabs,EventEmitter),ScrollTabs.prototype._createButton=function(parentNode,options){var className=options.className,direction=options.direction,button=domQuery("."+className,parentNode);return button||(button=domify(''+options.label+""),parentNode.insertBefore(button,parentNode.childNodes[0])),domAttr(button,"data-direction",direction),button},ScrollTabs.prototype._createScrollButtons=function(parentNode,options){this._createButton(parentNode,{className:"scroll-tabs-left",label:options.scrollSymbolLeft,direction:-1}),this._createButton(parentNode,{className:"scroll-tabs-right",label:options.scrollSymbolRight,direction:1})},ScrollTabs.prototype.getActiveTabNode=function(){return domQuery(this.options.selectors.active,this.container)},ScrollTabs.prototype.getTabsContainerNode=function(){return domQuery(this.options.selectors.tabsContainer,this.container)},ScrollTabs.prototype.getAllTabNodes=function(){return domQuery.all(this.options.selectors.tab,this.container)},ScrollTabs.prototype.getVisibleTabs=function(){var allTabs=this.getAllTabNodes(),ignore=this.options.selectors.ignore;return filter(allTabs,function(tabNode){return!domMatches(tabNode,ignore)})},ScrollTabs.prototype.getAdjacentTab=function(referenceTabNode,n){var visibleTabs=this.getVisibleTabs();return visibleTabs[visibleTabs.indexOf(referenceTabNode)+n]},ScrollTabs.prototype._bindEvents=function(node){this._bindWheelEvent(node),this._bindTabClickEvents(node),this._bindScrollButtonEvents(node)},ScrollTabs.prototype._bindTabClickEvents=function(node){var selector=this.options.selectors.tab,self=this;domDelegate.bind(node,selector,"click",function(event){self.scrollToTabNode(event.delegateTarget)})},ScrollTabs.prototype._bindWheelEvent=function(node){var self=this;domEvent.bind(node,"wheel",function(e){var direction=Math.sign(e.deltaY),oldActiveTab=self.getActiveTabNode(),newActiveTab=self.getAdjacentTab(oldActiveTab,direction);newActiveTab&&(self.scrollToTabNode(newActiveTab),self.emit("scroll",newActiveTab,oldActiveTab,direction)),e.preventDefault()})},ScrollTabs.prototype._bindScrollButtonEvents=function(node){var self=this;domDelegate.bind(node,".scroll-tabs-button","click",function(event){var target=event.delegateTarget,direction=parseInt(domAttr(target,"data-direction"),10),oldActiveTabNode=self.getActiveTabNode(),newActiveTabNode=self.getAdjacentTab(oldActiveTabNode,direction);newActiveTabNode&&(self.scrollToTabNode(newActiveTabNode),self.emit("scroll",newActiveTabNode,oldActiveTabNode,direction)),event.preventDefault()})},ScrollTabs.prototype.scrollToTabNode=function(tabNode){if(tabNode){var tabsContainerNode=tabNode.parentNode,tabWidth=tabNode.offsetWidth,tabOffsetLeft=tabNode.offsetLeft,tabOffsetRight=tabOffsetLeft+tabWidth,containerWidth=tabsContainerNode.offsetWidth;tabsContainerNode.scrollLeft>tabOffsetLeft?tabsContainerNode.scrollLeft=0:tabOffsetRight>containerWidth&&(tabsContainerNode.scrollLeft=tabOffsetRight-containerWidth)}},ScrollTabs.prototype.update=function(){var tabsContainerNode=this.getTabsContainerNode(),overflow=tabsContainerNode.scrollWidth>tabsContainerNode.offsetWidth;domClasses(this.container).toggle("scroll-tabs-overflow",overflow),overflow&&this.scrollToTabNode(this.getActiveTabNode())},module.exports=create,module.exports.get=get},{events:347,inherits:351,"lodash/collection/filter":364,"lodash/object/assign":499,"min-dom/lib/attr":514,"min-dom/lib/classes":515,"min-dom/lib/delegate":518,"min-dom/lib/domify":519,"min-dom/lib/event":520,"min-dom/lib/matches":521,"min-dom/lib/query":522}],541:[function(require,module,exports){"use strict";function calculateUpdate(currentSelection,currentValue,newValue){var currentCursor=currentSelection.start,newCursor=currentCursor,diff=newValue.length-currentValue.length,currentTail=(newValue.length,currentValue.length,currentValue.substring(currentCursor));newValue.lastIndexOf(currentTail)===newValue.length-currentTail.length&&(currentValue=currentValue.substring(0,currentValue.length-currentTail.length),newValue=newValue.substring(0,newValue.length-currentTail.length));var diff=createDiff(currentValue,newValue);return diff&&(newCursor="remove"===diff.type?diff.newStart:diff.newEnd),range(newCursor)}function createDiff(currentValue,newValue){var insert,l_str,l_char,s_str,s_char,l_idx=0,s_idx=0;for(newValue.length>currentValue.length?(l_str=newValue,s_str=currentValue):(l_str=currentValue,s_str=newValue);l_idxcurrentValue.length?{newStart:insert.l_start,newEnd:insert.l_end,type:"add"}:{newStart:insert.s_start,newEnd:insert.s_end,type:newValue.length0?(this.top--,this.data.pop()):void 0},TinyStack.prototype.push=function(arg){return this.data[++this.top]=arg,this},void 0!==exports?module.exports=factory:"function"==typeof define?define(function(){return factory}):global.stack=factory}(this)},{}],543:[function(require,module,exports){function append(element,node){return appendTo(node,element),element}module.exports=append;var appendTo=require("./appendTo")},{"./appendTo":544}],544:[function(require,module,exports){function appendTo(element,target){return target.appendChild(ensureImported(element,target)),element}module.exports=appendTo;var ensureImported=require("./util/ensureImported")},{"./util/ensureImported":554}],545:[function(require,module,exports){function getAttribute(node,name){return CSS_PROPERTIES[name]?node.style[name]:node.getAttributeNS(null,name)}function setAttribute(node,name,value){var hyphenated=name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),type=CSS_PROPERTIES[hyphenated];type?(type===LENGTH_ATTR&&"number"==typeof value&&(value=String(value)+"px"),node.style[hyphenated]=value):node.setAttributeNS(null,name,value)}function setAttributes(node,attrs){var i,name,names=Object.keys(attrs);for(i=0,name;name=names[i];i++)setAttribute(node,name,attrs[name])}function attr(node,name,value){if("string"==typeof name){if(void 0===value)return getAttribute(node,name);setAttribute(node,name,value)}else setAttributes(node,name);return node}module.exports=attr;var LENGTH_ATTR=2,CSS_PROPERTIES={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":LENGTH_ATTR,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":LENGTH_ATTR,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1}},{}],546:[function(require,module,exports){function defined(o){return void 0!==o}function classes(el){return new ClassList(el)}function ClassList(el){if(!el||!el.nodeType)throw new Error("A DOM element reference is required");this.el=el,this.list=el.classList}module.exports=classes;var index=function(arr,obj){if(arr.indexOf)return arr.indexOf(obj);for(var i=0;i"+svg+"",parseDocument(svg)}function parseDocument(svg){var parser;return parser=new DOMParser,parser.async=!1,parser.parseFromString(svg,"text/xml")}module.exports=parse;var ns=require("./ns"),SVG_START='"),childNodes=node.childNodes,i=0,len=childNodes.length;i")}else output.push("/>");break;case 8:output.push("\x3c!--",escape(node.nodeValue,TEXT_ENTITIES),"--\x3e");break;case 4:output.push("",node.nodeValue,"");break;default:throw new Error("unable to handle node "+node.nodeType)}return output}module.exports=serialize;var TEXT_ENTITIES=/([&<>]{1})/g,ATTR_ENTITIES=/([\n\r"]{1})/g,ENTITY_REPLACEMENT={"&":"&","<":"<",">":">",'"':"'"}},{}]},{},[1]); //# sourceMappingURL=jsr-352.min.js.map \ No newline at end of file diff --git a/src/cljs-flowchart/job_streamer/console/flowchart.cljs b/src/cljs-flowchart/job_streamer/console/flowchart.cljs index 65165e4..6636705 100644 --- a/src/cljs-flowchart/job_streamer/console/flowchart.cljs +++ b/src/cljs-flowchart/job_streamer/console/flowchart.cljs @@ -195,7 +195,7 @@ (.error js/console (str "something went wrong:" err)) (.. modeler (get "canvas") - (zoom "fit-viewport")))) + (zoom 0.8)))) save-job-handler (fn [e] (.preventDefault e) (.stopPropagation e)