1/*! dmn-js - dmn-modeler v14.1.2 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
2!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DmnJS=t()}(this,(function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){a(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,x(i.key),i)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return(t=x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function l(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=u(e);if(t){var r=u(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return p(this,n)}}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}function v(){return v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=f(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},v.apply(this,arguments)}function m(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,t)||_(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function x(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function w(e){return Array.prototype.concat.apply([],e)}var C=Object.prototype.toString,E=Object.prototype.hasOwnProperty;function k(e){return void 0===e}function S(e){return void 0!==e}function j(e){return null==e}function O(e){return"[object Array]"===C.call(e)}function P(e){return"[object Object]"===C.call(e)}function D(e){return"[object Number]"===C.call(e)}function R(e){var t=C.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function T(e){return"[object String]"===C.call(e)}function M(e,t){return E.call(e,t)}function I(e,t){var n;return t=function(e){return R(e)?e:function(t){return t===e}}(t),N(e,(function(e,i){if(t(e,i))return n=e,!1})),n}function A(e,t){var n=[];return N(e,(function(e,i){t(e,i)&&n.push(e)})),n}function N(e,t){var n;if(!k(e)){var i=O(e)?X:K;for(var r in e)if(M(e,r)&&!1===t(n=e[r],i(r)))return n}}function B(e,t,n){return N(e,(function(e,i){n=t(n,e,i)})),n}function L(e,t){return!!B(e,(function(e,n,i){return e&&t(n,i)}),!0)}function $(e,t){return!!I(e,t)}function V(e,t){var n=[];return N(e,(function(e,i){n.push(t(e,i))})),n}function z(e){return e&&Object.keys(e)||[]}function F(e){return V(e,(function(e){return e}))}function U(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=G(t),N(e,(function(e){var i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)})),n}function H(e){e=G(e);for(var t={},n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];N(i,(function(n){return U(n,e,t)}));var o=V(t,(function(e,t){return e[0]}));return o}function W(e,t){t=G(t);var n=[];return N(e,(function(e,i){for(var r=t(e,i),o={d:r,v:e},a=0;a<n.length;a++){if(r<n[a].d)return void n.splice(a,0,o)}n.push(o)})),V(n,(function(e){return e.v}))}function q(e){return function(t){return L(e,(function(e,n){return t[n]===e}))}}function G(e){return R(e)?e:function(t){return t[e]}}function K(e){return e}function X(e){return Number(e)}function Y(e,t){var n,i,r,o;function a(n){var a=Date.now(),c=n?0:o+t-a;if(c>0)return s(c);e.apply(r,i),u()}function s(e){n=setTimeout(a,e)}function u(){n&&clearTimeout(n),n=o=i=r=void 0}function c(){o=Date.now();for(var e=arguments.length,a=new Array(e),u=0;u<e;u++)a[u]=arguments[u];i=a,r=this,n||s(t)}return c.flush=function(){n&&a(!0),u()},c.cancel=u,c}function Z(e,t){var n=!1;return function(){n||(e.apply(void 0,arguments),n=!0,setTimeout((function(){n=!1}),t))}}function Q(e,t){return e.bind(t)}function J(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Object.assign.apply(Object,[e].concat(n))}function ee(e,t){var n={},i=Object(e);return N(t,(function(t){t in i&&(n[t]=e[t])})),n}function te(e,t){var n={};return N(Object(e),(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}var ne="__fn",ie=Array.prototype.slice;function re(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function oe(){}re.prototype.on=function(e,t,n,i){if(e=O(e)?e:[e],R(t)&&(i=n,n=t,t=1e3),!D(t))throw new Error("priority must be a number");var r=n;i&&((r=Q(n,i))[ne]=n[ne]||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:r,next:null})}))},re.prototype.once=function(e,t,n,i){var r=this;if(R(t)&&(i=n,n=t,t=1e3),!D(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(i,arguments);return r.off(e,o),t}o[ne]=n,this.on(e,t,o)},re.prototype.off=function(e,t){e=O(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},re.prototype.createEvent=function(e){var t=new oe;return t.init(e),t},re.prototype.fire=function(e,t){var i,r,o,a;if(a=ie.call(arguments),"object"===n(e)&&(e=(t=e).type),!e)throw new Error("no event type specified");if(r=this._listeners[e]){i=t instanceof oe?t:this.createEvent(t),a[0]=i;var s=i.type;e!==s&&(i.type=e);try{o=this._invokeListeners(i,a,r)}finally{e!==s&&(i.type=s)}return void 0===o&&i.defaultPrevented&&(o=!1),o}},re.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},re.prototype._destroy=function(){this._listeners={}},re.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},re.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==i&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return i},re.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));n=i,i=i.next}n.next=t}else this._setListeners(e,t)},re.prototype._getListeners=function(e){return this._listeners[e]},re.prototype._setListeners=function(e,t){this._listeners[e]=t},re.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(;o;)n=o.next,(r=o.callback)!==t&&r[ne]!==t||(i?i.next=n:this._setListeners(e,n)),i=o,o=n;else this._setListeners(e,null)},oe.prototype.stopPropagation=function(){this.cancelBubble=!0},oe.prototype.preventDefault=function(){this.defaultPrevented=!0},oe.prototype.init=function(e){J(this,e||{})};var ae=Object.prototype.toString;function se(){return se=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},se.apply(this,arguments)}function ue(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return se.apply(void 0,[e].concat(n))}var ce=Object.prototype.toString,le=Object.prototype.hasOwnProperty;function de(e){return"[object String]"===ce.call(e)}function pe(e,t){return le.call(e,t)}function he(e,t){var n;if(void 0!==e){var i=function(e){return"[object Array]"===ce.call(e)}(e)?ve:fe;for(var r in e)if(pe(e,r)&&!1===t(n=e[r],i(r)))return n}}function fe(e){return e}function ve(e){return Number(e)}function me(e,t){return e.bind(t)}function ge(){return ge=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ge.apply(this,arguments)}function ye(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ge.apply(void 0,[e].concat(n))}function _e(){}function be(e,t){this.model=e,this.properties=t}_e.prototype.get=function(e){return this.$model.properties.get(this,e)},_e.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},be.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(_e.prototype);he(e.properties,(function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)})),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),he(e,me((function(e,t){this.set(t,e)}),this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var xe={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},we={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}};function Ce(e,t){var n=we[e];return n?n(t):t}function Ee(e){return!!xe[e]}function ke(e){return!!we[e]}function Se(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function je(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function Oe(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,he(e,me(this.registerPackage,this))}function Pe(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function De(e){this.model=e}function Re(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Te(e){this.properties=new De(this),this.factory=new be(this,this.properties),this.registry=new Oe(e,this.properties),this.typeCache={}}je.prototype.build=function(){return e=this,t=["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"],n={},i=Object(e),he(t,(function(t){t in i&&(n[t]=e[t])})),n;var e,t,n,i},je.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},je.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},je.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Se(r[0],i),a=Se(r[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},je.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},je.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},je.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},je.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},je.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},je.prototype.hasProperty=function(e){return this.propertiesByName[e]},je.prototype.addTrait=function(e,t){var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(he(e.properties,me((function(n){n=ye({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[r]=e)},Oe.prototype.getPackage=function(e){return this.packageMap[e]},Oe.prototype.getPackages=function(){return this.packages},Oe.prototype.registerPackage=function(e){e=ye({},e);var t=this.packageMap;Pe(t,e,"prefix"),Pe(t,e,"uri"),he(e.types,me((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Oe.prototype.registerType=function(e,t){var n=Se((e=ye({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:ye(e.meta||{})})).name,t.prefix),i=n.name,r={};he(e.properties,me((function(e){var t=Se(e.name,n.prefix),i=t.name;Ee(e.type)||(e.type=Se(e.type,t.prefix).name),ye(e,{ns:t,name:i}),r[i]=e}),this)),ye(e,{ns:n,name:i,propertiesByName:r}),he(e.extends,me((function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},Oe.prototype.mapTypes=function(e,t,n){var i=Ee(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(e){return a(e,!0)}function a(n,i){var o=Se(n,Ee(n)?"":e.prefix);r.mapTypes(o,t,i)}if(!i)throw new Error("unknown type <"+e.name+">");he(i.superClass,n?o:a),t(i,!n),he(i.traits,o)},Oe.prototype.getEffectiveDescriptor=function(e){var t=Se(e),n=new je(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Oe.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},De.prototype.set=function(e,t,n){if(!de(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.model.getPropertyDescriptor(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[t]:i?r in e?e[r]=n:Re(e,i,n):e.$attrs[t]=n},De.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var i=n.name;return!e[i]&&n.isMany&&Re(e,n,[]),e[i]},De.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;delete(n=ye({},n,{get:function(){return i}})).value}Object.defineProperty(e,t,n)},De.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},De.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Te.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Te.prototype.getType=function(e){var t=this.typeCache,n=de(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Te.prototype.createAny=function(e,t,n){var i=Se(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),he(n,(function(e,t){var n;n=e,"[object Object]"===ce.call(n)&&void 0!==e.value?r[e.name]=e.value:r[t]=e})),r},Te.prototype.getPackage=function(e){return this.registry.getPackage(e)},Te.prototype.getPackages=function(){return this.registry.getPackages()},Te.prototype.getElementDescriptor=function(e){return e.$descriptor},Te.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},Te.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Te.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Me=Object.prototype.toString,Ie=Object.prototype.hasOwnProperty;function Ae(e){return"[object Array]"===Me.call(e)}function Ne(e){return"[object String]"===Me.call(e)}function Be(e,t){return Ie.call(e,t)}function Le(e,t){var n;return t=ze(t),Ve(e,(function(e,i){if(t(e,i))return n=e,!1})),n}function $e(e,t){var n=[];return Ve(e,(function(e,i){t(e,i)&&n.push(e)})),n}function Ve(e,t){var n;if(void 0!==e){var i=Ae(e)?Ue:Fe;for(var r in e)if(Be(e,r)&&!1===t(n=e[r],i(r)))return n}}function ze(e){return t=e,"[object Function]"===(n=Me.call(t))||"[object AsyncFunction]"===n||"[object GeneratorFunction]"===n||"[object AsyncGeneratorFunction]"===n||"[object Proxy]"===n?e:function(t){return t===e};var t,n}function Fe(e){return e}function Ue(e){return Number(e)}function He(){return He=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},He.apply(this,arguments)}function We(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return He.apply(void 0,[e].concat(n))}var qe=String.fromCharCode,Ge=Object.prototype.hasOwnProperty,Ke=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,Xe={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Ye(e,t,n,i){return i?Ge.call(Xe,i)?Xe[i]:"&"+i+";":qe(t||parseInt(n,16))}function Ze(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(Ke,Ye):e}Object.keys(Xe).forEach((function(e){Xe[e.toUpperCase()]=Xe[e]}));var Qe="xsi:type",Je="non-whitespace outside of root node";function et(e){return new Error(e)}function tt(e){return"missing namespace for prefix <"+e+">"}function nt(e){return{get:e,enumerable:!0}}function it(e){var t,n={};for(t in e)n[t]=e[t];return n}function rt(e){return e+"$uri"}function ot(){return{line:0,column:0}}function at(e){throw e}function st(e){if(!this)return new st(e);var t,i,r,o,a,s,u,c,l,d=e&&e.proxy,p=at,h=ot,f=!1,v=!1,m=null,g=!1;function y(e){e instanceof Error||(e=et(e)),m=e,p(e,h)}function _(e){a&&(e instanceof Error||(e=et(e)),a(e,h))}this.on=function(e,n){if("function"!=typeof n)throw et("required args <name, cb>");switch(e){case"openTag":i=n;break;case"text":t=n;break;case"closeTag":r=n;break;case"error":p=n;break;case"warn":a=n;break;case"cdata":o=n;break;case"attention":c=n;break;case"question":u=n;break;case"comment":s=n;break;default:throw et("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!==n(e))throw et("required args <nsMap={}>");var t,i={};for(t in e)i[t]=e[t];return i["http://www.w3.org/2001/XMLSchema-instance"]="xsi",v=!0,l=i,this},this.parse=function(e){if("string"!=typeof e)throw et("required args <xml=string>");return m=null,function(e){var n,a,p,m,b,x,w,C,E,k,S,j=v?[]:null,O=v?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[rt(n)]=t;return i}(l):null,P=[],D=0,R=!1,T=!1,M=0,I=0,A="",N=0;function B(){if(null!==S)return S;var e,t,n,i,r,o,a,s,u,c,d,p=v&&O.xmlns,h=v&&f?[]:null,m=N,g=A,y=g.length,b={},x={};e:for(;m<y;m++)if(u=!1,!(32===(c=g.charCodeAt(m))||c<14&&c>8)){for((c<65||c>122||c>90&&c<97)&&95!==c&&58!==c&&(_("illegal first char attribute name"),u=!0),d=m+1;d<y;d++)if(!((c=g.charCodeAt(d))>96&&c<123||c>64&&c<91||c>47&&c<59||46===c||45===c||95===c)){if(32===c||c<14&&c>8){_("missing attribute value"),m=d;continue e}if(61===c)break;_("illegal attribute name char"),u=!0}if("xmlns:xmlns"===(s=g.substring(m,d))&&(_("illegal declaration of xmlns"),u=!0),34===(c=g.charCodeAt(d+1)))-1===(d=g.indexOf('"',m=d+2))&&-1!==(d=g.indexOf("'",m))&&(_("attribute value quote missmatch"),u=!0);else if(39===c)-1===(d=g.indexOf("'",m=d+2))&&-1!==(d=g.indexOf('"',m))&&(_("attribute value quote missmatch"),u=!0);else for(_("missing attribute value quotes"),u=!0,d+=1;d<y&&!(32===(c=g.charCodeAt(d+1))||c<14&&c>8);d++);for(-1===d&&(_("missing closing quotes"),d=y,u=!0),u||(o=g.substring(m,d)),m=d;d+1<y&&!(32===(c=g.charCodeAt(d+1))||c<14&&c>8);d++)m===d&&(_("illegal character after attribute end"),u=!0);if(m=d+1,!u)if(s in x)_("attribute <"+s+"> already defined");else if(x[s]=!0,v)if(f){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Ze(o),t=rt(r),!(a=l[e])){if("xmlns"===r||t in O&&O[t]!==e)do{a="ns"+D++}while(void 0!==O[a]);else a=r;l[e]=a}O[r]!==a&&(i||(O=it(O),i=!0),O[r]=a,"xmlns"===r&&(O[rt(a)]=e,p=a),O[t]=e),b[s]=o;continue}h.push(s,o)}else-1!==(c=s.indexOf(":"))?(n=O[s.substring(0,c)])?((s=p===n?s.substr(c+1):n+s.substr(c))===Qe&&(-1!==(c=o.indexOf(":"))?(n=o.substring(0,c),o=(n=O[n]||n)+o.substring(c)):o=p+":"+o),b[s]=o):_(tt(s.substring(0,c))):b[s]=o;else b[s]=o}if(f)for(m=0,y=h.length;m<y;m++){if(s=h[m++],o=h[m],-1!==(c=s.indexOf(":"))){if(!(n=O[s.substring(0,c)])){_(tt(s.substring(0,c)));continue}(s=p===n?s.substr(c+1):n+s.substr(c))===Qe&&(-1!==(c=o.indexOf(":"))?(n=o.substring(0,c),o=(n=O[n]||n)+o.substring(c)):o=p+":"+o)}b[s]=o}return S=b}function L(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,a=0,s=I;M>=a&&(t=i.exec(e))&&!((s=t[0].length+t.index)>M);)r+=1,a=s;return-1==M?(o=s,n=e.substring(I)):0===I?n=e.substring(I,M):(o=M-a,n=-1==I?e.substring(M):e.substring(M,I+1)),{data:n,line:r,column:o}}h=L,d&&(k=Object.create({},{name:nt((function(){return C})),originalName:nt((function(){return E})),attrs:nt(B),ns:nt((function(){return O}))}));for(;-1!==I;){if(-1===(M=60===e.charCodeAt(I)?I:e.indexOf("<",I)))return P.length?y("unexpected end of file"):0===I?y("missing start tag"):void(I<e.length&&e.substring(I).trim()&&_(Je));if(I!==M)if(P.length){if(t&&(t(e.substring(I,M),Ze,h),g))return}else if(e.substring(I,M).trim()&&(_(Je),g))return;if(33===(b=e.charCodeAt(M+1))){if(91===(m=e.charCodeAt(M+2))&&"CDATA["===e.substr(M+3,6)){if(-1===(I=e.indexOf("]]>",M)))return y("unclosed cdata");if(o&&(o(e.substring(M+9,I),h),g))return;I+=3;continue}if(45===m&&45===e.charCodeAt(M+3)){if(-1===(I=e.indexOf("--\x3e",M)))return y("unclosed comment");if(s&&(s(e.substring(M+4,I),Ze,h),g))return;I+=3;continue}}if(63!==b){for(a=M+1;;a++){if(x=e.charCodeAt(a),isNaN(x))return I=-1,y("unclosed tag");if(34===x)a=-1!==(m=e.indexOf('"',a+1))?m:a;else if(39===x)a=-1!==(m=e.indexOf("'",a+1))?m:a;else if(62===x){I=a;break}}if(33!==b){if(S={},47===b){if(R=!1,T=!0,!P.length)return y("missing open tag");if(a=C=P.pop(),m=M+2+a.length,e.substring(M+2,m)!==a)return y("closing tag mismatch");for(;m<I;m++)if(!(32===(b=e.charCodeAt(m))||b>8&&b<14))return y("close tag")}else{if(47===e.charCodeAt(I-1)?(a=C=e.substring(M+1,I-1),R=!0,T=!0):(a=C=e.substring(M+1,I),R=!0,T=!1),!(b>96&&b<123||b>64&&b<91||95===b||58===b))return y("illegal first char nodeName");for(m=1,p=a.length;m<p;m++)if(!((b=a.charCodeAt(m))>96&&b<123||b>64&&b<91||b>47&&b<59||45===b||95===b||46==b)){if(32===b||b<14&&b>8){C=a.substring(0,m),S=null;break}return y("invalid nodeName")}T||P.push(C)}if(v){if(n=O,R&&(T||j.push(n),null===S&&(f=-1!==a.indexOf("xmlns",m))&&(N=m,A=a,B(),f=!1)),E=C,-1!==(b=C.indexOf(":"))){if(!(w=O[C.substring(0,b)]))return y("missing namespace on <"+E+">");C=C.substr(b+1)}else w=O.xmlns;w&&(C=w+":"+C)}if(R&&(N=m,A=a,i&&(d?i(k,Ze,T,h):i(C,B,Ze,T,h),g)))return;if(T){if(r&&(r(d?k:C,Ze,R,h),g))return;v&&(O=R?n:j.pop())}I+=1}else{if(c&&(c(e.substring(M,I+1),Ze,h),g))return;I+=1}}else{if(-1===(I=e.indexOf("?>",M)))return y("unclosed question");if(u&&(u(e.substring(M,I+2),h),g))return;I+=2}}}(e),h=ot,g=!1,m},this.stop=function(){g=!0}}function ut(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var ct={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},lt="xsi:type";function dt(e){return e.xml&&e.xml.serialize}function pt(e){return dt(e)===lt}function ht(e,t){return ut(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function ft(e){return new Error(e)}function vt(e){return e.$descriptor}function mt(e){We(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw ft("expected element");var t,n=this.elementsById,i=vt(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw ft("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function gt(){}function yt(){}function _t(){}function bt(e,t){this.property=e,this.context=t}function xt(e,t){this.element=t,this.propertyDesc=e}function wt(){}function Ct(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Et(e,t,n){Ct.call(this,e,t,n)}function kt(e,t,n){this.model=e,this.context=n}function St(e){e instanceof Te&&(e={model:e}),We(this,{lax:!1},e)}gt.prototype.handleEnd=function(){},gt.prototype.handleText=function(){},gt.prototype.handleNode=function(){},yt.prototype=Object.create(gt.prototype),yt.prototype.handleNode=function(){return this},_t.prototype=Object.create(gt.prototype),_t.prototype.handleText=function(e){this.body=(this.body||"")+e},bt.prototype=Object.create(_t.prototype),bt.prototype.handleNode=function(e){if(this.element)throw ft("expected no sub nodes");return this.element=this.createReference(e),this},bt.prototype.handleEnd=function(){this.element.id=this.body},bt.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},xt.prototype=Object.create(_t.prototype),xt.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Ce(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},wt.prototype=Object.create(_t.prototype),wt.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},Ct.prototype=Object.create(wt.prototype),Ct.prototype.addReference=function(e){this.context.addReference(e)},Ct.prototype.handleText=function(e){if(!vt(this.element).bodyProperty)throw ft("unexpected body text <"+e+">");_t.prototype.handleText.call(this,e)},Ct.prototype.handleEnd=function(){var e=this.body,t=this.element,n=vt(t).bodyProperty;n&&void 0!==e&&(e=Ce(n.type,e),t.set(n.name,e))},Ct.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,r=vt(i),o=this.context,a=new i({}),s=this.model;return Ve(n,(function(e,n){var i=r.propertiesByName[n];i&&i.isReference?i.isMany?Ve(e.split(" "),(function(e){o.addReference({element:a,property:i.ns.name,id:e})})):o.addReference({element:a,property:i.ns.name,id:e}):(i?e=Ce(i.type,e):"xmlns"!==n&&(t=Se(n,r.ns.prefix),s.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:a,property:n,value:e})),a.set(n,e))})),a},Ct.prototype.getPropertyForNode=function(e){var t,n,i=Se(e.name),r=this.type,o=this.model,a=vt(r),s=i.name,u=a.propertiesByName[s];if(u&&!u.isAttr)return pt(u)&&(t=e.attributes[lt])?(t=function(e,t){var n=Se(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,o),We({},u,{effectiveType:vt(n=o.getType(t)).name})):u;var c=o.getPackage(i.prefix);if(c){if(t=ht(i,c),n=o.getType(t),u=Le(a.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),u)return We({},u,{effectiveType:vt(n).name})}else if(u=Le(a.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),u)return u;throw ft("unrecognized element <"+i.name+">")},Ct.prototype.toString=function(){return"ElementDescriptor["+vt(this.type).name+"]"},Ct.prototype.valueHandler=function(e,t){return new xt(e,t)},Ct.prototype.referenceHandler=function(e){return new bt(e,this.context)},Ct.prototype.handler=function(e){return"Element"===e?new kt(this.model,e,this.context):new Ct(this.model,e,this.context)},Ct.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,ke(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(We(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},Et.prototype=Object.create(Ct.prototype),Et.prototype.createElement=function(e){var t=e.name,n=Se(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&ht(n,o)||t;if(!r.hasType(a))throw ft("unexpected element <"+e.originalName+">");return Ct.prototype.createElement.call(this,e)},kt.prototype=Object.create(wt.prototype),kt.prototype.createElement=function(e){var t=e.name,n=Se(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},kt.prototype.handleChild=function(e){var t=new kt(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},kt.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},St.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ct?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,a=new mt(We({},t,{rootHandler:i})),s=new st({proxy:!0}),u=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var i=t(),r=i.line,o=i.column,s=i.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var u="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:u,error:e}),!0;throw ft(u)}function l(e,t){return c(e,t,!0)}i.context=a,u.push(i);var d=/^<\?xml /i,p=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function f(e,t){try{u.peek().handleText(e)}catch(e){l(e,t)}}var v=r.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return s.ns(v).on("openTag",(function(e,t,n,i){var r=e.attrs||{},a=Object.keys(r).reduce((function(e,n){var i=t(r[n]);return e[n]=i,e}),{});!function(e,t){var n=u.peek();try{u.push(n.handleNode(e))}catch(e){c(e,t,o)&&u.push(new yt)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},i)})).on("question",(function(e){if(d.test(e)){var t=p.exec(e),n=t&&t[1];n&&!h.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){u.pop().handleEnd()})).on("cdata",f).on("text",(function(e,t,n){!function(e,t){e.trim()&&f(e,t)}(t(e),n)})).on("error",c).on("warn",l),new Promise((function(t,n){var r;try{s.parse(e),function(){var e,t,n=a.elementsById,i=a.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],s=vt(r).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var u=r.get(s.name),c=u.indexOf(t);-1===c&&(c=u.length),o?u[c]=o:u.splice(c,1)}else r.set(s.name,o)}}()}catch(e){r=e}var o=i.element;r||o||(r=ft("failed to parse document as <"+i.type.$descriptor.name+">"));var u=a.warnings,c=a.references,l=a.elementsById;return r?(r.warnings=u,n(r)):t({rootElement:o,elementsById:l,references:c,warnings:u})}))},St.prototype.handler=function(e){return new Et(this.model,e)};var jt=/<|>|'|"|&|\n\r|\n/g,Ot=/<|>|&/g;function Pt(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(t){var n=t.uri,r=this.getNSKey(t);i[r]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(r,o).filter((function(e){var n=t.getNSKey(e);return i[n]}))}}function Dt(e,t){return ut(t)?(n=e).charAt(0).toLowerCase()+n.slice(1):e;var n}function Rt(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Tt(e){return Ne(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var Mt={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},It={"<":"lt",">":"gt","&":"amp"};function At(e,t,n){return(e=Ne(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function Nt(e){this.tagName=e}function Bt(){}function Lt(e){this.tagName=e}function $t(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function Vt(e,t){$t.call(this,e,t)}function zt(){this.value="",this.write=function(e){this.value+=e}}function Ft(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join("  ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function Ut(e){return e=We({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new zt,r=new Ft(i,e.format);if(e.preamble&&r.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new $t).build(t).serializeTo(r),!n)return i.value}}}function Ht(e,t){Te.call(this,e,t)}Nt.prototype.build=function(e){return this.element=e,this},Nt.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},Bt.prototype.serializeValue=Bt.prototype.serializeTo=function(e){e.append(this.escape?At(this.value,Ot,It):this.value)},Bt.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Ot)&&(this.escape=!0),this},Rt(Lt,Bt),Lt.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},$t.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){return $e(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!Be(e,n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)}))}(e),this.parseAttributes(function(e){return $e(e,(function(e){return e.isAttr}))}(n)),this.parseContainments(function(e){return $e(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},$t.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?We({localName:t.ns.localName},e):We({localName:Dt(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},$t.prototype.nsPropertyTagName=function(e){return function(e,t){return We({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},$t.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},$t.prototype.nsAttributeName=function(e){var t;if(t=Ne(e)?Se(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:We({localName:t.localName},n)},$t.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return Ve(e,(function(r,o){"$body"===o?n.push((new Bt).build({type:"String"},r)):"$children"===o?Ve(r,(function(e){n.push(new $t(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})})),i},$t.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=Se(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var a=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(a)}},$t.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return Ve(i,(function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)})),r},$t.prototype.parseGenericAttributes=function(e,t){var n=this;Ve(t,(function(t){if(t.name!==lt)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},$t.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;Ve(e,(function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new Bt).build(e,r[0]));else if(ke(e.type))Ve(r,(function(i){n.push(new Lt(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(o)Ve(r,(function(i){n.push(new Nt(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var a=pt(e),s=function(e){return"property"===dt(e)}(e);Ve(r,(function(i){var r;r=a?new Vt(t,e):s?new $t(t,e):new $t(t),n.push(r.build(i))}))}}))},$t.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new Pt(t):n=t),n},$t.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)&&!n||i.add(e,t),i.mapPrefix(o,r),e},$t.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,u=e.uri;if(!s&&!u)return{localName:e.localName};if(r=ct[s]||o&&(o.getPackage(s)||{}).uri,!(u=u||r||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(u))){for(n=s,i=1;a.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:u},r===u)}return s&&a.mapPrefix(s,u),e},$t.prototype.parseAttributes=function(e){var t=this,n=this.element;Ve(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];Ve(i,(function(e){r.push(e.id)})),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},$t.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Tt(e)},$t.prototype.addAttribute=function(e,t){var n=this.attrs;Ne(t)&&(t=At(t,jt,Mt));var i=function(e,t){t=ze(t);var n=Ae(e)?-1:void 0;return Ve(e,(function(e,i){if(t(e,i))return n=i,!1})),n}(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),r={name:e,value:t};-1!==i?n.splice(i,1,r):n.push(r)},$t.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}))}(n).concat(t)),Ve(t,(function(t){e.append(" ").append(Tt(t.name)).append('="').append(t.value).append('"')}))},$t.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Bt;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),Ve(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Rt(Vt,$t),Vt.prototype.parseNsAttributes=function(e){var t=$t.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(lt),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},Vt.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},Ht.prototype=Object.create(Te.prototype),Ht.prototype.fromXML=function(e,t,n){var i;i=t,"[object String]"!==ae.call(i)&&(n=t,t="dmn:Definitions");var r=new St(ue({model:this,lax:!0},n)),o=r.handler(t);return r.fromXML(e,o)},Ht.prototype.toXML=function(e,t){var n=new Ut(t);return new Promise((function(t,i){try{return t({xml:n.toXML(e)})}catch(e){return i(e)}}))};var Wt={dc:{name:"DC",prefix:"dc",uri:"http://www.omg.org/spec/DMN/20180521/DC/",types:[{name:"Dimension",properties:[{name:"width",isAttr:!0,type:"Real"},{name:"height",isAttr:!0,type:"Real"}]},{name:"Bounds",properties:[{name:"height",isAttr:!0,type:"Real"},{name:"width",isAttr:!0,type:"Real"},{name:"x",isAttr:!0,type:"Real"},{name:"y",isAttr:!0,type:"Real"}]},{name:"Point",properties:[{name:"x",isAttr:!0,type:"Real"},{name:"y",isAttr:!0,type:"Real"}]},{name:"Color",properties:[{name:"red",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"},{name:"green",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"},{name:"blue",type:"UML_Standard_Profile.mdzip:eee_1045467100323_917313_65"}]}],associations:[],enumerations:[{name:"AlignmentKind",literalValues:[{name:"start"},{name:"center"},{name:"end"}]}]},di:{name:"DI",prefix:"di",uri:"http://www.omg.org/spec/DMN/20180521/DI/",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"extension",type:"Extension"},{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"style",isReference:!0,type:"Style",xml:{serialize:"property"}},{name:"sharedStyle",isReference:!0,isVirtual:!0,type:"Style"}]},{name:"Diagram",superClass:["DiagramElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"}]},{name:"Shape",isAbstract:!0,properties:[{name:"bounds",type:"dc:Bounds"}],superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,properties:[{name:"waypoint",type:"dc:Point",isMany:!0,xml:{serialize:"property"}}],superClass:["DiagramElement"]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],enumerations:[],xml:{tagAlias:"lowerCase"}},dmn:{name:"DMN",prefix:"dmn",uri:"https://www.omg.org/spec/DMN/20191111/MODEL/",types:[{name:"AuthorityRequirement",superClass:["DMNElement"],properties:[{name:"requiredAuthority",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"ItemDefinition",superClass:["NamedElement"],properties:[{name:"typeRef",type:"String"},{name:"allowedValues",type:"UnaryTests",xml:{serialize:"property"}},{name:"typeLanguage",type:"String",isAttr:!0},{name:"itemComponent",type:"ItemDefinition",isMany:!0,xml:{serialize:"property"}},{name:"functionItem",type:"FunctionItem"},{name:"isCollection",isAttr:!0,type:"Boolean"}]},{name:"Definitions",superClass:["NamedElement"],properties:[{name:"import",type:"Import",isMany:!0},{name:"itemDefinition",type:"ItemDefinition",isMany:!0},{name:"drgElement",type:"DRGElement",isMany:!0},{name:"artifact",type:"Artifact",isMany:!0},{name:"elementCollection",type:"ElementCollection",isMany:!0},{name:"businessContextElement",type:"BusinessContextElement",isMany:!0},{name:"namespace",type:"String",isAttr:!0},{name:"expressionLanguage",type:"String",isAttr:!0},{name:"typeLanguage",type:"String",isAttr:!0},{name:"exporter",isAttr:!0,type:"String"},{name:"exporterVersion",isAttr:!0,type:"String"},{name:"dmnDI",type:"dmndi:DMNDI"}]},{name:"KnowledgeSource",superClass:["DRGElement"],properties:[{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0},{name:"type",type:"String"},{name:"owner",type:"DMNElementReference",xml:{serialize:"property"}},{name:"locationURI",type:"String",isAttr:!0}]},{name:"DecisionRule",superClass:["DMNElement"],properties:[{name:"inputEntry",type:"UnaryTests",isMany:!0,xml:{serialize:"property"}},{name:"outputEntry",type:"LiteralExpression",isMany:!0,xml:{serialize:"property"}},{name:"annotationEntry",type:"RuleAnnotation",isMany:!0,xml:{serialize:"property"}}]},{name:"Expression",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"typeRef",isAttr:!0,type:"String"}]},{name:"InformationItem",superClass:["NamedElement"],properties:[{name:"typeRef",isAttr:!0,type:"String"}]},{name:"Decision",superClass:["DRGElement"],properties:[{name:"question",type:"String",xml:{serialize:"property"}},{name:"allowedAnswers",type:"String",xml:{serialize:"property"}},{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"informationRequirement",type:"InformationRequirement",isMany:!0},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0},{name:"supportedObjective",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"impactedPerformanceIndicator",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"decisionMaker",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"decisionOwner",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"usingProcess",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"usingTask",isMany:!0,type:"DMNElementReference",xml:{serialize:"property"}},{name:"decisionLogic",type:"Expression"}]},{name:"Invocation",superClass:["Expression"],properties:[{name:"calledFunction",type:"Expression"},{name:"binding",type:"Binding",isMany:!0}]},{name:"OrganisationalUnit",superClass:["BusinessContextElement"],properties:[{name:"decisionMade",type:"Decision",isReference:!0,isMany:!0},{name:"decisionOwned",type:"Decision",isReference:!0,isMany:!0}]},{name:"Import",superClass:["NamedElement"],properties:[{name:"importType",type:"String",isAttr:!0},{name:"locationURI",type:"String",isAttr:!0},{name:"namespace",type:"String",isAttr:!0}]},{name:"InformationRequirement",superClass:["DMNElement"],properties:[{name:"requiredDecision",type:"DMNElementReference",xml:{serialize:"property"}},{name:"requiredInput",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"ElementCollection",superClass:["NamedElement"],properties:[{name:"drgElement",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"DRGElement",isAbstract:!0,superClass:["NamedElement"],properties:[]},{name:"InputData",superClass:["DRGElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}}]},{name:"DMNElement",isAbstract:!0,properties:[{name:"description",type:"String"},{name:"extensionElements",type:"ExtensionElements"},{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extensionAttribute",type:"ExtensionAttribute",isMany:!0},{name:"label",isAttr:!0,type:"String"}]},{name:"InputClause",superClass:["DMNElement"],properties:[{name:"inputExpression",type:"LiteralExpression",xml:{serialize:"property"}},{name:"inputValues",type:"UnaryTests",xml:{serialize:"property"}}]},{name:"DecisionTable",superClass:["Expression"],properties:[{name:"input",type:"InputClause",isMany:!0,xml:{serialize:"property"}},{name:"output",type:"OutputClause",isMany:!0,xml:{serialize:"property"}},{name:"annotation",type:"RuleAnnotationClause",isMany:!0,xml:{serialize:"property"}},{name:"rule",type:"DecisionRule",isMany:!0,xml:{serialize:"property"}},{name:"hitPolicy",type:"HitPolicy",isAttr:!0,default:"UNIQUE"},{name:"aggregation",type:"BuiltinAggregator",isAttr:!0},{name:"preferredOrientation",type:"DecisionTableOrientation",isAttr:!0},{name:"outputLabel",isAttr:!0,type:"String"}]},{name:"LiteralExpression",superClass:["Expression"],properties:[{name:"expressionLanguage",type:"String",isAttr:!0},{name:"text",type:"String"},{name:"importedValues",type:"ImportedValues"}]},{name:"Binding",properties:[{name:"parameter",type:"InformationItem",xml:{serialize:"property"}},{name:"bindingFormula",type:"Expression"}]},{name:"KnowledgeRequirement",superClass:["DMNElement"],properties:[{name:"requiredKnowledge",type:"DMNElementReference",xml:{serialize:"property"}}]},{name:"BusinessKnowledgeModel",superClass:["Invocable"],properties:[{name:"encapsulatedLogic",type:"FunctionDefinition",xml:{serialize:"property"}},{name:"knowledgeRequirement",type:"KnowledgeRequirement",isMany:!0},{name:"authorityRequirement",type:"AuthorityRequirement",isMany:!0}]},{name:"BusinessContextElement",isAbstract:!0,superClass:["NamedElement"],properties:[{name:"URI",type:"String",isAttr:!0}]},{name:"PerformanceIndicator",superClass:["BusinessContextElement"],properties:[{name:"impactingDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"FunctionDefinition",superClass:["Expression"],properties:[{name:"formalParameter",type:"InformationItem",isMany:!0,xml:{serialize:"property"}},{name:"body",type:"Expression"},{name:"kind",type:"FunctionKind",isAttr:!0}]},{name:"Context",superClass:["Expression"],properties:[{name:"contextEntry",type:"ContextEntry",isMany:!0}]},{name:"ContextEntry",superClass:["DMNElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}},{name:"value",type:"Expression"}]},{name:"List",superClass:["Expression"],properties:[{name:"elements",isMany:!0,type:"Expression"}]},{name:"Relation",superClass:["Expression"],properties:[{name:"column",type:"InformationItem",isMany:!0,xml:{serialize:"property"}},{name:"row",type:"List",isMany:!0,xml:{serialize:"property"}}]},{name:"OutputClause",superClass:["DMNElement"],properties:[{name:"outputValues",type:"UnaryTests",xml:{serialize:"property"}},{name:"defaultOutputEntry",type:"LiteralExpression",xml:{serialize:"property"}},{name:"name",isAttr:!0,type:"String"},{name:"typeRef",isAttr:!0,type:"String"}]},{name:"UnaryTests",superClass:["Expression"],properties:[{name:"text",type:"String"},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"NamedElement",isAbstract:!0,superClass:["DMNElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ImportedValues",superClass:["Import"],properties:[{name:"importedElement",type:"String"},{name:"expressionLanguage",type:"String",isAttr:!0}]},{name:"DecisionService",superClass:["Invocable"],properties:[{name:"outputDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"encapsulatedDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"inputDecision",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}},{name:"inputData",type:"DMNElementReference",isMany:!0,xml:{serialize:"property"}}]},{name:"ExtensionElements",properties:[{name:"values",type:"Element",isMany:!0}]},{name:"ExtensionAttribute",properties:[{name:"value",type:"Element"},{name:"valueRef",type:"Element",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Element",isAbstract:!0,properties:[{name:"extensionAttribute",type:"ExtensionAttribute",isAttr:!0,isReference:!0},{name:"elements",type:"ExtensionElements",isAttr:!0,isReference:!0}]},{name:"Artifact",isAbstract:!0,superClass:["DMNElement"],properties:[]},{name:"Association",superClass:["Artifact"],properties:[{name:"sourceRef",type:"DMNElementReference",xml:{serialize:"property"}},{name:"targetRef",type:"DMNElementReference",xml:{serialize:"property"}},{name:"associationDirection",type:"AssociationDirection",isAttr:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",isAttr:!0,type:"String",default:"text/plain"}]},{name:"RuleAnnotationClause",properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"RuleAnnotation",properties:[{name:"text",type:"String"}]},{name:"Invocable",isAbstract:!0,superClass:["DRGElement"],properties:[{name:"variable",type:"InformationItem",xml:{serialize:"property"}}]},{name:"Group",superClass:["Artifact"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"FunctionItem",superClass:["DMNElement"],properties:[{name:"parameters",isMany:!0,type:"InformationItem",xml:{serialize:"property"}},{name:"outputTypeRef",isAttr:!0,type:"String"}]},{name:"DMNElementReference",properties:[{isAttr:!0,name:"href",type:"String"}]}],enumerations:[{name:"HitPolicy",literalValues:[{name:"UNIQUE"},{name:"FIRST"},{name:"PRIORITY"},{name:"ANY"},{name:"COLLECT"},{name:"RULE ORDER"},{name:"OUTPUT ORDER"}]},{name:"BuiltinAggregator",literalValues:[{name:"SUM"},{name:"COUNT"},{name:"MIN"},{name:"MAX"}]},{name:"DecisionTableOrientation",literalValues:[{name:"Rule-as-Row"},{name:"Rule-as-Column"},{name:"CrossTable"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"FunctionKind",literalValues:[{name:"FEEL"},{name:"Java"},{name:"PMML"}]}],associations:[],xml:{tagAlias:"lowerCase"}},dmndi:{name:"DMNDI",prefix:"dmndi",uri:"https://www.omg.org/spec/DMN/20191111/DMNDI/",types:[{name:"DMNDI",properties:[{name:"diagrams",type:"DMNDiagram",isMany:!0},{name:"styles",type:"DMNStyle",isMany:!0}]},{name:"DMNStyle",superClass:["di:Style"],properties:[{name:"fillColor",type:"dc:Color",isAttr:!0},{name:"strokeColor",type:"dc:Color",isAttr:!0},{name:"fontColor",type:"dc:Color",isAttr:!0},{name:"fontSize",isAttr:!0,type:"Real"},{name:"fontFamily",isAttr:!0,type:"String"},{name:"fontItalic",isAttr:!0,type:"Boolean"},{name:"fontBold",isAttr:!0,type:"Boolean"},{name:"fontUnderline",isAttr:!0,type:"Boolean"},{name:"fontStrikeThrough",isAttr:!0,type:"Boolean"},{name:"labelHorizontalAlignment",type:"dc:AlignmentKind",isAttr:!0},{name:"labelVerticalAlignment",type:"dc:AlignmentKind",isAttr:!0}]},{name:"DMNDiagram",superClass:["di:Diagram"],properties:[{name:"dmnElementRef",type:"dmn:DMNElement",isAttr:!0,isReference:!0},{name:"size",type:"Size"},{name:"localStyle",type:"DMNStyle",isVirtual:!0},{name:"sharedStyle",type:"DMNStyle",isVirtual:!0,isReference:!0,redefines:"di:DiagramElement#sharedStyle"},{name:"diagramElements",type:"DMNDiagramElement",isMany:!0}]},{name:"DMNDiagramElement",isAbstract:!0,superClass:["di:DiagramElement"],properties:[{name:"dmnElementRef",type:"dmn:DMNElement",isAttr:!0,isReference:!0},{name:"sharedStyle",type:"DMNStyle",isVirtual:!0,isReference:!0,redefines:"di:DiagramElement#sharedStyle"},{name:"localStyle",type:"DMNStyle",isVirtual:!0},{name:"label",type:"DMNLabel"}]},{name:"DMNLabel",superClass:["di:Shape"],properties:[{name:"text",type:"Text"}]},{name:"DMNShape",superClass:["di:Shape","DMNDiagramElement"],properties:[{name:"isListedInputData",isAttr:!0,type:"Boolean"},{name:"decisionServiceDividerLine",type:"DMNDecisionServiceDividerLine"},{name:"isCollapsed",isAttr:!0,type:"Boolean"}]},{name:"DMNEdge",superClass:["di:Edge","DMNDiagramElement"],properties:[{name:"sourceElement",type:"DMNDiagramElement",isAttr:!0,isReference:!0},{name:"targetElement",type:"DMNDiagramElement",isAttr:!0,isReference:!0}]},{name:"DMNDecisionServiceDividerLine",superClass:["di:Edge"]},{name:"Text",properties:[{name:"text",isBody:!0,type:"String"}]},{name:"Size",superClass:["dc:Dimension"]}],associations:[],enumerations:[]},biodi:{name:"bpmn.io DI for DMN",uri:"http://bpmn.io/schema/dmn/biodi/2.0",prefix:"biodi",xml:{tagAlias:"lowerCase"},types:[{name:"DecisionTable",isAbstract:!0,extends:["dmn:DecisionTable"],properties:[{name:"annotationsWidth",isAttr:!0,type:"Integer"}]},{name:"OutputClause",isAbstract:!0,extends:["dmn:OutputClause"],properties:[{name:"width",isAttr:!0,type:"Integer"}]},{name:"InputClause",isAbstract:!0,extends:["dmn:InputClause"],properties:[{name:"width",isAttr:!0,type:"Integer"}]}]}};function qt(e,t){return new Ht(ue({},Wt,e),t)}function Gt(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var Kt=Object.prototype.toString,Xt=Object.prototype.hasOwnProperty;function Yt(e,t){return Xt.call(e,t)}function Zt(e,t){var n;if(void 0!==e){var i=function(e){return"[object Array]"===Kt.call(e)}(e)?Jt:Qt;for(var r in e)if(Yt(e,r)&&!1===t(n=e[r],i(r)))return n}}function Qt(e){return e}function Jt(e){return Number(e)}function en(e){for(var t=e.style,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Zt(i,(function(e){e&&Zt(e,(function(e,n){t[n]=e}))})),e}function tn(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var nn=Object.prototype.toString;function rn(e){return new on(e)}function on(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function an(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}function sn(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function un(e,t,n){for(var i=n?e:e.parentNode;i&&i.nodeType!==document.DOCUMENT_NODE&&i.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(sn(i,t))return i;i=i.parentNode}return sn(i,t)?i:null}on.prototype.add=function(e){return this.list.add(e),this},on.prototype.remove=function(e){return"[object RegExp]"==nn.call(e)?this.removeMatching(e):(this.list.remove(e),this)},on.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},on.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},on.prototype.array=function(){return Array.from(this.list)},on.prototype.has=on.prototype.contains=function(e){return this.list.contains(e)};var cn,ln,dn,pn={};function hn(){cn=window.addEventListener?"addEventListener":"attachEvent",ln=window.removeEventListener?"removeEventListener":"detachEvent",dn="addEventListener"!==cn?"on":""}var fn=Gt({__proto__:null,bind:pn.bind=function(e,t,n,i){return cn||hn(),e[cn](dn+t,n,i||!1),n},unbind:pn.unbind=function(e,t,n,i){return ln||hn(),e[ln](dn+t,n,i||!1),n},default:pn},[pn]),vn=["focus","blur"];var mn,gn={bind:function(e,t,n,i,r){return-1!==vn.indexOf(n)&&(r=!0),fn.bind(e,n,(function(n){var r=n.target||n.srcElement;n.delegateTarget=un(r,t,!0),n.delegateTarget&&i.call(e,n)}),r)},unbind:function(e,t,n,i){return-1!==vn.indexOf(t)&&(i=!0),fn.unbind(e,t,n,i)}},yn=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){return(r=t.createElement("html")).innerHTML=e,r.removeChild(r.lastChild)}var r,o=Object.prototype.hasOwnProperty.call(bn,i)?bn[i]:bn._default,a=o[0],s=o[1],u=o[2];(r=t.createElement("div")).innerHTML=s+e+u;for(;a--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var c=t.createDocumentFragment();for(;r.firstChild;)c.appendChild(r.removeChild(r.firstChild));return c},_n=!1;"undefined"!=typeof document&&((mn=document.createElement("div")).innerHTML='  <link/><table></table><a href="/a">a</a><input type="checkbox"/>',_n=!mn.getElementsByTagName("link").length,mn=void 0);var bn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:_n?[1,"X<div>","</div>"]:[0,"",""]};bn.td=bn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],bn.option=bn.optgroup=[1,'<select multiple="multiple">',"</select>"],bn.thead=bn.tbody=bn.colgroup=bn.caption=bn.tfoot=[1,"<table>","</table>"],bn.polyline=bn.ellipse=bn.polygon=bn.circle=bn.text=bn.line=bn.path=bn.rect=bn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var xn=yn;function wn(e,t){return(t=t||document).querySelector(e)}function Cn(e,t){return(t=t||document).querySelectorAll(e)}function En(e){e.parentNode&&e.parentNode.removeChild(e)}function kn(e){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var t=arguments.length;if(!(t>=1&&R(arguments[t-1])))return e.apply(this,arguments);var n=arguments[t-1];console.warn(new Error("Passing callbacks to "+Sn(e.name)+" is deprecated and will be removed in a future major release. Please switch to promises: https://bpmn.io/l/moving-to-promises.html"));var i=Array.prototype.slice.call(arguments,0,-1);e.apply(this,i).then((function(e){var t=Object.keys(e)[0];return n(null,e[t])}),(function(e){return n(e,e.warnings)}))}}function Sn(e){return e.replace("bound ","")}function jn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function On(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jn(Object(n),!0).forEach((function(t){Pn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pn(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Dn={width:"100%",height:"100%",position:"relative"},Rn=function(){function e(){var t=this;i(this,e);var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Pn(this,"_viewsChanged",(function(){t._emit("views.changed",{views:t._views,activeView:t._activeView})})),this._eventBus=new re,this._viewsChanged=Y(this._viewsChanged,0),this._views=[],this._viewers={},this.open=kn(this.open.bind(this)),this.importXML=kn(this.importXML.bind(this)),this.saveXML=kn(this.saveXML.bind(this)),this._init(n)}return o(e,[{key:"importXML",value:function(e,t){var n=this;return t=t||{open:!0},new Promise((function(r,o){var a=n._activeView;n._clear().then((function(){var s;e=n._emit("import.parse.start",{xml:e})||e,n._moddle.fromXML(e,"dmn:Definitions").then((function(e){var u=e.rootElement,c=e.references,l=e.elementsById;if(s=e.warnings,u=n._emit("import.parse.complete",i({error:null,definitions:u,elementsById:l,references:c,warnings:s}))||u,n._setDefinitions(u),!t.open)return n._emit("import.done",{error:null,warnings:s}),void r({warnings:s});var d=n._getInitialView(n._views,a);if(!d){var p=new Error("no displayable contents");return n._emit("import.done",{error:p,warnings:s}),p.warnings=s,o(p)}n.open(d).then((function(e){return{warnings:e.warnings}})).catch((function(e){return{error:e,warnings:e.warnings}})).then((function(e){var t=[].concat(s,e.warnings);n._emit("import.done",{error:e.error,warnings:t}),e.error?(e.error.warnings=t,o(e.error)):r({warnings:t})}))})).catch((function(t){return s=t.warnings,t=function(e,t){if("failed to parse document as <dmn:Definitions>"!==e.message)return null;var n=-1!==t.indexOf('"http://www.omg.org/spec/DMN/20151101/dmn.xsd"')?"1.1":-1!==t.indexOf('"http://www.omg.org/spec/DMN/20180521/MODEL/"')&&"1.2";if(!n)return null;return e=new Error("unsupported DMN "+n+" file detected; only DMN 1.3 files can be opened"),console.error("Cannot open what looks like a DMN "+n+" diagram. Please refer to https://bpmn.io/l/dmn-compatibility.html to learn how to make the toolkit compatible with older DMN files",e),e}(t,e)||function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);if(!t)return null;return e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid DMN 1.3 diagram file"+t[2],e}(t)||t,n._emit("import.parse.complete",i({error:t,warnings:s})),n._emit("import.done",{error:t,warnings:s}),t.warnings=s,o(t)}))})).catch((function(e){return n._emit("import.done",{error:e,warnings:[]}),e.warnings=[],o(e)}))}));function i(e){var t=n._eventBus.createEvent(e);return Object.defineProperty(t,"context",{enumerable:!0,get:function(){return console.warn(new Error("import.parse.complete <context> is deprecated and will be removed in future library versions")),{warnings:e.warnings,references:e.references,elementsById:e.elementsById}}}),t}}},{key:"getDefinitions",value:function(){return this._definitions}},{key:"getActiveView",value:function(){return this._activeView}},{key:"getActiveViewer",value:function(){var e=this.getActiveView();return e&&this._getViewer(e)}},{key:"getView",value:function(e){return this._views.filter((function(t){return t.element===e}))[0]}},{key:"getViews",value:function(){return this._views}},{key:"saveXML",value:function(e){var t=this;e=e||{};var n=this._definitions;return new Promise((function(i,r){n?(n=t._emit("saveXML.start",{definitions:n})||n,t._moddle.toXML(n,e).then((function(e){var n=e.xml;return{xml:n=t._emit("saveXML.serialized",{xml:n})||n}})).catch((function(e){return{error:e}})).then((function(e){t._emit("saveXML.done",e),e.error?r(e.error):i({xml:e.xml})}))):r(new Error("no definitions loaded"))}))}},{key:"on",value:function(){var e;(e=this._eventBus).on.apply(e,arguments)}},{key:"off",value:function(){var e;(e=this._eventBus).off.apply(e,arguments)}},{key:"once",value:function(){var e;(e=this._eventBus).once.apply(e,arguments)}},{key:"attachTo",value:function(e){e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=wn(e)),e.appendChild(this._container),this._emit("attach",{})}},{key:"detach",value:function(){this._emit("detach",{}),En(this._container)}},{key:"destroy",value:function(){var e=this;Object.keys(this._viewers).forEach((function(t){An(e._viewers[t],"destroy")})),En(this._container)}},{key:"_init",value:function(e){this._options=e,this._moddle=this._createModdle(e),this._viewers={},this._views=[];var t=xn('<div class="dmn-js-parent"></div>'),n=J({},Dn,e);J(t.style,{width:Tn(n.width),height:Tn(n.height),position:n.position}),this._container=t,e.container&&this.attachTo(e.container)}},{key:"_clear",value:function(){return this._switchView(null)}},{key:"open",value:function(e){return this._switchView(e)}},{key:"_setDefinitions",value:function(e){this._definitions=e,this._updateViews()}},{key:"_updateViews",value:function(){var e=this._definitions;if(!e)return this._views=[],void this._switchView(null);for(var t=this._getViewProviders(),n=[e].concat(y(e.drgElement||[])),i=this._views,r=[],o=0,a=n;o<a.length;o++){var s=a[o],u=I(t,(function(e){return"string"==typeof e.opens?e.opens===s.$type:e.opens(s)}));if(u){var c={element:s,id:s.id,name:s.name,type:u.id};r.push(c)}}var l,d=this._activeView;if(!d||(l=I(r,(function(e){return Mn(d,e)}))||this._getInitialView(r),l)){var p=!Mn(d,l)||In(d,l),h=i.length!==r.length||!L(r,(function(e){return I(i,(function(t){return Mn(t,e)&&!In(t,e)}))}));this._activeView=l,this._views=r,(p||h)&&this._viewsChanged()}else this._switchView(null)}},{key:"_getInitialView",value:function(e,t){var n;return t&&(n=I(e,(function(e){return Mn(e,t)}))||I(e,(function(e){return e.type===t}))),n||e[0]}},{key:"_switchView",value:function(e){var t=this;return new Promise((function(n,i){var r,o=function(e,r){t._viewsChanged(),e?i(e):n(r)},a=t.getActiveView(),s=e&&t._getViewer(e),u=e&&e.element;if(a&&(r=t._getViewer(a))!==s&&(An(r,"clear"),r.detach()),t._activeView=e,s)return r!==s&&s.attachTo(t._container),t._emit("import.render.start",{view:e,element:u}),void s.open(u).then((function(n){t._emit("import.render.complete",{view:e,error:null,warnings:n.warnings}),o(null,n)})).catch((function(n){t._emit("import.render.complete",{view:e,error:n,warnings:n.warnings}),o(n,null)}));o()}))}},{key:"_getViewer",value:function(e){var t=e.type,n=this._viewers[t];return n||(n=this._viewers[t]=this._createViewer(e.type),this._emit("viewer.created",{type:t,viewer:n})),n}},{key:"_createViewer",value:function(e){var t=I(this._getViewProviders(),(function(t){return t.id===e}));if(!t)throw new Error("no provider for view type <"+e+">");var n=t.constructor,i=this._options[e]||{};return new n(On(On(On({},this._options.common||{}),i),{},{additionalModules:[].concat(y(i.additionalModules||[]),[{_parent:["value",this],moddle:["value",this._moddle]}])}))}},{key:"_emit",value:function(){var e;return(e=this._eventBus).fire.apply(e,arguments)}},{key:"_createModdle",value:function(e){return new qt(e.moddleExtensions)}},{key:"_getViewProviders",value:function(){return[]}}]),e}();function Tn(e){return e+(D(e)?"px":"")}function Mn(e,t){return S(e)?!!S(t)&&(e.element===t.element||e.id===t.id):!S(t)}function In(e,t){return!e||!t||e.name!==t.name}function An(e,t){R(e[t])&&e[t]()}var Nn=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=e.exports=function(e,n){if(n||(n=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var o=i-Math.floor(i),a="";for(r=0;r<Math.floor(i);r++){a=Math.floor(Math.random()*n).toString(n)+a}if(o){var s=Math.pow(n,o);a=Math.floor(Math.random()*s).toString(n)+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,e)?t(e,n):a};t.rack=function(e,n,i){var r=function(r){var a=0;do{if(a++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var s=t(e,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=r,s},o=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=n||16,r}}));function Bn(e){if(!(this instanceof Bn))return new Bn(e);e=e||[128,36,1],this._seed=e.length?Nn.rack(e[0],e[1],e[2]):e}function Ln(e,t){var n=zn(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function $n(e){return Ln(e,"dmn:InputClause")}function Vn(e){return Ln(e,"dmn:OutputClause")}function zn(e){return e&&e.businessObject||e}function Fn(e,t){return $(t,(function(t){return Ln(e,t)}))}Bn.prototype.next=function(e){return this._seed(e||!0)},Bn.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},Bn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Bn.prototype.assigned=function(e){return this._seed.get(e)||!1},Bn.prototype.unclaim=function(e){delete this._seed.hats[e]},Bn.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var Un=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"_init",value:function(e){var t=this;v(u(n.prototype),"_init",this).call(this,e),this.on("import.parse.complete",(function(e){e.error||t._collectIds(e.definitions,e.elementsById)})),this.on("destroy",(function(){t._moddle.ids.clear()})),this.on("viewer.created",(function(e){e.viewer.on("elements.changed",(function(e){var n=e.elements.some((function(e){return Fn(e,["dmn:Decision","dmn:Definitions"])}));n&&t._updateViews()}))}))}},{key:"_collectIds",value:function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t)i.claim(n,t[n])}},{key:"_createModdle",value:function(e){var t=v(u(n.prototype),"_createModdle",this).call(this,e);return t.ids=new Bn([32,36,1]),t}}]),n}(Rn);function Hn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}var Wn=/^class[ {]/;function qn(e){return Array.isArray(e)}function Gn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Kn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];1===t.length&&qn(t[0])&&(t=t[0]);var i=(t=y(t)).pop();return i.$inject=t,i}var Xn=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Yn=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Zn=/\/\*([^*]*)\*\//m;function Qn(e){if("function"!=typeof e)throw new Error('Cannot annotate "'.concat(e,'". Expected a function!'));var t=e.toString().match(function(e){return Wn.test(e.toString())}(e)?Xn:Yn);if(!t)return[];var n=t[1]||t[2];return n&&n.split(",").map((function(e){var t=e.match(Zn);return(t&&t[1]||e).trim()}))||[]}function Jn(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw a('No provider for "'.concat(e,'"!'))}};var n=[],i=this._providers=Object.create(t._providers||null),r=this._instances=Object.create(null),o=r.injector=this,a=function(e){var t=n.join(" -> ");return n.length=0,new Error(t?"".concat(e," (Resolving: ").concat(t,")"):e)};function s(e,o){if(!i[e]&&-1!==e.indexOf(".")){for(var u=e.split("."),c=s(u.shift());u.length;)c=c[u.shift()];return c}if(Gn(r,e))return r[e];if(Gn(i,e)){if(-1!==n.indexOf(e))throw n.push(e),a("Cannot resolve circular dependency!");return n.push(e),r[e]=i[e][0](i[e][1]),n.pop(),r[e]}return t.get(e,o)}function u(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!qn(e))throw a('Cannot invoke "'.concat(e,'". Expected a function!'));e=Kn(e.slice())}return{fn:e,dependencies:(e.$inject||Qn(e)).map((function(e){return Gn(t,e)?t[e]:s(e)}))}}function c(e){var t=u(e),n=t.fn,i=t.dependencies;return new(Function.prototype.bind.apply(n,[null].concat(i)))}function l(e,t,n){var i=u(e,n),r=i.fn,o=i.dependencies;return r.apply(t,o)}function d(e,t){if(t&&t.length){var n,r,a,s,u=Object.create(null),c=Object.create(null),l=[],d=[],p=[],h=function(e){var o;n=i[e],-1!==t.indexOf(e)&&("private"===n[2]?-1===(r=l.indexOf(n[3]))?(a=n[3].createChild([],t),o=a,s=Kn((function(e){return o.get(e)})),l.push(n[3]),d.push(a),p.push(s),u[e]=[s,e,"private",a]):u[e]=[p[r],e,"private",d[r]]:u[e]=[n[2],n[1]],c[e]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach((function(t){-1!==n[1].$scope.indexOf(t)&&(u[e]=[n[2],n[1]],c[t]=!0)}))};for(var f in i)h(f);t.forEach((function(e){if(!c[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(u)}return new Jn(e,o)}var p,h,f={factory:l,type:c,value:function(e){return e}};function v(e,t){var n=e.__init__||[];return function(){n.forEach((function(e){"string"==typeof e?t.get(e):t.invoke(e)}))}}function m(e){var t=e.__exports__;if(t){var n=e.__modules__,r=Object.keys(e).reduce((function(t,n){return"__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t}),Object.create(null)),a=d((n||[]).concat(r)),s=Kn((function(e){return a.get(e)}));t.forEach((function(e){i[e]=[s,e,"private",a]}));var u=(e.__init__||[]).slice();return u.unshift((function(){a.init()})),v(e=Object.assign({},e,{__init__:u}),a)}return Object.keys(e).forEach((function(t){if("__init__"!==t&&"__depends__"!==t)if("private"!==e[t][2]){var n=e[t][0],r=e[t][1];i[t]=[f[n],ei(n,r),n]}else i[t]=e[t]})),v(e,o)}function g(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(g,e)).indexOf(t)?e:e.concat(t)}this.get=s,this.invoke=l,this.instantiate=c,this.createChild=d,this.init=(p=e.reduce(g,[]).map(m),h=!1,function(){h||(h=!0,p.forEach((function(e){return e()})))})}function ei(e,t){return"value"!==e&&qn(t)&&(t=Kn(t.slice())),t}function ti(e,t){var n=this;t=t||1e3,e.on(["render.shape","render.connection"],t,(function(e,t){var i=e.type,r=t.element,o=t.gfx,a=t.attrs;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r,a):n.drawConnection(o,r,a)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function ni(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function ii(e,t){return ni(t,e),e}ti.prototype.canRender=function(e){},ti.prototype.drawShape=function(e,t){},ti.prototype.drawConnection=function(e,t){},ti.prototype.getShapePath=function(e){},ti.prototype.getConnectionPath=function(e){};var ri={"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":2,"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":2,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function oi(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ri[i];r?(2===r&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function ai(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return ri[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);oi(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)oi(e,i,t[i])}(e,t);return e}var si=Object.prototype.toString;function ui(e){return new ci(e)}function ci(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function li(e){var t=e.parentNode;return t&&t.removeChild(e),e}function di(e){for(var t;t=e.firstChild;)li(t);return e}function pi(e){return e.cloneNode(!0)}ci.prototype.add=function(e){return this.list.add(e),this},ci.prototype.remove=function(e){return"[object RegExp]"==si.call(e)?this.removeMatching(e):(this.list.remove(e),this)},ci.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},ci.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},ci.prototype.array=function(){return Array.from(this.list)},ci.prototype.has=ci.prototype.contains=function(e){return this.list.contains(e)};var hi="http://www.w3.org/2000/svg",fi='<svg xmlns="'+hi+'"';function vi(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(hi)&&(e=fi+e.substring(4)):(e=fi+">"+e+"</svg>",t=!0);var n=function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function mi(e,t){var n;return"<"===e.charAt(0)?(n=vi(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(hi,e),t&&ai(n,t),n}var gi=null;function yi(){return null===gi&&(gi=mi("svg")),gi}function _i(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function bi(e){return e?yi().createSVGTransformFromMatrix(e):yi().createSVGTransform()}var xi=/([&<>]{1})/g,wi=/([\n\r"]{1})/g,Ci={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Ei(e,t){return e.replace(t,(function(e,t){return Ci[t]||t}))}function ki(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Ei(e.textContent,xi));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Ei(o.value,wi),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)ki(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Ei(e.nodeValue,xi),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Si(e,t){var n=vi(t);if(di(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),o=0;o<r.length;o++)ni(r[o],e)}}function ji(e,t){if(void 0!==t){try{Si(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)ki(t,n),t=t.nextSibling;return n.join("")}(e)}function Oi(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Pi(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(Oi(e,i))}(n,t)),n.consolidate()}function Di(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function Ri(e){return["M",e.x,e.y]}function Ti(e){return["L",e.x,e.y]}function Mi(e,t){for(var n,i,r,o=e.length,a=[Ri(e[0])],s=1;s<o;s++){var u=e[s-1],c=e[s],l=e[s+1];if(l&&t){var d=Math.min(t,Ai(c.x-u.x,c.y-u.y),Ai(l.x-c.x,l.y-c.y));if(d){var p=Ii(c,u,d),h=Ii(c,u,.5*d),f=Ii(c,l,d),v=Ii(c,l,.5*d);a.push(Ti(p)),a.push((i=v,r=f,["C",(n=h).x,n.y,i.x,i.y,r.x,r.y]))}else a.push(Ti(c))}else a.push(Ti(c))}return a}function Ii(e,t,n){var i=t.x-e.x,r=t.y-e.y,o=n/Ai(i,r);return{x:e.x+i*o,y:e.y+r*o}}function Ai(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ni(e,t,n){D(t)&&(n=t,t=null),t||(t={});var i=mi("path",t);return D(n)&&(i.dataset.cornerRadius=String(n)),Bi(i,e)}function Bi(e,t){return ai(e,{d:Di(Mi(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Li(e){return A(e,(function(t){return!I(e,(function(e){return e!==t&&$i(t,e)}))}))}function $i(e,t){if(t){if(e===t)return t;if(e.parent)return $i(e.parent,t)}}function Vi(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function zi(e,t,n){n=n||0,O(e)||(e=[e]),N(e,(function(e,i){var r=t(e,i,n);O(r)&&r.length&&zi(r,t,n+1)}))}function Fi(e,t){return function(e,t,n){var i=[],r=[];return zi(e,(function(e,o,a){Vi(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&Vi(r,s,t))return s})),i}(e,!t,-1)}function Ui(e,t){var n,i,r,o;return t=!!t,O(e)||(e=[e]),N(e,(function(e){var a=e;e.waypoints&&!t&&(a=Ui(e.waypoints,!0));var s=a.x,u=a.y,c=a.height||0,l=a.width||0;(s<n||void 0===n)&&(n=s),(u<i||void 0===i)&&(i=u),(s+l>r||void 0===r)&&(r=s+l),(u+c>o||void 0===o)&&(o=u+c)})),{x:n,y:i,height:o-i,width:r-n}}function Hi(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Wi(e){return!(!e||!e.isFrame)}function qi(e,t){return J({},e||{},t||{})}function Gi(e,t){ti.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Hn(Gi,ti),Gi.prototype.canRender=function(){return!0},Gi.prototype.drawShape=function(e,t,n){var i=mi("rect");return ai(i,{x:0,y:0,width:t.width||0,height:t.height||0}),Wi(t)?ai(i,J({},this.FRAME_STYLE,n||{})):ai(i,J({},this.SHAPE_STYLE,n||{})),ii(e,i),i},Gi.prototype.drawConnection=function(e,t,n){var i=Ni(t.waypoints,J({},this.CONNECTION_STYLE,n||{}));return ii(e,i),i},Gi.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return Di([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},Gi.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return Di(r)},Gi.$inject=["eventBus","styles"];var Ki={__init__:["defaultRenderer"],defaultRenderer:["type",Gi],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){return J(this.style(t,n),{class:e})},this.style=function(t,n){O(t)||n||(n=t,t=[]);var i=B(t,(function(t,n){return J(t,e[n]||{})}),{});return n?J(i,n):i},this.computeStyle=function(e,n,i){return O(n)||(i=n,n=[]),t.style(n||[],J({},i,e||{}))}}]};function Xi(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function Yi(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function Zi(e,t){return e&&t?e.indexOf(t):-1}function Qi(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function Ji(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Qi(e,t);return Math.abs(r/o)<=i}function er(e,t){for(var n=Array.from(arguments).flat(),i={x:"v",y:"h"},r=0,o=Object.entries(i);r<o.length;r++){var a=g(o[r],2),s=a[0],u=a[1];if(tr(s,n))return u}return!1}function tr(e,t){var n=t[0];return L(t,(function(t){return Math.abs(n[e]-t[e])<=2}))}function nr(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var ir="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function rr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}
3/**
4   * This file contains source code adapted from Snap.svg (licensed Apache-2.0).
5   *
6   * @see https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js
7   */var or=/,?([a-z]),?/gi,ar=parseFloat,sr=Math,ur=sr.PI,cr=sr.min,lr=sr.max,dr=sr.pow,pr=sr.abs,hr=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,fr=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,vr=Array.isArray||function(e){return e instanceof Array};function mr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function gr(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)mr(e,n)&&(t[n]=gr(e[n]));return t}function yr(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function _r(e){var t=_r.ps=_r.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)mr(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function br(e,t,n,i){return 1===arguments.length&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function xr(){return this.join(",").replace(or,"$1")}function wr(e){var t=gr(e);return t.toString=xr,t}function Cr(e,t,n,i,r,o,a,s,u){var c=1-u,l=dr(c,3),d=dr(c,2),p=u*u*u,h=l*t+3*d*u*i+3*c*u*u*o+p*s;return{x:Pr(l*e+3*d*u*n+3*c*u*u*r+p*a),y:Pr(h)}}function Er(e){var t=Nr.apply(null,e);return br(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function kr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Sr(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function jr(e,t,n,i,r,o,a,s,u){null==u&&(u=1);for(var c=(u=u>1?1:u<0?0:u)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],p=0,h=0;h<12;h++){var f=c*l[h]+c,v=Sr(f,e,n,r,a),m=Sr(f,t,i,o,s),g=v*v+m*m;p+=d[h]*sr.sqrt(g)}return c*p}function Or(e,t,n,i,r,o,a,s){if(!(lr(e,n)<cr(r,a)||cr(e,n)>lr(r,a)||lr(t,i)<cr(o,s)||cr(t,i)>lr(o,s))){var u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),c=(e-n)*(o-s)-(t-i)*(r-a);if(c){var l=Pr(((e*i-t*n)*(r-a)-(e-n)*(r*s-o*a))/c),d=Pr(u/c),p=+l.toFixed(2),h=+d.toFixed(2);if(!(p<+cr(e,n).toFixed(2)||p>+lr(e,n).toFixed(2)||p<+cr(r,a).toFixed(2)||p>+lr(r,a).toFixed(2)||h<+cr(t,i).toFixed(2)||h>+lr(t,i).toFixed(2)||h<+cr(o,s).toFixed(2)||h>+lr(o,s).toFixed(2)))return{x:l,y:d}}}}function Pr(e){return Math.round(1e11*e)/1e11}function Dr(e,t,n){if(!function(e,t){return e=br(e),kr(t=br(t),e.x,e.y)||kr(t,e.x2,e.y)||kr(t,e.x,e.y2)||kr(t,e.x2,e.y2)||kr(e,t.x,t.y)||kr(e,t.x2,t.y)||kr(e,t.x,t.y2)||kr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(Er(e),Er(t)))return n?0:[];for(var i=jr.apply(0,e),r=jr.apply(0,t),o=Tr(e)?1:~~(i/5)||1,a=Tr(t)?1:~~(r/5)||1,s=[],u=[],c={},l=n?0:[],d=0;d<o+1;d++){var p=Cr.apply(0,e.concat(d/o));s.push({x:p.x,y:p.y,t:d/o})}for(d=0;d<a+1;d++)p=Cr.apply(0,t.concat(d/a)),u.push({x:p.x,y:p.y,t:d/a});for(d=0;d<o;d++)for(var h=0;h<a;h++){var f,v=s[d],m=s[d+1],g=u[h],y=u[h+1],_=pr(m.x-v.x)<.01?"y":"x",b=pr(y.x-g.x)<.01?"y":"x",x=Or(v.x,v.y,m.x,m.y,g.x,g.y,y.x,y.y);if(x){if(c[f=x.x.toFixed(9)+"#"+x.y.toFixed(9)])continue;c[f]=!0;var w=v.t+pr((x[_]-v[_])/(m[_]-v[_]))*(m.t-v.t),C=g.t+pr((x[b]-g[b])/(y[b]-g[b]))*(y.t-g.t);w>=0&&w<=1&&C>=0&&C<=1&&(n?l++:l.push({x:x.x,y:x.y,t1:w,t2:C}))}}return l}function Rr(e){var t=_r(e);if(t.abs)return wr(t.abs);if(vr(e)&&vr(e&&e[0])||(e=function(e){if(!e)return null;var t=_r(e);if(t.arr)return gr(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=[];return vr(e)&&vr(e[0])&&(i=gr(e)),i.length||String(e).replace(hr,(function(e,t,r){var o=[],a=t.toLowerCase();for(r.replace(fr,(function(e,t){t&&o.push(+t)})),"m"==a&&o.length>2&&(i.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L");o.length>=n[a]&&(i.push([t].concat(o.splice(0,n[a]))),n[a]););})),i.toString=_r.toString,t.arr=gr(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,u=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],u++,i[0]=["M",r,o]);for(var c,l,d=u,p=e.length;d<p;d++){if(i.push(c=[]),(n=(l=e[d])[0])!=n.toUpperCase())switch(c[0]=n.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+r,c[7]=+l[7]+o;break;case"V":c[1]=+l[1]+o;break;case"H":c[1]=+l[1]+r;break;case"M":a=+l[1]+r,s=+l[2]+o;default:for(var h=1,f=l.length;h<f;h++)c[h]=+l[h]+(h%2?r:o)}else for(var v=0,m=l.length;v<m;v++)c[v]=l[v];switch(n=n.toUpperCase(),c[0]){case"Z":r=+a,o=+s;break;case"H":r=c[1];break;case"V":o=c[1];break;case"M":a=c[c.length-2],s=c[c.length-1];default:r=c[c.length-2],o=c[c.length-1]}}return i.toString=xr,t.abs=wr(i),i}function Tr(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Mr(e,t,n,i){return[e,t,n,i,n,i]}function Ir(e,t,n,i,r,o){var a=1/3,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function Ar(e,t,n,i,r,o,a,s,u,c){var l,d=120*ur/180,p=ur/180*(+r||0),h=[],f=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return mr(r,i)?(yr(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e.apply(0,n),r[i])}}((function(e,t,n){return{x:e*sr.cos(n)-t*sr.sin(n),y:e*sr.sin(n)+t*sr.cos(n)}}));if(c)C=c[0],E=c[1],x=c[2],w=c[3];else{e=(l=f(e,t,-p)).x,t=l.y;var v=(e-(s=(l=f(s,u,-p)).x))/2,m=(t-(u=l.y))/2,g=v*v/(n*n)+m*m/(i*i);g>1&&(n*=g=sr.sqrt(g),i*=g);var y=n*n,_=i*i,b=(o==a?-1:1)*sr.sqrt(pr((y*_-y*m*m-_*v*v)/(y*m*m+_*v*v))),x=b*n*m/i+(e+s)/2,w=b*-i*v/n+(t+u)/2,C=sr.asin(((t-w)/i).toFixed(9)),E=sr.asin(((u-w)/i).toFixed(9));(C=e<x?ur-C:C)<0&&(C=2*ur+C),(E=s<x?ur-E:E)<0&&(E=2*ur+E),a&&C>E&&(C-=2*ur),!a&&E>C&&(E-=2*ur)}var k=E-C;if(pr(k)>d){var S=E,j=s,O=u;E=C+d*(a&&E>C?1:-1),h=Ar(s=x+n*sr.cos(E),u=w+i*sr.sin(E),n,i,r,0,a,j,O,[E,S,x,w])}k=E-C;var P=sr.cos(C),D=sr.sin(C),R=sr.cos(E),T=sr.sin(E),M=sr.tan(k/4),I=4/3*n*M,A=4/3*i*M,N=[e,t],B=[e+I*D,t-A*P],L=[s+I*T,u-A*R],$=[s,u];if(B[0]=2*N[0]-B[0],B[1]=2*N[1]-B[1],c)return[B,L,$].concat(h);for(var V=[],z=0,F=(h=[B,L,$].concat(h).join().split(",")).length;z<F;z++)V[z]=z%2?f(h[z-1],h[z],p).y:f(h[z],h[z+1],p).x;return V}function Nr(e,t,n,i,r,o,a,s){for(var u,c,l,d,p,h,f,v,m=[],g=[[],[]],y=0;y<2;++y)if(0==y?(c=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,l=3*n-3*e):(c=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,l=3*i-3*t),pr(u)<1e-12){if(pr(c)<1e-12)continue;0<(d=-l/c)&&d<1&&m.push(d)}else f=c*c-4*l*u,v=sr.sqrt(f),f<0||(0<(p=(-c+v)/(2*u))&&p<1&&m.push(p),0<(h=(-c-v)/(2*u))&&h<1&&m.push(h));for(var _,b=m.length,x=b;b--;)_=1-(d=m[b]),g[0][b]=_*_*_*e+3*_*_*d*n+3*_*d*d*r+d*d*d*a,g[1][b]=_*_*_*t+3*_*_*d*i+3*_*d*d*o+d*d*d*s;return g[0][x]=e,g[1][x]=t,g[0][x+1]=a,g[1][x+1]=s,g[0].length=g[1].length=x+2,{x0:cr.apply(0,g[0]),y0:cr.apply(0,g[1]),x1:lr.apply(0,g[0]),y1:lr.apply(0,g[1])}}function Br(e){var t=_r(e);if(t.curve)return wr(t.curve);for(var n=Rr(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(Ar.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(Ir(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(Ir(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(Mr(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(Mr(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(Mr(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(Mr(t.x,t.y,t.X,t.Y))}return e},o=function(e,t){if(e[t].length>7){e[t].shift();for(var i=e[t];i.length;)a[t]="A",e.splice(t++,0,["C"].concat(i.splice(0,6)));e.splice(t,1),l=n.length}},a=[],s="",u="",c=0,l=n.length;c<l;c++){n[c]&&(s=n[c][0]),"C"!=s&&(a[c]=s,c&&(u=a[c-1])),n[c]=r(n[c],i,u),"A"!=a[c]&&"C"==s&&(a[c]="C"),o(n,c);var d=n[c],p=d.length;i.x=d[p-2],i.y=d[p-1],i.bx=ar(d[p-4])||i.x,i.by=ar(d[p-3])||i.y}return t.curve=wr(n),n}var Lr=function(e,t,n){e=Br(e),t=Br(t);for(var i,r,o,a,s,u,c,l,d,p,h=n?0:[],f=0,v=e.length;f<v;f++){var m=e[f];if("M"==m[0])i=s=m[1],r=u=m[2];else{"C"==m[0]?(d=[i,r].concat(m.slice(1)),i=d[6],r=d[7]):(d=[i,r,i,r,s,u,s,u],i=s,r=u);for(var g=0,y=t.length;g<y;g++){var _=t[g];if("M"==_[0])o=c=_[1],a=l=_[2];else{"C"==_[0]?(p=[o,a].concat(_.slice(1)),o=p[6],a=p[7]):(p=[o,a,o,a,c,l,c,l],o=c,a=l);var b=Dr(d,p,n);if(n)h+=b;else{for(var x=0,w=b.length;x<w;x++)b[x].segment1=f,b[x].segment2=g,b[x].bez1=d,b[x].bez2=p;h=h.concat(b)}}}}}return h},$r=Lr;function Vr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function zr(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Fr(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Ur(e){for(var t=e.waypoints,n=t.reduce((function(e,n,i){var r=t[i-1];if(r){var o=e[e.length-1],a=o&&o.endLength||0,s=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(r,n);e.push({start:r,end:n,startLength:a,endLength:a+s,length:s})}return e}),[]),i=n.reduce((function(e,t){return e+t.length}),0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length;return{x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s}}function Hr(e){return function(e){return!!e.waypoints}(e)?Ur(e):Vr({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function Wr(e,t,n){P(n=n||0)||(n={x:n,y:n});var i=zr(e),r=zr(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,u=o?"top":s?"bottom":null,c=i.right+n.x<=r.left?"left":a?"right":null;return c&&u?u+"-"+c:c||u||"intersect"}function qr(e,t,n){var i=function(e,t){return $r(e,t)}(e,t);return 1===i.length||2===i.length&&Qi(i[0],i[1])<1?Vr(i[0]):i.length>1?(i=W(i,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),Vr(i[n?0:i.length-1])):null}function Gr(e,t){return Math.round(e*t)/t}function Kr(e){return D(e)?e+"px":e}function Xr(e,t,n){var i=mi("g");ui(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}var Yr={shape:["x","y","width","height"],connection:["waypoints"]};function Zr(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function Qr(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Zr.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Zr.prototype._init=function(e){var t=this,n=this._eventBus,i=this._container=function(e){var t=(e=J({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),en(n,{position:"relative",overflow:"hidden",width:Kr(e.width),height:Kr(e.height)}),t.appendChild(n),n}(e),r=this._svg=mi("svg");ai(r,{width:"100%",height:"100%"}),ii(i,r);var o=this._viewport=Xr(r,"viewport");!1!==e.deferUpdate&&(this._viewboxChanged=Y(Q(this._viewboxChanged,this),300)),n.on("diagram.init",(function(){n.fire("canvas.init",{svg:r,viewport:o})})),n.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(function(){delete t._cachedViewbox})),n.on("diagram.destroy",500,this._destroy,this),n.on("diagram.clear",500,this._clear,this)},Zr.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Zr.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach((function(t){var n=Hi(t);"root"===n?e.removeRootElement(t):e._removeElement(t,n)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Zr.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Zr.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");var n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Zr.prototype._getChildIndex=function(e){return B(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Zr.prototype._createLayer=function(e,t){void 0===t&&(t=1);var n=this._getChildIndex(t);return{group:Xr(this._viewport,"layer-"+e,n),index:t,visible:!0}},Zr.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;var o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Zr.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=t.group;return t.visible?(li(n),t.visible=!1,n):n},Zr.prototype._removeLayer=function(e){var t=this._layers[e];t&&(delete this._layers[e],li(t.group))},Zr.prototype.getActiveLayer=function(){var e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Zr.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),e){var t=this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{};return t.rootElement}},Zr.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Zr.prototype._findPlaneForRoot=function(e){return I(this._planes,(function(t){return t.rootElement===e}))},Zr.prototype.getContainer=function(){return this._container},Zr.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(N([i.gfx,i.secondaryGfx],(function(e){e&&(n?ui(e).add(t):ui(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Zr.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Zr.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Zr.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),ui(this.getGraphics(e)).has(t)},Zr.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Zr.prototype.getRootElement=function(){var e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Zr.prototype.addRootElement=function(e){var t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});var n=e.layer="root-"+t;this._ensureValid("root",e);var i=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Zr.prototype.removeRootElement=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},Zr.prototype.setRootElement=function(e,t){if(S(t))throw new Error("override not supported");if(e!==this._rootElement){if(!e)throw new Error("rootElement required");return this._findPlaneForRoot(e)||(e=this.addRootElement(e)),this._setRoot(e),e}},Zr.prototype._removeRoot=function(e){var t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Zr.prototype._addRoot=function(e,t){var n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Zr.prototype._setRoot=function(e,t){var n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Zr.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");var n=Yr[e],i=L(n,(function(e){return void 0!==t[e]}));if(!i)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Zr.prototype._setParent=function(e,t,n){Yi(t.children,e,n),e.parent=t},Zr.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Zr.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Zr.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Zr.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),Xi(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Zr.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Zr.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Zr.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Zr.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Zr.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Zr.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,i,r,o,a,s,u=this._viewport,c=this.getSize();return e?(this._changeViewbox((function(){o=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(o).translate(-e.x,-e.y);Pi(u,t)})),e):(t=(i=this._rootElement?this.getActiveLayer():null)&&i.getBBox()||{},n=(r=Pi(u))?r.matrix:function(e,t,n,i,r,o){var a=yi().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return _i(a,e);case 6:return _i(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),o=Gr(n.a,1e3),a=Gr(-n.e||0,1e3),s=Gr(-n.f||0,1e3),e=this._cachedViewbox={x:a?a/o:0,y:s?s/o:0,width:c.width/o,height:c.height/o,scale:o,inner:{width:t.width||0,height:t.height||0,x:t.x||0,y:t.y||0},outer:c})},Zr.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox((function(){e=J({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Qr(t,n)})),{x:n.e,y:n.f}},Zr.prototype.scrollToElement=function(e,t){var n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));var i=this.findRoot(e);i!==this.getRootElement()&&this.setRootElement(i),t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};var r,o,a=Ui(e),s=zr(a),u=this.viewbox(),c=this.zoom();u.y+=t.top/c,u.x+=t.left/c,u.width-=(t.right+t.left)/c,u.height-=(t.bottom+t.top)/c;var l=zr(u);if(a.width<u.width&&a.height<u.height){var d=Math.max(0,s.right-l.right),p=Math.min(0,s.left-l.left),h=Math.max(0,s.bottom-l.bottom),f=Math.min(0,s.top-l.top);r=d||p,o=h||f}else r=a.x-u.x,o=a.y-u.y;this.scroll({dx:-r*c,dy:-o*c})},Zr.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox((function(){"object"!==n(t)&&(i=this.viewbox().outer,t={x:i.width/2,y:i.height/2}),r=this._setZoom(e,t)})),Gr(r.a,1e3)):this.viewbox(e).scale;var i,r},Zr.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),n={x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},Zr.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,u=a.createSVGMatrix(),c=a.createSVGPoint(),l=(i=s.getCTM()).a;return t?(n=J(c,t).matrixTransform(i.inverse()),r=u.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),o=i.multiply(r)):o=u.scale(e),Qr(this._viewport,o),o},Zr.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Zr.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},Zr.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Jr="data-element-id";function eo(e){this._elements={},this._eventBus=e}eo.$inject=["eventBus"],eo.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ai(t,Jr,i),n&&ai(n,Jr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},eo.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ai(i.gfx,Jr,""),i.secondaryGfx&&ai(i.secondaryGfx,Jr,""),delete t[n])},eo.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},eo.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ai(t,Jr,i),t},eo.prototype.get=function(e){var t;t="string"==typeof e?e:e&&ai(e,Jr);var n=this._elements[t];return n&&n.element},eo.prototype.filter=function(e){var t=[];return this.forEach((function(n,i){e(n,i)&&t.push(n)})),t},eo.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=t[n[i]],o=r.element;if(e(o,r.gfx))return o}},eo.prototype.getAll=function(){return this.filter((function(e){return e}))},eo.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)}))},eo.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},eo.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var to={},no={get exports(){return to},set exports(e){to=e}},io={};io.extend=function(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if(void 0===n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},io.isExtended=function(e){return!0===e.__refs_collection};var ro=io;function oo(e,t,n){var i=ro.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach((function(i){e.set(i,t.inverse,n)}))}function ao(e,t){if(!(this instanceof ao))return new ao(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}ao.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?oo(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},ao.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return ro.isExtended(n)||oo(this,t,e),n},ao.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},ao.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},ao.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var so=ao;!function(e){e.exports=so,e.exports.Collection=io}(no);var uo=rr(to),co=new uo({name:"children",enumerable:!0,collection:!0},{name:"parent"}),lo=new uo({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),po=new uo({name:"attachers",collection:!0},{name:"host"}),ho=new uo({name:"outgoing",collection:!0},{name:"source"}),fo=new uo({name:"incoming",collection:!0},{name:"target"});function vo(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),co.bind(this,"parent"),lo.bind(this,"labels"),ho.bind(this,"outgoing"),fo.bind(this,"incoming")}function mo(){vo.call(this),co.bind(this,"children"),po.bind(this,"host"),po.bind(this,"attachers")}function go(){mo.call(this)}function yo(){mo.call(this),lo.bind(this,"labelTarget")}function _o(){vo.call(this),ho.bind(this,"source"),fo.bind(this,"target")}Hn(mo,vo),Hn(go,mo),Hn(yo,mo),Hn(_o,vo);var bo={connection:_o,shape:mo,label:yo,root:go};function xo(){this._uid=12}function wo(e){return e.childNodes[0]}function Co(e,t,n){var i=bi();i.setTranslate(t,n),Pi(e,i)}function Eo(e,t){this._eventBus=e,this._elementRegistry=t}function ko(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}xo.prototype.createRoot=function(e){return this.create("root",e)},xo.prototype.createLabel=function(e){return this.create("label",e)},xo.prototype.createShape=function(e){return this.create("shape",e)},xo.prototype.createConnection=function(e){return this.create("connection",e)},xo.prototype.create=function(e,t){return(t=J({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=bo[e];if(!n)throw new Error("unknown type: <"+e+">");return J(new n,t)}(e,t)},Eo.$inject=["eventBus","elementRegistry"],Eo.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n),t||(ui(t=mi("g")).add("djs-children"),ii(n.parentNode,t))):t=n,t},Eo.prototype._clear=function(e){var t=wo(e);return an(t),t},Eo.prototype._createContainer=function(e,t,n,i){var r=mi("g");ui(r).add("djs-group"),void 0!==n?ko(r,t,t.childNodes[n]):ii(t,r);var o=mi("g");ui(o).add("djs-element"),ui(o).add("djs-"+e),i&&ui(o).add("djs-frame"),ii(r,o);var a=mi("g");return ui(a).add("djs-visual"),ii(o,a),o},Eo.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Wi(t))},Eo.prototype.updateContainments=function(e){var t,n=this,i=this._elementRegistry;t=B(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),N(t,(function(e){var t=e.children;if(t){var r=n._getChildrenContainer(e);N(t.slice().reverse(),(function(e){ko(i.getGraphics(e).parentNode,r)}))}}))},Eo.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Eo.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Eo.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Eo.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Eo.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Co(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?ai(n,"display","none"):ai(n,"display","block")}},Eo.prototype.remove=function(e){li(this._elementRegistry.getGraphics(e).parentNode)};var So={__depends__:[Ki],__init__:["canvas"],canvas:["type",Zr],elementRegistry:["type",eo],elementFactory:["type",xo],eventBus:["type",re],graphicsFactory:["type",Eo]};function jo(e){return function(e){var t=new Jn(e);return t.init(),t}([{config:["value",e=e||{}]},So].concat(e.modules||[]))}function Oo(e,t){this.injector=t=t||jo(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}Oo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Oo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var Po=new uo({name:"dmnElementRef",enumerable:!0},{name:"di",configurable:!0});function Do(e,t){var n=[];function i(t){try{var n=t.di&&function(t){if(t.gfx)throw new Error("already rendered "+t.id);return e.element(t)}(t);return n}catch(e){a(e.message,{element:t,error:e})}}function r(e){var t,n;(n=(t=e).dmnElementRef)?n.di?a("multiple DI elements defined for element",{element:n}):(Po.bind(n,"di"),n.di=t):a("no DMN element referenced in element",{element:t})}function o(e){n.push(e)}function a(t,n){e.error(t,n)}return{handleDefinitions:function(t,a){var s=t.dmnDI;if(!s)throw new Error("no dmndi:DMNDI");var u,c=s.diagrams||[];if(a&&-1===c.indexOf(a))throw new Error("diagram not part of dmndi:DMNDI");if(!a&&c&&c.length&&(a=c[0]),!a)throw new Error("no diagram to display");t.di=a,function(e){N(e.diagramElements,r)}(a),u=t,e.root(u),N(t.get("drgElement"),(function(e){i(e),function(e){N(["informationRequirement","knowledgeRequirement","authorityRequirement"],(function(t){N(e[t],(function(e){o((function(){i(e)}))}))}))}(e)})),function(e){N(e,(function(e){Ln(e,"dmn:Association")?function(e){o((function(){i(e)}))}(e):i(e)}))}(t.get("artifact")),N(n,(function(e){e()}))}}}var Ro=new Bn,To="hsl(225, 10%, 15%)";function Mo(e,t,n,i,r,o){ti.call(this,t);var a=Ro.next(),s=i.computeStyle,u={},c=e&&e.defaultFillColor||"white",l=e&&e.defaultStrokeColor||To,d=e&&e.defaultLabelColor;function p(e,t,n){var i=e+"-"+Ao(t)+"-"+Ao(n)+"-"+a;return u[i]||function(e,t,n,i){if("association-start"===t){var r=mi("path");ai(r,{d:"M 11 5 L 1 10 L 11 15"}),h(e,{element:r,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}else if("association-end"===t){var o=mi("path");ai(o,{d:"M 1 5 L 11 10 L 1 15"}),h(e,{element:o,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}else if("information-requirement-end"===t){var a=mi("path");ai(a,{d:"M 1 5 L 11 10 L 1 15 Z"}),h(e,{element:a,attrs:{fill:i,stroke:"none"},ref:{x:11,y:10},scale:1})}else if("knowledge-requirement-end"===t){var s=mi("path");ai(s,{d:"M 1 3 L 11 10 L 1 17"}),h(e,{element:s,attrs:{fill:"none",stroke:i,strokeWidth:2},ref:{x:11,y:10},scale:.8})}else if("authority-requirement-end"===t){var u=mi("circle");ai(u,{cx:3,cy:3,r:3}),h(e,{element:u,attrs:{fill:i,stroke:"none"},ref:{x:3,y:3},scale:.9})}}(i,e,0,n),"url(#"+i+")"}function h(e,t){var n=J({strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},r=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=mi("marker");ai(t.element,n),ii(a,t.element),ai(a,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});var s=wn("defs",o._svg);s||(s=mi("defs"),ii(o._svg,s)),ii(s,a),u[e]=a}function f(e,t,n,i,r,o){P(r)&&(o=r,r=0),r=r||0,o=s(o,{stroke:To,strokeWidth:2,fill:"white"});var a=mi("rect");return ai(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),ai(a,o),ii(e,a),a}function v(e,t,n){var i=r.createText(t||"",n);return tn(i,"class","djs-label"),ii(e,i),i}function m(e,t,n,i){var r=function(e){return zn(e).name}(t);return v(e,r,i=J({box:t,align:n,padding:5,style:{fill:Lo(t,d,l)}},i))}function g(e,t,n){n=s(n,["no-fill"],{strokeWidth:2,stroke:To});var i=mi("path");return ai(i,{d:t}),ai(i,n),ii(e,i),i}var y={"dmn:Decision":function(e,t){var n=f(e,t.width,t.height,0,{stroke:No(t,l),fill:Bo(t,c)});return m(e,t,"center-middle"),n},"dmn:KnowledgeSource":function(e,t){var i=g(e,n.getScaledPath("KNOWLEDGE_SOURCE",{xScaleFactor:1.021,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.075}}),{strokeWidth:2,fill:Bo(t,c),stroke:No(t,l)});return m(e,t,"center-middle"),i},"dmn:BusinessKnowledgeModel":function(e,t){var i=g(e,n.getScaledPath("BUSINESS_KNOWLEDGE_MODEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.3}}),{strokeWidth:2,fill:Bo(t,c),stroke:No(t,l)});return m(e,t,"center-middle"),i},"dmn:InputData":function(e,t){var n=f(e,t.width,t.height,22,{stroke:No(t,l),fill:Bo(t,c)});return m(e,t,"center-middle"),n},"dmn:TextAnnotation":function(e,t){var i=f(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return g(e,n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:No(t,l)}),v(e,Io(t).text||"",{style:{fill:Lo(t,d,l)},box:t,align:"left-top",padding:5}),i},"dmn:Association":function(e,t){var n=Io(t),i=Bo(t,c),r=No(t,l),o={stroke:r,strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"};return"One"!==n.associationDirection&&"Both"!==n.associationDirection||(o.markerEnd=p("association-end",i,r)),"Both"===n.associationDirection&&(o.markerStart=p("association-start",i,r)),_(e,t.waypoints,o)},"dmn:InformationRequirement":function(e,t){var n=Bo(t,c),i=No(t,l),r={stroke:i,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:p("information-requirement-end",n,i)};return _(e,t.waypoints,r)},"dmn:KnowledgeRequirement":function(e,t){var n=Bo(t,c),i=No(t,l),r={stroke:i,strokeWidth:1,strokeDasharray:5,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:p("knowledge-requirement-end",n,i)};return _(e,t.waypoints,r)},"dmn:AuthorityRequirement":function(e,t){var n=Bo(t,c),i=No(t,l),r={stroke:i,strokeWidth:1.5,strokeDasharray:5,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:p("authority-requirement-end",n,i)};return _(e,t.waypoints,r)}};function _(e,t,n){var i=Ni(t,n=s(n,["no-fill"],{stroke:To,strokeWidth:2,fill:"none"}));return ii(e,i),i}this.canRender=function(e){return Ln(e,"dmn:DMNElement")||Ln(e,"dmn:InformationRequirement")||Ln(e,"dmn:KnowledgeRequirement")||Ln(e,"dmn:AuthorityRequirement")},this.drawShape=function(e,t){var n=y[t.type];return n?n(e,t):ti.prototype.drawShape.apply(this,[e,t])},this.drawConnection=function(e,t){var n=t.type,i=y[n];return i?i(e,t):ti.prototype.drawConnection.apply(this,[e,t])}}function Io(e){return e.businessObject}function Ao(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function No(e,t){return t}function Bo(e,t){return t}function Lo(e,t,n){return t||No(0,n)}Hn(Mo,ti),Mo.$inject=["config.drdRenderer","eventBus","pathMap","styles","textRenderer","canvas"];var $o={width:150,height:50};function Vo(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(i.width=0),i}catch(e){return{width:0,height:0}}}function zo(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=Vo(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return Fo(e,o,r,i);o=Uo(o,i.width,t)}}function Fo(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}function Uo(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-|\u00AD)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"!==n&&"­"!==n||r.pop();break}r.push(n),o+=n.length}var a=r[r.length-1];return a&&"­"===a&&(r[r.length-1]="-"),r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ho(e){this._config=J({},{size:$o,padding:0,style:{},align:"center-top"},e||{})}Ho.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ho.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ho.prototype.layoutText=function(e,t){var n=J({},this._config.size,t.box),i=J({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return P(e)?J({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(i),u=e.split(/\u00AD?\r?\n/),c=[],l=n.width-o.left-o.right,d=mi("text");for(ai(d,{x:0,y:0}),ai(d,i),ii(function(){var e=document.getElementById("helper-svg");return e||(ai(e=mi("svg"),{id:"helper-svg"}),en(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}(),d);u.length;)c.push(zo(u,l,d));"middle"===r.vertical&&(o.top=o.bottom=0);var p=B(c,(function(e,t,n){return e+(s||t.height)}),0)+o.top+o.bottom,h=B(c,(function(e,t,n){return t.width>e?t.width:e}),0),f=o.top;"middle"===r.vertical&&(f+=(n.height-p)/2),f-=(s||c[0].height)/4;var v=mi("text");return ai(v,i),N(c,(function(e){var t;switch(f+=s||e.height,r.horizontal){case"left":t=o.left;break;case"right":t=(a?h:l)-o.right-e.width;break;default:t=Math.max(((a?h:l)-e.width)/2+o.left,0)}var n=mi("tspan");ai(n,{x:t,y:f}),n.textContent=e.text,ii(v,n)})),li(d),{dimensions:{width:h,height:p},element:v}};function Wo(e){var t=J({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=J({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ho({style:t});this.getExternalLabelBounds=function(e,t){var n=r.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:i});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,n){var i=r.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(i.height))}},this.createText=function(e,t){return r.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Wo.$inject=["config.textRenderer"];var qo=/\{([^{}]+)\}/g,Go=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Ko={__init__:["drdRenderer"],drdRenderer:["type",Mo],textRenderer:["type",Wo],pathMap:["type",function(){this.pathMap={KNOWLEDGE_SOURCE:{d:"m {mx},{my} l 0,{e.y0} c {e.x0},{e.y1} {e.x1},-{e.y2} {e.x2},-{e.y3} c {e.x3},-{e.y4} {e.x4},{e.y5} {e.x5},{e.y6} l 0,-{e.y7}z",width:100,height:65,widthElements:[29.8,48.4,67.2,12.2,19.8,30.8],heightElements:[55.3,19.7,4.2,6.7,2.3,1.6,6.2,54.6]},BUSINESS_KNOWLEDGE_MODEL:{d:"m {mx},{my} l {e.x0},-{e.y0} l {e.x1},0 l 0,{e.y1} l -{e.x2},{e.y2} l -{e.x3},0z",width:125,height:45,widthElements:[13.8,109.2,13.8,109.1],heightElements:[13.2,29.8,13.2]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",width:10,height:30,widthElements:[10],heightElements:[30]}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o={};if(t.position){for(var a=t.containerHeight/r.height*t.yScaleFactor,s=t.containerWidth/r.width*t.xScaleFactor,u=0;u<r.heightElements.length;u++)o["y"+u]=r.heightElements[u]*a;for(var c=0;c<r.widthElements.length;c++)o["x"+c]=r.widthElements[c]*s}var l,d,p=(l=r.d,d={mx:n,my:i,e:o},String(l).replace(qo,(function(e,t){return function(e,t,n){var i=n;return t.replace(Go,(function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))})),i=(null==i||i==n?e:i)+""}(e,t,d)})));return p}}]};function Xo(e,t,n,i){this._eventBus=e,this._canvas=t,this._elementRegistry=i,this._elementFactory=n}function Yo(e,t){return J({id:e.id,type:e.$type,businessObject:e},t)}function Zo(e){return e.split("#").pop()}Xo.$inject=["eventBus","canvas","elementFactory","elementRegistry"],Xo.prototype.root=function(e){var t=this._elementFactory.createRoot(Yo(e));return this._canvas.setRootElement(t),t},Xo.prototype.add=function(e){var t,n,i,r,o,a,s=this._elementFactory,u=this._canvas,c=this._eventBus,l=e.di;if(l.$instanceOf("dmndi:DMNShape"))a=l.bounds,o=Yo(e,{x:Math.round(a.x),y:Math.round(a.y),width:Math.round(a.width),height:Math.round(a.height)}),t=s.createShape(o),u.addShape(t),c.fire("drdElement.added",{element:t,di:l});else{if(!l.$instanceOf("dmndi:DMNEdge"))throw new Error("unknown di for element "+e.id);n=function(e){var t=e.waypoint;if(t)return V(t,(function(e){var t={x:e.x,y:e.y};return J({original:t},t)}))}(l),i=this._getSource(e),r=this._getTarget(e),i&&r&&(o=Yo(e,{hidden:!1,source:i,target:r,waypoints:n}),t=s.createConnection(o),u.addConnection(t),c.fire("drdElement.added",{element:t,di:l}))}return t},Xo.prototype._getSource=function(e){var t,n;if(Ln(e,"dmn:Association")?n=e.sourceRef:Ln(e,"dmn:InformationRequirement")?n=e.requiredDecision||e.requiredInput:Ln(e,"dmn:KnowledgeRequirement")?n=e.requiredKnowledge:Ln(e,"dmn:AuthorityRequirement")&&(n=e.requiredDecision||e.requiredInput||e.requiredAuthority),n&&(t=n.href),t)return this._getShape(Zo(t))},Xo.prototype._getTarget=function(e){return Ln(e,"dmn:Association")?e.targetRef&&this._getShape(Zo(e.targetRef.href)):this._getShape(e.$parent.id)},Xo.prototype._getShape=function(e){return this._elementRegistry.get(e)};var Qo={__depends__:[Ko,{drdImporter:["type",Xo]}]};var Jo={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]};function ea(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function ta(e){return e.originalEvent||e.srcEvent}function na(e,t){ea(e),ea(ta(e))}function ia(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function ra(e,t){return(ta(e)||e).button===t}function oa(e){return ra(e,0)}function aa(e){var t=ta(e)||e;return!!oa(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function sa(e){var t=ta(e)||e;return oa(e)&&t.shiftKey}function ua(e){return!0}function ca(e){return oa(e)||function(e){return ra(e,1)}(e)}function la(e,t,n){var i=this;function r(n,i,r){var o,a;(function(e,t){var n=u[e]||oa;return!n(t)})(n,i)||(r?a=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(a=o,r=t.get(a)),a&&r&&!1===e.fire(n,{element:r,gfx:a,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":ua,"element.mousedown":ca,"element.mouseup":ca,"element.click":ca,"element.dblclick":ca};function c(e,t,n,i){var a=o[n]=function(e){r(n,e)};i&&(u[n]=i),a.$delegate=gn.bind(e,"svg, .djs-element",t,a)}function l(e,t,n){var i=a(n);i&&gn.unbind(e,t,i.$delegate)}e.on("canvas.destroy",(function(e){var t;t=e.svg,N(s,(function(e,n){l(t,n,e)}))})),e.on("canvas.init",(function(e){var t;t=e.svg,N(s,(function(e,n){c(t,n,e)}))})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:i})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:i})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;i.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;i.updateDefaultHit(t,n)}));var d=f("djs-hit djs-hit-stroke"),p=f("djs-hit djs-hit-click-stroke"),h={all:f("djs-hit djs-hit-all"),"click-stroke":p,stroke:d,"no-move":f("djs-hit djs-hit-no-move")};function f(e,t){return t=J({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function v(e,t){var n=h[t];if(!n)throw new Error("invalid hit type <"+t+">");return ai(e,n),e}function m(e,t){ii(e,t)}this.removeHits=function(e){N(Cn(".djs-hit",e),li)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=Ni(t);return v(n,"stroke"),m(e,n),n},this.createBoxHit=function(e,t,n){n=J({x:0,y:0},n);var i=mi("rect");return v(i,t),ai(i,n),m(e,i),i},this.updateDefaultHit=function(e,t){var n=wn(".djs-hit",t);if(n)return e.waypoints?Bi(n,e.waypoints):ai(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=s[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=a,this.registerEvent=c,this.unregisterEvent=l}la.$inject=["eventBus","elementRegistry","styles"];var da={__init__:["interactionEvents"],interactionEvents:["type",la]};function pa(e,t){this.offset=6;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e,t){var i=mi("rect");return ai(i,J({x:10,y:10,rx:4,width:100,height:100},n)),ii(e,i),i}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=wn(".djs-outline",n);o||(o=r(n)),i.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=wn(".djs-outline",n);o||(o=r(n)),i.updateConnectionOutline(o,t)}))}pa.prototype.updateShapeOutline=function(e,t){ai(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},pa.prototype.updateConnectionOutline=function(e,t){var n=Ui(t);ai(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},pa.$inject=["eventBus","styles","elementRegistry"];var ha={__init__:["outline"],outline:["type",pa]};function fa(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}fa.$inject=["eventBus","canvas"],fa.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},fa.prototype.get=function(){return this._selectedElements},fa.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},fa.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();O(e)||(e=e?[e]:[]);var r=this._canvas,o=r.getRootElement();e=e.filter((function(e){var t=r.findRoot(e);return o===t})),t?N(e,(function(e){-1===n.indexOf(e)&&n.push(e)})):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var va="hover",ma="selected";function ga(e,t,n){this._canvas=e;var i=this;function r(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){r(e.element,va)})),t.on("element.out",(function(e){o(e.element,va)})),t.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;N(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,ma)}(e)})),N(n,(function(e){-1===t.indexOf(e)&&function(e){r(e,ma)}(e)})),i._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateSelectionOutline(n.get())}))}function ya(e,t,n,i){e.on("create.end",500,(function(e){var n=e.context,i=n.canExecute,r=n.elements,o=(n.hints||{}).autoSelect;if(i){if(!1===o)return;O(o)?t.select(o):t.select(r.filter(_a))}})),e.on("connect.end",500,(function(e){var n=e.context.connection;n&&t.select(n)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id);I(n,(function(e){return r.id===e.id}))||t.select(r)})),e.on("element.click",(function(e){if(oa(e)){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,a=aa(e)||sa(e);if(r&&o)return a?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,a)}}))}function _a(e){return!e.hidden}ga.$inject=["canvas","eventBus","selection"],ga.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");di(t);var n=e.length>1;if(ui(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var i=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(Ui(e)),r=mi("rect");ai(r,J({rx:3},i)),ui(r).add("djs-selection-outline"),ii(t,r)}},ya.$inject=["eventBus","selection","canvas","elementRegistry"];var ba={__init__:["selectionVisuals","selectionBehavior"],__depends__:[da,ha],selection:["type",fa],selectionVisuals:["type",ga],selectionBehavior:["type",ya]};function xa(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}xa.prototype.next=function(){return this._prefix+ ++this._counter};var wa=new xa("ov");function Ca(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=wa,this._overlayDefaults=J({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),en(o=xn('<div class="djs-overlay-container" />'),{position:"absolute",width:0,height:0}),r.insertBefore(o,r.firstChild),o),this._init()}function Ea(e,t,n){en(e,{left:t+"px",top:n+"px"})}function ka(e,t){e.style.display=!1===t?"none":""}function Sa(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}Ca.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ca.prototype.get=function(e){if(T(e)&&(e={id:e}),T(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?A(t.overlays,q({type:e.type})):t.overlays.slice():[]}return e.type?A(this._overlays,q({type:e.type})):e.id?this._overlays[e.id]:null},Ca.prototype.add=function(e,t,n){if(P(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=J({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Ca.prototype.remove=function(e){var t=this.get(e)||[];O(t)||(t=[t]);var n=this;N(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(En(e.html),En(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}}))},Ca.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},Ca.prototype.show=function(){ka(this._overlayRoot)},Ca.prototype.hide=function(){ka(this._overlayRoot,!1)},Ca.prototype.clear=function(){this._overlays={},this._overlayContainers=[],an(this._overlayRoot)},Ca.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ui(t);i=o.x,r=o.y}Ea(n,i,r),tn(e.html,"data-container-id",t.id)},Ca.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,a=i.left,s=i.top;void 0!==i.right&&(t=o.waypoints?Ui(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?Ui(o).height:o.height,s=-1*i.bottom+n);Ea(r,a||0,s||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ca.prototype._createOverlayContainer=function(e){var t=xn('<div class="djs-overlays" />');en(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Ca.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Sa(this._overlayRoot,n)},Ca.prototype._getOverlayContainer=function(e,t){var n=I(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},Ca.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),T(o)&&(o=xn(o)),n=this._getOverlayContainer(r),en(t=xn('<div class="djs-overlay" data-overlay-id="'+i+'">'),{position:"absolute"}),t.appendChild(o),e.type&&rn(t).add("djs-overlay-"+e.type),ka(t,this._canvas.findRoot(r)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ca.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=!0;(i!==this._canvas.getRootElement()||n&&(S(r)&&r>t.scale||S(o)&&o<t.scale))&&(s=!1),ka(a,s),this._updateOverlayScale(e,t)},Ca.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),S(n)&&t.scale<n&&(r=(1/t.scale||1)*n),S(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),S(r)&&(s="scale("+r+","+r+")"),Sa(a,s)},Ca.prototype._updateOverlaysVisibilty=function(e){var t=this;N(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},Ca.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element;N(t.get({element:n}),(function(e){t.remove(e.id)}));var i=t._getOverlayContainer(n);if(i){En(i.html);var r=t._overlayContainers.indexOf(i);-1!==r&&t._overlayContainers.splice(r,1)}})),e.on("element.changed",500,(function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(N(i.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(i))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&rn(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};var ja={__init__:["overlays"],overlays:["type",Ca]};function Oa(e,t,n){this._eventBus=e,this._canvas=t,this._translate=n,e.on("diagram.init",(function(){this._init()}),this),e.on("import.done",(function(e){e.error||this.update()}),this),this.HTML_MARKUP='<div class="dmn-definitions"><div class="dmn-definitions-name" title="'+this._translate("Definition Name")+'" spellcheck="false"></div><div class="dmn-definitions-id" title="'+this._translate("Definition ID")+'" spellcheck="false"></div></div>'}function Pa(e,t){function n(e,n){rn(t.getContainer()).toggle(e,n)}e.on("palette.create",(function(){n("with-palette",!0)})),e.on("palette.changed",(function(e){n("with-palette-two-column",e.twoColumn)}))}Oa.$inject=["eventBus","canvas","translate"],Oa.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=xn(this.HTML_MARKUP);n.appendChild(i),this.nameElement=wn(".dmn-definitions-name",this._container),this.idElement=wn(".dmn-definitions-id",this._container),gn.bind(i,".dmn-definitions-name, .dmn-definitions-id","mousedown",(function(e){e.stopPropagation()})),t.fire("definitionIdView.create",{html:i})},Oa.prototype.update=function(){var e=this._canvas.getRootElement().businessObject;this.nameElement.textContent=e.name,this.idElement.textContent=e.id},Pa.$inject=["eventBus","canvas"];var Da={__depends__:[Jo],__init__:["definitionPropertiesView","definitionPropertiesPaletteAdapter"],definitionPropertiesView:["type",Oa],definitionPropertiesPaletteAdapter:["type",Pa]},Ra=[{className:"dmn-icon-decision-table",matches:function(e){var t=e.businessObject;return Ln(t,"dmn:Decision")&&Ln(t.decisionLogic,"dmn:DecisionTable")}},{className:"dmn-icon-literal-expression",matches:function(e){var t=e.businessObject;return Ln(t,"dmn:Decision")&&Ln(t.decisionLogic,"dmn:LiteralExpression")}}],Ta=function(){function e(t,n,r,o){var a=this;i(this,e),this._injector=t,this._eventBus=n,this._overlays=r,this._config=o||{enabled:!0},n.on(["shape.added"],(function(e){for(var t=e.element,n=0;n<Ra.length;n++){var i=Ra[n],r=i.matches,o=i.className;r&&r(t)&&a.addOverlay(t,o)}}))}return o(e,[{key:"addOverlay",value:function(e,t){var n=xn('\n      <div class="drill-down-overlay">\n        <span class="'.concat(t,'"></span>\n      </div>\n    ')),i=this._overlays.add(e,{position:{top:2,left:2},html:n});!1!==this._config.enabled&&(rn(n).add("interactive"),this.bindEventListener(e,n,i))}},{key:"bindEventListener",value:function(e,t,n){var i=this,r=this._overlays,o=this._eventBus,a=r._overlayRoot;gn.bind(a,'[data-overlay-id="'+n+'"]',"click",(function(){!1!==o.fire("drillDown.click",{element:e})&&i.drillDown(e)}))}},{key:"drillDown",value:function(e){var t=this._injector.get("_parent",!1);if(!t)return!1;var n=t.getView(e.businessObject);return!!n&&(t.open(n),!0)}}]),e}();Ta.$inject=["injector","eventBus","overlays","config.drillDown"];var Ma={__depends__:[ja],__init__:["drillDown"],drillDown:["type",Ta]},Ia='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21" style="vertical-align:middle"><path fill="#000000" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="#000000" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';
8/**
9   * This file must not be changed or exchanged.
10   *
11   * @see http://bpmn.io/license for more information.
12   */function Aa(e){return e.join(";")}var Na,Ba='<div class="bjs-powered-by-lightbox" style="'+Aa(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+Aa(["width: 100%","height: 100%","background: rgba(40,40,40,0.2)"])+'"></div><div class="notice" style="'+Aa(["position: absolute","left: 50%","top: 40%","transform: translate(-50%)","width: 260px","padding: 10px","background: white","box-shadow: 0 1px 4px rgba(0,0,0,0.3)","font-family: Helvetica, Arial, sans-serif","font-size: 14px","display: flex","line-height: 1.3"])+'"><a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;">'+Ia+'</a><span>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>';var La=["additionalModules","canvas"];function $a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Va(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$a(Object(n),!0).forEach((function(t){za(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function za(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Fa(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ua(e){
13/**
14   * Adds the project logo to the diagram container as
15   * required by the bpmn.io license.
16   *
17   * @see http://bpmn.io/license
18   *
19   * @param {Element} container
20   */
21var t,n;this._container=this._createContainer(),t=this._container,n=xn('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position: absolute; bottom: 15px; right: 15px; z-index: 100;">'+Ia+"</a>"),t.appendChild(n),fn.bind(n,"click",(function(e){Na||(Na=xn(Ba),gn.bind(Na,".backdrop","click",(function(e){document.body.removeChild(Na)}))),document.body.appendChild(Na),e.preventDefault()})),this._init(this._container,e)}function Ha(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Wa(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qa(e){return Math.log(e)/Math.log(10)}function Ga(e,t){var n=qa(e.min),i=qa(e.max);return(Math.abs(n)+Math.abs(i))/t}Hn(Ua,Oo),Ua.prototype.saveSVG=kn((function(e){var t=this;return new Promise((function(e){var n=t.get("canvas"),i=n.getActiveLayer(),r=wn("defs",n._svg),o=ji(i),a=r&&r.outerHTML||"",s=i.getBBox();e({svg:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with dmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+s.width+'" height="'+s.height+'" viewBox="'+s.x+" "+s.y+" "+s.width+" "+s.height+'" version="1.1">'+a+o+"</svg>"})}))})),Ua.prototype.getModules=function(){return this._modules},Ua.prototype.destroy=function(){Oo.prototype.destroy.call(this),En(this._container)},Ua.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ua.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ua.prototype._init=function(e,t){var n=t.additionalModules,i=t.canvas,r=Fa(t,La),o=t.modules||this.getModules(),a=[].concat([{drd:["value",this]}],y(o),y(n||[])),s=Va(Va({},r),{},{canvas:Va(Va({},i),{},{container:e}),modules:a});Oo.call(this,s),t&&t.container&&this.attachTo(t.container)},Ua.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ua.prototype._createContainer=function(){return xn('<div class="dmn-drd-container"></div>')},Ua.prototype.open=function(e){var t=this;return new Promise((function(n,i){var r;try{return t._definitions&&t.clear(),t._definitions=e,function(e,t,n){var i,r=e.get("drdImporter"),o=e.get("eventBus"),a=[];o.fire("import.start",{definitions:t});try{!function(e){new Do({root:function(e){return r.root(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){a.push({message:e,context:t})}}).handleDefinitions(e)}(t)}catch(e){i=e}o.fire("import.done",{error:i,warnings:a}),n(i,a)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):n({warnings:[]})}))},Ua.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach();var t=this._container;e.appendChild(t),this._emit("attach",{}),this.get("canvas").resized()},Ua.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ua.prototype._modules=[Qo,Jo,ba,ja,Da,Ma];var Ka=Math.sign||function(e){return e>=0?1:-1},Xa={min:.2,max:4};function Ya(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Q(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var i=this;t.on("canvas.init",(function(t){i._init(!1!==e.enabled)}))}Ya.$inject=["config.zoomScroll","eventBus","canvas"],Ya.prototype.scroll=function(e){this._canvas.scroll(e)},Ya.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ya.prototype.zoom=function(e,t){var n=Ga(Xa,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},Ya.prototype._handleWheel=function(e){if(!un(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Ka(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Ya.prototype.stepZoom=function(e,t){var n=Ga(Xa,10);this._zoom(e,t,n)},Ya.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=qa(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Xa,s),t)},Ya.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&fn[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},Ya.prototype._init=function(e){this.toggle(e)};var Za={__init__:["zoomScroll"],zoomScroll:["type",Ya]},Qa=/^djs-cursor-.*$/;function Ja(e){var t=rn(document.body);t.removeMatching(Qa),e&&t.add("djs-cursor-"+e)}function es(){Ja(null)}function ts(e,t){function n(){return!1}return t=t||"element.click",e.once(t,5e3,n),function(){e.off(t,n)}}function ns(e,t){var n;function i(i){var r,o=n.start,a=n.button,s=ia(i),u=Wa(s,o);(!n.dragging&&(r=u,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>15)&&(n.dragging=!0,0===a&&ts(e),Ja("grab")),n.dragging)&&(u=Wa(s,n.last||n.start),t.scroll({dx:u.x,dy:u.y}),n.last=s);i.preventDefault()}function r(e){fn.unbind(document,"mousemove",i),fn.unbind(document,"mouseup",r),n=null,es()}e.on("element.mousedown",500,(function(e){return function(e){if(un(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:ia(e)},fn.bind(document,"mousemove",i),fn.bind(document,"mouseup",r),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}ns.$inject=["eventBus","canvas"];var is={__init__:["moveCanvas"],moveCanvas:["type",ns]},rs={},os={get exports(){return rs},set exports(e){rs=e}};!function(e){!function(t,i,r,o){var a,s=["","webkit","Moz","MS","ms","o"],u=i.createElement("div"),c=Math.round,l=Math.abs,d=Date.now;function p(e,t,n){return setTimeout(_(e,n),t)}function h(e,t,n){return!!Array.isArray(e)&&(f(e,n[t],n),!0)}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==o)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function v(e,n,i){var r="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=t.console&&(t.console.warn||t.console.log);return o&&o.call(t.console,r,i),e.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===o||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}:Object.assign;var m=v((function(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;)(!n||n&&e[i[r]]===o)&&(e[i[r]]=t[i[r]]),r++;return e}),"extend","Use `assign`."),g=v((function(e,t){return m(e,t,!0)}),"merge","Use `assign`.");function y(e,t,n){var i,r=t.prototype;(i=e.prototype=Object.create(r)).constructor=e,i._super=r,n&&a(i,n)}function _(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return"function"==n(e)?e.apply(t&&t[0]||o,t):e}function x(e,t){return e===o?t:e}function w(e,t,n){f(S(t),(function(t){e.addEventListener(t,n,!1)}))}function C(e,t,n){f(S(t),(function(t){e.removeEventListener(t,n,!1)}))}function E(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function k(e,t){return e.indexOf(t)>-1}function S(e){return e.trim().split(/\s+/g)}function j(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function O(e){return Array.prototype.slice.call(e,0)}function P(e,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];j(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort((function(e,n){return e[t]>n[t]})):i.sort()),i}function D(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),a=0;a<s.length;){if((i=(n=s[a])?n+r:t)in e)return i;a++}return o}var R=1;function T(e){var n=e.ownerDocument||e;return n.defaultView||n.parentWindow||t}var M="ontouchstart"in t,I=D(t,"PointerEvent")!==o,A=M&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),N="touch",B="mouse",L=24,$=["x","y"],V=["clientX","clientY"];function z(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){b(e.options.enable,[e])&&n.handler(t)},this.init()}function F(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,a=1&t&&i-r==0,s=12&t&&i-r==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=U(t));r>1&&!n.firstMultiple?n.firstMultiple=U(t):1===r&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,u=s?s.center:a.center,c=t.center=H(i);t.timeStamp=d(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=K(u,c),t.distance=G(u,c),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y});t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}(n,t),t.offsetDirection=q(t.deltaX,t.deltaY);var p=W(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=p.x,t.overallVelocityY=p.y,t.overallVelocity=l(p.x)>l(p.y)?p.x:p.y,t.scale=s?(h=s.pointers,f=i,G(f[0],f[1],V)/G(h[0],h[1],V)):1,t.rotation=s?function(e,t){return K(t[1],t[0],V)+K(e[1],e[0],V)}(s.pointers,i):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,i,r,a,s=e.lastInterval||t,u=t.timeStamp-s.timeStamp;if(8!=t.eventType&&(u>25||s.velocity===o)){var c=t.deltaX-s.deltaX,d=t.deltaY-s.deltaY,p=W(u,c,d);i=p.x,r=p.y,n=l(p.x)>l(p.y)?p.x:p.y,a=q(c,d),e.lastInterval=t}else n=s.velocity,i=s.velocityX,r=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=a}(n,t);var h,f;var v=e.element;E(t.srcEvent.target,v)&&(v=t.srcEvent.target);t.target=v}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function U(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:d(),pointers:t,center:H(t),deltaX:e.deltaX,deltaY:e.deltaY}}function H(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:c(n/t),y:c(i/t)}}function W(e,t,n){return{x:t/e||0,y:n/e||0}}function q(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function G(e,t,n){n||(n=$);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function K(e,t,n){n||(n=$);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}z.prototype={handler:function(){},init:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(T(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(T(this.element),this.evWin,this.domHandler)}};var X={mousedown:1,mousemove:2,mouseup:4},Y="mousedown",Z="mousemove mouseup";function Q(){this.evEl=Y,this.evWin=Z,this.pressed=!1,z.apply(this,arguments)}y(Q,z,{handler:function(e){var t=X[e.type];1&t&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:B,srcEvent:e}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},ee={2:N,3:"pen",4:B,5:"kinect"},te="pointerdown",ne="pointermove pointerup pointercancel";function ie(){this.evEl=te,this.evWin=ne,z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(te="MSPointerDown",ne="MSPointerMove MSPointerUp MSPointerCancel"),y(ie,z,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=J[i],o=ee[e.pointerType]||e.pointerType,a=o==N,s=j(t,e.pointerId,"pointerId");1&r&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):12&r&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var re={touchstart:1,touchmove:2,touchend:4,touchcancel:8},oe="touchstart",ae="touchstart touchmove touchend touchcancel";function se(){this.evTarget=oe,this.evWin=ae,this.started=!1,z.apply(this,arguments)}function ue(e,t){var n=O(e.touches),i=O(e.changedTouches);return 12&t&&(n=P(n.concat(i),"identifier",!0)),[n,i]}y(se,z,{handler:function(e){var t=re[e.type];if(1===t&&(this.started=!0),this.started){var n=ue.call(this,e,t);12&t&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:N,srcEvent:e})}}});var ce={touchstart:1,touchmove:2,touchend:4,touchcancel:8},le="touchstart touchmove touchend touchcancel";function de(){this.evTarget=le,this.targetIds={},z.apply(this,arguments)}function pe(e,t){var n=O(e.touches),i=this.targetIds;if(3&t&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=O(e.changedTouches),s=[],u=this.target;if(o=n.filter((function(e){return E(e.target,u)})),1===t)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<a.length;)i[a[r].identifier]&&s.push(a[r]),12&t&&delete i[a[r].identifier],r++;return s.length?[P(o.concat(s),"identifier",!0),s]:void 0}y(de,z,{handler:function(e){var t=ce[e.type],n=pe.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:N,srcEvent:e})}});function he(){z.apply(this,arguments);var e=_(this.handler,this);this.touch=new de(this.manager,e),this.mouse=new Q(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function fe(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,ve.call(this,t)):12&e&&ve.call(this,t)}function ve(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)}),2500)}}function me(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=25&&a<=25)return!0}return!1}y(he,z,{handler:function(e,t,n){var i=n.pointerType==N,r=n.pointerType==B;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)fe.call(this,t,n);else if(r&&me.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var ge=D(u.style,"touchAction"),ye=ge!==o,_e="compute",be="auto",xe="manipulation",we="none",Ce="pan-x",Ee="pan-y",ke=function(){if(!ye)return!1;var e={},n=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){e[i]=!n||t.CSS.supports("touch-action",i)})),e}();function Se(e,t){this.manager=e,this.set(t)}Se.prototype={set:function(e){e==_e&&(e=this.compute()),ye&&this.manager.element.style&&ke[e]&&(this.manager.element.style[ge]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,(function(t){b(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(k(e,we))return we;var t=k(e,Ce),n=k(e,Ee);if(t&&n)return we;if(t||n)return t?Ce:Ee;if(k(e,xe))return xe;return be}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=k(i,we)&&!ke[we],o=k(i,Ee)&&!ke[Ee],a=k(i,Ce)&&!ke[Ce];if(r){var s=1===e.pointers.length,u=e.distance<2,c=e.deltaTime<250;if(s&&u&&c)return}if(!a||!o)return r||o&&6&n||a&&n&L?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var je=32;function Oe(e){this.options=a({},this.defaults,e||{}),this.id=R++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Pe(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function De(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Re(e,t){var n=t.manager;return n?n.get(e):e}function Te(){Oe.apply(this,arguments)}function Me(){Te.apply(this,arguments),this.pX=null,this.pY=null}function Ie(){Te.apply(this,arguments)}function Ae(){Oe.apply(this,arguments),this._timer=null,this._input=null}function Ne(){Te.apply(this,arguments)}function Be(){Te.apply(this,arguments)}function Le(){Oe.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function $e(e,t){return(t=t||{}).recognizers=x(t.recognizers,$e.defaults.preset),new Ve(e,t)}Oe.prototype={defaults:{},set:function(e){return a(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Re(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)||(e=Re(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===j(t,e=Re(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Re(e,this);var t=j(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<8&&i(t.options.event+Pe(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=8&&i(t.options.event+Pe(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=je},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=a({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=je);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},y(Te,Oe,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=6&t,r=this.attrTest(e);return i&&(8&n||!r)?16|t:i||r?4&n?8|t:2&t?4|t:2:je}}),y(Me,Te,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(Ee),e&L&&t.push(Ce),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(6&t.direction?(r=0===o?1:o<0?2:4,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?1:a<0?8:16,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return Te.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=De(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),y(Ie,Te,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[we]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),y(Ae,Oe,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[be]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||12&e.eventType&&!r)this.reset();else if(1&e.eventType)this.reset(),this._timer=p((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return je},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=d(),this.manager.emit(this.options.event,this._input)))}}),y(Ne,Te,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[we]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),y(Be,Te,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Me.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return 30&n?t=e.overallVelocity:6&n?t=e.overallVelocityX:n&L&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=De(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),y(Le,Oe,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[xe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(i&&r&&n){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||G(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=p((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return je},failTimeout:function(){return this._timer=p((function(){this.state=je}),this.options.interval,this),je},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),$e.VERSION="2.0.7",$e.defaults={domEvents:!1,touchAction:_e,enable:!0,inputTarget:null,inputClass:null,preset:[[Ne,{enable:!1}],[Ie,{enable:!1},["rotate"]],[Be,{direction:6}],[Me,{direction:6},["swipe"]],[Le],[Le,{event:"doubletap",taps:2},["tap"]],[Ae]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ve(e,t){var n;this.options=a({},$e.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((n=this).options.inputClass||(I?ie:A?de:M?he:Q))(n,F),this.touchAction=new Se(this,this.options.touchAction),ze(this,!0),f(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function ze(e,t){var n,i=e.element;i.style&&(f(e.options.cssProps,(function(r,o){n=D(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}Ve.prototype={set:function(e){return a(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&14&n.state&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof Oe)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=j(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==o&&t!==o){var n=this.handlers;return f(S(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==o){var n=this.handlers;return f(S(e),(function(e){t?n[e]&&n[e].splice(j(n[e],t),1):delete n[e]})),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var n=i.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t,t.target.dispatchEvent(n)}(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&ze(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},a($e,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:je,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:L,DIRECTION_ALL:30,Manager:Ve,Input:z,TouchAction:Se,TouchInput:de,MouseInput:Q,PointerEventInput:ie,TouchMouseInput:he,SingleTouchInput:se,Recognizer:Oe,AttrRecognizer:Te,Tap:Le,Pan:Me,Swipe:Be,Pinch:Ie,Rotate:Ne,Press:Ae,on:w,off:C,each:f,merge:g,extend:m,assign:a,inherit:y,bindFn:_,prefixed:D}),(void 0!==t?t:"undefined"!=typeof self?self:{}).Hammer=$e,e.exports?e.exports=$e:t.Hammer=$e}(window,document)}(os);var as=rs,ss=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function us(e,t){return t.get(e,!1)}function cs(e){e.preventDefault(),"function"==typeof e.stopPropagation?e.stopPropagation():e.srcEvent&&"function"==typeof e.srcEvent.stopPropagation&&e.srcEvent.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function ls(e){function t(t){setTimeout((function(){N(ss,(function(t){fn.unbind(e,t,cs,!0)}))}),500)}fn.bind(e,"touchstart",(function(t){N(ss,(function(t){fn.bind(e,t,cs,!0)}))}),!0),fn.bind(e,"touchend",t,!0),fn.bind(e,"touchcancel",t,!0);var n=new as.Manager(e,{inputClass:as.TouchInput,recognizers:[],domEvents:!0}),i=new as.Tap,r=new as.Pan({threshold:10}),o=new as.Press,a=new as.Pinch,s=new as.Tap({event:"doubletap",taps:2});return a.requireFailure(r),a.requireFailure(o),n.add([r,o,a,s,i]),n.reset=function(e){var t=this.recognizers,i=this.session;i.stopped||(n.stop(e),setTimeout((function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;i.curRecognizer=null}),0))},n.on("hammer.input",(function(e){e.srcEvent.defaultPrevented&&n.reset(!0)})),n}function ds(e,t,n,i,r){var o,a=us("dragging",e),s=us("move",e),u=us("contextPad",e),c=us("palette",e);function l(e,t){return function(n){var o=d(n.target),a=o&&i.get(o);return t&&(n.srcEvent.button=t),r.fire(e,n,a)}}function d(e){return un(e,"svg, .djs-element",!0)}function p(e){function n(e){var n=d(e.target),r=n&&i.get(n);if(s&&t.getRootElement()!==r)return s.start(e,r,!0);!function(e){var n=0,i=0;function r(e){var r=e.deltaX-n,o=e.deltaY-i;t.scroll({dx:r,dy:o}),n=e.deltaX,i=e.deltaY}function a(e){o.off("panmove",r),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",r),o.on("panend",a),o.on("pancancel",a)}()}(o=ls(e)).on("tap",l("element.click")),o.on("doubletap",l("element.dblclick",1)),o.on("panstart",n),o.on("press",n),o.on("pinchstart",(function(e){var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(.2,Math.min(4,r*n));t.zoom(o,i),cs(e)}function a(e){o.off("pinchmove",r),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",r),o.on("pinchend",a),o.on("pinchcancel",a)}))}a&&n.on("drag.move",(function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=ia(t),r=d(document.elementFromPoint(n.x,n.y)),o=r&&i.get(r);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:r}),e.hover=o,e.hoverGfx=r))}})),u&&n.on("contextPad.create",(function(e){var t=ls(e.pad.html);t.on("panstart",(function(e){u.trigger("dragstart",e,!0)})),t.on("press",(function(e){u.trigger("dragstart",e,!0)})),t.on("tap",(function(e){u.trigger("click",e)}))})),c&&n.on("palette.create",(function(e){var t=ls(e.container);t.on("panstart",(function(e){c.trigger("dragstart",e,!0)})),t.on("press",(function(e){c.trigger("dragstart",e,!0)})),t.on("tap",(function(e){c.trigger("click",e)}))})),n.on("canvas.init",(function(e){p(e.svg)}))}function ps(e){var t=this;e.on("canvas.init",(function(e){t.addBBoxMarker(e.svg)}))}ds.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],ps.$inject=["eventBus"],ps.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=mi("rect");ai(n,{x:-1e4,y:1e4,width:10,height:10}),ai(n,t),ii(e,n);var i=mi("rect");ai(i,{x:1e4,y:1e4,width:10,height:10}),ai(i,t),ii(e,i)};var hs={__depends__:[{__depends__:[da],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",ds],touchFix:["type",ps]}]};function fs(e){Ua.call(this,e)}function vs(e){return e&&e[e.length-1]}function ms(e){return e.y}function gs(e){return e.x}Hn(fs,Ua),fs.prototype._navigationModules=[Za,is,hs],fs.prototype._modules=[].concat(fs.prototype._modules,fs.prototype._navigationModules);var ys={left:gs,center:gs,right:function(e){return e.x+e.width},top:ms,middle:ms,bottom:function(e){return e.y+e.height}};function _s(e,t){this._modeling=e,this._rules=t}_s.$inject=["modeling","rules"],_s.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},_s.prototype._isType=function(e,t){return-1!==t.indexOf(e)},_s.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,u={},c={},l=!1;if(this._isType(e,["left","top"]))u[e]=t[0][a];else if(this._isType(e,["right","bottom"]))r=vs(t),u[e]=r[a]+r[s];else if(this._isType(e,["center","middle"])){if(N(t,(function(e){var t=e[a]+Math.round(e[s]/2);c[t]?c[t].elements.push(e):c[t]={elements:[e],center:t}})),n=W(c,(function(e){return e.elements.length>1&&(l=!0),e.elements.length})),l)return u[e]=vs(n).center,u;i=t[0],r=vs(t=W(t,(function(e){return e[a]+e[s]}))),u[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(i,r)}return u},_s.prototype.trigger=function(e,t){var n,i=this._modeling,r=A(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(O(n=this._rules.allowed("elements.align",{elements:r}))&&(r=n),!(r.length<2)&&n){var o=W(r,ys[t]),a=this._alignmentPosition(t,o);i.alignElements(o,a)}};var bs={__init__:["alignElements"],alignElements:["type",_s]};function xs(e,t,n,i){for(var r;r=ws(e,n,t);)n=i(t,n,r);return n}function ws(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e){var t=Cs(e);e.host&&(t=t.concat(Cs(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(Cs(t))}),[])));return t}(e);return I(r,(function(e){return e!==n&&"intersect"===Wr(e,i,10)}))}function Cs(e){return(t=e,t.outgoing.map((function(e){return e.target}))).concat(function(e){return e.incoming.map((function(e){return e.source}))}(e));var t}function Es(){return!0}function ks(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||50,r=Hr(e),o=zr(e);return{x:o.right+i+t.width/2,y:r.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),a=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:a}),a}}function Ss(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}ks.$inject=["eventBus","modeling","canvas"],Ss.$inject=["eventBus","selection"];var js={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ks],autoPlaceSelectionBehavior:["type",Ss]},Os={width:135,height:46},Ps={width:180,height:80},Ds={width:125,height:45},Rs={width:100,height:63};function Ts(e){xo.call(this),this._drdFactory=e}Hn(Ts,xo),Ts.$inject=["drdFactory"],Ts.prototype.baseCreate=xo.prototype.create,Ts.prototype.create=function(e,t){return this.createDrdElement(e,t)},Ts.prototype.createDrdElement=function(e,t){var n,i=this._drdFactory,r=(t=t||{}).businessObject;if(!r){if(!t.type)throw new Error("no shape type specified");r=i.create(t.type)}return r.di||("connection"===e?r.di=i.createDiEdge(r,[]):"shape"===e&&(r.di=i.createDiShape(r,{}))),n=this._getDefaultSize(r),t=J({businessObject:r,id:r.id},n,t),this.baseCreate(e,t)},Ts.prototype._getDefaultSize=function(e){return Ln(e,"dmn:BusinessKnowledgeModel")?Os:Ln(e,"dmn:Decision")?Ps:Ln(e,"dmn:InputData")?Ds:Ln(e,"dmn:KnowledgeSource")?Rs:{width:100,height:80}};var Ms="left",Is="right",As=60,Ns=Ps.width;function Bs(e,t){return Ln(t,"dmn:TextAnnotation")?function(e,t){var n=zr(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};return xs(e,t,i,function(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach((function(o){var a=e[o];if(a){var s="x"===o?"width":"height",u=a.margin,c=a.minDistance;r[o]=u<0?Math.min(i[o]+u-t[s]/2,n[o]-c+u):Math.max(i[o]+i[s]+u+t[s]/2,n[o]+c+u)}})),r}}({y:{margin:-30,minDistance:20}}))}(e,t):Ln(t,"dmn:DRGElement")?function(e,t){var n=zr(e),i=Hr(e);function r(t){return t.target===e?1:-1}var o=function(e,t){t||(t={});var n=t.defaultDistance||50,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},a=t.maxDistance||250,s=t.reference||"start";function u(e,t){return"n"===i?"start"===s?zr(e).top-zr(t).bottom:"center"===s?zr(e).top-Hr(t).y:zr(e).top-zr(t).top:"w"===i?"start"===s?zr(e).left-zr(t).right:"center"===s?zr(e).left-Hr(t).x:zr(e).left-zr(t).left:"s"===i?"start"===s?zr(t).top-zr(e).bottom:"center"===s?Hr(t).y-zr(e).bottom:zr(t).bottom-zr(e).bottom:"start"===s?zr(t).left-zr(e).right:"center"===s?Hr(t).x-zr(e).right:zr(t).right-zr(e).right}r||(r=Es);var c=e.incoming.filter(r).map((function(t){var n=o(t),i=n<0?u(t.source,e):u(e,t.source);return{id:t.source.id,distance:i,weight:n}})),l=e.outgoing.filter(r).map((function(t){var n=o(t),i=n>0?u(e,t.target):u(t.target,e);return{id:t.target.id,distance:i,weight:n}})),d=B(c.concat(l).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,i=t.weight;return n<0||n>a||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return d.distance||n}(e,{defaultDistance:180,direction:"s",getWeight:r,filter:Ls,reference:"center"}),a={x:i.x,y:n.bottom+o};return xs(e,t,a,function(e){var t,n,i=Hr(e);return function(e,r,o){var a;return t?(r.x<i.x?t=o:n=o,a=$s(i,Hr(t))<$s(i,Hr(n))?Ms:Is):(t=o,n=o,a=Hr(o).x-i.x>0?Ms:Is),a===Ms?{x:Math.min(Hr(t).x-Ns-As,zr(t).left-As-e.width/2),y:r.y}:{x:Math.max(Hr(n).x+Ns+As,zr(n).right+As+e.width/2),y:r.y}}}(e))}(e,t):void 0}function Ls(e){return!Ln(e,"dmn:Association")}function $s(e,t){return Math.abs(t.x-e.x)}function Vs(e){e.on("autoPlace",(function(e){var t=e.shape;return Bs(e.source,t)}))}Vs.$inject=["eventBus"];var zs={__depends__:[js],__init__:["dmnAutoPlace"],dmnAutoPlace:["type",Vs]};function Fs(e,t,n){var i,r,o=this,a=n.get("dragging",!1);a&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,i=o._findTargetGfx(n),r=i&&e.get(i);i&&r&&(t.stopPropagation(),a.hover({element:r,gfx:i}),a.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:i})})),t.on("element.out",(function(){i=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ia(e),function(e){return un(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Fs.$inject=["elementRegistry","eventBus","injector"];var Us={__init__:["hoverFix"],hoverFix:["type",Fs]},Hs=["c","C"],Ws=["v","V"],qs=["y","Y"],Gs=["z","Z"];function Ks(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Xs(e,t){return-1!==(e=O(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Ys(e){return e.shiftKey}var Zs=Math.round,Qs="djs-drag-active";function Js(e){e.preventDefault()}function eu(e,t,n,i){var r,o={threshold:5,trapClick:!0};function a(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function s(t,n){n=n||r;var i=e.createEvent(J({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function u(e,i){var o,u=r.payload,c=r.displacement,l=r.globalStart,d=ia(e),p=Wa(d,l),h=r.localStart,f=a(d),m=Wa(f,h);if(!r.active&&(i||(o=p,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>r.threshold))){if(J(u,{x:Zs(h.x+c.x),y:Zs(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===s("start"))return v();r.active=!0,r.keepSelection||(u.previousSelection=n.get(),n.select(null)),r.cursor&&Ja(r.cursor),t.addMarker(t.getRootElement(),Qs)}na(e),r.active&&(J(u,{x:Zs(f.x+c.x),y:Zs(f.y+c.y),dx:Zs(m.x),dy:Zs(m.y)},{originalEvent:e}),s("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,na(e)),t=s("end")),!1===t&&s("rejected"),s("ended",m(!0!==t))}function l(e){Xs("Escape",e)&&(Js(e),v())}function d(t){var n;r.active&&(n=ts(e),setTimeout(n,400),Js(t)),c(t)}function p(e){u(e)}function h(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,s("hover")}function f(e){s("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function v(e){var t;if(r){var n=r.active;n&&s("cancel"),t=m(e),n&&s("canceled",t)}}function m(o){var a,m;s("cleanup"),es(),m=r.trapClick?d:c,fn.unbind(document,"mousemove",u),fn.unbind(document,"dragstart",Js),fn.unbind(document,"selectstart",Js),fn.unbind(document,"mousedown",m,!0),fn.unbind(document,"mouseup",m,!0),fn.unbind(document,"keyup",l),fn.unbind(document,"touchstart",p,!0),fn.unbind(document,"touchcancel",v,!0),fn.unbind(document,"touchmove",u,!0),fn.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),Qs);var g=r.payload.previousSelection;return!1!==o&&g&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(g),a=r,r=null,a}e.on("diagram.destroy",v),this.init=function(t,n,i,m){r&&v(!1),"string"==typeof n&&(m=i,i=n,n=null);var g,y,_,b,x,w=(m=J({},o,m||{})).data||{};b=m.trapClick?d:c,t?(g=ta(t)||t,y=ia(t),na(t),"dragstart"===g.type&&Js(g)):(g=null,y={x:0,y:0}),_=a(y),n||(n=_),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(g),r=J({prefix:i,data:w,payload:{},globalStart:y,displacement:Wa(n,_),localStart:_,isTouch:x},m),m.manual||(x?(fn.bind(document,"touchstart",p,!0),fn.bind(document,"touchcancel",v,!0),fn.bind(document,"touchmove",u,!0),fn.bind(document,"touchend",c,!0)):(fn.bind(document,"mousemove",u),fn.bind(document,"dragstart",Js),fn.bind(document,"selectstart",Js),fn.bind(document,"mousedown",b,!0),fn.bind(document,"mouseup",b,!0)),fn.bind(document,"keyup",l),e.on("element.hover",h),e.on("element.out",f)),s("init"),m.autoActivate&&u(t,!0)},this.move=u,this.hover=h,this.out=f,this.end=c,this.cancel=v,this.context=function(){return r},this.setOptions=function(e){J(o,e)}}eu.$inject=["eventBus","canvas","selection","elementRegistry"];var tu={__depends__:[Us,ba],dragging:["type",eu]};function nu(e,t,n){this._canvas=n,this._opts=J({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function iu(e,t,n){return t<e&&e<n}nu.$inject=["config.autoScroll","eventBus","canvas"],nu.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,u=0;u<4;u++)iu(o[u],n.scrollThresholdOut[u],n.scrollThresholdIn[u])&&(0===u?a=n.scrollStep:1==u?s=n.scrollStep:2==u?a=-n.scrollStep:3==u&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout((function(){i.startScroll(e)}),n.scrollRepeatTimeout))},nu.prototype.stopScroll=function(){clearTimeout(this._scrolling)},nu.prototype.setOptions=function(e){this._opts=J({},this._opts,e)},nu.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ia(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var ru={__depends__:[tu],__init__:["autoScroll"],autoScroll:["type",nu]};function ou(e){this._commandStack=e.get("commandStack",!1)}ou.$inject=["injector"],ou.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var au={__init__:["rules"],rules:["type",ou]},su=Math.round,uu=Math.max;function cu(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Qi(i,t)<=10)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=$r(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,10),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=r[0],a=r[r.length-1];return o?o!==a?o.segment2!==a.segment2?{point:e[i=uu(o.segment2,a.segment2)-1],bendpoint:!0,index:i}:{point:{x:su(o.x+a.x)/2,y:su(o.y+a.y)/2},index:o.segment2}:{point:{x:su(o.x),y:su(o.y)},index:o.segment2}:null}(e,t)}function lu(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=function(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(i[0].n*t[0]+i[1].n*t[1])/(i[0].lambda*t[0]+i[1].lambda*t[1])}([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function du(e,t){var n,i=lu(e,t),r={x:i.x-e.x,y:i.y-e.y};return n=r,Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}var pu="djs-bendpoint",hu="djs-segment-dragger";function fu(e,t,n){var i=function(e,t){var n,i=ia(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(e,n);return cu(t,i)}function vu(e,t){var n=mi("g");ui(n).add(pu),ii(e,n);var i=mi("circle");ai(i,{cx:0,cy:0,r:4}),ui(i).add("djs-visual"),ii(n,i);var r=mi("circle");return ai(r,{cx:0,cy:0,r:10}),ui(r).add("djs-hit"),ii(n,r),t&&ui(n).add(t),n}function mu(e,t,n,i){var r=mi("g");ii(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return yu("h"===n?i:r)}(t,n,i),a=mi("rect");ai(a,{x:-9,y:-3,width:18,height:6}),ui(a).add("djs-visual"),ii(r,a);var s=mi("rect");return ai(s,{x:-o/2,y:-8.5,width:o,height:17}),ui(s).add("djs-hit"),ii(r,s),function(e,t){var n=bi();n.setRotate(t,0,0),Pi(e,n)}(r,"v"===i?90:0),r}function gu(e,t,n){var i=mi("g"),r=nr(t,n),o=er(t,n);return ii(e,i),mu(i,t,n,o),ui(i).add(hu),ui(i).add("h"===o?"horizontal":"vertical"),Co(i,r.x,r.y),i}function yu(e){return Math.abs(Math.round(2*e/3))}function _u(e,t){var n=function(e,t){for(var n,i=t.waypoints,r=1/0,o=0;o<i.length-1;o++){var a=du(e,[i[o],i[o+1]]);a<r&&(r=a,n=o)}return[i[n],i[n+1]]}(e,t);return lu(e,n)}function bu(e){return CSS.escape(e)}function xu(e,t,n,i,r){function o(e,n){var o,a=n.waypoints,s=fu(t,a,e);if(s)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=er((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?yu("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,s),!function(e,t,n){var i,r,o,a,s,u,c=e.index,l=e.point;return!(c<=0||e.bendpoint)&&(o=nr(i=t[c-1],r=t[c]),a=er(i,r),s=Math.abs(l.x-o.x),u=Math.abs(l.y-o.y),a&&s<=n&&u<=n)}(s,a,o)?i.start(e,n,s.index,!s.bendpoint):r.start(e,n,s.index),!0}function a(e,t,i){fn.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function s(e,n){var i=t.getLayer("overlays"),r=wn('.djs-bendpoints[data-element-id="'+bu(e.id)+'"]',i);return!r&&n&&(ai(r=mi("g"),{"data-element-id":e.id}),ui(r).add("djs-bendpoints"),ii(i,r),a(r,"mousedown",e),a(r,"click",e),a(r,"dblclick",e)),r}function u(e,t){return wn('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var i=vu(e);ii(e,i),Co(i,t.x,t.y)})),vu(e,"floating")}function l(e,t){for(var n,i,r,o=t.waypoints,s=1;s<o.length;s++)er(n=o[s-1],i=o[s])&&(ai(r=gu(e,n,i),{"data-segment-idx":s}),a(r,"mousemove",t))}function d(e){var t=s(e);return t||(c(t=s(e,!0),e),l(t,e)),t}function p(e){var t=s(e);t&&(!function(e){N(Cn("."+hu,e),(function(e){li(e)}))}(t),function(e){N(Cn("."+pu,e),(function(e){li(e)}))}(t),l(t,e),c(t,e))}function h(e,t,n){var i,r,o=u(t.index,e),a=n[t.index-1],s=n[t.index],c=t.point,l=nr(a,s),d=er(a,s);o&&(i=function(e){return wn(".djs-visual",e)}(o),r={x:c.x-l.x,y:c.y-l.y},"v"===d&&(r={x:r.y,y:r.x}),Co(i,r.x,r.y))}e.on("connection.changed",(function(e){p(e.element)})),e.on("connection.remove",(function(e){var t=s(e.element);t&&li(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=d(n),e.add?ui(t).add(e.marker):ui(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,i,r=e.element,o=r.waypoints;if(o){if(n=s(r,!0),!(i=fu(t,o,e.originalEvent)))return;!function(e,t){var n=wn(".floating",e),i=t.point;n&&Co(n,i.x,i.y)}(n,i),i.bendpoint||h(n,i,o)}})),e.on("element.mousedown",(function(e){if(oa(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&d(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(d(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=s(t);i&&ai(i,{"data-element-id":n})}})),this.addHandles=d,this.updateHandles=p,this.getBendpointsContainer=s,this.getSegmentDragger=u}xu.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var wu=Math.round,Cu="reconnectStart",Eu="reconnectEnd",ku="updateWaypoints";function Su(e,t,n,i,r,o){this._injector=e,this.start=function(e,t,o,a){var s,u=n.getGraphics(t),c=t.source,l=t.target,d=t.waypoints,p=(s=a||0!==o?a||o!==d.length-1?ku:Eu:Cu)===ku?"connection.updateWaypoints":"connection.reconnect",h=r.allowed(p,{connection:t,source:c,target:l});!1===h&&(h=r.allowed(p,{connection:t,source:l,target:c})),!1!==h&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:u,context:{allowed:h,bendpointIndex:o,connection:t,source:c,target:l,insert:a,type:s}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,o=i.source,a=i.target,s=e.hover,u=n.type;if(n.hover=s,s){var c=u===ku?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(c,{connection:i,source:u===Cu?s:o,target:u===Eu?s:a}))return n.source=u===Cu?s:o,void(n.target=u===Eu?s:a);!1===t&&(t=n.allowed=r.allowed(c,{connection:i,source:u===Eu?s:a,target:u===Cu?s:o})),t&&(n.source=u===Eu?s:a,n.target=u===Cu?s:o)}})),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],(function(e){var t=e.context,n=t.type;t.hover=null,t.source=null,t.target=null,n!==ku&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,r=t.connection,a=t.insert,s=r.waypoints.slice(),u=t.source,c=t.target,l=t.type,d=t.hints||{},p={x:wu(e.x),y:wu(e.y)};if(!n)return!1;l===ku?(a?s.splice(i,0,p):s[i]=p,d.bendpointMove={insert:a,bendpointIndex:i},s=this.cropWaypoints(r,s),o.updateWaypoints(r,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===Qi(t,i=e[r+1])||Ji(n,i,t)?e.splice(r,1):r++;return e}(s),d)):(l===Cu?(d.docking="source",ju(t)&&(d.docking="target",d.newWaypoints=s.reverse())):l===Eu&&(d.docking="target",ju(t)&&(d.docking="source",d.newWaypoints=s.reverse())),o.reconnect(r,u,c,p,d))}),this)}function ju(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Cu?t&&i&&t===i&&n!==i:r===Eu?t&&n&&t===n&&n!==i:void 0}Su.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Su.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};var Ou="updateWaypoints",Pu="connect-ok",Du="connect-not-ok",Ru="connect-hover",Tu="djs-updating",Mu="djs-element-hidden";function Iu(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,r=t.connection,o=t.insert,a=r.waypoints,s=a.slice();t.waypoints=a,o&&s.splice(n,0,{x:e.x,y:e.y}),r.waypoints=s,ui(t.draggerGfx=vu(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,Mu),i.addMarker(r,Tu)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,r=t.hover,o=t.type;if(r){if(i.addMarker(r,Ru),o===Ou)return;n?(i.removeMarker(r,Du),i.addMarker(r,Pu)):!1===n&&(i.removeMarker(r,Pu),i.addMarker(r,Du))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,r=t.target;n&&(i.removeMarker(n,Ru),i.removeMarker(n,r?Pu:Du))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,o=n.bendpointIndex,a=n.draggerGfx,s=n.hover,u=n.type,c=n.connection,l=c.source,d=c.target,p=c.waypoints.slice(),h={x:t.x,y:t.y},f=n.hints||{},v={};r&&(f.connectionStart&&(v.connectionStart=f.connectionStart),f.connectionEnd&&(v.connectionEnd=f.connectionEnd),"reconnectStart"===u?ju(n)?(v.connectionEnd=v.connectionEnd||h,v.source=d,v.target=s||l,p=p.reverse()):(v.connectionStart=v.connectionStart||h,v.source=s||l,v.target=d):"reconnectEnd"===u?ju(n)?(v.connectionStart=v.connectionStart||h,v.source=s||d,v.target=l,p=p.reverse()):(v.connectionEnd=v.connectionEnd||h,v.source=l,v.target=s||d):(v.noCropping=!0,v.noLayout=!0,p[o]=h),u===Ou&&(p=e.cropWaypoints(c,p)),v.waypoints=p,r.drawPreview(n,i,v)),Co(a,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,a=t.hover,s=t.target,u=t.waypoints;n.waypoints=u,li(o),i.removeMarker(n,Tu),i.removeMarker(n,Mu),a&&(i.removeMarker(a,Pu),i.removeMarker(a,s?Pu:Du)),r&&r.cleanUp(t)}))}Iu.$inject=["bendpointMove","injector","eventBus","canvas"];var Au="connect-hover",Nu="djs-updating";function Bu(e,t,n){return Lu(e,t,e[t]+n)}function Lu(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function $u(e){return"x"===e?"y":"x"}function Vu(e,t,n){var i,r;return e.original?e.original:(i=Hr(t),Lu(e,r=$u(n),i[r]))}function zu(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);function s(e,t){if(!a)return t;var n,i=e.waypoints;return e.waypoints=t,n=a.getCroppedWaypoints(e),e.waypoints=i,n}function u(e){r.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return Lu(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],$u(e.axis));Co(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,a,s,u,c=n.getGraphics(t),l=r-1,d=r,p=t.waypoints,h=p[l],f=p[d],v=fu(n,p,e);(a=er(h,f))&&(s="v"===a?"x":"y",0===l&&(h=Vu(h,t.source,s)),d===p.length-1&&(f=Vu(f,t.target,s)),o={connection:t,segmentStartIndex:l,segmentEndIndex:d,segmentStart:h,segmentEnd:f,axis:s,dragPosition:u=v?v.point:{x:(h.x+f.x)/2,y:(h.y+f.y)/2}},i.init(e,u,"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=gu(r,t.segmentStart,t.segmentEnd),ui(t.draggerGfx).add("djs-dragging"),n.addMarker(i,Nu)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,l=i.segmentStart,d=i.segmentEnd,p=i.axis,h=i.originalWaypoints.slice(),f=Bu(l,p,e["d"+p]),v=Bu(d,p,e["d"+p]),m=h.length,g=0;h[o]=f,h[a]=v,o<2&&(t=Wr(r.source,f),1===o?"intersect"===t&&(h.shift(),h[0]=f,g--):"intersect"!==t&&(h.unshift(l),g++)),a>m-3&&(n=Wr(r.target,v),a===m-2?"intersect"===n&&(h.pop(),h[h.length-1]=v):"intersect"!==n&&h.push(d)),i.newWaypoints=r.waypoints=s(r,h),c(i,g,e),i.newSegmentStartIndex=o+g,u(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,Au)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Au)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&li(t.draggerGfx),n.removeMarker(i,Nu)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,u(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var a=function(e,t){var n=0,i=e.filter((function(i,r){return!Ji(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,r),u=s(n,a.waypoints),c=a.segmentOffset,l={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+c}};o.updateWaypoints(n,u,l)}))}zu.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Fu=Math.abs,Uu=Math.round;function Hu(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Uu(e.x+e.width/2),y:Uu(e.y+e.height/2)}}function Wu(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function qu(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function Gu(e){return e.children||[]}var Ku=Math.abs,Xu=Math.round;function Yu(e){function t(e,t){if(O(e)){for(var n=e.length;n--;)if(Ku(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(i>e-10)return t-i+e}return t}function n(e,t){return e.waypoints?_u(t,e):e.width?{x:Xu(e.width/2+e.x),y:Xu(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,r,o=function(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,a=t.segmentStart,s=t.segmentStartIndex,u=t.segmentEnd,c=t.segmentEndIndex,l=t.axis;if(i)return i;var d=[o[s-1],a,u,o[c+1]];return s<2&&d.unshift(n(r.source,e)),c>o.length-3&&d.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},N(d,(function(e){e&&(e=e.original||e,"y"===l&&i.horizontal.push(e.y),"x"===l&&i.vertical.push(e.x))})),i}(e),a=e.x,s=e.y;if(o){var u=a-(i=t(o.vertical,a)),c=s-(r=t(o.horizontal,s));J(e,{dx:e.dx-u,dy:e.dy-c,x:i,y:r}),(u||-1!==o.vertical.indexOf(a))&&qu(e,"x",i),(c||-1!==o.horizontal.indexOf(s))&&qu(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t,i=e.context.hover,r=i&&n(i,e);(t=i)&&t.waypoints&&r&&r.x&&r.y&&(qu(e,"x",r.x),qu(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,r,o=e.context,a=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},N(r,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),s=o.hover,u=s&&n(s,e),c=e.x,l=e.y;if(a){var d=c-(i=t(u?a.vertical.concat([u.x]):a.vertical,c)),p=l-(r=t(u?a.horizontal.concat([u.y]):a.horizontal,l));J(e,{dx:e.dx-d,dy:e.dy-p,x:e.x-d,y:e.y-p}),(d||-1!==a.vertical.indexOf(c))&&qu(e,"x",i),(p||-1!==a.horizontal.indexOf(l))&&qu(e,"y",r)}}))}Yu.$inject=["eventBus"];var Zu={__depends__:[tu,au],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",xu],bendpointMove:["type",Su],bendpointMovePreview:["type",Iu],connectionSegmentMove:["type",zu],bendpointSnapping:["type",Yu]},Qu=".entry";function Ju(e,t,n,i){this._canvas=e,this._eventBus=n,this._overlays=i;var r=S(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:r},this._current=null,this._init()}function ec(e,t){return-1!==e.indexOf(t)}Ju.$inject=["canvas","config.contextPad","eventBus","overlays"],Ju.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,i=n.length?1===n.length?n[0]:n:null;i?e.open(i,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,i=e._current;if(i){var r=i.target;$(O(r)?r:[r],(function(e){return ec(n,e)}))&&e.open(r,!0)}}))},Ju.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},Ju.prototype.getEntries=function(e){var t=this._getProviders(),n=O(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return N(t,(function(t){if(R(t[n])){var r=t[n](e);R(r)?i=r(i):N(r,(function(e,t){i[t]=e}))}})),i},Ju.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=tn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ju.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries[e];if(o){var a=o.action;if(R(a)){if("click"===t)return a(n,r,i)}else if(a[t])return a[t](n,r,i);n.preventDefault()}}},Ju.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ju.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ju.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),i=this.getPad(e),r=i.html;N(n,(function(e,n){var i,o=e.group||"default",a=xn(e.html||'<div class="entry" draggable="true"></div>');tn(a,"data-action",n),(i=wn("[data-group="+bu(o)+"]",r))||(tn(i=xn('<div class="group"></div>'),"data-group",o),r.appendChild(i)),i.appendChild(a),e.className&&function(e,t){var n=rn(e);t=O(t)?t:t.split(/\s+/g),t.forEach((function(e){n.add(e)}))}(a,e.className),e.title&&tn(a,"title",e.title),e.imageUrl&&(tn(t=xn("<img>"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",a.appendChild(t))})),rn(r).add("open"),this._current={target:e,entries:n,pad:i},this._eventBus.fire("contextPad.open",{current:this._current})},Ju.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=xn('<div class="djs-context-pad"></div>'),r=this._getPosition(e),o=J({html:i},this._overlaysConfig,r);gn.bind(i,Qu,"click",(function(e){t.trigger("click",e)})),gn.bind(i,Qu,"dragstart",(function(e){t.trigger("dragstart",e)})),fn.bind(i,"mousedown",(function(e){e.stopPropagation()}));var a=this._canvas.getRootElement();this._overlayId=n.add(a,"context-pad",o);var s=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:s}),s},Ju.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ju.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return O(e)===O(n)&&(O(e)?e.length===n.length&&L(e,(function(e){return ec(n,e)})):n===e)},Ju.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},Ju.prototype._getPosition=function(e){var t=Ui(O(e)?e:[e]);return{position:{left:t.x+t.width+12,top:t.y-6}}};var tc={__depends__:[da,ja],contextPad:["type",Ju]};function nc(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,o=e.hover;if(n.hover=o,!j(t=n.canExecute=r(i,o))){if(!1!==t)return n.source=i,void(n.target=o);j(t=n.canExecute=r(o,i))||!1!==t&&(n.source=o,n.target=i)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},a=t.source,s=t.target;if(!i)return!1;var u=null,c={connectionStart:ic(t)?o:r,connectionEnd:ic(t)?r:o};P(i)&&(u=i),t.connection=n.connect(a,s,u,c)})),this.start=function(e,n,i,r){P(i)||(r=i,i=Hr(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function ic(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}nc.$inject=["eventBus","dragging","modeling","rules"];var rc="connect-ok",oc="connect-not-ok";function ac(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=t.hover,o=t.source,a=t.start,s=t.startPosition,u=t.target,c=t.connectionStart||s,l=t.connectionEnd||{x:e.x,y:e.y},d=c,p=l;ic(t)&&(d=l,p=c),i.drawPreview(t,n,{source:o||a,target:u||r,connectionStart:d,connectionEnd:p})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?rc:oc)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,rc),n.removeMarker(t,oc))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}ac.$inject=["injector","eventBus","canvas"];var sc={__depends__:[ba,au,tu],__init__:["connectPreview"],connect:["type",nc],connectPreview:["type",ac]},uc=["marker-start","marker-mid","marker-end"],cc=["circle","ellipse","line","path","polygon","polyline","path","rect"];function lc(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",(function(){N(r._clonedMarkers,(function(e){li(e)})),r._clonedMarkers={}}))}lc.$inject=["elementRegistry","eventBus","canvas","styles"],lc.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},lc.prototype.addDragger=function(e,t,n){var i=pi(n=n||this.getGfx(e)),r=n.getBoundingClientRect();return this._cloneMarkers(wo(i)),ai(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),ii(t,i),i},lc.prototype.addFrame=function(e,t){var n=mi("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ii(t,n),n},lc.prototype._cloneMarkers=function(e){var t=this;if(e.childNodes)for(var n=0;n<e.childNodes.length;n++)t._cloneMarkers(e.childNodes[n]);(function(e){return-1!==cc.indexOf(e.nodeName)})(e)&&uc.forEach((function(n){if(ai(e,n)){var i=function(e,t,n){var i=(r=ai(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return wn("marker#"+i,n||document)}(e,n,t._canvas.getContainer());t._cloneMarker(e,i,n)}}))},lc.prototype._cloneMarker=function(e,t,n){var i=t.id,r=this._clonedMarkers[i];if(!r){var o=i+"-clone";(r=pi(t)).id=o,ui(r).add("djs-dragger").add("djs-dragger-marker"),this._clonedMarkers[i]=r;var a=wn("defs",this._canvas._svg);a||(a=mi("defs"),ii(this._canvas._svg,a)),ii(a,r)}ai(e,n,"url(#"+this._clonedMarkers[i].id+")")};var dc={__init__:["previewSupport"],previewSupport:["type",lc]},pc="drop-ok",hc="drop-not-ok",fc="attach-ok",vc="new-parent",mc="create";function gc(e,t,n,i,r){function o(t,n){[fc,pc,hc,vc].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function a(){var e=t.context();e&&e.prefix===mc&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,a=t.source,s=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);yc(e);var u={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i,o){if(!t)return!1;var a=I(e=A(e,(function(t){var n=t.labelTarget;return!(t.parent||function(e){return!!e.labelTarget}(t)&&-1!==e.indexOf(n))})),(function(e){return!_c(e)})),s=!1,u=!1,c=!1;bc(e)&&(s=r.allowed("shape.attach",{position:n,shape:a,target:t})),s||(c=bc(e)?r.allowed("shape.create",{position:n,shape:a,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t}));var l=o.connectionTarget;return c||s?(a&&i&&(u=r.allowed("connection.create",{source:l===i?a:i,target:l===i?i:a,hints:{targetParent:t,targetAttach:s}})),{attach:s,connect:u}):(null===c||null===s)&&null}(n,i,u,a,s);i&&null!==c&&(t.target=i,c&&c.attach?o(i,fc):o(i,c?vc:hc))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,r=t.shape,o=t.elements,a=t.target,s=t.canExecute,u=s&&s.attach,c=s&&s.connect,l=t.hints||{};if(!1===s||!a)return!1;yc(e);var d={x:e.x,y:e.y};r=c?i.appendShape(n,r,d,a,{attach:u,connection:!0===c?{}:c,connectionTarget:l.connectionTarget}):I(o=i.createElements(o,d,a,J({},l,{attach:u})),(function(e){return!_c(e)})),J(t,{elements:o,shape:r}),J(e,{elements:o,shape:r})})),n.on("create.init",(function(){n.on("elements.changed",a),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",a)}))})),this.start=function(e,n,i){O(n)||(n=[n]);var r=I(n,(function(e){return!_c(e)}));if(r){i=J({elements:n,hints:{},shape:r},i||{}),N(n,(function(e){D(e.x)||(e.x=0),D(e.y)||(e.y=0)}));var o=Ui(A(n,(function(e){return!e.hidden})));N(n,(function(e){_c(e)&&(e.waypoints=V(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),J(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,mc,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function yc(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function _c(e){return!!e.waypoints}function bc(e){return e&&1===e.length&&!_c(e[0])}gc.$inject=["canvas","dragging","eventBus","modeling","rules"];function xc(e,t,n,i,r){t.on("create.move",750,(function(t){var o=t.hover,a=t.context,s=a.elements,u=a.dragGroup;u||(u=a.dragGroup=function(e){var t=mi("g");ai(t,r.cls("djs-drag-group",["no-events"]));var o=mi("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(wo(r),e)):(r=n._createContainer("shape",o),n.drawShape(wo(r),e),Co(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(s)),o?(u.parentNode||ii(e.getActiveLayer(),u),Co(u,t.x,t.y)):li(u)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&li(t)}))}xc.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var wc,Cc,Ec,kc,Sc,jc,Oc,Pc={__depends__:[tu,dc,au,ba],__init__:["create","createPreview"],create:["type",gc],createPreview:["type",xc]},Dc={},Rc=[],Tc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Mc(e,t){for(var n in t)e[n]=t[n];return e}function Ic(e){var t=e.parentNode;t&&t.removeChild(e)}function Ac(e,t,n){var i,r,o,a={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?wc.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===a[o]&&(a[o]=e.defaultProps[o]);return Nc(e,a,i,r,null)}function Nc(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++Ec:r};return null==r&&null!=Cc.vnode&&Cc.vnode(o),o}function Bc(e){return e.children}function Lc(e,t){this.props=e,this.context=t}function $c(e,t){if(null==t)return e.__?$c(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?$c(e):null}function Vc(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Vc(e)}}function zc(e){(!e.__d&&(e.__d=!0)&&kc.push(e)&&!Fc.__r++||Sc!==Cc.debounceRendering)&&((Sc=Cc.debounceRendering)||jc)(Fc)}function Fc(){var e,t,n,i,r,o,a,s;for(kc.sort(Oc);e=kc.shift();)e.__d&&(t=kc.length,i=void 0,r=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(i=[],(r=Mc({},o)).__v=o.__v+1,Zc(s,o,r,n.__n,void 0!==s.ownerSVGElement,null!=o.__h?[a]:null,i,null==a?$c(o):a,o.__h),Qc(i,o),o.__e!=a&&Vc(o)),kc.length>t&&kc.sort(Oc));Fc.__r=0}function Uc(e,t,n,i,r,o,a,s,u,c){var l,d,p,h,f,v,m,g=i&&i.__k||Rc,y=g.length;for(n.__k=[],l=0;l<t.length;l++)if(null!=(h=n.__k[l]=null==(h=t[l])||"boolean"==typeof h||"function"==typeof h?null:"string"==typeof h||"number"==typeof h||"bigint"==typeof h?Nc(null,h,null,null,h):Array.isArray(h)?Nc(Bc,{children:h},null,null,null):h.__b>0?Nc(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(p=g[l])||p&&h.key==p.key&&h.type===p.type)g[l]=void 0;else for(d=0;d<y;d++){if((p=g[d])&&h.key==p.key&&h.type===p.type){g[d]=void 0;break}p=null}Zc(e,h,p=p||Dc,r,o,a,s,u,c),f=h.__e,(d=h.ref)&&p.ref!=d&&(m||(m=[]),p.ref&&m.push(p.ref,null,h),m.push(d,h.__c||f,h)),null!=f?(null==v&&(v=f),"function"==typeof h.type&&h.__k===p.__k?h.__d=u=Hc(h,u,e):u=Wc(e,h,p,g,f,u),"function"==typeof n.type&&(n.__d=u)):u&&p.__e==u&&u.parentNode!=e&&(u=$c(p))}for(n.__e=v,l=y;l--;)null!=g[l]&&("function"==typeof n.type&&null!=g[l].__e&&g[l].__e==n.__d&&(n.__d=qc(i).nextSibling),tl(g[l],g[l]));if(m)for(l=0;l<m.length;l++)el(m[l],m[++l],m[++l])}function Hc(e,t,n){for(var i,r=e.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=e,t="function"==typeof i.type?Hc(i,t,n):Wc(n,i,i,r,i.__e,t));return t}function Wc(e,t,n,i,r,o){var a,s,u;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(null==n||r!=o||null==r.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(r),a=null;else{for(s=o,u=0;(s=s.nextSibling)&&u<i.length;u+=1)if(s==r)break e;e.insertBefore(r,o),a=o}return void 0!==a?a:r.nextSibling}function qc(e){var t,n,i;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(i=qc(n)))return i;return null}function Gc(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Tc.test(t)?n:n+"px"}function Kc(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Gc(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||Gc(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i||e.addEventListener(t,o?Yc:Xc,o):e.removeEventListener(t,o?Yc:Xc,o);else if("dangerouslySetInnerHTML"!==t){if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&-1==t.indexOf("-")?e.removeAttribute(t):e.setAttribute(t,n))}}function Xc(e){return this.l[e.type+!1](Cc.event?Cc.event(e):e)}function Yc(e){return this.l[e.type+!0](Cc.event?Cc.event(e):e)}function Zc(e,t,n,i,r,o,a,s,u){var c,l,d,p,h,f,v,m,g,y,_,b,x,w,C,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(u=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(c=Cc.__b)&&c(t);try{e:if("function"==typeof E){if(m=t.props,g=(c=E.contextType)&&i[c.__c],y=c?g?g.props.value:c.__:i,n.__c?v=(l=t.__c=n.__c).__=l.__E:("prototype"in E&&E.prototype.render?t.__c=l=new E(m,y):(t.__c=l=new Lc(m,y),l.constructor=E,l.render=nl),g&&g.sub(l),l.props=m,l.state||(l.state={}),l.context=y,l.__n=i,d=l.__d=!0,l.__h=[],l._sb=[]),null==l.__s&&(l.__s=l.state),null!=E.getDerivedStateFromProps&&(l.__s==l.state&&(l.__s=Mc({},l.__s)),Mc(l.__s,E.getDerivedStateFromProps(m,l.__s))),p=l.props,h=l.state,l.__v=t,d)null==E.getDerivedStateFromProps&&null!=l.componentWillMount&&l.componentWillMount(),null!=l.componentDidMount&&l.__h.push(l.componentDidMount);else{if(null==E.getDerivedStateFromProps&&m!==p&&null!=l.componentWillReceiveProps&&l.componentWillReceiveProps(m,y),!l.__e&&null!=l.shouldComponentUpdate&&!1===l.shouldComponentUpdate(m,l.__s,y)||t.__v===n.__v){for(t.__v!==n.__v&&(l.props=m,l.state=l.__s,l.__d=!1),l.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),_=0;_<l._sb.length;_++)l.__h.push(l._sb[_]);l._sb=[],l.__h.length&&a.push(l);break e}null!=l.componentWillUpdate&&l.componentWillUpdate(m,l.__s,y),null!=l.componentDidUpdate&&l.__h.push((function(){l.componentDidUpdate(p,h,f)}))}if(l.context=y,l.props=m,l.__P=e,b=Cc.__r,x=0,"prototype"in E&&E.prototype.render){for(l.state=l.__s,l.__d=!1,b&&b(t),c=l.render(l.props,l.state,l.context),w=0;w<l._sb.length;w++)l.__h.push(l._sb[w]);l._sb=[]}else do{l.__d=!1,b&&b(t),c=l.render(l.props,l.state,l.context),l.state=l.__s}while(l.__d&&++x<25);l.state=l.__s,null!=l.getChildContext&&(i=Mc(Mc({},i),l.getChildContext())),d||null==l.getSnapshotBeforeUpdate||(f=l.getSnapshotBeforeUpdate(p,h)),C=null!=c&&c.type===Bc&&null==c.key?c.props.children:c,Uc(e,Array.isArray(C)?C:[C],t,n,i,r,o,a,s,u),l.base=t.__e,t.__h=null,l.__h.length&&a.push(l),v&&(l.__E=l.__=null),l.__e=!1}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Jc(n.__e,t,n,i,r,o,a,u);(c=Cc.diffed)&&c(t)}catch(e){t.__v=null,(u||null!=o)&&(t.__e=s,t.__h=!!u,o[o.indexOf(s)]=null),Cc.__e(e,t,n)}}function Qc(e,t){Cc.__c&&Cc.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Cc.__e(e,t.__v)}}))}function Jc(e,t,n,i,r,o,a,s){var u,c,l,d=n.props,p=t.props,h=t.type,f=0;if("svg"===h&&(r=!0),null!=o)for(;f<o.length;f++)if((u=o[f])&&"setAttribute"in u==!!h&&(h?u.localName===h:3===u.nodeType)){e=u,o[f]=null;break}if(null==e){if(null===h)return document.createTextNode(p);e=r?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,p.is&&p),o=null,s=!1}if(null===h)d===p||s&&e.data===p||(e.data=p);else{if(o=o&&wc.call(e.childNodes),c=(d=n.props||Dc).dangerouslySetInnerHTML,l=p.dangerouslySetInnerHTML,!s){if(null!=o)for(d={},f=0;f<e.attributes.length;f++)d[e.attributes[f].name]=e.attributes[f].value;(l||c)&&(l&&(c&&l.__html==c.__html||l.__html===e.innerHTML)||(e.innerHTML=l&&l.__html||""))}if(function(e,t,n,i,r){var o;for(o in n)"children"===o||"key"===o||o in t||Kc(e,o,null,n[o],i);for(o in t)r&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||Kc(e,o,t[o],n[o],i)}(e,p,d,r,s),l)t.__k=[];else if(f=t.props.children,Uc(e,Array.isArray(f)?f:[f],t,n,i,r&&"foreignObject"!==h,o,a,o?o[0]:n.__k&&$c(n,0),s),null!=o)for(f=o.length;f--;)null!=o[f]&&Ic(o[f]);s||("value"in p&&void 0!==(f=p.value)&&(f!==e.value||"progress"===h&&!f||"option"===h&&f!==d.value)&&Kc(e,"value",f,d.value,!1),"checked"in p&&void 0!==(f=p.checked)&&f!==e.checked&&Kc(e,"checked",f,d.checked,!1))}return e}function el(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Cc.__e(e,n)}}function tl(e,t,n){var i,r;if(Cc.unmount&&Cc.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||el(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Cc.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&tl(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||Ic(e.__e),e.__=e.__e=e.__d=void 0}function nl(e,t,n){return this.constructor(e,n)}function il(e,t,n){var i,r,o;Cc.__&&Cc.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],Zc(t,e=(!i&&n||t).__k=Ac(Bc,null,[e]),r||Dc,Dc,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?wc.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i),Qc(o,e)}wc=Rc.slice,Cc={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(t){e=t}throw e}},Ec=0,Lc.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Mc({},this.state),"function"==typeof e&&(e=e(Mc({},n),this.props)),e&&Mc(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),zc(this))},Lc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zc(this))},Lc.prototype.render=Bc,kc=[],jc="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Oc=function(e,t){return e.__v.__b-t.__v.__b},Fc.__r=0;var rl=function e(t,n,i,r){var o;n[0]=0;for(var a=1;a<n.length;a++){var s=n[a++],u=n[a]?(n[0]|=s?1:2,i[n[a++]]):n[++a];3===s?r[0]=u:4===s?r[1]=Object.assign(r[1]||{},u):5===s?(r[1]=r[1]||{})[n[++a]]=u:6===s?r[1][n[++a]]+=u+"":s?(o=t.apply(u,e(t,u,i,["",null])),r.push(o),u[0]?n[0]|=2:(n[a-2]=0,n[a]=o)):r.push(u)}return r},ol=new Map;var al,sl,ul,cl,ll=function(e){var t=ol.get(this);return t||(t=new Map,ol.set(this,t)),(t=rl(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,i=1,r="",o="",a=[0],s=function(e){1===i&&(e||(r=r.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?a.push(0,e,r):3===i&&(e||r)?(a.push(3,e,r),i=2):2===i&&"..."===r&&e?a.push(4,e,0):2===i&&r&&!e?a.push(5,0,!0,r):i>=5&&((r||!e&&5===i)&&(a.push(i,0,r,n),i=6),e&&(a.push(i,e,0,n),i=6)),r=""},u=0;u<e.length;u++){u&&(1===i&&s(),s(u));for(var c=0;c<e[u].length;c++)t=e[u][c],1===i?"<"===t?(s(),a=[a],i=3):r+=t:4===i?"--"===r&&">"===t?(i=1,r=""):r=t+r[0]:o?t===o?o="":r+=t:'"'===t||"'"===t?o=t:">"===t?(s(),i=1):i&&("="===t?(i=5,n=r,r=""):"/"===t&&(i<5||">"===e[u][c+1])?(s(),3===i&&(a=a[0]),i=a,(a=a[0]).push(2,0,i),i=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(s(),i=2):r+=t),3===i&&"!--"===r&&(i=4,a=a[0])}return s(),a}(e)),t),arguments,[])).length>1?t:t[0]}.bind(Ac),dl=0,pl=[],hl=[],fl=Cc.__b,vl=Cc.__r,ml=Cc.diffed,gl=Cc.__c,yl=Cc.unmount;function _l(e,t){Cc.__h&&Cc.__h(sl,e,dl||t),dl=0;var n=sl.__H||(sl.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:hl}),n.__[e]}function bl(e){return dl=1,function(e,t,n){var i=_l(al++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):zl(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=sl,!sl.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var a=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}})),!(!a&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};sl.u=!0;var o=sl.shouldComponentUpdate,a=sl.componentWillUpdate;sl.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}a&&a.call(this,e,t,n)},sl.shouldComponentUpdate=r}return i.__N||i.__}(zl,e)}function xl(e,t){var n=_l(al++,3);!Cc.__s&&Vl(n.__H,t)&&(n.__=e,n.i=t,sl.__H.__h.push(n))}function wl(e,t){var n=_l(al++,4);!Cc.__s&&Vl(n.__H,t)&&(n.__=e,n.i=t,sl.__h.push(n))}function Cl(e){return dl=5,El((function(){return{current:e}}),[])}function El(e,t){var n=_l(al++,7);return Vl(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function kl(e,t){return dl=8,El((function(){return e}),t)}function Sl(){for(var e;e=pl.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ll),e.__H.__h.forEach($l),e.__H.__h=[]}catch(t){e.__H.__h=[],Cc.__e(t,e.__v)}}Cc.__b=function(e){sl=null,fl&&fl(e)},Cc.__r=function(e){vl&&vl(e),al=0;var t=(sl=e.__c).__H;t&&(ul===sl?(t.__h=[],sl.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=hl,e.__N=e.i=void 0}))):(t.__h.forEach(Ll),t.__h.forEach($l),t.__h=[])),ul=sl},Cc.diffed=function(e){ml&&ml(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==pl.push(t)&&cl===Cc.requestAnimationFrame||((cl=Cc.requestAnimationFrame)||Bl)(Sl)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==hl&&(e.__=e.__V),e.i=void 0,e.__V=hl}))),ul=sl=null},Cc.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Ll),e.__h=e.__h.filter((function(e){return!e.__||$l(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Cc.__e(n,e.__v)}})),gl&&gl(e,t)},Cc.unmount=function(e){yl&&yl(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Ll(e)}catch(e){t=e}})),n.__H=void 0,t&&Cc.__e(t,n.__v))};var jl,Ol,Pl,Dl,Rl,Tl,Ml,Il,Al,Nl="function"==typeof requestAnimationFrame;function Bl(e){var t,n=function(){clearTimeout(i),Nl&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Nl&&(t=requestAnimationFrame(n))}function Ll(e){var t=sl,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),sl=t}function $l(e){var t=sl;e.__c=e.__(),sl=t}function Vl(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function zl(e,t){return"function"==typeof t?t(e):t}function Fl(e){var t,i,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==n(e))if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(i=Fl(e[t]))&&(r&&(r+=" "),r+=i);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Ul(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=Fl(e))&&(i&&(i+=" "),i+=t);return i}function Hl(e){var t=e.entry,n=e.selected,i=e.onMouseEnter,r=e.onMouseLeave,o=e.onAction;return ll(jl||(jl=m(["\n    <li\n      class=","\n      data-id=","\n      title=","\n      onClick=","\n      onMouseEnter=","\n      onMouseLeave=","\n      onDragStart=","\n      draggable=",'\n    >\n      <div class="djs-popup-entry-content">\n        <span\n          class=',"\n        >\n          ","\n\n          ","\n        </span>\n        ","\n      </div>\n      ","\n    </li>\n  "])),Ul("entry",{selected:n}),t.id,t.title||t.label,o,i,r,(function(e){return o(e,t,"dragstart")}),!0,Ul("djs-popup-entry-name",t.className),t.imageUrl?ll(Ol||(Ol=m(['\n            <img class="djs-popup-entry-icon" src=',' alt="" />\n          '])),t.imageUrl):null,t.label?ll(Pl||(Pl=m(['\n            <span class="djs-popup-label">\n              ',"\n            </span>\n          "])),t.label):null,t.description&&ll(Dl||(Dl=m(['\n          <span\n            class="djs-popup-entry-description"\n            title=',"\n          >\n            ","\n          </span>\n        "])),t.description,t.description),t.documentationRef&&ll(Rl||(Rl=m(['\n        <div class="djs-popup-entry-docs">\n          <a\n            href="','"\n            onClick=','\n            title="Open element documentation"\n            target="_blank"\n            rel="noopener"\n          >\n            <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n              <path fill-rule="evenodd" clip-rule="evenodd" d="M10.6368 10.6375V5.91761H11.9995V10.6382C11.9995 10.9973 11.8623 11.3141 11.5878 11.5885C11.3134 11.863 10.9966 12.0002 10.6375 12.0002H1.36266C0.982345 12.0002 0.660159 11.8681 0.396102 11.6041C0.132044 11.34 1.52588e-05 11.0178 1.52588e-05 10.6375V1.36267C1.52588e-05 0.98236 0.132044 0.660173 0.396102 0.396116C0.660159 0.132058 0.982345 2.95639e-05 1.36266 2.95639e-05H5.91624V1.36267H1.36266V10.6375H10.6368ZM12 0H7.2794L7.27873 1.36197H9.68701L3.06507 7.98391L4.01541 8.93425L10.6373 2.31231V4.72059H12V0Z" fill="#818798"/>\n            </svg>\n          </a>\n        </div>\n      '])),t.documentationRef,(function(e){return e.stopPropagation()})))}var Wl,ql,Gl,Kl,Xl,Yl,Zl,Ql,Jl,ed,td=["selectedEntry","setSelectedEntry","entries"];function nd(e){var n=e.selectedEntry,i=e.setSelectedEntry,r=e.entries,o=l(e,td),a=Cl(),s=El((function(){return function(e){var n=[],i=function(e){return n.find((function(t){return e.id===t.id}))},r=function(e){return!!i(e)},o=function(e){return"string"==typeof e?{id:e}:e};return e.forEach((function(e){var a=e.group?o(e.group):{id:"default"};r(a)?i(a).entries.push(e):n.push(t(t({},a),{},{entries:[e]}))})),n}(r)}),[r]);return wl((function(){var e=a.current;if(e){var t,n=e.querySelector(".selected");n&&("function"==typeof(t=n).scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded():t.scrollIntoView({scrollMode:"if-needed",block:"nearest"}))}}),[n]),ll(Tl||(Tl=m(['\n    <div class="djs-popup-results" ref=',">\n      ","\n    </div>\n  "])),a,s.map((function(e){return ll(Ml||(Ml=m(["\n        ",'\n        <ul class="djs-popup-group" data-group=',">\n          ","\n        </ul>\n      "])),e.name&&ll(Il||(Il=m(["\n          <div key=",' class="entry-header" title=',">\n            ","\n          </div>\n        "])),e.id,e.name,e.name),e.id,e.entries.map((function(e){return ll(Al||(Al=m(["\n            <","\n              key=","\n              entry=","\n              selected=","\n              onMouseEnter=","\n              onMouseLeave=","\n              ...","\n            />\n          "])),Hl,e.id,e,e===n,(function(){return i(e)}),(function(){return i(null)}),o)})))})))}function id(e){var t=e.onClose,n=e.onSelect,i=e.className,r=e.headerEntries,o=e.position,a=e.title,s=e.width,u=e.scale,c=e.search,l=e.entries,d=e.onOpened,p=e.onClosed,h=El((function(){return!!S(c)&&l.length>5}),[c,l]),f=Cl(),v=g(bl(""),2),y=v[0],_=v[1],b=kl((function(e,t){if(!h)return e;return e.filter((function(e){if(!t)return(e.rank||0)>=0;var n=[e.description||"",e.label||"",e.search||""].join("---").toLowerCase();return t.toLowerCase().split(/\s/g).every((function(e){return n.includes(e)}))}))}),[h]),x=g(bl(b(l,y)),2),w=x[0],C=x[1],E=g(bl(w[0]),2),k=E[0],j=E[1],O=kl((function(e){k&&e.includes(k)||j(e[0]),C(e)}),[k,C,j]);xl((function(){O(b(l,y))}),[y,l]),xl((function(){var e=function(e){if("Escape"===e.key)return e.preventDefault(),t()};return document.documentElement.addEventListener("keydown",e),function(){document.documentElement.removeEventListener("keydown",e)}}),[]),wl((function(){f.current&&f.current.focus()}),[]);var P=kl((function(e){var t=w.indexOf(k)+e;t<0&&(t=w.length-1),t>=w.length&&(t=0),j(w[t])}),[w,k,j]),D=kl((function(e){return"Enter"===e.key&&k?n(e,k):"ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey?(P(-1),e.preventDefault()):"ArrowDown"===e.key||"Tab"===e.key?(P(1),e.preventDefault()):void 0}),[n,t,k,P]),R=kl((function(e){sn(e.target,"input")&&_((function(){return e.target.value}))}),[_]);xl((function(){return d(),function(){p()}}),[]);var T=El((function(){return a||r.length>0}),[a,r]);return ll(Wl||(Wl=m(["\n    <","\n      onClose=","\n      onKeyup=","\n      onKeydown=","\n      className=","\n      position=","\n      width=","\n      scale=","\n    >\n      ","\n      ","\n    </",">\n  "])),rd,t,R,D,i,o,s,u,T&&ll(ql||(ql=m(['\n        <div class="djs-popup-header">\n          <h3 class="djs-popup-title" title=',">","</h3>\n          ","\n        </div>\n      "])),a,a,r.map((function(e){return ll(Gl||(Gl=m(["\n            <span\n              class=","\n              onClick=","\n              title=","\n              data-id=","\n              onMouseEnter=","\n              onMouseLeave=","\n            >\n              ","\n\n              ","\n            </span>\n          "])),function(e,t){return Ul("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}(e,e===k),(function(t){return n(t,e)}),e.title||e.label,e.id,(function(){return j(e)}),(function(){return j(null)}),e.imageUrl?ll(Kl||(Kl=m(['\n                <img class="djs-popup-entry-icon" src=',' alt="" />\n              '])),e.imageUrl):null,e.label?ll(Xl||(Xl=m(['\n                <span class="djs-popup-label">',"</span>\n              "])),e.label):null)}))),l.length>0&&ll(Yl||(Yl=m(['\n        <div class="djs-popup-body">\n\n          ',"\n\n          <","\n            entries=","\n            selectedEntry=","\n            setSelectedEntry=","\n            onAction=","\n          />\n        </div>\n        ","\n      "])),h&&ll(Zl||(Zl=m(['\n          <div class="djs-popup-search">\n            <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n              <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>\n            </svg>\n            <input\n                ref=','\n                type="text"\n              />\n          </div>\n          '])),f),nd,w,k,j,n,0===w.length&&ll(Ql||(Ql=m(['\n          <div class="djs-popup-no-results">No matching entries found.</div>\n        '])))),rd)}function rd(e){var t=e.onClose,n=e.onKeydown,i=e.onKeyup,r=e.className,o=e.children,a=e.position,s=Cl(),u=kl((function(e){un(e.target,".djs-popup",!0)||t()}),[t]);return wl((function(){if("function"==typeof a){var e=s.current,t=a(e);e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px")}}),[s.current,a]),wl((function(){s.current&&s.current.focus()}),[]),ll(Jl||(Jl=m(['\n    <div\n      class="djs-popup-backdrop"\n      onClick=',"\n    >\n      <div\n        class=","\n        style=","\n        onKeydown=","\n        onKeyup=","\n        ref=",'\n        tabIndex="-1"\n      >\n        ',"\n      </div>\n    </div>\n  "])),u,Ul("djs-popup",r),function(e){return{transform:"scale(".concat(e.scale,")"),width:"".concat(e.width,"px")}}(e),n,i,s,o)}var od="data-id",ad=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function sd(e,t,n){var i=this;this._eventBus=t,this._canvas=n,this._current=null;var r=S(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:r},t.on("diagram.destroy",(function(){i.close()})),t.on("element.changed",(function(e){var t=i.isOpen()&&i._current.element;e.element===t&&i._render()}))}sd.$inject=["config.popupMenu","eventBus","canvas"],sd.prototype._render=function(){var e=this,n=this._current,i=n.position,r=n.className,o=n.entries,a=n.headerEntries,s=n.options,u=Object.entries(o).map((function(e){var n=g(e,2);return t({id:n[0]},n[1])})),c=Object.entries(a).map((function(e){var n=g(e,2);return t({id:n[0]},n[1])})),l=i&&function(t){return e._ensureVisible(t,i)},d=this._updateScale(this._current.container);il(ll(ed||(ed=m(["\n      <","\n        onClose=","\n        onSelect=","\n        position=","\n        className=","\n        entries=","\n        headerEntries=","\n        scale=","\n        onOpened=","\n        onClosed=","\n        ...","\n      />\n    "])),id,(function(t){return e.close(t)}),(function(t,n,i){return e.trigger(t,n,i)}),l,r,u,c,d,this._onOpened.bind(this),this._onClosed.bind(this),t({},s)),this._current.container)},sd.prototype.open=function(e,t,n,i){if(!e)throw new Error("Element is missing");if(!t)throw new Error("No registered providers for: "+t);if(!n)throw new Error("the position argument is missing");this.isOpen()&&this.close();var r=this._getContext(e,t),o=r.entries,a=r.headerEntries;this._current={position:n,className:t,element:e,entries:o,headerEntries:a,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},sd.prototype._getContext=function(e,t){var n=this._getProviders(t);if(!n||!n.length)throw new Error("No registered providers for: "+t);var i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,empty:!(Object.keys(i).length||Object.keys(r).length)}},sd.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},sd.prototype.reset=function(){var e=this._current.container;il(null,e),En(e)},sd.prototype._emit=function(e,t){this._eventBus.fire("popupMenu.".concat(e),t)},sd.prototype._onOpened=function(){this._emit("opened")},sd.prototype._onClosed=function(){this._emit("closed")},sd.prototype._createContainer=function(e){var t=this._canvas.getContainer(),n=xn('<div class="djs-popup-parent djs-scrollable" data-popup='.concat(e.provider,"></div>"));return t.appendChild(n),n},sd.prototype._bindAutoClose=function(){this._eventBus.once(ad,this.close,this)},sd.prototype._unbindAutoClose=function(){this._eventBus.off(ad,this.close,this)},sd.prototype._updateScale=function(e){var t,n,i=this._canvas.zoom(),r=this._config.scale,o=i;return!0!==r&&(!1===r?(t=1,n=1):(t=r.min,n=r.max),S(t)&&i<t&&(o=t),S(n)&&i>n&&(o=n)),o},sd.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),{x:o,y:a}},sd.prototype.isEmpty=function(e,t){if(!e)throw new Error("element parameter is missing");if(!t)throw new Error("providerId parameter is missing");var n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},sd.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},sd.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},sd.prototype._getEntries=function(e,t){var n={};return N(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);R(i)?n=i(n):N(i,(function(e,t){n[t]=e}))}else N(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=te(e,["id"])}))})),n},sd.prototype._getHeaderEntries=function(e,t){var n={};return N(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);R(i)?n=i(n):N(i,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;N(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=te(e,["id"])}))}})),n},sd.prototype.isOpen=function(){return!!this._current},sd.prototype.trigger=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"click";if(e.preventDefault(),!t){var i=un(e.delegateTarget||e.target,".entry",!0),r=tn(i,od);t=this._getEntry(r)}var o=t.action;if(R(o)){if("click"===n)return o(e,t)}else if(o[n])return o[n](e,t)},sd.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};var ud={__init__:["popupMenu"],popupMenu:["type",sd]},cd=Math.round;function ld(e,t){this._modeling=e,this._eventBus=t}function dd(e,t){t.on("replace.end",500,(function(t){var n=t.newElement,i=t.hints;!1!==(void 0===i?{}:i).select&&e.select(n)}))}ld.$inject=["modeling","eventBus"],ld.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,u=t.y||e.y,c=cd(s+o/2),l=cd(u+a/2),d=i.replaceShape(e,J({},t,{x:c,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:d,hints:n}),d},dd.$inject=["selection","eventBus"];var pd={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",dd],replace:["type",ld]};function hd(e,t,n,i){this.replaceElement=function(n,i,r){r=r||{};var o=i.type,a=n.businessObject,s=e.create(o),u={type:o,businessObject:s};if(u.width=n.width,u.height=n.height,s.name=a.name,i.table){var c=e.create("dmn:DecisionTable");s.decisionLogic=c,c.$parent=s;var l=e.create("dmn:OutputClause");l.typeRef="string",l.$parent=c,c.output=[l];var d=e.create("dmn:InputClause");d.$parent=c;var p=e.create("dmn:LiteralExpression",{typeRef:"string"});d.inputExpression=p,p.$parent=d,c.input=[d]}return i.expression&&(s.decisionLogic=e.create("dmn:LiteralExpression"),s.variable=e.create("dmn:InformationItem")),t.replaceElement(n,u,r)}}hd.$inject=["drdFactory","replace","selection","modeling"];var fd={__depends__:[pd,ba],drdReplace:["type",hd]},vd=[{label:"Empty",actionName:"replace-with-empty-decision",className:"dmn-icon-clear",target:{type:"dmn:Decision",table:!1,expression:!1}},{label:"Decision Table",actionName:"replace-with-decision-table",className:"dmn-icon-decision-table",target:{type:"dmn:Decision",table:!0,expression:!1}},{label:"Literal Expression",actionName:"replace-with-literal-expression",className:"dmn-icon-literal-expression",target:{type:"dmn:Decision",table:!1,expression:!0}}];function md(e,t,n,i,r,o){this._popupMenu=e,this._modeling=t,this._moddle=n,this._drdReplace=i,this._rules=r,this._translate=o,this.register()}md.$inject=["popupMenu","modeling","moddle","drdReplace","rules","translate"],md.prototype.register=function(){this._popupMenu.registerProvider("dmn-replace",this)},md.prototype.getEntries=function(e){var t=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];if(Ln(t,"dmn:Decision")){var n=A(vd,(function(e){var n="replace-with-empty-decision"===e.actionName&&t.decisionLogic,i="replace-with-decision-table"===e.actionName&&!Ln(t.decisionLogic,"dmn:DecisionTable"),r="replace-with-literal-expression"===e.actionName&&!Ln(t.decisionLogic,"dmn:LiteralExpression");return n||i||r}));return this._createEntries(e,n)}return[]},md.prototype._createEntries=function(e,t){var n=[],i=this;return N(t,(function(t){var r=i._createMenuEntry(t,e);n.push(r)})),n},md.prototype._createMenuEntry=function(e,t,n){var i=this._drdReplace.replaceElement;return n=n||function(){return i(t,e.target)},{label:(0,this._translate)(e.label),className:e.className,id:e.actionName,action:n}},md.prototype.getHeaderEntries=function(e){return[]};var gd={__depends__:[Jo,ud,fd],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",md]};function yd(e,t,n,i,r,o,a,s,u,c,l,d){l=l||{},t.registerProvider(this),this._contextPad=t,this._modeling=n,this._elementFactory=i,this._connect=r,this._create=o,this._rules=a,this._popupMenu=s,this._canvas=u,this._translate=c,!1!==l.autoPlace&&(this._autoPlace=d.get("autoPlace",!1)),e.on("create.end",250,(function(e){var n=e.context.shape;if(aa(e)){var i=t.getEntries(n);i.replace&&i.replace.action.click(e,n)}}))}yd.$inject=["eventBus","contextPad","modeling","elementFactory","connect","create","rules","popupMenu","canvas","translate","config.contextPad","injector"],yd.prototype.getContextPadEntries=function(e){var t=this._modeling,n=this._elementFactory,i=this._connect,r=this._create,o=this._popupMenu,a=this._canvas,s=this._contextPad,u=this._rules,c=this._translate,l=this._autoPlace,d={};if("label"===e.type)return d;var p=e.businessObject;function h(e,t,n){i.start(e,t,n)}function f(e,t,i,o){function a(t,i){var a=n.createShape(J({type:e},o));r.start(t,a,{source:i,hints:{connectionTarget:i}})}"string"!=typeof i&&(o=i,i=c("Append {type}",{type:e.replace(/^dmn:/,"")}));var s=l?function(t,i){var r=n.createShape(J({type:e},o));l.append(i,r,{connectionTarget:i})}:a;return{group:"model",className:t,title:i,action:{dragstart:a,click:s}}}Ln(p,"dmn:Decision")&&J(d,{"append.decision":f("dmn:Decision","dmn-icon-decision")}),Fn(p,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:KnowledgeSource"])&&J(d,{"append.knowledge-source":f("dmn:KnowledgeSource","dmn-icon-knowledge-source")}),Fn(p,["dmn:BusinessKnowledgeModel","dmn:Decision"])&&J(d,{"append.business-knowledge-model":f("dmn:BusinessKnowledgeModel","dmn-icon-business-knowledge")}),Fn(p,["dmn:Decision","dmn:KnowledgeSource"])&&J(d,{"append.input-data":f("dmn:InputData","dmn-icon-input-data")}),Ln(p,"dmn:DRGElement")&&J(d,{"append.text-annotation":f("dmn:TextAnnotation","dmn-icon-text-annotation"),connect:{group:"connect",className:"dmn-icon-connection-multi",title:c("Connect using Information/Knowledge/Authority Requirement or Association"),action:{click:h,dragstart:h}}}),Ln(p,"dmn:TextAnnotation")&&J(d,{connect:{group:"connect",className:"dmn-icon-connection-multi",title:c("Connect using association"),action:{click:h,dragstart:h}}}),o.isEmpty(e,"dmn-replace")||J(d,{replace:{group:"edit",className:"dmn-icon-screw-wrench",title:c("Change type"),action:{click:function(e,t){var n=J(function(e){var t=a.getContainer(),n=s.getPad(e).html,i=t.getBoundingClientRect(),r=n.getBoundingClientRect(),o=r.top-i.top;return{x:r.left-i.left,y:o+r.height+5}}(t),{cursor:{x:e.x,y:e.y}});o.open(t,"dmn-replace",n)}}}});var v=u.allowed("elements.delete",{elements:[e]});return O(v)&&(v=v[0]===e),v&&J(d,{delete:{group:"edit",className:"dmn-icon-trash",title:c("Remove"),action:{click:function(n){t.removeElements([e])}}}}),d};var _d={__depends__:[Jo,tc,ba,sc,Pc,gd],__init__:["contextPadProvider"],contextPadProvider:["type",yd]};function bd(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}bd.$inject=["injector","canvas","graphicsFactory","elementFactory"],bd.prototype.drawPreview=function(e,t,n){n=n||{};var i,r,o,a=e.connectionPreviewGfx,s=e.getConnection,u=n.source,c=n.target,l=n.waypoints,d=n.connectionStart,p=n.connectionEnd,h=n.noLayout,f=n.noCropping,v=n.noNoop,m=this;a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),di(a),s||(s=e.getConnection=(r=function(e,t,n){return m.getConnection(e,t,n)},o={},function(e){var t=JSON.stringify(e),n=o[t];return n||(n=o[t]=r.apply(null,arguments)),n})),t&&(i=s(t,u,c)),i?(i.waypoints=l||[],this._layouter&&!h&&(i.waypoints=this._layouter.layoutConnection(i,{source:u,target:c,connectionStart:d,connectionEnd:p,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[u?Hr(u):d,c?Hr(c):p]),this._connectionDocking&&(u||c)&&!f&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,u,c)),this._graphicsFactory.drawConnection(a,i)):!v&&this.drawNoopPreview(a,n)},bd.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Hr(n),o=t.connectionEnd||Hr(i),a=this.cropWaypoints(r,o,n,i);ii(e,this.createNoopConnection(a[0],a[1]))},bd.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return[e=n&&qr(o,s,!0)||e,t=i&&qr(a,s,!1)||t]},bd.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&li(e.connectionPreviewGfx)},bd.prototype.getConnection=function(e){var t=function(e){return P(e)?e:{}}(e);return this._elementFactory.createConnection(t)},bd.prototype.createConnectionPreviewGfx=function(){var e=mi("g");return ai(e,{pointerEvents:"none"}),ui(e).add("djs-connection-preview"),ii(this._canvas.getActiveLayer(),e),e},bd.prototype.createNoopConnection=function(e,t){return Ni([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var xd={__init__:["connectionPreview"],connectionPreview:["type",bd]},wd=/\s/,Cd=/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i,Ed=/^[a-z_][\w-.]*$/i,kd=/\$\{([^}]*)\}/g;function Sd(e,t){var n=e.$model.ids.assigned(t);return t?n&&n!==e?"Element must have unique ID.":function(e){if(e=function(e){return e.replace(kd,"$1")}(e),function(e){return wd.test(e)}(e))return"Id must not contain spaces.";if(!Ed.test(e))return Cd.test(e)?"Id must not contain prefix.":"Id must be a valid QName."}(t):"Element must have ID."}function jd(e,t,n,i,r){this._eventBus=e,this._modeling=t,this._canvas=n,this._definitionPropertiesView=i,this._translate=r,e.on("definitionIdView.create",(function(e){this._container=e.html;var t=wn(".dmn-definitions-name",this._container),n=wn(".dmn-definitions-id",this._container);this._setup(t,"name"),this._setup(n,"id")}),this)}jd.$inject=["eventBus","modeling","canvas","definitionPropertiesView","translate"],jd.prototype.update=function(e,t){var n=this._canvas.getRootElement(),i={};if(i[e]=t,"id"===e){var r=Sd(zn(n),t);if(r)return void this._addErrorMessage(r);this._clearErrorMessage()}this._modeling.updateProperties(n,i)},jd.prototype._setup=function(e,t){var n=this;e.setAttribute("contenteditable",!0),e.addEventListener("input",Y((function(e){var i=e.target.value||e.target.textContent;n.update(t,i.trim())}),300)),e.addEventListener("keydown",(function(t){13===t.keyCode&&(e.blur(),window.getSelection().removeAllRanges())})),e.addEventListener("blur",(function(){n._clearErrorMessage(),n._definitionPropertiesView.update()}))},jd.prototype._addErrorMessage=function(e){var t='<span class="dmn-definitions-error-message">'+this._translate(e)+"</span>",n=wn(".dmn-definitions-id",this._container);this._clearErrorMessage(),rn(n).add("dmn-definitions-error"),n.parentElement.appendChild(xn(t))},jd.prototype._clearErrorMessage=function(){var e=wn(".dmn-definitions-id",this._container);if(rn(e).has("dmn-definitions-error")){rn(e).remove("dmn-definitions-error");var t=wn(".dmn-definitions-error-message",this._container);e.parentNode.removeChild(t)}};var Od={__depends__:[Da],__init__:["definitionPropertiesEdit","definitionPropertiesPaletteAdapter"],definitionPropertiesEdit:["type",jd],definitionPropertiesPaletteAdapter:["type",Pa]},Pd={horizontal:["x","width"],vertical:["y","height"]};function Dd(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return O(n)?n:n?e:[]}))}Dd.$inject=["modeling","rules"],Dd.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Dd.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Dd.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(N(t,(function(e){r=e(r,n,i)})),r):e},Dd.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return N(W(e,i),(function(e,o){var a,s=n._findRange(e,i,r),u=t[t.length-1];u&&n._hasIntersection(u.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))})),t},Dd.prototype._setOrientation=function(e){var t=Pd[e];this._axis=t[0],this._dimension=t[1]},Dd.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Dd.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Rd={__init__:["distributeElements"],distributeElements:["type",Dd]};function Td(e){e.registerFilter((function(e){return A(e,(function(e){var t=Fn(e,["dmn:AuthorityRequirement","dmn:InformationRequirement","dmn:KnowledgeRequirement","dmn:Association","dmn:TextAnnotation"]);return!(e.labelTarget||t)}))}))}Td.$inject=["distributeElements"];var Md={__depends__:[Rd],__init__:["drdDistributeElements"],drdDistributeElements:["type",Td]},Id="is not a registered action";function Ad(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Nd(e,t){return new Error(e+" "+t)}Ad.$inject=["eventBus","injector"],Ad.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),u=e.get("keyboardMove",!1),c=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",(function(){t.undo()})),this.register("redo",(function(){t.redo()}))),o&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),r&&this.register("stepZoom",(function(e){r.stepZoom(e.value)})),a&&this.register("zoom",(function(e){a.zoom(e.value)})),n&&i&&s&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,r=s.allowed("elements.delete",{elements:e});!1!==r&&(t=O(r)?r:e).length&&n.removeElements(t.slice())}})),u&&this.register("moveCanvas",(function(e){u.moveCanvas(e)})),c&&this.register("moveSelection",(function(e){c.moveSelection(e.direction,e.accelerated)}))},Ad.prototype.trigger=function(e,t){if(!this._actions[e])throw Nd(e,Id);return this._actions[e](t)},Ad.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);N(e,(function(e,t){n._registerAction(t,e)}))},Ad.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Nd(e,"is already registered");this._actions[e]=t},Ad.prototype.unregister=function(e){if(!this.isRegistered(e))throw Nd(e,Id);this._actions[e]=void 0},Ad.prototype.getActions=function(){return Object.keys(this._actions)},Ad.prototype.isRegistered=function(e){return!!this._actions[e]};var Bd={__init__:["editorActions"],editorActions:["type",Ad]};function Ld(e){e.invoke(Ad,this)}Hn(Ld,Ad),Ld.$inject=["injector"],Ld.prototype._registerDefaultActions=function(e){Ad.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("lassoTool",!1),o=e.get("handTool",!1),a=e.get("directEditing",!1),s=e.get("distributeElements",!1),u=e.get("alignElements",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),r=n.filter((function(t){return t!==e}));return i.select(r),r})),i&&s&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length>2&&s.trigger(t,n)})),i&&u&&this._registerAction("alignElements",(function(e){var t=i.get(),n=e.type;t.length>1&&u.trigger(t,n)})),r&&this._registerAction("lassoTool",(function(){r.toggle()})),o&&this._registerAction("handTool",(function(){o.toggle()})),i&&a&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&a.activate(e[0])}))};var $d={__depends__:[Bd],editorActions:["type",Ld]};function Vd(e){return e.dmnDI&&e.dmnDI.diagrams&&e.dmnDI.diagrams[0]}function zd(e,t,n,i){n.on("import.start",(function(n){var r=n.definitions;Vd(r)||function(n){var r=n.dmnDI;r||(r=e.create("dmndi:DMNDI"),n.set("dmnDI",r));var o=e.create("dmndi:DMNDiagram");r.set("diagrams",[o]);var a=0;N(n.get("drgElement"),(function(n){if(Ln(n,"dmn:Decision")){var r=t._getDefaultSize(n),s=e.createDiShape(n,{x:150+30*a,y:150+30*a,width:r.width,height:r.height});i.updateDiParent(s,o),a++}}))}(r)}))}zd.$inject=["drdFactory","elementFactory","eventBus","drdUpdater"];var Fd={__init__:["diGenerator"],diGenerator:["type",zd]};function Ud(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Hd(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",800,(function(){r.setActive(i)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!r.active||n&&Ks(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},o=function(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;if(s&&D(s[t]))return s[t];s||(s=o.snapOffset={});D(s[t])||(s[t]=0);if(!r)return s[t];n.get(r.id)||(Wd(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2);if(!a)return s[t];"x"===t?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2);return s[t]}(t,n,e);o&&(i.offset=o);var a=function(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={});a[t]||(a[t]={});var s=n.direction;i&&(Wd(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var u=r.min,c=r.max;u&&(Wd(t)?Gd(s)?a.x.max=u.left:a.x.min=u.right:qd(s)?a.y.max=u.top:a.y.min=u.bottom);c&&(Wd(t)?Gd(s)?a.x.min=c.left:a.x.max=c.right:qd(s)?a.y.min=c.top:a.y.max=c.bottom);return a[t]}(t,n);a&&J(i,a),Wu(t,n)||r.snapEvent(t,n,i)}))}}))}function Wd(e){return"x"===e}function qd(e){return-1!==e.indexOf("n")}function Gd(e){return-1!==e.indexOf("w")}Hd.prototype.snapEvent=function(e,t,n){qu(e,t,this.snapValue(e[t],n))},Hd.prototype.getGridSpacing=function(){return 10},Hd.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=Ud(e+=r,10),t&&t.min&&D(n=t.min)&&(n=Ud(n+r,10,"ceil"),e=Math.max(e,n)),t&&t.max&&D(i=t.max)&&(i=Ud(i+r,10,"floor"),e=Math.min(e,i)),e-=r},Hd.prototype.isActive=function(){return this.active},Hd.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Hd.prototype.toggleActive=function(){this.setActive(!this.active)},Hd.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Kd(e){this._eventBus=e}Kd.$inject=["eventBus"],Kd.prototype.on=function(e,t,n,i,r,o){if((R(t)||D(t))&&(o=r,r=i,i=n,n=t,t=null),R(n)&&(o=r,r=i,i=n,n=1e3),P(r)&&(o=r,r=!1),!R(i))throw new Error("handlerFn must be a function");O(e)||(e=[e]);var a=this._eventBus;N(e,(function(e){var s=["commandStack",e,t].filter((function(e){return e})).join(".");a.on(s,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)}))};function Xd(e,t){Kd.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,i=(t.hints||{}).autoResize;if(i){var r=t.shape,o=t.newBounds;T(i)?t.newBounds=n.snapComplex(o,i):t.newBounds=n.snapSimple(r,o)}}))}N(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],(function(e){Kd.prototype[e]=function(t,n,i,r,o){(R(t)||D(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}})),Xd.$inject=["eventBus","gridSnapping","modeling"],Hn(Xd,Kd),Xd.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Xd.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Xd.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),J(e,o),e},Xd.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),J(e,o),e};function Yd(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,i=e.context;i.initialized&&("x"===i.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}Yd.$inject=["eventBus","gridSnapping"];var Zd={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Xd],gridSnappingSpaceToolBehavior:["type",Yd]}],__init__:["gridSnapping"],gridSnapping:["type",Hd]},Qd="keyboard.keydown",Jd="input-handle-modified-keys";function ep(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",(function(){n._fire("destroy"),n.unbind()})),t.on("diagram.init",(function(){n._fire("init")})),t.on("attach",(function(){e&&e.bindTo&&n.bind(e.bindTo)})),t.on("detach",(function(){n.unbind()}))}ep.$inject=["config.keyboard","eventBus"],ep.prototype._keydownHandler=function(e){this._keyHandler(e,Qd)},ep.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},ep.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Qd,n)&&e.preventDefault()}},ep.prototype._isEventIgnored=function(e){return!!e.defaultPrevented||(t=e.target)&&(sn(t,"input, textarea")||"true"===t.contentEditable)&&this._isModifiedKeyIgnored(e);var t},ep.prototype._isModifiedKeyIgnored=function(e){return!Ks(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},ep.prototype._getAllowedModifiers=function(e){var t=un(e,"["+Jd+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Jd).split(",")},ep.prototype.bind=function(e){this.unbind(),this._node=e,fn.bind(e,"keydown",this._keydownHandler),fn.bind(e,"keyup",this._keyupHandler),this._fire("bind")},ep.prototype.getBinding=function(){return this._node},ep.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),fn.unbind(e,"keydown",this._keydownHandler),fn.unbind(e,"keyup",this._keyupHandler)),this._node=null},ep.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},ep.prototype.addListener=function(e,t,n){R(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Qd,e,t)},ep.prototype.removeListener=function(e,t){this._eventBus.off(t||Qd,e)},ep.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},ep.prototype.isCmd=Ks,ep.prototype.isShift=Ys,ep.prototype.isKey=Xs;function tp(e,t){var n=this;e.on("editorActions.init",500,(function(e){var i=e.editorActions;n.registerBindings(t,i)}))}tp.$inject=["eventBus","keyboard"],tp.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){if(function(e){return Ks(e)&&!Ys(e)&&Xs(Gs,e)}(e.keyEvent))return t.trigger("undo"),!0})),n("redo",(function(e){if(function(e){return Ks(e)&&(Xs(qs,e)||Xs(Gs,e)&&Ys(e))}(e.keyEvent))return t.trigger("redo"),!0})),n("copy",(function(e){if(function(e){return Ks(e)&&Xs(Hs,e)}(e.keyEvent))return t.trigger("copy"),!0})),n("paste",(function(e){if(function(e){return Ks(e)&&Xs(Ws,e)}(e.keyEvent))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Xs(["+","Add","="],n)&&Ks(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Xs(["-","Subtract"],n)&&Ks(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(Xs("0",n)&&Ks(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(Xs(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var np={__init__:["keyboard","keyboardBindings"],keyboard:["type",ep],keyboardBindings:["type",tp]};function ip(e){e.invoke(tp,this)}Hn(ip,tp),ip.$inject=["injector"],ip.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}tp.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var i=n.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0})),n("lassoTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["l","L"],i)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["h","H"],i)?(t.trigger("handTool"),!0):void 0})),n("directEditing",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["e","E"],i)?(t.trigger("directEditing"),!0):void 0}))};var rp={__depends__:[np],__init__:["keyboardBindings"],keyboardBindings:["type",ip]},op={moveSpeed:50,moveSpeedAccelerated:200};function ap(e,t,n){var i=this;this._config=J({},op,e||{}),t.addListener((function(e){var n=e.keyEvent,r=i._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,a=t.isShift(n)?r.moveSpeedAccelerated:r.moveSpeed;switch(n.key){case"ArrowLeft":case"Left":o="left";break;case"ArrowUp":case"Up":o="up";break;case"ArrowRight":case"Right":o="right";break;case"ArrowDown":case"Down":o="down"}return i.moveCanvas({speed:a,direction:o}),!0}})),this.moveCanvas=function(e){var t=0,i=0,r=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":i=r;break;case"right":t=-r;break;case"down":i=-r}n.scroll({dx:t,dy:i})}}ap.$inject=["config.keyboardMove","keyboard","canvas"];var sp={__depends__:[np],__init__:["keyboardMove"],keyboardMove:["type",ap]},up={moveSpeed:1,moveSpeedAccelerated:10},cp="left",lp="right",dp="down",pp={ArrowLeft:cp,Left:cp,ArrowUp:"up",Up:"up",ArrowRight:lp,Right:lp,ArrowDown:dp,Down:dp},hp={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function fp(e,t,n,i,r){var o=this;this._config=J({},up,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=pp[n.key];if(i&&!t.isCmd(n)){var r=t.isShift(n);return o.moveSelection(i,r),!0}})),this.moveSelection=function(e,t){var o=r.get();if(o.length){var a=this._config[t?"moveSpeedAccelerated":"moveSpeed"],s=hp[e](a);i.allowed("elements.move",{shapes:o})&&n.moveElements(o,s)}}}fp.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var vp={__depends__:[np,ba],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",fp]};function mp(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}mp.$inject=["eventBus","injector"],mp.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},mp.prototype.canExecute=function(e,t){var n={command:e,context:t},i=this._getHandler(e),r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},mp.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},mp.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},mp.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},mp.prototype.register=function(e,t){this._setHandler(e,t)},mp.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");var n=this._injector.instantiate(t);this.register(e,n)},mp.prototype.canUndo=function(){return!!this._getUndoAction()},mp.prototype.canRedo=function(){return!!this._getRedoAction()},mp.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},mp.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},mp.prototype._internalUndo=function(e){var t=this,n=e.command,i=e.context,r=this._getHandler(n);this._atomicDo((function(){t._fire(n,"revert",e),r.revert&&t._markDirty(r.revert(i)),t._revertedAction(e),t._fire(n,"reverted",e)}))},mp.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var i,r=t?[e+"."+t,t]:[e];n=this._eventBus.createEvent(n);for(var o=0,a=r;o<a.length;o++){var s=a[o];if(i=this._eventBus.fire("commandStack."+s,n),n.cancelBubble)break}return i},mp.prototype._createId=function(){return this._uid++},mp.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},mp.prototype._internalExecute=function(e,t){var n=this,i=e.command,r=e.context,o=this._getHandler(i);if(!o)throw new Error("no command handler registered for <"+i+">");this._pushAction(e),t||(this._fire(i,"preExecute",e),o.preExecute&&o.preExecute(r),this._fire(i,"preExecuted",e)),this._atomicDo((function(){n._fire(i,"execute",e),o.execute&&n._markDirty(o.execute(r)),n._executedAction(e,t),n._fire(i,"executed",e)})),t||(this._fire(i,"postExecute",e),o.postExecute&&o.postExecute(r),this._fire(i,"postExecuted",e)),this._popAction(e)},mp.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},mp.prototype._popAction=function(){var e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:H("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},mp.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=O(e)?e:[e],t.dirty=t.dirty.concat(e))},mp.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},mp.prototype._revertedAction=function(e){this._stackIdx--},mp.prototype._getHandler=function(e){return this._handlerMap[e]},mp.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var gp={commandStack:["type",mp]};function yp(e,t,n,i){e.on("element.changed",(function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Hi(r)+".changed",i)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),i.updateContainments(n)})),e.on("shape.changed",(function(e){i.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){i.update("connection",e.element,e.gfx)}))}yp.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var _p={__init__:["changeSupport"],changeSupport:["type",yp]},bp=Math.min,xp=Math.max;function wp(e){e.preventDefault()}function Cp(e){e.stopPropagation()}function Ep(e){this.container=e.container,this.parent=xn('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=wn("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=Q(this.autoResize,this),this.handlePaste=Q(this.handlePaste,this)}function kp(e,t){this._eventBus=e,this._providers=[],this._textbox=new Ep({container:t.getContainer(),keyHandler:Q(this._handleKey,this),resizeHandler:Q(this._handleResize,this)})}Ep.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{};var s=ee(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);J(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var u=ee(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return J(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&J(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),o.innerText=n,fn.bind(o,"keydown",this.keyHandler),fn.bind(o,"mousedown",Cp),fn.bind(o,"paste",this.handlePaste),i.autoResize&&fn.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Ep.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},Ep.prototype.insertText=function(e){e=e.replace(/\r\n|\r|\n/g,"\n"),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Ep.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,a=r.endContainer,s=r.startOffset,u=r.endOffset,c=r.commonAncestorContainer,l=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var d=o.textContent;o.textContent=d.substring(0,s)+e+d.substring(u),n=o,i=s+e.length}else if(o===this.content&&a===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,l[s]),n=p,i=p.textContent.length}else{var h=l.indexOf(o),f=l.indexOf(a);l.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,s)+e+a.textContent.substring(u):n>h&&n<=f&&En(t)})),n=o,i=s+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},Ep.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Ep.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,u,c,l;n=this.resizeHandle=xn('<div class="djs-direct-editing-resize-handle"></div>');var d=function(n){wp(n),Cp(n);var d=bp(xp(c+n.clientX-s,i),o),p=bp(xp(l+n.clientY-u,r),a);t.style.width=d+"px",t.style.height=p+"px",e.resizeHandler({width:c,height:l,dx:n.clientX-s,dy:n.clientY-u})},p=function e(t){wp(t),Cp(t),fn.unbind(document,"mousemove",d,!1),fn.unbind(document,"mouseup",e,!1)};fn.bind(n,"mousedown",(function(e){wp(e),Cp(e),s=e.clientX,u=e.clientY;var n=t.getBoundingClientRect();c=n.width,l=n.height,fn.bind(document,"mousemove",d),fn.bind(document,"mouseup",p)}))}J(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Ep.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),fn.unbind(t,"keydown",this.keyHandler),fn.unbind(t,"mousedown",Cp),fn.unbind(t,"input",this.autoResize),fn.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),En(n)),En(e)},Ep.prototype.getValue=function(){return this.content.innerText.trim()},Ep.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Ep.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},kp.$inject=["eventBus","canvas"],kp.prototype.registerProvider=function(e){this._providers.push(e)},kp.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},kp.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},kp.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},kp.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},kp.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},kp.prototype.getValue=function(){return this._textbox.getValue()},kp.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},kp.prototype._handleResize=function(e){this._fire("resize",e)},kp.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=I(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Sp={__depends__:[da],__init__:["directEditing"],directEditing:["type",kp]};function jp(e){return Ln(e,"dmn:Decision")||Ln(e,"dmn:BusinessKnowledgeModel")||Ln(e,"dmn:InputData")||Ln(e,"dmn:KnowledgeSource")?"name":Ln(e,"dmn:TextAnnotation")?"text":void 0}function Op(e){var t=e.businessObject,n=jp(t);if(n)return t[n]||""}function Pp(e,t,n,i,r){this._canvas=e,this._modeling=i,this._textRenderer=r,t.registerProvider(this),n.on("element.dblclick",(function(e){t.activate(e.element)})),n.on(["autoPlace.start","canvas.viewbox.changing","drag.init","drillDown.click","element.mousedown","popupMenu.open","selection.changed"],(function(){t.complete()})),n.on(["commandStack.changed"],(function(){t.cancel()})),n.on("create.end",500,(function(e){var n=e.shape;(Ln(n,"dmn:Decision")||Ln(n,"dmn:InputData")||Ln(n,"dmn:BusinessKnowledgeModel")||Ln(n,"dmn:KnowledgeSource")||Ln(n,"dmn:TextAnnotation"))&&t.activate(n)})),n.on("autoPlace.end",500,(function(e){t.activate(e.shape)}))}Pp.$inject=["canvas","directEditing","eventBus","modeling","textRenderer"],Pp.prototype.activate=function(e){var t=Op(e);if(S(t)){var n={text:t};J(n,this.getEditingBBox(e));var i={};return Ln(e,"dmn:DRGElement")&&J(i,{centerVertically:!0}),Ln(e,"dmn:TextAnnotation")&&J(i,{resizable:!0}),J(n,{options:i}),n}},Pp.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x,y:i.y},o=t.zoom(),a=this._textRenderer.getDefaultStyle(),s=a.fontSize*o,u=a.lineHeight,c={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};return Ln(e,"dmn:DRGElement")&&(J(r,{width:i.width,height:i.height}),J(c,{fontSize:s+"px",lineHeight:u,paddingTop:7*o+"px",paddingBottom:7*o+"px",paddingLeft:5*o+"px",paddingRight:5*o+"px"})),Ln(e,"dmn:TextAnnotation")&&(J(r,{width:i.width,height:i.height,minWidth:30*o,minHeight:10*o}),J(c,{textAlign:"left",paddingTop:5*o+"px",paddingBottom:7*o+"px",paddingLeft:7*o+"px",paddingRight:5*o+"px",fontSize:s+"px",lineHeight:u})),{bounds:r,style:c}},Pp.prototype.update=function(e,t,n,i){var r,o,a;Ln(e,"dmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),(a=t)&&a.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var Dp={__depends__:[gp,_p,Sp],__init__:["labelEditingProvider"],labelEditingProvider:["type",Pp]};function Rp(e,t){t.invoke(Kd,this),this.preExecute("connection.create",(function(t){var n=t.connection,i=n.businessObject,r=t.source,o=t.target;Ln(n,"dmn:Association")?((i.sourceRef=e.create("dmn:DMNElementReference",{href:"#"+r.id})).$parent=i,(i.targetRef=e.create("dmn:DMNElementReference",{href:"#"+o.id})).$parent=i):(i["required"+function(e){if(Ln(e,"dmn:BusinessKnowledgeModel"))return"Knowledge";if(Ln(e,"dmn:Decision"))return"Decision";if(Ln(e,"dmn:InputData"))return"Input";if(Ln(e,"dmn:KnowledgeSource"))return"Authority"}(r)]=e.create("dmn:DMNElementReference",{href:"#"+r.id})).$parent=i}),!0)}Rp.$inject=["drdFactory","injector"],Hn(Rp,Kd);function Tp(e,t,n,i){function r(e,i,r){i||(i=e.incoming.filter((function(e){return Ln(e,"dmn:InformationRequirement")})));var o={};r?o[r]=i:o=function(e,t){var n={};return t.forEach((function(t){var i=Wr(t.source,e).split("-").shift();n[i]||(n[i]=[]),n[i].push(t)})),n}(e,i),N(o,(function(i,r){i=function(e,t){var n;n=t.includes("top")||t.includes("bottom")?"x":"y";return e.sort((function(e,t){return Hr(e.source)[n]-Hr(t.source)[n]}))}(i,r);var o=function(e,t,n){return e.map((function(i,r){var o=i.source,a=Hr(o),s=zr(o),u=zr(t),c=e.length;return n.includes("bottom")?{start:{x:a.x,y:s.top},end:{x:u.left+t.width/(c+1)*(r+1),y:u.bottom}}:n.includes("top")?{start:{x:a.x,y:s.bottom},end:{x:u.left+t.width/(c+1)*(r+1),y:u.top}}:n.includes("right")?{start:{x:s.left,y:a.y},end:{x:u.right,y:u.top+t.height/(c+1)*(r+1)}}:{start:{x:s.right,y:a.y},end:{x:u.left,y:u.top+t.height/(c+1)*(r+1)}}}))}(i,e,r);i.forEach((function(e,i){var r=o[i].start,a=o[i].end,s=t.layoutConnection(e,{connectionStart:r,connectionEnd:a});n.updateWaypoints(e,s)}))}))}e.invoke(Kd,this),this.preExecute(["connection.create","connection.reconnect"],(function(e){var t=e.connection,n=e.newSource||e.source,r=e.newTarget||e.target;if((!Ln(t,"dmn:InformationRequirement")||i.allowed("connection.connect",{connection:t,source:n,target:r}))&&Ln(t,"dmn:InformationRequirement")){var o=Wr(n,r);e.hints||(e.hints={}),J(e.hints,function(e,t,n){var i=Hr(e),r=Hr(t);n.includes("bottom")?(i.y=e.y,r.y=t.y+t.height):n.includes("top")?(i.y=e.y+e.height,r.y=t.y):n.includes("right")?(i.x=e.x,r.x=t.x+t.width):(i.x=e.x+e.width,r.x=t.x);return{connectionStart:i,connectionEnd:r}}(n,r,o))}}),!0),this.postExecuted(["connection.create","connection.delete","connection.reconnect"],(function(e){var t=e.connection,n=t.source||e.source,i=t.target||e.target;if(Ln(t,"dmn:InformationRequirement")){var o=Wr(n,i),a=i.incoming.filter((function(e){var t=Wr(e.source,e.target);return Ln(e,"dmn:InformationRequirement")&&Mp(t,o)}));a.length&&r(i,a,o)}}),!0),this.preExecute("connection.reconnect",(function(e){var t=e.connection,n=t.source,i=t.target;if(Ln(t,"dmn:InformationRequirement")){var o=Wr(n,i),a=i.incoming.filter((function(e){var n=Wr(e.source,e.target);return e!==t&&Ln(e,"dmn:InformationRequirement")&&Mp(n,o)}));a.length&&r(i,a,o)}}),!0),this.postExecuted("elements.move",500,(function(e){var t=e.shapes,n=e.closure.enclosedConnections;t.forEach((function(e){if(Fn(e,["dmn:Decision","dmn:InputData"])){var t=e.incoming.filter((function(e){return Ln(e,"dmn:InformationRequirement")&&!n[e.id]}));t.length&&r(e,t),e.outgoing.forEach((function(e){Ln(e,"dmn:InformationRequirement")&&!n[e.id]&&r(e.target)}))}}))}),!0)}function Mp(e,t){return e&&t&&e.split("-").shift()===t.split("-").shift()}function Ip(e,t,n){e.invoke(Kd,this),this.preExecute("connection.reconnect",(function(e){var i=e.connection,r=e.newSource||i.source,o=e.newTarget||i.target,a=i.waypoints.slice(),s=n.allowed("connection.reconnect",{connection:i,source:r,target:o});s&&s.type!==i.type&&(e.connection=t.connect(r,o,{type:s.type,waypoints:a}),t.removeConnection(i))}),!0)}function Ap(e,t,n){Kd.call(this,e),this._modeling=t,this.postExecuted(["shape.replace"],1500,(function(e){var i=e.context,r=i.oldShape,o=i.newShape;t.unclaimId(r.businessObject.id,r.businessObject),t.updateProperties(o,{id:r.id}),n.select(o)}))}Tp.$inject=["injector","layouter","modeling","rules"],Hn(Tp,Kd),Hn(Ip,Kd),Ip.$inject=["injector","modeling","rules"],Hn(Ap,Kd),Ap.$inject=["eventBus","modeling","selection"];var Np="id",Bp=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),(r=t.call(this,e)).executed("element.updateProperties",r.updateIds.bind(d(r))),r}return o(n,[{key:"updateIds",value:function(e){var t=e.context,n=t.element,i=t.oldProperties,r=t.properties,o=zn(n);if(!this.shouldSkipUpdate(o,i,r)){var a=function(e){var t=e;for(;!Ln(t,"dmn:Definitions");)t=t.$parent;return t}(o);a.get("drgElement").forEach((function(e){!function(e,t,n){var i={authorityRequirement:function(){e.authorityRequirement.forEach((function(e){var i=e.requiredAuthority,r=e.requiredDecision,o=e.requiredInput;i&&i.href==="#".concat(t)&&(i.href="#".concat(n)),r&&r.href==="#".concat(t)&&(r.href="#".concat(n)),o&&o.href==="#".concat(t)&&(o.href="#".concat(n))}))},informationRequirement:function(){e.informationRequirement.forEach((function(e){var i=e.requiredDecision,r=e.requiredInput;i&&i.href==="#".concat(t)&&(i.href="#".concat(n)),r&&r.href==="#".concat(t)&&(r.href="#".concat(n))}))},knowledgeRequirement:function(){e.knowledgeRequirement.forEach((function(e){var i=e.requiredKnowledge;i&&i.href==="#".concat(t)&&(i.href="#".concat(n))}))}};N(i,(function(t,n){e[n]&&t()}))}(e,i.id,r.id)})),a.get("artifact").forEach((function(e){!function(e,t,n){var i={sourceRef:function(){var i=e.sourceRef;i.href==="#".concat(t)&&(i.href="#".concat(n))},targetRef:function(){var i=e.targetRef;i.href==="#".concat(t)&&(i.href="#".concat(n))}};N(i,(function(t,n){e[n]&&t()}))}(e,i.id,r.id)}))}}},{key:"shouldSkipUpdate",value:function(e,t,n){return!function(e,t){return Np in e&&Np in t}(t,n)||!Ln(e,"dmn:DRGElement")&&!Ln(e,"dmn:TextAnnotation")}}]),n}(Kd);Bp.$inject=["eventBus"];var Lp={__init__:["createConnectionBehavior","idChangeBehavior","layoutConnectionBehavior","replaceConnectionBehavior","replaceElementBehavior"],createConnectionBehavior:["type",Rp],idChangeBehavior:["type",Bp],layoutConnectionBehavior:["type",Tp],replaceConnectionBehavior:["type",Ip],replaceElementBehavior:["type",Ap]};function $p(e){Kd.call(this,e),this.init()}function Vp(e){e.invoke($p,this)}function zp(e,t){if(!e||Hp(e)||!t||Hp(t))return null;if(e===t)return!1;if(Ln(e,"dmn:BusinessKnowledgeModel")&&Fn(t,["dmn:BusinessKnowledgeModel","dmn:Decision"]))return{type:"dmn:KnowledgeRequirement"};if(Ln(e,"dmn:Decision")){if(Ln(t,"dmn:Decision"))return{type:"dmn:InformationRequirement"};if(Ln(t,"dmn:KnowledgeSource"))return{type:"dmn:AuthorityRequirement"}}if(Ln(e,"dmn:Definitions")||Ln(t,"dmn:Definitions"))return!1;if(Ln(e,"dmn:InputData")){if(Ln(t,"dmn:Decision"))return{type:"dmn:InformationRequirement"};if(Ln(t,"dmn:KnowledgeSource"))return{type:"dmn:AuthorityRequirement"}}return Ln(e,"dmn:KnowledgeSource")&&Fn(t,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:KnowledgeSource"])?{type:"dmn:AuthorityRequirement"}:!!(Ln(e,"dmn:TextAnnotation")&&!Ln(t,"dmn:TextAnnotation")||!Ln(e,"dmn:TextAnnotation")&&Ln(t,"dmn:TextAnnotation"))&&{type:"dmn:Association"}}function Fp(e,t){return Fn(e,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:InputData","dmn:KnowledgeSource","dmn:TextAnnotation"])&&Ln(t,"dmn:Definitions")}function Up(e,t){return O(e)||(e=[e]),!t||!(!L(e,(function(e){return Fn(e,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:InputData","dmn:KnowledgeSource","dmn:TextAnnotation","dmn:InformationRequirement","dmn:AuthorityRequirement","dmn:KnowledgeRequirement","dmn:Association"])}))||!Ln(t,"dmn:Definitions"))}function Hp(e){return!!e.labelTarget}$p.$inject=["eventBus"],Hn($p,Kd),$p.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},$p.prototype.init=function(){},Hn(Vp,$p),Vp.$inject=["injector"],Vp.prototype.init=function(){this.addRule("connection.create",(function(e){return zp(e.source,e.target)})),this.addRule("connection.reconnect",(function(e){return e.connection,zp(e.source,e.target)})),this.addRule("connection.updateWaypoints",(function(e){var t=e.connection;return{type:t.type,businessObject:t.businessObject}})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes;return e.position,Up(n,t)})),this.addRule("shape.create",(function(e){return Fp(e.shape,e.target)})),this.addRule("shape.resize",(function(e){return Ln(e.shape,"dmn:TextAnnotation")}))},Vp.prototype.canConnect=zp,Vp.prototype.canCreate=Fp,Vp.prototype.canMove=Up;var Wp={__depends__:[au],__init__:["drdRules"],drdRules:["type",Vp]};function qp(e){this._model=e}function Gp(e,t,n,i,r){r.invoke(Kd,this),this._definitionPropertiesView=t,this._drdFactory=n,this._drdRules=i;var o=this;function a(e){var t=e.connection,n=e.parent,i=e.shape;t&&!Ln(t,"dmn:Association")&&(n=t.target),o.updateParent(i||t,n)}function s(e){var t=e.connection,n=e.shape,i=e.parent||e.newParent;t&&!Ln(t,"dmn:Association")&&(i=t.target),o.updateParent(n||t,i)}function u(e){var t=e.shape;(Ln(t,"dmn:DRGElement")||Ln(t,"dmn:TextAnnotation"))&&o.updateBounds(t)}function c(e){o.updateConnectionWaypoints(e)}this.executed(["connection.create","connection.layout"],(function(t){var n=t.connection;t.cropped||(n.waypoints=e.getCroppedWaypoints(n),t.cropped=!0)}),!0),this.reverted(["connection.layout"],(function(e){delete e.cropped}),!0),this.executed(["connection.create","connection.delete","connection.move","shape.create","shape.delete"],a,!0),this.reverted(["connection.create","connection.delete","connection.move","shape.create","shape.delete"],s,!0),this.executed(["shape.create","shape.move","shape.resize"],u,!0),this.reverted(["shape.create","shape.move","shape.resize"],u,!0),this.executed(["connection.create","connection.layout","connection.move","connection.updateWaypoints"],c,!0),this.reverted(["connection.create","connection.layout","connection.move","connection.updateWaypoints"],c,!0),this.executed("connection.create",(function(e){var t=e.connection,n=t.businessObject,i=e.target.businessObject;Ln(t,"dmn:Association")?a(e):o.updateSemanticParent(n,i)}),!0),this.reverted("connection.create",(function(e){s(e)}),!0),this.executed("connection.reconnect",(function(e){var t=e.connection.businessObject,n=e.newTarget.businessObject;Ln(t,"dmn:Association")||o.updateSemanticParent(t,n)}),!0),this.reverted("connection.reconnect",(function(e){var t=e.connection.businessObject,n=e.oldTarget.businessObject;Ln(t,"dmn:Association")||o.updateSemanticParent(t,n)}),!0),this.executed("element.updateProperties",(function(e){t.update()}),!0),this.reverted("element.updateProperties",(function(e){t.update()}),!0)}function Kp(e,t){this._modeling=e,this._canvas=t}function Xp(e){this._modeling=e}function Yp(e,t){this._canvas=e,this._layouter=t}qp.$inject=["moddle"],qp.prototype._needsId=function(e){return Fn(e,["dmn:Artifact","dmn:DMNElement","dmn:DRGElement","dmndi:DMNDiagram","dmndi:DMNDiagramElement"])},qp.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},qp.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},qp.prototype.createDiShape=function(e,t,n){return this.create("dmndi:DMNShape",J({dmnElementRef:e,bounds:this.createDiBounds(t)},n))},qp.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},qp.prototype.createDiEdge=function(e,t,n){return this.create("dmndi:DMNEdge",{dmnElementRef:e,waypoint:this.createDiWaypoints(t)},n)},qp.prototype.createDiWaypoints=function(e){var t=this;return e.map((function(e){return t.createDiWaypoint(e)}))},qp.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ee(e,["x","y"]))},qp.prototype.createExtensionElements=function(){return this.create("dmn:ExtensionElements",{values:[]})},Hn(Gp,Kd),Gp.$inject=["connectionDocking","definitionPropertiesView","drdFactory","drdRules","injector"],Gp.prototype.updateBounds=function(e){J(e.businessObject.di.bounds,{x:e.x,y:e.y,width:e.width,height:e.height})},Gp.prototype.updateConnectionWaypoints=function(e){var t=this._drdFactory,n=e.connection,i=n.businessObject.di;i.waypoint=t.createDiWaypoints(n.waypoints).map((function(e){return e.$parent=i,e}))},Gp.prototype.updateParent=function(e,t){var n=e.parent;Ln(e,"dmn:DRGElement")||Ln(e,"dmn:Artifact")||(n=t);var i=e.businessObject,r=n&&n.businessObject;this.updateSemanticParent(i,r),this.updateDiParent(i.di,r&&r.di)},Gp.prototype.updateSemanticParent=function(e,t){var n,i;e.$parent!==t&&(Ln(e,"dmn:DRGElement")?i="drgElement":Ln(e,"dmn:Artifact")?i="artifact":Ln(e,"dmn:InformationRequirement")?i="informationRequirement":Ln(e,"dmn:AuthorityRequirement")?i="authorityRequirement":Ln(e,"dmn:KnowledgeRequirement")&&(i="knowledgeRequirement"),e.$parent&&Xi(n=e.$parent.get(i),e),t?(n=t.get(i))&&(n.push(e),e.$parent=t):e.$parent=null)},Gp.prototype.updateDiParent=function(e,t){if(e.$parent!==t){if(!Fn(e,["dmndi:DMNEdge","dmndi:DMNShape"]))throw new Error("unsupported");for(var n=t||e;!Ln(n,"dmndi:DMNDiagram");)n=n.$parent;var i=n.get("diagramElements");t?(e.$parent=n,Yi(i,e)):(e.$parent=null,Xi(i,e))}},Kp.$inject=["modeling","canvas"],Kp.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;N(n,(function(e){var n={x:0,y:0};S(i.left)?n.x=i.left-e.x:S(i.right)?n.x=i.right-e.width-e.x:S(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:S(i.top)?n.y=i.top-e.y:S(i.bottom)?n.y=i.bottom-e.height-e.y:S(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},Kp.prototype.postExecute=function(e){},Xp.$inject=["modeling"],Xp.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Xp.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,$(t.outgoing,(function(e){return e.target===n}))||(i.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},Yp.$inject=["canvas","layouter"],Yp.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Yp.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Zp=Math.round;function Qp(e){this._modeling=e}function Jp(e){return!!e.waypoints}Qp.$inject=["modeling"],Qp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;N(t,(function(e){D(e.x)||(e.x=0),D(e.y)||(e.y=0)}));var s=Ui(A(t,(function(e){return!e.hidden})));N(t,(function(e){Jp(e)&&(e.waypoints=V(e.waypoints,(function(e){return{x:Zp(e.x-s.x-s.width/2+r.x),y:Zp(e.y-s.y-s.height/2+r.y)}}))),J(e,{x:Zp(e.x-s.x-s.width/2+r.x),y:Zp(e.y-s.y-s.height/2+r.y)})}));var u=Li(t),c={};N(t,(function(e){if(Jp(e))c[e.id]=D(i)?a.createConnection(c[e.source.id],c[e.target.id],i,e,e.parent||n,o):a.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=J({},o);-1===u.indexOf(e)&&(t.autoResize=!1),c[e.id]=D(i)?a.createShape(e,ee(e,["x","y","width","height"]),e.parent||n,i,t):a.createShape(e,ee(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=F(c)};var eh=Math.round;function th(e){this._canvas=e}function nh(e){th.call(this,e)}th.$inject=["canvas"],th.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?J(t,n):J(t,{x:n.x-eh(t.width/2),y:n.y-eh(t.height/2)}),this._canvas.addShape(t,i,r),t},th.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},Hn(nh,th),nh.$inject=["canvas"];var ih=th.prototype.execute;nh.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,ih.call(this,e)};var rh=th.prototype.revert;function oh(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function ah(e,t){this._canvas=e,this._modeling=t}function sh(e,t){this._modeling=e,this._elementRegistry=t}function uh(e,t){this._canvas=e,this._modeling=t}function ch(e){this._modeling=e}nh.prototype.revert=function(e){return e.shape.labelTarget=null,rh.call(this,e)},ah.$inject=["canvas","modeling"],ah.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;oh(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),oh(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},ah.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Zi(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ah.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Yi(n.children,t,i),this._canvas.addConnection(t,n),t},sh.$inject=["modeling","elementRegistry"],sh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;N(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},uh.$inject=["canvas","modeling"],uh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;oh(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),oh(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),oh(n.children,(function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},uh.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Zi(i.children,n),t.removeShape(n),n},uh.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Yi(i.children,n,r),t.addShape(n,i),n},ch.$inject=["modeling"];var lh={x:"y",y:"x"};function dh(e,t){this._layouter=e,this._canvas=t}function ph(){}function hh(e,t,n){var i=Ha(t),r=Ha(n),o=Wa(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return Vr({x:r.x+a,y:r.y+s})}function fh(e,t,n){var i=_h(e),r=bh(i,t),o=i[0];return r.length?r[r.length-1]:hh(o.original||o,n,t)}function vh(e,t,n){var i=_h(e),r=bh(i,t),o=i[i.length-1];return r.length?r[0]:hh(o.original||o,n,t)}function mh(e,t,n){var i=_h(e),r=yh(t,n),o=i[0];return hh(o.original||o,r,t)}function gh(e,t,n){var i=_h(e),r=yh(t,n),o=i[i.length-1];return hh(o.original||o,r,t)}function yh(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function _h(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bh(e,t){return A(V(e,xh),(function(e){return function(e,t){return"intersect"===Wr(t,e,1)}(e,t)}))}function xh(e){return e.original||e}function wh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Ch(e){this._modeling=e}function Eh(e){this._helper=new Ch(e)}function kh(e){this._modeling=e,this._helper=new Ch(e)}function Sh(e){this._modeling=e}function jh(e){return e.original||e}function Oh(e,t){this._modeling=e,this._rules=t}function Ph(e){this._modeling=e}function Dh(e,t){return-1!==e.indexOf(t)}function Rh(e){this._modeling=e}function Th(e){return J({},e)}function Mh(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Ih(e,t,n){var i=Mh(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Ah(e,t){return-1!==e.indexOf(t)}function Nh(e){this._modeling=e}function Bh(e){var t={};return N(e,(function(e){t[e.id]=e.hidden,e.children&&(t=J({},t,Bh(e.children)))})),t}function Lh(e,t){var n=[];return N(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Lh(e.children,e.collapsed||t)))})),n}function $h(e,t){var n=[];return N(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat($h(e.children,t)))})),n}function Vh(e){this._modeling=e}function zh(e,t){return Xi(e&&e.attachers,t)}function Fh(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Yi(i,t,n)}}function Uh(){}function Hh(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function Wh(e){this._moddle=e}function qh(){function e(e,t){var n=e.label||e,i=e.labelTarget||e;return function(e,t,n){var i=e.businessObject,r=jp(i);r&&(i[r]=t),n&&(e.hidden=!t)}(n,t,i!==n),[n,i]}this.execute=function(t){return t.oldLabel=Op(t.element),e(t.element,t.newLabel)},this.revert=function(t){return e(t.element,t.oldLabel)}}ch.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function u(e){return e.max-e.min}var c,l,d=n[0],p=s(n),h=n[p],f=0;N(n,(function(e,c){var l,d,h;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=u(e.range)):(d=(l=W(e.elements,i))[0],c===p&&(d=l[s(l)]),h=a(d),e.range=null,N(l,(function(n){!function(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[lh[i]]=0,t.moveElements([n],r,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}})),c&&c!==n.length-1&&(f+=u(e.range)))})),l=Math.abs(h.range.min-d.range.max),(c=Math.round((l-f)/(n.length-1)))<n.length-1||N(n,(function(e,o){var a,s={};e!==d&&e!==h&&(a=n[o-1],e.range.max=0,N(e.elements,(function(n,o){s[lh[i]]=0,s[i]=a.range.max-n[i]+c,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)})))}))},ch.prototype.postExecute=function(e){},dh.$inject=["layouter","canvas"],dh.prototype.execute=function(e){var t=e.connection;return J(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},dh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},ph.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Xi(o.children,t),Yi(i.children,t,r),t.parent=i,N(t.waypoints,(function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)})),t},ph.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Xi(n.children,t),Yi(i.children,t,r),t.parent=i,N(t.waypoints,(function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)})),t},wh.prototype.add=function(e,t){return this.addAll([e],t)},wh.prototype.addAll=function(e,t){var n=function(e,t,n){k(t)&&(t=!0),P(t)&&(n=t,t=!0);var i=qi((n=n||{}).allShapes),r=qi(n.allConnections),o=qi(n.enclosedElements),a=qi(n.enclosedConnections),s=qi(n.topLevel,t&&U(e,(function(e){return e.id})));function u(e){s[e.source.id]&&s[e.target.id]&&(s[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return zi(e,(function(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,N(e.incoming,u),N(e.outgoing,u),e.children;a[e.id]=r[e.id]=e})),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return J(this,n),this},Ch.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ch.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,u=e.enclosedConnections,c=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),N(a,(function(e){o.moveShape(e,t,c[e.id]&&!l&&n,{recurse:!1,layout:!1})})),N(s,(function(e){var i=!!a[e.source.id],r=!!a[e.target.id];u[e.id]&&i&&r?o.moveConnection(e,t,c[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&mh(e,e.source,t),connectionEnd:r&&gh(e,e.target,t)})}))},Ch.prototype.getClosure=function(e){return(new wh).addAll(e,!0)},Eh.$inject=["modeling"],Eh.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Eh.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},kh.$inject=["modeling"],kh.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ee(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Xi(o.children,t),Yi(i.children,t,r),J(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},kh.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(N(t.incoming,(function(e){r.layoutConnection(e,{connectionEnd:gh(e,t,n)})})),N(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:mh(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},kh.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Yi(n.children,t,i),J(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},kh.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},kh.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Sh.$inject=["modeling"],Sh.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return O(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Sh.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||i&&"source"!==o.docking||(a.connectionStart=a.connectionStart||jh(O(r)?r[0]:r)),!i||n&&"target"!==o.docking||(a.connectionEnd=a.connectionEnd||jh(O(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sh.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},Oh.$inject=["modeling","rules"],Oh.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints||{};function u(e,t,n){return r.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,l={x:a.x,y:a.y},d={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(a,l,o.parent,s),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(c=o.children.slice(),i.moveElements(c,{x:0,y:0},t,s));var p=o.incoming.slice(),h=o.outgoing.slice();N(p,(function(e){u(e.source,t,e)&&n.reconnectEnd(e,t,vh(e,t,d),s)})),N(h,(function(e){var i=e.target;u(t,i,e)&&n.reconnectStart(e,t,fh(e,t,d),s)}))},Oh.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Oh.prototype.execute=function(e){},Oh.prototype.revert=function(e){},Oh.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Oh.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Oh.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Ph.$inject=["modeling"],Ph.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},J(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ph.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds;!1!==(e.hints||{}).layout&&(N(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:vh(e,n,i)})})),N(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:fh(e,n,i)})})))},Ph.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return J(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Rh.$inject=["modeling"],Rh.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),N(r,(function(e){a[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return N(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;N(r.concat(o),(function(i){var r=i.source,o=i.target;(Dh(e,r)||Dh(e,o)||Dh(t,r)||Dh(t,o))&&(Dh(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,a)},Rh.prototype.execute=function(){},Rh.prototype.revert=function(){},Rh.prototype.moveShapes=function(e,t){var n=this;N(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Rh.prototype.resizeShapes=function(e,t,n){var i=this;N(e,(function(e){var r=function(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,u=n.y;switch(t){case"n":return{x:i,y:r+u,width:o,height:a-u};case"s":return{x:i,y:r,width:o,height:a+u};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}(e,n,t);i._modeling.resizeShape(e,r,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Rh.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,u=r.concat(o);N(e,(function(e){var c=e.source,l=e.target,d=function(e){return V(e.waypoints,(function(e){return(e=Th(e)).original&&(e.original=Th(e.original)),e}))}(e),p=Mh(n),h={};Ah(u,c)&&Ah(u,l)?(d=V(d,(function(e){return Ih(e,i,n)&&(e[p]=e[p]+t[p]),e.original&&Ih(e.original,i,n)&&(e.original[p]=e.original[p]+t[p]),e})),s._modeling.updateWaypoints(e,d,{labelBehavior:!1})):(Ah(u,c)||Ah(u,l))&&(Ah(r,c)?h.connectionStart=mh(e,c,t):Ah(r,l)?h.connectionEnd=gh(e,l,t):Ah(o,c)?h.connectionStart=fh(e,c,a[c.id]):Ah(o,l)&&(h.connectionEnd=vh(e,l,a[l.id])),s._modeling.layoutConnection(e,h))}))},Nh.$inject=["modeling"],Nh.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Bh(n),t.collapsed=!t.collapsed;var i=Lh(n,t.collapsed);return[t].concat(i)},Nh.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=$h(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Vh.$inject=["modeling"],Vh.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=zh(i,t),Fh(n,t),t.host=n,t},Vh.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,zh(n,t),Fh(i,t,r),t},Uh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Uh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Hh.$inject=["eventBus","elementFactory","commandStack"],Hh.prototype.getHandlers=function(){return{"shape.append":Xp,"shape.create":th,"shape.delete":uh,"shape.move":kh,"shape.resize":Ph,"shape.replace":Oh,"shape.toggleCollapse":Nh,spaceTool:Rh,"label.create":nh,"connection.create":Yp,"connection.delete":ah,"connection.move":ph,"connection.layout":dh,"connection.updateWaypoints":Uh,"connection.reconnect":Sh,"elements.create":Qp,"elements.move":Eh,"elements.delete":sh,"elements.distribute":ch,"elements.align":Kp,"element.updateAttachment":Vh}},Hh.prototype.registerHandlers=function(e){N(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Hh.prototype.moveShape=function(e,t,i,r,o){"object"===n(r)&&(o=r,r=null);var a={shape:e,delta:t,newParent:i,newParentIndex:r,hints:o||{}};this._commandStack.execute("shape.move",a)},Hh.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Hh.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},Hh.prototype.moveConnection=function(e,t,i,r,o){"object"===n(r)&&(o=r,r=void 0);var a={connection:e,delta:t,newParent:i,newParentIndex:r,hints:o||{}};this._commandStack.execute("connection.move",a)},Hh.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Hh.prototype.createConnection=function(e,t,i,r,o,a){"object"===n(i)&&(a=o,o=r,r=i,i=void 0);var s={source:e,target:t,parent:o,parentIndex:i,connection:r=this._create("connection",r),hints:a};return this._commandStack.execute("connection.create",s),s.connection},Hh.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,a,s=(r=r||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var u={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",u),u.shape},Hh.prototype.createElements=function(e,t,n,i,r){O(e)||(e=[e]),"number"!=typeof i&&(r=i,i=void 0);var o={position:t,elements:e,parent:n,parentIndex:i,hints:r=r||{}};return this._commandStack.execute("elements.create",o),o.elements},Hh.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Hh.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},Hh.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Hh.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Hh.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Hh.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Hh.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Hh.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Hh.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Hh.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},Hh.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Hh.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},Hh.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,J(i,{docking:"source"}))},Hh.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,J(i,{docking:"target"}))},Hh.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Hh.prototype._create=function(e,t){return t instanceof vo?t:this._elementFactory.create(e,t)},Hh.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},Wh.$inject=["moddle"],Wh.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},Wh.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)};var Gh="id";function Kh(e,t){this._elementRegistry=e,this._moddle=t}function Xh(e,t){return Gh in e&&e[Gh]!==t[Gh]}function Yh(e,t){N(t,(function(t,n){e.set(n,t)}))}function Zh(e,t,n){this._canvas=e,this._drdRules=t,n.invoke(Hh,this)}function Qh(){}Kh.$inject=["elementRegistry","moddle"],Kh.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=e.properties,s=e.oldProperties||function(e,t){return B(t,(function(t,n){return t[n]=e.get(n),t}),{})}(o,z(a));return Xh(a,o)&&(r.unclaim(o[Gh]),i.updateId(t,a[Gh]),r.claim(a[Gh],o)),"name"in a&&t.label&&n.push(t.label),Yh(o,a),e.oldProperties=s,e.changed=n,n},Kh.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Yh(r,i),Xh(n,r)&&(a.unclaim(n[Gh]),o.updateId(t,i[Gh]),a.claim(i[Gh],r)),e.changed},Hn(Zh,Hh),Zh.$inject=["canvas","drdRules","injector"],Zh.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Zh.prototype.connect=function(e,t,n,i){var r=this._drdRules,o=this._canvas.getRootElement();return n||(n=r.canConnect(e,t)||{type:"dmn:Association"}),this.createConnection(e,t,n,o,i)},Zh.prototype.getHandlers=function(){var e=Hh.prototype.getHandlers.call(this);return e["id.updateClaim"]=Wh,e["element.updateLabel"]=qh,e["element.updateProperties"]=Kh,e},Zh.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Zh.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Zh.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Qh.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Hr(t.source||e.source),t.connectionEnd||Hr(t.target||e.target)]};function Jh(e){this._connectionDocking=e}function ef(e,t){return e?e.original||e:Hr(t)}function tf(e){return J({original:e.point.original||e.point},e.actual)}function nf(e,t){this._elementRegistry=e,this._graphicsFactory=t}Hn(Jh,Qh),Jh.$inject=["connectionDocking"],Jh.prototype.layoutConnection=function(e,t){var n=this._connectionDocking;t||(t={});var i=t.source||e.source,r=t.target||e.target,o=t.waypoints||e.waypoints||[],a=t.connectionStart,s=t.connectionEnd,u=Wr(i,r);if(a||(a=ef(o[0],i)),s||(s=ef(o[o.length-1],r)),Ln(e,"dmn:InformationRequirement")){o=[a,s];var c=n.getCroppedWaypoints(J({},e,{waypoints:o}),i,r),l={x:(s=c.pop()).x,y:s.y};return u.includes("bottom")?l.y+=20:u.includes("top")?l.y-=20:u.includes("right")?l.x+=20:l.x-=20,o=c.concat([l,s])}return[a,s]},nf.$inject=["elementRegistry","graphicsFactory"],nf.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(tf(i)),o.push(tf(r)),o},nf.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},nf.prototype._getIntersection=function(e,t,n){return qr(this._getShapePath(e),this._getConnectionPath(t),n)},nf.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},nf.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},nf.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var rf={__init__:["modeling","drdUpdater"],__depends__:[Lp,Wp,Da,gp,ba,_p],drdFactory:["type",qp],drdUpdater:["type",Gp],elementFactory:["type",Ts],modeling:["type",Zh],layouter:["type",Jh],connectionDocking:["type",nf]},of=Math.round;function af(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function a(e,n,i,r){if(P(i)&&(r=i,i=!1),!n.waypoints&&n.parent&&!ui(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+of(e.width/2),y:e.y+of(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),r=function(e){var t=U(e,"id");return A(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(r),J(t,{shapes:r,validatedShapes:r,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,a={x:e.dx,y:e.dy};t=o(i,a,{x:e.x,y:e.y},r),n.delta=a,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,a=t.shapes;if(!1===r)return!1;i.x=of(i.x),i.y=of(i.y),0===i.x&&0===i.y||n.moveElements(a,i,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(oa(e)){var t=ta(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}})),this.start=a}af.$inject=["eventBus","dragging","modeling","selection","rules"];var sf="djs-dragging",uf="drop-ok",cf="drop-not-ok",lf="new-parent",df="attach-ok";function pf(e,t,n,i){function r(e){var t=function(e){var t=A(e,(function(t){return!function(e){return e.waypoints}(t)||I(e,q({id:t.source.id}))&&I(e,q({id:t.target.id}))}));return t}(o(e));return t}function o(e){var t=Fi(e,!0),n=V(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return w(t.concat(n))}function a(e,n){[df,uf,cf,lf].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}e.on("shape.move.start",499,(function(e){var a=e.context,s=a.shapes,u=a.allDraggedElements,c=r(s);if(!a.dragGroup){var l=mi("g");ai(l,n.cls("djs-drag-group",["no-events"])),ii(t.getActiveLayer(),l),a.dragGroup=l}c.forEach((function(e){i.addDragger(e,a.dragGroup)})),N(u=u?w([u,o(s)]):o(s),(function(e){t.addMarker(e,sf)})),a.allDraggedElements=u,a.differentParents=1!==function(e){return z(e).length}(U(s,(function(e){return e.parent&&e.parent.id})))})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?a(i,df):t.canExecute&&i&&i.id!==r.id?a(i,lf):a(i,t.canExecute?uf:cf)),Co(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&a(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,i=n.allDraggedElements,r=n.dragGroup;N(i,(function(e){t.removeMarker(e,sf)})),r&&li(r)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,sf),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}pf.$inject=["eventBus","canvas","styles","previewSupport"];var hf={__depends__:[da,ba,ha,au,tu,dc],__init__:["move","movePreview"],move:["type",af],movePreview:["type",pf]},ff=".djs-palette-toggle",vf=".entry",mf=ff+", "+vf,gf="djs-palette-",yf="open",_f="two-column";function bf(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",(function(e){var t=e.tool;n.updateToolHighlight(t)})),e.on("i18n.changed",(function(){n._update()})),e.on("diagram.init",(function(){n._diagramInitialized=!0,n._rebuild()}))}function xf(e,t){var n=t.getPaletteEntries();return R(n)?n(e):(N(n,(function(t,n){e[n]=t})),e)}bf.$inject=["eventBus","canvas"],bf.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},bf.prototype.getEntries=function(){return this._getProviders().reduce(xf,{})},bf.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},bf.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=xn(bf.HTML_MARKUP);n.appendChild(i),rn(n).add(gf+"shown"),gn.bind(i,mf,"click",(function(t){if(sn(t.delegateTarget,ff))return e.toggle();e.trigger("click",t)})),fn.bind(i,"mousedown",(function(e){e.stopPropagation()})),gn.bind(i,vf,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},bf.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},bf.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=rn(i),a=rn(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(_f,t),a.toggle(gf+_f,t),"open"in e&&(o.toggle(yf,e.open),a.toggle(gf+yf,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},bf.prototype._update=function(){var e=wn(".djs-palette-entries",this._container),t=this._entries=this.getEntries();an(e),N(t,(function(t,n){var i=t.group||"default",r=wn("[data-group="+bu(i)+"]",e);r||(tn(r=xn('<div class="group"></div>'),"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),a=xn(o);if(r.appendChild(a),!t.separator&&(tn(a,"data-action",n),t.title&&tn(a,"title",t.title),t.className&&function(e,t){var n=rn(e),i=O(t)?t:t.split(/\s+/g);i.forEach((function(e){n.add(e)}))}(a,t.className),t.imageUrl)){var s=xn("<img>");tn(s,"src",t.imageUrl),a.appendChild(s)}})),this.open()},bf.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=tn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},bf.prototype.triggerEntry=function(e,t,n,i){var r,o;if(r=this._entries[e]){if(R(o=r.action)){if("click"===t)return o(n,i)}else if(o[t])return o[t](n,i);n.preventDefault()}},bf.prototype._layoutChanged=function(){this._toggleState({})},bf.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},bf.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},bf.prototype.open=function(){this._toggleState({open:!0})},bf.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},bf.prototype.isActiveTool=function(e){return e&&this._activeTool===e},bf.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=wn(".djs-palette-entries",this._container),this._toolsContainer=wn("[data-group=tools]",t)),N(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=rn(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},bf.prototype.isOpen=function(){return rn(this._container).has(yf)},bf.prototype._getParentContainer=function(){return this._canvas.getContainer()},bf.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var wf={__init__:["palette"],palette:["type",bf]};function Cf(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Cf.$inject=["eventBus","dragging"],Cf.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Cf.prototype.isActive=function(e){return e&&this._active===e},Cf.prototype.length=function(e){return this._tools.length},Cf.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Cf.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",(function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)}),this),N(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&un(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Ef={__depends__:[tu],__init__:["toolManager"],toolManager:["type",Cf]};function kf(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",(function(e){(t._svg=e.svg).addEventListener("mousemove",n)})),e.on("canvas.destroy",(function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)}))}kf.$inject=["eventBus"],kf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null);return n}(0,0)};var Sf={__init__:["mouse"],mouse:["type",kf]},jf="crosshair";function Of(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,u=function(e){var n,i=t.getActiveLayer();ai(n=e.frame=mi("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ii(i,n)},c=function(e){var t=e.frame,n=e.bbox;ai(t,{x:n.x,y:n.y,width:n.width,height:n.height})},l=function(e){e.frame&&li(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){s.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",(function(e){var t=Pf(e),n=i.filter((function(e){return e}));s.select(n,t)})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Pf(e),u(t)})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Pf(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;l(t)})),e.on("element.mousedown",1500,(function(e){if(sa(e))return s.activateLasso(e.originalEvent),!0}))}function Pf(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}Of.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Of.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:jf,data:{context:{}}})},Of.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:jf,data:{context:{}}})},Of.prototype.select=function(e,t){var n=function(e,t){var n={};return N(e,(function(e){var i=e;i.waypoints&&(i=Ui(i)),!D(t.y)&&i.x>t.x&&(n[e.id]=e),!D(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(D(t.width)&&D(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:D(t.width)&&D(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select(F(n))},Of.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Of.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Df={__depends__:[Ef,Sf],__init__:["lassoTool"],lassoTool:["type",Of]},Rf=1500,Tf="grab";function Mf(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Rf,(function(e){if(aa(e))return a.activateMove(e.originalEvent,!0),!1})),s&&s.addListener(Rf,(function(e){if(If(e.keyEvent)&&!a.isActive()){var t=a._mouse.getLastMoveEvent();a.activateMove(t,!!t)}}),"keyboard.keydown"),s&&s.addListener(Rf,(function(e){If(e.keyEvent)&&a.isActive()&&a.toggle()}),"keyboard.keyup"),e.on("hand.end",(function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",(function(){a.activateMove(t.originalEvent,{reactivate:!0})}))})),e.on("hand.move.move",(function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})})),e.on("hand.move.end",(function(t){var n=t.context.reactivate;return!aa(t)&&n&&e.once("hand.move.ended",(function(e){a.activateHand(e.originalEvent,!0,!0)})),!1}))}function If(e){return Xs("Space",e)}Mf.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Mf.prototype.activateMove=function(e,t,i){"object"===n(t)&&(i=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Tf,data:{context:i||{}}})},Mf.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Tf,data:{context:{reactivate:n}}})},Mf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Mf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Af={__depends__:[Ef,Sf],__init__:["handTool"],handTool:["type",Mf]};function Nf(e,t,n,i,r,o){this._palette=e,this._create=t,this._elementFactory=n,this._handTool=i,this._lassoTool=r,this._translate=o,e.registerProvider(this)}Nf.$inject=["palette","create","elementFactory","handTool","lassoTool","translate"],Nf.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,r=this._handTool,o=this._lassoTool,a=this._translate;function s(e,t,r,o,a){function s(t){var r=i.createShape(J({type:e},a));n.start(t,r)}return{group:t,className:r,title:o,action:{dragstart:s,click:s}}}return J(t,{"hand-tool":{group:"tools",className:"dmn-icon-hand-tool",title:a("Activate the hand tool"),action:{click:function(e){r.activateHand(e)}}},"lasso-tool":{group:"tools",className:"dmn-icon-lasso-tool",title:a("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"tool-separator":{group:"tools",separator:!0},"create.decision":s("dmn:Decision","drd","dmn-icon-decision",a("Create Decision")),"create.input-data":s("dmn:InputData","drd","dmn-icon-input-data",a("Create Input Data")),"create.knowledge-source":s("dmn:KnowledgeSource","drd","dmn-icon-knowledge-source",a("Create Knowledge Source")),"create.business-knowledge-model":s("dmn:BusinessKnowledgeModel","drd","dmn-icon-business-knowledge",a("Create Knowledge Model"))}),t};var Bf={__depends__:[Jo,wf,Pc,Df,Af],__init__:["paletteProvider"],paletteProvider:["type",Nf]},Lf=Math.max,$f=Math.min;function Vf(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return D(r)&&(i=(/top|left/.test(e)?$f:Lf)(i,r)),D(o)&&(i=(/top|left/.test(e)?Lf:$f)(i,o)),i}function zf(e,t){return void 0!==e?e:20}function Ff(e){return!e.waypoints&&"label"!==e.type}function Uf(e,t){var i;if((i=void 0===e.length?A(e.children,Ff):e).length)return function(e,t){var i,r,o,a;return"object"===n(t)?(i=zf(t.left),r=zf(t.right),o=zf(t.top),a=zf(t.bottom)):i=r=o=a=zf(t),{x:e.x-i,y:e.y-o,width:e.width+i+r,height:e.height+o+a}}(Ui(i),t)}function Hf(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(e,t){var n,i=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=function(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+r,o.height=e.height-r):-1!==t.indexOf("s")&&(o.height=e.height+r),-1!==t.indexOf("e")?o.width=e.width+i:-1!==t.indexOf("w")&&(o.x=e.x+i,o.width=e.width-i),o}(i,o,t),e.newBounds=function(e,t){if(!t)return e;var n=zr(e);return Fr({top:Vf("top",n,t),right:Vf("right",n,t),bottom:Vf("bottom",n,t),left:Vf("left",n,t)})}(n,a),e.canExecute=r.canResize(e)}function a(e){var t,i=e.shape,r=e.canExecute,o=e.newBounds;if(r){if(t=o,!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(i,o={x:Math.round(t.x),y:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height)}))return;n.resizeShape(i,o)}}e.on("resize.start",(function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:zr(i)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){a(e.context)}))}function Wf(e,t){var n=Hr(e),i=zr(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}function qf(e){var t="resize-";return"n"===e||"s"===e?t+"ns":"e"===e||"w"===e?t+"ew":"nw"===e||"se"===e?t+"nwse":t+"nesw"}Hf.prototype.canResize=function(e){var t=this._rules,n=ee(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Hf.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=J({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Wf(t,r),"resize",{autoActivate:!0,cursor:qf(r),data:{shape:t,context:i}})},Hf.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=zr(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?zr(i):o;return Fr({top:$f(o.top,a.top),left:$f(o.left,a.left),bottom:Lf(o.bottom,a.bottom),right:Lf(o.right,a.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Uf(t,e.childrenBoxPadding))},Hf.$inject=["eventBus","rules","modeling","dragging"];var Gf="djs-resizing",Kf="resize-not-ok";function Xf(e,t,n){e.on("resize.move",500,(function(e){var i,r,o,a;i=e.context,r=i.shape,o=i.newBounds,(a=i.frame)||(a=i.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,Gf)),o.width>5&&ai(a,{x:o.x,width:o.width}),o.height>5&&ai(a,{y:o.y,height:o.height}),i.canExecute?ui(a).remove(Kf):ui(a).add(Kf)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&li(n.frame),t.removeMarker(i,Gf)}))}Xf.$inject=["eventBus","canvas","previewSupport"];var Yf=-6,Zf="djs-resizer",Qf=["n","w","s","e","nw","ne","se","sw"];function Jf(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&N(t,Q(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}Jf.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){oa(t)&&i.activate(t,e,n)}fn.bind(t,"mousedown",r),fn.bind(t,"touchstart",r)},Jf.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=Yf);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Yf);return t}(i),a=mi("g");ui(a).add(Zf),ui(a).add(Zf+"-"+e.id),ui(a).add(Zf+"-"+i),ii(r,a);var s=mi("rect");ai(s,{x:-4+o.x,y:-4+o.y,width:8,height:8}),ui(s).add(Zf+"-visual"),ii(a,s);var u=mi("rect");return ai(u,{x:-10+o.x,y:-10+o.y,width:20,height:20}),ui(u).add(Zf+"-hit"),ii(a,u),function(e,t,n,i,r){var o=bi();o.setTranslate(t,n);var a=bi();a.setRotate(i||0,0,0);var s=bi();s.setScale(r||1,r||1),Pi(e,[o,a,s])}(a,t,n),a},Jf.prototype.createResizer=function(e,t){var n=Wf(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Jf.prototype.addResizer=function(e){var t=this;!function(e){return!!e.waypoints}(e)&&this._resize.canResize({shape:e})&&N(Qf,(function(n){t.createResizer(e,n)}))},Jf.prototype.removeResizers=function(){di(this._getResizersParent())},Jf.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Jf.$inject=["eventBus","canvas","selection","resize"];var ev={__depends__:[au,tu,dc],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Hf],resizePreview:["type",Xf],resizeHandles:["type",Jf]};function tv(e){e.on(["bendpoint.move.move","bendpoint.move.end"],2e3,(function(e){var t=e.context,n=t.allowed,i=t.hover,r=t.source,o=t.target,a=t.type;if(t.hints||(t.hints={}),delete t.hints.connectionStart,delete t.hints.connectionEnd,(!n||"dmn:InformationRequirement"===n.type)&&i&&Fn(i,["dmn:Decision","dmn:InputData"])&&r!==o){var s="reconnectStart"===a||"reconnectEnd"===a,u=Wr(r,o);s&&i===r?(!function(e,t){var n=e.context,i=n.source,r=nv(i,t),o=e.x-r.x,a=e.y-r.y;e.x-=o,e.y-=a,e.dx-=o,e.dy-=a}(e,u),t.hints.connectionEnd=iv(o,u)):s&&i===o&&(t.hints.connectionStart=nv(r,u),function(e,t){var n=e.context,i=n.target,r=iv(i,t),o=0,a=0;t.includes("top")||t.includes("bottom")?a=e.y-r.y:o=e.x-r.x;e.x-=o,e.y-=a,e.dx-=o,e.dy-=a}(e,u))}}))}function nv(e,t){var n=zr(e),i=Hr(e);return t.includes("bottom")?i.y=n.top:t.includes("top")?i.y=n.bottom:t.includes("right")?i.x=n.left:i.x=n.right,i}function iv(e,t){var n=zr(e),i=Hr(e);return t.includes("bottom")?i.y=n.bottom:t.includes("top")?i.y=n.top:t.includes("right")?i.x=n.right:i.x=n.left,i}tv.$inject=["eventBus"];function rv(e){e.on(["connect.hover","connect.move","connect.end"],250,(function(e){var t=e.context,n=t.canExecute,i=t.hover,r=t.source,o=t.target;if(n&&"dmn:InformationRequirement"===n.type){var a=Wr(r,o);t.connectionStart=Hr(r),t.connectionEnd=i===r?Hr(o):{x:e.x,y:e.y},a.includes("bottom")?(t.connectionStart.y=zr(r).top,t.connectionEnd.y=zr(o).bottom):a.includes("top")?(t.connectionStart.y=zr(r).bottom,t.connectionEnd.y=zr(o).top):a.includes("right")?(t.connectionStart.x=zr(r).left,t.connectionEnd.x=zr(o).right):(t.connectionStart.x=zr(r).right,t.connectionEnd.x=zr(o).left)}else delete t.connectionStart,delete t.connectionEnd}))}function ov(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function av(e){this._snapValues={}}rv.$inject=["eventBus"],ov.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},ov.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},ov.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},ov.prototype.getSnapLocations=function(){return this._snapLocations},ov.prototype.setSnapLocations=function(e){this._snapLocations=e},ov.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new av).initDefaults(this._defaultSnaps),n},av.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},av.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],Fu(r-e)<=n)return r}(e[n],r[n],i)},av.prototype.initDefaults=function(e){var t=this;N(e||{},(function(e,n){N(e,(function(e){t.add(n,e)}))}))};function sv(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){i.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],1250,(function(e){var t=e.context,r=t.shape,o=t.snapContext,a=t.target;if((!e.originalEvent||!Ks(e.originalEvent))&&!Wu(e)&&a){var s=o.pointsForTarget(a);s.initialized||((s=i.addSnapTargetPoints(s,r,a)).initialized=!0),n.snap(e,s)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}function uv(e){return!!e.labelTarget}sv.$inject=["elementRegistry","eventBus","snapping"],sv.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new ov);var a=(t=n.get(r.id)?Hu(r,e):{x:e.x+Hu(r).x,y:e.y+Hu(r).y}).x-r.width/2,s=t.y-r.height/2,u=t.x+r.width/2,c=t.y+r.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),uv(r)||(o.setSnapOrigin("top-left",{x:a-e.x,y:s-e.y}),o.setSnapOrigin("bottom-right",{x:u-e.x,y:c-e.y})),o},sv.prototype.addSnapTargetPoints=function(e,t,n){return N(this.getSnapTargets(t,n),(function(n){if(uv(n))uv(t)&&e.add("mid",Hu(n));else if(n.waypoints){if(n.waypoints.length<3)return;N(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else{e.add("mid",Hu(n))}})),D(t.x)&&D(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Hu(t)),e):e},sv.prototype.getSnapTargets=function(e,t){return Gu(t).filter((function(e){return!e.hidden}))};function cv(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var i=e.context,r=i.shape,o=r.parent,a=i.direction,s=i.snapContext;if(!(e.originalEvent&&Ks(e.originalEvent)||Wu(e))){var u=s.pointsForTarget(o);u.initialized||((u=n.addSnapTargetPoints(u,r,o,a)).initialized=!0),function(e){return"n"===e||"s"===e}(a)&&qu(e,"x",e.x),function(e){return"e"===e||"w"===e}(a)&&qu(e,"y",e.y),t.snap(e,u)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function lv(e,t){var n=Hr(e),i=zr(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}cv.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new ov);var o=lv(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},cv.prototype.addSnapTargetPoints=function(e,t,n,i){return N(this.getSnapTargets(t,n),(function(t){var n;e.add("corner",{x:(n=t).x+n.width,y:n.y+n.height}),e.add("corner",function(e){return{x:e.x,y:e.y}}(t))})),e.add("corner",lv(t,i)),e},cv.$inject=["eventBus","snapping"],cv.prototype.getSnapTargets=function(e,t){return Gu(t).filter((function(t){return!(n=t,i=e,n.host===i||function(e){return!!e.waypoints}(t)||function(e){return!!e.hidden}(t)||function(e){return!!e.labelTarget}(t));var n,i}))};function dv(e){this._canvas=e,this._asyncHide=Y(Q(this.hide,this),1e3)}dv.$inject=["canvas"],dv.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:Wu(e,"x"),y:Wu(e,"y")};N(i,(function(i){var o=n.getSnapOrigin(i),a={x:e.x+o.x,y:e.y+o.y};if(N(["x","y"],(function(e){var n;r[e]||void 0!==(n=t.snap(a,i,e,7))&&(r[e]={value:n,originValue:n-o[e]})})),r.x&&r.y)return!1})),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),N(["x","y"],(function(t){var n=r[t];P(n)&&qu(e,t,n.originValue)}))},dv.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=mi("path");return ai(n,{d:"M0,0 L0,0"}),ui(n).add("djs-snap-line"),ii(t,n),{update:function(t){D(t)?ai(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):ai(n,{display:"none"})}}},dv.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},dv.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},dv.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},dv.prototype.hide=function(){N(this._snapLines,(function(e){e.update()}))};var pv={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",sv],resizeSnapping:["type",cv],snapping:["type",dv]}],__init__:["bendpointSnapping","connectSnapping"],bendpointSnapping:["type",tv],connectSnapping:["type",rv]};function hv(e){fs.call(this,e)}Hn(hv,fs),hv.prototype._modelingModules=[bs,zs,ru,Zu,_d,xd,Od,Md,$d,Fd,Zd,rp,sp,vp,Dp,rf,hf,Bf,ev,pv],hv.prototype._modules=[].concat(hv.prototype._modules,hv.prototype._modelingModules);var fv=o((function e(t){i(this,e),J(this,t),xv(this,"businessObject",{writable:!0})})),vv=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),xv(d(r=t.call(this,e)),"rows",{enumerable:!0,value:r.rows||[]}),xv(d(r),"cols",{enumerable:!0,value:r.cols||[]}),r}return o(n)}(fv),mv=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),xv(d(r=t.call(this,e)),"root",{writable:!0}),xv(d(r),"cells",{enumerable:!0,value:r.cells||[]}),r}return o(n)}(fv),gv=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),xv(d(r=t.call(this,e)),"root",{writable:!0}),xv(d(r),"cells",{enumerable:!0,value:r.cells||[]}),r}return o(n)}(fv),yv=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),xv(d(r=t.call(this,e)),"row",{writable:!0}),xv(d(r),"col",{writable:!0}),r}return o(n)}(fv),_v={root:vv,row:mv,col:gv,cell:yv};function bv(e,t){var n=_v[e];if(!n)throw new Error("unknown type "+e);return new n(t)}function xv(e,t,n){Object.defineProperty(e,t,n)}var wv=function(){function e(){i(this,e),this._uid=12}return o(e,[{key:"create",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.id||(t.id=e+"_"+this._uid++),bv(e,t)}},{key:"createRoot",value:function(e){return this.create("root",e)}},{key:"createRow",value:function(e){return this.create("row",e)}},{key:"createCol",value:function(e){return this.create("col",e)}},{key:"createCell",value:function(e){return this.create("cell",e)}}]),e}(),Cv=function(){function e(t){i(this,e),this._eventBus=t,this._elements={},t.on("table.clear",this.clear.bind(this))}return o(e,[{key:"add",value:function(e,t){var n=e.id;this._elements[n]=e}},{key:"remove",value:function(e){var t=e.id||e;delete this._elements[t]}},{key:"get",value:function(e){return this._elements[e]}},{key:"getAll",value:function(){return Ev(this._elements)}},{key:"forEach",value:function(e){Ev(this._elements).forEach((function(t){return e(t)}))}},{key:"filter",value:function(e){return Ev(this._elements).filter((function(t){return e(t)}))}},{key:"clear",value:function(){this._elements={}}},{key:"updateId",value:function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t}),this.remove(e),e.id=t,this.add(e)}},{key:"_validateId",value:function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")}}]),e}();function Ev(e){return Object.keys(e).map((function(t){return e[t]}))}Cv.$inject=["eventBus"];var kv=function(){function e(t){var n=this;i(this,e),this._listeners={},t.on("elements.changed",(function(e){var t=e.elements;n.elementsChanged(t)})),t.on("root.remove",(function(e){var i=e.root.id;n._listeners[i]&&t.once("root.add",(function(e){var t=e.root.id;n.updateId(i,t)}))})),t.on("element.updateId",(function(e){var t=e.element,i=e.newId;n.updateId(t.id,i)}))}return o(e,[{key:"elementsChanged",value:function(e){for(var t={},n=e.length,i=0;i<n;i++){var r=e[i].id;if(t[r])return;t[r]=!0;var o=this._listeners[r]&&this._listeners[r].length;if(o)for(var a=0;a<o;a++)this._listeners[r][a]&&this._listeners[r][a]()}}},{key:"onElementsChanged",value:function(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e][this._listeners[e].length]=t}},{key:"offElementsChanged",value:function(e,t){if(this._listeners[e])if(t){var n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}else this._listeners[e].length=0}},{key:"updateId",value:function(e,t){this._listeners[e]&&(this._listeners[t]=this._listeners[e],delete this._listeners[e])}}]),e}();kv.$inject=["eventBus"];var Sv=function(){function e(){i(this,e),this._listeners={}}return o(e,[{key:"getComponent",value:function(e,t){var n=this._listeners[e];if(n){for(var i,r=0;r<n.length&&!(i=n[r].callback(t));r++);return i}}},{key:"getComponents",value:function(e,t){var n=this._listeners[e],i=[];if(!n)return i;for(var r=0;r<n.length;r++){var o=n[r].callback(t);o&&i.push(o)}return i.length,i}},{key:"onGetComponent",value:function(e,t,n){if(R(t)&&(n=t,t=1e3),!D(t))throw new Error("priority must be a number");var i,r,o=this._getListeners(e),a={priority:t,callback:n};for(r=0;i=o[r];r++)if(i.priority<t)return void o.splice(r,0,a);o.push(a)}},{key:"offGetComponent",value:function(e,t){var n,i,r=this._getListeners(e);if(t)for(i=r.length-1;n=r[i];i--)n.callback===t&&r.splice(i,1);else r.length=0}},{key:"_getListeners",value:function(e){var t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}]),e}(),jv="$NO_OP",Ov=!("undefined"==typeof window||!window.document),Pv=Array.isArray;function Dv(e){var t=n(e);return"string"===t||"number"===t}function Rv(e){return Bv(e)||Nv(e)}function Tv(e){return Nv(e)||!1===e||function(e){return!0===e}(e)||Bv(e)}function Mv(e){return"function"==typeof e}function Iv(e){return"string"==typeof e}function Av(e){return"number"==typeof e}function Nv(e){return null===e}function Bv(e){return void 0===e}function Lv(e){throw e||(e="a runtime error occured! Use Inferno in development environment to find the error."),new Error("Inferno Error: "+e)}function $v(e){console.error(e)}function Vv(e,t){var n={};if(e)for(var i in e)n[i]=e[i];if(t)for(var r in t)n[r]=t[r];return n}function zv(e){var t;if(Pv(e))t="Array("+(e.length>3?e.slice(0,3).toString()+",...":e.toString())+")";else if(Dv(e))t="Text("+e+")";else if(Tv(e))t="InvalidVNode("+e+")";else{var n=e.flags;if(481&n)t="<"+e.type+(e.className?' class="'+e.className+'"':"")+">";else if(16&n)t="Text("+e.children+")";else if(1024&n)t="Portal*";else{var i=e.type;t="<"+(i.name||i.displayName||i.constructor.name||(i.toString().match(/^function\s*([^\s(]+)/)||[])[1])+" />"}}return">> "+t+"\n"}function Fv(e,t){for(var i={},r=0,o=e.length;r<o;r++){var a=e[r];if(Pv(a))return"Encountered ARRAY in mount, array must be flattened, or normalize used. Location: \n"+zv(a);if(Tv(a)){if(t)return"Encountered invalid node when preparing to keyed algorithm. Location: \n"+zv(a);if(0!==Object.keys(i).length)return"Encountered invalid node with mixed keys. Location: \n"+zv(a)}else{"object"===n(a)&&(a.isValidated=!0);var s=a.key;if(!Rv(s)&&!Dv(s))return"Encountered child vNode where key property is not string or number. Location: \n"+zv(a);var u=a.children,c=a.childFlags;if(!Tv(u)){var l=void 0;if(12&c?l=Fv(u,8&a.childFlags):2===c&&(l=Fv([u],8&a.childFlags)),l)return l+=zv(a)}if(t&&Rv(s))return"Encountered child without key during keyed algorithm. If this error points to Array make sure children is flat list. Location: \n"+zv(a);if(t||!Rv(s)){if(i[s])return"Encountered two children with same key: {"+s+"}. Location: \n"+zv(a);i[s]=!0}else if(0!==Object.keys(i).length)return"Encountered children with key missing. Location: \n"+zv(a)}}}function Uv(e){if(!(1&e.childFlags)&&(64&e.flags&&Lv("input elements can't have children."),128&e.flags&&Lv("textarea elements can't have children."),481&e.flags)){var t=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],n=e.type.toLowerCase();"media"===n&&Lv("media elements can't have children.");var i=t.indexOf(n);-1!==i&&Lv(t[i]+" elements can't have children.")}}function Hv(e){if(!1===e.isValidated&&e.children&&481&e.flags){var t=Fv(Array.isArray(e.children)?e.children:[e.children],(8&e.childFlags)>0);t&&Lv(t+zv(e))}e.isValidated=!0}var Wv="$";function qv(e,t,n,i,r,o,a,s){return{childFlags:e,children:t,className:n,dom:null,flags:i,isValidated:!1,key:void 0===r?null:r,parentVNode:null,props:void 0===o?null:o,ref:void 0===a?null:a,type:s}}function Gv(e,t,n,i,r,o,a,s){14&e&&Lv("Creating Component vNodes using createVNode is not allowed. Use Inferno.createComponentVNode method.");var u=void 0===r?1:r,c=qv(u,i,n,e,a,o,s,t);return 0===u&&em(c,c.children),Uv(c),c}function Kv(e,t,n,i,r){1&e&&Lv("Creating element vNodes using createComponentVNode is not allowed. Use Inferno.createVNode method."),(2&e)>0&&(e=t.prototype&&Mv(t.prototype.render)?4:8);var o=t.defaultProps;if(!Rv(o))for(var a in n||(n={}),o)Bv(n[a])&&(n[a]=o[a]);if((8&e)>0){var s=t.defaultHooks;if(!Rv(s))if(r)for(var u in s)Bv(r[u])&&(r[u]=s[u]);else r=s}var c=qv(1,null,null,e,i,n,r,t),l=tm.createVNode;return Mv(l)&&l(c),c}function Xv(e,t){return qv(1,Rv(e)?"":e,null,16,t,null,null,null)}function Yv(e){var t=e.props;if(t){var n=e.flags;481&n&&(void 0!==t.children&&Rv(e.children)&&em(e,t.children),void 0!==t.className&&(e.className=t.className||null,t.className=void 0)),void 0!==t.key&&(e.key=t.key,t.key=void 0),void 0!==t.ref&&(e.ref=8&n?Vv(e.ref,t.ref):t.ref,t.ref=void 0)}return e}function Zv(e){var t,n=e.flags;if(14&n){var i,r=e.props;if(!Nv(r))for(var o in i={},r)i[o]=r[o];t=Kv(n,e.type,i,e.key,e.ref)}else 481&n?t=Gv(n,e.type,e.className,e.children,e.childFlags,e.props,e.key,e.ref):16&n?t=Xv(e.children,e.key):1024&n&&(t=e);return t}function Qv(){return Xv("",null)}function Jv(e,t,n,i){for(var r=e.length;n<r;n++){var o=e[n];if(!Tv(o)){var a=i+Wv+n;if(Pv(o))Jv(o,t,0,a);else{if(Dv(o))o=Xv(o,a);else{var s=o.key,u=Iv(s)&&s[0]===Wv;Nv(o.dom)&&!u||(o=Zv(o)),Nv(s)||u?o.key=a:o.key=i+s}t.push(o)}}}}function em(e,t){var n,i=1;if(Tv(t))n=t;else if(Iv(t))i=2,n=Xv(t);else if(Av(t))i=2,n=Xv(t+"");else if(Pv(t)){var r=t.length;if(0===r)n=null,i=1;else{(Object.isFrozen(t)||!0===t.$)&&(t=t.slice()),i=8;for(var o=0;o<r;o++){var a=t[o];if(Tv(a)||Pv(a)){n=n||t.slice(0,o),Jv(t,n,o,"");break}if(Dv(a))(n=n||t.slice(0,o)).push(Xv(a,Wv+o));else{var s=a.key,u=Nv(a.dom),c=Nv(s),l=!c&&Iv(s)&&s[0]===Wv;!u||c||l?(n=n||t.slice(0,o),u&&!l||(a=Zv(a)),(c||l)&&(a.key=Wv+o),n.push(a)):n&&n.push(a)}}(n=n||t).$=!0}}else n=t,Nv(t.dom)||(n=Zv(t)),i=2;return e.children=n,e.childFlags=i,Uv(e),e}var tm={afterRender:null,beforeRender:null,createVNode:null,renderComplete:null},nm="http://www.w3.org/1999/xlink",im="http://www.w3.org/XML/1998/namespace",rm={"xlink:actuate":nm,"xlink:arcrole":nm,"xlink:href":nm,"xlink:role":nm,"xlink:show":nm,"xlink:title":nm,"xlink:type":nm,"xml:base":im,"xml:lang":im,"xml:space":im},om={},am=[];function sm(e,t){e.appendChild(t)}function um(e,t,n){Rv(n)?sm(e,t):e.insertBefore(t,n)}function cm(e,t,n){e.replaceChild(t,n)}function lm(e){for(var t;void 0!==(t=e.shift());)t()}Object.freeze(om);var dm={},pm={};function hm(e,t,n){var i=dm[e],r=n.$EV;t?(i||(pm[e]=function(e){var t=function(t){var n=t.type,i="click"===n||"dblclick"===n;if(i&&0!==t.button)return t.stopPropagation(),!1;t.stopPropagation=vm;var r={dom:document};Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return r.dom}}),function(e,t,n,i,r){var o=t;for(;!Nv(o);){if(n&&o.disabled)return;var a=o.$EV;if(a){var s=a[i];if(s&&(r.dom=o,s.event?s.event(s.data,e):s(e),e.cancelBubble))return}o=o.parentNode}}(t,t.target,i,e,r)};return document.addEventListener(fm(e),t),t}(e),dm[e]=0),r||(r=n.$EV={}),r[e]||dm[e]++,r[e]=t):r&&r[e]&&(dm[e]--,1===i&&(document.removeEventListener(fm(e),pm[e]),pm[e]=null),r[e]=t)}function fm(e){return e.substr(2).toLowerCase()}function vm(){this.cancelBubble=!0,this.immediatePropagationStopped||this.stopImmediatePropagation()}function mm(e,t){var n=document.createElement("i");return n.innerHTML=t,n.innerHTML===e.innerHTML}function gm(e,t,n){if(e[t]){var i=e[t];i.event?i.event(i.data,n):i(n)}else{var r=t.toLowerCase();e[r]&&e[r](n)}}function ym(e,t){var n=function(n){n.stopPropagation();var i=this.$V;if(i){var r=i.props||om,o=i.dom;if(Iv(e))gm(r,e,n);else for(var a=0;a<e.length;a++)gm(r,e[a],n);if(Mv(t)){var s=this.$V,u=s.props||om;t(u,o,!1,s)}}};return Object.defineProperty(n,"wrapped",{configurable:!1,enumerable:!1,value:!0,writable:!1}),n}function _m(e){return"checkbox"===e||"radio"===e}var bm=ym("onInput",Cm),xm=ym(["onClick","onChange"],Cm);function wm(e){e.stopPropagation()}function Cm(e,t){var n=e.type,i=e.value,r=e.checked,o=e.multiple,a=e.defaultValue,s=!Rv(i);n&&n!==t.type&&t.setAttribute("type",n),Rv(o)||o===t.multiple||(t.multiple=o),Rv(a)||s||(t.defaultValue=a+""),_m(n)?(s&&(t.value=i),Rv(r)||(t.checked=r)):s&&t.value!==i?(t.defaultValue=i,t.value=i):Rv(r)||(t.checked=r)}function Em(e,t){if("optgroup"===e.type){var n=e.children,i=e.childFlags;if(12&i)for(var r=0,o=n.length;r<o;r++)km(n[r],t);else 2===i&&km(n,t)}else km(e,t)}function km(e,t){var n=e.props||om,i=e.dom;i.value=n.value,Pv(t)&&-1!==t.indexOf(n.value)||n.value===t?i.selected=!0:Rv(t)&&Rv(n.selected)||(i.selected=n.selected||!1)}wm.wrapped=!0;var Sm=ym("onChange",jm);function jm(e,t,n,i){var r=Boolean(e.multiple);Rv(e.multiple)||r===t.multiple||(t.multiple=r);var o=i.childFlags;if(0==(1&o)){var a=i.children,s=e.value;if(n&&Rv(s)&&(s=e.defaultValue),12&o)for(var u=0,c=a.length;u<c;u++)Em(a[u],s);else 2===o&&Em(a,s)}}var Om=ym("onInput",Dm),Pm=ym("onChange");function Dm(e,t,n){var i=e.value,r=t.value;if(Rv(i)){if(n){var o=e.defaultValue;Rv(o)||o===r||(t.defaultValue=o,t.value=o)}}else r!==i&&(t.defaultValue=i,t.value=i)}function Rm(e,t,n,i,r,o){64&e?Cm(i,n):256&e?jm(i,n,r,t):128&e&&Dm(i,n,r),o&&(n.$V=t)}function Tm(e,t,n){64&e?function(e,t){_m(t.type)?(e.onchange=xm,e.onclick=wm):e.oninput=bm}(t,n):256&e?function(e){e.onchange=Sm}(t):128&e&&function(e,t){e.oninput=Om,t.onChange&&(e.onchange=Pm)}(t,n)}function Mm(e){return e.type&&_m(e.type)?!Rv(e.checked):!Rv(e.value)}function Im(e,t){Am(e),t&&e.dom&&(!function(e,t){e.removeChild(t)}(t,e.dom),e.dom=null)}function Am(e){var t=e.flags;if(481&t){var n=e.ref,i=e.props;Mv(n)&&n(null);var r=e.children,o=e.childFlags;if(12&o?Nm(r):2===o&&Am(r),!Nv(i))for(var a in i)switch(a){case"onClick":case"onDblClick":case"onFocusIn":case"onFocusOut":case"onKeyDown":case"onKeyPress":case"onKeyUp":case"onMouseDown":case"onMouseMove":case"onMouseUp":case"onSubmit":case"onTouchEnd":case"onTouchMove":case"onTouchStart":hm(a,null,e.dom)}}else{var s=e.children;if(s)if(14&t){var u=e.ref;4&t?(Mv(s.componentWillUnmount)&&s.componentWillUnmount(),Mv(u)&&u(null),s.$UN=!0,s.$LI&&Am(s.$LI)):(!Rv(u)&&Mv(u.onComponentWillUnmount)&&u.onComponentWillUnmount(e.dom,e.props||om),Am(s))}else 1024&t&&Im(s,e.type)}}function Nm(e){for(var t=0,n=e.length;t<n;t++)Am(e[t])}function Bm(e,t){Nm(t),e.textContent=""}function Lm(e,t){switch(e){case"animationIterationCount":case"borderImageOutset":case"borderImageSlice":case"borderImageWidth":case"boxFlex":case"boxFlexGroup":case"boxOrdinalGroup":case"columnCount":case"fillOpacity":case"flex":case"flexGrow":case"flexNegative":case"flexOrder":case"flexPositive":case"flexShrink":case"floodOpacity":case"fontWeight":case"gridColumn":case"gridRow":case"lineClamp":case"lineHeight":case"opacity":case"order":case"orphans":case"stopOpacity":case"strokeDasharray":case"strokeDashoffset":case"strokeMiterlimit":case"strokeOpacity":case"strokeWidth":case"tabSize":case"widows":case"zIndex":case"zoom":return t;default:return t+"px"}}function $m(e,t,n,i,r,o,a){switch(e){case"onClick":case"onDblClick":case"onFocusIn":case"onFocusOut":case"onKeyDown":case"onKeyPress":case"onKeyUp":case"onMouseDown":case"onMouseMove":case"onMouseUp":case"onSubmit":case"onTouchEnd":case"onTouchMove":case"onTouchStart":hm(e,n,i);break;case"children":case"childrenType":case"className":case"defaultValue":case"key":case"multiple":case"ref":break;case"autoFocus":i.autofocus=!!n;break;case"allowfullscreen":case"autoplay":case"capture":case"checked":case"controls":case"default":case"disabled":case"hidden":case"indeterminate":case"loop":case"muted":case"novalidate":case"open":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"selected":i[e]=!!n;break;case"defaultChecked":case"value":case"volume":if(o&&"value"===e)return;var s=Rv(n)?"":n;i[e]!==s&&(i[e]=s);break;case"dangerouslySetInnerHTML":var u=t&&t.__html||"",c=n&&n.__html||"";u!==c&&(Rv(c)||mm(i,c)||(Nv(a)||(12&a.childFlags?Nm(a.children):2===a.childFlags&&Am(a.children),a.children=null,a.childFlags=1),i.innerHTML=c));break;default:"o"===e[0]&&"n"===e[1]?function(e,t,n){var i=e.toLowerCase();if(Mv(t)||Rv(t)){var r=n[i];r&&r.wrapped||(n[i]=t)}else{var o=t.event;o&&Mv(o)?n[i]=function(e,t){return function(n){e(t.data,n)}}(o,t):Lv('an event on a VNode "'+e+'". was not a function or a valid linkEvent.')}}(e,n,i):Rv(n)?i.removeAttribute(e):"style"===e?function(e,t,n){var i,r,o=n.style;if(Iv(t))o.cssText=t;else if(Rv(e)||Iv(e))for(i in t)r=t[i],o[i]=Av(r)?Lm(i,r):r;else{for(i in t)(r=t[i])!==e[i]&&(o[i]=Av(r)?Lm(i,r):r);for(i in e)Rv(t[i])&&(o[i]="")}}(t,n,i):r&&rm[e]?i.setAttributeNS(rm[e],e,n):i.setAttribute(e,n)}}function Vm(e,t,n,i,r){var o=!1,a=(448&t)>0;for(var s in a&&(o=Mm(n))&&Tm(t,i,n),n)$m(s,null,n[s],i,r,o,null);a&&Rm(t,e,i,n,!0,o)}function zm(e,t,n,i){var r=new t(n,i);if(e.children=r,r.$V=e,r.$BS=!1,r.context=i,r.props===om&&(r.props=n),r.$UN=!1,Mv(r.componentWillMount)){if(r.$BR=!0,r.componentWillMount(),r.$PSS){var o=r.state,a=r.$PS;if(Nv(o))r.state=a;else for(var s in a)o[s]=a[s];r.$PSS=!1,r.$PS=null}r.$BR=!1}Mv(tm.beforeRender)&&tm.beforeRender(r);var u,c=Fm(r.render(n,r.state,i),e);return Mv(r.getChildContext)&&(u=r.getChildContext()),Rv(u)?r.$CX=i:r.$CX=Vv(i,u),Mv(tm.afterRender)&&tm.afterRender(r),r.$LI=c,r}function Fm(e,t){return Pv(e)&&Lv("a valid Inferno VNode (or null) must be returned from a component render. You may have returned an array or an invalid object."),Tv(e)?e=Qv():Dv(e)?e=Xv(e,null):(e.dom&&(e=Zv(e)),14&e.flags&&(e.parentVNode=t)),e}function Um(e,t,i,r){var o=e.flags;return 481&o?Wm(e,t,i,r):14&o?function(e,t,n,i,r){var o,a=e.type,s=e.props||om,u=e.ref;if(r){var c=zm(e,a,s,n);e.dom=o=Um(c.$LI,null,c.$CX,i),Gm(e,u,c),c.$UPD=!1}else{var l=Fm(a(s,n),e);e.children=l,e.dom=o=Um(l,null,n,i),Km(s,u,o)}Nv(t)||sm(t,o);return o}(e,t,i,r,(4&o)>0):512&o||16&o?Hm(e,t):1024&o?(Um(e.children,e.type,i,!1),e.dom=Hm(Qv(),t)):void("object"===n(e)?Lv("mount() received an object that's not a valid VNode, you should stringify it first, fix createVNode flags or call normalizeChildren. Object: \""+JSON.stringify(e)+'".'):Lv('mount() expects a valid VNode, instead it received an object with the type "'+n(e)+'".'))}function Hm(e,t){var n=e.dom=document.createTextNode(e.children);return Nv(t)||sm(t,n),n}function Wm(e,t,n,i){var r=e.flags,o=e.children,a=e.props,s=e.className,u=e.ref,c=e.childFlags;i=i||(32&r)>0;var l=function(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}(e.type,i);if(e.dom=l,Rv(s)||""===s||(i?l.setAttribute("class",s):l.className=s),Hv(e),Nv(t)||sm(t,l),0==(1&c)){var d=!0===i&&"foreignObject"!==e.type;2===c?Um(o,l,n,d):12&c&&qm(o,l,n,d)}return Nv(a)||Vm(e,r,a,l,i),Iv(u)&&Lv('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'),Mv(u)&&Xm(l,u),l}function qm(e,t,n,i){for(var r=0,o=e.length;r<o;r++){var a=e[r];Nv(a.dom)||(e[r]=a=Zv(a)),Um(a,t,n,i)}}function Gm(e,t,i){Mv(t)?t(i):Dv(t)?Lv('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'):!Rv(t)&&function(e){return"object"===n(e)}(t)&&4&e.flags&&Lv("functional component lifecycle events are not supported on ES2015 class components."),Mv(i.componentDidMount)&&am.push(function(e){return function(){e.$UPD=!0,e.componentDidMount(),e.$UPD=!1}}(i))}function Km(e,t,n){Rv(t)||(Mv(t.onComponentWillMount)&&t.onComponentWillMount(e),Mv(t.onComponentDidMount)&&am.push(function(e,t,n){return function(){return e.onComponentDidMount(t,n)}}(t,n,e)))}function Xm(e,t){am.push((function(){return t(e)}))}function Ym(e,t,n,i){var r=e.children,o=e.props,a=e.className,s=e.flags,u=e.ref;if(i=i||(32&s)>0,1!==t.nodeType||t.tagName.toLowerCase()!==e.type){$v("Inferno hydration: Server-side markup doesn't match client-side markup or Initial render target is not empty");var c=Wm(e,null,n,i);e.dom=c,cm(t.parentNode,c,t)}else{e.dom=t;var l=t.firstChild,d=e.childFlags;if(0==(1&d)){for(var p=null;l;)p=l.nextSibling,8===l.nodeType&&("!"===l.data?t.replaceChild(document.createTextNode(""),l):t.removeChild(l)),l=p;if(l=t.firstChild,2===d)Nv(l)?Um(r,t,n,i):(p=l.nextSibling,Zm(r,l,n,i),l=p);else if(12&d)for(var h=0,f=r.length;h<f;h++){var v=r[h];Nv(l)?Um(v,t,n,i):(p=l.nextSibling,Zm(v,l,n,i),l=p)}for(;l;)p=l.nextSibling,t.removeChild(l),l=p}else Nv(t.firstChild)||function(e,t){return Boolean(t&&t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html&&mm(e,t.dangerouslySetInnerHTML.__html))}(t,o)||(t.textContent="",448&s&&(t.defaultValue=""));Nv(o)||Vm(e,s,o,t,i),Rv(a)?""!==t.className&&t.removeAttribute("class"):i?t.setAttribute("class",a):t.className=a,Mv(u)?Xm(t,u):Iv(u)&&Lv('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.')}}function Zm(e,t,i,r){var o=e.flags;14&o?function(e,t,n,i,r){var o=e.type,a=e.ref,s=e.props||om;if(r){var u=zm(e,o,s,n),c=u.$LI;Zm(c,t,u.$CX,i),e.dom=c.dom,Gm(e,a,u),u.$UPD=!1}else{var l=Fm(o(s,n),e);Zm(l,t,n,i),e.children=l,e.dom=l.dom,Km(s,a,t)}}(e,t,i,r,(4&o)>0):481&o?Ym(e,t,i,r):16&o?function(e,t){if(3!==t.nodeType){var n=Hm(e,null);e.dom=n,cm(t.parentNode,n,t)}else{var i=e.children;t.nodeValue!==i&&(t.nodeValue=i),e.dom=t}}(e,t):512&o?e.dom=t:(Lv('hydrate() expects a valid VNode, instead it received an object with the type "'+n(e)+'".'),Lv())}function Qm(e,t,n,i,r){Am(e),cm(n,Um(t,null,i,r),e.dom)}function Jm(e,t,n,i,r){var o=0|t.flags;e.flags!==o||2048&o?Qm(e,t,n,i,r):481&o?function(e,t,n,i,r,o){var a=t.type;if(e.type!==a)Qm(e,t,n,i,r);else{var s,u=e.dom,c=e.props,l=t.props,d=!1,p=!1;if(t.dom=u,r=r||(32&o)>0,c!==l){var h=c||om;if((s=l||om)!==om)for(var f in(d=(448&o)>0)&&(p=Mm(s)),s){var v=h[f],m=s[f];v!==m&&$m(f,v,m,u,r,p,e)}if(h!==om)for(var g in h)s.hasOwnProperty(g)||Rv(h[g])||$m(g,h[g],null,u,r,p,e)}var y=e.children,_=t.children,b=t.ref,x=e.className,w=t.className;Hv(t),4096&o?function(e,t){e.textContent!==t.children&&(e.textContent=t.children)}(u,_):eg(e.childFlags,t.childFlags,y,_,u,i,r&&"foreignObject"!==a),d&&Rm(o,t,u,s,!1,p),x!==w&&(Rv(w)?u.removeAttribute("class"):r?u.setAttribute("class",w):u.className=w),Mv(b)&&e.ref!==b?Xm(u,b):Iv(b)&&Lv('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.')}}(e,t,n,i,r,o):14&o?function(e,t,n,i,r,o){var a=t.type,s=e.key,u=t.key;if(e.type!==a||s!==u)Qm(e,t,n,i,r);else{var c=t.props||om;if(o){var l=e.children;l.$UPD=!0,l.$V=t,tg(l,l.state,t,c,n,i,r,!1,!1),l.$UPD=!1}else{var d=!0,p=e.props,h=t.ref,f=!Rv(h),v=e.children;if(t.dom=e.dom,t.children=v,f&&Mv(h.onComponentShouldUpdate)&&(d=h.onComponentShouldUpdate(p,c)),!1!==d){f&&Mv(h.onComponentWillUpdate)&&h.onComponentWillUpdate(p,c);var m=a(c,i);m!==jv&&(Jm(v,m=Fm(m,t),n,i,r),t.children=m,t.dom=m.dom,f&&Mv(h.onComponentDidUpdate)&&h.onComponentDidUpdate(p,c))}else 14&v.flags&&(v.parentVNode=t)}}}(e,t,n,i,r,(4&o)>0):16&o?function(e,t){var n=t.children,i=e.dom;n!==e.children&&(i.nodeValue=n);t.dom=i}(e,t):512&o?t.dom=e.dom:function(e,t,n){var i=e.type,r=t.type,o=t.children;if(eg(e.childFlags,t.childFlags,e.children,o,i,n,!1),t.dom=e.dom,i!==r&&!Tv(o)){var a=o.dom;i.removeChild(a),r.appendChild(a)}}(e,t,i)}function eg(e,t,n,i,r,o,a){switch(e){case 2:switch(t){case 2:Jm(n,i,r,o,a);break;case 1:Im(n,r);break;default:Im(n,r),qm(i,r,o,a)}break;case 1:switch(t){case 2:Um(i,r,o,a);break;case 1:break;default:qm(i,r,o,a)}break;default:if(12&t){var s=n.length,u=i.length;0===s?u>0&&qm(i,r,o,a):0===u?Bm(r,n):8===t&&8===e?function(e,t,n,i,r,o,a){var s,u,c=o-1,l=a-1,d=0,p=e[d],h=t[d];e:{for(;p.key===h.key;){if(h.dom&&(t[d]=h=Zv(h)),Jm(p,h,n,i,r),e[d]=h,++d>c||d>l)break e;p=e[d],h=t[d]}for(p=e[c],h=t[l];p.key===h.key;){if(h.dom&&(t[l]=h=Zv(h)),Jm(p,h,n,i,r),e[c]=h,l--,d>--c||d>l)break e;p=e[c],h=t[l]}}if(d>c){if(d<=l)for(var f=(u=l+1)<a?t[u].dom:null;d<=l;)(h=t[d]).dom&&(t[d]=h=Zv(h)),d++,um(n,Um(h,null,i,r),f)}else if(d>l)for(;d<=c;)Im(e[d++],n);else{var v=d,m=d,g=c-d+1,y=l-d+1,_=[];for(s=0;s<y;s++)_.push(0);var b=g===o,x=!1,w=0,C=0;if(a<4||(g|y)<32)for(s=v;s<=c;s++)if(p=e[s],C<y){for(d=m;d<=l;d++)if(h=t[d],p.key===h.key){if(_[d-m]=s+1,b)for(b=!1;s>v;)Im(e[v++],n);w>d?x=!0:w=d,h.dom&&(t[d]=h=Zv(h)),Jm(p,h,n,i,r),C++;break}!b&&d>l&&Im(p,n)}else b||Im(p,n);else{var E={};for(s=m;s<=l;s++)E[t[s].key]=s;for(s=v;s<=c;s++)if(p=e[s],C<y)if(void 0!==(d=E[p.key])){if(b)for(b=!1;s>v;)Im(e[v++],n);h=t[d],_[d-m]=s+1,w>d?x=!0:w=d,h.dom&&(t[d]=h=Zv(h)),Jm(p,h,n,i,r),C++}else b||Im(p,n);else b||Im(p,n)}if(b)Bm(n,e),qm(t,n,i,r);else if(x){var k=function(e){var t,n,i,r,o,a=e.slice(),s=[0],u=e.length;for(t=0;t<u;t++){var c=e[t];if(0!==c){if(e[n=s[s.length-1]]<c){a[t]=n,s.push(t);continue}for(i=0,r=s.length-1;i<r;)e[s[o=(i+r)/2|0]]<c?i=o+1:r=o;c<e[s[i]]&&(i>0&&(a[t]=s[i-1]),s[i]=t)}}i=s.length,r=s[i-1];for(;i-- >0;)s[i]=r,r=a[r];return s}(_);for(d=k.length-1,s=y-1;s>=0;s--)0===_[s]?((h=t[w=s+m]).dom&&(t[w]=h=Zv(h)),u=w+1,um(n,Um(h,null,i,r),u<a?t[u].dom:null)):d<0||s!==k[d]?(u=(w=s+m)+1,um(n,(h=t[w]).dom,u<a?t[u].dom:null)):d--}else if(C!==y)for(s=y-1;s>=0;s--)0===_[s]&&((h=t[w=s+m]).dom&&(t[w]=h=Zv(h)),u=w+1,um(n,Um(h,null,i,r),u<a?t[u].dom:null))}}(n,i,r,o,a,s,u):function(e,t,n,i,r,o,a){for(var s,u,c=o>a?a:o,l=0;l<c;l++)s=t[l],u=e[l],s.dom&&(s=t[l]=Zv(s)),Jm(u,s,n,i,r),e[l]=s;if(o<a)for(l=c;l<a;l++)(s=t[l]).dom&&(s=t[l]=Zv(s)),Um(s,n,i,r);else if(o>a)for(l=c;l<o;l++)Im(e[l],n)}(n,i,r,o,a,s,u)}else 1===t?Bm(r,n):2===t&&(Bm(r,n),Um(i,r,o,a))}}function tg(e,t,n,i,r,o,a,s,u){var c,l=e.state,d=e.props;if(n.children=e,e.$UN)$v("Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.");else{if(d!==i||i===om){if(!u&&Mv(e.componentWillReceiveProps)){if(e.$BR=!0,e.componentWillReceiveProps(i,o),e.$UN)return;e.$BR=!1}e.$PSS&&(t=Vv(t,e.$PS),e.$PSS=!1,e.$PS=null)}var p=Boolean(e.shouldComponentUpdate);if(s||!p||p&&e.shouldComponentUpdate(i,t,o)){Mv(e.componentWillUpdate)&&(e.$BS=!0,e.componentWillUpdate(i,t,o),e.$BS=!1),e.props=i,e.state=t,e.context=o,Mv(tm.beforeRender)&&tm.beforeRender(e),c=e.render(i,t,o),Mv(tm.afterRender)&&tm.afterRender(e);var h,f=c!==jv;if(Mv(e.getChildContext)&&(h=e.getChildContext()),h=Rv(h)?o:Vv(o,h),e.$CX=h,f){var v=e.$LI,m=Fm(c,n);Jm(v,m,r,h,a),e.$LI=m,Mv(e.componentDidUpdate)&&e.componentDidUpdate(d,l)}}else e.props=i,e.state=t,e.context=o;n.dom=e.$LI.dom}}Ov&&null===document.body&&$v('Inferno warning: you cannot initialize inferno without "document.body". Wait on "DOMContentLoaded" event, add script to bottom of body, or use async/defer attributes on script tag.');var ng=Ov?document.body:null;function ig(e,t,n){if(ng===t&&Lv('you cannot render() to the "document.body". Use an empty element as a container instead.'),e!==jv){var i=t.$V;return Rv(i)?Tv(e)||(e.dom&&(e=Zv(e)),Nv(t.firstChild)?(Um(e,t,om,!1),t.$V=e):function(e,t,n){var i=t.firstChild;if(!Nv(i))for(Tv(e)||Zm(e,i,om,!1),i=t.firstChild;i=i.nextSibling;)t.removeChild(i);am.length>0&&lm(am),t.$V=e,Mv(n)&&n()}(e,t),i=e):Rv(e)?(Im(i,t),t.$V=null):(e.dom&&(e=Zv(e)),Jm(i,e,t,om,!1),i=t.$V=e),am.length>0&&lm(am),Mv(n)&&n(),Mv(tm.renderComplete)&&tm.renderComplete(i),i&&14&i.flags?i.children:void 0}}var rg="undefined"==typeof Promise?null:Promise.resolve(),og="undefined"==typeof requestAnimationFrame?setTimeout:requestAnimationFrame.bind(window);function ag(e,t,n,i){Mv(t)&&(t=t(e.state,e.props,e.context));var r,o=e.$PS;if(Rv(o))e.$PS=t;else for(var a in t)o[a]=t[a];if(e.$PSS||e.$BR)e.$PSS=!0,e.$BR&&Mv(n)&&am.push(n.bind(e));else if(e.$UPD){var s=e.$QU;Nv(s)&&(s=e.$QU=[],r=function(e,t){return function(){e.$QU=null,e.$UPD=!0,sg(e,!1,(function(){for(var n=0,i=t.length;n<i;n++)t[n].call(e)})),e.$UPD=!1}}(e,s),rg?rg.then(r):og(r)),Mv(n)&&s.push(n)}else e.$PSS=!0,e.$UPD=!0,sg(e,i,n),e.$UPD=!1}function sg(e,t,n){if(!e.$UN){if(t||!e.$BR){e.$PSS=!1;var i=e.$PS,r=Vv(e.state,i),o=e.props,a=e.context;e.$PS=null;var s=e.$V,u=e.$LI;if(tg(e,r,s,o,u.dom&&u.dom.parentNode,a,(32&s.flags)>0,t,!0),e.$UN)return;if(0==(1024&e.$LI.flags))for(var c=e.$LI.dom;!Nv(s=s.parentVNode);)(14&s.flags)>0&&(s.dom=c);am.length>0&&lm(am)}else e.state=e.$PS,e.$PS=null;Mv(n)&&n.call(e)}}var ug=function(e,t){this.state=null,this.$BR=!1,this.$BS=!0,this.$PSS=!1,this.$PS=null,this.$LI=null,this.$V=null,this.$UN=!1,this.$CX=null,this.$UPD=!0,this.$QU=null,this.props=e||om,this.context=t||om};ug.prototype.forceUpdate=function(e){this.$UN||ag(this,{},e,!0)},ug.prototype.setState=function(e,t){this.$UN||(this.$BS?Lv("cannot update state via setState() in componentWillUpdate() or constructor."):ag(this,e,t,!1))},ug.prototype.render=function(e,t,n){};var cg=function(){};console.info("Inferno is in development mode."),-1===(cg.name||cg.toString()).indexOf("testFn")&&$v("It looks like you're using a minified copy of the development build of Inferno. When deploying Inferno apps to production, make sure to use the production build which skips development warnings and is faster. See http://infernojs.org for more details.");var lg=function(e){s(n,e);var t=h(n);function n(e){var r;i(this,n);var o=(r=t.call(this,e))._injector=e.injector;r._sheet=o.get("sheet"),r._changeSupport=o.get("changeSupport"),r._components=o.get("components"),r._eventBus=o.get("eventBus");var a=o.get("throttle");return r.onElementsChanged=r.onElementsChanged.bind(d(r)),r.onScroll=a(r.onScroll.bind(d(r))),r}return o(n,[{key:"onElementsChanged",value:function(){this.forceUpdate()}},{key:"onScroll",value:function(){this._eventBus.fire("sheet.scroll")}},{key:"getChildContext",value:function(){return{changeSupport:this._changeSupport,components:this._components,injector:this._injector}}},{key:"componentWillMount",value:function(){var e=this._sheet.getRoot().id;this._changeSupport.onElementsChanged(e,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this._sheet.getRoot().id;this._changeSupport.offElementsChanged(e,this.onElementsChanged)}},{key:"render",value:function(){var e=this._sheet.getRoot(),t=e.rows,n=e.cols,i=this._components.getComponents("table.before"),r=this._components.getComponents("table.after"),o=this._components.getComponent("table.head"),a=this._components.getComponent("table.body"),s=this._components.getComponent("table.foot");return Gv(1,"div","tjs-container",[i&&i.map((function(e,t){return Kv(2,e,null,t)})),Gv(1,"div","tjs-table-container",Gv(1,"table","tjs-table",[o&&Kv(2,o,{rows:t,cols:n}),a&&Kv(2,a,{rows:t,cols:n}),s&&Kv(2,s,{rows:t,cols:n})],0),2,{onScroll:this.onScroll}),r&&r.map((function(e,t){return Kv(2,e,null,t)}))],0)}}]),n}(ug),dg=function(){function e(t,n,r,o,a){i(this,e);var s=r.container;this._container=s,o.on("root.added",(function(){ig(Kv(2,lg,{injector:a}),s)})),o.on("root.remove",(function(){ig(null,s)}))}return o(e,[{key:"getContainer",value:function(){return this._container}}]),e}();dg.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var pg={__init__:["changeSupport","components","renderer"],changeSupport:["type",kv],components:["type",Sv],renderer:["type",dg]},hg=function(){function e(t,n){var r=this;i(this,e),this._elementRegistry=t,this._eventBus=n,this._root=null,n.on("table.clear",(function(){r.setRoot(null)}))}return o(e,[{key:"setRoot",value:function(e){if(this._root){var t=this._root;this._eventBus.fire("root.remove",{root:t}),this._root=null,this._eventBus.fire("root.removed",{root:t})}e&&this._eventBus.fire("root.add",{root:e}),this._root=e,e&&this._eventBus.fire("root.added",{root:e})}},{key:"getRoot",value:function(){return this._root||this.setRoot({id:"__implicitroot",rows:[],cols:[]}),this._root}},{key:"addRow",value:function(e,t){var n=this,i=this.getRoot();if(i.cols.length!=e.cells.length)throw new Error("number of cells is not equal to number of cols");return void 0===t&&(t=i.rows.length),fg(t,i.rows,e),e.root=i,this._elementRegistry.add(e),e.cells.forEach((function(r,o){n._elementRegistry.add(r),r.row=e,r.col=i.cols[o],fg(t,i.cols[o].cells,r)})),this._eventBus.fire("row.add",{row:e}),e}},{key:"removeRow",value:function(e){var t=this,n=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));var i=n.rows.indexOf(e);-1!==i&&(vg(i,n.rows),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach((function(e,r){t._elementRegistry.remove(e),e.col=void 0,vg(i,n.cols[r].cells)})),this._eventBus.fire("row.remove",{row:e}))}},{key:"addCol",value:function(e,t){var n=this,i=this.getRoot();if(this._elementRegistry.add(e),i.rows.length!=e.cells.length)throw new Error("number of cells is not equal to number of rows");return void 0===t&&(t=i.cols.length),fg(t,i.cols,e),e.root=i,e.cells.forEach((function(r,o){n._elementRegistry.add(r),r.col=e,r.row=i.rows[o],fg(t,i.rows[o].cells,r)})),this._eventBus.fire("col.add",{col:e}),e}},{key:"removeCol",value:function(e){var t=this,n=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));var i=n.cols.indexOf(e);-1!==i&&(vg(i,n.cols),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach((function(e,r){t._elementRegistry.remove(e),e.row=void 0,vg(i,n.rows[r].cells)})),this._eventBus.fire("col.remove",{col:e}))}},{key:"resized",value:function(){this._eventBus.fire("sheet.resized")}}]),e}();function fg(e,t,n){return t.splice(e,0,n)}function vg(e,t){return t.splice(e,1)}function mg(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t="number"==typeof e?e:e?300:0;return t?function(e){return Z(e,t)}:function(e){return e}}hg.$inject=["elementRegistry","eventBus"],mg.$inject=["config.throttle"];var gg={__depends__:[pg],__init__:["elementFactory","sheet"],elementFactory:["type",wv],elementRegistry:["type",Cv],eventBus:["type",re],sheet:["type",hg],throttle:["factory",mg]},yg=["modules"],_g=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=t.injector;if(!n){var r=this._init(t),o=r.modules,a=r.config;n=bg(a,o)}this.get=n.get,this.invoke=n.invoke,this.get("eventBus").fire("table.init"),this.get("eventBus").fire("diagram.init")}return o(e,[{key:"_init",value:function(e){return{modules:e.modules,config:l(e,yg)}}},{key:"destroy",value:function(){var e=this.get("eventBus");e.fire("table.destroy"),e.fire("diagram.destroy")}},{key:"clear",value:function(){var e=this.get("eventBus");e.fire("table.clear"),e.fire("diagram.clear")}}]),e}();function bg(e,t){var n=new Jn([{config:["value",e]},gg].concat(t||[]));return n.init(),n}function xg(e){if(!e)return"<null>";var t=e.id?' id="'.concat(e.id,'"'):"";return"<".concat(e.$type).concat(t," />")}function wg(e,t){function n(t,n,i){if(t.gfx)throw new Error("already rendered ".concat(xg(t)));return e.element(t,n,i)}function i(e,t,i){N(e,(function(e){n(e,t,i)}))}function r(e,t,i){N(e,(function(e){n(e,t,i)}))}return{handleDecision:function(t){t.id||(t.id="decision");var o=t.decisionLogic;if(!o)throw new Error("no table for ".concat(xg(t)));if(!o.output)throw new Error("missing output for ".concat(xg(o)));var a,s,u,c,l=(c=o,e.table(c));o.input&&i(o.input,l,o),i(o.output,l,o),a=o.rule,s=l,u=o,N(a,(function(e){n(e,s,u),r(e.inputEntry,e),r(e.outputEntry,e)}))}}}function Cg(e,n){var i=e.elements,r=e.index;return r[n]?e:{elements:[].concat(y(i),[n]),index:t(t({},r),{},a({},n,!0))}}function Eg(e,t){return e.elements.join(t)}function kg(){for(var e={elements:[],index:{}},t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return i.forEach((function(t){var i=n(t);"string"===i&&t.length>0?e=Cg(e,t):"object"===i&&null!==t&&Object.keys(t).forEach((function(n){t[n]&&(e=Cg(e,n))}))})),Eg(e," ")}function Sg(e){return jg(e.constructor,e)}function jg(e,t){var n=e.$inject;if(n){var i=t.context.injector,r=[].concat(y(n),[function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];for(var o in i){var a=n[o],s=i[o];t[a]=s}}]);i.invoke(r)}}function Og(e,t){Object.keys(t).forEach((function(n){if("$inject"!==n&&"__init"!==n){var i=t[n];"constructor"===n&&i.call(e,e.props,e.context);var r=e[n];if(void 0!==r){if("function"!=typeof r)throw new Error("failed to mixin <".concat(n,">: cannot combine with non-fn component value"));e[n]=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var o;return n.forEach((function(t){if(void 0!==(o=t.call.apply(t,[e].concat(i))))return!1})),o}.bind(e)}(e,r,i)}else e[n]=i.bind(e)}})),"$inject"in t&&jg(t,e),"__init"in t&&t.__init.call(e,e.props,e.context)}var Pg={getSelectionClasses:function(){var e=this.state;return kg({selected:e.selected,"selected-secondary":e.selectedSecondary,focussed:e.focussed})},selectionChanged:function(e){this.setState(e)},componentWillUpdate:function(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!1)},componentDidUpdate:function(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!0)},componentDidMount:function(){this.updateSelectionSubscription(!0)},componentWillUnmount:function(){this.updateSelectionSubscription(!1)},updateSelectionSubscription:function(e){var t=this.props.elementId;t&&t&&this.eventBus[e?"on":"off"]("selection.".concat(t,".changed"),this.selectionChanged)}},Dg=Pg;Pg.$inject=["eventBus"];var Rg=["className","elementId","coords"],Tg=function(e){s(r,e);var n=h(r);function r(e,t){var o;return i(this,r),Og(d(o=n.call(this,e,t)),Dg),Sg(d(o)),o}return o(r,[{key:"getRenderProps",value:function(){for(var e=this.props,n=e.className,i=e.elementId,r=e.coords,o=l(e,Rg),a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];var c={className:kg.apply(void 0,s.concat([this.getSelectionClasses(),n]))};return i&&(c["data-element-id"]=i),r&&(c["data-coords"]=r),t(t({},c),o)}}]),r}(ug),Mg=function(e){s(r,e);var n=h(r);function r(e,t){var o;return i(this,r),(o=n.call(this,e,t)).state={},o}return o(r,[{key:"render",value:function(){return Yv(Gv(1,"td",null,this.props.children,0,t({},this.getRenderProps("cell"))))}}]),r}(Tg),Ig=["type","context"],Ag=["type","context"];function Ng(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Bg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ng(Object(n),!0).forEach((function(t){Lg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ng(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lg(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function $g(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var Vg={slotFill:function(e,t){var n=e.type,i=e.context,r=$g(e,Ig),o=this.components.getComponent(n,i)||t;return o?Yv(Kv(2,o,Bg(Bg({},i),r))):null},slotFills:function(e){var t=e.type,n=e.context,i=$g(e,Ag);return this.components.getComponents(t,n).map((function(e){return Yv(Kv(2,e,Bg(Bg({},n),i)))}))}};function zg(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Vg.$inject=["components"];var Fg=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),zg(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),Og(d(o),Vg),Sg(d(o)),o}return o(n,[{key:"componentDidMount",value:function(){this.changeSupport.onElementsChanged(this.getRoot(),this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){this.changeSupport.offElementsChanged(this.getRoot(),this.onElementsChanged)}},{key:"getRoot",value:function(){return this.sheet.getRoot()}},{key:"render",value:function(){var e=(this.getRoot().businessObject.get("annotationsWidth")||400)+"px";return Gv(1,"th","annotation header",[this.slotFills({type:"cell-inner",context:{cellType:"annotations",col:this.sheet.getRoot(),minWidth:400}}),this.translate("Annotations")],0,{style:{width:e}})}}]),n}(ug);function Ug(e){var t=e.row.businessObject,n=t.id,i=t.description;return Kv(2,Mg,{className:"annotation",elementId:n,children:i||"-"})}function Hg(e){e.onGetComponent("cell",(function(e){var t=e.cellType;return"after-label-cells"===t?Fg:"after-rule-cells"===t?Ug:void 0}))}Fg.$inject=["changeSupport","sheet","translate"],Hg.$inject=["components"];var Wg={__init__:["annotationsProvider"],annotationsProvider:["type",Hg]};function qg(e,t){return J({id:e.id,type:e.$type,businessObject:e},t)}var Gg=function(){function e(t,n,r){i(this,e),this._elementFactory=t,this._eventBus=n,this._sheet=r}return o(e,[{key:"add",value:function(e){var t,n=this;if(Ln(e,"dmn:DecisionTable"))t=this._elementFactory.createRoot(qg(e)),this._sheet.setRoot(t);else if(Ln(e,"dmn:InputClause"))t=this._elementFactory.createCol(qg(e)),this._sheet.addCol(t);else if(Ln(e,"dmn:OutputClause"))t=this._elementFactory.createCol(qg(e)),this._sheet.addCol(t);else if(Ln(e,"dmn:DecisionRule")){e.inputEntry||(e.inputEntry=[]),e.outputEntry||(e.outputEntry=[]);var i=[].concat(y(e.inputEntry),y(e.outputEntry)).map((function(e){return n._elementFactory.createCell(qg(e))}));t=this._elementFactory.createRow(J(qg(e),{cells:i})),this._sheet.addRow(t)}return this._eventBus.fire("dmnElement.added",{element:t}),t}}]),e}();Gg.$inject=["elementFactory","eventBus","sheet"];var Kg={__depends__:[{__depends__:[Jo],tableImporter:["type",Gg]},pg]};function Xg(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Yg=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Xg(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),Og(d(o),Vg),o._sheet=r.injector.get("sheet"),o._changeSupport=r.changeSupport,o}return o(n,[{key:"componentWillMount",value:function(){var e=this._sheet.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this._sheet.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}},{key:"render",value:function(){var e=this,t=this._sheet.getRoot();if(!Ln(t,"dmn:DMNElement"))return null;var n=zn(t),i=n.input,r=n.output;return Gv(1,"thead",null,Gv(1,"tr",null,[Gv(1,"th","index-column"),this.slotFills({type:"cell",context:{cellType:"before-label-cells"}}),i&&i.map((function(t,n){var r=t.width||"192px";return e.slotFill({type:"cell",context:{cellType:"input-header",input:t,index:n,inputsLength:i.length,width:r},key:t.id},Zg)})),r.map((function(t,n){return e.slotFill({type:"cell",context:{cellType:"output-header",output:t,index:n,outputsLength:r.length},key:t.id},Qg)})),this.slotFills({type:"cell",context:{cellType:"after-label-cells"}})],0),2)}}]),n}(ug);function Zg(e,t){var n=e.input,i=e.className,r=e.index,o=n.label,a=n.inputExpression,s=n.inputValues,u=t.injector.get("translate");return Gv(1,"th",(i||"")+" input-cell",[Gv(1,"div","clause",u(0===r?"When":"And"),0),o?Gv(1,"div","input-label",o,0,{title:u("Input Label: ")+o}):Gv(1,"div","input-expression",a.text,0,{title:u("Input Expression: ")+a.text}),Gv(1,"div","input-variable",s&&s.text||a.typeRef,0,{title:s&&s.text?u("Input Values"):u("Input Type")})],0,{"data-col-id":n.id},n.id)}function Qg(e,t){var n=e.output,i=e.className,r=e.index,o=n.label,a=n.name,s=n.outputValues,u=n.typeRef,c=t.injector.get("translate");return Gv(1,"th",(i||"")+" output-cell",[Gv(1,"div","clause",c(0===r?"Then":"And"),0),o?Gv(1,"div","output-label",o,0,{title:c("Output Label")}):Gv(1,"div","output-name",a,0,{title:c("Output Name")}),Gv(1,"div","output-variable",s&&s.text||u,0,{title:s&&s.text?c("Output Values"):c("Output Type")})],0,null,n.id)}function Jg(e){e.onGetComponent("table.head",(function(){return Yg}))}Jg.$inject=["components"];var ey={__init__:["decisionTableHeadProvider"],decisionTableHeadProvider:["type",Jg]},ty=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),Sg(d(o)),o}return o(n,[{key:"render",value:function(){var e=this.sheet.getRoot();if(!Ln(e,"dmn:DMNElement"))return null;var t=e.businessObject.$parent.name,n=this.components.getComponent("hit-policy")||ny;return Gv(1,"div","decision-table-properties",[Gv(1,"div","decision-table-name",t,0,{title:this._translate("Decision Name: ")+t}),Gv(1,"div","decision-table-header-separator"),Kv(2,n)],4)}}]),n}(ug);function ny(){return null}ty.$inject=["sheet","components"];var iy=o((function e(t){i(this,e),t.onGetComponent("table.before",500,(function(){return ty}))}));iy.$inject=["components"];var ry={__init__:["decisionTableProperties"],decisionTableProperties:["type",iy]},oy=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"render",value:function(){var e=this.props,t=e.row,n=e.rowIndex,i=this.context.components.getComponents("cell-inner",{cellType:"rule-index",row:t,rowIndex:n});return Gv(1,"td","rule-index",[i&&i.map((function(e){return Kv(2,e,{row:t,rowIndex:n})})),n+1],0,{"data-element-id":t.id,"data-row-id":t.id})}}]),n}(ug),ay=o((function e(t){i(this,e),t.onGetComponent("cell",(function(e){if("before-rule-cells"===e.cellType)return oy}))}));ay.$inject=["components"];var sy={__init__:["decisionRuleIndices"],decisionRuleIndices:["type",ay]},uy=[{label:"FEEL",value:"feel"}],cy=function(){function e(t){i(this,e),this._injector=t;var n=t.get("config.expressionLanguages")||{};this._config={options:uy,defaults:{editor:"feel"}},n.options&&(this._config.options=n.options);var r=this._getLegacyDefaults();J(this._config.defaults,r,n.defaults)}return o(e,[{key:"getDefault",value:function(e){var t=this._config.defaults,n=t[e]||t.editor;return this._getLanguageByValue(n)||this.getAll()[0]}},{key:"getLabel",value:function(e){var t=this._getLanguageByValue(e);return t?t.label:e}},{key:"getAll",value:function(){return this._config.options}},{key:"_getLegacyDefaults",value:function(){var e={},t=this._injector,n=t.get("config.defaultInputExpressionLanguage"),i=t.get("config.defaultOutputExpressionLanguage");return n&&(e.inputCell=n),i&&(e.outputCell=i),e}},{key:"_getLanguageByValue",value:function(e){return I(this.getAll(),(function(t){return e===t.value}))}}]),e}();cy.$inject=["injector"];var ly={__init__:["expressionLanguages"],expressionLanguages:["type",cy]},dy=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"render",value:function(e){var t=e.rows,n=e.cols,i=this.context.components;return Gv(1,"tbody",null,t.map((function(e,t){var r=i.getComponent("row",{rowType:"rule"});return r&&Kv(2,r,{row:e,rowIndex:t,cols:n},e.id)})),0)}}]),n}(ug),py=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Og(d(o=t.call(this,e,r)),Vg),o}return o(n,[{key:"render",value:function(){var e=this,t=this.props,n=t.row,i=t.rowIndex,r=t.cols,o=n.cells;return Gv(1,"tr",null,[this.slotFills({type:"cell",context:{cellType:"before-rule-cells",row:n,rowIndex:i}}),o.map((function(t,o){return e.slotFill({type:"cell",context:{cellType:"rule",cell:t,rowIndex:i,colIndex:o},key:t.id,row:n,col:r[o]})})),this.slotFills({type:"cell",context:{cellType:"after-rule-cells",row:n,rowIndex:i}})],0)}}]),n}(ug),hy=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"render",value:function(){var e=this.props,t=e.cell,n=e.row,i=e.col;return Ln(t,"dmn:UnaryTests")?Kv(2,Mg,{className:"input-cell",elementId:t.id,"data-row-id":n.id,"data-col-id":i.id,children:t.businessObject.text}):Kv(2,Mg,{className:"output-cell",elementId:t.id,"data-row-id":n.id,"data-col-id":i.id,children:t.businessObject.text})}}]),n}(ug),fy=o((function e(t){i(this,e),t.onGetComponent("table.body",(function(){return dy})),t.onGetComponent("row",(function(e){if("rule"===e.rowType)return py})),t.onGetComponent("cell",(function(e){if("rule"===e.cellType)return hy}))}));fy.$inject=["components"];var vy={__depends__:[ly],__init__:["decisionRules"],decisionRules:["type",fy]},my=[{label:"Unique",value:{hitPolicy:"UNIQUE",aggregation:void 0},explanation:"No overlap is possible and all rules are disjoint. Only a single rule can be matched"},{label:"First",value:{hitPolicy:"FIRST",aggregation:void 0},explanation:"Rules may overlap. The first matching rule will be chosen"},{label:"Priority",value:{hitPolicy:"PRIORITY",aggregation:void 0},explanation:"Rules may overlap. The one with the highest priority will be chosen"},{label:"Any",value:{hitPolicy:"ANY",aggregation:void 0},explanation:"Rules may overlap. Their output have to match"},{label:"Collect",value:{hitPolicy:"COLLECT",aggregation:void 0},explanation:"Collects the values of all matching rules"},{label:"Collect (Sum)",value:{hitPolicy:"COLLECT",aggregation:"SUM"},explanation:"Collects the values of all matching rules and sums up to a single value"},{label:"Collect (Min)",value:{hitPolicy:"COLLECT",aggregation:"MIN"},explanation:"Collects the values of all matching rules and uses the lowest value"},{label:"Collect (Max)",value:{hitPolicy:"COLLECT",aggregation:"MAX"},explanation:"Collects the values of all matching rules and uses the highest value"},{label:"Collect (Count)",value:{hitPolicy:"COLLECT",aggregation:"COUNT"},explanation:"Collects the values of all matching rules and counts the number of them"},{label:"Rule order",value:{hitPolicy:"RULE ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in rule order"},{label:"Output order",value:{hitPolicy:"OUTPUT ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in decreasing output priority order"}],gy=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),Sg(d(o)),o}return o(n,[{key:"getRoot",value:function(){return this.sheet.getRoot()}},{key:"render",value:function(){var e=this.getRoot().businessObject,t=e.aggregation,n=e.hitPolicy,i=I(my,(function(e){return function(e,t){return e.hitPolicy===t.hitPolicy&&e.aggregation===t.aggregation}(e.value,{aggregation:t,hitPolicy:n})}));return Gv(1,"div","hit-policy header",[Gv(1,"label","dms-label",this._translate("Hit Policy:"),0),Gv(1,"span","hit-policy-value",this._translate(i.label),0)],4,{title:this._translate(i.explanation)})}}]),n}(ug);function yy(e){e.onGetComponent("hit-policy",(function(){return gy}))}gy.$inject=["sheet"],yy.$inject=["components"];var _y={__init__:["hitPolicyProvider"],hitPolicyProvider:["type",yy]};function by(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var xy=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),by(d(o=t.call(this,e,r)),"onClick",(function(){o._eventBus.fire("showDrd")}));var a=r.injector;return o._translate=a.get("translate"),o._eventBus=a.get("eventBus"),o}return o(n,[{key:"render",value:function(){var e=this;return Gv(1,"div","view-drd",Gv(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(function(t){return e.node=t}))}}]),n}(ug),wy=function(){function e(t,n,r,o){var a=this;i(this,e),this._injector=r,this._sheet=o,t.onGetComponent("table.before",(function(){if(a.canViewDrd())return xy})),n.on("showDrd",(function(){var e=r.get("_parent",!1),t=Cy(o.getRoot());if(t){var n=e.getView(t);e.open(n)}}))}return o(e,[{key:"canViewDrd",value:function(){var e=this._injector.get("_parent",!1);if(!e)return!1;var t=Cy(this._sheet.getRoot());return!!e.getView(t)}}]),e}();function Cy(e){var t=e.businessObject;if(t)return t.$parent.$parent}wy.$inject=["components","eventBus","injector","sheet"];var Ey={__init__:["viewDrd"],viewDrd:["type",wy]};function ky(){return Gv(32,"svg",null,[Gv(1,"path",null,null,1,{fill:"#000000",d:"M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"}),Gv(1,"path",null,null,1,{fill:"#000000",d:"M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"})],4,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14.02 5.57",width:"53",height:"21",style:"vertical-align:middle"})}function Sy(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var jy=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),Sy(d(o=t.call(this,e,r)),"onClick",(function(){o._eventBus.fire("poweredBy.show")}));var a=r.injector;return o._eventBus=a.get("eventBus"),o}return o(n,[{key:"render",value:function(){var e=this;return Gv(1,"div","powered-by",Gv(1,"div","powered-by__logo",Kv(2,ky),2,{title:"Powered by bpmn.io",onClick:this.onClick},null,(function(t){return e.node=t})),2)}}]),n}(ug),Oy=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),(r=t.call(this,e)).state={show:!1},r.onClick=r.onClick.bind(d(r)),r.onShow=r.onShow.bind(d(r)),r}return o(n,[{key:"onClick",value:function(){this.setState({show:!1})}},{key:"onShow",value:function(){this.setState({show:!0})}},{key:"componentWillMount",value:function(){(this._eventBus=this.context.injector.get("eventBus")).on("poweredBy.show",this.onShow)}},{key:"componentWillUnmount",value:function(){this._eventBus.off("poweredBy.show",this.onShow)}},{key:"render",value:function(){return this.state.show&&Gv(1,"div","powered-by-overlay",Gv(1,"div","powered-by-overlay-content",[Gv(1,"a","logo",Kv(2,ky),2,{href:"https://bpmn.io",target:"_blank",rel:"noopener"}),Gv(1,"span",null,[Xv("Web-based tooling for BPMN, DMN and CMMN diagrams powered by "),Gv(1,"a",null,Xv("bpmn.io"),2,{href:"http://bpmn.io",target:"_blank"}),Xv(".")],4)],4,{onClick:function(e){return e.stopPropagation()}}),2,{onClick:this.onClick})}}]),n}(ug),Py=o((function e(t,n){i(this,e),t.onGetComponent("table.before",(function(){return jy})),t.onGetComponent("table.before",(function(){return Oy}))}));Py.$inject=["components","eventBus"];var Dy={__init__:["poweredBy"],poweredBy:["type",Py]},Ry=["modules","additionalModules"];function Ty(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var My=function(e){s(n,e);var t=h(n);function n(){var e;i(this,n);var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n._createContainer();return(e=t.call(this,J(r,{renderer:{container:o}})))._container=o,e}return o(n,[{key:"open",value:function(e){var t=this;return new Promise((function(n,i){var r;try{return t._decision&&t.clear(),t._decision=e,function(e,t,n){var i=e.get("tableImporter"),r=e.get("eventBus"),o=e.get("sheet");e.get("modeling",!1);var a,s=[];r.fire("import.render.start",{decision:t});try{!function(e){new wg({create:function(e,t,n,r){return i.create(e,t,n,r)},table:function(e){return i.add(e)},element:function(e,t,n){return i.add(e,t,n)},error:function(e,t){s.push({message:e,context:t})}}).handleDecision(e)}(t)}catch(e){a=e}r.fire("import.render.complete",{error:a,warnings:s}),r.fire("elements.changed",{elements:[o.getRoot()]}),n(a,s)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):n({warnings:[]})}))}},{key:"_init",value:function(e){var t=e.modules,n=e.additionalModules,i=Ty(e,Ry),r=t||this.getModules(),o=n||[],a=[{decisionTable:["value",this]}];return{modules:[Dy].concat(y(r),y(o),a),config:i}}},{key:"on",value:function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)}},{key:"off",value:function(e,t){this.get("eventBus").off(e,t)}},{key:"_emit",value:function(e,t){return this.get("eventBus").fire(e,t)}},{key:"attachTo",value:function(e){if(!e)throw new Error("parentNode required");this.detach();var t=this._container;e.appendChild(t),this._emit("attach",{})}},{key:"detach",value:function(){var e=this._container;e.parentNode&&(this._emit("detach",{}),En(e))}},{key:"destroy",value:function(){v(u(n.prototype),"destroy",this).call(this),this.detach()}},{key:"getModules",value:function(){return n._getModules()}}],[{key:"_getModules",value:function(){return[Wg,Kg,Jo,ey,ry,sy,vy,_y,Ey]}},{key:"_createContainer",value:function(){return xn('<div class="dmn-decision-table-container"></div>')}}]),n}(_g);function Iy(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Ay=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Iy(d(o=t.call(this,e,r)),"handleClick",(function(e){e.stopPropagation(),o.addRule(e.target.dataset.colIndex)})),Sg(d(o)),o.addRule=o.addRule.bind(d(o)),o}return o(n,[{key:"componentWillMount",value:function(){this._eventBus=this.context.injector.get("eventBus")}},{key:"addRule",value:function(e){this._eventBus.fire("addRule",{colIndex:e})}},{key:"render",value:function(){var e=this.props.cols,t=[Gv(1,"td","add-rule-add",Gv(1,"span","dmn-icon-plus action-icon",null,1,{title:"Add Rule"}),2)],n=this.sheet.getRoot().businessObject;n.input&&n.input.length||t.push(Gv(1,"td","input-cell",Xv("-"),2));for(var i=0;i<e.length+1;i++){var r="add-rule",o=e[i]&&e[i].businessObject,a="";o?(o.$instanceOf("dmn:InputClause")&&(r+=" input-cell",a="-"),o.$instanceOf("dmn:OutputClause")&&(r+=" output-cell")):r+=" annotation",t.push(Gv(1,"td",r,a,0,{"data-col-index":i}))}return Gv(1,"tfoot","actionable add-rule",Gv(1,"tr",null,t,0),2,{onClick:this.handleClick})}}]),n}(ug);Ay.$inject=["sheet"];var Ny=o((function e(t,n,r,o){i(this,e),t.onGetComponent("table.foot",(function(){return Ay})),r.on("addRule",(function(e,t){var i=n.trigger("addRule"),r=t.colIndex;i.cells[r]?o.select(i.cells[r]):o.select(i.cells[0])}))}));Ny.$inject=["components","editorActions","eventBus","selection"];var By=function(){function e(t,n,r){var o=this;i(this,e),this._elementRegistry=t,this._eventBus=n,this._renderer=r,this._selection=void 0,n.on("diagram.clear",(function(){o._selection=void 0}))}return o(e,[{key:"select",value:function(e){T(e)&&(e=this._elementRegistry.get(e));var t=this._selection;t!==e&&(this._selection=e,this._eventBus.fire("selection.changed",{oldSelection:t,selection:e}))}},{key:"deselect",value:function(){var e=this._selection;this._selection=void 0,this._eventBus.fire("selection.changed",{oldSelection:e,selection:this._selection})}},{key:"get",value:function(){return this._selection}},{key:"hasSelection",value:function(){return!!this._selection}}]),e}();By.$inject=["elementRegistry","eventBus","renderer"];var Ly=o((function e(t,n,r,o){i(this,e),this._elementRegistry=t,this._renderer=r,this._selection=o,n.on(["cell.click","cell.contextmenu"],(function(e){var n=e.id,i=t.get(n);i&&o.select(i)})),n.on("row.remove",(function(e){var t=e.row,n=o.get();n&&t===n.row&&o.deselect()})),n.on("col.remove",(function(e){var t=e.col,n=o.get();n&&t===n.col&&o.deselect()}))}));Ly.$inject=["elementRegistry","eventBus","renderer","selection"];var $y={__init__:["selection","selectionBehavior"],selection:["type",By],selectionBehavior:["type",Ly]};var Vy=["click","dblclick","contextmenu","mousedown","mouseup","mouseenter","mouseleave","mouseout","mouseover","mousemove","focusin","focusout","drag","dragstart","dragend","dragover","dragenter","dragleave","drop"],zy=function(){function e(t,n){var r,o,a,s=this;i(this,e),a=function(e){var t=e.target,n=e.type,i=un(t,"[data-element-id]",!0);if(i){var r=i.getAttribute("data-element-id");if(r){var o=s._eventBus.createEvent({id:r,event:e,node:i,target:i});s._eventBus.fire("cell.".concat(n),o),o.defaultPrevented&&e.preventDefault(),o.cancelBubble&&e.stopPropagation()}}},(o="_handleEvent")in(r=this)?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,this._eventBus=n,this._container=t.container,n.on("table.init",(function(){s._addEventListeners(Vy)})),n.on("table.destroy",(function(){s._removeEventListeners(Vy)}))}return o(e,[{key:"_addEventListeners",value:function(e){var t=this,n=this._container;e.forEach((function(e){n.addEventListener(e,t._handleEvent)}))}},{key:"_removeEventListeners",value:function(e){var t=this,n=this._container;e.forEach((function(e){n.removeEventListener(e,t._handleEvent)}))}}]),e}();zy.$inject=["config.renderer","eventBus"];var Fy={__init__:["interactionEvents"],interactionEvents:["type",zy]},Uy={},Hy={get exports(){return Uy},set exports(e){Uy=e}};
22/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
23!function(e,t){var n;n=ir,e.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),i=n.length,r=-1,o="",a=n.charCodeAt(0);++r<i;)0!=(t=n.charCodeAt(r))?o+=t>=1&&t<=31||127==t||0==r&&t>=48&&t<=57||1==r&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==r&&1==i&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(r):n.charAt(r):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(n)}(Hy);var Wy=Uy,qy=function(e,t){return e^t};var Gy=/\b(Array|Date|Object|Math|JSON)\b/g,Ky=function(e,t){var n=function(e){for(var t=[],n=0;n<e.length;n++)~t.indexOf(e[n])||t.push(e[n]);return t}(function(e){return e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(Gy,"").match(/[a-zA-Z_]\w*/g)||[]}(e));return t&&"string"==typeof t&&(t=function(e){return function(t){return e+t}}(t)),t?function(e,t,n){var i=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return e.replace(i,(function(e){return"("==e[e.length-1]||~t.indexOf(e)?n(e):e}))}(e,n,t):n};var Xy=Yy;function Yy(e,t){if(!(this instanceof Yy))return new Yy(e,t);if(this.node=this.start=this.peeked=e,this.root=t,this.closingTag=!1,this._revisit=!0,this._selects=[],this._rejects=[],e&&this.higher(e))throw new Error("root must be a parent or ancestor to node")}function Zy(e,t){var n="nextSibling"==e;return function(i,r,o){i=this.compile(i),r=r&&r>0?r:1;for(var a=this.node,s=this.closingTag,u=this._revisit;a;){if(qy(n,s)&&a[t])a=a[t],s=!n;else if(1==a.nodeType&&!a[t]&&qy(n,s)){if(s=n,!u)continue}else if(a[e])a=a[e],s=!n;else if(a=a.parentNode,s=n,!u)continue;if(!a||this.higher(a,this.root))break;if(i(a)&&this.selects(a,o)&&this.rejects(a,o)){if(--r)continue;return o||(this.node=a),this.closingTag=s,a}}return null}}Yy.prototype.reset=function(e){return this.node=e||this.start,this},Yy.prototype.revisit=function(e){return this._revisit=null==e||e,this},Yy.prototype.opening=function(){return 1==this.node.nodeType&&(this.closingTag=!1),this},Yy.prototype.atOpening=function(){return!this.closingTag},Yy.prototype.closing=function(){return 1==this.node.nodeType&&(this.closingTag=!0),this},Yy.prototype.atClosing=function(){return this.closingTag},Yy.prototype.next=Zy("nextSibling","firstChild"),Yy.prototype.previous=Yy.prototype.prev=Zy("previousSibling","lastChild"),Yy.prototype.select=function(e){return e=this.compile(e),this._selects.push(e),this},Yy.prototype.selects=function(e,t){var n=this._selects,i=n.length;if(!i)return!0;for(var r=0;r<i;r++)if(n[r].call(this,e,t))return!0;return!1},Yy.prototype.reject=function(e){return e=this.compile(e),this._rejects.push(e),this},Yy.prototype.rejects=function(e,t){var n=this._rejects,i=n.length;if(!i)return!0;for(var r=0;r<i;r++)if(n[r].call(this,e,t))return!1;return!0},Yy.prototype.higher=function(e){var t=this.root;if(!t)return!1;for(e=e.parentNode;e&&e!=t;)e=e.parentNode;return e!=t},Yy.prototype.compile=function(e){switch(n(e)){case"number":return function(t){return e==t.nodeType};case"string":return new Function("node","return "+Ky(e,"node."));case"function":return e;default:return function(){return!0}}},Yy.prototype.peak=Yy.prototype.peek=function(e,t){return 1==arguments.length&&(t=e,e=!0),(t=null==t?1:t)?t>0?this.next(e,t,!0):this.prev(e,Math.abs(t),!0):this.node},Yy.prototype.use=function(e){return e(this),this};var Qy=window.getSelection();function Jy(e){Qy.removeAllRanges(),Qy.addRange(e)}function e_(){return Qy}function t_(e,t){var n=function(e,t){var n,i=t.start,r=t.end,o=document.createRange(),a=Xy(e.firstChild,e),s=a.node,u=!1,c=0;for(;s;){if(c===i&&(u?o.setStartAfter(s):o.setStartBefore(s)),c===r)return u?o.setEndAfter(s):o.setEndBefore(s),o;if(u||(r_(s)||s.previousSibling&&(o_(s)||a_(s)))&&c++,i_(s)){if(n=s.textContent.length,c<=i&&c+n>i&&o.setStart(s,i-c),c+n>r)return o.setEnd(s,r-c),o;c+=n}s=a.next(),u=a.closingTag}c<=i&&(e.lastChild?o.setStartAfter(e.lastChild):o.setStart(e,0));e.lastChild?o.setEndAfter(e.lastChild):o.setEnd(e,0);return o}(e,t);Jy(n)}function n_(e){if(!function(e){if(!Qy.rangeCount)return null;var t=Qy.focusNode;return i_(t)&&(t=t.parentNode),e==t||e.contains(t)}(e))return null;var t,n,i=Qy.getRangeAt(0),r=i.startContainer,o=i.endContainer,a=i.startOffset,s=i.endOffset,u=Xy(e.firstChild,e),c=u.node,l=!1,d=0;function p(e,t){return 1===arguments.length&&(t=e),e.parentNode===o&&t==o.childNodes[s]}function h(e,t){return 1===arguments.length&&(t=e),e.parentNode===r&&t==r.childNodes[a]}for(;c&&(h(c)&&(n=d),!p(c));){if(l||(r_(c)||t&&t.nextSibling==c&&(o_(c)||a_(c)))&&d++,i_(c)){if(r===c&&(n=d+a),o===c){d+=s;break}d+=c.textContent.length}if((i_(c)||l)&&(h(c,c.nextSibling)&&(n=d),p(c,c.nextSibling)))break;t=c,c=u.next(),l=u.closingTag}return{start:void 0===n?d:n,end:d}}function i_(e){return 3===e.nodeType}function r_(e){return 1===e.nodeType&&"BR"===e.nodeName}function o_(e){return 1===e.nodeType&&"DIV"===e.nodeName}function a_(e){return 1===e.nodeType&&"P"===e.nodeName}function s_(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u_(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u_(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function c_(e){return e.getAttribute("data-element-id")}function l_(e,t){return wn('[data-element-id="'.concat(Wy(e),'"]'),t)}function d_(e){return un(e,"[data-element-id]",!0)}function p_(e){var t="[contenteditable]";return sn(e,t)?e:wn(t,e)}var h_={above:!0,below:!0,right:!0,left:!0};function f_(e,t,n,i,r){var o=e.container,a=null;function s(e,n){t.fire("selection."+e+".changed",n),t.fire("cellSelection.changed",{elementId:e,selection:n})}function u(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a!==e&&s(a,{selected:!1,focussed:!1}),a=e,e&&s(e,{selected:!0,focussed:t}),e?i.select(e):i.deselect()}t.on("cell.click",500,(function(e){var t=e.target;if(!function(e){return un(e,".no-deselect",!0)}(t)){var n=d_(t);u(n&&c_(n),!e.defaultPrevented)}})),t.on("cell.focusin",500,(function(e){var t=c_(e.target),n=!e.defaultPrevented;return e.stopPropagation(),u(t,n)})),t.on("cell.focusout",500,(function(e){s(c_(e.target),{focussed:!1})})),t.on("cellSelection.changed",(function(e){var t=e.elementId,n=e.selection,i=l_(t,o);n.focussed&&i&&function(e){var t=p_(e);if(t&&document.body.contains(t)&&document.activeElement!==t){t.focus();var n=n_(t);n&&0!==n.end||t_(t,{start:5e3,end:5e3})}}(i)})),t.on("selection.changed",(function(e){var t=e.selection,n=e.oldSelection,i=t&&t.id,r=n&&n.id;i&&i!==a?u(t.id):r&&r===a&&u()})),this.isCellSelected=function(){return!!a},this.getCellSelection=function(){return a},this.selectCell=function(e){if(a){if(!(e in h_))throw new Error("direction must be any of { above, below, left, right }");var t=function(e){var t=e.getAttribute("data-coords");if(!t)return null;var n=s_(t.split(":"),2);return{row:n[0],col:n[1]}}(l_(a,o));if(!t)return!1;var n=function(e,t){var n=e.row,i=e.col;if("above"===t||"below"===t){var r=parseInt(n,10);return isNaN(r)?e:{col:i,row:"above"===t?r-1:r+1}}if("left"===t||"right"===t){var o=parseInt(i,10);return isNaN(o)?e:{row:n,col:"left"===t?o-1:o+1}}throw new Error("invalid direction <"+t+">")}(t,e),i=function(e,t){var n="".concat(e.row,":").concat(e.col);return wn('[data-coords="'.concat(Wy(n),'"]'),t)}(n,o);if(!i)return!1;var r=c_(i);return r&&u(r,{focussed:!0,selected:!0}),!0}},t.on("contextMenu.close",(function(){if(a)return u(a)}))}f_.$inject=["config.renderer","eventBus","sheet","selection","elementRegistry"];var v_={__depends__:[Fy,$y],__init__:["cellSelection"],cellSelection:["type",f_]};function m_(){}m_.prototype.get=function(){return this._data},m_.prototype.set=function(e){this._data=e},m_.prototype.clear=function(){var e=this._data;return delete this._data,e},m_.prototype.isEmpty=function(){return!this._data};var g_={clipboard:["type",m_]},y_=2e3,__=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e))._sheet=r,o}return o(n,[{key:"init",value:function(){var e=this;this.addRule("col.move",y_,(function(t){var n=t.col,i=t.index,r=e._sheet.getRoot().businessObject.input;return $n(n)?i<r.length:i>=r.length})),this.addRule("col.remove",y_,(function(t){var n=t.col,i=e._sheet.getRoot().cols;return!Vn(n)||i.filter((function(e){return Vn(e)})).length>1})),this.addRule("paste",y_,(function(t){var n=t.data,i=t.target;if(!n||!i)return!1;var r=n.root;return i instanceof mv?e.canPasteRows(r):i instanceof gv&&e.canPasteCols(r,i)}))}},{key:"canPasteRows",value:function(e){var t=this._sheet.getRoot().cols;return L(e,(function(e){return"row"===e.type&&(e.cells.length===t.length&&L(e.cells,(function(e,n){return $n(t[n])?"dmn:UnaryTests"===e.businessObject.$type:"dmn:LiteralExpression"===e.businessObject.$type})))}))}},{key:"canPasteCols",value:function(e,t){var n=this._sheet.getRoot().rows;return L(e,(function(e){return"col"===e.type&&(e.cells.length===n.length&&($n(t)?"dmn:InputClause"===e.businessObject.$type:"dmn:OutputClause"===e.businessObject.$type))}))}}]),n}($p);__.$inject=["eventBus","sheet"];var b_={__depends__:[{__depends__:[au]}],__init__:["decisionTableModelingRules"],decisionTableModelingRules:["type",__]},x_=function(){function e(t,n,r){i(this,e),this._clipboard=t,this._modeling=n,this._sheet=r}return o(e,[{key:"execute",value:function(e){var t=e.data;return e.oldData=this._clipboard.get(),this._clipboard.set(t),this._sheet.getRoot()}},{key:"postExecute",value:function(e){var t=this;e.elements.forEach((function(e){e instanceof mv?t._modeling.removeRow(e):e instanceof gv&&t._modeling.removeCol(e)}))}},{key:"revert",value:function(e){var t=e.oldData;return this._clipboard.set(t),this._sheet.getRoot()}}]),e}();function w_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function C_(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w_(Object(n),!0).forEach((function(t){E_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E_(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}x_.$inject=["clipboard","modeling","sheet"];var k_=[function(e,t,n,i){var r=n,o=C_(C_({},t),{},{type:P_(e)});if(e instanceof mv||e instanceof gv){var a=i(e.cells,r);o.cells=a.root,r=a.descriptorCache}return{root:o,descriptorCache:r}},function(e,t,n){var i=e.businessObject;if(!i)return{root:t,descriptorCache:n};var r=D_(i,n);return{root:C_(C_({},t),{},{businessObject:r.root}),descriptorCache:r.descriptorCache}}],S_=[function(e,t,n){var i=e.root.businessObject;if(!i)return{root:t,reviveCache:n};var r=M_({root:i,descriptorCache:e.descriptorCache},n);return{root:C_(C_({},t),{},{businessObject:r.root}),reviveCache:r.reviveCache}},function(e,t,n,i){var r=e.root,o=e.descriptorCache,a=C_({},t);t.businessObject&&t.businessObject.id&&(a.id=t.businessObject.id);if("row"===r.type||"col"===r.type){var s=i({root:r.cells,descriptorCache:o},n);a.cells=s.root,n=s.reviveCache}var u=new(function(e){switch(e.type){case"row":return mv;case"cell":return yv;case"col":return gv;default:throw new Error("unknown element type: #"+e.type)}}(r))(a);u instanceof mv?u.cells.forEach((function(e){e.row=u})):u instanceof gv&&u.cells.forEach((function(e){e.col=u}));return{root:u,reviveCache:n}}];function j_(e,t,n){return n=n||k_,t=t||{},O(e)?function(e,t,n){return B(e,(function(e,t){var i=e.descriptorCache,r=e.root,o=O_(t,i,n),a=o.root,s=o.descriptorCache;return{root:[].concat(y(r),[a]),descriptorCache:C_(C_({},i),s)}}),{root:[],descriptorCache:t})}(e,t,n):O_(e,t,n)}function O_(e,t,n){var i=e.id,r={id:i},o=t.elements||{},s=o[i];if(s)return{root:s,descriptorCache:t};var u=function(e,t,n,i){function r(e,t){return j_(e,t,n)}return B(n,(function(t,n){return n(e,t.root,t.descriptorCache,r)}),{root:t,descriptorCache:i})}(e,r,n,C_(C_({},t),{},{elements:o}));return{root:u.root,descriptorCache:C_(C_({},u.descriptorCache),{},{elements:C_(C_({},u.descriptorCache.elements),{},a({},i,u.root))})}}function P_(e){if(e instanceof mv)return"row";if(e instanceof gv)return"col";if(e instanceof yv)return"cell";throw new Error("cannot deduce element type: #"+e.id)}function D_(e,t){var n,i,r=e.id;if(r&&(i=(n=t.boCache||{})[r]))return{root:i,descriptorCache:t};var o={$type:e.$type};return r&&(o.id=r,n=C_(C_({},n),{},a({},r,o)),t=C_(C_({},t),{},{boCache:n})),e.$descriptor.properties.forEach((function(n){var i=e[n.name];if(i){if(O(i)&&(i=i.map((function(e){var n=D_(e,t);return t=n.descriptorCache,n.root}))),i.$type){var r=D_(i,t);t=r.descriptorCache,i=r.root}o[n.name]=i}})),{root:o,descriptorCache:t}}function R_(e,t,n){return n=n||S_,t=t||{},O(e.root)?function(e,t,n){var i=e.root,r=e.descriptorCache;return B(i,(function(e,t){var i=e.reviveCache,o=e.root,a=T_({root:t,descriptorCache:r},i,n),s=a.root,u=a.reviveCache;return{root:[].concat(y(o),[s]),reviveCache:u}}),{root:[],reviveCache:t})}(e,t,n):T_(e,t,n)}function T_(e,t,n){var i=e.root.id,r=t.elements||{},o=r[i];if(o)return{root:o,reviveCache:t};var s=function(e,t,n,i){function r(e,t){return R_(e,t,n)}return B(n,(function(t,n){return n(e,t.root,t.reviveCache,r)}),{root:t,reviveCache:i})}(e,{id:i},n,C_(C_({},t),{},{elements:r}));return{root:s.root,reviveCache:C_(C_({},s.reviveCache),{},{elements:C_(C_({},s.reviveCache.elements),{},a({},i,s.root))})}}function M_(e,t){var n,i,r=e.root,o=r.id;if(o&&(i=(n=t.boCache||{})[o]))return{root:i,reviveCache:t};var s={};z(r).forEach((function(e){var i,o;r[e].$type?(i=(o=M_({root:r[e]},t)).root,t=o.reviveCache,n=t.boCache||{}):i=O(r[e])?r[e].map((function(e){return o=M_({root:e},t),t=o.reviveCache,n=t.boCache||{},o.root})):r[e],s[e]=i}));var u=s.$type;delete s.$type,t._keepIds&&!t._model.ids.assigned(s.id)||delete s.id;var c=t._dmnFactory.create(u,s);return N(s,(function(e){e.$type&&(e.$parent=c),O(e)&&e.forEach((function(e){return e.$parent=c}))})),o&&(n=C_(C_({},n),{},a({},o,c)),t=C_(C_({},t),{},{boCache:n})),{root:c,reviveCache:t}}var I_=function(){function e(t,n,r,o,a,s,u,c){i(this,e),this._clipboard=t,this._dmnFactory=n,this._elementFactory=r,this._elementRegistry=o,this._eventBus=a,this._model=s,this._modeling=u,this._sheet=c}return o(e,[{key:"postExecute",value:function(e){var t=this,n=e.element,i=e.after,r=this._clipboard.get();if(!r)throw new Error("missing clipboard data");var o=this._sheet.getRoot(),a=R_(r.elements,{_dmnFactory:this._dmnFactory,_keepIds:r.keepIds,_model:this._model}).root;if(n instanceof mv){var s=o.rows.indexOf(n);if(-1===s)return;a.forEach((function(e){i&&s++,t._modeling.addRow(e,s)}))}else if(n instanceof gv){var u=o.cols.indexOf(n);if(-1===u)return;a.forEach((function(e){i&&u++,t._modeling.addCol(e,u)}))}return e.oldElements=this._clipboard.get(),this._sheet.getRoot()}},{key:"revert",value:function(e){}}]),e}();function A_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function N_(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}I_.$inject=["clipboard","dmnFactory","elementFactory","elementRegistry","eventBus","moddle","modeling","sheet"];var B_=function(){function e(t,n,r,o,a,s){i(this,e),this._clipboard=t,this._commandStack=n,this._eventBus=r,this._modeling=o,this._sheet=a,this._rules=s,n.registerHandler("cut",x_),n.registerHandler("paste",I_)}return o(e,[{key:"copy",value:function(e){O(e)||(e=[e]);var t={elements:j_(e)};this._eventBus.fire("copyCutPaste.copy",{data:t}),this._clipboard.set(t)}},{key:"cut",value:function(e){O(e)||(e=[e]);var t={elements:j_(e),keepIds:!0},n={elements:e,data:t};this._eventBus.fire("copyCutPaste.cut",{data:t}),this._commandStack.execute("cut",n)}},{key:"pasteBefore",value:function(e){return this._paste(e,{before:!0})}},{key:"pasteAfter",value:function(e){return this._paste(e,{after:!0})}},{key:"_paste",value:function(e,t){var n=this._clipboard.get();if(n)return!!this._rules.allowed("paste",{data:n.elements,target:e})&&(this._commandStack.execute("paste",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A_(Object(n),!0).forEach((function(t){N_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({element:e},t)),this._clipboard.clear(),!0)}},{key:"pasteAt",value:function(e){}}]),e}();B_.$inject=["clipboard","commandStack","eventBus","modeling","sheet","rules"];var L_={__depends__:[g_,b_],__init__:["copyCutPaste"],copyCutPaste:["type",B_]},$_=o((function e(t,n,r,o,a,s){i(this,e);var u={addRule:function(){return r.addRow({type:"dmn:DecisionRule"})},addRuleAbove:function(e){var t=e&&e.rule;if(t||o.hasSelection()){t=t||o.get().row;var n=s.getRoot().rows.indexOf(t);if(-1!==n)return r.addRow({type:"dmn:DecisionRule"},n)}},addRuleBelow:function(e){var t=e&&e.rule;if(t||o.hasSelection()){t=t||o.get().row;var n=s.getRoot().rows.indexOf(t);if(-1!==n)return r.addRow({type:"dmn:DecisionRule"},n+1)}},removeRule:function(e){var t=e&&e.rule;(t||o.hasSelection())&&(t=t||o.get().row,r.removeRow(t))},addInput:function(){var e=s.getRoot().businessObject.input;return r.addCol({type:"dmn:InputClause"},e?e.length:0)},addInputLeft:function(e){var t=e&&e.input;if(t||o.hasSelection()){t=t||o.get().col;var n=s.getRoot().cols.indexOf(t);if(-1!==n)return r.addCol({type:"dmn:InputClause"},n)}},addInputRight:function(e){var t=e&&e.input;if(t||o.hasSelection()){t=t||o.get().col;var n=s.getRoot().cols.indexOf(t);if(-1!==n)return r.addCol({type:"dmn:InputClause"},n+1)}},removeInput:function(e){var t=e&&e.input;(t||o.hasSelection())&&(t=t||o.get().col,r.removeCol(t))},addOutput:function(){var e=s.getRoot().businessObject,t=e.get("input"),n=e.get("output");return r.addCol({type:"dmn:OutputClause"},t.length+n.length)},addOutputLeft:function(e){var t=e&&e.output;if(t||o.hasSelection()){t=t||o.get().col;var n=s.getRoot().cols.indexOf(t);if(-1!==n)return r.addCol({type:"dmn:OutputClause"},n)}},addOutputRight:function(e){var t=e&&e.output;if(t||o.hasSelection()){t=t||o.get().col;var n=s.getRoot().cols.indexOf(t);if(-1!==n)return r.addCol({type:"dmn:OutputClause"},n+1)}},removeOutput:function(e){var t=e&&e.output;(t||o.hasSelection())&&(t=t||o.get().col,r.removeCol(t))},addClause:function(){if(o.hasSelection()){var e=o.get().col;return Ln(e,"dmn:InputClause")?u.addInput({input:e}):Ln(e,"dmn:OutputClause")?u.addOutput({output:e}):void 0}},addClauseLeft:function(){if(o.hasSelection()){var e=o.get().col;return Ln(e,"dmn:InputClause")?u.addInputLeft({input:e}):Ln(e,"dmn:OutputClause")?u.addOutputLeft({output:e}):void 0}},addClauseRight:function(){if(o.hasSelection()){var e=o.get().col;return Ln(e,"dmn:InputClause")?u.addInputRight({input:e}):Ln(e,"dmn:OutputClause")?u.addOutputRight({output:e}):void 0}},removeClause:function(){if(o.hasSelection()){var e=o.get().col;return Ln(e,"dmn:InputClause")?u.removeInput({input:e}):Ln(e,"dmn:OutputClause")?u.removeOutput({output:e}):void 0}},selectCellAbove:function(){return a.selectCell("above")},selectCellBelow:function(){return a.selectCell("below")},copy:function(e){var n=e.element;t.copy(n)},cut:function(e){var n=e.element;t.cut(n)},pasteBefore:function(e){var n=e.element;return t.pasteBefore(n)},pasteAfter:function(e){var n=e.element;return t.pasteAfter(n)}};n.register(u)}));$_.$inject=["copyCutPaste","editorActions","modeling","selection","cellSelection","sheet"];var V_="is not a registered action",z_=function(){function e(t,n,r,o){i(this,e),this._actions={undo:function(){t.undo()},redo:function(){t.redo()},select:function(e){var t=e.cell;o.select(t)},deselect:function(){o.deselect()},addRow:function(e){var t=e.attrs,n=e.index;r.addRow(t,n)},removeRow:function(e){var t=e.row;r.removeRow(t)},moveRow:function(e){var t=e.row,n=e.index;r.moveRow(t,n)},addCol:function(e){var t=e.attrs,n=e.index;r.addCol(t,n)},removeCol:function(e){var t=e.col;r.removeCol(t)},moveCol:function(e){var t=e.col,n=e.index;r.moveCol(t,n)}}}return o(e,[{key:"trigger",value:function(e,t){if(!this._actions[e])throw F_(e,V_);return this._actions[e](t)}},{key:"register",value:function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);N(e,(function(e,t){n._registerAction(t,e)}))}},{key:"_registerAction",value:function(e,t){if(this.isRegistered(e))throw F_(e,"is already registered");this._actions[e]=t}},{key:"unregister",value:function(e){if(!this.isRegistered(e))throw F_(e,V_);this._actions[e]=void 0}},{key:"isRegistered",value:function(e){return!!this._actions[e]}}]),e}();function F_(e,t){return new Error(e+" "+t)}z_.$inject=["commandStack","eventBus","modeling","selection"];var U_={__depends__:[$y],__init__:["editorActions"],editorActions:["type",z_]},H_={__depends__:[v_,L_,U_,$y],__init__:["decisionTableEditorActions"],decisionTableEditorActions:["type",$_]},W_={__depends__:[H_],__init__:["addRule"],addRule:["type",Ny]},q_=/["'&<>]/,G_=function(e){var t,n=""+e,i=q_.exec(n);if(!i)return n;var r="",o=0,a=0;for(o=i.index;o<n.length;o++){switch(n.charCodeAt(o)){case 34:t="&quot;";break;case 38:t="&amp;";break;case 39:t="&#39;";break;case 60:t="&lt;";break;case 62:t="&gt;";break;default:continue}a!==o&&(r+=n.substring(a,o)),a=o+1,r+=t}return a!==o?r+n.substring(a,o):r};var K_={},X_={get exports(){return K_},set exports(e){K_=e}};function Y_(e,t){return{start:e,end:void 0===t?e:t}}function Z_(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}X_.exports=function(e,t,n){var i=e.start,r=i,o=(n.length,t.length);n.length,t.length;var a=t.substring(i);return n.lastIndexOf(a)===n.length-a.length&&(t=t.substring(0,t.length-a.length),n=n.substring(0,n.length-a.length)),(o=function(e,t){var n,i,r,o=0,a=0;t.length>e.length?(i=t,r=e):(i=e,r=t);for(;o<i.length;)i.charAt(o)!==r.charAt(a)?(n||(n={l_start:o,s_start:a}),o++):(n&&!n.complete&&(n.l_end=o,n.s_end=a,n.complete=!0),a++,o++);n&&!n.complete&&(n.complete=!0,n.s_end=r.length,n.l_end=i.length);if(!n)return;return t.length>e.length?{newStart:n.l_start,newEnd:n.l_end,type:"add"}:{newStart:n.s_start,newEnd:n.s_end,type:t.length<e.length?"remove":"replace"}}(t,n))&&(r="remove"===o.type?o.newStart:o.newEnd),Y_(r)},K_.range=Y_;var Q_=function(e){s(n,e);var t=h(n);function n(e,r){var o,a;return i(this,n),Z_(d(o=t.call(this,e,r)),"onFocus",(function(e){var t=o.props.onFocus;o.setState({focussed:!0}),"function"==typeof t&&t(e)})),Z_(d(o),"onBlur",(function(e){var t=o.props.onBlur;o.setState({focussed:!1}),"function"==typeof t&&t(e)})),Z_(d(o),"onKeydown",(function(e){if(13===e.which){if(e.preventDefault(),o.props.ctrlForNewline&&!function(e){return e.metaKey||e.ctrlKey}(e))return;if(o.props.singleLine)return;e.stopPropagation(),function(){var e=e_(),t=e.getRangeAt(0);if(!t)return;var n=t.cloneRange(),i=document.createElement("br");n.deleteContents(),n.insertNode(i),n.setStartAfter(i),n.setEndAfter(i),Jy(n)}(),o.onInput(e)}})),Z_(d(o),"onInput",(function(e){var t=o.props.onInput;"function"==typeof t&&t(J_(o.node))})),Z_(d(o),"onKeyPress",(function(e){o.onInputIEPolyfill&&o.onInputIEPolyfill(e)})),Z_(d(o),"onPaste",(function(e){if(o.onInputIEPolyfill&&o.onInputIEPolyfill(e),o.props.singleLine){var t=(e.clipboardData||window.clipboardData).getData("text");document.execCommand("insertText",!1,t.replace(/\n/g," ")),e.preventDefault()}})),o.state={},((a=window.navigator.userAgent).indexOf("MSIE ")>0||a.indexOf("Trident/")>0)&&(o.onInputIEPolyfill=function(e){var t=o.node.innerHTML;setTimeout((function(){var n=o.node.innerHTML;t!==n&&o.onInput(e)}),0)}),o}return o(n,[{key:"componentWillUpdate",value:function(e,t){var n=this.node,i=t.focussed&&n_(n);this.selected=i&&{range:i,text:J_(n)}}},{key:"componentDidUpdate",value:function(){var e=this.selected;if(e){var t=e.range,n=e.text,i=this.node,r=J_(i);t_(i,r!==n?K_(t,n,r):t)}}},{key:"getClassName",value:function(){var e=this.props,t=e.className,n=e.placeholder;return[t||"","content-editable",!e.value&&n?"content-editable--with-placeholder":""].join(" ")}},{key:"render",value:function(e){var t=this,n=e.value,i=e.placeholder;return n=G_(n).replace(/\r?\n/g,"<br/>")+"<br/>",Gv(1,"div",this.getClassName(),null,1,{contentEditable:"true",spellcheck:"false","data-placeholder":i||"",onInput:this.onInput,onKeypress:this.onKeypress,onPaste:this.onPaste,onFocus:this.onFocus,onBlur:this.onBlur,onKeydown:this.onKeydown,dangerouslySetInnerHTML:{__html:n}},null,(function(e){return t.node=e}))}}]),n}(ug);function J_(e){return e.innerText.replace(/\n$/,"")}function eb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var tb=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),eb(d(o=t.call(this,e,r)),"onFocus",(function(e){o.setState({focussed:!0});var t=o.props.onFocus;"function"==typeof t&&t(e)})),eb(d(o),"onBlur",(function(e){o.setState({focussed:!1}),o.state.invalid&&o.setState({changing:!1,invalid:!1});var t=o.props.onBlur;"function"==typeof t&&t(e)})),o.state={changing:!1,focussed:!1};var a=r.injector.get("debounceInput");return o.inputChanged=a((function(e){var t=o.props.onChange;"function"==typeof t&&t(e);var n=o.state.changing;o.setState({changing:n!==e&&n})})),o.onInput=function(e){var t=(o.props.validate||function(){})(e);o.setState({changing:e,invalid:t}),t||o.inputChanged(e)},o}return o(n,[{key:"getClassName",value:function(){var e=this.props,t=e.className,n=e.value,i=this.state,r=i.changing;return t+=" editable",i.focussed&&(t+=" focussed"),i.invalid&&(t+=" invalid"),n||r||(t+=" empty"),t}},{key:"getDisplayValue",value:function(){var e=this.props,t=e.value,n=e.placeholder,i=this.state,r=i.focussed,o=i.changing;return"string"==typeof o&&(t=o),t||(t=r?"":n||""),t}},{key:"getEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Kv(2,Q_,{className:e.className,ctrlForNewline:e.ctrlForNewline,onFocus:this.onFocus,onBlur:this.onBlur,onInput:this.onInput,value:this.getDisplayValue()})}}]),n}(ug);function nb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var ib=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),nb(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),nb(d(o),"setAnnotationValue",(function(e){var t=o.props.row;o.modeling.editAnnotation(t.businessObject,e)})),Sg(d(o)),o}return o(n,[{key:"componentWillMount",value:function(){var e=this.props.row;this.changeSupport.onElementsChanged(e.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this.props.row;this.changeSupport.offElementsChanged(e.id,this.onElementsChanged)}},{key:"render",value:function(){var e=this.props,t=e.row,n=e.rowIndex,i=t.businessObject,r=i.description,o=i.id;return Kv(2,Mg,{className:"annotation",onChange:this.setAnnotationValue,coords:"".concat(n,":annotation"),value:r,elementId:o,"data-row-id":t.id,children:Kv(2,rb,{ctrlForNewline:!0,className:"annotation-editor",onChange:this.setAnnotationValue,value:r})})}}]),n}(ug);ib.$inject=["changeSupport","modeling"];var rb=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"render",value:function(){return Gv(1,"div",this.getClassName(),this.getEditor(),0)}}]),n}(tb);function ob(e){e.onGetComponent("cell",(function(e){var t=e.cellType;return"after-label-cells"===t?Fg:"after-rule-cells"===t?ib:void 0}))}ob.$inject=["components"];function ab(e){return function(t){return!1!==e?Y(t,D(e)?e:300):t}}ab.$inject=["config.debounceInput"];var sb={debounceInput:["factory",ab]},ub={__depends__:[sb],__init__:["annotationsProvider"],annotationsProvider:["type",ob]};function cb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lb={position:"absolute"},db=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),cb(d(o=t.call(this,e,r)),"open",(function(e){var t=e.position,n=e.context;o.close(),o.setState({isOpen:!0,position:t||{x:0,y:0},context:n||{}})})),cb(d(o),"close",(function(){o.state.isOpen&&o.setState({context:void 0,isOpen:!1,position:{x:0,y:0}})})),cb(d(o),"triggerClose",(function(){o.eventBus.fire("contextMenu.close")})),o.state={isOpen:!1,position:{x:0,y:0}},Sg(d(o)),o}return o(n,[{key:"componentDidMount",value:function(){this.eventBus.on("contextMenu.open",this.open),this.eventBus.on("contextMenu.close",this.close)}},{key:"componentWillUnmount",value:function(){this.eventBus.off("contextMenu.open",this.open),this.eventBus.off("contextMenu.close",this.close)}},{key:"render",value:function(){var e=this.state,t=e.isOpen,n=e.context,i=e.position;if(!t)return null;var r=this.components.getComponents("context-menu",n);return r.length?Kv(2,pb,{className:"context-menu no-deselect",context:n,position:i,offset:n.offset||{x:0,y:0},autoFocus:!1!==n.autoFocus,autoClose:!1!==n.autoClose,components:r,onClose:this.triggerClose}):null}}]),n}(ug);db.$inject=["eventBus","components"];var pb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),cb(d(o=t.call(this,e,r)),"onGlobalMouseDown",(function(e){o.checkClose(e.target)})),cb(d(o),"onGlobalKey",(function(e){var t=e.which;13!==t&&27!==t||(e.stopPropagation(),e.preventDefault(),o.close())})),cb(d(o),"onFocusChanged",(function(e){o.checkClose(e.target)})),cb(d(o),"setNode",(function(e){o.node=e;var t,n=o.props.autoFocus;e&&(o.updatePosition(),n&&(t=wn(fb,e))&&(t.focus(),t.selectionStart&&"text"===t.type?t.selectionStart=1e5:"contentEditable"in t&&t_(t,{start:1e5,end:1e5})))})),Sg(d(o)),o}return o(n,[{key:"close",value:function(){var e=this.props.onClose;R(e)&&e()}},{key:"checkClose",value:function(e){if(this.props.autoClose){var t=this.node;t&&t!==e&&(t.contains(e)||this.close())}}},{key:"componentDidMount",value:function(){document.addEventListener("focusin",this.onFocusChanged),document.addEventListener("keydown",this.onGlobalKey),document.addEventListener("mousedown",this.onGlobalMouseDown)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("focusin",this.onFocusChanged),document.removeEventListener("keydown",this.onGlobalKey),document.removeEventListener("mousedown",this.onGlobalMouseDown)}},{key:"updatePosition",value:function(){var e=this.props,t=e.position,n=e.offset,i=this.node,r=i.getBoundingClientRect();t.width||(t.width=0),t.height||(t.height=0);var o=this.renderer.getContainer().getBoundingClientRect();o.width>o.height?(this.node.classList.add("horizontal"),this.node.classList.remove("vertical")):(this.node.classList.add("vertical"),this.node.classList.remove("horizontal"));var a,s,u,c=function(e){var t=un(e,".tjs-container");if(!t)return{scrollTop:0,scrollLeft:0};var n=t.scrollLeft,i=t.scrollTop;return{scrollTop:i,scrollLeft:n}}(i),l=c.scrollLeft,d=c.scrollTop,p={};t.align&&(a=t.align.split("-")),"left"===(a&&a[1]||(t.x+t.width/2>o.width/2?"left":"right"))?(s=t.x-o.left-r.width+n.x+l,i.classList.remove("right"),i.classList.add("left")):(s=-o.left+t.x+t.width-n.x+l,i.classList.remove("left"),i.classList.add("right")),s=a?s:hb(s,0+l,o.width-r.width+l),p.left=s+"px","top"===(a&&a[0]||(t.y+t.height/2>o.height/2?"top":"bottom"))?(u=t.y-o.top-r.height+n.y+d,i.classList.remove("bottom"),i.classList.add("top")):(u=-o.top+t.y-n.y+d,i.classList.remove("top"),i.classList.add("bottom")),u=a?u:hb(u,0+d,o.height-r.height+d),p.top=u+"px",p.overflowY="auto",p.maxHeight=o.height-u+d+"px",J(this.node.style,lb,p)}},{key:"render",value:function(){var e=this.props,t=e.context,n=e.components;return Gv(1,"div",e.className,n.map((function(e,n){return Kv(2,e,{context:t},n)})),0,{onContextMenu:function(e){return e.preventDefault()}},null,this.setNode)}}]),n}(ug);function hb(e,t,n){return Math.max(t,Math.min(n,e))}pb.$inject=["renderer"];var fb="\n  input[type=text],\n  input[type=number],\n  input[type=button],\n  input[type=submit],\n  [contenteditable],\n  [tabindex],\n  a[href],\n  textarea,\n  button\n";var vb=function(){function e(t,n,r){i(this,e),this._eventBus=n,t.onGetComponent("table.before",(function(){return db}))}return o(e,[{key:"open",value:function(e,t){this._eventBus.fire("contextMenu.open",{position:e,context:t})}},{key:"close",value:function(){this._eventBus.fire("contextMenu.close")}}]),e}();vb.$inject=["components","eventBus","renderer"];var mb={__init__:["contextMenu"],contextMenu:["type",vb]};function gb(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function yb(e){return e.shiftKey}function _b(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var bb=function(){function e(t,n,r,o,a,s,u){var c=this;i(this,e),_b(this,"_clearClipboard",(function(){c._clipboard.clear()})),_b(this,"_registerBindings",(function(){[function(e,t){if(gb(t)&&67===e){var n=c._getSelectedCell();if(!n)return;return yb(t)?c._editorActions.trigger("copy",{element:n.col}):c._editorActions.trigger("copy",{element:n.row}),!0}},function(e,t){if(gb(t)&&88===e){var n=c._getSelectedCell();if(!n)return;return yb(t)?c._editorActions.trigger("cut",{element:n.col}):c._editorActions.trigger("cut",{element:n.row}),!0}},function(e,t){var n;if(gb(t)&&86===e){var i=c._getSelectedCell();if(!i)return;yb(t)?(n=c._editorActions.trigger("pasteAfter",{element:i.col}))&&c._cellSelection.selectCell("right"):(n=c._editorActions.trigger("pasteAfter",{element:i.row}))&&c._cellSelection.selectCell("below")}return void 0!==n}].forEach((function(e){c._keyboard.addListener(e)}))})),this._clipboard=r,this._cellSelection=o,this._elementRegistry=a,this._editorActions=s,this._keyboard=t.get("keyboard",!1),this._renderer=u,this._keyboard&&(n.on("keyboard.init",this._registerBindings),n.on("keyboard.bind",(function(){fn.bind(document,"copy",c._clearClipboard,!0),fn.bind(document,"cut",c._clearClipboard,!0)})),n.on("keyboard.unbind",(function(){fn.unbind(document,"copy",c._clearClipboard,!0),fn.unbind(document,"cut",c._clearClipboard,!0)})))}return o(e,[{key:"_getSelectedCell",value:function(){var e=this._cellSelection.getCellSelection();if(e){var t=this._elementRegistry.get(e);if(t){var n=l_(e,this._renderer.getContainer()),i=p_(n);if(document.activeElement===i){var r=n_(n);if(!r||r.start===r.end)return t}}}}}]),e}();bb.$inject=["injector","eventBus","clipboard","cellSelection","elementRegistry","editorActions","renderer"];var xb={__depends__:[g_,v_],__init__:["copyCutPasteKeyBindings"],copyCutPasteKeyBindings:["type",bb]};function wb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Cb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),wb(d(o=t.call(this,e,r)),"onClick",(function(e){o.editorActions.trigger("addInput")})),Sg(d(o)),o}return o(n,[{key:"render",value:function(){return Gv(1,"th","input-cell create-inputs header actionable",[this.translate("Input"),Xv(" "),Gv(1,"span","add-input dmn-icon-plus action-icon",null,1,{title:this.translate("Add Input")})],0,{onClick:this.onClick,title:this.translate("Add Input")})}}]),n}(ug);function Eb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Cb.$inject=["editorActions","translate"];var kb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Eb(d(o=t.call(this,e,r)),"onClick",(function(e){o.editorActions.trigger("addInput")})),Sg(d(o)),o}return o(n,[{key:"render",value:function(){return Gv(1,"td","input-cell create-inputs",Xv("-"),2,{onClick:this.onClick,title:this.translate("Add Input")})}}]),n}(ug);kb.$inject=["editorActions","translate"];var Sb=o((function e(t,n){i(this,e),t.onGetComponent("cell",500,(function(e){var t=e.cellType,i=n.getRoot().businessObject;if(!i.input||!i.input.length)return"before-label-cells"===t?Cb:"before-rule-cells"===t?kb:void 0}))}));Sb.$inject=["components","sheet"];var jb={__depends__:[H_],__init__:["createInputsProvider"],createInputsProvider:["type",Sb]},Ob=["string","boolean","number","date","time","dateTime","dayTimeDuration","yearMonthDuration","Any"],Pb=function(){function e(t){i(this,e),this._dataTypes=t||Ob}return o(e,[{key:"getAll",value:function(){return this._dataTypes}}]),e}();Pb.$inject=["config.dataTypes"];var Db={__init__:["dataTypes"],dataTypes:["type",Pb]},Rb=function(){function e(t,n,r,o,a,s,u,c,l,d,p){i(this,e);var h=this;this._contextMenu=n,this._clipboard=r,this._editorActions=o,this._elementRegistry=s,this._eventBus=a,this._modeling=u,this._selection=c,this._sheet=l,this._rules=d,this._translate=p,this._getEntries=this._getEntries.bind(this),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"context-menu"===e.contextMenuType){var n=h._getEntries(e),i=h._elementRegistry.get(e.id),r=Tb(i)&&t.getComponents("context-menu-cell-additional",e);if(r&&r.length){var o=Gv(1,"div","context-menu-group context-menu-group-cell",r,0);return function(){return Gv(1,"div","context-menu-flex",(n||[]).concat(o),0)}}return function(){return Gv(1,"div","context-menu-flex",n||[],0)}}})),a.on("cell.contextmenu",(function(e){var t=e.event,i=e.id;e.node,t.preventDefault(),n.open({x:t.pageX,y:t.pageY},{contextMenuType:"context-menu",event:t,id:i})}))}return o(e,[{key:"_getEntries",value:function(e){var t=this,n=function(n){var i=n.cells.map((function(e){return e.id})).indexOf(e.id),r=t._editorActions.trigger("addRuleAbove",{rule:n});r.cells[i]?t._selection.select(r.cells[i]):t._selection.select(r.cells[0]),t._contextMenu.close()},i=function(n){var i=n.cells.map((function(e){return e.id})).indexOf(e.id),r=t._editorActions.trigger("addRuleBelow",{rule:n});r.cells[i]?t._selection.select(r.cells[i]):t._selection.select(r.cells[0]),t._contextMenu.close()},r=function(e){t._editorActions.trigger("removeRule",{rule:e}),t._contextMenu.close()},o=function(e){t._editorActions.trigger("addInputLeft",{input:e}),t._contextMenu.close()},a=function(e){t._editorActions.trigger("addInputRight",{input:e}),t._contextMenu.close()},s=function(e){t._editorActions.trigger("removeInput",{input:e}),t._contextMenu.close()},u=function(e){t._editorActions.trigger("addOutputLeft",{output:e}),t._contextMenu.close()},c=function(e){t._editorActions.trigger("addOutputRight",{output:e}),t._contextMenu.close()},l=function(e){t._editorActions.trigger("removeOutput",{output:e}),t._contextMenu.close()},d=function(e){t._editorActions.trigger("copy",{element:e}),t._contextMenu.close()},p=function(e){t._editorActions.trigger("cut",{element:e}),t._contextMenu.close()},h=function(e){t._editorActions.trigger("pasteBefore",{element:e}),t._contextMenu.close()},f=function(e){t._editorActions.trigger("pasteAfter",{element:e}),t._contextMenu.close()},v=e&&e.id;if(!v)return null;var m=this._elementRegistry.get(v);if(!m)return null;var g=this._clipboard.get()||{},y=[],_=m.row||m;if(Ln(_,"dmn:DecisionRule")){var b=this._rules.allowed("paste",{data:g.elements,target:_});y.push(Gv(1,"div","context-menu-group",[Gv(1,"div","context-menu-group-entry context-menu-entry-copy-rule",this._translate("Copy Rule"),0,{onClick:function(){return d(_)}}),Gv(1,"div","context-menu-group-entry context-menu-entry-cut-rule",this._translate("Cut Rule"),0,{onClick:function(){return p(_)}}),Gv(1,"div","context-menu-group-entry ".concat(b?"":"disabled"," context-menu-entry-paste-rule-above"),this._translate("Paste Rule Above"),0,{onClick:function(){return h(_)}}),Gv(1,"div","context-menu-group-entry ".concat(b?"":"disabled"," context-menu-entry-paste-rule-below"),this._translate("Paste Rule Below"),0,{onClick:function(){return f(_)}})],4),Gv(1,"div","context-menu-group",[Gv(1,"div","context-menu-group-entry context-menu-entry-add-rule-above",this._translate("Add Rule Above"),0,{onClick:function(){return n(_)}}),Gv(1,"div","context-menu-group-entry context-menu-entry-add-rule-below",this._translate("Add Rule Below"),0,{onClick:function(){return i(_)}}),Gv(1,"div","context-menu-group-entry context-menu-entry-remove-rule",this._translate("Remove Rule"),0,{onClick:function(){return r(_)}})],4))}else if(Ln(m,"dmn:InputClause")){var x=Ln(m,"dmn:InputClause")?m:m.col,w=this._rules.allowed("col.remove",{col:m.col||m}),C=this._rules.allowed("paste",{data:g.elements,target:m.col||m});y.push(Gv(1,"div","context-menu-group",[Gv(1,"div","context-menu-group-entry context-menu-entry-copy-input",this._translate("Copy Input Column"),0,{onClick:function(){return d(x)}}),Gv(1,"div","context-menu-group-entry ".concat(w?"":"disabled"," context-menu-entry-cut-input"),this._translate("Cut Input Column"),0,{onClick:function(){return p(x)}}),Gv(1,"div","context-menu-group-entry ".concat(C?"":"disabled"," context-menu-entry-paste-input-left"),this._translate("Paste Input Column Left"),0,{onClick:function(){return h(x)}}),Gv(1,"div","context-menu-group-entry ".concat(C?"":"disabled"," context-menu-entry-paste-input-right"),this._translate("Paste Input Column Right"),0,{onClick:function(){return f(x)}})],4),Gv(1,"div","context-menu-group",[Gv(1,"div","context-menu-group-entry context-menu-entry-add-input-left",this._translate("Add Input Column Left"),0,{onClick:function(){return o(x)}}),Gv(1,"div","context-menu-group-entry context-menu-entry-add-input-right",this._translate("Add Input Column Right"),0,{onClick:function(){return a(x)}}),Gv(1,"div","context-menu-group-entry ".concat(w?"":"disabled"," context-menu-entry-remove-input"),this._translate("Remove Input Column"),0,{onClick:function(){return s(x)}})],4))}else if(Ln(m,"dmn:OutputClause")||Ln(m.col,"dmn:OutputClause")){var E=Ln(m,"dmn:OutputClause")?m:m.col,k=this._rules.allowed("col.remove",{col:m.col||m}),S=this._rules.allowed("paste",{data:g.elements,target:m.col||m});y.push(Gv(1,"div","context-menu-group",[Gv(1,"div","context-menu-group-entry context-menu-entry-copy-output",this._translate("Copy Output Column"),0,{onClick:function(){return d(E)}}),Gv(1,"div","context-menu-group-entry ".concat(k?"":"disabled"," context-menu-entry-cut-output"),this._translate("Cut Output Column"),0,{onClick:function(){return p(E)}}),Gv(1,"div","context-menu-group-entry ".concat(S?"":"disabled"," context-menu-entry-paste-output-left"),this._translate("Paste Output Column Left"),0,{onClick:function(){return h(E)}}),Gv(1,"div","context-menu-group-entry ".concat(S?"":"disabled"," context-menu-entry-paste-output-right"),this._translate("Paste Output Column Right"),0,{onClick:function(){return f(E)}})],4),Gv(1,"div","context-menu-group",[Gv(1,"div","context-menu-group-entry context-menu-entry-add-output-left",this._translate("Add Output Column Left"),0,{onClick:function(){return u(E)}}),Gv(1,"div","context-menu-group-entry context-menu-entry-add-output-right",this._translate("Add Output Column Right"),0,{onClick:function(){return c(E)}}),Gv(1,"div","context-menu-group-entry ".concat(k?"":"disabled"," context-menu-entry-remove-output"),this._translate("Remove Output Column"),0,{onClick:function(){return l(E)}})],4))}return y}}]),e}();function Tb(e){return e instanceof yv}Rb.$inject=["components","contextMenu","clipboard","editorActions","eventBus","elementRegistry","modeling","selection","sheet","rules","translate"];var Mb=["row.add","row.remove","col.add","col.remove"],Ib=o((function e(t,n){i(this,e),n.on("commandStack.executed",(function(e){var n=e.command;-1!==Mb.indexOf(n)&&t.close()})),n.on("commandStack.reverted",(function(){t.close()}))}));Ib.$inject=["contextMenu","eventBus"];var Ab={__depends__:[H_,mb,b_],__init__:["decisionTableContextMenu","contextMenuCloseBehavior"],decisionTableContextMenu:["type",Rb],contextMenuCloseBehavior:["type",Ib]};function Nb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Bb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Nb(d(o=t.call(this,e,r)),"onClick",(function(e){var t=o.props.output;o._eventBus.fire("output.edit",{event:e,output:t})})),Nb(d(o),"onContextmenu",(function(e){var t=o.props.output.id;o._eventBus.fire("cell.contextmenu",{event:e,id:t})})),Nb(d(o),"onElementsChanged",(function(){o.forceUpdate()})),Og(d(o),Vg),o._translate=r.injector.get("translate"),o}return o(n,[{key:"componentWillMount",value:function(){var e=this.context.injector;this._changeSupport=this.context.changeSupport,this._eventBus=e.get("eventBus"),this._elementRegistry=e.get("elementRegistry");var t=this.props.output;this._changeSupport.onElementsChanged(t.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this.props.output;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}},{key:"render",value:function(){var e=this.props,t=e.output,n=e.index,i=e.outputsLength,r=t.label,o=t.name,a=t.outputValues,s=t.typeRef,u=t.width?t.width+"px":"192px";return Gv(1,"th","output-cell output-editor",[this.slotFills({type:"cell-inner",context:{cellType:"output-cell",col:this._elementRegistry.get(t.id),index:n,outputsLength:i},col:t}),Gv(1,"div","clause",0===n?this._translate("Then"):this._translate("And"),0),r?Gv(1,"div","output-label",r,0,{title:this._translate("Output Label: ")+r}):Gv(1,"div","output-name",o,0,{title:this._translate("Output Name: ")+o}),Gv(1,"div","output-variable",a&&a.text||this._translate(s),0,{title:a&&a.text?this._translate("Output Values"):this._translate("Output Type")})],0,{"data-col-id":t.id,onDblClick:this.onClick,onContextmenu:this.onContextmenu,style:{width:u}})}}]),n}(ug);function Lb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var $b=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Lb(d(o=t.call(this,e,r)),"onInput",(function(e){var t=o.props.onInput;"function"==typeof t&&t(e.target.value)})),Lb(d(o),"onKeyDown",(function(e){var t=o.props.onKeyDown;"function"==typeof t&&t(e)})),Lb(d(o),"onKeyUp",(function(e){var t=o.props.onKeyUp;"function"==typeof t&&t(e)})),o}return o(n,[{key:"render",value:function(){var e=this.props,t=e.className,n=e.placeholder,i=e.type,r=e.value;return Gv(64,"input",[t||"","dms-input"].join(" "),null,1,{placeholder:n||"",onInput:this.onInput,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,spellcheck:"false",type:i||"text",value:r})}}]),n}(ug),Vb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r)).translate=r.injector?r.injector.get("translate"):zb,o.setName=function(e){e=e||void 0,o.handleChange({name:e})},o.setLabel=function(e){e=e||void 0,o.handleChange({label:e})},o}return o(n,[{key:"handleChange",value:function(e){var t=this.props.onChange;"function"==typeof t&&t(e)}},{key:"render",value:function(){var e=this.props,t=e.name,n=e.label;return Gv(1,"div","context-menu-container ref-output-editor output-edit",[Gv(1,"div","dms-form-control",Kv(2,Q_,{className:"dms-output-label",value:n||"",placeholder:this.translate("Output"),singleLine:!0,onInput:this.setLabel}),2),Gv(1,"div","dms-form-control",[Gv(1,"label","dms-label",this.translate("Output Name"),0),Kv(2,$b,{className:"ref-output-name",value:t||"",onInput:this.setName})],4)],4)}}]),n}(ug);function zb(e){return e}function Fb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ub(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fb(Object(n),!0).forEach((function(t){Hb(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fb(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Wb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Hb(d(o=t.call(this,e,r)),"persistChanges",(function(){var e=o.props.context.output,t=o.state.unsaved;t&&(o.modeling.updateProperties(e,t),o.setState({unsaved:!1}))})),Hb(d(o),"handleChange",(function(e){o.setState({unsaved:Ub(Ub({},o.state.unsaved),e)},o.persistChanges)})),o.state={},Sg(d(o)),o.persistChanges=o.debounceInput(o.persistChanges),o}return o(n,[{key:"getValue",value:function(e){var t=this.props.context.output,n=this.state.unsaved;return n&&e in n?n[e]:t.get(e)}},{key:"render",value:function(){return Kv(2,Vb,{name:this.getValue("name"),label:this.getValue("label"),onChange:this.handleChange})}}]),n}(ug);Wb.$inject=["debounceInput","modeling"];var qb=o((function e(t,n,r,o){i(this,e),t.onGetComponent("cell",(function(e){if("output-header"===e.cellType)return Bb})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("output-edit"===e.contextMenuType)return Wb})),r.on("output.edit",(function(e){var t=e.event,i=e.output,r=un(t.target,"th",!0),o=r.getBoundingClientRect(),a=o.left,s=o.top,u=function(e){if(!sn(e,".output-cell + .output-cell"))return{x:-1,y:0}}(r);n.open({x:a,y:s,align:"bottom-right"},{contextMenuType:"output-edit",output:i,offset:u})}))}));function Gb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}qb.$inject=["components","contextMenu","eventBus","renderer"];var Kb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Gb(d(o=t.call(this,e,r)),"onClick",(function(e){var t=o.props.input;o._eventBus.fire("input.edit",{event:e,input:t})})),Gb(d(o),"onContextmenu",(function(e){var t=o.props.input.id;o._eventBus.fire("cell.contextmenu",{event:e,id:t})})),Gb(d(o),"onElementsChanged",(function(){o.forceUpdate()})),Og(d(o),Vg),o._translate=r.injector.get("translate"),o}return o(n,[{key:"componentWillMount",value:function(){var e=this.context.injector;this._changeSupport=this.context.changeSupport,this._sheet=e.get("sheet"),this._eventBus=e.get("eventBus"),this._elementRegistry=e.get("elementRegistry");var t=this._sheet.getRoot(),n=this.props.input;this._changeSupport.onElementsChanged(t.id,this.onElementsChanged),this._changeSupport.onElementsChanged(n.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this._sheet.getRoot(),t=this.props.input;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged),this._changeSupport.offElementsChanged(t.id,this.onElementsChanged)}},{key:"render",value:function(){var e=this.props,t=e.input,n=e.index,i=e.inputsLength,r=t.inputExpression,o=t.inputValues,a=t.get("label"),s=t.width?t.width+"px":"192px";return Gv(1,"th","input-cell input-editor",[this.slotFills({type:"cell-inner",context:{cellType:"input-cell",col:this._elementRegistry.get(t.id),index:n,inputsLength:i},col:t}),Gv(1,"div","clause",0===n?this._translate("When"):this._translate("And"),0),a?Gv(1,"div","input-label",a,0,{title:this._translate("Input Label: ")+a}):Gv(1,"div","input-expression",r.text,0,{title:this._translate("Input Expression: ")+r.text}),Gv(1,"div","input-variable",o&&o.text||this._translate(r.typeRef),0,{title:o&&o.text?this._translate("Input Values"):this._translate("Input Type")})],0,{"data-col-id":t.id,onDblClick:this.onClick,onContextmenu:this.onContextmenu,style:{width:s}})}}]),n}(ug),Xb=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r)).translate=r.injector?r.injector.get("translate"):Yb,o.handleValue=function(e){var t={text:e};o.handleChange(t)},o.handleLabelChange=function(e){var t=e||void 0;o.handleChange({label:t})},o}return o(n,[{key:"handleChange",value:function(e){var t=this.props.onChange;"function"==typeof t&&t(e)}},{key:"render",value:function(){var e=this.props,t=e.label,n=e.text;return Gv(1,"div","context-menu-container ref-input-editor input-edit",[Gv(1,"div","dms-form-control",Kv(2,Q_,{className:"dms-input-label",value:t||"",placeholder:this.translate("Input"),singleLine:!0,onInput:this.handleLabelChange}),2),Gv(1,"div","dms-form-control",[Gv(1,"label","dms-label",this.translate("Expression"),0),Kv(2,Q_,{placeholder:this.translate("enter expression"),className:["ref-text","dms-input"].join(" "),onInput:this.handleValue,value:n||""})],4)],4)}}]),n}(ug);function Yb(e){return e}var Zb=["label"];function Qb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Jb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qb(Object(n),!0).forEach((function(t){tx(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qb(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ex(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var nx=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),tx(d(o=t.call(this,e,r)),"persistChanges",(function(){var e=o.props.context.input,t=o.state.unsaved;if(t){var n,i=t.label,r=ex(t,Zb),a={};"label"in t&&(a.label=i),n=r,Object.keys(n).length&&(a.inputExpression=r),o.modeling.updateProperties(e,a),o.setState({unsaved:!1})}})),tx(d(o),"handleChange",(function(e){o.setState({unsaved:Jb(Jb({},o.state.unsaved),e)},o.persistChanges)})),o.state={},Sg(d(o)),o.persistChanges=o.debounceInput(o.persistChanges),o}return o(n,[{key:"getValue",value:function(e){var t=this.props.context.input,n=this.state.unsaved,i=t;return"text"===e&&(i=i.inputExpression),n&&e in n?n[e]:i.get(e)}},{key:"render",value:function(){return Kv(2,Xb,{label:this.getValue("label"),text:this.getValue("text"),onChange:this.handleChange})}}]),n}(ug);nx.$inject=["debounceInput","modeling","injector"];var ix=o((function e(t,n,r,o){i(this,e),t.onGetComponent("cell",(function(e){if("input-header"===e.cellType)return Kb})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("input-edit"===e.contextMenuType)return nx})),r.on("input.edit",(function(e){var t=e.event,i=e.input,r=un(t.target,"th",!0).getBoundingClientRect(),o=r.left,a=r.top;n.open({x:o,y:a,align:"bottom-right"},{contextMenuType:"input-edit",input:i})}))}));function rx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}ix.$inject=["components","contextMenu","eventBus","renderer"];var ox=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),rx(d(o=t.call(this,e,r)),"onChange",(function(e){o.setState({value:e});var t=o.props.onChange;"function"==typeof t&&t(e)})),rx(d(o),"onInputClick",(function(e){e.preventDefault(),e.stopPropagation(),o.setOptionsVisible(!o.state.optionsVisible),o.focusInput()})),rx(d(o),"onInput",(function(e){var t=e.target.value;o.onChange(t)})),rx(d(o),"onOptionClick",(function(e,t){t.preventDefault(),t.stopPropagation(),o.setOptionsVisible(!1),o.onChange(e),o.focusInput()})),rx(d(o),"onFocusChanged",(function(e){o.checkClose(e.target)})),rx(d(o),"onGlobalClick",(function(e){o.checkClose(e.target)})),rx(d(o),"onKeyDown",(function(e){var t=o.state.optionsVisible,n=e.which;40!==n&&38!==n||(e.stopPropagation(),e.preventDefault(),t?o.select(40===n?1:-1):o.setOptionsVisible(!0)),t&&(13!==n&&27!==n||(e.stopPropagation(),e.preventDefault(),o.setOptionsVisible(!1)))})),rx(d(o),"onKeyboard",(function(e){if(o.state.optionsVisible)return 27===e?(o.setOptionsVisible(!1),!0):void 0})),Sg(d(o));var a=e.value;return o.state={value:a,optionsVisible:!1},o._portalEl=null,o}return o(n,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onGlobalClick),document.addEventListener("focusin",this.onFocusChanged),this.keyboard.addListener(this.onKeyboard)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("focusin",this.onFocusChanged),document.removeEventListener("mousedown",this.onGlobalClick),this.keyboard.removeListener(this.onKeyboard),this.removePortalEl()}},{key:"componentWillReceiveProps",value:function(e){var t=e.value;this.setState({value:t})}},{key:"componentWillUpdate",value:function(e,t){t.optionsVisible?this._portalEl||this.addPortalEl():this._portalEl&&this.removePortalEl()}},{key:"componentDidUpdate",value:function(){if(this.state.optionsVisible&&this.inputNode){var e=this.getOptionsBounds();J(this._portalEl.style,e)}}},{key:"getOptionsBounds",value:function(){var e=this.renderer.getContainer(),t=e.getBoundingClientRect(),n=t.top,i=t.left,r=t.bottom,o=this.inputNode.getBoundingClientRect(),a=o.top,s=o.left,u=o.width,c=o.height,l=o.bottom,d=a+c-n+e.scrollTop,p=s-i+e.scrollLeft,h={top:"".concat(d,"px"),left:"".concat(p,"px"),width:"".concat(u,"px"),"max-height":"calc(100% - ".concat(d,"px)")};if(r-l<c){var f=r-a;h.bottom="".concat(f,"px"),h["max-height"]="calc(100% - ".concat(f,")"),delete h.top}return h}},{key:"addPortalEl",value:function(){this._portalEl=xn('<div class="dms-select-options"></div>'),this.renderer.getContainer().appendChild(this._portalEl),this._portalEl.addEventListener("mousedown",ax)}},{key:"removePortalEl",value:function(){this._portalEl&&(this._portalEl.removeEventListener("mousedown",ax),En(this._portalEl),this._portalEl=null)}},{key:"focusInput",value:function(){var e=this.inputNode;e.focus(),"selectionStart"in e&&(e.selectionStart=1e5)}},{key:"checkClose",value:function(e){!this._portalEl||this._portalEl.contains(e)||this.parentNode.contains(e)||this.setOptionsVisible(!1)}},{key:"select",value:function(e){var t=this.props.options,n=this.state.value;if(t){var i=t.filter((function(e){return e.value===n}))[0],r=i?t.indexOf(i):-1,o=-1===r?1===e?0:t.length-1:(r+e)%t.length,a=t[o<0?t.length+o:o];this.onChange(a.value)}}},{key:"setOptionsVisible",value:function(e){this.setState({optionsVisible:e})}},{key:"renderOptions",value:function(e,t){var n=this;return Gv(1,"div","options",e.map((function(e){return Gv(1,"div",["option",t===e?"active":""].join(" "),e.label,0,{"data-value":e.value,onClick:function(t){return n.onOptionClick(e.value,t)}})})),0)}},{key:"render",value:function(){var e,t,n=this,i=this.props,r=i.className,o=i.options,a=i.noInput,s=i.title,u=this.state,c=u.optionsVisible,l=u.value,d=!!o&&o.filter((function(e){return e.value===l}))[0],p=d?d.label:l;return Gv(1,"div",[r||"","dms-input-select"].join(" "),[a?Gv(1,"div","dms-input",p,0,{tabindex:"0",onKeyDown:this.onKeyDown},null,(function(e){return n.inputNode=e})):Gv(64,"input","dms-input",null,1,{onInput:this.onInput,onKeyDown:this.onKeyDown,spellcheck:"false",type:"text",value:l},null,(function(e){return n.inputNode=e})),Gv(1,"span",["dms-input-select-icon",c?"dmn-icon-up":"dmn-icon-down"].join(" ")),c&&(e=this.renderOptions(o,d),t=this._portalEl,Gv(1024,t,null,e,0,null,Tv(e)?null:e.key,null))],0,{title:s,onClick:this.onInputClick},null,(function(e){return n.parentNode=e}))}}]),n}(ug);function ax(e){e.stopPropagation()}function sx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}ox.$inject=["keyboard","renderer"];var ux=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),sx(d(o=t.call(this,e)),"onTypeChange",(function(e){var t,n=o.getElement(),i=Ln(n,"dmn:LiteralExpression")?n.$parent:n;$n(i)?t={inputExpression:{typeRef:e}}:Vn(i)&&(t={typeRef:e}),o._modeling.updateProperties(i,t)})),o._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling"),o._dataTypes=r.injector.get("dataTypes"),o}return o(n,[{key:"getElement",value:function(){return this.props.context.input||this.props.context.output}},{key:"render",value:function(){var e=this,t=this.getElement(),n=(Ln(t,"dmn:InputClause")?t.inputExpression:t).typeRef,i=this._dataTypes.getAll().map((function(t){return{label:e._translate(t),value:t}}));return Gv(1,"div","type-ref-edit context-menu-container",Gv(1,"div","dms-form-control",[Gv(1,"label","dms-label",[this._translate("Type"),Xv(":")],0),Kv(2,ox,{className:"type-ref-edit-select",onChange:this.onTypeChange,options:i,value:n})],4),2)}}]),n}(ug),cx=o((function e(t){i(this,e),t.onGetComponent("context-menu",750,(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.contextMenuType;if("input-edit"===t||"output-edit"===t)return ux}))}));cx.$inject=["components"];var lx={__depends__:[mb,Db],__init__:["typeRefEditingProvider"],typeRefEditingProvider:["type",cx]},dx=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e)).postExecuted("element.updateProperties",(function(e){var t=e.context,n=t.element,i=t.properties,o=$n(n)?i.inputExpression:i;if(o&&o.typeRef&&"string"!==o.typeRef){var a=Ln(n,"dmn:LiteralExpression")?n.$parent:n;r.editAllowedValues(a,null)}})),o}return o(n)}(Kd);function px(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}dx.$inject=["eventBus","modeling"];var hx=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),px(d(o=t.call(this,e,r)),"getRemoveClickHandler",(function(e){return function(t){t.stopPropagation(),o.removeItem(e)}})),px(d(o),"getToggleClickHandler",(function(e){return function(t){t.stopPropagation(),o.toggleItem(e)}})),px(d(o),"removeItem",(function(e){var t=o.props.onChange,n=o.state.items.filter((function(t){return t!==e}));o.setState({items:n}),t&&t(n)})),px(d(o),"toggleItem",(function(e){var t=o.props,n=t.onChange,i=t.type,r=o.state.items.map((function(t){return t===e?t.isChecked=!t.isChecked:"radio"===i&&(t.isChecked=!1),t}));o.setState({items:r}),n&&n(r)}));var a=e.items;return o.state={items:a},o}return o(n,[{key:"componentWillReceiveProps",value:function(e){var t=e.items;this.setState({items:t})}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,i=t.items,r=t.type,o=t.labelComponent,a=["dms-list-component"];n&&a.push(n);var s=function(e){var t=[];for(var n in e)t.push([n,e[n]]);return t}(U(i,"group"));return Gv(1,"div",a.join(" "),s.map((function(t){var n=t[0],i=t[1];return Gv(1,"div","group",[o&&o(n)||Gv(1,"h4","dms-heading",n,0),Gv(1,"ul","items no-wrap",i.map((function(t){return Gv(1,"li","item",[r&&Gv(64,"input","item-toggle",null,1,{type:r,checked:t.isChecked,onClick:e.getToggleClickHandler(t)}),Xv(" "),t.value,t.isRemovable&&Gv(1,"span","remove dmn-icon-clear",null,1,{title:"Remove item",onClick:e.getRemoveClickHandler(t)})],0)})),0)],0)})),0)}}]),n}(ug);var fx=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),o=t.call(this,e,r);var a=e.validate,s=e.value,u=a?a(s||""):void 0;return o.state={validationWarning:u,value:s},o.onInput=o.onInput.bind(d(o)),o.onKeyDown=o.onKeyDown.bind(d(o)),o.onKeyUp=o.onKeyUp.bind(d(o)),o}return o(n,[{key:"componentWillReceiveProps",value:function(e){var t=e.validate,n=e.value,i=t?t(n||""):void 0;this.setState({validationWarning:i,value:n})}},{key:"onInput",value:function(e){var t=this.props,n=t.onInput,i=t.validate,r=i?i(e):void 0;this.setState({validationWarning:r,value:e}),"function"==typeof n&&n&&n({isValid:!r,value:e})}},{key:"onKeyDown",value:function(e){var t=e.target.value,n=this.props,i=n.onKeyDown,r=n.validate,o=r?r(t):void 0;"function"==typeof i&&i({isValid:!o,value:t,event:e})}},{key:"onKeyUp",value:function(e){var t=e.target.value,n=this.props,i=n.onKeyUp,r=n.validate,o=r?r(t):void 0;"function"==typeof i&&i({isValid:!o,value:t,event:e})}},{key:"render",value:function(){var e=this.props,t=e.placeholder,n=e.type,i=e.className,r=this.state,o=r.validationWarning,a=r.value,s=["dms-validated-input",i].join(" "),u=[];return o&&u.push("invalid"),Gv(1,"div",s,[Kv(2,$b,{className:u,onInput:this.onInput,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,placeholder:t||"",type:n,value:a||""}),o&&Gv(1,"p","dms-hint dms-validation-warning",o,0)],0)}}]),n}(ug);function vx(e){if(!e||function(e){return""===e}(e.trim()))return{values:[]};var t=e.split(","),n={values:[]},i="";return t.forEach((function(e){/^"[^"]*"$/.test((i+=e).trim())?(n.values.push(i.trim()),i=""):i+=","})),i?void 0:n}function mx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var gx=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),mx(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),mx(d(o),"setPredefinedValues",(function(e){var t=o.getAllowedValuesTarget();o.setState({values:e}),o._modeling.editAllowedValues(t,e&&function(e){return e.map((function(e){return e.value}))}(e))})),mx(d(o),"onListChange",(function(e){o.setPredefinedValues(e)})),mx(d(o),"onInput",(function(e){e.isValid;var t=e.value;o.setState({inputValue:t})})),mx(d(o),"onKeyDown",(function(e){var t=e.isValid,n=e.event;if(13===n.keyCode&&(n.stopPropagation(),n.preventDefault(),t)){var i=o.state,r=i.inputValue,a=i.values,s=vx(r);o.onListChange((a||[]).concat(s.values.map((function(e){return{value:e,isCheckable:!1,isRemovable:!0,group:o._translate("Predefined Values")}})))),o.setState({inputValue:""})}})),mx(d(o),"handleRemovePredifinedValuesClick",(function(e){e.stopPropagation(),o.removePredefinedValues()})),mx(d(o),"removePredefinedValues",(function(){o.setPredefinedValues(null)})),o._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling"),o._changeSupport=r.changeSupport;var a=o.getAllowedValuesTarget(),s=vx(a.inputValues&&a.inputValues.text||a.outputValues&&a.outputValues.text||"");return o.state=s?{values:s.values.map((function(e){return{value:e,isCheckable:!1,isRemovable:!0,group:o._translate("Predefined Values")}})),inputValue:""}:{values:null,inputValue:""},o}return o(n,[{key:"componentWillMount",value:function(){var e=this.getAllowedValuesTarget();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this.getAllowedValuesTarget();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}},{key:"getAllowedValuesTarget",value:function(){var e=this.getElement();return Ln(e,"dmn:LiteralExpression")?e.$parent:e}},{key:"getElement",value:function(){return this.props.context.output||this.props.context.input.inputExpression}},{key:"render",value:function(){var e=this,t=this.getElement(),n=this.state,i=n.inputValue,r=n.values;return"string"===t.typeRef?Gv(1,"div","context-menu-container allowed-values-edit",Gv(1,"div","dms-form-control",[!_x(r)&&r.length>0&&Kv(2,hx,{labelComponent:yx,items:r,onChange:this.onListChange}),!_x(r)&&!r.length&&Gv(1,"div",null,[Gv(1,"label","dms-label",this._translate("Predefined Values"),0),Gv(1,"span","placeholder",this._translate("No values"),0)],4),!_x(r)&&Gv(1,"p","dms-hint",Gv(1,"button","del-values",this._translate("Clear predefined values."),0,{type:"button",onClick:this.handleRemovePredifinedValuesClick}),2),Gv(1,"label","dms-label",this._translate("Add Predefined Values"),0),Kv(2,fx,{onInput:this.onInput,onKeyDown:this.onKeyDown,placeholder:this._translate('"value", "value", ...'),type:"text",validate:function(t){if(!vx(t))return e._translate("Strings must be in double quotes.")},value:i})],0),2):null}}]),n}(ug);function yx(e){return Gv(1,"label","dms-label",e,0)}function _x(e){return null===e}var bx=o((function e(t){i(this,e),t.onGetComponent("context-menu",500,(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.contextMenuType;if("input-edit"===t||"output-edit"===t)return gx}))}));bx.$inject=["components"];var xx={__init__:["allowedValuesUpdateBehavior","allowedValuesEditingProvider"],allowedValuesUpdateBehavior:["type",dx],allowedValuesEditingProvider:["type",bx]};function wx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Cx=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),wx(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),wx(d(o),"handleClick",(function(e){e.stopPropagation(),o.add()})),wx(d(o),"add",(function(){o._eventBus.fire("addInput")})),o._sheet=r.injector.get("sheet"),o._eventBus=r.injector.get("eventBus"),o._changeSupport=r.changeSupport,o._translate=r.injector.get("translate"),o}return o(n,[{key:"componentWillMount",value:function(){var e=this.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}},{key:"getRoot",value:function(){return this._sheet.getRoot()}},{key:"render",value:function(){return Gv(1,"div","add-input actionable",Gv(1,"span","dmn-icon-plus action-icon"),2,{onClick:this.handleClick,title:this._translate("Add Input")})}}]),n}(ug);function Ex(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var kx=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Ex(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),Ex(d(o),"handleClick",(function(e){e.stopPropagation(),o.add()})),Ex(d(o),"add",(function(){o._eventBus.fire("addOutput")})),o._sheet=r.injector.get("sheet"),o._eventBus=r.injector.get("eventBus"),o._changeSupport=r.changeSupport,o._translate=r.injector.get("translate"),o}return o(n,[{key:"componentWillMount",value:function(){var e=this.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}},{key:"getRoot",value:function(){return this._sheet.getRoot()}},{key:"render",value:function(){return Gv(1,"div","add-output actionable",Gv(1,"span","dmn-icon-plus action-icon"),2,{onClick:this.handleClick,title:this._translate("Add Output")})}}]),n}(ug);function Sx(e,t,n){e.onGetComponent("cell-inner",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.cellType,n=e.index,i=e.inputsLength,r=e.outputsLength;return"input-cell"===t&&n===i-1?Cx:"output-cell"===t&&n===r-1?kx:void 0})),n.on("addInput",(function(){t.trigger("addInput")})),n.on("addOutput",(function(){t.trigger("addOutput")}))}Sx.$inject=["components","editorActions","eventBus"];var jx={__depends__:[H_],__init__:["addInputOutputProvider"],addInputOutputProvider:["type",Sx]};function Ox(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Px=function(){function e(t,n,r,o){var a=this;i(this,e),Ox(this,"_init",(function(){a._registerDefaultBindings(),a._fire("init")})),Ox(this,"_destroy",(function(){a._fire("destroy"),a.unbind(),a._listeners=null})),Ox(this,"_keyHandler",(function(e){var t,n,i=a._listeners,r=e.keyCode||e.charCode||-1;for(t=0;n=i[t];t++)if(n(r,e))return e.preventDefault(),void e.stopPropagation()})),Ox(this,"unbind",(function(){var e=a._node;e&&(a._fire("unbind"),fn.unbind(e,"keydown",a._keyHandler,!0)),a._node=null})),this._config=t||{},this._editorActions=r,this._eventBus=n,this._cellSelection=o,this._listeners=[],n.on("table.destroy",this._destroy),n.on("table.init",this._init),n.on("attach",(function(){a._config.bindTo&&a.bind(t.bindTo)})),n.on("detach",this.unbind)}return o(e,[{key:"bind",value:function(e){this.unbind(),this._node=e,fn.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")}},{key:"getBinding",value:function(){return this._node}},{key:"_fire",value:function(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})}},{key:"_registerDefaultBindings",value:function(){var e=this._listeners,t=this._editorActions,n=this._cellSelection;e.push((function(e,n){if(gb(n)&&!yb(n)&&90===e)return t.trigger("undo"),!0})),e.push((function(e,n){if(gb(n)&&(89===e||90===e&&yb(n)))return t.trigger("redo"),!0})),e.push((function(e,n){if(13===e&&!gb(n)&&yb(n)&&d_(n.target))return t.trigger("selectCellAbove"),!0})),e.push((function(e,i){if(13===e&&!gb(i)&&!yb(i)&&d_(i.target)){var r=t.trigger("selectCellBelow"),o=n.getCellSelection();if(!r&&o&&"__decisionProperties_name"!==o){var a=t.trigger("addRule");return t.trigger("selectCellBelow"),a}return!0}}))}},{key:"addListener",value:function(e){this._listeners.unshift(e)}},{key:"removeListener",value:function(e){this._listeners=this._listeners.filter((function(t){return t!==e}))}}]),e}();Px.$inject=["config.keyboard","eventBus","editorActions","cellSelection"];var Dx={__depends__:[H_],__init__:["keyboard"],keyboard:["type",Px]},Rx={__depends__:[jx,xx,mb,sb,ly,Dx,lx],__init__:["inputEditingProvider","outputEditingProvider"],inputEditingProvider:["type",ix],outputEditingProvider:["type",qb]};function Tx(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mx=function(){function e(t,n,r,o){var a=this;i(this,e),Tx(this,"handleDragOver",(function(e){Ix(e);var t=un(e.target,".dmn-decision-table-container td,\n   .dmn-decision-table-container th",!0),n=!!t,i=a._dragContext.hoverEl;i&&i!==t&&(a._emit("dragAndDrop.dragLeave",e),a._dragContext.targetEl=null,a._dragContext.hoverEl=null),t&&(t!==i&&(a._dragContext.hoverEl=t,!1!==(n=a._emit("dragAndDrop.dragEnter",e))&&(a._dragContext.targetEl=t)),n=a._emit("dragAndDrop.dragOver",e)),e.dataTransfer.dropEffect=!1!==n?"move":"none"})),Tx(this,"handleDrop",(function(e){Ix(e);var t=a._emit("dragAndDrop.drop",e);if(t){var n=a._dragContext.draggedElement;if(n instanceof mv){var i=a._sheet.getRoot().rows.indexOf(t);a._modeling.moveRow(n,i)}else if(n instanceof gv){var r=a._sheet.getRoot().cols.indexOf(t);a._modeling.moveCol(n,r)}}a.handleDragEnd(e)})),Tx(this,"handleDragEnd",(function(e){Ix(e),a._unbindListeners(),a._emit("dragAndDrop.dragEnd",e),a._dragContext=null})),this._eventBus=t,this._renderer=n,this._modeling=r,this._sheet=o,this._dragContext=null,t.on("table.destroy",(function(){a._unbindListeners()}))}return o(e,[{key:"_bindListeners",value:function(){fn.bind(document,"dragover",this.handleDragOver),fn.bind(document,"drop",this.handleDrop),fn.bind(document,"dragend",this.handleDragEnd)}},{key:"_unbindListeners",value:function(){fn.unbind(document,"dragover",this.handleDragOver),fn.unbind(document,"drop",this.handleDrop),fn.unbind(document,"dragend",this.handleDragEnd)}},{key:"_emit",value:function(e,t){return this._eventBus.fire(e,{dragContext:this._dragContext,originalEvent:t})}},{key:"startDrag",value:function(e,t){Ix(t,!0),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData&&t.dataTransfer.setData("text","__DUMMY"),this._dragContext={draggedElement:e},this._bindListeners(),this._emit("dragAndDrop.dragStart",t)}}]),e}();function Ix(e,t){e.stopPropagation(),!0!==t&&e.preventDefault()}Mx.$inject=["eventBus","renderer","modeling","sheet"];var Ax={__init__:["dragAndDrop"],dragAndDrop:["type",Mx]};function Nx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Bx="top",Lx="left",$x=function(){function e(t,n,r,o,a,s,u){var c=this;i(this,e),Nx(this,"_cleanup",(function(){var e=c._renderer.getContainer();Fx(e),function(e){var t=Cn(".dragged",e);N(t,(function(e){Wx(e)&&rn(e).remove("dragged")}))}(e),c._dragImage&&(En(c._dragImage),c._dragImage=null)})),this._elementRegistry=n,this._dragAndDrop=o,this._renderer=a,this._rules=s,this._sheet=u,t.onGetComponent("cell-inner",(function(e){var t=e.cellType,n=e.col,i=e.row;if("rule-index"===t)return function(){return Gv(1,"span","dmn-icon-drag vertical",Xv(" "),2,{draggable:"true",onDragStart:function(e){return c.startDrag(i,e)},title:"Move rule"})};if("input-cell"===t||"output-cell"===t){var r="Move ".concat($n(n)?"Input":"Output");return function(){return Gv(1,"span","dmn-icon-drag horizontal",null,1,{draggable:"true",onDragStart:function(e){return c.startDrag(n,e)},title:r})}}})),r.on("dragAndDrop.dragEnter",(function(e){var t=e.dragContext,n=t.draggedElement,i=t.hoverEl;if(n instanceof mv)return!0;if(n instanceof gv){var r=function(e,t,n){var i=t.get(e.dataset.colId);if(!i)return-1;var r=n.getRoot();return r.cols.indexOf(i)}(i,c._elementRegistry,c._sheet);return-1!==r&&c._rules.allowed("col.move",{col:n,index:r})}return!1})),r.on("dragAndDrop.dragLeave",(function(e){e.dragContext.targetEl&&Fx(c._renderer.getContainer())})),r.on("dragAndDrop.dragOver",(function(e){var t,n=e.dragContext,i=e.originalEvent,r=n.draggedElement,o=n.lastPosition,a=n.targetEl,s=c._renderer.getContainer();return!!a&&(r instanceof mv&&(t=Hx(i,a)),r instanceof gv&&(t=Ux(i,a)),o===t||(Fx(s),r instanceof mv&&Vx(a,s,t===Bx?"top":"bottom"),r instanceof gv&&zx(a,s,t===Lx?"left":"right"),n.lastPosition=t),!0)})),r.on("dragAndDrop.drop",(function(e){var t=e.dragContext,n=e.originalEvent,i=t.draggedElement,r=t.targetEl;if(!r)return!1;if(i instanceof mv){var o=Hx(n,r),a=r.dataset.rowId,s=c._elementRegistry.get(a);if(!s||s===i)return;var u=function(e,t,n,i){i.indexOf(e)>i.indexOf(t)&&(t=function(e,t){var n=t.indexOf(e);return t[Math.min(t.length-1,n+1)]}(t,i));return n===Bx?function(e,t){var n=t.indexOf(e);return t[Math.max(0,n-1)]}(t,i):t}(i,s,o,c._sheet.getRoot().rows);if(u===i)return;return u}if(i instanceof gv){var l=Ux(n,r),d=r.dataset.colId,p=c._elementRegistry.get(d);if(!p||p===i)return;var h=function(e,t,n,i){i.indexOf(e)>i.indexOf(t)&&(t=function(e,t){var n=t.indexOf(e);if($n(e)){var i=t.filter((function(e){return $n(e)})),r=i[i.length-1],o=t.indexOf(r);return t[Math.min(o,n+1)]}return t[Math.min(t.length-1,n+1)]}(t,i));return n===Lx?function(e,t){var n=t.indexOf(e);if(Vn(e)){var i=t.filter((function(e){return Vn(e)}))[0],r=t.indexOf(i);return t[Math.max(r,n-1)]}return t[Math.max(0,n-1)]}(t,i):t}(i,p,l,c._sheet.getRoot().cols);if(h===i)return;return h}})),r.on("dragAndDrop.dragEnd",this._cleanup)}return o(e,[{key:"startDrag",value:function(e,t){var n=this._renderer.getContainer();this._dragImage=xn('<span style="\n          visibility: hidden;\n          position: fixed;\n          top: -10000px\n      "></span>'),document.body.appendChild(this._dragImage),t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(this._dragImage,0,0),e instanceof mv?function(e,t){var n=Cn("[data-row-id=".concat(e.id,"]"),t);N(n,(function(e){Wx(e)&&rn(e).add("dragged")}))}(e,n):e instanceof gv&&function(e,t){var n=Cn("[data-col-id=".concat(e.id,"]"),t);N(n,(function(e){Wx(e)&&rn(e).add("dragged")}))}(e,n),this._dragAndDrop.startDrag(e,t)}}]),e}();function Vx(e,t,n){var i=e.dataset.rowId;i&&N(Cn("[data-row-id=".concat(i,"]"),t),(function(e){Wx(e)&&(rn(e).add("dragover"),rn(e).add(n))}))}function zx(e,t,n){var i=e.dataset.colId;i&&N(Cn("[data-col-id=".concat(i,"]"),t),(function(e){Wx(e)&&(rn(e).add("dragover"),rn(e).add(n))}))}function Fx(e){N(Cn(".dragover",e),(function(e){Wx(e)&&(rn(e).remove("dragover"),rn(e).remove("top"),rn(e).remove("right"),rn(e).remove("bottom"),rn(e).remove("left"))}))}function Ux(e,t){var n=t.getBoundingClientRect();return e.clientX<n.left+n.width/2?Lx:"right"}function Hx(e,t){var n=t.getBoundingClientRect();return e.clientY<n.top+n.height/2?Bx:"bottom"}function Wx(e){return e&&(1===e.nodeType||11==e.nodeType)}$x.$inject=["components","elementRegistry","eventBus","dragAndDrop","renderer","rules","sheet"];var qx={__depends__:[Ax,b_],__init__:["dmnDragAndDrop"],dmnDragAndDrop:["type",$x]};function Gx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Kx=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),Gx(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),Gx(d(o),"changeDescription",(function(e){o._modeling.updateProperties(o._element,{description:e})})),o._elementRegistry=r.injector.get("elementRegistry"),o._modeling=r.injector.get("modeling"),o._changeSupport=o.context.changeSupport;var a=o.props.context.id;return o._element=o._elementRegistry.get(a),o}return o(n,[{key:"componentWillMount",value:function(){this._element&&this._changeSupport.onElementsChanged(this._element.id,this.onElementsChanged)}},{key:"componentDidMount",value:function(){this.props.context.autoFocus&&this.node&&wn(".content-editable",this.node).focus()}},{key:"componentWillUnmount",value:function(){if(this._element){this._changeSupport.offElementsChanged(this._element.id,this.onElementsChanged);var e=this._element.businessObject.description;T(e)&&!e.length&&this.changeDescription(null)}}},{key:"render",value:function(){var e=this;if(this._element){var t=this._element.businessObject.description;if(T(t))return Gv(1,"div","context-menu-container description-editor",Kv(2,Xx,{className:"dms-input",onChange:this.changeDescription,value:t}),2,null,null,(function(t){return e.node=t}))}}}]),n}(ug),Xx=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"render",value:function(){return Gv(1,"div",this.getClassName(),this.getEditor(),0)}}]),n}(tb);function Yx(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Zx=o((function e(t,n,r,o,a,s,u){var c=this;i(this,e);var l=this;Yx(this,"addDescription",(function(e){c._modeling.updateProperties(e,{description:""});var t=c._renderer.getContainer(),n=Qx(t,l_(e.id,t).getBoundingClientRect());c._contextMenu.open(n,{contextMenuType:"cell-description",id:e.id,autoFocus:!0,offset:{x:4,y:4}})})),Yx(this,"removeDescription",(function(e){c._modeling.updateProperties(e,{description:null}),c._contextMenu.close()})),this._contextMenu=n,this._modeling=a,this._renderer=s,this._translate=u,o.on("cell.click",750,(function(e){if(!e.defaultPrevented){var t=e.target,i=e.id,o=r.get(i);if(Fn(o,["dmn:UnaryTests","dmn:LiteralExpression"])){Jx(o)||e.preventDefault();var a=Qx(s.getContainer(),t.getBoundingClientRect());n.open(a,{contextMenuType:"cell-description",autoFocus:!1,id:i,offset:{x:4,y:4}})}}})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"cell-description"===e.contextMenuType){var t=r.get(e.id),n=Jx(t);if(T(n))return Kx}})),t.onGetComponent("context-menu-cell-additional",500,(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"context-menu"===e.contextMenuType){var t=e.id;if(!t)return;var n=r.get(t);if(!n)return;var i=n.businessObject,o=i.description,a=T(o),s=a?"remove-description":"add-description",u=a?function(){return l.removeDescription(n)}:function(){return l.addDescription(n)};return Gv(1,"div","context-menu-group-entry ".concat(s),T(o)?l._translate("Remove Cell Description"):l._translate("Add Cell Description"),0,{onClick:u})}}))}));function Qx(e,t){var n=t.top,i=t.left,r=t.width,o=t.height;return{x:i+e.parentNode.scrollLeft-26,y:n+e.parentNode.scrollTop,width:r+52,height:o}}function Jx(e){return e&&e.businessObject&&e.businessObject.description}Zx.$inject=["components","contextMenu","elementRegistry","eventBus","modeling","renderer","translate"];var ew={__depends__:[mb,Fy],__init__:["description"],description:["type",Zx]},tw=function(){function e(t,n,r,o,a,s){i(this,e);var u=this;this._modeling=r,this._translate=a,this._expressionLanguages=o,t.onGetComponent("context-menu-cell-additional",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"context-menu"===e.contextMenuType){var t=e.event,i=e.id;if(!i)return;var r=n.get(i);if(!r)return;if(!u._shouldDisplayContextMenuEntry(r))return;var o=function(e){s.open({x:(t||e).pageX,y:(t||e).pageY},{contextMenuType:"expression-language",id:i})};return Gv(1,"div","context-menu-group-entry",u._translate("Change Cell Expression Language"),0,{onClick:o})}})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"expression-language"===e.contextMenuType){var t=e.id;if(!t)return;var i=n.get(t);if(!i)return;var r=u._getElementExpressionLanguage(i),a=o.getAll(),s="context-menu-group-entry context-menu-entry-set-expression-language";return function(){return Gv(1,"div","context-menu-flex",Gv(1,"div","context-menu-group",Gv(1,"div",s,[Gv(1,"div",null,u._translate("Expression Language"),0),Kv(2,ox,{className:"expression-language",onChange:function(e){return u.onChange(i,e)},options:a,value:r})],4),2),2)}}})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("input-edit"===e.contextMenuType)return function(){var t=e.input.inputExpression;if(u._shouldDisplayContextMenuEntry(t)){var n=u._getElementExpressionLanguage(t),i=o.getAll();return Gv(1,"div","context-menu-container ref-language",Gv(1,"div","dms-form-control",[Gv(1,"label","dms-label",u._translate("Expression Language"),0),Kv(2,ox,{className:"ref-language",value:n||"",onChange:function(e){return u.onChange(t,e)},options:i})],4),2)}}}))}return o(e,[{key:"onChange",value:function(e,t){this._modeling.editExpressionLanguage(e,t)}},{key:"_shouldDisplayContextMenuEntry",value:function(e){return this._expressionLanguages.getAll().length>1||this._getElementExpressionLanguage(e)!==this._getDefaultElementExpressionLanguage(e)}},{key:"_getElementExpressionLanguage",value:function(e){return zn(e).expressionLanguage||this._getDefaultElementExpressionLanguage(e)}},{key:"_getDefaultElementExpressionLanguage",value:function(e){return this._expressionLanguages.getDefault($n(e.col)?"inputCell":"outputCell").value}}]),e}();tw.$inject=["components","elementRegistry","modeling","expressionLanguages","translate","contextMenu"];var nw={__depends__:[ly],__init__:["expressionLanguage"],expressionLanguage:["type",tw]};function iw(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var rw=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),iw(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),iw(d(o),"setDecisionTableName",(function(e){o.modeling.editDecisionTableName(e)})),Sg(d(o)),o}return o(n,[{key:"componentWillMount",value:function(){this.setupChangeListeners({bind:this.getBusinessObject().id})}},{key:"componentWillUnmount",value:function(){this.setupChangeListeners({unbind:this.getBusinessObject().id})}},{key:"setupChangeListeners",value:function(e){var t=e.bind,n=e.unbind;"string"==typeof n&&this.changeSupport.offElementsChanged(n,this.onElementsChanged),"string"==typeof t&&this.changeSupport.onElementsChanged(t,this.onElementsChanged)}},{key:"getBusinessObject",value:function(){return this.sheet.getRoot().businessObject.$parent}},{key:"render",value:function(){var e=this.getBusinessObject().name,t=this.components.getComponent("hit-policy")||aw;return Gv(1,"div","decision-table-properties",[Kv(2,ow,{className:"decision-table-name",value:e,ctrlForNewline:!0,onBlur:sw,onChange:this.setDecisionTableName,elementId:"__decisionProperties_name",coords:"0:__decisionProperties"}),Gv(1,"div","decision-table-header-separator"),Kv(2,t)],4)}}]),n}(ug);rw.$inject=["sheet","modeling","changeSupport","components"];var ow=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),Og(d(o),Dg),o}return o(n,[{key:"render",value:function(){var e=this.props.value;return Gv(1,"div",kg(this.getSelectionClasses(),this.getClassName()),this.getEditor(),0,{"data-element-id":this.props.elementId,"data-coords":this.props.coords,title:this._translate("Decision Name: ")+e})}}]),n}(tb);function aw(){return null}function sw(e){e.target.scroll(0,0)}var uw=o((function e(t){i(this,e),t.onGetComponent("table.before",500,(function(){return rw}))}));uw.$inject=["components"];var cw={__depends__:[sb],__init__:["decisionTableProperties"],decisionTableProperties:["type",uw]};function lw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function dw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lw(Object(n),!0).forEach((function(t){pw(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lw(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pw(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var hw=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),pw(d(o=t.call(this,e,r)),"onChange",(function(e){var t=e.aggregation,n=e.hitPolicy;o.modeling.editHitPolicy(n,t)})),pw(d(o),"onElementsChanged",(function(){o.forceUpdate()})),o._translate=r.injector.get("translate"),Sg(d(o)),o}return o(n,[{key:"componentDidMount",value:function(){this.changeSupport.onElementsChanged(this.getRoot().id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){this.changeSupport.offElementsChanged(this.getRoot().id,this.onElementsChanged)}},{key:"getRoot",value:function(){return this.sheet.getRoot()}},{key:"render",value:function(){var e=this,t=this.getRoot().businessObject,n=t.aggregation,i=t.hitPolicy,r=I(my,(function(e){return function(e,t){return e.hitPolicy===t.hitPolicy&&e.aggregation===t.aggregation}(e.value,{aggregation:n,hitPolicy:i})}));return Gv(1,"div","hit-policy",[Gv(1,"label","dms-label",this._translate("Hit Policy:"),0),Kv(2,ox,{className:"hit-policy-edit-policy-select",onChange:this.onChange,options:my.map((function(t){return dw(dw({},t),{},{label:e._translate(t.label)})})),value:r.value,"data-hit-policy":"true",noInput:!0})],4,{title:this._translate(r.explanation)})}}]),n}(ug);function fw(e){e.onGetComponent("hit-policy",(function(){return hw}))}hw.$inject=["changeSupport","sheet","modeling"],fw.$inject=["components"];var vw={__depends__:[mb],__init__:["hitPolicyProvider"],hitPolicyProvider:["type",fw]},mw=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e)).executed(["row.add","row.remove","col.add","col.remove"],gw((function(e){var t=e.context,n=t.row||t.col;o.updateRoot(n,t.oldRoot)}))),o.reverted(["row.add","row.remove","col.add","col.remove"],gw((function(e){var t=e.context,n=t.row||t.col;o.updateRoot(n,t.newRoot)}))),o}return o(n,[{key:"updateRoot",value:function(e,t){var n=this,i=e.root,r=e.businessObject;if(Ln(e,"dmn:DecisionRule")){if(t){var o=t.businessObject.get("rule"),a=o.indexOf(r);o.splice(a,1),r.$parent=null}if(i){var s=i.businessObject,u=i.rows.indexOf(e);s.get("rule").splice(u,0,r),r.$parent=s,e.cells.forEach((function(t,i){n.wireCell(t,e,i)}))}}if(Ln(e,"dmn:InputClause")||Ln(e,"dmn:OutputClause")){var c,l;if(t){var d=t.businessObject,p=d.get("input"),h=d.get("output");if(Ln(e,"dmn:InputClause")&&(c=p,l=p.indexOf(r)),Ln(e,"dmn:OutputClause")&&(c=h,l=h.indexOf(r)),-1===l)throw new Error("inconsistent model: clause not in table");c.splice(l,1),r.$parent=null,e.cells.forEach((function(e,i){n.unwireCell(e,t.rows[i])}))}if(i){var f,v,m=i.businessObject,g=m.get("input"),y=m.get("output"),_=i.cols.indexOf(e);Ln(e,"dmn:InputClause")&&(v=g,f=_),Ln(e,"dmn:OutputClause")&&(v=y,f=_-g.length),v.splice(f,0,r),r.$parent=m,e.cells.forEach((function(e,t){n.wireCell(e,i.rows[t],_)}))}}}},{key:"unwireCell",value:function(e,t){var n,i,r=e.businessObject,o=t.businessObject,a=o.get("inputEntry"),s=o.get("outputEntry");if(Ln(e,"dmn:UnaryTests")&&(n=a),Ln(e,"dmn:LiteralExpression")&&(n=s),-1===(i=n.indexOf(r)))throw new Error("cell not in row");n.splice(i,1),r.$parent=null}},{key:"wireCell",value:function(e,t,n){var i,r,o=e.businessObject,a=t.businessObject,s=a.get("inputEntry"),u=a.get("outputEntry");o.$parent!==a&&(Ln(e,"dmn:UnaryTests")&&(i=s,r=n),Ln(e,"dmn:LiteralExpression")&&(i=u,r=n-s.length),i.splice(r,0,o),o.$parent=a)}}]),n}(Kd);function gw(e){return function(t){var n=t.context;Ln(n.row||n.col,"dmn:DMNElement")&&e(t)}}mw.$inject=["eventBus","sheet"];var yw=function(){function e(t){i(this,e),this._model=t}return o(e,[{key:"create",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this._model.create(e,t||{});return Ln(n,"dmn:InputClause")&&(t.inputExpression?n.inputExpression=t.inputExpression:(n.inputExpression=this.create("dmn:LiteralExpression",{typeRef:"string"}),n.inputExpression.$parent=n)),Ln(n,"dmn:OutputClause")&&(n.typeRef=t.typeRef||"string"),(Ln(n,"dmn:UnaryTests")||Ln(n,"dmn:LiteralExpression"))&&(n.text=t.text||""),this._ensureId(n),n}},{key:"_needsId",value:function(e){return Ln(e,"dmn:DMNElement")}},{key:"_ensureId",value:function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))}}]),e}();yw.$inject=["moddle"];var _w=["businessObject","type"];function bw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function xw(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ww(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var Cw=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),(r=t.call(this))._dmnFactory=e,r}return o(n,[{key:"create",value:function(e,t){var i=this._dmnFactory,r=t.businessObject,o=t.type,a=ww(t,_w);if(!r){if(!o){if("root"===e)o="dmn:DecisionTable";else if("cell"===e){var s=a.col;Ln(s,"dmn:OutputClause")&&(o="dmn:LiteralExpression"),Ln(s,"dmn:InputClause")&&(o="dmn:UnaryTests")}if(!o)throw new Error("cannot guess <type>")}r=i.create(o)}return v(u(n.prototype),"create",this).call(this,e,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bw(Object(n),!0).forEach((function(t){xw(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bw(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({businessObject:r,id:r.id},a))}}]),n}(wv);Cw.$inject=["dmnFactory"];var Ew=function(){function e(t,n){i(this,e),this._sheet=t,this._elementFactory=n}return o(e,[{key:"execute",value:function(e){var t=this._sheet,n=this._elementFactory,i=t.getRoot(),r=e.row,o=e.index;return void 0===o&&(o=e.index=i.rows.length),e.newRoot=i,r.cells.length||i.cols.forEach((function(e,t){var i=n.create("cell",{row:r,col:e});r.cells[t]=i})),t.addRow(r,o),t.getRoot()}},{key:"revert",value:function(e){var t=e.row,n=this._sheet;return n.removeRow(t),n.getRoot()}}]),e}();Ew.$inject=["sheet","elementFactory"];var kw=function(){function e(t){i(this,e),this._sheet=t}return o(e,[{key:"execute",value:function(e){var t=this._sheet,n=t.getRoot(),i=e.row,r=e.oldIndex=n.rows.indexOf(i);if(e.oldRoot=i.root,-1===r)throw new Error("row#".concat(i.id," not in sheet"));return t.removeRow(i),t.getRoot()}},{key:"revert",value:function(e){var t=e.row,n=e.oldIndex,i=this._sheet;return i.addRow(t,n),i.getRoot()}}]),e}();kw.$inject=["sheet"];var Sw=function(){function e(t){i(this,e),this._modeling=t}return o(e,[{key:"preExecute",value:function(e){var t=e.row;this._modeling.removeRow(t)}},{key:"postExecute",value:function(e){var t=e.row,n=e.index;this._modeling.addRow(t,n)}}]),e}();Sw.$inject=["modeling"];var jw=function(){function e(t,n){i(this,e),this._sheet=t,this._elementFactory=n}return o(e,[{key:"execute",value:function(e){var t=this._sheet,n=this._elementFactory,i=t.getRoot(),r=e.col,o=e.index;return void 0===o&&(o=e.index=i.cols.length),e.newRoot=i,r.cells.length||i.rows.forEach((function(e,t){var i=n.create("cell",{row:e,col:r});r.cells[t]=i})),t.addCol(r,o),t.getRoot()}},{key:"revert",value:function(e){var t=e.col,n=this._sheet;return n.removeCol(t),n.getRoot()}}]),e}();jw.$inject=["sheet","elementFactory"];var Ow=function(){function e(t,n){i(this,e),this._sheet=t,this._elementFactory=n}return o(e,[{key:"execute",value:function(e){var t=this._sheet,n=e.col,i=e.oldRoot=n.root;if(-1===(e.oldIndex=i.cols.indexOf(n)))throw new Error("col#".concat(n.id," not in sheet"));return t.removeCol(n),t.getRoot()}},{key:"revert",value:function(e){var t=e.col,n=e.oldIndex,i=this._sheet;return i.addCol(t,n),i.getRoot()}}]),e}();Ow.$inject=["sheet","elementFactory"];var Pw=function(){function e(t){i(this,e),this._modeling=t}return o(e,[{key:"preExecute",value:function(e){var t=e.col;this._modeling.removeCol(t)}},{key:"postExecute",value:function(e){var t=e.col,n=e.index;this._modeling.addCol(t,n)}}]),e}();Pw.$inject=["modeling"];var Dw=function(){function e(){i(this,e)}return o(e,[{key:"execute",value:function(e){return e.cell}},{key:"revert",value:function(e){return e.cell}}]),e}(),Rw=function(){function e(t,n,r){var o=this;i(this,e),this._eventBus=t,this._elementFactory=n,this._commandStack=r,t.on("table.init",(function(){!function(e,t){N(e,(function(e,n){t.registerHandler(n,e)}))}(o.getHandlers(),r)}))}return o(e,[{key:"getHandlers",value:function(){return e._getHandlers()}},{key:"_create",value:function(e,t){return t instanceof fv?t:this._elementFactory.create(e,t)}},{key:"addRow",value:function(e,t){var n=this._create("row",e),i={row:n,index:t};return this._commandStack.execute("row.add",i),n}},{key:"removeRow",value:function(e){this._commandStack.execute("row.remove",{row:e})}},{key:"moveRow",value:function(e,t){var n={row:e,index:t};this._commandStack.execute("row.move",n)}},{key:"addCol",value:function(e,t){var n=this._create("col",e),i={col:n,index:t};return this._commandStack.execute("col.add",i),n}},{key:"removeCol",value:function(e){this._commandStack.execute("col.remove",{col:e})}},{key:"moveCol",value:function(e,t){var n={col:e,index:t};this._commandStack.execute("col.move",n)}},{key:"editCell",value:function(e,n){var i=t({cell:e},n);this._commandStack.execute("cell.edit",i)}}],[{key:"_getHandlers",value:function(){return{"row.add":Ew,"row.remove":kw,"row.move":Sw,"col.add":jw,"col.remove":Ow,"col.move":Pw,"cell.edit":Dw}}}]),e}();Rw.$inject=["eventBus","elementFactory","commandStack"];var Tw=function(){function e(t,n,r){i(this,e),this._dmnFactory=t,this._moddle=n,this._modeling=r}return o(e,[{key:"execute",value:function(e){var t=e.element,n=e.allowedValues;return Ln(t,"dmn:InputClause")?(t.inputValues?e.oldAllowedValues=t.inputValues.text:Mw(n)||(t.inputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),Mw(n)?t.inputValues&&delete t.inputValues:t.inputValues.text=n.join(",")):(t.outputValues&&t?e.oldAllowedValues=t.outputValues.text:Mw(n)||(t.outputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),Mw(n)?t.outputValues&&delete t.outputValues:t.outputValues.text=n.join(",")),t}},{key:"revert",value:function(e){var t=e.element,n=e.oldAllowedValues;return Ln(t,"dmn:InputClause")?n?(t.inputValues||(t.inputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),t.inputValues.text=n):delete t.inputValues:n?(t.outputValues||(t.outputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),t.outputValues.text=n):delete t.outputValues,t}}]),e}();function Mw(e){return null===e}function Iw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Aw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Iw(Object(n),!0).forEach((function(t){Nw(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iw(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nw(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Tw.$inject=["dmnFactory","moddle","modeling"];var Bw="id",Lw=function(){function e(t,n){i(this,e),this._elementRegistry=t,this._moddle=n}return o(e,[{key:"execute",value:function(e){var t=e.element,n=e.properties,i=zn(t),r=this.updateProperties(i,n),o=r.changed,a=r.oldProperties;return e.oldProperties=a,[].concat(y(o),[t])}},{key:"revert",value:function(e){var t=e.element,n=e.oldProperties,i=zn(t),r=this.updateProperties(i,n).changed;return[].concat(y(r),[t])}},{key:"updateProperties",value:function(e,t){var n=this,i=this._moddle.ids;return B(t,(function(t,r,o){var s,u=e.get(o);if($w(r)){if(!$w(u))throw new Error("non-existing property <".concat(o,">: cannot update values"));var c=n.updateProperties(u,r),l=c.changed,d=c.oldProperties;return{changed:[].concat(y(t.changed),y(l),[u]),oldProperties:Aw(Aw({},t.oldProperties),{},a({},o,d))}}return o===Bw&&(s=r,e[Bw]!==s)&&(i.unclaim(e[Bw]),n._elementRegistry.updateId(e,r),i.claim(r,e)),e.set(o,r),{changed:t.changed,oldProperties:Aw(Aw({},t.oldProperties),{},a({},o,u))}}),{changed:[],oldProperties:{}})}}]),e}();function $w(e){return S(e)&&P(e)}Lw.$inject=["elementRegistry","moddle"];var Vw=function(){function e(t){i(this,e),this._moddle=t}return o(e,[{key:"execute",value:function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)}},{key:"revert",value:function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)}}]),e}();Vw.$inject=["moddle"];var zw=function(e){s(n,e);var t=h(n);function n(e,r,o,a){var s;return i(this,n),(s=t.call(this,e,r,o))._eventBus=e,s._elementFactory=r,s._commandStack=o,s._sheet=a,s}return o(n,[{key:"getHandlers",value:function(){return n._getHandlers()}},{key:"editDecisionTableName",value:function(e){var t={element:this._sheet.getRoot().businessObject.$parent,properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}},{key:"editDecisionTableId",value:function(e){var t={element:this._sheet.getRoot().businessObject.$parent,properties:{id:e}};this._commandStack.execute("element.updateProperties",t)}},{key:"editHitPolicy",value:function(e,t){var n={element:this._sheet.getRoot().businessObject,properties:{hitPolicy:e,aggregation:t}};this._commandStack.execute("element.updateProperties",n)}},{key:"updateProperties",value:function(e,t){var n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}},{key:"editInputExpression",value:function(e,t){var n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}},{key:"editOutputName",value:function(e,t){var n={element:e,properties:{name:t}};this._commandStack.execute("element.updateProperties",n)}},{key:"editInputExpressionTypeRef",value:function(e,t){var n={element:e,properties:{typeRef:t}};this._commandStack.execute("element.updateProperties",n)}},{key:"editOutputTypeRef",value:function(e,t){var n={element:e,properties:{typeRef:t}};this._commandStack.execute("element.updateProperties",n)}},{key:"editCell",value:function(e,t){var n={element:e,properties:{text:t}};this._commandStack.execute("element.updateProperties",n)}},{key:"editAnnotation",value:function(e,t){var n={element:e,properties:{description:t}};this._commandStack.execute("element.updateProperties",n)}},{key:"editAllowedValues",value:function(e,t){var n={element:e,allowedValues:t};this._commandStack.execute("editAllowedValues",n)}},{key:"editExpressionLanguage",value:function(e,t){var n={element:e,properties:{expressionLanguage:t}};this._commandStack.execute("element.updateProperties",n)}},{key:"claimId",value:function(e,t){var n={id:e,element:t,claiming:!0};this._commandStack.execute("id.updateClaim",n)}},{key:"unclaimId",value:function(e,t){var n={id:e,element:t};this._commandStack.execute("id.updateClaim",n)}}],[{key:"_getHandlers",value:function(){return J({},v(u(n),"_getHandlers",this).call(this),{editAllowedValues:Tw,"element.updateProperties":Lw,"id.updateClaim":Vw})}}]),n}(Rw);zw.$inject=["eventBus","elementFactory","commandStack","sheet"];var Fw=function(e){s(n,e);var t=h(n);function n(e,r,o){var a;return i(this,n),(a=t.call(this,e))._ids=r.ids,a._modeling=o,a.preExecute(["row.add","col.add"],(function(e){var t=e.context,n=t.row||t.col;a.claimId(n.businessObject),n.cells&&n.cells.forEach((function(e){return a.claimId(e.businessObject)}))})),a}return o(n,[{key:"claimId",value:function(e){var t=this;e.id&&!this._ids.assigned(e.id)&&this._modeling.claimId(e.id,e),e.$descriptor.properties.forEach((function(n){var i=e[n.name];i&&(O(i)&&i.forEach((function(e){return t.claimId(e)})),i.$type&&t.claimId(i))}))}}]),n}(Kd);Fw.$inject=["eventBus","moddle","modeling"];var Uw=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e))._modeling=r,o.preExecute(["row.remove","col.remove"],(function(e){var t=e.context,n=t.row||t.col;o.unclaimId(n.businessObject),n.cells&&n.cells.forEach((function(e){return o.unclaimId(e.businessObject)}))})),o}return o(n,[{key:"unclaimId",value:function(e){var t=this;e.id&&this._modeling.unclaimId(e.id,e),e.$descriptor.properties.forEach((function(n){var i=e[n.name];i&&(O(i)&&i.forEach((function(e){return t.unclaimId(e)})),i.$type&&t.unclaimId(i))}))}}]),n}(Kd);Uw.$inject=["eventBus","modeling"];var Hw={__init__:["dmnUpdater","idChangeBehavior","modeling"],__depends__:[{__init__:["idClaimBehavior","idUnclaimBehavior"],idClaimBehavior:["type",Fw],idUnclaimBehavior:["type",Uw]},gp],dmnUpdater:["type",mw],dmnFactory:["type",yw],elementFactory:["type",Cw],idChangeBehavior:["type",Bp],modeling:["type",zw]},Ww=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r)).state={isFocussed:!1},o.changeCellValue=o.changeCellValue.bind(d(o)),o.onFocus=o.onFocus.bind(d(o)),o.onBlur=o.onBlur.bind(d(o)),o.onElementsChanged=o.onElementsChanged.bind(d(o)),o}return o(n,[{key:"onElementsChanged",value:function(){this.forceUpdate()}},{key:"componentWillMount",value:function(){var e=this.context.injector,t=this.props.cell,n=this._changeSupport=this.context.changeSupport;this._modeling=e.get("modeling"),n.onElementsChanged(t.id,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this.props.cell;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}},{key:"changeCellValue",value:function(e){var t=this.props.cell;this._modeling.editCell(t.businessObject,e)}},{key:"onFocus",value:function(){this.setState({isFocussed:!0})}},{key:"onBlur",value:function(){this.setState({isFocussed:!1})}},{key:"render",value:function(){var e=this.props,t=e.cell,n=e.rowIndex,i=e.row,r=e.col,o=e.colIndex,a=this.state.isFocussed,s=Ln(t,"dmn:UnaryTests"),u=t.businessObject;return Kv(2,Mg,{className:s?"input-cell":"output-cell",elementId:t.id,coords:"".concat(n,":").concat(o),"data-row-id":i.id,"data-col-id":r.id,children:Kv(2,qw,{className:"cell-editor",placeholder:s?"-":"",ctrlForNewline:!0,onFocus:this.onFocus,onBlur:this.onBlur,isFocussed:a,onChange:this.changeCellValue,value:u.text,businessObject:u})})}}]),n}(ug),qw=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._expressionLanguages=r.injector.get("expressionLanguages"),o._translate=r.injector.get("translate"),o}return o(n,[{key:"isDefaultExpressionLanguage",value:function(e){var t=e.expressionLanguage,n=this.getDefaultExpressionLanguage(e).value;return!t||t===n}},{key:"getDescription",value:function(e){return e.description}},{key:"getExpressionLanguageLabel",value:function(e){var t=e.expressionLanguage,n=this.getDefaultExpressionLanguage(e);return this._expressionLanguages.getLabel(t)||n.label}},{key:"isScript",value:function(e){var t=this.getDefaultExpressionLanguage(e);return!!Ln(e,"dmn:UnaryTests")&&(-1!==e.text.indexOf("\n")||e.expressionLanguage&&e.expressionLanguage!==t)}},{key:"getDefaultExpressionLanguage",value:function(e){var t=Ln(e,"dmn:UnaryTests")?"inputCell":"outputCell";return this._expressionLanguages.getDefault(t)}},{key:"render",value:function(){var e=this.props,t=e.businessObject,n=e.isFocussed,i=this.getDescription(t),r=this.isDefaultExpressionLanguage(t),o=this.getExpressionLanguageLabel(t),a=this.isScript(t);return Gv(1,"div",this.getClassName(),[T(i)&&!n&&Gv(1,"div","description-indicator"),this.getEditor({className:a?"script-editor":null}),!r&&!n&&Gv(1,"span","dms-badge dmn-expression-language",[Gv(1,"span","dms-badge-icon dmn-icon-file-code"),Gv(1,"span","dms-badge-label",o,0)],4,{title:this._translate("Expression Language = {expressionLanguageLabel}",{expressionLanguageLabel:o})})],0)}}]),n}(tb),Gw=o((function e(t){i(this,e),t.onGetComponent("cell",1500,(function(e){if("rule"===e.cellType)return Ww}))}));Gw.$inject=["components"];var Kw={__depends__:[sb,vy],__init__:["decisionRulesEditor"],decisionRulesEditor:["type",Gw]};function Xw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Yw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xw(Object(n),!0).forEach((function(t){Zw(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xw(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zw(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Qw=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o.state={top:0,left:0,isVisible:!1,isDisabled:!1,selection:null},Sg(d(o));var a=o.debounceInput;return o.onClick=o.onClick.bind(d(o)),o.handleSelectionChanged=o.handleSelectionChanged.bind(d(o)),o.hideAndShowDebounced=o.hideAndShowDebounced.bind(d(o)),o.showDebounced=a(o.showDebounced.bind(d(o))),o.updatePosition=o.updatePosition.bind(d(o)),o}return o(n,[{key:"componentDidMount",value:function(){var e=this.eventBus;e.on("cellSelection.changed",this.handleSelectionChanged),e.on("commandStack.changed",this.updatePosition),e.on("sheet.scroll",this.hideAndShowDebounced)}},{key:"componentWillUnmount",value:function(){var e=this.eventBus;e.off("cellSelection.changed",this.handleSelectionChanged),e.off("commandStack.changed",this.updatePosition),e.off("sheet.scroll",this.hideAndShowDebounced)}},{key:"hideAndShowDebounced",value:function(){this.state.isVisible&&(this.hide(),this.showDebounced())}},{key:"showDebounced",value:function(){this.show()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState(Yw(Yw({},e),{},{isVisible:!1}))}},{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState(Yw(Yw({},e),{},{isVisible:!0})),this.updatePosition()}},{key:"handleSelectionChanged",value:function(e){var t=e.elementId,n=this.elementRegistry,i=this.expressionLanguages,r=this.simpleMode,o=n.get(t);if(o&&r.canSimpleEdit(o)){var a=!function(e,t,n){return!t||t===function(e,t){if($n(e.col))return t.getDefault("inputCell").value;if(Vn(e.col))return t.getDefault("outputCell").value}(e,n)}(o,o.businessObject.expressionLanguage,i);this.show({isDisabled:a,selection:o})}else this.hide({isDisabled:!1,selection:null})}},{key:"updatePosition",value:function(){var e=this.state.selection,t=this.node;if(e&&t){var n=this.renderer.getContainer(),i=n.getBoundingClientRect(),r=l_(e.id,n).getBoundingClientRect(),o=this.node.getBoundingClientRect(),a=function(e){var t=un(e,".tjs-table-container");if(!t)return{scrollTop:0,scrollLeft:0};var n=t.scrollLeft,i=t.scrollTop;return{scrollTop:i,scrollLeft:n}}(t),s=a.scrollLeft,u=a.scrollTop,c={};r.left+r.width/2>i.width/2?(c.left=-i.left+r.left-o.width+4+s+"px",t.classList.remove("right"),t.classList.add("left")):(c.left=-i.left+r.left+r.width-4+s+"px",t.classList.remove("left"),t.classList.add("right")),r.top+r.height/2>i.height/2?(c.top=-i.top+r.top-o.height+4+u+"px",t.classList.remove("top"),t.classList.add("bottom")):(c.top=-i.top+r.top-4+u+"px",t.classList.remove("bottom"),t.classList.add("top")),J(this.node.style,c)}}},{key:"onClick",value:function(){var e=this.eventBus;if(!this.state.isDisabled){var t=this.selection.get();t&&(e.fire("simpleMode.open",{element:t,node:l_(t.id,this._container)}),this.hide())}}},{key:"render",value:function(){var e=this,t=this.state,n=t.isDisabled,i=t.isVisible,r=t.top,o=t.left,a=["simple-mode-button","no-deselect"];return n&&a.push("disabled"),i?Gv(1,"div",a.join(" "),Gv(1,"span","dmn-icon-edit"),2,{onClick:this.onClick,style:{top:r,left:o},title:n?this._translate("Editing not supported for set expression language"):this._translate("Edit")},null,(function(t){return e.node=t})):null}}]),n}(ug);Qw.$inject=["debounceInput","elementRegistry","eventBus","expressionLanguages","renderer","selection","simpleMode"];var Jw=function(){function e(t,n,r,o,a){i(this,e),this._providers=[],t.onGetComponent("table.before",(function(){return Qw})),o.on("simpleMode.open",(function(e){var t=e.element,i=e.node.getBoundingClientRect(),r=i.left,o=i.top,s=i.width,u=i.height,c=a.getContainer();n.open({x:r+c.parentNode.scrollLeft,y:o+c.parentNode.scrollTop,width:s,height:u},{contextMenuType:"simple-mode-edit",element:t,offset:{x:4,y:4}})})),o.on("cell.click",(function(e){var t=e.event,n=e.node,i=e.id;if(function(e){if(e.altKey)return!1;return e.ctrlKey||e.metaKey}(t)){var a=r.get(i);a&&o.fire("simpleMode.open",{node:n,element:a}),e.preventDefault()}}))}return o(e,[{key:"registerProvider",value:function(e){this._providers.push(e)}},{key:"canSimpleEdit",value:function(e){return this._providers.reduce((function(t,n){return t||n(e)}),!1)}}]),e}();Jw.$inject=["components","contextMenu","elementRegistry","eventBus","renderer"];var eC={__depends__:[mb,v_,ly],__init__:["simpleMode"],simpleMode:["type",Jw]};var tC="none",nC=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a,s=o.props.context.element,u=!(a=s.businessObject.text)||function(e){return""===e}(a)?"none":"true"===a.trim()?"true":"false"===a.trim()?"false":void 0;return o.state={value:u||tC},o.editCell=o.editCell.bind(d(o)),o.onChange=o.onChange.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onChange",value:function(e){var t=this.props.context.element;this.editCell(t.businessObject,e===tC?"":e),this.setState({value:e})}},{key:"render",value:function(){var e=this.state.value,t=[{label:"-",value:tC},{label:this._translate("Yes"),value:"true"},{label:this._translate("No"),value:"false"}];return Gv(1,"div","simple-boolean-edit context-menu-container",[Gv(1,"h3","dms-heading",this._translate("Edit Boolean"),0),Gv(1,"h4","dms-heading",this._translate("Set Value"),0),Kv(2,ox,{noInput:!0,className:"dms-block",onChange:this.onChange,options:t,value:e})],4)}}]),n}(ug),iC=o((function e(t,n){i(this,e),n.registerProvider((function(e){return($n(e.col)||Vn(e.col))&&"boolean"===rC(e)})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;var t=rC(e.element);if("boolean"===t)return nC}}))}));function rC(e){return $n(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}iC.$inject=["components","simpleMode"];var oC={__depends__:[Dx,eC],__init__:["simpleBooleanEdit"],simpleBooleanEdit:["type",iC]},aC=/^\d{4}(?:-\d\d){2}$/,sC=/^\[date\("([^"]*)"\)..date\("([^"]*)"\)\]$/,uC=/^(<|>)\s*date\("([^"]*)"\)$/,cC=/^date\("([^"]*)"\)$/;function lC(e){if(!aC.test(e.trim()))return"Date must match pattern yyyy-MM-dd."}function dC(e,t){return"exact"===e?'date("'.concat(t[0],'")'):"before"===e?'< date("'.concat(t[0],'")'):"after"===e?'> date("'.concat(t[0],'")'):"between"===e?'[date("'.concat(t[0],'")..date("').concat(t[1],'")]'):void 0}function pC(){var e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().slice(0,10)}function hC(e){if(!e||""===e.trim())return{type:"exact",date:""};var t=e.match(sC);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(uC))?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(cC))?{type:"exact",date:t[1]}:void 0}var fC="exact",vC="between",mC=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a,s=hC(o.props.context.element.businessObject.text);s?(a=s.date?[s.date,""]:s.dates?s.dates:["",""],o.state={type:s.type,dates:a}):o.state={type:fC,dates:["",""]};var u=r.injector.get("debounceInput");return o.debouncedEditCell=u(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onTypeChange=o.onTypeChange.bind(d(o)),o.onSetStartDateTodayClick=o.onSetStartDateTodayClick.bind(d(o)),o.onSetEndDateTodayClick=o.onSetEndDateTodayClick.bind(d(o)),o.onStartDateInput=o.onStartDateInput.bind(d(o)),o.onEndDateInput=o.onEndDateInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onTypeChange",value:function(e){var t=this.props.context.element,n=this.state.dates;this.setState({type:e}),hC(dC(e,n))&&this.editCell(t.businessObject,dC(e,n))}},{key:"onSetStartDateTodayClick",value:function(){var e=this.props.context.element,t=this.state,n=t.dates,i=t.type,r=pC();this.setState({dates:[r,n[1]]}),hC(dC(i,[r,n[1]]))&&this.editCell(e.businessObject,dC(i,[r,n[1]]))}},{key:"onSetEndDateTodayClick",value:function(){var e=this.props.context.element,t=this.state,n=t.dates,i=t.type,r=pC();this.setState({dates:[n[0],r]}),hC(dC(i,[n[0],r]))&&this.editCell(e.businessObject,dC(i,[n[0],r]))}},{key:"onStartDateInput",value:function(e){var t=e.value,n=this.props.context.element,i=this.state,r=i.dates,o=i.type;this.setState({dates:[t,r[1]]}),this.debouncedEditCell(n.businessObject,dC(o,[t,r[1]]))}},{key:"onEndDateInput",value:function(e){var t=e.value,n=this.props.context.element,i=this.state,r=i.dates,o=i.type;this.setState({dates:[r[0],t]}),this.debouncedEditCell(n.businessObject,dC(o,[r[0],t]))}},{key:"render",value:function(){var e=this,t=this.state,n=t.dates,i=t.type,r=[{label:this._translate("Exactly"),value:fC},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:vC}];return Gv(1,"div","context-menu-container simple-date-edit",[Gv(1,"h3","dms-heading",this._translate("Edit date"),0),Gv(1,"div","dms-fill-row",Kv(2,ox,{noInput:!0,onChange:this.onTypeChange,options:r,value:i}),2),Gv(1,"h4","dms-heading",i===vC?this._translate("Edit start date"):this._translate("Set date"),0),Gv(1,"div",null,[Kv(2,fx,{className:"start-date-input dms-block",onInput:this.onStartDateInput,placeholder:this._translate("e.g. { sample }",{sample:pC()}),validate:function(t){return lC(t)&&e._translate(lC(t))},value:n[0]}),Gv(1,"p","dms-hint",[Gv(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetStartDateTodayClick}),Xv(".")],4)],4),i===vC&&Gv(1,"h4","dms-heading",this._translate("Edit end date"),0),i===vC&&Gv(1,"div",null,[Kv(2,fx,{className:"end-date-input dms-block",onInput:this.onEndDateInput,placeholder:this._translate("e.g. { sample }",{sample:pC()}),validate:function(t){return lC(t)&&e._translate(lC(t))},value:n[1]}),Gv(1,"p","dms-hint",[Gv(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetEndDateTodayClick}),Xv(".")],4)],4)],0)}}]),n}(ug),gC=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=hC(o.props.context.element.businessObject.text);o.state={date:a?a.date:""};var s=r.injector.get("debounceInput");return o.debouncedEditCell=s(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onClick=o.onClick.bind(d(o)),o.onInput=o.onInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onClick",value:function(){var e=this.props.context.element,t=pC();this.setState({date:t}),this.editCell(e.businessObject,'date("'.concat(t,'")'))}},{key:"onInput",value:function(e){var t=e.value,n=this.props.context.element;this.setState({date:t}),this.debouncedEditCell(n.businessObject,'date("'.concat(t,'")'))}},{key:"render",value:function(){var e=this,t=this.state.date;return Gv(1,"div","context-menu-container simple-date-edit",[Gv(1,"h3","dms-heading",this._translate("Edit date"),0),Gv(1,"h4","dms-heading",this._translate("Set date"),0),Gv(1,"div",null,[Kv(2,fx,{onInput:this.onInput,placeholder:this._translate("e.g. { example } ",{example:pC()}),validate:function(t){return lC(t)&&e._translate(lC(t))},value:t,className:"dms-block"}),Gv(1,"p","dms-hint",[this._translate("Set date"),Xv(" "),Gv(1,"button","use-today",this._translate("to today"),0,{type:"button",onClick:this.onClick}),Xv(".")],0)],4)],4)}}]),n}(ug),yC=o((function e(t,n){i(this,e),n.registerProvider((function(e){var t=_C(e);return($n(e.col)||Vn(e.col))&&bC(t)})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;var t=_C(e.element);if(bC(t)){if($n(e.element.col))return mC;if(Vn(e.element.col))return gC}}}))}));function _C(e){return $n(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function bC(e){return"date"===e}yC.$inject=["components","simpleMode"];var xC={__depends__:[Dx,eC],__init__:["simpleDateEdit"],simpleDateEdit:["type",yC]},wC=/^\d{4}(?:-\d\d){2}T(?:\d\d:){2}\d\d(?:Z|(?:[@+-][^")]+))?$/,CC=/^\[date and time\("([^"]*)"\)..date and time\("([^"]*)"\)\]$/,EC=/^(<|>)\s*date and time\("([^"]*)"\)$/,kC=/^date and time\("([^"]*)"\)$/;function SC(e){if(!wC.test(e.trim()))return"Date and time must match pattern yyyy-MM-ddTHH:mm:ss[time zone]."}function jC(e,t){return"exact"===e?'date and time("'.concat(t[0],'")'):"before"===e?'< date and time("'.concat(t[0],'")'):"after"===e?'> date and time("'.concat(t[0],'")'):"between"===e?'[date and time("'.concat(t[0],'")..date and time("').concat(t[1],'")]'):void 0}function OC(){var e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().replace(".000Z","Z")}function PC(e){if(!e||""===e.trim())return{type:"exact",date:""};var t=e.match(CC);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(EC))?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(kC))?{type:"exact",date:t[1]}:void 0}var DC="exact",RC="between",TC=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a,s=PC(o.props.context.element.businessObject.text);s?(a=s.date?[s.date,""]:s.dates?s.dates:["",""],o.state={type:s.type,dates:a}):o.state={type:DC,dates:["",""]};var u=r.injector.get("debounceInput");return o.debouncedEditCell=u(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onTypeChange=o.onTypeChange.bind(d(o)),o.onSetStartDateTodayClick=o.onSetStartDateTodayClick.bind(d(o)),o.onSetEndDateTodayClick=o.onSetEndDateTodayClick.bind(d(o)),o.onStartDateInput=o.onStartDateInput.bind(d(o)),o.onEndDateInput=o.onEndDateInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onTypeChange",value:function(e){var t=this.props.context.element,n=this.state.dates;this.setState({type:e}),PC(jC(e,n))&&this.editCell(t.businessObject,jC(e,n))}},{key:"onSetStartDateTodayClick",value:function(){var e=this.props.context.element,t=this.state,n=t.dates,i=t.type,r=OC();this.setState({dates:[r,n[1]]}),PC(jC(i,[r,n[1]]))&&this.editCell(e.businessObject,jC(i,[r,n[1]]))}},{key:"onSetEndDateTodayClick",value:function(){var e=this.props.context.element,t=this.state,n=t.dates,i=t.type,r=OC();this.setState({dates:[n[0],r]}),PC(jC(i,[n[0],r]))&&this.editCell(e.businessObject,jC(i,[n[0],r]))}},{key:"onStartDateInput",value:function(e){var t=e.value,n=this.props.context.element,i=this.state,r=i.dates,o=i.type;this.setState({dates:[t,r[1]]}),this.debouncedEditCell(n.businessObject,jC(o,[t,r[1]]))}},{key:"onEndDateInput",value:function(e){var t=e.value,n=this.props.context.element,i=this.state,r=i.dates,o=i.type;this.setState({dates:[r[0],t]}),this.debouncedEditCell(n.businessObject,jC(o,[r[0],t]))}},{key:"render",value:function(){var e=this,t=this.state,n=t.dates,i=t.type,r=[{label:this._translate("Exactly"),value:DC},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:RC}];return Gv(1,"div","context-menu-container simple-date-edit",[Gv(1,"h3","dms-heading",this._translate("Edit date and time"),0),Gv(1,"div","dms-fill-row",Kv(2,ox,{noInput:!0,onChange:this.onTypeChange,options:r,value:i}),2),Gv(1,"h4","dms-heading",i===RC?this._translate("Edit start date"):this._translate("Set date"),0),Gv(1,"div",null,[Kv(2,fx,{className:"start-date-input dms-block",onInput:this.onStartDateInput,placeholder:this._translate("e.g. { sample }",{sample:OC()}),validate:function(t){return SC(t)&&e._translate(SC(t))},value:n[0]}),Gv(1,"p","dms-hint",[Gv(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetStartDateTodayClick}),Xv(".")],4)],4),i===RC&&Gv(1,"h4","dms-heading",this._translate("Edit end date"),0),i===RC&&Gv(1,"div",null,[Kv(2,fx,{className:"end-date-input dms-block",onInput:this.onEndDateInput,placeholder:this._translate("e.g. { sample }",{sample:OC()}),validate:function(t){return SC(t)&&e._translate(SC(t))},value:n[1]}),Gv(1,"p","dms-hint",[Gv(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetEndDateTodayClick}),Xv(".")],4)],4)],0)}}]),n}(ug),MC=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=PC(o.props.context.element.businessObject.text);o.state={date:a?a.date:""};var s=r.injector.get("debounceInput");return o.debouncedEditCell=s(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onClick=o.onClick.bind(d(o)),o.onInput=o.onInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onClick",value:function(){var e=this.props.context.element,t=OC();this.setState({date:t}),this.editCell(e.businessObject,'date and time("'.concat(t,'")'))}},{key:"onInput",value:function(e){var t=e.value,n=this.props.context.element;this.setState({date:t}),this.debouncedEditCell(n.businessObject,'date and time("'.concat(t,'")'))}},{key:"render",value:function(){var e=this,t=this.state.date;return Gv(1,"div","context-menu-container simple-date-edit",[Gv(1,"h3","dms-heading",this._translate("Edit date and time"),0),Gv(1,"h4","dms-heading",this._translate("Set date and time"),0),Gv(1,"div",null,[Kv(2,fx,{onInput:this.onInput,placeholder:this._translate("e.g. { sample }",{sample:OC()}),validate:function(t){return SC(t)&&e._translate(SC(t))},value:t,className:"dms-block"}),Gv(1,"p","dms-hint",[this._translate("Use"),Xv(" "),Gv(1,"button","use-today",this._translate("today"),0,{type:"button",onClick:this.onClick}),Xv(".")],0)],4)],4)}}]),n}(ug),IC=o((function e(t,n){i(this,e),n.registerProvider((function(e){var t=AC(e);return($n(e.col)||Vn(e.col))&&NC(t)})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;var t=AC(e.element);if(NC(t)){if($n(e.element.col))return TC;if(Vn(e.element.col))return MC}}}))}));function AC(e){return $n(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function NC(e){return"dateTime"===e}IC.$inject=["components","simpleMode"];var BC={__depends__:[Dx,eC],__init__:["simpleDateTimeEdit"],simpleDateTimeEdit:["type",IC]};function LC(){LC=function(e,t){return new i(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function i(e,n,r){var o=new RegExp(e,n);return t.set(o,r||t.get(e)),VC(o,i.prototype)}function r(e,n){var i=t.get(n);return Object.keys(i).reduce((function(t,n){var r=i[n];if("number"==typeof r)t[n]=e[r];else{for(var o=0;void 0===e[r[o]]&&o+1<r.length;)o++;t[n]=e[r[o]]}return t}),Object.create(null))}return $C(i,RegExp),i.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=r(n,this);var i=n.indices;i&&(i.groups=r(i,this))}return n},i.prototype[Symbol.replace]=function(i,o){if("string"==typeof o){var a=t.get(this);return e[Symbol.replace].call(this,i,o.replace(/\$<([^>]+)>/g,(function(e,t){var n=a[t];return"$"+(Array.isArray(n)?n.join("$"):n)})))}if("function"==typeof o){var s=this;return e[Symbol.replace].call(this,i,(function(){var e=arguments;return"object"!=n(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,s)),o.apply(this,e)}))}return e[Symbol.replace].call(this,i,o)},LC.apply(this,arguments)}function $C(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&VC(e,t)}function VC(e,t){return VC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},VC(e,t)}var zC={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function FC(e){return z(zC).filter((function(t){return e===zC[t]}))[0]}function UC(e){if(!e||""===e.trim())return{type:"comparison",values:[]};var t=function(e){var t=qC(e);if(t)return{type:"comparison",operator:"equals",values:[t]};var n=GC(LC(/^(=|(:?<|>)=?)\s*duration\("([^"]*)"\)$/,{operator:1,value:3}),e),i=n.operator,r=n.value;if(i&&r)return{type:"comparison",values:[r],operator:FC(i)}}(e);if(t)return t;var n=function(e){var t=GC(LC(/^([[\]])duration\("([^"]*)"\)\.\.duration\("([^"]*)"\)([[\]])$/,{start:1,firstValue:2,secondValue:3,end:4}),e),n=t.start,i=t.end,r=t.firstValue,o=t.secondValue;if(n&&i)return{type:"range",values:[r,o],start:"]"===n?"exclude":"include",end:"["===i?"exclude":"include"}}(e);return n||void 0}function HC(e,t){return"equals"===e?'duration("'.concat(t,'")'):"".concat(zC[e],' duration("').concat(t,'")')}function WC(e,t,n,i){var r="exclude"===i?"[":"]";return"".concat("exclude"===n?"]":"[",'duration("').concat(e,'")')+'..duration("'.concat(t,'")').concat(r)}function qC(e){var t=/^duration\("([^"]*)"\)$/.exec(e);return t&&t[1]}function GC(e,t){return(e.exec(t)||{groups:{}}).groups}var KC={yearMonthDuration:"Must match PnYnM.",dayTimeDuration:"Must match PnDTnH."},XC=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._type=e.type,o.onInput=o.onInput.bind(d(o)),o.validate=o.validate.bind(d(o)),o.state={value:e.value},o}return o(n,[{key:"onInput",value:function(e){var t=e.value;this.setState({value:t}),this.props.onInput(t)}},{key:"validate",value:function(e){if(!function(e,t){return"yearMonthDuration"===e?function(e){return/^P(\d+Y\d+M|\d+Y|\d+M)$/.test(e)}(t):"dayTimeDuration"===e?function(e){return/^P(\d+DT\d+H|\d+D|T\d+H)$/.test(e)}(t):void 0}(this._type,e))return this._translate(KC[this._type])}},{key:"_getPlaceholder",value:function(){if("yearMonthDuration"===this._type)return this._translate("e.g. { sample }",{sample:"P1Y2M"});"dayTimeDuration"===this._type&&this._translate("e.g. { sample }",{sample:"P1DT2H"})}},{key:"render",value:function(){return Kv(2,fx,{type:"text",onInput:this.onInput,placeholder:this._getPlaceholder(),validate:this.validate,value:this.state.value,className:this.props.className})}}]),n}(ug),YC="comparison",ZC="range",QC=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=o.props.context.element;o._type=function(e){return e.col.businessObject.inputExpression.typeRef}(a);var s=UC(a.businessObject.text,o._type);o.state=s?{type:s.type,comparisonOperator:s.operator||"equals",startValue:s.values[0]||"",endValue:s.values[1]||"",rangeStartType:s.start||"include",rangeEndType:s.end||"include"}:{type:YC,comparisonOperator:"equals",startValue:"",endValue:"",rangeStartType:"include",rangeEndType:"include"};var u=r.injector.get("debounceInput");return o.debouncedEditCell=u(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onComparisonOperatorChange=o.onComparisonOperatorChange.bind(d(o)),o.onComparisonValueChange=o.onComparisonValueChange.bind(d(o)),o.onTypeChange=o.onTypeChange.bind(d(o)),o.onRangeStartTypeChange=o.onRangeStartTypeChange.bind(d(o)),o.onRangeStartValueChange=o.onRangeStartValueChange.bind(d(o)),o.onRangeEndTypeChange=o.onRangeEndTypeChange.bind(d(o)),o.onRangeEndValueChange=o.onRangeEndValueChange.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onTypeChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.comparisonOperator,r=n.startValue,o=n.endValue,a=n.rangeStartType,s=n.rangeEndType;e===YC?this.editCell(t.businessObject,HC(i,r)):this.editCell(t.businessObject,WC(r,o,a,s)),this.setState({type:e})}},{key:"onComparisonOperatorChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.startValue;i===YC&&(this.editCell(t.businessObject,HC(e,r)),this.setState({comparisonOperator:e}))}},{key:"onComparisonValueChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.comparisonOperator;i===YC&&(this.debouncedEditCell(t.businessObject,HC(r,e)),this.setState({startValue:e}))}},{key:"onRangeStartTypeChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.startValue,o=n.endValue,a=n.rangeEndType;i===ZC&&(this.editCell(t.businessObject,WC(r,o,e,a)),this.setState({rangeStartType:e}))}},{key:"onRangeStartValueChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.endValue,o=n.rangeStartType,a=n.rangeEndType;i===ZC&&(this.editCell(t.businessObject,WC(e,r,o,a)),this.setState({startValue:e}))}},{key:"onRangeEndTypeChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.startValue,o=n.endValue,a=n.rangeStartType;i===ZC&&(this.editCell(t.businessObject,WC(r,o,a,e)),this.setState({rangeEndType:e}))}},{key:"onRangeEndValueChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.startValue,o=n.rangeStartType,a=n.rangeEndType;i===ZC&&(this.editCell(t.businessObject,WC(r,e,o,a)),this.setState({endValue:e}))}},{key:"renderComparison",value:function(e,t){var n=[{label:this._translate("Equals"),value:"equals"},{label:this._translate("Less"),value:"less"},{label:this._translate("Less or equals"),value:"lessEquals"},{label:this._translate("Greater"),value:"greater"},{label:this._translate("Greater or equals"),value:"greaterEquals"}];return Gv(1,"div","comparison",[Gv(1,"h4","dms-heading",Xv("Value"),2),Gv(1,"div","dms-fill-row dms-input-duration-edit-row",[Kv(2,ox,{noInput:!0,onChange:this.onComparisonOperatorChange,options:n,value:e}),Xv(" "),Kv(2,XC,{type:this._type,className:"comparison-duration-input",onInput:this.onComparisonValueChange,value:t})],4)],4)}},{key:"renderRange",value:function(e,t,n,i){var r=[{label:this._translate("Include"),value:"include"},{label:this._translate("Exclude"),value:"exclude"}];return Gv(1,"div","range",[Gv(1,"h4","dms-heading",this._translate("Start value"),0),Gv(1,"div","dms-fill-row dms-input-duration-edit-row",[Kv(2,ox,{noInput:!0,onChange:this.onRangeStartTypeChange,options:r,value:n}),Xv(" "),Kv(2,XC,{type:this._type,className:"range-start-duration-input",onInput:this.onRangeStartValueChange,value:e})],4),Gv(1,"h4","dms-heading",this._translate("End value"),0),Gv(1,"div","dms-fill-row dms-input-duration-edit-row",[Kv(2,ox,{noInput:!0,onChange:this.onRangeEndTypeChange,options:r,value:i}),Xv(" "),Kv(2,XC,{type:this._type,className:"range-end-duration-input",onInput:this.onRangeEndValueChange,value:t})],4)],4)}},{key:"render",value:function(){var e=this.state,t=e.type,n=e.comparisonOperator,i=e.startValue,r=e.endValue,o=e.rangeStartType,a=e.rangeEndType,s=[{label:this._translate("Comparison"),value:YC},{label:this._translate("Range"),value:ZC}];return Gv(1,"div","context-menu-container simple-duration-edit",[Gv(1,"h3","dms-heading",this._translate("Edit duration"),0),Gv(1,"div","dms-fill-row",Kv(2,ox,{noInput:!0,onChange:this.onTypeChange,options:s,value:t}),2),t===YC&&this.renderComparison(n,i),t===ZC&&this.renderRange(i,r,o,a)],0)}}]),n}(ug);var JC=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=o.props.context.element;o._type=function(e){return e.col.businessObject.typeRef}(a);var s=r.injector.get("debounceInput");return o.debouncedEditCell=s(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onInput=o.onInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onInput",value:function(e){var t=this.props.context.element;this.debouncedEditCell(t.businessObject,'duration("'.concat(e,'")'))}},{key:"render",value:function(){var e=qC(this.props.context.element.businessObject.text,this._type);return Gv(1,"div","context-menu-container simple-duration-edit",[Gv(1,"h3","dms-heading",this._translate("Edit duration"),0),Gv(1,"h4","dms-heading",this._translate("Set duration"),0),Kv(2,XC,{onInput:this.onInput,value:e,type:this._type,className:"dms-block"})],4)}}]),n}(ug);var eE=o((function e(t,n){i(this,e),n.registerProvider((function(e){var t=tE(e);return($n(e.col)||Vn(e.col))&&iE(t)})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;var t=tE(e.element);if(iE(t)){if($n(e.element.col))return QC;if(Vn(e.element.col))return JC}}}))}));function tE(e){return $n(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}eE.$inject=["components","simpleMode"];var nE=["yearMonthDuration","dayTimeDuration"];function iE(e){return nE.includes(e)}var rE={__depends__:[Dx,eC],__init__:["simpleDurationEdit"],simpleDurationEdit:["type",eE]},oE=/^(-?(?:[0-9]|\.[0-9])+)$|^((?:<|>|=){0,2})\s*(-?(?:[0-9]|\.[0-9])+)$/,aE=/^(\[|\]){1}(-?(?:[0-9]|\.[0-9])+){1,}\.\.(-?(?:[0-9]|\.[0-9])+){1,}(\[|\]){1}$/,sE={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function uE(e){return z(sE).filter((function(t){return e===sE[t]}))[0]}function cE(e){if(!e||function(e){return""===e}(e.trim()))return{type:"comparison"};var t=e.match(oE),n=e.match(aE);if(t){if(function(e){return e[0]&&e[1]&&!e[2]&&!e[3]}(t))return{type:"comparison",value:parseFloat(t[1]),operator:"equals"};if(function(e){return e[0]&&!e[1]&&e[2]&&e[3]}(t))return{type:"comparison",value:parseFloat(t[3]),operator:uE(t[2])}}else if(n)return{type:"range",values:[n[2],n[3]].map((function(e){return parseFloat(e)})),start:"]"===n[1]?"exclude":"include",end:"["===n[4]?"exclude":"include"}}function lE(e,t){return"equals"===e?"".concat(t):"".concat(sE[e]," ").concat(t)}function dE(e,t,n,i){var r="exclude"===i?"[":"]";return"".concat("exclude"===n?"]":"[").concat(e,"..").concat(t).concat(r)}var pE="comparison",hE="range",fE=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=cE(o.props.context.element.businessObject.text);o.state=a?{type:a.type,comparisonOperator:a.operator||"equals",comparisonValue:a.value||0,rangeStartValue:a.values?a.values[0]:0,rangeEndValue:a.values?a.values[1]:0,rangeStartType:a.start||"include",rangeEndType:a.end||"include"}:{type:pE,comparisonOperator:"equals",comparisonValue:0,rangeStartValue:0,rangeEndValue:0,rangeStartType:"include",rangeEndType:"include"};var s=r.injector.get("debounceInput");return o.debouncedEditCell=s(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onComparisonOperatorChange=o.onComparisonOperatorChange.bind(d(o)),o.onComparisonValueChange=o.onComparisonValueChange.bind(d(o)),o.onTypeChange=o.onTypeChange.bind(d(o)),o.onRangeStartTypeChange=o.onRangeStartTypeChange.bind(d(o)),o.onRangeStartValueChange=o.onRangeStartValueChange.bind(d(o)),o.onRangeEndTypeChange=o.onRangeEndTypeChange.bind(d(o)),o.onRangeEndValueChange=o.onRangeEndValueChange.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onTypeChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.comparisonOperator,r=n.comparisonValue,o=n.rangeStartValue,a=n.rangeEndValue,s=n.rangeStartType,u=n.rangeEndType;e===pE?this.editCell(t.businessObject,lE(i,r)):this.editCell(t.businessObject,dE(o,a,s,u)),this.setState({type:e})}},{key:"onComparisonOperatorChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.comparisonValue;i===pE&&(this.editCell(t.businessObject,lE(e,r)),this.setState({comparisonOperator:e}))}},{key:"onComparisonValueChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.comparisonOperator;i===pE&&(this.debouncedEditCell(t.businessObject,lE(r,e)),this.setState({comparisonValue:e}))}},{key:"onRangeStartTypeChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.rangeStartValue,o=n.rangeEndValue,a=n.rangeEndType;i===hE&&(this.editCell(t.businessObject,dE(r,o,e,a)),this.setState({rangeStartType:e}))}},{key:"onRangeStartValueChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.rangeEndValue,o=n.rangeStartType,a=n.rangeEndType;i===hE&&(this.editCell(t.businessObject,dE(e,r,o,a)),this.setState({rangeStartValue:e}))}},{key:"onRangeEndTypeChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.rangeStartValue,o=n.rangeEndValue,a=n.rangeStartType;i===hE&&(this.editCell(t.businessObject,dE(r,o,a,e)),this.setState({rangeEndType:e}))}},{key:"onRangeEndValueChange",value:function(e){var t=this.props.context.element,n=this.state,i=n.type,r=n.rangeStartValue,o=n.rangeStartType,a=n.rangeEndType;i===hE&&(this.editCell(t.businessObject,dE(r,e,o,a)),this.setState({rangeEndValue:e}))}},{key:"renderComparison",value:function(e,t){var n=[{label:this._translate("Equals"),value:"equals"},{label:this._translate("Less"),value:"less"},{label:this._translate("Less or equals"),value:"lessEquals"},{label:this._translate("Greater"),value:"greater"},{label:this._translate("Greater or equals"),value:"greaterEquals"}];return Gv(1,"div","comparison",[Gv(1,"h4","dms-heading",this._translate("Value"),0),Gv(1,"div","dms-fill-row",[Kv(2,ox,{noInput:!0,onChange:this.onComparisonOperatorChange,options:n,value:e}),Xv(" "),Kv(2,$b,{className:"comparison-number-input",onInput:this.onComparisonValueChange,type:"number",value:t})],4)],4)}},{key:"renderRange",value:function(e,t,n,i){var r=[{label:this._translate("Include"),value:"include"},{label:this._translate("Exclude"),value:"exclude"}];return Gv(1,"div","range",[Gv(1,"h4","dms-heading",this._translate("Start value"),0),Gv(1,"div","dms-fill-row",[Kv(2,ox,{noInput:!0,onChange:this.onRangeStartTypeChange,options:r,value:n}),Xv(" "),Kv(2,$b,{className:"range-start-number-input",onInput:this.onRangeStartValueChange,type:"number",value:e})],4),Gv(1,"h4","dms-heading",this._translate("End value"),0),Gv(1,"div","dms-fill-row",[Kv(2,ox,{noInput:!0,onChange:this.onRangeEndTypeChange,options:r,value:i}),Xv(" "),Kv(2,$b,{className:"range-end-number-input",onInput:this.onRangeEndValueChange,type:"number",value:t})],4)],4)}},{key:"render",value:function(){var e=this.state,t=e.type,n=e.comparisonOperator,i=e.comparisonValue,r=e.rangeStartValue,o=e.rangeEndValue,a=e.rangeStartType,s=e.rangeEndType,u=[{label:this._translate("Comparison"),value:pE},{label:this._translate("Range"),value:hE}];return Gv(1,"div","context-menu-container simple-number-edit",[Gv(1,"h3","dms-heading",this._translate("Edit Number"),0),Gv(1,"div","dms-fill-row",Kv(2,ox,{noInput:!0,onChange:this.onTypeChange,options:u,value:t}),2),t===pE&&this.renderComparison(n,i),t===hE&&this.renderRange(r,o,a,s)],0)}}]),n}(ug),vE=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=cE(o.props.context.element.businessObject.text);o.state=a?{value:a.value}:{value:""};var s=r.injector.get("debounceInput");return o.debouncedEditCell=s(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onInput=o.onInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onInput",value:function(e){var t=this.props.context.element;this.debouncedEditCell(t.businessObject,e),this.setState({value:e})}},{key:"render",value:function(){var e=this.state.value;return Gv(1,"div","context-menu-container simple-number-edit",[Gv(1,"h3","dms-heading",this._translate("Edit Number"),0),Gv(1,"h4","dms-heading",this._translate("Set Value"),0),Kv(2,$b,{onInput:this.onInput,type:"number",value:e})],4)}}]),n}(ug),mE=o((function e(t,n){i(this,e),n.registerProvider((function(e){var t=gE(e);return($n(e.col)||Vn(e.col))&&_E(t)})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;var t=gE(e.element);if(_E(t)){if($n(e.element.col))return fE;if(Vn(e.element.col))return vE}}}))}));function gE(e){return $n(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}mE.$inject=["components","simpleMode"];var yE=["number","integer","long","double"];function _E(e){return yE.includes(e)}var bE={__depends__:[Dx,eC],__init__:["simpleNumberEdit"],simpleNumberEdit:["type",mE]};function xE(e){if(!e||wE(e.trim()))return{type:"disjunction",values:[]};var t=e.split(","),n={type:"disjunction",values:[]},i="";if(t.forEach((function(e){/^"[^"]*"$/.test((i+=e).trim())?(n.values.push(i.trim()),i=""):i+=","})),!i)return n;n.type="negation",n.values=[],i="";var r=e.match(/^\s*not\((.*)\)\s*$/);return r&&((t=r[1].split(",")).forEach((function(e){/^"[^"]*"$/.test((i+=e).trim())?(n.values.push(i.trim()),i=""):i+=","})),!i)?n:void 0}function wE(e){return""===e}var CE="disjunction",EE="negation",kE=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=xE(e.context.element.businessObject.text);a||(a={values:[],type:CE});var s=function(e){var t=$n(e)?e.inputValues:e.outputValues;return!t||wE(t.text)?[]:t.text.split(",").map((function(e){return e.trim()}))}(e.context.element.col.businessObject),u=a.values.filter((function(e){return!jE(s,e)})),c=$n(e.context.element.col),l=s.map((function(e){return{value:e,isChecked:jE(a.values,e),isRemovable:!1,group:o._translate("Predefined Values")}}));c&&(l=l.concat(u.map((function(e){return{value:e,isChecked:!0,isRemovable:!0,group:o._translate("Custom Values")}}))));var p="";c||!a.values.length||jE(s,a.values[0])||(p=a.values[0]),o.state={items:l,unaryTestsType:a.type,inputValue:p,isOutputValueInputChecked:""!==p};var h=r.injector.get("debounceInput");return o.debouncedEditCell=h(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.addUnaryTestsListItem=o.addUnaryTestsListItem.bind(d(o)),o.onInput=o.onInput.bind(d(o)),o.onKeyDown=o.onKeyDown.bind(d(o)),o.onOutputValueInputClick=o.onOutputValueInputClick.bind(d(o)),o.onUnaryTestsListChanged=o.onUnaryTestsListChanged.bind(d(o)),o.onUnaryTestsTypeChange=o.onUnaryTestsTypeChange.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onUnaryTestsTypeChange",value:function(e){var t=SE(this.state.items),n=this.props.context.element;e===CE?(this.editCell(n.businessObject,t.join(",")),this.setState({unaryTestsType:CE})):(this.editCell(n.businessObject,"not(".concat(t.join(","),")")),this.setState({unaryTestsType:EE}))}},{key:"onUnaryTestsListChanged",value:function(e){var t=SE(e),n=this.props.context.element;this.state.unaryTestsType===CE?this.editCell(n.businessObject,t.join(",")):this.editCell(n.businessObject,"not(".concat(t.join(","),")")),this.setState({items:e,isOutputValueInputChecked:!1})}},{key:"onOutputValueInputClick",value:function(){var e=this.props.context.element,t=this.state,n=t.inputValue,i=t.items,r=xE(n);!r||r.values.length>1||(this.editCell(e.businessObject,"".concat(r.values.join(""))),this.setState({items:i.map((function(e){return e.isChecked=!1,e})),isOutputValueInputChecked:!0}))}},{key:"onInput",value:function(e){var t=e.isValid,n=e.value,i=this.state.isOutputValueInputChecked;this.setState({inputValue:n});var r=this.props.context.element;!$n(r)&&t&&i&&this.debouncedEditCell(r.businessObject,n)}},{key:"onKeyDown",value:function(e){var t=e.isValid,n=e.event;if(13===n.keyCode){var i=$n(this.props.context.element.col);!i&&t||(n.stopPropagation(),n.preventDefault()),t&&(i?this.addUnaryTestsListItem():this.onOutputValueInputClick())}}},{key:"addUnaryTestsListItem",value:function(){var e=this,t=this.state,n=t.inputValue,i=t.items,r=t.unaryTestsType,o=xE(n);if(o){var a=this.props.context.element,s=SE(i),u=[].concat(s,o.values);r===CE?this.editCell(a.businessObject,u.join(",")):this.editCell(a.businessObject,"not(".concat(u.join(","),")"));var c=i.concat(o.values.map((function(t){return{value:t,isChecked:!0,isRemovable:!0,group:e._translate("Custom Values")}})));this.setState({items:c,inputValue:""})}}},{key:"render",value:function(){var e=this,t=this.props.context.element,n=this.state,i=n.inputValue,r=n.isOutputValueInputChecked,o=n.items,a=n.unaryTestsType,s=[{label:this._translate("Match one"),value:CE},{label:this._translate("Match none"),value:EE}],u=$n(t.col),c=a===EE,l=!u&&o.length>0;return Gv(1,"div","simple-string-edit context-menu-container",[Gv(1,"h3","dms-heading",this._translate("Edit String"),0),u&&Gv(1,"p",null,Kv(2,ox,{noInput:!0,onChange:this.onUnaryTestsTypeChange,options:s,value:c?EE:CE},null,(function(t){return e.selectNode=t})),2),Kv(2,hx,{onChange:this.onUnaryTestsListChanged,items:o,type:u?"checkbox":"radio"}),Gv(1,"h4","dms-heading",u?this._translate("Add Values"):this._translate("Set Value"),0),Gv(1,"div","dms-fill-row",[l&&Gv(64,"input","cursor-pointer",null,1,{checked:r,onClick:this.onOutputValueInputClick,type:"radio",style:{marginRight:"8px"}}),Kv(2,fx,{className:"dms-block",onKeyDown:this.onKeyDown,onInput:this.onInput,placeholder:u?this._translate('"value", "value", ...'):this._translate('"value"'),type:"text",validate:function(t){if(!xE(t))return e._translate("Strings must be in double quotes.")},value:i})],0)],0)}}]),n}(ug);function SE(e){return e.filter((function(e){return e.isChecked})).map((function(e){return e.value}))}function jE(e,t){return-1!==e.indexOf(t)}var OE=o((function e(t,n){i(this,e),n.registerProvider((function(e){return($n(e.col)||Vn(e.col))&&"string"===PE(e)})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;var t=PE(e.element);if("string"===t)return kE}}))}));function PE(e){return $n(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}OE.$inject=["components","simpleMode"];var DE={__depends__:[Dx,eC],__init__:["simpleStringEdit"],simpleStringEdit:["type",OE]},RE=/^(?:\d\d:){2}\d\d(?:Z|(?:[@+-][^")]+))?$/,TE=/^\[time\("([^"]*)"\)..time\("([^"]*)"\)\]$/,ME=/^(<|>)\s*time\("([^"]*)"\)$/,IE=/^time\("([^"]*)"\)$/;function AE(e){if(!RE.test(e.trim()))return"Time must match pattern hh:mm:ss[time zone]."}function NE(e,t){return"exact"===e?'time("'.concat(t[0],'")'):"before"===e?'< time("'.concat(t[0],'")'):"after"===e?'> time("'.concat(t[0],'")'):"between"===e?'[time("'.concat(t[0],'")..time("').concat(t[1],'")]'):void 0}function BE(){return(new Date).toISOString().slice(11,-5)+"Z"}function LE(e){if(!e||""===e.trim())return{type:"exact",time:""};var t=e.match(TE);return t?{type:"between",times:[t[1],t[2]]}:(t=e.match(ME))?{type:"<"===t[1]?"before":"after",time:t[2]}:(t=e.match(IE))?{type:"exact",time:t[1]}:void 0}var $E="exact",VE="between",zE=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a,s=LE(o.props.context.element.businessObject.text);s?(a=s.time?[s.time,""]:s.times?s.times:["",""],o.state={type:s.type,times:a}):o.state={type:$E,times:["",""]};var u=r.injector.get("debounceInput");return o.debouncedEditCell=u(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onTypeChange=o.onTypeChange.bind(d(o)),o.onSetStartTimeNowClick=o.onSetStartTimeNowClick.bind(d(o)),o.onSetEndTimeNowClick=o.onSetEndTimeNowClick.bind(d(o)),o.onStartTimeInput=o.onStartTimeInput.bind(d(o)),o.onEndTimeInput=o.onEndTimeInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onTypeChange",value:function(e){var t=this.props.context.element,n=this.state.times;this.setState({type:e}),LE(NE(e,n))&&this.editCell(t.businessObject,NE(e,n))}},{key:"onSetStartTimeNowClick",value:function(){var e=this.props.context.element,t=this.state,n=t.times,i=t.type,r=BE();this.setState({times:[r,n[1]]}),LE(NE(i,[r,n[1]]))&&this.editCell(e.businessObject,NE(i,[r,n[1]]))}},{key:"onSetEndTimeNowClick",value:function(){var e=this.props.context.element,t=this.state,n=t.times,i=t.type,r=BE();this.setState({times:[n[0],r]}),LE(NE(i,[n[0],r]))&&this.editCell(e.businessObject,NE(i,[n[0],r]))}},{key:"onStartTimeInput",value:function(e){var t=e.value,n=this.props.context.element,i=this.state,r=i.times,o=i.type;this.setState({times:[t,r[1]]}),this.debouncedEditCell(n.businessObject,NE(o,[t,r[1]]))}},{key:"onEndTimeInput",value:function(e){var t=e.value,n=this.props.context.element,i=this.state,r=i.times,o=i.type;this.setState({times:[r[0],t]}),this.debouncedEditCell(n.businessObject,NE(o,[r[0],t]))}},{key:"render",value:function(){var e=this,t=this.state,n=t.times,i=t.type,r=[{label:this._translate("Exactly"),value:$E},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:VE}];return Gv(1,"div","context-menu-container simple-time-edit",[Gv(1,"h3","dms-heading",this._translate("Edit time"),0),Gv(1,"div","dms-fill-row",Kv(2,ox,{noInput:!0,onChange:this.onTypeChange,options:r,value:i}),2),Gv(1,"h4","dms-heading",i===VE?this._translate("Edit start time"):this._translate("Set time"),0),Gv(1,"div",null,[Kv(2,fx,{className:"start-time-input dms-block",onInput:this.onStartTimeInput,placeholder:this._translate("e.g. { example } ",{example:pC()}),validate:function(t){return AE(t)&&e._translate(AE(t))},value:n[0]}),Gv(1,"p","dms-hint",[Gv(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onSetStartTimeNowClick}),Xv(".")],4)],4),i===VE&&Gv(1,"h4","dms-heading",this._translate("Edit end time"),0),i===VE&&Gv(1,"div",null,[Kv(2,fx,{className:"end-time-input dms-block",onInput:this.onEndTimeInput,placeholder:this._translate("e.g. { example } ",{example:pC()}),validate:function(t){return AE(t)&&e._translate(AE(t))},value:n[1]}),Gv(1,"p","dms-hint",[Gv(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onSetEndTimeNowClick}),Xv(".")],4)],4)],0)}}]),n}(ug),FE=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._modeling=r.injector.get("modeling");var a=LE(o.props.context.element.businessObject.text);o.state={date:a?a.date:""};var s=r.injector.get("debounceInput");return o.debouncedEditCell=s(o.editCell.bind(d(o))),o.editCell=o.editCell.bind(d(o)),o.onClick=o.onClick.bind(d(o)),o.onInput=o.onInput.bind(d(o)),o}return o(n,[{key:"editCell",value:function(e,t){this._modeling.editCell(e,t)}},{key:"onClick",value:function(){var e=this.props.context.element,t=BE();this.setState({date:t}),this.editCell(e.businessObject,'time("'.concat(t,'")'))}},{key:"onInput",value:function(e){var t=e.value,n=this.props.context.element;this.setState({date:t}),this.debouncedEditCell(n.businessObject,'time("'.concat(t,'")'))}},{key:"render",value:function(){var e=this,t=this.state.date;return Gv(1,"div","context-menu-container simple-time-edit",[Gv(1,"h3","dms-heading",this._translate("Edit Date"),0),Gv(1,"h4","dms-heading",this._translate("Set Date"),0),Gv(1,"div",null,[Kv(2,fx,{onInput:this.onInput,placeholder:this._translate("e.g. { example } ",{example:pC()}),validate:function(t){return AE(t)&&e._translate(AE(t))},value:t,className:"dms-block"}),Gv(1,"p","dms-hint",[this._translate("Set date"),Xv(" "),Gv(1,"button","use-now",this._translate("to now"),0,{type:"button",onClick:this.onClick}),Xv(".")],0)],4)],4)}}]),n}(ug),UE=o((function e(t,n){i(this,e),n.registerProvider((function(e){var t=HE(e);return($n(e.col)||Vn(e.col))&&WE(t)})),t.onGetComponent("context-menu",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;var t=HE(e.element);if(WE(t)){if($n(e.element.col))return zE;if(Vn(e.element.col))return FE}}}))}));function HE(e){return $n(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function WE(e){return"time"===e}UE.$inject=["components","simpleMode"];var qE={__depends__:[Dx,eC],__init__:["simpleTimeEdit"],simpleTimeEdit:["type",UE]};function GE(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var KE=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),GE(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),GE(d(o),"handleMouseDown",(function(e){!function(e){var t=e.node,n=e.event,i=e.minWidth,r=e.onEnd,o=void 0===r?XE:r;n.preventDefault();var a,s=t.getBoundingClientRect().width,u=n.clientX;function c(e){e.preventDefault();var n=d(e.clientX);a&&cancelAnimationFrame(a),a=requestAnimationFrame((function(){t.style.width=n+"px"}))}function l(e){e.preventDefault(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",l);var t=d(e.clientX);o(t)}function d(e){var t=e-u;return Math.max(s+t,i)}document.addEventListener("mousemove",c),document.addEventListener("mouseup",l)}({node:un(e.target,"th",!1),event:e,minWidth:o.props.minWidth||150,onEnd:o.saveWidth})})),GE(d(o),"saveWidth",(function(e){var t=o.props.col,n={};Ln(t,"dmn:DecisionTable")?n.annotationsWidth=e:n.width=e,o.modeling.updateProperties(t,n)})),Sg(d(o)),o}return o(n,[{key:"componentDidMount",value:function(){var e=this.getRoot();this.changeSupport.onElementsChanged(e,this.onElementsChanged)}},{key:"componentWillUnmount",value:function(){var e=this.getRoot();this.changeSupport.offElementsChanged(e,this.onElementsChanged)}},{key:"getRoot",value:function(){return this.sheet.getRoot()}},{key:"isLastInputOrOutput",value:function(){var e=this.props.col,t=zn(this.getRoot());if(Ln(e,"dmn:InputClause")){var n=t.get("input");return n.indexOf(e)===n.length-1}if(Ln(e,"dmn:OutputClause")){var i=t.get("output");return i.indexOf(e)===i.length-1}}},{key:"render",value:function(){var e=this.isLastInputOrOutput()?{right:"-7px",width:"27px"}:null;return Gv(1,"div","resize-column-handle",null,1,{onMouseDown:this.handleMouseDown,title:this.translate("Resize"),style:e})}}]),n}(ug);function XE(){}function YE(e){e.onGetComponent("cell-inner",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.cellType;if("input-cell"===t||"output-cell"===t||"annotations"===t)return KE}))}KE.$inject=["sheet","changeSupport","translate","modeling"],YE.$inject=["components"];var ZE={__init__:["columnResizeProvider"],columnResizeProvider:["type",YE]},QE=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"getModules",value:function(){return[].concat(y(My._getModules()),y(n._getModules()))}}],[{key:"_getModules",value:function(){return[W_,ub,v_,mb,L_,xb,jb,Db,Ab,H_,Rx,ZE,qx,ew,nw,ly,Dx,cw,U_,vw,Fy,Hw,Kw,$y,eC,oC,xC,BC,rE,bE,DE,qE]}}]),n}(My),JE=function(){function e(t){var n=this;i(this,e),this._listeners={},t.on("elements.changed",(function(e){var t=e.elements;n.elementsChanged(t)})),t.on("element.updateId",(function(e){var t=e.element,i=e.newId;n.updateId(t.id,i)}))}return o(e,[{key:"elementsChanged",value:function(e){for(var t={},n=e.length,i=0;i<n;i++){var r=e[i].id;if(t[r])return;t[r]=!0;var o=this._listeners[r]&&this._listeners[r].length;if(o)for(var a=0;a<o;a++)this._listeners[r][a]&&this._listeners[r][a]()}}},{key:"onElementsChanged",value:function(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e][this._listeners[e].length]=t}},{key:"offElementsChanged",value:function(e,t){if(this._listeners[e])if(t){var n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}else this._listeners[e].length=0}},{key:"updateId",value:function(e,t){this._listeners[e]&&(this._listeners[t]=this._listeners[e],delete this._listeners[e])}}]),e}();JE.$inject=["eventBus"];var ek=function(){function e(){i(this,e),this._listeners={}}return o(e,[{key:"getComponent",value:function(e,t){var n=this._listeners[e];if(n){for(var i,r=0;r<n.length&&!(i=n[r].callback(t));r++);return i}}},{key:"getComponents",value:function(e,t){var n=this._listeners[e];if(n){for(var i=[],r=0;r<n.length;r++){var o=n[r].callback(t);o&&i.push(o)}if(i.length)return i}}},{key:"onGetComponent",value:function(e,t,n){if(R(t)&&(n=t,t=1e3),!D(t))throw new Error("priority must be a number");var i,r,o=this._getListeners(e),a={priority:t,callback:n};for(r=0;i=o[r];r++)if(i.priority<t)return void o.splice(r,0,a);o.push(a)}},{key:"offGetComponent",value:function(e,t){var n,i,r=this._getListeners(e);if(t)for(i=r.length-1;n=r[i];i--)n.callback===t&&r.splice(i,1);else r.length=0}},{key:"_getListeners",value:function(e){var t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}]),e}(),tk=function(e){s(n,e);var t=h(n);function n(e){var r;i(this,n);var o=(r=t.call(this,e))._injector=e.injector;return r._changeSupport=o.get("changeSupport"),r._components=o.get("components"),r._renderer=o.get("renderer"),r}return o(n,[{key:"getChildContext",value:function(){return{changeSupport:this._changeSupport,components:this._components,renderer:this._renderer,injector:this._injector}}},{key:"render",value:function(){var e=this._components.getComponents("viewer");return Gv(1,"div","viewer-container",e&&e.map((function(e,t){return Kv(2,e,null,t)})),0)}}]),n}(ug),nk=function(){function e(t,n,r,o,a){i(this,e);var s=r.container;this._container=s,o.on("renderer.mount",(function(){ig(Kv(2,tk,{injector:a}),s)})),o.on("renderer.unmount",(function(){ig(null,s)}))}return o(e,[{key:"getContainer",value:function(){return this._container}}]),e}();nk.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var ik={__init__:["changeSupport","components","renderer"],changeSupport:["type",JE],components:["type",ek],eventBus:["type",re],renderer:["type",nk]},rk=["modules"];function ok(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var ak=function(){function e(){i(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.injector;if(!n){var r=this._init(t),o=r.modules,a=r.config;n=sk(a,o)}this.get=n.get,this.invoke=n.invoke,this.get("eventBus").fire("viewer.init")}return o(e,[{key:"_init",value:function(e){return{modules:e.modules,config:ok(e,rk)}}},{key:"destroy",value:function(){this.get("eventBus").fire("viewer.destroy")}},{key:"clear",value:function(){this.get("eventBus").fire("viewer.clear")}}]),e}();function sk(e,t){var n=new Jn([{config:["value",e]},ik].concat(t||[]));return n.init(),n}var uk=function(){function e(t,n){i(this,e),this._eventBus=n,this._viewer=t}return o(e,[{key:"getDecision",value:function(){return this._viewer.getDecision()}},{key:"updateId",value:function(e,t){if(e!==this.getDecision())throw new Error("element !== decision");this._eventBus.fire("element.updateId",{element:e,newId:t}),e.id=t}}]),e}();uk.$inject=["viewer","eventBus"];var ck={__init__:["elementRegistry"],elementRegistry:["type",uk]},lk=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._viewer=r.injector.get("viewer"),o}return o(n,[{key:"render",value:function(){return Gv(1,"div","decision-properties",Gv(1,"h3","decision-name",this._viewer.getDecision().name,0),2)}}]),n}(ug),dk=o((function e(t){i(this,e),t.onGetComponent("viewer",1500,(function(){return lk}))}));dk.$inject=["components"];var pk={__init__:["decisionProperties"],decisionProperties:["type",dk]},hk=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._viewer=r.injector.get("viewer"),o}return o(n,[{key:"render",value:function(){var e=this._viewer.getDecision(),t=e.decisionLogic,n=e.variable;return Gv(1,"div","literal-expression-properties",Gv(1,"table",null,[Gv(1,"tr",null,[Gv(1,"td",null,this._translate("Variable Name:"),0),Gv(1,"td",null,Gv(1,"span",null,n.name||"-",0),2)],4),Gv(1,"tr",null,[Gv(1,"td",null,this._translate("Variable Type:"),0),Gv(1,"td",null,Gv(1,"span",null,this._translate(n.typeRef||"")||"-",0),2)],4),Gv(1,"tr",null,[Gv(1,"td",null,this._translate("Expression Language:"),0),Gv(1,"td",null,Gv(1,"span",null,t.expressionLanguage||"-",0),2)],4)],4),2)}}]),n}(ug),fk=o((function e(t){i(this,e),t.onGetComponent("viewer",500,(function(){return hk}))}));fk.$inject=["components"];var vk={__depends__:[],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",fk]};function mk(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var gk=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),mk(d(o=t.call(this,e,r)),"onClick",(function(){o._eventBus.fire("poweredBy.show")}));var a=r.injector;return o._eventBus=a.get("eventBus"),o}return o(n,[{key:"render",value:function(){var e=this;return Gv(1,"div","powered-by",Gv(1,"div","powered-by__logo",Kv(2,ky),2),2,{onClick:this.onClick,title:"Powered by bpmn.io"},null,(function(t){return e.node=t}))}}]),n}(ug),yk=function(e){s(n,e);var t=h(n);function n(e){var r;return i(this,n),(r=t.call(this,e)).state={show:!1},r.onClick=r.onClick.bind(d(r)),r.onShow=r.onShow.bind(d(r)),r}return o(n,[{key:"onClick",value:function(){this.setState({show:!1})}},{key:"onShow",value:function(){this.setState({show:!0})}},{key:"componentWillMount",value:function(){(this._eventBus=this.context.injector.get("eventBus")).on("poweredBy.show",this.onShow)}},{key:"componentWillUnmount",value:function(){this._eventBus.off("poweredBy.show",this.onShow)}},{key:"render",value:function(){return this.state.show&&Gv(1,"div","powered-by-overlay",Gv(1,"div","powered-by-overlay-content",[Gv(1,"a","logo",Kv(2,ky),2,{href:"https://bpmn.io",target:"_blank",rel:"noopener"}),Gv(1,"span",null,[Xv("Web-based tooling for BPMN, DMN and CMMN diagrams powered by "),Gv(1,"a",null,Xv("bpmn.io"),2,{href:"http://bpmn.io",target:"_blank"}),Xv(".")],4)],4,{onClick:function(e){return e.stopPropagation()}}),2,{onClick:this.onClick})}}]),n}(ug),_k=o((function e(t,n){i(this,e),t.onGetComponent("viewer",2e3,(function(){return gk})),t.onGetComponent("viewer",(function(){return yk}))}));_k.$inject=["components","eventBus"];var bk={__init__:["poweredBy"],poweredBy:["type",_k]},xk=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._viewer=r.injector.get("viewer"),o}return o(n,[{key:"render",value:function(){return Gv(1,"div","textarea",Gv(1,"div","content",this._viewer.getDecision().decisionLogic.text,0),2)}}]),n}(ug),wk=o((function e(t){i(this,e),t.onGetComponent("viewer",(function(){return xk}))}));wk.$inject=["components"];var Ck={__init__:["textarea"],textarea:["type",wk]};function Ek(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var kk=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),Ek(d(o=t.call(this,e,r)),"onClick",(function(){o._eventBus.fire("showDrd")}));var a=r.injector;return o._translate=a.get("translate"),o._eventBus=a.get("eventBus"),o}return o(n,[{key:"render",value:function(){var e=this;return Gv(1,"div","view-drd",Gv(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(function(t){return e.node=t}))}}]),n}(ug);kk.$inject=["translate"];var Sk=function(){function e(t,n,r,o){var a=this;i(this,e),this._injector=o,this._viewer=n,t.onGetComponent("viewer",2e3,(function(){if(a.canViewDrd())return kk})),r.on("showDrd",(function(){var e=o.get("_parent",!1),t=a.getDefinitions(),n=e.getView(t);e.open(n)}))}return o(e,[{key:"canViewDrd",value:function(){var e=this._injector.get("_parent",!1);if(e){var t=this.getDefinitions();return!!e.getView(t)}}},{key:"getDefinitions",value:function(){return this._viewer.getDecision().$parent}}]),e}();Sk.$inject=["components","viewer","eventBus","injector"];var jk={__init__:["viewDrd"],viewDrd:["type",Sk]},Ok=["modules","additionalModules"];function Pk(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var Dk=function(e){s(n,e);var t=h(n);function n(){var e;i(this,n);var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n._createContainer();return(e=t.call(this,J(r,{renderer:{container:o}})))._container=o,e}return o(n,[{key:"open",value:function(e){var t=this;return new Promise((function(n,i){var r;try{t._decision&&(t.clear(),t.get("eventBus").fire("renderer.unmount")),t._decision=e,t.get("eventBus").fire("import",e),t.get("eventBus").fire("renderer.mount")}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):n({warnings:[]})}))}},{key:"_init",value:function(e){var t=e.modules,n=e.additionalModules,i=Pk(e,Ok),r=t||this.getModules(),o=n||[],a=[{viewer:["value",this]}];return{modules:[].concat(y(r),y(o),a),config:i}}},{key:"on",value:function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)}},{key:"off",value:function(e,t){this.get("eventBus").off(e,t)}},{key:"_emit",value:function(e,t){return this.get("eventBus").fire(e,t)}},{key:"getDecision",value:function(){return this._decision}},{key:"attachTo",value:function(e){if(!e)throw new Error("parentNode required");this.detach(),e.appendChild(this._container),this._emit("attach",{})}},{key:"detach",value:function(){var e=this._container;e.parentNode&&(this._emit("detach",{}),En(e))}},{key:"destroy",value:function(){v(u(n.prototype),"destroy",this).call(this),this.detach()}},{key:"getModules",value:function(){return n._getModules()}}],[{key:"_getModules",value:function(){return[ck,Jo,pk,vk,bk,Ck,jk]}},{key:"_createContainer",value:function(){return xn('<div class="dmn-literal-expression-container"></div>')}}]),n}(ak);function Rk(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Tk=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),Rk(d(o=t.call(this,e,r)),"onElementsChanged",(function(){o.forceUpdate()})),Rk(d(o),"setDecisionName",(function(e){o._modeling.editDecisionName(e)})),o._viewer=r.injector.get("viewer"),o._modeling=r.injector.get("modeling"),o.setupChangeListeners({bind:o.getDecision().id}),o}return o(n,[{key:"componentWillUnmount",value:function(){this.setupChangeListeners({unbind:this.getDecision().id})}},{key:"getDecision",value:function(){return this._viewer.getDecision()}},{key:"setupChangeListeners",value:function(e){var t=e.bind,n=e.unbind,i=this.context.changeSupport;"string"==typeof n&&i.offElementsChanged(n,this.onElementsChanged),"string"==typeof t&&i.onElementsChanged(t,this.onElementsChanged)}},{key:"render",value:function(){var e=this.getDecision().name;return Gv(1,"header","decision-properties",Kv(2,Mk,{className:"decision-name editor",value:e,onBlur:Ik,onChange:this.setDecisionName}),2)}}]),n}(ug),Mk=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"render",value:function(){return Gv(1,"h3",this.getClassName(),this.getEditor(),0)}}]),n}(tb);function Ik(e){e.target.scroll(0,0)}var Ak=o((function e(t){i(this,e),t.onGetComponent("viewer",1500,(function(){return Tk}))}));Ak.$inject=["components"];var Nk={__depends__:[sb],__init__:["decisionProperties"],decisionProperties:["type",Ak]},Bk="is not a registered action",Lk=function(){function e(t,n){i(this,e),this._actions={undo:function(){t.undo()},redo:function(){t.redo()}}}return o(e,[{key:"trigger",value:function(e,t){if(!this._actions[e])throw $k(e,Bk);return this._actions[e](t)}},{key:"register",value:function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);N(e,(function(e,t){n._registerAction(t,e)}))}},{key:"_registerAction",value:function(e,t){if(this.isRegistered(e))throw $k(e,"is already registered");this._actions[e]=t}},{key:"unregister",value:function(e){if(!this.isRegistered(e))throw $k(e,Bk);this._actions[e]=void 0}},{key:"isRegistered",value:function(e){return!!this._actions[e]}}]),e}();function $k(e,t){return new Error(e+" "+t)}Lk.$inject=["commandStack","eventBus"];var Vk={__init__:["editorActions"],editorActions:["type",Lk]};function zk(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Fk(e){return e.shiftKey}function Uk(e,t,i){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Hk=function(){function e(t,n,r){var o=this;i(this,e),Uk(this,"_init",(function(){o._registerDefaultBindings(),o._fire("init")})),Uk(this,"_destroy",(function(){o._fire("destroy"),o.unbind(),o._listeners=null})),Uk(this,"_keyHandler",(function(e){var t,n,i=o._listeners,r=e.keyCode||e.charCode||-1;for(t=0;n=i[t];t++)if(n(r,e))return e.preventDefault(),void e.stopPropagation()})),Uk(this,"unbind",(function(){var e=o._node;e&&(o._fire("unbind"),fn.unbind(e,"keydown",o._keyHandler,!0)),o._node=null})),this._config=t||{},this._eventBus=n,this._editorActions=r,this._listeners=[],n.on("viewer.destroy",this._destroy),n.on("viewer.init",this._init),n.on("attach",(function(){o._config.bindTo&&o.bind(t.bindTo)})),n.on("detach",this.unbind)}return o(e,[{key:"bind",value:function(e){this.unbind(),this._node=e,fn.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")}},{key:"getBinding",value:function(){return this._node}},{key:"_fire",value:function(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})}},{key:"_registerDefaultBindings",value:function(){var e=this._listeners,t=this._editorActions;e.push((function(e,n){if(zk(n)&&!Fk(n)&&90===e)return t.trigger("undo"),!0})),e.push((function(e,n){if(zk(n)&&(89===e||90===e&&Fk(n)))return t.trigger("redo"),!0}))}},{key:"addListener",value:function(e){this._listeners.unshift(e)}},{key:"removeListener",value:function(e){this._listeners=this._listeners.filter((function(t){return t!==e}))}}]),e}();Hk.$inject=["config.keyboard","eventBus","editorActions"];var Wk={__depends__:[Vk],__init__:["keyboard"],keyboard:["type",Hk]},qk=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._viewer=r.injector.get("viewer"),o._modeling=r.injector.get("modeling"),o._dataTypes=r.injector.get("dataTypes");var a=o._viewer.getDecision();return o.state={name:a.variable.name,typeRef:a.variable.typeRef},o.setVariableName=o.setVariableName.bind(d(o)),o.setVariableType=o.setVariableType.bind(d(o)),o}return o(n,[{key:"setVariableName",value:function(e){this._modeling.editVariableName(e),this.setState({name:e})}},{key:"setVariableType",value:function(e){""===e?(this._modeling.editVariableType(void 0),this.setState({typeRef:void 0})):(this._modeling.editVariableType(e),this.setState({typeRef:e}))}},{key:"render",value:function(){var e=this,t=this.state,n=t.name,i=t.typeRef,r=this._dataTypes.getAll().map((function(t){return{label:e._translate(t),value:t}}));return Gv(1,"div","literal-expression-properties",Gv(1,"table",null,[Gv(1,"tr",null,[Gv(1,"td",null,this._translate("Variable Name:"),0),Gv(1,"td",null,Kv(2,$b,{className:"variable-name-input",onInput:this.setVariableName,placeholder:"name",value:n||""}),2)],4),Gv(1,"tr",null,[Gv(1,"td",null,this._translate("Variable Type:"),0),Gv(1,"td",null,Gv(1,"div","dms-fill-row",Kv(2,ox,{onChange:this.setVariableType,options:r,value:i,className:"variable-type-select dms-block"}),2),2)],4),Kv(2,Gk)],4),2)}}]),n}(ug),Gk=function(e){s(n,e);var t=h(n);function n(e,r){var o;return i(this,n),(o=t.call(this,e,r))._translate=r.injector.get("translate"),o._viewer=r.injector.get("viewer"),o._modeling=r.injector.get("modeling"),o._expressionLanguages=r.injector.get("expressionLanguages"),o.setExpressionLanguage=o.setExpressionLanguage.bind(d(o)),o}return o(n,[{key:"setExpressionLanguage",value:function(e){""===e?this._modeling.editExpressionLanguage(void 0):this._modeling.editExpressionLanguage(e)}},{key:"_getExpressionLanguage",value:function(){var e=this._viewer.getDecision().decisionLogic;return e&&e.expressionLanguage?e.expressionLanguage.toLowerCase():this._getDefaultExpressionLanguage()}},{key:"_getDefaultExpressionLanguage",value:function(){return this._expressionLanguages.getDefault().value}},{key:"_shouldRender",value:function(){return this._expressionLanguages.getAll().length>1||this._getExpressionLanguage()!==this._getDefaultExpressionLanguage()}},{key:"render",value:function(){if(!this._shouldRender())return null;var e=this._getExpressionLanguage(),t=this._expressionLanguages.getAll();return Gv(1,"tr",null,[Gv(1,"td",null,this._translate("Expression Language:"),0),Gv(1,"td",null,Gv(1,"div","dms-fill-row",Kv(2,ox,{onChange:this.setExpressionLanguage,options:t,value:e,className:"expression-language-select dms-block"}),2),2)],4)}}]),n}(ug),Kk=o((function e(t){i(this,e),t.onGetComponent("viewer",500,(function(){return qk}))}));Kk.$inject=["components"];var Xk={__depends__:[sb,Wk,ly,Pb],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",Kk]},Yk=function(){function e(t,n,r){var o=this;i(this,e),this._commandStack=t,this._viewer=n,this._eventBus=r,r.on("viewer.init",(function(){!function(e,t){N(e,(function(e,n){t.registerHandler(n,e)}))}(o.getHandlers(),t)}))}return o(e,[{key:"getHandlers",value:function(){return e._getHandlers()}},{key:"getDecision",value:function(){return this._viewer.getDecision()}},{key:"editDecisionName",value:function(e){var t={element:this.getDecision(),properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}},{key:"editDecisionId",value:function(e){var t={element:this.getDecision(),properties:{id:e}};this._commandStack.execute("element.updateProperties",t)}},{key:"editLiteralExpressionText",value:function(e){var t={element:this.getDecision().decisionLogic,properties:{text:e}};this._commandStack.execute("element.updateProperties",t)}},{key:"editExpressionLanguage",value:function(e){var t={element:this.getDecision().decisionLogic,properties:{expressionLanguage:e}};this._commandStack.execute("element.updateProperties",t)}},{key:"editVariableName",value:function(e){var t={element:this.getDecision().variable,properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}},{key:"editVariableType",value:function(e){var t={element:this.getDecision().variable,properties:{typeRef:e}};this._commandStack.execute("element.updateProperties",t)}}],[{key:"_getHandlers",value:function(){return{"element.updateProperties":Lw}}}]),e}();Yk.$inject=["commandStack","viewer","eventBus"];var Zk={__init__:["idChangeBehavior","modeling"],commandStack:["type",mp],idChangeBehavior:["type",Bp],modeling:["type",Yk]},Qk=function(e){s(n,e);var t=h(n);function n(e,r){var o;i(this,n),(o=t.call(this,e,r))._modeling=r.injector.get("modeling"),o._viewer=r.injector.get("viewer"),o.editLiteralExpressionText=o.editLiteralExpressionText.bind(d(o)),o.onElementsChanged=o.onElementsChanged.bind(d(o));var a=o.getLiteralExpression().id;return r.changeSupport.onElementsChanged(a,o.onElementsChanged),o}return o(n,[{key:"getLiteralExpression",value:function(){return this._viewer.getDecision().decisionLogic}},{key:"onElementsChanged",value:function(){this.forceUpdate()}},{key:"editLiteralExpressionText",value:function(e){this._modeling.editLiteralExpressionText(e)}},{key:"render",value:function(){var e=this.getLiteralExpression().text;return Kv(2,Jk,{className:"textarea editor",value:e,onChange:this.editLiteralExpressionText})}}]),n}(ug),Jk=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"render",value:function(){return Gv(1,"div",this.getClassName(),this.getEditor(),0)}}]),n}(tb),eS=o((function e(t){i(this,e),t.onGetComponent("viewer",(function(){return Qk}))}));eS.$inject=["components"];var tS={__depends__:[sb],__init__:["textarea"],textarea:["type",eS]},nS=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"getModules",value:function(){return[].concat(y(Dk._getModules()),y(n._getModules()))}}],[{key:"_getModules",value:function(){return[Nk,Wk,Xk,Zk,ly,Db,tS]}}]),n}(Dk),iS=function(e){s(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return o(n,[{key:"_getViewProviders",value:function(){return[{id:"drd",constructor:hv,opens:"dmn:Definitions"},{id:"decisionTable",constructor:QE,opens:function(e){return Ln(e,"dmn:Decision")&&Ln(e.decisionLogic,"dmn:DecisionTable")}},{id:"literalExpression",constructor:nS,opens:function(e){return Ln(e,"dmn:Decision")&&Ln(e.decisionLogic,"dmn:LiteralExpression")}}]}},{key:"_getInitialView",value:function(e){for(var t,i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];var a=(t=v(u(n.prototype),"_getInitialView",this)).call.apply(t,[this,e].concat(r));if(a){var s=a.element;return Ln(s,"dmn:Definitions")&&!Vd(s)&&(a=I(e,(function(e){return!Ln(e.element,"dmn:Definitions")}))||a),a}}}]),n}(Un);return iS}));
24