camunda-dmn-js
Version:
Embeddable Camunda modeling distributions based on dmn-js
188 lines • 1.25 MB
JavaScript
!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).DmnModeler=t()}(this,(function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function t(e,t,n){return t=r(t),function(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 function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],r(e).constructor):t.apply(e,n))}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,n){return t&&function(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,h(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!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 l(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){o(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 c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?e(t,n):void 0}}(t)||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 h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}const d=Object.prototype.toString,p=Object.prototype.hasOwnProperty;function f(e){return void 0===e}function g(e){return void 0!==e}function m(e){return null==e}function v(e){return"[object Array]"===d.call(e)}function y(e){return"[object Object]"===d.call(e)}function b(e){return"[object Number]"===d.call(e)}function _(e){const t=d.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function x(e){return"[object String]"===d.call(e)}function O(e,t){return!m(e)&&p.call(e,t)}function w(e,t){const n=Q(t);let i;return k(e,(function(e,t){if(n(e,t))return i=e,!1})),i}function C(e,t){const n=Q(t);let i=[];return k(e,(function(e,t){n(e,t)&&i.push(e)})),i}function k(e,t){let n,i;if(f(e))return;const o=v(e)?B:j;for(let r in e)if(O(e,r)&&(n=e[r],i=t(n,o(r)),!1===i))return n}function E(e,t,n){return k(e,(function(e,i){n=t(n,e,i)})),n}function S(e,t){return!!E(e,(function(e,n,i){return e&&t(n,i)}),!0)}function $(e,t){return!!w(e,t)}function P(e,t){let n=[];return k(e,(function(e,i){n.push(t(e,i))})),n}function T(e){return e&&Object.keys(e)||[]}function R(e){return P(e,(e=>e))}function A(e,t,n={}){return t=I(t),k(e,(function(e){let i=t(e)||"_",o=n[i];o||(o=n[i]=[]),o.push(e)})),n}function M(e,...t){e=I(e);let n={};return k(t,(t=>A(t,e,n))),P(n,(function(e,t){return e[0]}))}function D(e,t){t=I(t);let n=[];return k(e,(function(e,i){let o=t(e,i),r={d:o,v:e};for(var s=0;s<n.length;s++){let{d:e}=n[s];if(o<e)return void n.splice(s,0,r)}n.push(r)})),P(n,(e=>e.v))}function L(e){return function(t){return S(e,(function(e,n){return t[n]===e}))}}function I(e){return _(e)?e:t=>t[e]}function Q(e){return _(e)?e:t=>t===e}function j(e){return e}function B(e){return Number(e)}function N(e,t){let n,i,o,r;function s(n){let s=Date.now(),c=n?0:r+t-s;if(c>0)return a(c);e.apply(o,i),l()}function a(e){n=setTimeout(s,e)}function l(){n&&clearTimeout(n),n=r=i=o=void 0}function c(...e){r=Date.now(),i=e,o=this,n||a(t)}return c.flush=function(){n&&s(!0),l()},c.cancel=l,c}function q(e,t){return e.bind(t)}function F(e,...t){return Object.assign(e,...t)}function V(e,t,n){let i=e;return k(t,(function(e,o){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+typeof e+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");let r=t[o+1],s=i[e];g(r)&&m(s)&&(s=i[e]=isNaN(+r)?{}:[]),f(r)?f(n)?delete i[e]:i[e]=n:i=s})),e}function X(e,t){let n={},i=Object(e);return k(t,(function(t){t in i&&(n[t]=e[t])})),n}function z(e,t){let n={};return k(Object(e),(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}var Y="__fn",W=Array.prototype.slice;function H(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function U(){}function G(){}function Z(e,t){this.model=e,this.properties=t}H.prototype.on=function(e,t,n,i){if(e=v(e)?e:[e],_(t)&&(i=n,n=t,t=1e3),!b(t))throw new Error("priority must be a number");var o=n;i&&((o=q(n,i))[Y]=n[Y]||n);var r=this;e.forEach((function(e){r._addListener(e,{priority:t,callback:o,next:null})}))},H.prototype.once=function(e,t,n,i){var o=this;if(_(t)&&(i=n,n=t,t=1e3),!b(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var t=n.apply(i,arguments);return o.off(e,r),t}r[Y]=n,this.on(e,t,r)},H.prototype.off=function(e,t){e=v(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},H.prototype.createEvent=function(e){var t=new U;return t.init(e),t},H.prototype.fire=function(e,t){var n,i,o,r;if(r=W.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof U?t:this.createEvent(t),r[0]=n;var s=n.type;e!==s&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==s&&(n.type=s)}return void 0===o&&n.defaultPrevented&&(o=!1),o}},H.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},H.prototype._destroy=function(){this._listeners={}},H.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},H.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},H.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)},H.prototype._getListeners=function(e){return this._listeners[e]},H.prototype._setListeners=function(e,t){this._listeners[e]=t},H.prototype._removeListener=function(e,t){var n,i,o,r=this._getListeners(e);if(t)for(;r;)n=r.next,(o=r.callback)!==t&&o[Y]!==t||(i?i.next=n:this._setListeners(e,n)),i=r,r=n;else this._setListeners(e,null)},U.prototype.stopPropagation=function(){this.cancelBubble=!0},U.prototype.preventDefault=function(){this.defaultPrevented=!0},U.prototype.init=function(e){F(this,e||{})},G.prototype.get=function(e){return this.$model.properties.get(this,e)},G.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},Z.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(G.prototype);k(e.properties,(function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)})),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(e){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),k(e,q((function(e,t){this.set(t,e)}),this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var K={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},J={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 ee(e,t){var n=J[e];return n?n(t):t}function te(e){return!!K[e]}function ne(e){return!!J[e]}function ie(e,t){var n,i,o=e.split(/:/);if(1===o.length)n=e,i=t;else{if(2!==o.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=o[1],i=o[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function oe(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function re(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,k(e,q(this.registerPackage,this))}function se(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function ae(e){this.model=e}function le(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ce(e){return e.replace(/^:/,"")}function ue(e,t={}){this.properties=new ae(this),this.factory=new Z(this,this.properties),this.registry=new re(e,this.properties),this.typeCache={},this.config=t}oe.prototype.build=function(){return X(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},oe.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)},oe.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=this.propertiesByName,s=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 a=o.indexOf(e);if(-1===a)throw new Error("property <"+i.name+"> not found in property list");o.splice(a,1),this.addProperty(t,n?void 0:a,s),r[i.name]=r[i.localName]=t},oe.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=ie(o[0],i),s=ie(o[1],r.prefix).name,a=this.propertiesByName[s];if(!a)throw new Error("refined property <"+s+"> not found");this.replaceProperty(a,e,n),delete e.redefines},oe.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},oe.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},oe.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},oe.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},oe.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},oe.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")},oe.prototype.hasProperty=function(e){return this.propertiesByName[e]},oe.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(k(e.properties,q((function(n){n=F({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,o=n.redefines;i||o?this.redefineProperty(n,i||o,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[o]=e)},re.prototype.getPackage=function(e){return this.packageMap[e]},re.prototype.getPackages=function(){return this.packages},re.prototype.registerPackage=function(e){e=F({},e);var t=this.packageMap;se(t,e,"prefix"),se(t,e,"uri"),k(e.types,q((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},re.prototype.registerType=function(e,t){var n=ie((e=F({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:F(e.meta||{})})).name,t.prefix),i=n.name,o={};k(e.properties,q((function(e){var t=ie(e.name,n.prefix),i=t.name;te(e.type)||(e.type=ie(e.type,t.prefix).name),F(e,{ns:t,name:i}),o[i]=e}),this)),F(e,{ns:n,name:i,propertiesByName:o}),k(e.extends,q((function(e){var t=ie(e,n.prefix),o=this.typeMap[t.name];o.traits=o.traits||[],o.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},re.prototype.mapTypes=function(e,t,n){var i=te(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(n,i){var r=ie(n,te(n)?"":e.prefix);o.mapTypes(r,t,i)}function s(e){return r(e,!0)}if(!i)throw new Error("unknown type <"+e.name+">");k(i.superClass,n?s:function(e){return r(e,!1)}),t(i,!n),k(i.traits,s)},re.prototype.getEffectiveDescriptor=function(e){var t=ie(e),n=new oe(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},re.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},ae.prototype.set=function(e,t,n){if(!x(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;void 0===n?i?delete e[o]:delete e.$attrs[ce(t)]:i?o in e?e[o]=n:le(e,i,n):e.$attrs[ce(t)]=n},ae.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ce(t)];var i=n.name;return!e[i]&&n.isMany&&le(e,n,[]),e[i]},ae.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;delete(n=F({},n,{get:function(){return i}})).value}Object.defineProperty(e,t,n)},ae.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},ae.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},ae.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(void 0!==o){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw n;"undefined"!=typeof console&&console.warn(n)}return null},ue.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},ue.prototype.getType=function(e){var t=this.typeCache,n=x(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},ue.prototype.createAny=function(e,t,n){var i=ie(e),o={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){V(this,[e],t)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),k(n,(function(e,t){y(e)&&void 0!==e.value?o[e.name]=e.value:o[t]=e})),o},ue.prototype.getPackage=function(e){return this.registry.getPackage(e)},ue.prototype.getPackages=function(){return this.registry.getPackages()},ue.prototype.getElementDescriptor=function(e){return e.$descriptor},ue.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},ue.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},ue.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var he=String.fromCharCode,de=Object.prototype.hasOwnProperty,pe=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,fe={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function ge(e,t,n,i){return i?de.call(fe,i)?fe[i]:"&"+i+";":he(t||parseInt(n,16))}function me(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(pe,ge):e}Object.keys(fe).forEach((function(e){fe[e.toUpperCase()]=fe[e]}));var ve="non-whitespace outside of root node";function ye(e){return new Error(e)}function be(e){return"missing namespace for prefix <"+e+">"}function _e(e){return{get:e,enumerable:!0}}function xe(e){var t,n={};for(t in e)n[t]=e[t];return n}function Oe(e){return e+"$uri"}function we(){return{line:0,column:0}}function Ce(e){throw e}function ke(e){if(!this)return new ke(e);var t,n,i,o,r,s,a,l,c,u=e&&e.proxy,h=Ce,d=we,p=!1,f=!1,g=null,m=!1;function v(e){e instanceof Error||(e=ye(e)),g=e,h(e,d)}function y(e){r&&(e instanceof Error||(e=ye(e)),r(e,d))}this.on=function(e,c){if("function"!=typeof c)throw ye("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":i=c;break;case"error":h=c;break;case"warn":r=c;break;case"cdata":o=c;break;case"attention":l=c;break;case"question":a=c;break;case"comment":s=c;break;default:throw ye("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw ye("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return f=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw ye("required args <xml=string>");return g=null,function(e){var r,h,g,b,_,x,O,w,C,k,E,S=f?[]:null,$=f?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Oe(n)]=t;return i}(c):null,P=[],T=0,R=!1,A=!1,M=0,D=0,L="",I=0;function Q(){if(null!==E)return E;var e,t,n,i,o,r,s,a,l,u,h,d=f&&$.xmlns,g=f&&p?[]:null,m=I,v=L,b=v.length,_={},x={};e:for(;m<b;m++)if(l=!1,!(32===(u=v.charCodeAt(m))||u<14&&u>8)){for((u<65||u>122||u>90&&u<97)&&95!==u&&58!==u&&(y("illegal first char attribute name"),l=!0),h=m+1;h<b;h++)if(!((u=v.charCodeAt(h))>96&&u<123||u>64&&u<91||u>47&&u<59||46===u||45===u||95===u)){if(32===u||u<14&&u>8){y("missing attribute value"),m=h;continue e}if(61===u)break;y("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(a=v.substring(m,h))&&(y("illegal declaration of xmlns"),l=!0),34===(u=v.charCodeAt(h+1)))-1===(h=v.indexOf('"',m=h+2))&&-1!==(h=v.indexOf("'",m))&&(y("attribute value quote missmatch"),l=!0);else if(39===u)-1===(h=v.indexOf("'",m=h+2))&&-1!==(h=v.indexOf('"',m))&&(y("attribute value quote missmatch"),l=!0);else for(y("missing attribute value quotes"),l=!0,h+=1;h<b&&!(32===(u=v.charCodeAt(h+1))||u<14&&u>8);h++);for(-1===h&&(y("missing closing quotes"),h=b,l=!0),l||(r=v.substring(m,h)),m=h;h+1<b&&!(32===(u=v.charCodeAt(h+1))||u<14&&u>8);h++)m===h&&(y("illegal character after attribute end"),l=!0);if(m=h+1,!l)if(a in x)y("attribute <"+a+"> already defined");else if(x[a]=!0,f)if(p){if(null!==(o="xmlns"===a?"xmlns":120===a.charCodeAt(0)&&"xmlns:"===a.substr(0,6)?a.substr(6):null)){if(e=me(r),t=Oe(o),!(s=c[e])){if("xmlns"===o||t in $&&$[t]!==e)do{s="ns"+T++}while(void 0!==$[s]);else s=o;c[e]=s}$[o]!==s&&(i||($=xe($),i=!0),$[o]=s,"xmlns"===o&&($[Oe(s)]=e,d=s),$[t]=e),_[a]=r;continue}g.push(a,r)}else-1!==(u=a.indexOf(":"))?(n=$[a.substring(0,u)])?_[a=d===n?a.substr(u+1):n+a.substr(u)]=r:y(be(a.substring(0,u))):_[a]=r;else _[a]=r}if(p)for(m=0,b=g.length;m<b;m++){if(a=g[m++],r=g[m],-1!==(u=a.indexOf(":"))){if(!(n=$[a.substring(0,u)])){y(be(a.substring(0,u)));continue}a=d===n?a.substr(u+1):n+a.substr(u)}_[a]=r}return E=_}function j(){for(var t,n,i=/(\r\n|\r|\n)/g,o=0,r=0,s=0,a=D;M>=s&&(t=i.exec(e))&&!((a=t[0].length+t.index)>M);)o+=1,s=a;return-1==M?(r=a,n=e.substring(D)):0===D?n=e.substring(D,M):(r=M-s,n=-1==D?e.substring(M):e.substring(M,D+1)),{data:n,line:o,column:r}}d=j,u&&(k=Object.create({},{name:_e((function(){return w})),originalName:_e((function(){return C})),attrs:_e(Q),ns:_e((function(){return $}))}));for(;-1!==D;){if(-1===(M=60===e.charCodeAt(D)?D:e.indexOf("<",D)))return P.length?v("unexpected end of file"):0===D?v("missing start tag"):void(D<e.length&&e.substring(D).trim()&&y(ve));if(D!==M)if(P.length){if(t&&(t(e.substring(D,M),me,d),m))return}else if(e.substring(D,M).trim()&&(y(ve),m))return;if(33===(_=e.charCodeAt(M+1))){if(91===(b=e.charCodeAt(M+2))&&"CDATA["===e.substr(M+3,6)){if(-1===(D=e.indexOf("]]>",M)))return v("unclosed cdata");if(o&&(o(e.substring(M+9,D),d),m))return;D+=3;continue}if(45===b&&45===e.charCodeAt(M+3)){if(-1===(D=e.indexOf("--\x3e",M)))return v("unclosed comment");if(s&&(s(e.substring(M+4,D),me,d),m))return;D+=3;continue}}if(63!==_){for(h=M+1;;h++){if(x=e.charCodeAt(h),isNaN(x))return D=-1,v("unclosed tag");if(34===x)h=-1!==(b=e.indexOf('"',h+1))?b:h;else if(39===x)h=-1!==(b=e.indexOf("'",h+1))?b:h;else if(62===x){D=h;break}}if(33!==_){if(E={},47===_){if(R=!1,A=!0,!P.length)return v("missing open tag");if(h=w=P.pop(),b=M+2+h.length,e.substring(M+2,b)!==h)return v("closing tag mismatch");for(;b<D;b++)if(!(32===(_=e.charCodeAt(b))||_>8&&_<14))return v("close tag")}else{if(47===e.charCodeAt(D-1)?(h=w=e.substring(M+1,D-1),R=!0,A=!0):(h=w=e.substring(M+1,D),R=!0,A=!1),!(_>96&&_<123||_>64&&_<91||95===_||58===_))return v("illegal first char nodeName");for(b=1,g=h.length;b<g;b++)if(!((_=h.charCodeAt(b))>96&&_<123||_>64&&_<91||_>47&&_<59||45===_||95===_||46==_)){if(32===_||_<14&&_>8){w=h.substring(0,b),E=null;break}return v("invalid nodeName")}A||P.push(w)}if(f){if(r=$,R&&(A||S.push(r),null===E&&(p=-1!==h.indexOf("xmlns",b))&&(I=b,L=h,Q(),p=!1)),C=w,-1!==(_=w.indexOf(":"))){if(!(O=$[w.substring(0,_)]))return v("missing namespace on <"+C+">");w=w.substr(_+1)}else O=$.xmlns;O&&(w=O+":"+w)}if(R&&(I=b,L=h,n&&(u?n(k,me,A,d):n(w,Q,me,A,d),m)))return;if(A){if(i&&(i(u?k:w,me,R,d),m))return;f&&($=R?r:S.pop())}D+=1}else{if(l&&(l(e.substring(M,D+1),me,d),m))return;D+=1}}else{if(-1===(D=e.indexOf("?>",M)))return v("unclosed question");if(a&&(a(e.substring(M,D+2),d),m))return;D+=2}}}(e),d=we,m=!1,g},this.stop=function(){m=!0}}function Ee(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Se={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},$e="property";function Pe(e){return e.xml&&e.xml.serialize}function Te(e,t){return Ee(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Re(e){return new Error(e)}function Ae(e){return e.$descriptor}function Me(e){F(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Re("expected element");var t,n=this.elementsById,i=Ae(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 Re("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function De(){}function Le(){}function Ie(){}function Qe(e,t){this.property=e,this.context=t}function je(e,t){this.element=t,this.propertyDesc=e}function Be(){}function Ne(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function qe(e,t,n){Ne.call(this,e,t,n)}function Fe(e,t,n){this.model=e,this.context=n}function Ve(e){e instanceof ue&&(e={model:e}),F(this,{lax:!1},e)}De.prototype.handleEnd=function(){},De.prototype.handleText=function(){},De.prototype.handleNode=function(){},Le.prototype=Object.create(De.prototype),Le.prototype.handleNode=function(){return this},Ie.prototype=Object.create(De.prototype),Ie.prototype.handleText=function(e){this.body=(this.body||"")+e},Qe.prototype=Object.create(Ie.prototype),Qe.prototype.handleNode=function(e){if(this.element)throw Re("expected no sub nodes");return this.element=this.createReference(e),this},Qe.prototype.handleEnd=function(){this.element.id=this.body},Qe.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},je.prototype=Object.create(Ie.prototype),je.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ee(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Be.prototype=Object.create(Ie.prototype),Be.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},Ne.prototype=Object.create(Be.prototype),Ne.prototype.addReference=function(e){this.context.addReference(e)},Ne.prototype.handleText=function(e){if(!Ae(this.element).bodyProperty)throw Re("unexpected body text <"+e+">");Ie.prototype.handleText.call(this,e)},Ne.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ae(t).bodyProperty;n&&void 0!==e&&(e=ee(n.type,e),t.set(n.name,e))},Ne.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,o=Ae(i),r=this.context,s=new i({}),a=this.model;return k(n,(function(e,n){var i=o.propertiesByName[n];i&&i.isReference?i.isMany?k(e.split(" "),(function(e){r.addReference({element:s,property:i.ns.name,id:e})})):r.addReference({element:s,property:i.ns.name,id:e}):(i?e=ee(i.type,e):"xmlns"===n?n=":"+n:(t=ie(n,o.ns.prefix),a.getPackage(t.prefix)&&r.addWarning({message:"unknown attribute <"+n+">",element:s,property:n,value:e})),s.set(n,e))})),s},Ne.prototype.getPropertyForNode=function(e){var t=ie(e.name),n=this.type,i=this.model,o=Ae(n),r=t.name,s=o.propertiesByName[r];if(s&&!s.isAttr){const t=function(e){const t=Pe(e);return t!==$e&&(t||null)}(s);if(t){const n=e.attributes[t];if(n){const t=function(e,t,n){const i=ie(e,t.xmlns),o=ie(`${t[i.prefix]||i.prefix}:${i.localName}`);return function(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&0===i.indexOf(o)?e.prefix+":"+i.slice(o.length):n}(o,n.getPackage(o.prefix))}(n,e.ns,i);return F({},s,{effectiveType:Ae(i.getType(t)).name})}}return s}var a=i.getPackage(t.prefix);if(a){const e=Te(t,a),n=i.getType(e);if(s=w(o.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),s)return F({},s,{effectiveType:Ae(n).name})}else if(s=w(o.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),s)return s;throw Re("unrecognized element <"+t.name+">")},Ne.prototype.toString=function(){return"ElementDescriptor["+Ae(this.type).name+"]"},Ne.prototype.valueHandler=function(e,t){return new je(e,t)},Ne.prototype.referenceHandler=function(e){return new Qe(e,this.context)},Ne.prototype.handler=function(e){return"Element"===e?new Fe(this.model,e,this.context):new Ne(this.model,e,this.context)},Ne.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,ne(n=t.effectiveType||t.type))return this.valueHandler(t,i);var r=(o=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==r&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(F(r,{element:i}),this.context.addReference(r)):r.$parent=i),o},qe.prototype=Object.create(Ne.prototype),qe.prototype.createElement=function(e){var t=e.name,n=ie(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),s=r&&Te(n,r)||t;if(!o.hasType(s))throw Re("unexpected element <"+e.originalName+">");return Ne.prototype.createElement.call(this,e)},Fe.prototype=Object.create(Be.prototype),Fe.prototype.createElement=function(e){var t=e.name,n=ie(t).prefix,i=e.ns[n+"$uri"],o=e.attributes;return this.model.createAny(t,i,o)},Fe.prototype.handleChild=function(e){var t=new Fe(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},Fe.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Ve.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ne?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var o=this.model,r=this.lax,s=new Me(F({},t,{rootHandler:i})),a=new ke({proxy:!0}),l=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var i=t(),o=i.line,r=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var l="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+o+"\n\tcolumn: "+r+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:l,error:e}),!0;throw Re(l)}function u(e,t){return c(e,t,!0)}i.context=s,l.push(i);var h=/^<\?xml /i,d=/ encoding="([^"]+)"/i,p=/^utf-8$/i;function f(e,t){try{l.peek().handleText(e)}catch(e){u(e,t)}}var g=o.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),Object.entries(Se).reduce((function(e,[t,n]){return e[n]=t,e}),o.config&&o.config.nsMap||{}));return a.ns(g).on("openTag",(function(e,t,n,i){var o=e.attrs||{},s=Object.keys(o).reduce((function(e,n){var i=t(o[n]);return e[n]=i,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,r)&&l.push(new Le)}}({name:e.name,originalName:e.originalName,attributes:s,ns:e.ns},i)})).on("question",(function(e){if(h.test(e)){var t=d.exec(e),n=t&&t[1];n&&!p.test(n)&&s.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.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",u),new Promise((function(t,n){var o;try{a.parse(e),function(){var e,t,n=s.elementsById,i=s.references;for(e=0;t=i[e];e++){var o=t.element,r=n[t.id],a=Ae(o).propertiesByName[t.property];if(r||s.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var l=o.get(a.name),c=l.indexOf(t);-1===c&&(c=l.length),r?l[c]=r:l.splice(c,1)}else o.set(a.name,r)}}()}catch(e){o=e}var r=i.element;o||r||(o=Re("failed to parse document as <"+i.type.$descriptor.name+">"));var l=s.warnings,c=s.references,u=s.elementsById;return o?(o.warnings=l,n(o)):t({rootElement:r,elementsById:u,references:c,warnings:l})}))},Ve.prototype.handler=function(e){return new qe(this.model,e)};var Xe=/<|>|'|"|&|\n\r|\n/g,ze=/<|>|&/g;function Ye(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}function We(e,t){return Ee(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}function He(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Ue(e){return x(e)?e:(e.prefix?e.prefix+":":"")+e.localName}Ye.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ye.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ye.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ye.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},Ye.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ye.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ye.prototype.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},Ye.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ye.prototype.getUsed=function(e){return[].concat(this.wellknown,this.custom).filter((e=>{var t=this.getNSKey(e);return this.used[t]}))};var Ge={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Ze={"<":"lt",">":"gt","&":"amp"};function Ke(e,t,n){return(e=x(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function Je(e){this.tagName=e}function et(){}function tt(e){this.tagName=e}function nt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function it(e,t,n){nt.call(this,e,t),this.serialization=n}function ot(){this.value="",this.write=function(e){this.value+=e}}function rt(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 st(e){return e=F({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new ot,o=new rt(i,e.format);e.preamble&&o.append('<?xml version="1.0" encoding="UTF-8"?>\n');var r=new nt,s=t.$model;if(r.getNamespaces().mapDefaultPrefixes(function(e){const t=e.config&&e.config.nsMap||{},n={};for(const e in Se)n[e]=Se[e];for(const e in t){n[t[e]]=e}for(const t of e.getPackages())n[t.prefix]=t.uri;return n}(s)),r.build(t).serializeTo(o),!n)return i.value}}}function at(e,t){ue.call(this,e,t)}Je.prototype.build=function(e){return this.element=e,this},Je.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},et.prototype.serializeValue=et.prototype.serializeTo=function(e){e.append(this.escape?Ke(this.value,ze,Ze):this.value)},et.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ze)&&(this.escape=!0),this},He(tt,et),tt.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},nt.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,o=this.propertyDescriptor,r=i.isGeneric;return t=r?this.parseGenericNsAttributes(e):this.parseNsAttributes(e),this.ns=o?this.nsPropertyTagName(o):this.nsTagName(i),this.tagName=this.addTagName(this.ns),r?this.parseGenericContainments(e):(n=function(e){return C(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!O(e,n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)}))}(e),this.parseAttributes(function(e){return C(e,(function(e){return e.isAttr}))}(n)),this.parseContainments(function(e){return C(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},nt.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?F({localName:t.ns.localName},e):F({localName:We(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},nt.prototype.nsPropertyTagName=function(e){return function(e,t){return F({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},nt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},nt.prototype.nsAttributeName=function(e){var t;if(t=x(e)?ie(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}:F({localName:t.localName},n)},nt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter((([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n))).map((([e,t])=>({name:e,value:t})))},nt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push((new et).build({type:"String"},t));var n=e.$children;n&&k(n,(e=>{this.body.push(new nt(this).build(e))}))},nt.prototype.parseNsAttribute=function(e,t,n){var i,o=e.$model,r=ie(t);if("xmlns"===r.prefix&&(i={prefix:r.localName,uri:n}),r.prefix||"xmlns"!==r.localName||(i={uri:n}),!i)return{name:t,value:n};if(o&&o.getPackage(n))this.logNamespace(i,!0,!0);else{var s=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(s)}},nt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return k(n,(function(n,o){var r=t.parseNsAttribute(e,o,n);r&&i.push(r)})),i},nt.prototype.parseGenericAttributes=function(e,t){var n=this;k(t,(function(t){try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){"undefined"!=typeof console&&console.warn(`missing namespace information for <${t.name}=${t.value}> on`,e,n)}}))},nt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;k(e,(function(e){var o=i.get(e.name),r=e.isReference;if(e.isMany||(o=[o]),e.isBody)n.push((new et).build(e,o[0]));else if(ne(e.type))k(o,(function(i){n.push(new tt(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(r)k(o,(function(i){n.push(new Je(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var s=Pe(e);k(o,(function(i){var o;o=s?s===$e?new nt(t,e):new it(t,e,s):new nt(t),n.push(o.build(i))}))}}))},nt.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new Ye(t):n=t),n},nt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix;return i.byUri(o)&&!n||i.add(e,t),i.mapPrefix(r,o),e},nt.prototype.logNamespaceUsed=function(e,t){var n,i,o,r=this.getNamespaces(t),s=e.prefix,a=e.uri;if(!s&&!a)return{localName:e.localName};if(o=r.defaultUriByPrefix(s),!(a=a||o||r.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if((e=r.byUri(a))||s||(e=this.logNamespace({uri:a},o===a,!0)),!e){for(n=s,i=1;r.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:a},o===a)}return s&&r.mapPrefix(s,a),e},nt.prototype.parseAttributes=function(e){var t=this,n=this.element;k(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var o=[];k(i,(function(e){o.push(e.id)})),i=o.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},nt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Ue(e)},nt.prototype.addAttribute=function(e,t){var n=this.attrs;x(t)&&(t=Ke(t,Xe,Ge));var i=function(e,t){const n=Q(t);let i=v(e)?-1:void 0;return k(e,(function(e,t){if(n(e,t))return i=t,!1})),i}(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),o={name:e,value:t};-1!==i?n.splice(i,1,o):n.push(o)},nt.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)),k(t,(function(t){e.append(" ").append(Ue(t.name)).append('="').append(t.value).append('"')}))},nt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==et;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),k(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},He(it,nt),it.prototype.parseNsAttributes=function(e){var t=nt.prototype.parseNsAttributes.call(this,e).filter((e=>e.name!==this.serialization)),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},it.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},at.prototype=Object.create(ue.prototype),at.prototype.fromXML=function(e,t,n){x(t)||(n=t,t="dmn:Definitions");var i=new Ve(F({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},at.prototype.toXML=function(e,t){var n=new st(t);return new Promise((function(t,i){try{return t({xml:n.toXML(e)})}catch(e){return i(e)}}))};var lt={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 ct(e,t){return new at(F({},lt,e),t)}function ut(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 ht,dt,pt,ft={};function gt(){ht=window.addEventListener?"addEventListener":"attachEvent",dt=window.removeEventListener?"removeEventListener":"detachEvent",pt="addEventListener"!==ht?"on":""}var mt=ut({__proto__:null,bind:ft.bind=function(e,t,n,i){return ht||gt(),e[ht](pt+t,n,i||!1),n},unbind:ft.unbind=function(e,t,n,i){return dt||gt(),e[dt](pt+t,n,i||!1),n},default:ft},[ft]),vt=["focus","blur"];var yt,bt={bind:function(e,t,n,i,o){return-1!==vt.indexOf(n)&&(o=!0),mt.bind(e,n,(function(n){var o=n.target||n.srcElement;n.delegateTarget=function(e,t,n){var i=n?e:e.parentNode;return i&&"function"==typeof i.closest&&i.closest(t)||null}(o,t,!0),n.delegateTarget&&i.call(e,n)}),o)},unbind:function(e,t,n,i){return-1!==vt.indexOf(t)&&(i=!0),mt.unbind(e,t,n,i)}},_t=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(Ot,i)?Ot[i]:Ot._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},xt=!1;"undefined"!=typeof document&&((yt=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',xt=!yt.getElementsByTagName("link").length,yt=void 0);var Ot={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:xt?[1,"X<div>","</div>"]:[0,"",""]};Ot.td=Ot.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ot.option=Ot.optgroup=[1,'<select multiple="multiple">',"</select>"],Ot.thead=Ot.tbody=Ot.colgroup=Ot.caption=Ot.tfoot=[1,"<table>","</table>"],Ot.polyline=Ot.ellipse=Ot.polygon=Ot.circle=Ot.text=Ot.line=Ot.path=Ot.rect=Ot.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var wt=_t;function Ct(e){e.parentNode&&e.parentNode.removeChild(e)}function kt(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&&_(arguments[t-1])))return e.apply(this,arguments);var n=arguments[t-1];console.warn(new Error("Passing callbacks to "+function(e){return e.replace("bound ","")}(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)}))}}const Et={width:"100%",height:"100%",position:"relative"};class St{constructor(e={}){this._eventBus=new H,this._viewsChanged=N(this._viewsChanged,0),this._views=[],this._viewers={},this.open=kt(this.open.bind(this)),this.importXML=kt(this.importXML.bind(this)),this.saveXML=kt(this.saveXML.bind(this)),this._init(e)}importXML(e,t){var n=this;return t=t||{open:!0},new Promise((function(o,r){var s=n._activeView;n._clear().then((()=>{var a;e=n._emit("import.parse.start",{xml:e})||e,n._moddle.fromXML(e,"dmn:Definitions").then((e=>{var l=e.rootElement,c=e.references,u=e.elementsById;if(a=e.warnings,l=n._emit("import.parse.complete",i({error:null,definitions:l,elementsById:u,references:c,warnings:a}))||l,n._setDefinitions(l),!t.open)return n._emit("import.done",{error:null,warnings:a}),void o({warnings:a});var h=n._getInitialView(n._views,s);if(!h){var d=new Error("no displayable contents");return n._emit("import.done",{error:d,warnings:a}),d.warnings=a,r(d)}n.open(h).then((e=>({warnings:e.warnings}))).catch((e=>({error:e,warnings:e.warnings}))).then((e=>{var t=[].concat(a,e.warnings);n._emit("import.done",{error:e.error,warnings:t}),e.error?(e.error.warnings=t,r(e.error)):o({warnings:t})}))})).catch((t=>(a=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:a})),n._emit("import.done",{error:t,warnings:a}),t.warnings=a,r(t))))})).catch((e=>(n._emit("import.done",{error:e,warnings:[]}),e.warnings=[],r(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}}getDefinitions(){return this._definitions}getActiveView(){return this._activeView}getActiveViewer(){var e=this.getActiveView();return e&&this._getViewer(e)}getView(e){return this._views.filter((function(t){return t.element===e}))[0]}getViews(){return this._views}saveXML(e){var t=this;e=e||{};var n=this._definitions;return new Promise((function(i,o){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((e=>({error:e}))).then((e=>{t._emit("saveXML.done",e),e.error?o(e.error):i({xml:e.xml})}))):o(new Error("no definitions loaded"))}))}on(...e){this._eventBus.on(...e)}off(...e){this._eventBus.off(...e)}once(...e){this._eventBus.once(...e)}attachTo(e){var t,n;e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(t=e,e=(n=n||document).querySelector(t)),e.appendChild(this._container),this._emit("attach",{})}detach(){this._emit("detach",{}),Ct(this._container)}destroy(){Object.keys(this._viewers).forEach((e=>{Rt(this._viewers[e],"destroy")})),Ct(this._container)}_init(e){this._options=e,this._moddle=this._createModdle(e),this._viewers={},this._views=[];const t=wt('<div class="dmn-js-parent"></div>'),n=F({},Et,e);F(t.style,{width:$t(n.width),height:$t(n.height),position:n.position}),this._container=t,e.container&&this.attachTo(e.container)}_clear(){return this._switchView(null)}open(e){return this._switchView(e)}_setDefinitions(e){this._definitions=e,this._updateViews()}_viewsChanged=()=>{this._emit("views.changed",{views:this._views,activeView:this._activeView})};_updateViews(){var e=this._definitions;if(!e)return this._views=[],void this._switchView(null);var t=this._getViewProviders(),n=[e,...e.drgElement||[]],i=this._views,o=[];for(var r of n){var s=w(t,(function(e){return"string"==typeof e.opens?e.opens===r.$type:e.opens(r)}));if(s){var a={element:r,id:r.id,name:r.name,type:s.id};o.push(a)}}var l,c=this._activeView;if(!c||(l=w(o,(function(e){return Pt(c,e)}))||this._getInitialView(o),l)){var u=!Pt(c,l)||Tt(c,l),h=i.length!==o.length||!S(o,(function(e){return w(i,(function(t){return Pt(t,e)&&!Tt(t,e)}))}));this._activeView=l,this._views=o,(u||h)&&this._viewsChanged()}else this._switchView(null)}_getInitialView(e,t){var n;return t&&(n=w(e,(function(e){return Pt(e,t)}))||w(e,(function(e){return e.type===t}))),n||e[0]}_switchView(e){var t=this;return new Promise((function(n,i){var o,r=(e,o)=>{t._viewsChanged(),e?i(e):n(o)},s=t.getActiveView(),a=e&&t._getViewer(e),l=e&&e.element;if(s&&(o=t._getViewer(s))!==a&&(Rt(o,"clear"),o.detach()),t._activeView=e,a)return o!==a&&a.attachTo(t._container),t._emit("import.render.start",{view:e,element:l}),void a.open(l).then((n=>{t._emit("import.render.complete",{view:e,error:null,warnings:n.warnings}),r(null,n)})).catch((n=>{t._emit("import.render.complete",{view:e,error:n,warnings:n.warnings}),r(n,null)}));r()}))}_getViewer(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}_createViewer(e){var t=w(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({...this._options.common||{},...i,additionalModules:[...i.additionalModules||[],{_parent:["value",this],moddle:["value",this._moddle]}]})}_emit(...e){return this._eventBus.fire(...e)}_createModdle(e){return new ct(e.moddleExtensions)}_getViewProviders(){return[]}}function $t(e){return e+(b(e)?"px":"")}function Pt(e,t){return g(e)?!!g(t)&&(e.element===t.element||e.id===t.id):!g(t)}function Tt(e,t){return!e||!t||e.name!==t.name}function Rt(e,t){_(e[t])&&e[t]()}var At=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),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,e/o))/Math.log(n)*o;var r=i-Math.floor(i),s="";for(o=0;o<Math.floor(i);o++){s=Math.floor(Math.random()*n).toString(n)+s}if(r){var a=Math.pow(n,r);s=Math.floor(Math.random()*a).toString(n)+s}var l=parseInt(s,n);return l!==1/0&&l>=Math.pow(2,e)?t(e,n):s};t.rack=function(e,n,i){var o=function(o){var s=0;do{if(s++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var a=t(e,n)}while(Object.hasOwnProperty.call(r,a));return r[a]=o,a},r=o.hats={};return o.get=function(e){return o.hats[e]},o.set=function(e,t){return o.hats[e]=t,o},o.bits=e||128,o.base=n||16,o}}));function Mt(e){if(!(this instanceof Mt))return new Mt(e);e=e||[128,36,1],this._seed=e.length?At.rack(e[0],e[1],e[2]):e}function Dt(e,t){var n=Qt(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Lt(e){return Dt(e,"dmn:InputClause")}function It(e){return Dt(e,"dmn:OutputClause")}function Qt(e){return e&&e.businessObject||e}function jt(e,t){return $(t,(function(t){return Dt(e,t)}))}function Bt(e){var t=Qt(e);if(Dt(t,"dmn:Decision"))return t.get("decisionLogic");if(Dt(t,"dmn:BusinessKnowledgeModel")){var n=t.get("encapsulatedLogic");return n&&n.get("body")}}Mt.prototype.next=function(e){return this._seed(e||!0)},Mt.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},Mt.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Mt.prototype.assigned=function(e){return this._seed.get(e)||!1},Mt.prototype.unclaim=function(e){delete this._seed.hats[e]},Mt.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};class Nt extends St{_init(e){super._init(e),this.on("import.parse.complete",(e=>{e.error||this._collectIds(e.definitions,e.elementsById)})),this.on("destroy",(()=>{this._moddle.ids.clear()})),this.on("viewer.created",(({viewer:e})=>{e.on("elements.changed",(({elements:e})=>{var t=e.some((function(e){return jt(e,["dmn:Decision","dmn:Definitions","dmn:BusinessKnowledgeModel"])}));t&&this._updateViews()}))}))}_collectIds(e,t){var n,i=e.$model.ids;for(n in i.clear(),t)i.claim(n,t[n])}_createModdle(e){var t=super._createModdle(e);return t.ids=new Mt([32,36,1]),t}}function qt(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function Ft(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)}const Vt=Object.prototype.toString;function Xt(e){return new zt(e)}function zt(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}zt.prototype.add=function(e){return this.list.add(e),this},zt.prototype.remove=function(e){return"[object RegExp]"==Vt.call(e)?this.removeMatching(e):(this.list.remove(e),this)},zt.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},zt.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},zt.prototype.array=function(){return Array.from(this.list)},zt.prototype.has=zt.prototype.contains=function(e){return this.list.contains(e)};var Yt,Wt,Ht,Ut={};function Gt(){Yt=window.addEventListener?"addEventListener":"attachEvent",Wt=window.removeEventListener?"removeEventListener":"detachEvent",Ht="addEventListener"!==Yt?"on":""}var Zt=Ft({__proto__:null,bind:Ut.bind=function(e,t,n,i){return Yt||Gt(),e[Yt](Ht+t,n,i||!1),n},unbind:Ut.unbind=function(e,t,n,i){return Wt||Gt(),e[Wt](Ht+t,n,i||!1),n},default:Ut},[Ut]),Kt=["focus","blur"];var Jt,en={bind:function(e,t,n,i,o){return-1!==Kt.indexOf(n)&&(o=!0),Zt.bind(e,n,(function(n){var o=n.target||n.srcElement;n.delegateTarget=function(e,t,n){var i=n?e:e.parentNode;return i&&"function"==typeof i.closest&&i.closest(t)||null}(o,t,!0),n.delegateTarget&&i.call(e,n)}),o)},unbind:function(e,t,n,i){return-1!==Kt.indexOf(t)&&(i=!0),Zt.unbind(e,t,n,i)}},tn=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(on,i)?on[i]:on._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},nn=!1;"undefined"!=typeof document&&((Jt=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',nn=!Jt.getElementsByTagName("link").length,Jt=void 0);var on={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:nn?[1,"X<div>","</div>"]:[0,"",""]};on.td=on.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],on.option=on.optgroup=[1,'<select multiple="multiple">',"</select>"],on.thead=on.tbody=on.colgroup=on.caption=on.tfoot=[1,"<table>","</table>"],on.polyline=on.ellipse=on.polygon=on.circle=on.text=on.line=on.path=on.rect=on.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var rn=tn;function sn(e,t){return(t=t||document).querySelector(e)}const an=/^class[ {]/;function ln(e){return Array.isArray(e)}function cn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function un(...e){1===e.length&&ln(e[0])&&(e=e[0]);const t=(e=[...e]).pop();return t.$inject=e,t}const hn=/constructor\s*[^(]*\(\s*([^)]*)\)/m,dn=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,pn=/\/\*([^*]*)\*\//m;function fn(e){if("function"!=typeof e)throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(function(e){return an.test(e.toString())}(e)?hn:dn);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map((e=>{const t=e.match(pn);return(t&&t[1]||e).trim()}))||[]}function gn(e,t){const n=t||{get:function(e,t){if(i.push(e),!1===t)return null;throw a(`No provider for "${e}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),s=r.injector=this,a=function(e){const t=i.join(" -> ");return i.length=0,new Error(t?`${e} (Resolving: ${t})`:e)};function l(e,t){if(!o[e]&&e.includes(".")){const t=e.split(".");let n=l(t.shift());for(;t.length;)n=n[t.shift()];return n}if(cn(r,e))return r[e];if(cn(o,e)){if(-1!==i.indexOf(e))throw i.push(e),a("Cannot resolve circular dependency!");return i.push(e),r[e]=o[e][0](o[e][1]),i.pop(),r[e]}return n.get(e,t)}function c(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!ln(e))throw a(`Cannot invoke "${e}". Expected a function!`);e=un(e.slice())}return{fn:e,dependencies:(e.$inject||fn(e)).map((e=>cn(t,e)?t[e]:l(e)))}}function u(e){const{fn:t,dependencies:n}=c(e);return new(Function.prototype.bind.call(t,null,...n))}function h(e,t,n){const{fn:i,dependencies:o}=c(e,n);return i.apply(t,o)}function d(e){return un((t=>e.get(t)))}function p(e,t){if(t&&t.length){const n=Object.create(null),i=Object.create(null),r=[],s=[],a=[];let l,c,u,h;for(let e in o)l=o[e],-1!==t.indexOf(e)&&("private"===l[2]?(c=r.indexOf(l[3]),-1===c?(u=l[3].createChild([],t),h=d(u),r.push(l[3]),s.push(u),a.push(h),n[e]=[h,e,"private",u]):n[e]=[a[c],e,"private",s[c]]):n[e]=[l[2],l[1]],i[e]=!0),"factory"!==l[2]&&"type"!==l[2]||!l[1].$scope||t.forEach((t=>{-1!==l[1].$scope.indexOf(t)&&(n[e]=[l[2],l[1]],i[t]=!0)}));t.forEach((e=>{if(!i[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(n)}return new gn(e,s)}const f={factory:h,type:u,value:function(e){return e}};function g(e,t){const n=e.__init__||[];return function(){n.forEach((e=>{"string"==typeof e?t.get(e):t.invoke(e)}))}}function m(e){const t=e.__exports__;if(t){const n=e.__modules__,i=Object.keys(e).reduce(((t,n)=>("__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t)),Object.create(null)),r=p((n||[]).concat(i)),s=un((function(e){return r.get(e)}));t.forEach((function(e){o[e]=[s,e,"private",r]}));const a=(e.__init__||[]).slice();return a.unshift((function(){r.init()})),g(e=Object.assign({},e,{__init__:a}),r)}return Object.keys(e).forEach((function(t){if("__init__"===t||"__depends__"===t)return;const n=e[t];if("private"===n[2])return void(o[t]=n);const i=n[0],r=n[1];o[t]=[f[i],mn(i,r),i]})),g(e,s)}function v(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(v,e)).indexOf(t)?e:e.concat(t)}this.get=l,this.invoke=h,this.instantiate=u,this.createChild=p,this.init=function(e){const t=e.reduce(v,[]).map(m);let n=!1;return function(){n||(n=!0,t.forEach((e=>e())))}}(e)}function mn(e,t){return"value"!==e&&ln(t)&&(t=un(t.slice())),t}function vn(e,t){var n=this;t=t||1e3,e.on(["render.shape","render.connection"],t,(function(e,t){var i=e.type,o=t.element,r=t.gfx,s=t.attrs;if(n.canRender(o))return"render.shape"===i?n.drawShape(r,o,s):n.drawConnection(r,o,s)})),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 yn(e,t){return function(e,t){t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}(t,e),e}vn.prototype.canRender=function(e){},vn.prototype.drawShape=function(e,t){},vn.prototype.drawConnection=function(e,t){},vn.prototype.getShapePath=function(e){},vn.prototype.getConnectionPath=function(e){};var bn={"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 _n(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=bn[i];o?(2===o&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function xn(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return bn[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);_n(e,t,n)}else!function(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)_n(e,i,t[i])}(e,t);return e}const On=Object.prototype.toString;function wn(e){return new Cn(e)}function Cn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function kn(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function En(e){return e.cloneNode(!0)}Cn.prototype.add=function(e){return this.list.add(e),this},Cn.prototype.remove=function(e){return"[object RegExp]"==On.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Cn.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Cn.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Cn.prototype.array=function(){return Array.from(this.list)},Cn.prototype.has=Cn.prototype.contains=function(e){return this.list.contains(e)};var Sn="http://www.w3.org/2000/svg",$n='<svg xmlns="'+Sn+'"';function Pn(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Sn)&&(e=$n+e.substring(4)):(e=$n+">"+e+"</svg>",t=!0);var n=function(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function Tn(e,t){var n;return"<"===(e=e.trim()).charAt(0)?(n=Pn(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Sn,e),t&&xn(n,t),n}var Rn=null;function An(){return null===Rn&&(Rn=Tn("svg")),Rn}function Mn(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function Dn(e){return An().createSVGTransform()}var Ln=/([&<>]{1})/g,In=/([&<>\n\r"]{1})/g,Qn={"&":"&","<":"<",">":">",'"':"'"};function jn(e,t){return e.replace(t,(function(e,t){return Qn[t]||t}))}function Bn(e,t){var n,i,o,r,s;switch(e.nodeType){case 3:t.push(jn(e.textContent,Ln));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(o=e.attributes).length;n<i;++n)r=o.item(n),t.push(" ",r.name,'="',jn(r.value,In),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(s=e.childNodes).length;n<i;++n)Bn(s.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",jn(e.nodeValue,Ln),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Nn(e,t){return function(e){for(var t=e.firstChild,n=[];t;)Bn(t,n),t=t.nextSibling;return n.join("")}(e)}function qn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Fn(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Vn(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(Fn(e,i))}(n,t)),n.consolidate()}function Xn(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function zn(e){return["L",e.x,e.y]}function Yn(e,t){const n=e.length,i=[(o=e[0],["M",o.x,o.y])];var o,r,s,a;for(let o=1;o<n;o++){const n=e[o-1],l=e[o],c=e[o+1];if(!c||!t){i.push(zn(l));continue}const u=Math.min(t,Hn(l.x-n.x,l.y-n.y),Hn(c.x-l.x,c.y-l.y));if(!u){i.push(zn(l));continue}const h=Wn(l,n,u),d=Wn(l,n,.5*u),p=Wn(l,c,u),f=Wn(l,c,.5*u);i.push(zn(h)),i.push((s=f,a=p,["C",(r=d).x,r.y,s.x,s.y,a.x,a.y]))}return i}function Wn(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=n/Hn(i,o);return{x:e.x+i*r,y:e.y+o*r}}function Hn(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Un(e,t,n){b(t)&&(n=t,t=null),t||(t={});const i=Tn("path",t);return b(n)&&(i.dataset.cornerRadius=String(n)),Gn(i,e)}function Gn(e,t){return xn(e,{d:Xn(Yn(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Zn(e){return C(e,(function(t){return!w(e,(function(e){return e!==t&&Kn(t,e)}))}))}function Kn(e,t){if(t){if(e===t)return t;if(e.parent)return Kn(e.parent,t)}}function Jn(e,t,n){var i=!n;return e.push(t),i}function ei(e,t,n){n=n||0,v(e)||(e=[e]),k(e,(function(e,i){var o=t(e,i,n);v(o)&&o.length&&ei(o,t,n+1)}))}function ti(e,t){return function(e,t){var n=[],i=[];return ei(e,(function(e,o,r){Jn(n,e,t);var s=e.children;if(s&&Jn(i,s,t))return s})),n}(e,!t)}function ni(e,t){var n,i,o,r;return t=!!t,v(e)||(e=[e]),k(e,(function(e){var s=e;e.waypoints&&!t&&(s=ni(e.waypoints,!0));var a=s.x,l=s.y,c=s.height||0,u=s.width||0;(a<n||void 0===n)&&(n=a),(l<i||void 0===i)&&(i=l),(a+u>o||void 0===o)&&(o=a+u),(l+c>r||void 0===r)&&(r=l+c)})),{x:n,y:i,height:r-i,width:o-n}}function ii(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function oi(e){return!(!e||!e.isFrame)}function ri(e,t){return F({},e||{},t||{})}function si(e,t){vn.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})}qt(si,vn),si.prototype.canRender=function(){return!0},si.prototype.drawShape=function(e,t,n){var i=Tn("rect");return xn(i,{x:0,y:0,width:t.width||0,height:t.height||0}),oi(t)?xn(i,F({},this.FRAME_STYLE,n||{})):xn(i,F({},this.SHAPE_STYLE,n||{})),yn(e,i),i},si.prototype.drawConnection=function(e,t,n){var i=Un(t.waypoints,F({},this.CONNECTION_STYLE,n||{}));return yn(e,i),i},si.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return Xn([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},si.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,o=[];for(t=0;n=i[t];t++)n=n.original||n,o.push([0===t?"M":"L",n.x,n.y]);return Xn(o)},si.$inject=["eventBus","styles"];var ai={__init__:["defaultRenderer"],defaultRenderer:["type",si],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 F(this.style(t,n),{class:e})},this.style=function(t,n){v(t)||n||(n=t,t=[]);var i=E(t,(function(t,n){return F(t,e[n]||{})}),{});return n?F(i,n):i},this.computeStyle=function(e,n,i){return v(n)||(i=n,n=[]),t.style(n||[],F({},i,e||{}))}}]};function li(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)}const ci=Object.prototype.toString,ui=Object.prototype.hasOwnProperty;function hi(e,t){return ui.call(e,t)}function di(e,t){let n,i;if(void 0===e)return;const o=function(e){return"[object Array]"===ci.call(e)}(e)?fi:pi;for(let r in e)if(hi(e,r)&&(n=e[r],i=t(n,o(r)),!1===i))return n}function pi(e){return e}function fi(e){return Number(e)}function gi(e,...t){const n=e.style;return di(t,(function(e){e&&di(e,(function(e,t){n[t]=e}))})),e}function mi(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}const vi=Object.prototype.toString;function yi(e){return new bi(e)}function bi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function _i(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function xi(e,t,n){var i=n?e:e.parentNode;return i&&"function"==typeof i.closest&&i.closest(t)||null}bi.prototype.add=function(e){return this.list.add(e),this},bi.prototype.remove=function(e){return"[object RegExp]"==vi.call(e)?this.removeMatching(e):(this.list.remove(e),this)},bi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},bi.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},bi.prototype.array=function(){return Array.from(this.list)},bi.prototype.has=bi.prototype.contains=function(e){return this.list.contains(e)};var Oi,wi,Ci,ki={};function Ei(){Oi=window.addEventListener?"addEventListener":"attachEvent",wi=window.removeEventListener?"removeEventListener":"detachEvent",Ci="addEventListener"!==Oi?"on":""}var Si=li({__proto__:null,bind:ki.bind=function(e,t,n,i){return Oi||Ei(),e[Oi](Ci+t,n,i||!1),n},unbind:ki.unbind=function(e,t,n,i){return wi||Ei(),e[wi](Ci+t,n,i||!1),n},default:ki},[ki]),$i=["focus","blur"];var Pi,Ti={bind:function(e,t,n,i,o){return-1!==$i.indexOf(n)&&(o=!0),Si.bind(e,n,(function(n){var o=n.target||n.srcElement;n.delegateTarget=xi(o,t,!0),n.delegateTarget&&i.call(e,n)}),o)},unbind:function(e,t,n,i){return-1!==$i.indexOf(t)&&(i=!0),Si.unbind(e,t,n,i)}},Ri=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(Mi,i)?Mi[i]:Mi._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},Ai=!1;"undefined"!=typeof document&&((Pi=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',Ai=!Pi.getElementsByTagName("link").length,Pi=void 0);var Mi={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:Ai?[1,"X<div>","</div>"]:[0,"",""]};Mi.td=Mi.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Mi.option=Mi.optgroup=[1,'<select multiple="multiple">',"</select>"],Mi.thead=Mi.tbody=Mi.colgroup=Mi.caption=Mi.tfoot=[1,"<table>","</table>"],Mi.polyline=Mi.ellipse=Mi.polygon=Mi.circle=Mi.text=Mi.line=Mi.path=Mi.rect=Mi.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Di=Ri;function Li(e,t){return e&&"function"==typeof e.matches&&e.matches(t)||!1}function Ii(e,t){return(t=t||document).querySelector(e)}function Qi(e,t){return(t=t||document).querySelectorAll(e)}function ji(e){e.parentNode&&e.parentNode.removeChild(e)}function Bi(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function Ni(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 qi(e,t){return e&&t?e.indexOf(t):-1}function Fi(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function Vi(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=Fi(e,t);return Math.abs(o/r)<=i}function Xi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[e,t]of Object.entries(i))if(zi(e,n))return t;return!1}function zi(e,t){const n=t[0];return S(t,(function(t){return Math.abs(n[e]-t[e])<=2}))}function Yi(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Wi=/,?([a-z]),?/gi,Hi=parseFloat,Ui=Math,Gi=Ui.PI,Zi=Ui.min,Ki=Ui.max,Ji=Ui.pow,eo=Ui.abs,to=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,no=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,io=Array.isArray||function(e){return e instanceof Array};function oo(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ro(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)oo(e,n)&&(t[n]=ro(e[n]));return t}function so(e){var t=so.ps=so.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)oo(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function ao(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 lo(){return this.join(",").replace(Wi,"$1")}function co(e){var t=ro(e);return t.toString=lo,t}function uo(e,t,n,i,o,r,s,a,l){var c=1-l,u=Ji(c,3),h=Ji(c,2),d=l*l*l,p=u*t+3*h*l*i+3*c*l*l*r+d*a;return{x:vo(u*e+3*h*l*n+3*c*l*l*o+d*s),y:vo(p)}}function ho(e){var t=function(e,t,n,i,o,r,s,a){for(var l,c,u,h,d,p,f,g,m=[],v=[[],[]],y=0;y<2;++y)if(0==y?(c=6*e-12*n+6*o,l=-3*e+9*n-9*o+3*s,u=3*n-3*e):(c=6*t-12*i+6*r,l=-3*t+9*i-9*r+3*a,u=3*i-3*t),eo(l)<1e-12){if(eo(c)<1e-12)continue;0<(h=-u/c)&&h<1&&m.push(h)}else f=c*c-4*u*l,g=Ui.sqrt(f),f<0||(0<(d=(-c+g)/(2*l))&&d<1&&m.push(d),0<(p=(-c-g)/(2*l))&&p<1&&m.push(p));var b,_=m.length,x=_;for(;_--;)b=1-(h=m[_]),v[0][_]=b*b*b*e+3*b*b*h*n+3*b*h*h*o+h*h*h*s,v[1][_]=b*b*b*t+3*b*b*h*i+3*b*h*h*r+h*h*h*a;return v[0][x]=e,v[1][x]=t,v[0][x+1]=s,v[1][x+1]=a,v[0].length=v[1].length=x+2,{x0:Zi(...v[0]),y0:Zi(...v[1]),x1:Ki(...v[0]),y1:Ki(...v[1])}}(...e);return ao(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function po(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function fo(e,t,n,i,o){return e*(e*(-3*t+9*n-9*i+3*o)+6*t-12*n+6*i)-3*t+3*n}function go(e,t,n,i,o,r,s,a,l){null==l&&(l=1);for(var c=(l=l>1?1:l<0?0:l)/2,u=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,p=0;p<12;p++){var f=c*u[p]+c,g=fo(f,e,n,o,s),m=fo(f,t,i,r,a),v=g*g+m*m;d+=h[p]*Ui.sqrt(v)}return c*d}function mo(e,t,n,i,o,r,s,a){if(!(Ki(e,n)<Zi(o,s)||Zi(e,n)>Ki(o,s)||Ki(t,i)<Zi(r,a)||Zi(t,i)>Ki(r,a))){var l=(e*i-t*n)*(r-a)-(t-i)*(o*a-r*s),c=(e-n)*(r-a)-(t-i)*(o-s);if(c){var u=vo(((e*i-t*n)*(o-s)-(e-n)*(o*a-r*s))/c),h=vo(l/c),d=+u.toFixed(2),p=+h.toFixed(2);if(!(d<+Zi(e,n).toFixed(2)||d>+Ki(e,n).toFixed(2)||d<+Zi(o,s).toFixed(2)||d>+Ki(o,s).toFixed(2)||p<+Zi(t,i).toFixed(2)||p>+Ki(t,i).toFixed(2)||p<+Zi(r,a).toFixed(2)||p>+Ki(r,a).toFixed(2)))return{x:u,y:h}}}}function vo(e){return Math.round(1e11*e)/1e11}function yo(e,t,n){if(!function(e,t){return e=ao(e),po(t=ao(t),e.x,e.y)||po(t,e.x2,e.y)||po(t,e.x,e.y2)||po(t,e.x2,e.y2)||po(e,t.x,t.y)||po(e,t.x2,t.y)||po(e,t.x,t.y2)||po(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)}(ho(e),ho(t)))return n?0:[];for(var i=go(...e),o=go(...t),r=xo(e)?1:~~(i/5)||1,s=xo(t)?1:~~(o/5)||1,a=[],l=[],c={},u=n?0:[],h=0;h<r+1;h++){var d=uo(...e,h/r);a.push({x:d.x,y:d.y,t:h/r})}for(h=0;h<s+1;h++)d=uo(...t,h/s),l.push({x:d.x,y:d.y,t:h/s});for(h=0;h<r;h++)for(var p=0;p<s;p++){var f,g=a[h],m=a[h+1],v=l[p],y=l[p+1],b=eo(m.x-g.x)<.01?"y":"x",_=eo(y.x-v.x)<.01?"y":"x",x=mo(g.x,g.y,m.x,m.y,v.x,v.y,y.x,y.y);if(x){if(c[f=x.x.toFixed(9)+"#"+x.y.toFixed(9)])continue;c[f]=!0;var O=g.t+eo((x[b]-g[b])/(m[b]-g[b]))*(m.t-g.t),w=v.t+eo((x[_]-v[_])/(y[_]-v[_]))*(y.t-v.t);O>=0&&O<=1&&w>=0&&w<=1&&(n?u++:u.push({x:x.x,y:x.y,t1:O,t2:w}))}}return u}function bo(e,t,n){e=ko(e),t=ko(t);for(var i,o,r,s,a,l,c,u,h,d,p=n?0:[],f=0,g=e.length;f<g;f++){var m=e[f];if("M"==m[0])i=a=m[1],o=l=m[2];else{"C"==m[0]?(i=(h=[i,o,...m.slice(1)])[6],o=h[7]):(h=[i,o,i,o,a,l,a,l],i=a,o=l);for(var v=0,y=t.length;v<y;v++){var b=t[v];if("M"==b[0])r=c=b[1],s=u=b[2];else{"C"==b[0]?(r=(d=[r,s,...b.slice(1)])[6],s=d[7]):(d=[r,s,r,s,c,u,c,u],r=c,s=u);var _=yo(h,d,n);if(n)p+=_;else{for(var x=0,O=_.length;x<O;x++)_[x].segment1=f,_[x].segment2=v,_[x].bez1=h,_[x].bez2=d;p=p.concat(_)}}}}}return p}function _o(e){var t=so(e);if(t.abs)return co(t.abs);if(io(e)&&io(e&&e[0])||(e=function(e){if(!e)return null;var t=so(e);if(t.arr)return ro(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 io(e)&&io(e[0])&&(i=ro(e)),i.length||String(e).replace(to,(function(e,t,o){var r=[],s=t.toLowerCase();for(o.replace(no,(function(e,t){t&&r.push(+t)})),"m"==s&&r.length>2&&(i.push([t,...r.splice(0,2)]),s="l",t="m"==t?"l":"L");r.length>=n[s]&&(i.push([t,...r.splice(0,n[s])]),n[s]););})),i.toString=so.toString,t.arr=ro(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],o=0,r=0,s=0,a=0,l=0;"M"==e[0][0]&&(s=o=+e[0][1],a=r=+e[0][2],l++,i[0]=["M",o,r]);for(var c,u,h=l,d=e.length;h<d;h++){if(i.push(c=[]),(n=(u=e[h])[0])!=n.toUpperCase())switch(c[0]=n.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+o,c[7]=+u[7]+r;break;case"V":c[1]=+u[1]+r;break;case"H":c[1]=+u[1]+o;break;case"M":s=+u[1]+o,a=+u[2]+r;default:for(var p=1,f=u.length;p<f;p++)c[p]=+u[p]+(p%2?o:r)}else for(var g=0,m=u.length;g<m;g++)c[g]=u[g];switch(n=n.toUpperCase(),c[0]){case"Z":o=+s,r=+a;break;case"H":o=c[1];break;case"V":r=c[1];break;case"M":s=c[c.length-2],a=c[c.length-1];default:o=c[c.length-2],r=c[c.length-1]}}return i.toString=lo,t.abs=co(i),i}function xo(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Oo(e,t,n,i){return[e,t,n,i,n,i]}function wo(e,t,n,i,o,r){var s=1/3,a=2/3;return[s*e+a*n,s*t+a*i,s*o+a*n,s*r+a*i,o,r]}function Co(e,t,n,i,o,r,s,a,l,c){var u,h=120*Gi/180,d=Gi/180*(+o||0),p=[],f=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0).join("␀"),i=t.cache=t.cache||{},o=t.count=t.count||[];return oo(i,n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(o,n),i[n]):(o.length>=1e3&&delete i[o.shift()],o.push(n),i[n]=e(...arguments),i[n])}}((function(e,t,n){return{x:e*Ui.cos(n)-t*Ui.sin(n),y:e*Ui.sin(n)+t*Ui.cos(n)}}));if(c)w=c[0],C=c[1],x=c[2],O=c[3];else{e=(u=f(e,t,-d)).x,t=u.y;var g=(e-(a=(u=f(a,l,-d)).x))/2,m=(t-(l=u.y))/2,v=g*g/(n*n)+m*m/(i*i);v>1&&(n*=v=Ui.sqrt(v),i*=v);var y=n*n,b=i*i,_=(r==s?-1:1)*Ui.sqrt(eo((y*b-y*m*m-b*g*g)/(y*m*m+b*g*g))),x=_*n*m/i+(e+a)/2,O=_*-i*g/n+(t+l)/2,w=Ui.asin(((t-O)/i).toFixed(9)),C=Ui.asin(((l-O)/i).toFixed(9));(w=e<x?Gi-w:w)<0&&(w=2*Gi+w),(C=a<x?Gi-C:C)<0&&(C=2*Gi+C),s&&w>C&&(w-=2*Gi),!s&&C>w&&(C-=2*Gi)}var k=C-w;if(eo(k)>h){var E=C,S=a,$=l;C=w+h*(s&&C>w?1:-1),p=Co(a=x+n*Ui.cos(C),l=O+i*Ui.sin(C),n,i,o,0,s,S,$,[C,E,x,O])}k=C-w;var P=Ui.cos(w),T=Ui.sin(w),R=Ui.cos(C),A=Ui.sin(C),M=Ui.tan(k/4),D=4/3*n*M,L=4/3*i*M,I=[e,t],Q=[e+D*T,t-L*P],j=[a+D*A,l-L*R],B=[a,l];if(Q[0]=2*I[0]-Q[0],Q[1]=2*I[1]-Q[1],c)return[Q,j,B].concat(p);for(var N=[],q=0,F=(p=[Q,j,B].concat(p).join().split(",")).length;q<F;q++)N[q]=q%2?f(p[q-1],p[q],d).y:f(p[q],p[q+1],d).x;return N}function ko(e){var t=so(e);if(t.curve)return co(t.curve);for(var n=_o(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=function(e,t,n){var i,o;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",...Co(t.x,t.y,...e.slice(1))];break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,o=2*t.y-t.by):(i=t.x,o=t.y),e=["C",i,o,...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",...wo(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",...wo(t.x,t.y,e[1],e[2],e[3],e[4])];break;case"L":e=["C",...Oo(t.x,t.y,e[1],e[2])];break;case"H":e=["C",...Oo(t.x,t.y,e[1],t.y)];break;case"V":e=["C",...Oo(t.x,t.y,t.x,e[1])];break;case"Z":e=["C",...Oo(t.x,t.y,t.X,t.Y)]}return e},r=function(e,t){if(e[t].length>7){e[t].shift();for(var i=e[t];i.length;)s[t]="A",e.splice(t++,0,["C",...i.splice(0,6)]);e.splice(t,1),u=n.length}},s=[],a="",l="",c=0,u=n.length;c<u;c++){n[c]&&(a=n[c][0]),"C"!=a&&(s[c]=a,c&&(l=s[c-1])),n[c]=o(n[c],i,l),"A"!=s[c]&&"C"==a&&(s[c]="C"),r(n,c);var h=n[c],d=h.length;i.x=h[d-2],i.y=h[d-1],i.bx=Hi(h[d-4])||i.x,i.by=Hi(h[d-3])||i.y}return t.curve=co(n),n}function Eo(e){return y(e)&&O(e,"waypoints")}function So(e){return y(e)&&O(e,"labelTarget")}function $o(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Po(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function To(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Ro(e){for(var t=e.waypoints,n=t.reduce((function(e,n,i){var o=t[i-1];if(o){var r=e[e.length-1],s=r&&r.endLength||0,a=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(o,n);e.push({start:o,end:n,startLength:s,endLength:s+a,length:a})}return e}),[]),i=n.reduce((function(e,t){return e+t.length}),0),o=i/2,r=0,s=n[r];s.endLength<o;)s=n[++r];var a=(o-s.startLength)/s.length;return{x:s.start.x+(s.end.x-s.start.x)*a,y:s.start.y+(s.end.y-s.start.y)*a}}function Ao(e){return Eo(e)?Ro(e):$o({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function Mo(e,t,n){y(n=n||0)||(n={x:n,y:n});var i=Po(e),o=Po(t),r=i.bottom+n.y<=o.top,s=i.left-n.x>=o.right,a=i.top-n.y>=o.bottom,l=r?"top":a?"bottom":null,c=i.right+n.x<=o.left?"left":s?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function Do(e,t,n){var i=function(e,t){return bo(e,t)}(e,t);return 1===i.length||2===i.length&&Fi(i[0],i[1])<1?$o(i[0]):i.length>1?(i=D(i,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),$o(i[n?0:i.length-1])):null}function Lo(e,t){return Math.round(e*t)/t}function Io(e){return b(e)?e+"px":e}function Qo(e,t,n){const i=Tn("g");wn(i).add(t);const o=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const jo={shape:["x","y","width","height"],connection:["waypoints"]};function Bo(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}function No(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Bo.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Bo.prototype._init=function(e){const t=this._eventBus,n=this._container=function(e){const t=(e=F({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),gi(n,{position:"relative",overflow:"hidden",width:Io(e.width),height:Io(e.height)}),t.appendChild(n),n}(e),i=this._svg=Tn("svg");xn(i,{width:"100%",height:"100%"}),mi(i,"tabindex",0),e.autoFocus&&t.on("element.hover",(()=>{this.restoreFocus()})),t.on("element.mousedown",500,(e=>{this.focus()})),i.addEventListener("focusin",(()=>{this._setFocused(!0)})),i.addEventListener("focusout",(()=>{this._setFocused(!1)})),yn(n,i);const o=this._viewport=Qo(i,"viewport");e.deferUpdate&&(this._viewboxChanged=N(q(this._viewboxChanged,this),300)),t.on("diagram.init",(()=>{t.fire("canvas.init",{svg:i,viewport:o})})),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(()=>{delete this._cachedViewbox})),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Bo.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const 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},Bo.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Bo.prototype._clear=function(){this._elementRegistry.getAll().forEach((e=>{const t=ii(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Bo.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Bo.prototype.restoreFocus=function(){document.activeElement===document.body&&this.focus()},Bo.prototype.isFocused=function(){return this._focused},Bo.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Bo.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let 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},Bo.prototype._getChildIndex=function(e){return E(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Bo.prototype._createLayer=function(e,t){void 0===t&&(t=1);const n=this._getChildIndex(t);return{group:Qo(this._viewport,"layer-"+e,n),index:t,visible:!0}},Bo.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,o=t.index;if(t.visible)return i;const r=this._getChildIndex(o);return n.insertBefore(i,n.childNodes[r]||null),t.visible=!0,i},Bo.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible?(qn(n),t.visible=!1,n):n},Bo.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],qn(t.group))},Bo.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Bo.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),!e)return;const t=this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{};return t.rootElement},Bo.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Bo.prototype._findPlaneForRoot=function(e){return w(this._planes,(function(t){return t.rootElement===e}))},Bo.prototype.getContainer=function(){return this._container},Bo.prototype._updateMarker=function(e,t,n){let i;e.id||(e=this._elementRegistry.get(e)),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(k([i.gfx,i.secondaryGfx],(function(i){i&&(n?(e.markers.add(t),wn(i).add(t)):(e.markers.delete(t),wn(i).remove(t)))})),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Bo.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Bo.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Bo.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),!!e.markers&&e.markers.has(t)},Bo.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Bo.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Bo.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Bo.prototype.removeRootElement=function(e){"string"==typeof e&&(e=this._elementRegistry.get(e));if(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},Bo.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Bo.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Bo.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Bo.prototype._setRoot=function(e,t){const 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})},Bo.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");const n=jo[e],i=S(n,(function(e){return void 0!==t[e]}));if(!i)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Bo.prototype._setParent=function(e,t,n){Ni(t.children,e,n),e.parent=t},Bo.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const o=this._eventBus,r=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const s=r.create(e,t,i);return this._elementRegistry.add(t,s),r.update(e,t,s),o.fire(e+".added",{element:t,gfx:s}),t},Bo.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Bo.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Bo.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e))return o.fire(t+".remove",{element:e}),i.remove(e),Bi(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Bo.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Bo.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Bo.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Bo.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Bo.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Bo.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,s,a,l,c;return e?(this._changeViewbox((function(){a=Math.min(n.width/e.width,n.height/e.height);const i=this._svg.createSVGMatrix().scale(a).translate(-e.x,-e.y);Vn(t,i)})),e):(r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},s=Vn(t),o=s?s.matrix:function(e,t,n,i,o,r){var s=An().createSVGMatrix();switch(arguments.length){case 0:return s;case 1:return Mn(s,e);case 6:return Mn(s,{a:e,b:t,c:n,d:i,e:o,f:r})}}(),a=Lo(o.a,1e3),l=Lo(-o.e||0,1e3),c=Lo(-o.f||0,1e3),e=this._cachedViewbox={x:l?l/a:0,y:c?c/a:0,width:n.width/a,height:n.height/a,scale:a,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n})},Bo.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=F({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),No(t,n)})),{x:n.e,y:n.f}},Bo.prototype.scrollToElement=function(e,t){let n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);if(i!==this.getRootElement()&&this.setRootElement(i),i===e)return;t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const o=ni(e),r=Po(o),s=this.viewbox(),a=this.zoom();let l,c;s.y+=t.top/a,s.x+=t.left/a,s.width-=(t.right+t.left)/a,s.height-=(t.bottom+t.top)/a;const u=Po(s);if(o.width<s.width&&o.height<s.height){const e=Math.max(0,r.right-u.right),t=Math.min(0,r.left-u.left),n=Math.max(0,r.bottom-u.bottom),i=Math.min(0,r.top-u.top);l=e||t,c=n||i}else l=o.x-s.x,c=o.y-s.y;this.scroll({dx:-l*a,dy:-c*a})},Bo.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if("fit-viewport"===e)return this._fitViewport(t);let n,i;return this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)})),Lo(i.a,1e3)},Bo.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let o,r;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?r={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(o=Math.min(1,n.width/i.width,n.height/i.height),r={x:i.x+(e?i.width/2-n.width/o/2:0),y:i.y+(e?i.height/2-n.height/o/2:0),width:n.width/o,height:n.height/o}),this.viewbox(r),this.viewbox(!1).scale},Bo.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let s,a,l,c,u;l=i.getCTM();const h=l.a;return t?(s=F(r,t),a=s.matrixTransform(l.inverse()),c=o.translate(a.x,a.y).scale(1/h*e).translate(-a.x,-a.y),u=l.multiply(c)):u=o.scale(e),No(this._viewport,u),u},Bo.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Bo.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;if(e.waypoints){n=this.getGraphics(e).getBBox()}else n=e;return{x:n.x*t.scale-t.x*t.scale,y:n.y*t.scale-t.y*t.scale,width:n.width*t.scale,height:n.height*t.scale}},Bo.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var qo="data-element-id";function Fo(e){this._elements={},this._eventBus=e}function Vo(e,t,n){var i=function(e,t,n,i){var o=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,o,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var r=this.indexOf(e);if(void 0===n){if(-1!==r)return;n=this.length}-1!==r&&this.splice(r,1),this.splice(n,0,e),-1===r&&t.set(e,o,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}(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 Xo(e,t){if(!(this instanceof Xo))return new Xo(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Fo.$inject=["eventBus"],Fo.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),xn(t,qo,i),n&&xn(n,qo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Fo.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(xn(i.gfx,qo,""),i.secondaryGfx&&xn(i.secondaryGfx,qo,""),delete t[n])},Fo.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)},Fo.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&xn(t,qo,i),t},Fo.prototype.get=function(e){var t;t="string"==typeof e?e:e&&xn(e,qo);var n=this._elements[t];return n&&n.element},Fo.prototype.filter=function(e){var t=[];return this.forEach((function(n,i){e(n,i)&&t.push(n)})),t},Fo.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=t[n[i]],r=o.element;if(e(r,o.gfx))return r}},Fo.prototype.getAll=function(){return this.filter((function(e){return e}))},Fo.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)}))},Fo.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Fo.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")},Xo.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?Vo(this,t,e):function(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(t){if(t!==o){var r=o;o=null,r&&e.unset(r,i,n),o=t,e.set(o,i,n)}}})}(this,t,e)},Xo.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return function(e){return!0===e.__refs_collection}(n)||Vo(this,t,e),n},Xo.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Xo.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Xo.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var zo=new Xo({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Yo=new Xo({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Wo=new Xo({name:"attachers",collection:!0},{name:"host"}),Ho=new Xo({name:"outgoing",collection:!0},{name:"source"}),Uo=new Xo({name:"incoming",collection:!0},{name:"target"});function Go(){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)}}),zo.bind(this,"parent"),Yo.bind(this,"labels"),Ho.bind(this,"outgoing"),Uo.bind(this,"incoming")}function Zo(){Go.call(this),zo.bind(this,"children"),Wo.bind(this,"host"),Wo.bind(this,"attachers")}function Ko(){Go.call(this),zo.bind(this,"children")}function Jo(){Zo.call(this),Yo.bind(this,"labelTarget")}function er(){Go.call(this),Ho.bind(this,"source"),Uo.bind(this,"target")}qt(Zo,Go),qt(Ko,Zo),qt(Jo,Zo),qt(er,Go);var tr={connection:er,shape:Zo,label:Jo,root:Ko};function nr(){this._uid=12}function ir(e){return e.childNodes[0]}function or(e,t,n){var i=Dn();i.setTranslate(t,n),Vn(e,i)}function rr(e,t){this._eventBus=e,this._elementRegistry=t}function sr(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}nr.prototype.createRoot=function(e){return this.create("root",e)},nr.prototype.createLabel=function(e){return this.create("label",e)},nr.prototype.createShape=function(e){return this.create("shape",e)},nr.prototype.createConnection=function(e){return this.create("connection",e)},nr.prototype.create=function(e,t){return(t=F({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=tr[e];if(!n)throw new Error("unknown type: <"+e+">");return F(new n,t)}(e,t)},rr.$inject=["eventBus","elementRegistry"],rr.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n),t||(wn(t=Tn("g")).add("djs-children"),yn(n.parentNode,t))):t=n,t},rr.prototype._clear=function(e){var t=ir(e);return _i(t),t},rr.prototype._createContainer=function(e,t,n,i){var o=Tn("g");wn(o).add("djs-group"),void 0!==n?sr(o,t,t.childNodes[n]):yn(t,o);var r=Tn("g");wn(r).add("djs-element"),wn(r).add("djs-"+e),i&&wn(r).add("djs-frame"),yn(o,r);var s=Tn("g");return wn(s).add("djs-visual"),yn(r,s),r},rr.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,oi(t))},rr.prototype.updateContainments=function(e){var t,n=this,i=this._elementRegistry;t=E(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),k(t,(function(e){var t=e.children;if(t){var o=n._getChildrenContainer(e);k(t.slice().reverse(),(function(e){sr(i.getGraphics(e).parentNode,o)}))}}))},rr.prototype.drawShape=function(e,t,n={}){return this._eventBus.fire("render.shape",{gfx:e,element:t,attrs:n})},rr.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},rr.prototype.drawConnection=function(e,t,n={}){return this._eventBus.fire("render.connection",{gfx:e,element:t,attrs:n})},rr.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},rr.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),or(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?xn(n,"display","none"):xn(n,"display","block")}},rr.prototype.remove=function(e){qn(this._elementRegistry.getGraphics(e).parentNode)};var ar={__depends__:[ai],__init__:["canvas"],canvas:["type",Bo],elementRegistry:["type",Fo],elementFactory:["type",nr],eventBus:["type",H],graphicsFactory:["type",rr]};function lr(e){return function(e){var t=new gn(e);return t.init(),t}([{config:["value",e=e||{}]},ar].concat(e.modules||[]))}function cr(e,t){this._injector=t||lr(e),this.get("eventBus").fire("diagram.init")}cr.prototype.get=function(e,t){return this._injector.get(e,t)},cr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},cr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},cr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var ur=new Xo({name:"dmnElementRef",enumerable:!0},{name:"di",configurable:!0});function hr(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){s(e.message,{element:t,error:e})}}function o(e){var t,n;(n=(t=e).dmnElementRef)?n.di?s("multiple DI elements defined for element",{element:n}):(ur.bind(n,"di"),n.di=t):s("no DMN element referenced in element",{element:t})}function r(e){n.push(e)}function s(t,n){e.error(t,n)}return{handleDefinitions:function(t,s){var a=t.dmnDI;if(!a)throw new Error("no dmndi:DMNDI");var l,c=a.diagrams||[];if(s&&-1===c.indexOf(s))throw new Error("diagram not part of dmndi:DMNDI");if(!s&&c&&c.length&&(s=c[0]),!s)throw new Error("no diagram to display");t.di=s,function(e){k(e.diagramElements,o)}(s),l=t,e.root(l),k(t.get("drgElement"),(function(e){i(e),function(e){k(["informationRequirement","knowledgeRequirement","authorityRequirement"],(function(t){k(e[t],(function(e){r((function(){i(e)}))}))}))}(e)})),function(e){k(e,(function(e){Dt(e,"dmn:Association")?function(e){r((function(){i(e)}))}(e):i(e)}))}(t.get("artifact")),k(n,(function(e){e()}))}}}var dr="$NO_OP",pr=Array.isArray;function fr(e){var t=typeof e;return"string"===t||"number"===t}function gr(e){return xr(e)||_r(e)}function mr(e){return _r(e)||!1===e||function(e){return!0===e}(e)||xr(e)}function vr(e){return"function"==typeof e}function yr(e){return"string"==typeof e}function br(e){return"number"==typeof e}function _r(e){return null===e}function xr(e){return void 0===e}function Or(e,t){var n={};if(e)for(var i in e)n[i]=e[i];if(t)for(var o in t)n[o]=t[o];return n}var wr="$";function Cr(e,t,n,i,o,r,s,a){return{childFlags:e,children:t,className:n,dom:null,flags:i,key:void 0===o?null:o,parentVNode:null,props:void 0===r?null:r,ref:void 0===s?null:s,type:a}}function kr(e,t,n,i,o,r,s,a){var l=void 0===o?1:o,c=Cr(l,i,n,e,s,r,a,t);return 0===l&&Ar(c,c.children),c}function Er(e,t,n,i,o){(2&e)>0&&(e=t.prototype&&vr(t.prototype.render)?4:8);var r=t.defaultProps;if(!gr(r))for(var s in n||(n={}),r)xr(n[s])&&(n[s]=r[s]);if((8&e)>0){var a=t.defaultHooks;if(!gr(a))if(o)for(var l in a)xr(o[l])&&(o[l]=a[l]);else o=a}var c=Cr(1,null,null,e,i,n,o,t),u=Mr.createVNode;return vr(u)&&u(c),c}function Sr(e,t){return Cr(1,gr(e)?"":e,null,16,t,null,null,null)}function $r(e){var t=e.props;if(t){var n=e.flags;481&n&&(void 0!==t.children&&gr(e.children)&&Ar(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?Or(e.ref,t.ref):t.ref,t.ref=void 0)}return e}function Pr(e){var t,n=e.flags;if(14&n){var i,o=e.props;if(!_r(o))for(var r in i={},o)i[r]=o[r];t=Er(n,e.type,i,e.key,e.ref)}else 481&n?t=kr(n,e.type,e.className,e.children,e.childFlags,e.props,e.key,e.ref):16&n?t=Sr(e.children,e.key):1024&n&&(t=e);return t}function Tr(){return Sr("",null)}function Rr(e,t,n,i){for(var o=e.length;n<o;n++){var r=e[n];if(!mr(r)){var s=i+wr+n;if(pr(r))Rr(r,t,0,s);else{if(fr(r))r=Sr(r,s);else{var a=r.key,l=yr(a)&&a[0]===wr;_r(r.dom)&&!l||(r=Pr(r)),_r(a)||l?r.key=s:r.key=i+a}t.push(r)}}}}function Ar(e,t){var n,i=1;if(mr(t))n=t;else if(yr(t))i=2,n=Sr(t);else if(br(t))i=2,n=Sr(t+"");else if(pr(t)){var o=t.length;if(0===o)n=null,i=1;else{(Object.isFrozen(t)||!0===t.$)&&(t=t.slice()),i=8;for(var r=0;r<o;r++){var s=t[r];if(mr(s)||pr(s)){n=n||t.slice(0,r),Rr(t,n,r,"");break}if(fr(s))(n=n||t.slice(0,r)).push(Sr(s,wr+r));else{var a=s.key,l=_r(s.dom),c=_r(a),u=!c&&yr(a)&&a[0]===wr;!l||c||u?(n=n||t.slice(0,r),l&&!u||(s=Pr(s)),(c||u)&&(s.key=wr+r),n.push(s)):n&&n.push(s)}}(n=n||t).$=!0}}else n=t,_r(t.dom)||(n=Pr(t)),i=2;return e.children=n,e.childFlags=i,e}var Mr={afterRender:null,beforeRender:null,createVNode:null,renderComplete:null},Dr="http://www.w3.org/1999/xlink",Lr="http://www.w3.org/XML/1998/namespace",Ir={"xlink:actuate":Dr,"xlink:arcrole":Dr,"xlink:href":Dr,"xlink:role":Dr,"xlink:show":Dr,"xlink:title":Dr,"xlink:type":Dr,"xml:base":Lr,"xml:lang":Lr,"xml:space":Lr},Qr={},jr=[];function Br(e,t){e.appendChild(t)}function Nr(e,t,n){gr(n)?Br(e,t):e.insertBefore(t,n)}function qr(e,t,n){e.replaceChild(t,n)}function Fr(e){for(var t;void 0!==(t=e.shift());)t()}var Vr={},Xr={};function zr(e,t,n){var i=Vr[e],o=n.$EV;t?(i||(Xr[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=Wr;var o={dom:document};Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return o.dom}}),function(e,t,n,i){var o=function(e){return vr(e.composedPath)?e.composedPath()[0]:e.target}(e);for(;!_r(o);){if(t&&o.disabled)return;var r=o.$EV;if(r){var s=r[n];if(s&&(i.dom=o,s.event?s.event(s.data,e):s(e),e.cancelBubble))return}o=o.parentNode}}(t,i,e,o)};return document.addEventListener(Yr(e),t),t}(e),Vr[e]=0),o||(o=n.$EV={}),o[e]||Vr[e]++,o[e]=t):o&&o[e]&&(Vr[e]--,1===i&&(document.removeEventListener(Yr(e),Xr[e]),Xr[e]=null),o[e]=t)}function Yr(e){return e.substr(2).toLowerCase()}function Wr(){this.cancelBubble=!0,this.immediatePropagationStopped||this.stopImmediatePropagation()}function Hr(e,t){var n=document.createElement("i");return n.innerHTML=t,n.innerHTML===e.innerHTML}function Ur(e,t,n){if(e[t]){var i=e[t];i.event?i.event(i.data,n):i(n)}else{var o=t.toLowerCase();e[o]&&e[o](n)}}function Gr(e,t){var n=function(n){n.stopPropagation();var i=this.$V;if(i){var o=i.props||Qr,r=i.dom;if(yr(e))Ur(o,e,n);else for(var s=0;s<e.length;s++)Ur(o,e[s],n);if(vr(t)){var a=this.$V,l=a.props||Qr;t(l,r,!1,a)}}};return Object.defineProperty(n,"wrapped",{configurable:!1,enumerable:!1,value:!0,writable:!1}),n}function Zr(e){return"checkbox"===e||"radio"===e}var Kr=Gr("onInput",ts),Jr=Gr(["onClick","onChange"],ts);function es(e){e.stopPropagation()}function ts(e,t){var n=e.type,i=e.value,o=e.checked,r=e.multiple,s=e.defaultValue,a=!gr(i);n&&n!==t.type&&t.setAttribute("type",n),gr(r)||r===t.multiple||(t.multiple=r),gr(s)||a||(t.defaultValue=s+""),Zr(n)?(a&&(t.value=i),gr(o)||(t.checked=o)):a&&t.value!==i?(t.defaultValue=i,t.value=i):gr(o)||(t.checked=o)}function ns(e,t){if("optgroup"===e.type){var n=e.children,i=e.childFlags;if(12&i)for(var o=0,r=n.length;o<r;o++)is(n[o],t);else 2===i&&is(n,t)}else is(e,t)}function is(e,t){var n=e.props||Qr,i=e.dom;i.value=n.value,pr(t)&&-1!==t.indexOf(n.value)||n.value===t?i.selected=!0:gr(t)&&gr(n.selected)||(i.selected=n.selected||!1)}es.wrapped=!0;var os=Gr("onChange",rs);function rs(e,t,n,i){var o=Boolean(e.multiple);gr(e.multiple)||o===t.multiple||(t.multiple=o);var r=i.childFlags;if(!(1&r)){var s=i.children,a=e.value;if(n&&gr(a)&&(a=e.defaultValue),12&r)for(var l=0,c=s.length;l<c;l++)ns(s[l],a);else 2===r&&ns(s,a)}}var ss=Gr("onInput",ls),as=Gr("onChange");function ls(e,t,n){var i=e.value,o=t.value;if(gr(i)){if(n){var r=e.defaultValue;gr(r)||r===o||(t.defaultValue=r,t.value=r)}}else o!==i&&(t.defaultValue=i,t.value=i)}function cs(e,t,n,i,o,r){64&e?ts(i,n):256&e?rs(i,n,o,t):128&e&&ls(i,n,o),r&&(n.$V=t)}function us(e,t,n){64&e?function(e,t){Zr(t.type)?(e.onchange=Jr,e.onclick=es):e.oninput=Kr}(t,n):256&e?function(e){e.onchange=os}(t):128&e&&function(e,t){e.oninput=ss,t.onChange&&(e.onchange=as)}(t,n)}function hs(e){return e.type&&Zr(e.type)?!gr(e.checked):!gr(e.value)}function ds(e,t){ps(e),t&&e.dom&&(!function(e,t){e.removeChild(t)}(t,e.dom),e.dom=null)}function ps(e){var t=e.flags;if(481&t){var n=e.ref,i=e.props;vr(n)&&n(null);var o=e.children,r=e.childFlags;if(12&r?fs(o):2===r&&ps(o),!_r(i))for(var s in i)switch(s){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":zr(s,null,e.dom)}}else{var a=e.children;if(a)if(14&t){var l=e.ref;4&t?(vr(a.componentWillUnmount)&&a.componentWillUnmount(),vr(l)&&l(null),a.$UN=!0,a.$LI&&ps(a.$LI)):(!gr(l)&&vr(l.onComponentWillUnmount)&&l.onComponentWillUnmount(e.dom,e.props||Qr),ps(a))}else 1024&t&&ds(a,e.type)}}function fs(e){for(var t=0,n=e.length;t<n;t++)ps(e[t])}function gs(e,t){fs(t),e.textContent=""}function ms(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 vs(e,t,n,i,o,r,s){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":zr(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(r&&"value"===e)return;var a=gr(n)?"":n;i[e]!==a&&(i[e]=a);break;case"dangerouslySetInnerHTML":var l=t&&t.__html||"",c=n&&n.__html||"";l!==c&&(gr(c)||Hr(i,c)||(_r(s)||(12&s.childFlags?fs(s.children):2===s.childFlags&&ps(s.children),s.children=null,s.childFlags=1),i.innerHTML=c));break;default:"o"===e[0]&&"n"===e[1]?function(e,t,n){var i=e.toLowerCase();if(vr(t)||gr(t)){var o=n[i];o&&o.wrapped||(n[i]=t)}else{var r=t.event;r&&vr(r)&&(n[i]=function(e,t){return function(n){e(t.data,n)}}(r,t))}}(e,n,i):gr(n)?i.removeAttribute(e):"style"===e?function(e,t,n){var i,o,r=n.style;if(yr(t))r.cssText=t;else if(gr(e)||yr(e))for(i in t)o=t[i],r[i]=br(o)?ms(i,o):o;else{for(i in t)(o=t[i])!==e[i]&&(r[i]=br(o)?ms(i,o):o);for(i in e)gr(t[i])&&(r[i]="")}}(t,n,i):o&&Ir[e]?i.setAttributeNS(Ir[e],e,n):i.setAttribute(e,n)}}function ys(e,t,n,i,o){var r=!1,s=(448&t)>0;for(var a in s&&(r=hs(n))&&us(t,i,n),n)vs(a,null,n[a],i,o,r,null);s&&cs(t,e,i,n,!0,r)}function bs(e,t,n,i){var o=new t(n,i);if(e.children=o,o.$V=e,o.$BS=!1,o.context=i,o.props===Qr&&(o.props=n),o.$UN=!1,vr(o.componentWillMount)){if(o.$BR=!0,o.componentWillMount(),o.$PSS){var r=o.state,s=o.$PS;if(_r(r))o.state=s;else for(var a in s)r[a]=s[a];o.$PSS=!1,o.$PS=null}o.$BR=!1}vr(Mr.beforeRender)&&Mr.beforeRender(o);var l,c=_s(o.render(n,o.state,i),e);return vr(o.getChildContext)&&(l=o.getChildContext()),gr(l)?o.$CX=i:o.$CX=Or(i,l),vr(Mr.afterRender)&&Mr.afterRender(o),o.$LI=c,o}function _s(e,t){return mr(e)?e=Tr():fr(e)?e=Sr(e,null):(e.dom&&(e=Pr(e)),14&e.flags&&(e.parentVNode=t)),e}function xs(e,t,n,i){var o=e.flags;return 481&o?ws(e,t,n,i):14&o?function(e,t,n,i,o){var r,s=e.type,a=e.props||Qr,l=e.ref;if(o){var c=bs(e,s,a,n);e.dom=r=xs(c.$LI,null,c.$CX,i),ks(e,l,c),c.$UPD=!1}else{var u=_s(s(a,n),e);e.children=u,e.dom=r=xs(u,null,n,i),Es(a,l,r)}_r(t)||Br(t,r);return r}(e,t,n,i,(4&o)>0):512&o||16&o?Os(e,t):1024&o?(xs(e.children,e.type,n,!1),e.dom=Os(Tr(),t)):void 0}function Os(e,t){var n=e.dom=document.createTextNode(e.children);return _r(t)||Br(t,n),n}function ws(e,t,n,i){var o=e.flags,r=e.children,s=e.props,a=e.className,l=e.ref,c=e.childFlags;i=i||(32&o)>0;var u=function(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}(e.type,i);if(e.dom=u,gr(a)||""===a||(i?u.setAttribute("class",a):u.className=a),_r(t)||Br(t,u),!(1&c)){var h=!0===i&&"foreignObject"!==e.type;2===c?xs(r,u,n,h):12&c&&Cs(r,u,n,h)}return _r(s)||ys(e,o,s,u,i),vr(l)&&Ss(u,l),u}function Cs(e,t,n,i){for(var o=0,r=e.length;o<r;o++){var s=e[o];_r(s.dom)||(e[o]=s=Pr(s)),xs(s,t,n,i)}}function ks(e,t,n){vr(t)&&t(n),vr(n.componentDidMount)&&jr.push(function(e){return function(){e.$UPD=!0,e.componentDidMount(),e.$UPD=!1}}(n))}function Es(e,t,n){gr(t)||(vr(t.onComponentWillMount)&&t.onComponentWillMount(e),vr(t.onComponentDidMount)&&jr.push(function(e,t,n){return function(){return e.onComponentDidMount(t,n)}}(t,n,e)))}function Ss(e,t){jr.push((function(){return t(e)}))}function $s(e,t,n,i){var o=e.children,r=e.props,s=e.className,a=e.flags,l=e.ref;if(i=i||(32&a)>0,1!==t.nodeType||t.tagName.toLowerCase()!==e.type){var c=ws(e,null,n,i);e.dom=c,qr(t.parentNode,c,t)}else{e.dom=t;var u=t.firstChild,h=e.childFlags;if(1&h)_r(t.firstChild)||function(e,t){return Boolean(t&&t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html&&Hr(e,t.dangerouslySetInnerHTML.__html))}(t,r)||(t.textContent="",448&a&&(t.defaultValue=""));else{for(var d=null;u;)d=u.nextSibling,8===u.nodeType&&("!"===u.data?t.replaceChild(document.createTextNode(""),u):t.removeChild(u)),u=d;if(u=t.firstChild,2===h)_r(u)?xs(o,t,n,i):(d=u.nextSibling,Ps(o,u,n,i),u=d);else if(12&h)for(var p=0,f=o.length;p<f;p++){var g=o[p];_r(u)?xs(g,t,n,i):(d=u.nextSibling,Ps(g,u,n,i),u=d)}for(;u;)d=u.nextSibling,t.removeChild(u),u=d}_r(r)||ys(e,a,r,t,i),gr(s)?""!==t.className&&t.removeAttribute("class"):i?t.setAttribute("class",s):t.className=s,vr(l)&&Ss(t,l)}}function Ps(e,t,n,i){var o=e.flags;14&o?function(e,t,n,i,o){var r=e.type,s=e.ref,a=e.props||Qr;if(o){var l=bs(e,r,a,n),c=l.$LI;Ps(c,t,l.$CX,i),e.dom=c.dom,ks(0,s,l),l.$UPD=!1}else{var u=_s(r(a,n),e);Ps(u,t,n,i),e.children=u,e.dom=u.dom,Es(a,s,t)}}(e,t,n,i,(4&o)>0):481&o?$s(e,t,n,i):16&o?function(e,t){if(3!==t.nodeType){var n=Os(e,null);e.dom=n,qr(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:function(e){throw e||(e="a runtime error occured! Use Inferno in development environment to find the error."),new Error("Inferno Error: "+e)}()}function Ts(e,t,n,i,o){ps(e),qr(n,xs(t,null,i,o),e.dom)}function Rs(e,t,n,i,o){var r=0|t.flags;e.flags!==r||2048&r?Ts(e,t,n,i,o):481&r?function(e,t,n,i,o,r){var s=t.type;if(e.type!==s)Ts(e,t,n,i,o);else{var a,l=e.dom,c=e.props,u=t.props,h=!1,d=!1;if(t.dom=l,o=o||(32&r)>0,c!==u){var p=c||Qr;if((a=u||Qr)!==Qr)for(var f in(h=(448&r)>0)&&(d=hs(a)),a){var g=p[f],m=a[f];g!==m&&vs(f,g,m,l,o,d,e)}if(p!==Qr)for(var v in p)a.hasOwnProperty(v)||gr(p[v])||vs(v,p[v],null,l,o,d,e)}var y=e.children,b=t.children,_=t.ref,x=e.className,O=t.className;4096&r?function(e,t){e.textContent!==t.children&&(e.textContent=t.children)}(l,b):As(e.childFlags,t.childFlags,y,b,l,i,o&&"foreignObject"!==s),h&&cs(r,t,l,a,!1,d),x!==O&&(gr(O)?l.removeAttribute("class"):o?l.setAttribute("class",O):l.className=O),vr(_)&&e.ref!==_&&Ss(l,_)}}(e,t,n,i,o,r):14&r?function(e,t,n,i,o,r){var s=t.type,a=e.key,l=t.key;if(e.type!==s||a!==l)Ts(e,t,n,i,o);else{var c=t.props||Qr;if(r){var u=e.children;u.$UPD=!0,u.$V=t,Ms(u,u.state,t,c,n,i,o,!1,!1),u.$UPD=!1}else{var h=!0,d=e.props,p=t.ref,f=!gr(p),g=e.children;if(t.dom=e.dom,t.children=g,f&&vr(p.onComponentShouldUpdate)&&(h=p.onComponentShouldUpdate(d,c)),!1!==h){f&&vr(p.onComponentWillUpdate)&&p.onComponentWillUpdate(d,c);var m=s(c,i);m!==dr&&(Rs(g,m=_s(m,t),n,i,o),t.children=m,t.dom=m.dom,f&&vr(p.onComponentDidUpdate)&&p.onComponentDidUpdate(d,c))}else 14&g.flags&&(g.parentVNode=t)}}}(e,t,n,i,o,(4&r)>0):16&r?function(e,t){var n=t.children,i=e.dom;n!==e.children&&(i.nodeValue=n);t.dom=i}(e,t):512&r?t.dom=e.dom:function(e,t,n){var i=e.type,o=t.type,r=t.children;if(As(e.childFlags,t.childFlags,e.children,r,i,n,!1),t.dom=e.dom,i!==o&&!mr(r)){var s=r.dom;i.removeChild(s),o.appendChild(s)}}(e,t,i)}function As(e,t,n,i,o,r,s){switch(e){case 2:switch(t){case 2:Rs(n,i,o,r,s);break;case 1:ds(n,o);break;default:ds(n,o),Cs(i,o,r,s)}break;case 1:switch(t){case 2:xs(i,o,r,s);break;case 1:break;default:Cs(i,o,r,s)}break;default:if(12&t){var a=n.length,l=i.length;0===a?l>0&&Cs(i,o,r,s):0===l?gs(o,n):8===t&&8===e?function(e,t,n,i,o,r,s){var a,l,c=r-1,u=s-1,h=0,d=e[h],p=t[h];e:{for(;d.key===p.key;){if(p.dom&&(t[h]=p=Pr(p)),Rs(d,p,n,i,o),e[h]=p,++h>c||h>u)break e;d=e[h],p=t[h]}for(d=e[c],p=t[u];d.key===p.key;){if(p.dom&&(t[u]=p=Pr(p)),Rs(d,p,n,i,o),e[c]=p,u--,h>--c||h>u)break e;d=e[c],p=t[u]}}if(h>c){if(h<=u)for(var f=(l=u+1)<s?t[l].dom:null;h<=u;)(p=t[h]).dom&&(t[h]=p=Pr(p)),h++,Nr(n,xs(p,null,i,o),f)}else if(h>u)for(;h<=c;)ds(e[h++],n);else{var g=h,m=h,v=c-h+1,y=u-h+1,b=[];for(a=0;a<y;a++)b.push(0);var _=v===r,x=!1,O=0,w=0;if(s<4||(v|y)<32)for(a=g;a<=c;a++)if(d=e[a],w<y){for(h=m;h<=u;h++)if(p=t[h],d.key===p.key){if(b[h-m]=a+1,_)for(_=!1;a>g;)ds(e[g++],n);O>h?x=!0:O=h,p.dom&&(t[h]=p=Pr(p)),Rs(d,p,n,i,o),w++;break}!_&&h>u&&ds(d,n)}else _||ds(d,n);else{var C={};for(a=m;a<=u;a++)C[t[a].key]=a;for(a=g;a<=c;a++)if(d=e[a],w<y)if(void 0!==(h=C[d.key])){if(_)for(_=!1;a>g;)ds(e[g++],n);p=t[h],b[h-m]=a+1,O>h?x=!0:O=h,p.dom&&(t[h]=p=Pr(p)),Rs(d,p,n,i,o),w++}else _||ds(d,n);else _||ds(d,n)}if(_)gs(n,e),Cs(t,n,i,o);else if(x){var k=function(e){var t,n,i,o,r,s=e.slice(),a=[0],l=e.length;for(t=0;t<l;t++){var c=e[t];if(0!==c){if(e[n=a[a.length-1]]<c){s[t]=n,a.push(t);continue}for(i=0,o=a.length-1;i<o;)e[a[r=(i+o)/2|0]]<c?i=r+1:o=r;c<e[a[i]]&&(i>0&&(s[t]=a[i-1]),a[i]=t)}}i=a.length,o=a[i-1];for(;i-- >0;)a[i]=o,o=s[o];return a}(b);for(h=k.length-1,a=y-1;a>=0;a--)0===b[a]?((p=t[O=a+m]).dom&&(t[O]=p=Pr(p)),l=O+1,Nr(n,xs(p,null,i,o),l<s?t[l].dom:null)):h<0||a!==k[h]?(l=(O=a+m)+1,Nr(n,(p=t[O]).dom,l<s?t[l].dom:null)):h--}else if(w!==y)for(a=y-1;a>=0;a--)0===b[a]&&((p=t[O=a+m]).dom&&(t[O]=p=Pr(p)),l=O+1,Nr(n,xs(p,null,i,o),l<s?t[l].dom:null))}}(n,i,o,r,s,a,l):function(e,t,n,i,o,r,s){for(var a,l,c=r>s?s:r,u=0;u<c;u++)a=t[u],l=e[u],a.dom&&(a=t[u]=Pr(a)),Rs(l,a,n,i,o),e[u]=a;if(r<s)for(u=c;u<s;u++)(a=t[u]).dom&&(a=t[u]=Pr(a)),xs(a,n,i,o);else if(r>s)for(u=c;u<r;u++)ds(e[u],n)}(n,i,o,r,s,a,l)}else 1===t?gs(o,n):2===t&&(gs(o,n),xs(i,o,r,s))}}function Ms(e,t,n,i,o,r,s,a,l){var c,u=e.state,h=e.props;if(n.children=e,!e.$UN){if(h!==i||i===Qr){if(!l&&vr(e.componentWillReceiveProps)){if(e.$BR=!0,e.componentWillReceiveProps(i,r),e.$UN)return;e.$BR=!1}e.$PSS&&(t=Or(t,e.$PS),e.$PSS=!1,e.$PS=null)}var d=Boolean(e.shouldComponentUpdate);if(a||!d||d&&e.shouldComponentUpdate(i,t,r)){vr(e.componentWillUpdate)&&(e.$BS=!0,e.componentWillUpdate(i,t,r),e.$BS=!1),e.props=i,e.state=t,e.context=r,vr(Mr.beforeRender)&&Mr.beforeRender(e),c=e.render(i,t,r),vr(Mr.afterRender)&&Mr.afterRender(e);var p,f=c!==dr;if(vr(e.getChildContext)&&(p=e.getChildContext()),p=gr(p)?r:Or(r,p),e.$CX=p,f){var g=e.$LI,m=_s(c,n);Rs(g,m,o,p,s),e.$LI=m,vr(e.componentDidUpdate)&&e.componentDidUpdate(h,u)}}else e.props=i,e.state=t,e.context=r;n.dom=e.$LI.dom}}function Ds(e,t,n){if(e!==dr){var i=t.$V;return gr(i)?mr(e)||(e.dom&&(e=Pr(e)),_r(t.firstChild)?(xs(e,t,Qr,!1),t.$V=e):function(e,t,n){var i=t.firstChild;if(!_r(i))for(mr(e)||Ps(e,i,Qr,!1),i=t.firstChild;i=i.nextSibling;)t.removeChild(i);jr.length>0&&Fr(jr),t.$V=e,vr(n)&&n()}(e,t),i=e):gr(e)?(ds(i,t),t.$V=null):(e.dom&&(e=Pr(e)),Rs(i,e,t,Qr,!1),i=t.$V=e),jr.length>0&&Fr(jr),vr(n)&&n(),vr(Mr.renderComplete)&&Mr.renderComplete(i),i&&14&i.flags?i.children:void 0}}var Ls="undefined"==typeof Promise?null:Promise.resolve(),Is="undefined"==typeof requestAnimationFrame?setTimeout:requestAnimationFrame.bind(window);function Qs(e,t,n,i){vr(t)&&(t=t(e.state,e.props,e.context));var o,r=e.$PS;if(gr(r))e.$PS=t;else for(var s in t)r[s]=t[s];if(e.$PSS||e.$BR)e.$PSS=!0,e.$BR&&vr(n)&&jr.push(n.bind(e));else if(e.$UPD){var a=e.$QU;_r(a)&&(a=e.$QU=[],o=function(e,t){return function(){e.$QU=null,e.$UPD=!0,js(e,!1,(function(){for(var n=0,i=t.length;n<i;n++)t[n].call(e)})),e.$UPD=!1}}(e,a),Ls?Ls.then(o):Is(o)),vr(n)&&a.push(n)}else e.$PSS=!0,e.$UPD=!0,js(e,i,n),e.$UPD=!1}function js(e,t,n){if(!e.$UN){if(t||!e.$BR){e.$PSS=!1;var i=e.$PS,o=Or(e.state,i),r=e.props,s=e.context;e.$PS=null;var a=e.$V,l=e.$LI;if(Ms(e,o,a,r,l.dom&&l.dom.parentNode,s,(32&a.flags)>0,t,!0),e.$UN)return;if(!(1024&e.$LI.flags))for(var c=e.$LI.dom;!_r(a=a.parentVNode);)(14&a.flags)>0&&(a.dom=c);jr.length>0&&Fr(jr)}else e.state=e.$PS,e.$PS=null;vr(n)&&n.call(e)}}var Bs=function(){function e(e,t){this.state=null,this.props=void 0,this.context=void 0,this.refs=void 0,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||Qr,this.context=t||Qr}var t=e.prototype;return t.forceUpdate=function(e){this.$UN||Qs(this,{},e,!0)},t.setState=function(e,t){this.$UN||this.$BS||Qs(this,e,t,!1)},t.render=function(e,t,n){},e}();Bs.defaultProps=void 0;var Ns='<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>';function qs(e){var t=wt('<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;">'+Ns+"</a>");e.appendChild(t),mt.bind(t,"click",(function(e){!function(){Xs||(Xs=wt(zs),bt.bind(Xs,".backdrop","click",(function(e){document.body.removeChild(Xs)})));document.body.appendChild(Xs)}(),e.preventDefault()}))}class Fs extends Bs{constructor(e,t){super(e,t),this.node=null}componentDidMount(){qs(this.node)}render(){return kr(1,"div",null,null,1,null,null,(e=>this.node=e))}}function Vs(e){return e.join(";")}var Xs,zs='<div class="bjs-powered-by-lightbox" style="'+Vs(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+Vs(["width: 100%","height: 100%","background: rgba(40,40,40,0.2)"])+'"></div><div class="notice" style="'+Vs(["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;">'+Ns+'</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 Ys=new Mt,Ws="hsl(225, 10%, 15%)";function Hs(e,t,n,i,o,r){vn.call(this,t);var s=Ys.next(),a=i.computeStyle,l={},c=e&&e.defaultFillColor||"white",u=e&&e.defaultStrokeColor||Ws,h=e&&e.defaultLabelColor;function d(e,t,n){var i=e+"-"+Gs(t)+"-"+Gs(n)+"-"+s;return l[i]||function(e,t,n,i){if("association-start"===t){var o=Tn("path");xn(o,{d:"M 11 5 L 1 10 L 11 15"}),p(e,{element:o,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}else if("association-end"===t){var r=Tn("path");xn(r,{d:"M 1 5 L 11 10 L 1 15"}),p(e,{element:r,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}else if("information-requirement-end"===t){var s=Tn("path");xn(s,{d:"M 1 5 L 11 10 L 1 15 Z"}),p(e,{element:s,attrs:{fill:i,stroke:"none"},ref:{x:11,y:10},scale:1})}else if("knowledge-requirement-end"===t){var a=Tn("path");xn(a,{d:"M 1 3 L 11 10 L 1 17"}),p(e,{element:a,attrs:{fill:"none",stroke:i,strokeWidth:2},ref:{x:11,y:10},scale:.8})}else if("authority-requirement-end"===t){var l=Tn("circle");xn(l,{cx:3,cy:3,r:3}),p(e,{element:l,attrs:{fill:i,stroke:"none"},ref:{x:3,y:3},scale:.9})}}(i,e,0,n),"url(#"+i+")"}function p(e,t){var n=F({strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var s=Tn("marker");xn(t.element,n),yn(s,t.element),xn(s,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var a=sn("defs",r._svg);a||(a=Tn("defs"),yn(r._svg,a)),yn(a,s),l[e]=s}function f(e,t,n,i,o,r){y(o)&&(r=o,o=0),o=o||0,r=a(r,{stroke:Ws,strokeWidth:2,fill:"white"});var s=Tn("rect");return xn(s,{x:o,y:o,width:t-2*o,height:n-2*o,rx:i,ry:i}),xn(s,r),yn(e,s),s}function g(e,t,n){var i=o.createText(t||"",n);return function(e,t,n){2==arguments.length?e.getAttribute(t):e.setAttribute(t,n)}(i,"class","djs-label"),yn(e,i),i}function m(e,t,n,i){var o=function(e){return Qt(e).name}(t);return g(e,o,i=F({box:t,align:n,padding:5,style:{fill:Js(t,h,u)}},i))}function v(e,t,n){n=a(n,["no-fill"],{strokeWidth:2,stroke:Ws});var i=Tn("path");return xn(i,{d:t}),xn(i,n),yn(e,i),i}var b={"dmn:Decision":function(e,t){var n=f(e,t.width,t.height,0,{stroke:Zs(t,u),fill:Ks(t,c)});return m(e,t,"center-middle"),n},"dmn:KnowledgeSource":function(e,t){var i=v(e,n.getScaledPath("KNOWLEDGE_SOURCE",{xScaleFactor:1.021,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.075}}),{strokeWidth:2,fill:Ks(t,c),stroke:Zs(t,u)});return m(e,t,"center-middle"),i},"dmn:BusinessKnowledgeModel":function(e,t){var i=v(e,n.getScaledPath("BUSINESS_KNOWLEDGE_MODEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.3}}),{strokeWidth:2,fill:Ks(t,c),stroke:Zs(t,u)});return m(e,t,"center-middle"),i},"dmn:InputData":function(e,t){var n=f(e,t.width,t.height,22,{stroke:Zs(t,u),fill:Ks(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 v(e,n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:Zs(t,u)}),g(e,Us(t).text||"",{style:{fill:Js(t,h,u)},box:t,align:"left-top",padding:5}),i},"dmn:Association":function(e,t){var n=Us(t),i=Ks(t,c),o=Zs(t,u),r={stroke:o,strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"};return"One"!==n.associationDirection&&"Both"!==n.associationDirection||(r.markerEnd=d("association-end",i,o)),"Both"===n.associationDirection&&(r.markerStart=d("association-start",i,o)),_(e,t.waypoints,r)},"dmn:InformationRequirement":function(e,t){var n=Ks(t,c),i=Zs(t,u),o={stroke:i,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:d("information-requirement-end",n,i)};return _(e,t.waypoints,o)},"dmn:KnowledgeRequirement":function(e,t){var n=Ks(t,c),i=Zs(t,u),o={stroke:i,strokeWidth:1,strokeDasharray:5,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:d("knowledge-requirement-end",n,i)};return _(e,t.waypoints,o)},"dmn:AuthorityRequirement":function(e,t){var n=Ks(t,c),i=Zs(t,u),o={stroke:i,strokeWidth:1.5,strokeDasharray:5,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:d("authority-requirement-end",n,i)};return _(e,t.waypoints,o)}};function _(e,t,n){var i=Un(t,n=a(n,["no-fill"],{stroke:Ws,strokeWidth:2,fill:"none"}));return yn(e,i),i}this.canRender=function(e){return Dt(e,"dmn:DMNElement")||Dt(e,"dmn:InformationRequirement")||Dt(e,"dmn:KnowledgeRequirement")||Dt(e,"dmn:AuthorityRequirement")},this.drawShape=function(e,t){var n=b[t.type];return n?n(e,t):vn.prototype.drawShape.apply(this,[e,t])},this.drawConnection=function(e,t){var n=t.type,i=b[n];return i?i(e,t):vn.prototype.drawConnection.apply(this,[e,t])}}function Us(e){return e.businessObject}function Gs(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function Zs(e,t){return t}function Ks(e,t){return t}function Js(e,t,n){return t||Zs(0,n)}qt(Hs,vn),Hs.$inject=["config.drdRenderer","eventBus","pathMap","styles","textRenderer","canvas"];var ea={width:150,height:50};function ta(e,t){var n;t.textContent=e;try{var i,o=""===e;return t.textContent=o?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},o&&(i.width=0),i}catch(e){return console.log(e),{width:0,height:0}}}function na(e,t,n){for(var i,o=e.shift(),r=o;;){if((i=ta(r,n)).width=r?i.width:0," "===r||""===r||i.width<Math.round(t)||r.length<2)return ia(e,r,o,i);r=ra(r,i.width,t)}}function ia(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var oa="";function ra(e,t,n){var i=Math.max(e.length*(n/t),1),o=function(e,t){var n,i=e.split(/(\s|-|\u00AD)/g),o=[],r=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+r<t)){"-"!==n&&n!==oa||o.pop();break}o.push(n),r+=n.length}var s=o[o.length-1];return s&&s===oa&&(o[o.length-1]="-"),o.join("")}(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function sa(e){this._config=F({},{size:ea,padding:0,style:{},align:"center-top"},e||{})}sa.prototype.createText=function(e,t){return this.layoutText(e,t).element},sa.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},sa.prototype.layoutText=function(e,t){var n=F({},this._config.size,t.box),i=F({},this._config.style,t.style),o=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),r=function(e){return y(e)?F({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),s=t.fitBox||!1,a=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(i),l=e.split(/\u00AD?\r?\n/),c=[],u=n.width-r.left-r.right,h=Tn("text");for(xn(h,{x:0,y:0}),xn(h,i),yn(function(){var e=document.getElementById("helper-svg");return e||(xn(e=Tn("svg"),{id:"helper-svg"}),gi(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}(),h);l.length;)c.push(na(l,u,h));"middle"===o.vertical&&(r.top=r.bottom=0);var d=E(c,(function(e,t,n){return e+(a||t.height)}),0)+r.top+r.bottom,p=E(c,(function(e,t,n){return t.width>e?t.width:e}),0),f=r.top;"middle"===o.vertical&&(f+=(n.height-d)/2),f-=(a||c[0].height)/4;var g=Tn("text");return xn(g,i),k(c,(function(e){var t;switch(f+=a||e.height,o.horizontal){case"left":t=r.left;break;case"right":t=(s?p:u)-r.right-e.width;break;default:t=Math.max(((s?p:u)-e.width)/2+r.left,0)}var n=Tn("tspan");xn(n,{x:t,y:f}),n.textContent=e.text,yn(g,n)})),qn(h),{dimensions:{width:p,height:d},element:g}};function aa(e){var t=F({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=F({},t,{fontSize:n},e&&e.externalStyle||{}),o=new sa({style:t});this.getExternalLabelBounds=function(e,t){var n=o.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=o.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 o.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}aa.$inject=["config.textRenderer"];var la=/\{([^{}]+)\}/g,ca=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var ua={__init__:["drdRenderer"],drdRenderer:["type",Hs],textRenderer:["type",aa],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,o=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 r={};if(t.position){for(var s=t.containerHeight/o.height*t.yScaleFactor,a=t.containerWidth/o.width*t.xScaleFactor,l=0;l<o.heightElements.length;l++)r["y"+l]=o.heightElements[l]*s;for(var c=0;c<o.widthElements.length;c++)r["x"+c]=o.widthElements[c]*a}var u,h,d=(u=o.d,h={mx:n,my:i,e:r},String(u).replace(la,(function(e,t){return function(e,t,n){var i=n;return t.replace(ca,(function(e,t,n,o,r){t=t||o,i&&(t in i&&(i=i[t]),"function"==typeof i&&r&&(i=i()))})),i=(null==i||i==n?e:i)+""}(e,t,h)})));return d}}]};function ha(e,t,n,i){this._eventBus=e,this._canvas=t,this._elementRegistry=i,this._elementFactory=n}function da(e,t){return F({id:e.id,type:e.$type,businessObject:e},t)}function pa(e){return e.split("#").pop()}ha.$inject=["eventBus","canvas","elementFactory","elementRegistry"],ha.prototype.root=function(e){var t=this._elementFactory.createRoot(da(e));return this._canvas.setRootElement(t),t},ha.prototype.add=function(e){var t,n,i,o,r,s,a=this._elementFactory,l=this._canvas,c=this._eventBus,u=e.di;if(u.$instanceOf("dmndi:DMNShape"))s=u.bounds,r=da(e,{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}),t=a.createShape(r),l.addShape(t),c.fire("drdElement.added",{element:t,di:u});else{if(!u.$instanceOf("dmndi:DMNEdge"))throw new Error("unknown di for element "+e.id);n=function(e){var t=e.waypoint;if(t)return P(t,(function(e){var t={x:e.x,y:e.y};return F({original:t},t)}))}(u),i=this._getSource(e),o=this._getTarget(e),i&&o&&(r=da(e,{hidden:!1,source:i,target:o,waypoints:n}),t=a.createConnection(r),l.addConnection(t),c.fire("drdElement.added",{element:t,di:u}))}return t},ha.prototype._getSource=function(e){var t,n;if(Dt(e,"dmn:Association")?n=e.sourceRef:Dt(e,"dmn:InformationRequirement")?n=e.requiredDecision||e.requiredInput:Dt(e,"dmn:KnowledgeRequirement")?n=e.requiredKnowledge:Dt(e,"dmn:AuthorityRequirement")&&(n=e.requiredDecision||e.requiredInput||e.requiredAuthority),n&&(t=n.href),t)return this._getShape(pa(t))},ha.prototype._getTarget=function(e){return Dt(e,"dmn:Association")?e.targetRef&&this._getShape(pa(e.targetRef.href)):this._getShape(e.$parent.id)},ha.prototype._getShape=function(e){return this._elementRegistry.get(e)};var fa={__depends__:[ua,{drdImporter:["type",ha]}]};var ga={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]};function ma(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function va(e){return e.originalEvent||e.srcEvent}function ya(e){ma(e),ma(va(e))}function ba(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 _a(){return/mac/i.test(navigator.platform)}function xa(e,t){return(va(e)||e).button===t}function Oa(e){return xa(e,0)}function wa(e){var t=va(e)||e;return!!Oa(e)&&(_a()?t.metaKey:t.ctrlKey)}function Ca(e){var t=va(e)||e;return Oa(e)&&t.shiftKey}function ka(e){return!0}function Ea(e){return Oa(e)||function(e){return xa(e,1)}(e)}function Sa(e,t,n){var i=this;function o(n,i,o){var r,s;(function(e,t){var n=l[e]||Oa;return!n(t)})(n,i)||(o?s=t.getGraphics(o):(r=i.delegateTarget||i.target)&&(s=r,o=t.get(s)),s&&o&&!1===e.fire(n,{element:o,gfx:s,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var r={};function s(e){return r[e]}var a={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":ka,"element.mousedown":Ea,"element.mouseup":Ea,"element.click":Ea,"element.dblclick":Ea};function c(e,t,n,i){var s=r[n]=function(e){o(n,e)};i&&(l[n]=i),s.$delegate=Ti.bind(e,"svg, .djs-element",t,s)}function u(e,t,n){var i=s(n);i&&Ti.unbind(e,t,i.$delegate)}e.on("canvas.destroy",(function(e){!function(e){k(a,(function(t,n){u(e,n,t)}))}(e.svg)})),e.on("canvas.init",(function(e){!function(e){k(a,(function(t,n){c(e,n,t)}))}(e.svg)})),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 h=f("djs-hit djs-hit-stroke"),d=f("djs-hit djs-hit-click-stroke"),p={all:f("djs-hit djs-hit-all"),"click-stroke":d,stroke:h,"no-move":f("djs-hit djs-hit-no-move")};function f(e,t){return t=F({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function g(e,t){var n=p[t];if(!n)throw new Error("invalid hit type <"+t+">");return xn(e,n),e}function m(e,t){yn(e,t)}this.removeHits=function(e){k(Qi(".djs-hit",e),qn)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,o=e.isFrame;return i?this.createWaypointsHit(t,i):(n=o?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=Un(t);return g(n,"stroke"),m(e,n),n},this.createBoxHit=function(e,t,n){n=F({x:0,y:0},n);var i=Tn("rect");return g(i,t),xn(i,n),m(e,i),i},this.updateDefaultHit=function(e,t){var n=Ii(".djs-hit",t);if(n)return e.waypoints?Gn(n,e.waypoints):xn(n,{width:e.width,height:e.height}),n},this.fire=o,this.triggerMouseEvent=function(e,t,n){var i=a[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return o(i,t,n)},this.mouseHandler=s,this.registerEvent=c,this.unregisterEvent=u}Sa.$inject=["eventBus","elementRegistry","styles"];var $a={__init__:["interactionEvents"],interactionEvents:["type",Sa]};function Pa(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)}))}Pa.$inject=["eventBus","canvas"],Pa.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})}},Pa.prototype.get=function(){return this._selectedElements},Pa.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Pa.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();v(e)||(e=e?[e]:[]);var o=this._canvas,r=o.getRootElement();e=e.filter((function(e){var t=o.findRoot(e);return r===t})),t?k(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 Ta="hover",Ra="selected";function Aa(e,t){function n(t,n){e.addMarker(t,n)}function i(t,n){e.removeMarker(t,n)}this._canvas=e,t.on("element.hover",(function(e){n(e.element,Ta)})),t.on("element.out",(function(e){i(e.element,Ta)})),t.on("selection.changed",(function(e){var t=e.oldSelection,o=e.newSelection;k(t,(function(e){-1===o.indexOf(e)&&function(e){i(e,Ra)}(e)})),k(o,(function(e){-1===t.indexOf(e)&&function(e){n(e,Ra)}(e)}))}))}function Ma(e,t,n,i){e.on("create.end",500,(function(e){var n=e.context,i=n.canExecute,o=n.elements,r=(n.hints||{}).autoSelect;if(i){if(!1===r)return;v(r)?t.select(r):t.select(o.filter(Da))}})),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||[],o=i.get(e.context.shape.id);w(n,(function(e){return o.id===e.id}))||t.select(o)})),e.on("element.click",(function(e){if(Oa(e)){var i=e.element;i===n.getRootElement()&&(i=null);var o=t.isSelected(i),r=t.get().length>1,s=Ca(e);if(o&&r)return s?t.deselect(i):t.select(i);o?t.deselect(i):t.select(i,s)}}))}function Da(e){return!e.hidden}Aa.$inject=["canvas","eventBus"],Ma.$inject=["eventBus","selection","canvas","elementRegistry"];var La={__init__:["selectionVisuals","selectionBehavior"],__depends__:[$a],selection:["type",Pa],selectionVisuals:["type",Aa],selectionBehavior:["type",Ma]};function Ia(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}Ia.prototype.next=function(){return this._prefix+ ++this._counter};var Qa=new Ia("ov");function ja(e,t,n,i){var o,r;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=Qa,this._overlayDefaults=F({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(o=n.getContainer(),gi(r=Di('<div class="djs-overlay-container" />'),{position:"absolute",width:0,height:0}),o.insertBefore(r,o.firstChild),r),this._init()}function Ba(e,t,n){gi(e,{left:t+"px",top:n+"px"})}function Na(e,t){e.style.display=!1===t?"none":""}function qa(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}ja.$inject=["config.overlays","eventBus","canvas","elementRegistry"],ja.prototype.get=function(e){if(x(e)&&(e={id:e}),x(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?C(t.overlays,L({type:e.type})):t.overlays.slice():[]}return e.type?C(this._overlays,L({type:e.type})):e.id?this._overlays[e.id]:null},ja.prototype.add=function(e,t,n){if(y(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=F({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},ja.prototype.remove=function(e){var t=this.get(e)||[];v(t)||(t=[t]);var n=this;k(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(ji(e.html),ji(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)}}))},ja.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},ja.prototype.show=function(){Na(this._overlayRoot)},ja.prototype.hide=function(){Na(this._overlayRoot,!1)},ja.prototype.clear=function(){this._overlays={},this._overlayContainers=[],_i(this._overlayRoot)},ja.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=ni(t);i=r.x,o=r.y}Ba(n,i,o),mi(e.html,"data-container-id",t.id)},ja.prototype._updateOverlay=function(e){var t,n,i=e.position,o=e.htmlContainer,r=e.element,s=i.left,a=i.top;void 0!==i.right&&(t=r.waypoints?ni(r).width:r.width,s=-1*i.right+t);void 0!==i.bottom&&(n=r.waypoints?ni(r).height:r.height,a=-1*i.bottom+n);Ba(o,s||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ja.prototype._createOverlayContainer=function(e){var t=Di('<div class="djs-overlays" />');gi(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},ja.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";qa(this._overlayRoot,n)},ja.prototype._getOverlayContainer=function(e,t){var n=w(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},ja.prototype._addOverlay=function(e){var t,n,i=e.id,o=e.element,r=e.html;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),x(r)&&(r=Di(r)),n=this._getOverlayContainer(o),gi(t=Di('<div class="djs-overlay" data-overlay-id="'+i+'">'),{position:"absolute"}),t.appendChild(r),e.type&&yi(t).add("djs-overlay-"+e.type),Na(t,this._canvas.findRoot(o)===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())},ja.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,s=e.htmlContainer,a=!0;(i!==this._canvas.getRootElement()||n&&(g(o)&&o>t.scale||g(r)&&r<t.scale))&&(a=!1),Na(s,a),this._updateOverlayScale(e,t)},ja.prototype._updateOverlayScale=function(e,t){var n,i,o,r=e.scale,s=e.htmlContainer,a="";!0!==r&&(!1===r?(n=1,i=1):(n=r.min,i=r.max),g(n)&&t.scale<n&&(o=(1/t.scale||1)*n),g(i)&&t.scale>i&&(o=(1/t.scale||1)*i)),g(o)&&(a="scale("+o+","+o+")"),qa(s,a)},ja.prototype._updateOverlaysVisibilty=function(e){var t=this;k(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},ja.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;k(t.get({element:n}),(function(e){t.remove(e.id)}));var i=t._getOverlayContainer(n);if(i){ji(i.html);var o=t._overlayContainers.indexOf(i);-1!==o&&t._overlayContainers.splice(o,1)}})),e.on("element.changed",500,(function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(k(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&&yi(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 Fa={__init__:["overlays"],overlays:["type",ja]};function Va(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 Xa(e,t){function n(e,n){Xt(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)}))}Va.$inject=["eventBus","canvas","translate"],Va.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=rn(this.HTML_MARKUP);n.appendChild(i),this.nameElement=sn(".dmn-definitions-name",this._container),this.idElement=sn(".dmn-definitions-id",this._container),en.bind(i,".dmn-definitions-name, .dmn-definitions-id","mousedown",(function(e){e.stopPropagation()})),t.fire("definitionIdView.create",{html:i})},Va.prototype.update=function(){var e=this._canvas.getRootElement().businessObject;this.nameElement.textContent=e.name,this.idElement.textContent=e.id},Xa.$inject=["eventBus","canvas"];var za={__depends__:[ga],__init__:["definitionPropertiesView","definitionPropertiesPaletteAdapter"],definitionPropertiesView:["type",Va],definitionPropertiesPaletteAdapter:["type",Xa]},Ya=[{className:"dmn-icon-decision-table",matches:function(e){var t=Qt(e);return Dt(t,"dmn:Decision")&&Dt(t.decisionLogic,"dmn:DecisionTable")},title:"Open decision table"},{className:"dmn-icon-literal-expression",matches:function(e){return Dt(Bt(e),"dmn:LiteralExpression")},title:"Open literal expression"}];class Wa{constructor(e,t,n,i,o){this._injector=e,this._eventBus=t,this._overlays=n,this._translate=o,this._config=i||{enabled:!0},t.on(["shape.added"],(({element:e})=>{for(let t=0;t<Ya.length;t++){const{matches:n,className:i,title:o}=Ya[t];n&&n(e)&&this.addOverlay(e,i,o)}}))}addOverlay(e,t,n){const i=!1!==this._config.enabled,o=this._getOverlayNode(t,n,i),r=this._overlays.add(e,{position:{top:2,left:2},html:o});i&&(Xt(o).add("interactive"),this.bindEventListener(e,o,r))}_getOverlayNode(e,t,n){const i=document.createElement("div");if(i.className="drill-down-overlay",!n){const t=document.createElement("span");return t.className=e,i.appendChild(t),i}const o=document.createElement("button");return o.type="button",o.className=e,o.title=this._translate(t),i.appendChild(o),i}bindEventListener(e,t,n){const i=this._overlays,o=this._eventBus,r=i._overlayRoot;en.bind(r,'[data-overlay-id="'+n+'"]',"click",(()=>{!1!==o.fire("drillDown.click",{element:e})&&this.drillDown(e)}))}drillDown(e){const t=this._injector.get("_parent",!1);if(!t)return!1;const n=t.getView(e.businessObject);return!!n&&(t.open(n),!0)}}Wa.$inject=["injector","eventBus","overlays","config.drillDown","translate"];var Ha={__depends__:[Fa,ga],__init__:["drillDown"],drillDown:["type",Wa]};function Ua(e){this._container=this._createContainer(),qs(this._container),this._init(this._container,e)}function Ga(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Za(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ka(e){return Math.log(e)/Math.log(10)}function Ja(e,t){var n=Ka(e.min),i=Ka(e.max);return(Math.abs(n)+Math.abs(i))/t}qt(Ua,cr),Ua.prototype.saveSVG=kt((function(e){var t=this;return new Promise((function(e){var n=t.get("canvas"),i=n.getActiveLayer(),o=sn("defs",n._svg),r=Nn(i),s=o&&o.outerHTML||"",a=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="'+a.width+'" height="'+a.height+'" viewBox="'+a.x+" "+a.y+" "+a.width+" "+a.height+'" version="1.1">'+s+r+"</svg>"})}))})),Ua.prototype.getModules=function(){return this._modules},Ua.prototype.destroy=function(){var e;cr.prototype.destroy.call(this),(e=this._container).parentNode&&e.parentNode.removeChild(e)},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{additionalModules:n,canvas:i,...o}=t,r={...o,canvas:{...i,container:e},modules:[...[{drd:["value",this]}],...t.modules||this.getModules(),...n||[]]};cr.call(this,r),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 rn('<div class="dmn-drd-container"></div>')},Ua.prototype.open=function(e){var t=this;return new Promise(((n,i)=>{var o;try{return t._definitions&&t.clear(),t._definitions=e,function(e,t,n){var i,o=e.get("drdImporter"),r=e.get("eventBus"),s=[];r.fire("import.start",{definitions:t});try{!function(e){new hr({root:function(e){return o.root(e)},element:function(e,t){return o.add(e,t)},error:function(e,t){s.push({message:e,context:t})}}).handleDefinitions(e)}(t)}catch(e){i=e}r.fire("import.done",{error:i,warnings:s}),n(i,s)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){o=e}o?(o.warnings=o.warnings||[],i(o)):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=[fa,ga,La,Fa,za,Ha];var el=Math.sign||function(e){return e>=0?1:-1},tl={min:.2,max:4};function nl(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.focus.changed",(function(t){i._init(t.focused&&!1!==e.enabled)}))}nl.$inject=["config.zoomScroll","eventBus","canvas"],nl.prototype.scroll=function(e){this._canvas.scroll(e)},nl.prototype.reset=function(){this._canvas.zoom("fit-viewport")},nl.prototype.zoom=function(e,t){var n=Ja(tl,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},nl.prototype._handleWheel=function(e){if(this._canvas.isFocused()){var t=this._container;e.preventDefault();var n,i=e.ctrlKey||_a()&&e.metaKey,o=e.shiftKey,r=-1*this._scale;if(r*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var s=t.getBoundingClientRect(),a={x:e.clientX-s.left,y:e.clientY-s.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*el(e.deltaY)*r,this.zoom(n,a)}else n=o?{dx:r*e.deltaY,dy:0}:{dx:r*e.deltaX,dy:r*e.deltaY},this.scroll(n)}},nl.prototype.stepZoom=function(e,t){var n=Ja(tl,10);this._zoom(e,t,n)},nl.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Ka(i.zoom()),s=Math.round(r/n)*n;s+=n*o;var a,l,c=Math.pow(10,s);i.zoom((a=tl,l=c,Math.max(a.min,Math.min(a.max,l))),t)},nl.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&Si[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},nl.prototype._init=function(e){this.toggle(e)};var il={__init__:["zoomScroll"],zoomScroll:["type",nl]},ol=/^djs-cursor-.*$/;function rl(e){var t=yi(document.body);t.removeMatching(ol),e&&t.add("djs-cursor-"+e)}function sl(){rl(null)}function al(e,t){function n(){return!1}return t=t||"element.click",e.once(t,5e3,n),function(){e.off(t,n)}}function ll(e,t){var n;function i(e){return function(e){if(xi(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:ba(e)},Si.bind(document,"mousemove",o),Si.bind(document,"mouseup",r),!0}(e.originalEvent)}function o(i){var o,r=n.start,s=n.button,a=ba(i),l=Za(a,r);(!n.dragging&&(o=l,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>15)&&(n.dragging=!0,0===s&&al(e),rl("grab")),n.dragging)&&(l=Za(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);i.preventDefault()}function r(e){Si.unbind(document,"mousemove",o),Si.unbind(document,"mouseup",r),n=null,sl()}e.on("canvas.focus.changed",(function(t){t.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)})),this.isActive=function(){return!!n}}ll.$inject=["eventBus","canvas"];var cl={__init__:["moveCanvas"],moveCanvas:["type",ll]};function ul(e){return CSS.escape(e)}var hl={"&":"&","<":"<",">":">",'"':""","'":"'"};var dl=["c","C"],pl=["v","V"],fl=["y","Y"],gl=["z","Z"];function ml(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function vl(e,t){return-1!==(e=v(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function yl(e){return e.shiftKey}function bl(e){return ml(e)&&!yl(e)&&vl(gl,e)}function _l(e){return ml(e)&&(vl(fl,e)||vl(gl,e)&&yl(e))}function xl(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Ii(xl.INPUT_SELECTOR,this._container),this._resultsContainer=Ii(xl.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}function Ol(e,t,n){var i=function(e){var t="";return e.forEach((function(e){var n,i=(n=""+(n=e.value||e.matched||e.normal))&&n.replace(/[&<>"']/g,(function(e){return hl[e]})),o=e.match||e.matched;t+=o?'<b class="'+xl.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":i})),""!==t?t:null}(t),o=Di(n);o.innerHTML=i,e.appendChild(o)}xl.$inject=["canvas","eventBus","selection","translate"],xl.prototype._bindEvents=function(){var e=this;function t(t,n,i,o){e._eventMaps.push({el:t,type:i,listener:Ti.bind(t,n,i,o)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,xl.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,xl.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,xl.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,xl.INPUT_SELECTOR,"keydown",(function(e){vl("ArrowUp",e)&&e.preventDefault(),vl("ArrowDown",e)&&e.preventDefault()})),t(this._container,xl.INPUT_SELECTOR,"keyup",(function(t){if(vl("Escape",t))return e.close();if(vl("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return vl("ArrowUp",t)?e._scrollToDirection(!0):vl("ArrowDown",t)?e._scrollToDirection():void(vl(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},xl.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){Ti.unbind(e.el,e.type,e.listener)}))},xl.prototype._search=function(e){var t=this;if(this._clearResults(),e.trim()){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).length){n.forEach((function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=Ii(xl.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}else this._selection.select(null)}},xl.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},xl.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},xl.prototype._clearResults=function(){_i(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},xl.prototype._getCurrentResult=function(){return Ii(xl.RESULT_SELECTED_SELECTOR,this._resultsContainer)},xl.prototype._createResultNode=function(e,t){var n=Di(xl.RESULT_HTML);return e.primaryTokens.length>0&&Ol(n,e.primaryTokens,xl.RESULT_PRIMARY_HTML),Ol(n,e.secondaryTokens,xl.RESULT_SECONDARY_HTML),mi(n,xl.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},xl.prototype.registerProvider=function(e){this._searchProvider=e},xl.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,yi(this._canvas.getContainer()).add("djs-search-open"),yi(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},xl.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,yi(this._canvas.getContainer()).remove("djs-search-open"),yi(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},xl.prototype.toggle=function(){this.isOpen()?this.close():this.open()},xl.prototype.isOpen=function(){return this._open},xl.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&yi(t).remove(xl.RESULT_SELECTED_CLASS);var n=mi(e,xl.RESULT_ID_ATTRIBUTE),i=this._results[n].element;yi(e).add(xl.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:300}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},xl.prototype._select=function(e){var t=mi(e,xl.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:300}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},xl.prototype._getBoxHtml=function(){const e=Di(xl.BOX_HTML),t=Ii(xl.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},xl.CONTAINER_SELECTOR=".djs-search-container",xl.INPUT_SELECTOR=".djs-search-input input",xl.RESULTS_CONTAINER_SELECTOR=".djs-search-results",xl.RESULT_SELECTOR=".djs-search-result",xl.RESULT_SELECTED_CLASS="djs-search-result-selected",xl.RESULT_SELECTED_SELECTOR="."+xl.RESULT_SELECTED_CLASS,xl.RESULT_ID_ATTRIBUTE="data-result-id",xl.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",xl.BOX_HTML='<div class="djs-search-container djs-scrollable">\n <div class="djs-search-input">\n <svg class="djs-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 type="text" spellcheck="false" />\n </div>\n <div class="djs-search-results" />\n</div>',xl.RESULT_HTML='<div class="djs-search-result"></div>',xl.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',xl.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var wl={__depends__:[ga,Fa,La],searchPad:["type",xl]};function Cl(e){return Dt(e,"dmn:Decision")||Dt(e,"dmn:BusinessKnowledgeModel")||Dt(e,"dmn:InputData")||Dt(e,"dmn:KnowledgeSource")?"name":Dt(e,"dmn:TextAnnotation")?"text":void 0}function kl(e){var t=e.businessObject,n=Cl(t);if(n)return t[n]||""}function El(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function Sl(e){return C(e,(function(e){return!!e.matched})).length>0}function $l(e,t){const n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();const o=e.indexOf(t);return o>-1?(0!==o&&n.push({normal:i.substr(0,o)}),n.push({matched:i.substr(o,t.length)}),t.length+o<e.length&&n.push({normal:i.substr(t.length+o,e.length)})):n.push({normal:i}),n}El.$inject=["elementRegistry","searchPad","canvas"],El.prototype.find=function(e){const t=this._canvas.getRootElement();let n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=C(n,(function(e){return e!==t})),n=P(n,(function(t){return{primaryTokens:$l(kl(t),e),secondaryTokens:$l(t.id,e),element:t}})),n=C(n,(function(e){return Sl(e.primaryTokens)||Sl(e.secondaryTokens)})),n=D(n,(function(e){return kl(e.element)+e.element.id})),n};var Pl={__depends__:[wl],__init__:["dmnSearch"],dmnSearch:["type",El]};function Tl(e){Ua.call(this,e)}function Rl(e){return e&&e[e.length-1]}function Al(e){return e.y}function Ml(e){return e.x}qt(Tl,Ua),Tl.prototype._navigationModules=[il,cl,Pl],Tl.prototype._modules=[].concat(Tl.prototype._modules,Tl.prototype._navigationModules);var Dl={left:Ml,center:Ml,right:function(e){return e.x+e.width},top:Al,middle:Al,bottom:function(e){return e.y+e.height}};function Ll(e,t){this._modeling=e,this._rules=t}Ll.$inject=["modeling","rules"],Ll.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},Ll.prototype._isType=function(e,t){return-1!==t.indexOf(e)},Ll.prototype._alignmentPosition=function(e,t){var n,i,o,r=this._getOrientationDetails(e),s=r.axis,a=r.dimension,l={},c={},u=!1;if(this._isType(e,["left","top"]))l[e]=t[0][s];else if(this._isType(e,["right","bottom"]))o=Rl(t),l[e]=o[s]+o[a];else if(this._isType(e,["center","middle"])){if(k(t,(function(e){var t=e[s]+Math.round(e[a]/2);c[t]?c[t].elements.push(e):c[t]={elements:[e],center:t}})),n=D(c,(function(e){return e.elements.length>1&&(u=!0),e.elements.length})),u)return l[e]=Rl(n).center,l;i=t[0],o=Rl(t=D(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(i,o)}return l},Ll.prototype.trigger=function(e,t){var n,i=this._modeling,o=C(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(v(n=this._rules.allowed("elements.align",{elements:o}))&&(o=n),!(o.length<2)&&n){var r=D(o,Dl[t]),s=this._alignmentPosition(t,r);i.alignElements(r,s)}};var Il={__init__:["alignElements"],alignElements:["type",Ll]};function Ql(e,t,n,i){for(var o;o=jl(e,n,t);)n=i(t,n,o);return n}function jl(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=function(e){var t=Bl(e);e.host&&(t=t.concat(Bl(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(Bl(t))}),[])));return t}(e);return w(o,(function(e){return e!==n&&"intersect"===Mo(e,i,10)}))}function Bl(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 Nl(){return!0}function ql(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,o=Ao(e),r=Po(e);return{x:r.right+i+t.width/2,y:o.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,o){e.fire("autoPlace.start",{source:n,shape:i});var r=e.fire("autoPlace",{source:n,shape:i}),s=t.appendShape(n,i,r,n.parent,o);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function Fl(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}ql.$inject=["eventBus","modeling","canvas"],Fl.$inject=["eventBus","selection"];var Vl={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ql],autoPlaceSelectionBehavior:["type",Fl]},Xl={width:135,height:46},zl={width:180,height:80},Yl={width:125,height:45},Wl={width:100,height:63};function Hl(e){nr.call(this),this._drdFactory=e}qt(Hl,nr),Hl.$inject=["drdFactory"],Hl.prototype.baseCreate=nr.prototype.create,Hl.prototype.create=function(e,t){return this.createDrdElement(e,t)},Hl.prototype.createDrdElement=function(e,t){var n,i=this._drdFactory,o=(t=t||{}).businessObject;if(!o){if(!t.type)throw new Error("no shape type specified");o=i.create(t.type)}return o.di||("connection"===e?o.di=i.createDiEdge(o,[]):"shape"===e&&(o.di=i.createDiShape(o,{}))),n=this._getDefaultSize(o),t=F({businessObject:o,id:o.id},n,t),this.baseCreate(e,t)},Hl.prototype._getDefaultSize=function(e){return Dt(e,"dmn:BusinessKnowledgeModel")?Xl:Dt(e,"dmn:Decision")?zl:Dt(e,"dmn:InputData")?Yl:Dt(e,"dmn:KnowledgeSource")?Wl:{width:100,height:80}};var Ul="left",Gl="right",Zl=60,Kl=zl.width;function Jl(e,t){return Dt(t,"dmn:TextAnnotation")?function(e,t){var n=Po(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};return Ql(e,t,i,function(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach((function(r){var s=e[r];if(s){var a="x"===r?"width":"height",l=s.margin,c=s.minDistance;o[r]=l<0?Math.min(i[r]+l-t[a]/2,n[r]-c+l):Math.max(i[r]+i[a]+l+t[a]/2,n[r]+c+l)}})),o}}({y:{margin:-30,minDistance:20}}))}(e,t):Dt(t,"dmn:DRGElement")?function(e,t){var n=Po(e),i=Ao(e);function o(t){return t.target===e?1:-1}var r=function(e,t){t||(t={});var n=t.defaultDistance||50,i=t.direction||"e",o=t.filter,r=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||250,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?Po(e).top-Po(t).bottom:"center"===a?Po(e).top-Ao(t).y:Po(e).top-Po(t).top:"w"===i?"start"===a?Po(e).left-Po(t).right:"center"===a?Po(e).left-Ao(t).x:Po(e).left-Po(t).left:"s"===i?"start"===a?Po(t).top-Po(e).bottom:"center"===a?Ao(t).y-Po(e).bottom:Po(t).bottom-Po(e).bottom:"start"===a?Po(t).left-Po(e).right:"center"===a?Ao(t).x-Po(e).right:Po(t).right-Po(e).right}o||(o=Nl);var c=e.incoming.filter(o).map((function(t){var n=r(t),i=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:i,weight:n}})),u=e.outgoing.filter(o).map((function(t){var n=r(t),i=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:i,weight:n}})),h=E(c.concat(u).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>s||(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 h.distance||n}(e,{defaultDistance:180,direction:"s",getWeight:o,filter:ec,reference:"center"}),s={x:i.x,y:n.bottom+r};return Ql(e,t,s,function(e){var t,n,i=Ao(e);return function(e,o,r){var s;return t?(o.x<i.x?t=r:n=r,s=tc(i,Ao(t))<tc(i,Ao(n))?Ul:Gl):(t=r,n=r,s=Ao(r).x-i.x>0?Ul:Gl),s===Ul?{x:Math.min(Ao(t).x-Kl-Zl,Po(t).left-Zl-e.width/2),y:o.y}:{x:Math.max(Ao(n).x+Kl+Zl,Po(n).right+Zl+e.width/2),y:o.y}}}(e))}(e,t):void 0}function ec(e){return!Dt(e,"dmn:Association")}function tc(e,t){return Math.abs(t.x-e.x)}function nc(e){e.on("autoPlace",(function(e){var t=e.shape;return Jl(e.source,t)}))}nc.$inject=["eventBus"];var ic={__depends__:[Vl],__init__:["dmnAutoPlace"],dmnAutoPlace:["type",nc]};function oc(e,t,n){var i,o,r=this,s=n.get("dragging",!1);s&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,i=r._findTargetGfx(n),o=i&&e.get(i);i&&o&&(t.stopPropagation(),s.hover({element:o,gfx:i}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,o=e.element})),t.on("element.hover",1500,(function(e){o&&t.fire("element.out",{element:o,gfx:i})})),t.on("element.out",(function(){i=null,o=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ba(e),function(e){return xi(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}oc.$inject=["elementRegistry","eventBus","injector"];var rc={__init__:["hoverFix"],hoverFix:["type",oc]},sc=Math.round,ac="djs-drag-active";function lc(e){e.preventDefault()}function cc(e,t,n,i){var o,r={threshold:5,trapClick:!0};function s(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 a(t,n){n=n||o;var i=e.createEvent(F({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function l(e,i){var r,l=o.payload,c=o.displacement,u=o.globalStart,h=ba(e),d=Za(h,u),p=o.localStart,f=s(h),m=Za(f,p);if(!o.active&&(i||(r=d,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>o.threshold))){if(F(l,{x:sc(p.x+c.x),y:sc(p.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return g();o.active=!0,o.keepSelection||(l.previousSelection=n.get(),n.select(null)),o.cursor&&rl(o.cursor),t.addMarker(t.getRootElement(),ac)}ya(e),o.active&&(F(l,{x:sc(f.x+c.x),y:sc(f.y+c.y),dx:sc(m.x),dy:sc(m.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;o.active&&(e&&(o.payload.originalEvent=e,ya(e)),t=a("end")),!1===t&&a("rejected"),a("ended",m(!0!==t))}function u(e){vl("Escape",e)&&(lc(e),g())}function h(t){var n;o.active&&(n=al(e),setTimeout(n,400),lc(t)),c(t)}function d(e){l(e)}function p(e){var t=o.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=o.payload;t.hoverGfx=null,t.hover=null}function g(e){var t;if(o){var n=o.active;n&&a("cancel"),t=m(e),n&&a("canceled",t)}}function m(r){var s,m;a("cleanup"),sl(),m=o.trapClick?h:c,Si.unbind(document,"mousemove",l),Si.unbind(document,"dragstart",lc),Si.unbind(document,"selectstart",lc),Si.unbind(document,"mousedown",m,!0),Si.unbind(document,"mouseup",m,!0),Si.unbind(document,"keyup",u),Si.unbind(document,"touchstart",d,!0),Si.unbind(document,"touchcancel",g,!0),Si.unbind(document,"touchmove",l,!0),Si.unbind(document,"touchend",c,!0),e.off("element.hover",p),e.off("element.out",f),t.removeMarker(t.getRootElement(),ac);var v=o.payload.previousSelection;return!1!==r&&v&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(v),s=o,o=null,s}e.on("diagram.destroy",g),this.init=function(t,n,i,m){o&&g(!1),"string"==typeof n&&(m=i,i=n,n=null);var v,y,b,_,x,O=(m=F({},r,m||{})).data||{};_=m.trapClick?h:c,t?(v=va(t)||t,y=ba(t),ya(t),"dragstart"===v.type&&lc(v)):(v=null,y={x:0,y:0}),b=s(y),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),o=F({prefix:i,data:O,payload:{},globalStart:y,displacement:Za(n,b),localStart:b,isTouch:x},m),m.manual||(x?(Si.bind(document,"touchstart",d,!0),Si.bind(document,"touchcancel",g,!0),Si.bind(document,"touchmove",l,!0),Si.bind(document,"touchend",c,!0)):(Si.bind(document,"mousemove",l),Si.bind(document,"dragstart",lc),Si.bind(document,"selectstart",lc),Si.bind(document,"mousedown",_,!0),Si.bind(document,"mouseup",_,!0)),Si.bind(document,"keyup",u),e.on("element.hover",p),e.on("element.out",f)),a("init"),m.autoActivate&&l(t,!0)},this.move=l,this.hover=p,this.out=f,this.end=c,this.cancel=g,this.context=function(){return o},this.setOptions=function(e){F(r,e)}}cc.$inject=["eventBus","canvas","selection","elementRegistry"];var uc={__depends__:[rc,La],dragging:["type",cc]};function hc(e,t,n){this._canvas=n,this._opts=F({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 dc(e,t,n){return t<e&&e<n}hc.$inject=["config.autoScroll","eventBus","canvas"],hc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)dc(r[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){i.startScroll(e)}),n.scrollRepeatTimeout))},hc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},hc.prototype.setOptions=function(e){this._opts=F({},this._opts,e)},hc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ba(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var pc={__depends__:[uc],__init__:["autoScroll"],autoScroll:["type",hc]};function fc(e){this._commandStack=e.get("commandStack",!1)}fc.$inject=["injector"],fc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var gc={__init__:["rules"],rules:["type",fc]},mc=Math.round,vc=Math.max;function yc(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Fi(i,t)<=10)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,o=bo(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)),r=o[0],s=o[o.length-1];return r?r!==s?r.segment2!==s.segment2?{point:e[i=vc(r.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:mc(r.x+s.x)/2,y:mc(r.y+s.y)/2},index:r.segment2}:{point:{x:mc(r.x),y:mc(r.y)},index:r.segment2}:null}(e,t)}function bc(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=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],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function _c(e,t){var n,i=bc(e,t),o={x:i.x-e.x,y:i.y-e.y};return n=o,Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}var xc="djs-bendpoint",Oc="djs-segment-dragger";function wc(e,t,n){var i=function(e,t){var n,i=ba(t),o=e._container.getBoundingClientRect();n={x:o.left,y:o.top};var r=e.viewbox();return{x:r.x+(i.x-n.x)/r.scale,y:r.y+(i.y-n.y)/r.scale}}(e,n);return yc(t,i)}function Cc(e,t){var n=Tn("g");wn(n).add(xc),yn(e,n);var i=Tn("circle");xn(i,{cx:0,cy:0,r:4}),wn(i).add("djs-visual"),yn(n,i);var o=Tn("circle");return xn(o,{cx:0,cy:0,r:10}),wn(o).add("djs-hit"),yn(n,o),t&&wn(n).add(t),n}function kc(e,t,n,i){var o=Tn("g");yn(e,o);var r=function(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Sc("h"===n?i:o)}(t,n,i),s=Tn("rect");xn(s,{x:-9,y:-3,width:18,height:6}),wn(s).add("djs-visual"),yn(o,s);var a=Tn("rect");return xn(a,{x:-r/2,y:-8.5,width:r,height:17}),wn(a).add("djs-hit"),yn(o,a),function(e,t){var n=Dn();n.setRotate(t,0,0),Vn(e,n)}(o,"v"===i?90:0),o}function Ec(e,t,n){var i=Tn("g"),o=Yi(t,n),r=Xi(t,n);return yn(e,i),kc(i,t,n,r),wn(i).add(Oc),wn(i).add("h"===r?"horizontal":"vertical"),or(i,o.x,o.y),i}function Sc(e){return Math.abs(Math.round(2*e/3))}function $c(e,t){var n=function(e,t){for(var n,i=t.waypoints,o=1/0,r=0;r<i.length-1;r++){var s=_c(e,[i[r],i[r+1]]);s<o&&(o=s,n=r)}return[i[n],i[n+1]]}(e,t);return bc(e,n)}function Pc(e,t,n,i,o){function r(e,n){var r,s=n.waypoints,a=wc(t,s,e);if(a)return r=function(e,t){var n,i,o=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Xi((n={start:o[t.index-1],end:o[t.index]}).start,n.end))?Sc("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var i,o,r,s,a,l,c=e.index,u=e.point;return!(c<=0||e.bendpoint)&&(r=Yi(i=t[c-1],o=t[c]),s=Xi(i,o),a=Math.abs(u.x-r.x),l=Math.abs(u.y-r.y),s&&a<=n&&l<=n)}(a,s,r)?i.start(e,n,a.index,!a.bendpoint):o.start(e,n,a.index),!0}function s(e,t,i){Si.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function a(e,n){var i=t.getLayer("overlays"),o=Ii('.djs-bendpoints[data-element-id="'+ul(e.id)+'"]',i);return!o&&n&&(xn(o=Tn("g"),{"data-element-id":e.id}),wn(o).add("djs-bendpoints"),yn(i,o),s(o,"mousedown",e),s(o,"click",e),s(o,"dblclick",e)),o}function l(e,t){return Ii('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var i=Cc(e);yn(e,i),or(i,t.x,t.y)})),Cc(e,"floating")}function u(e,t){for(var n,i,o,r=t.waypoints,a=1;a<r.length;a++)Xi(n=r[a-1],i=r[a])&&(xn(o=Ec(e,n,i),{"data-segment-idx":a}),s(o,"mousemove",t))}function h(e){var t=a(e);return t||(c(t=a(e,!0),e),u(t,e)),t}function d(e){var t=a(e);t&&(!function(e){k(Qi("."+Oc,e),(function(e){qn(e)}))}(t),function(e){k(Qi("."+xc,e),(function(e){qn(e)}))}(t),u(t,e),c(t,e))}function p(e,t,n){var i,o,r=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,u=Yi(s,a),h=Xi(s,a);r&&(i=function(e){return Ii(".djs-visual",e)}(r),o={x:c.x-u.x,y:c.y-u.y},"v"===h&&(o={x:o.y,y:o.x}),or(i,o.x,o.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&qn(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=h(n),e.add?wn(t).add(e.marker):wn(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,i,o=e.element,r=o.waypoints;if(r){if(n=a(o,!0),!(i=wc(t,r,e.originalEvent)))return;!function(e,t){var n=Ii(".floating",e),i=t.point;n&&or(n,i.x,i.y)}(n,i),i.bendpoint||p(n,i,r)}})),e.on("element.mousedown",(function(e){if(Oa(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return r(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&h(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(h(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=a(t);i&&xn(i,{"data-element-id":n})}})),this.addHandles=h,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}Pc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Tc=Math.round,Rc="reconnectStart",Ac="reconnectEnd",Mc="updateWaypoints";function Dc(e,t,n,i,o,r){this._injector=e,this.start=function(e,t,r,s){var a,l=n.getGraphics(t),c=t.source,u=t.target,h=t.waypoints,d=(a=s||0!==r?s||r!==h.length-1?Mc:Ac:Rc)===Mc?"connection.updateWaypoints":"connection.reconnect",p=o.allowed(d,{connection:t,source:c,target:u});!1===p&&(p=o.allowed(d,{connection:t,source:u,target:c})),!1!==p&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:p,bendpointIndex:r,connection:t,source:c,target:u,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,r=i.source,s=i.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===Mc?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=o.allowed(c,{connection:i,source:l===Rc?a:r,target:l===Ac?a:s}))return n.source=l===Rc?a:r,void(n.target=l===Ac?a:s);!1===t&&(t=n.allowed=o.allowed(c,{connection:i,source:l===Ac?a:s,target:l===Rc?a:r})),t&&(n.source=l===Ac?a:s,n.target=l===Rc?a:r)}})),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!==Mc&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,o=t.connection,s=t.insert,a=o.waypoints.slice(),l=t.source,c=t.target,u=t.type,h=t.hints||{},d={x:Tc(e.x),y:Tc(e.y)};if(!n)return!1;u===Mc?(s?a.splice(i,0,d):a[i]=d,h.bendpointMove={insert:s,bendpointIndex:i},a=this.cropWaypoints(o,a),r.updateWaypoints(o,function(e){e=e.slice();for(var t,n,i,o=0;e[o];)t=e[o],n=e[o-1],0===Fi(t,i=e[o+1])||Vi(n,i,t)?e.splice(o,1):o++;return e}(a),h)):(u===Rc?(h.docking="source",Lc(t)&&(h.docking="target",h.newWaypoints=a.reverse())):u===Ac&&(h.docking="target",Lc(t)&&(h.docking="source",h.newWaypoints=a.reverse())),r.reconnect(o,l,c,d,h))}),this)}function Lc(e){var t=e.hover,n=e.source,i=e.target,o=e.type;return o===Rc?t&&i&&t===i&&n!==i:o===Ac?t&&n&&t===n&&n!==i:void 0}Dc.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Dc.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 Ic="updateWaypoints",Qc="connect-ok",jc="connect-not-ok",Bc="connect-hover",Nc="djs-updating",qc="djs-dragging";function Fc(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,o=t.connection,r=t.insert,s=o.waypoints,a=s.slice();t.waypoints=s,r&&a.splice(n,0,{x:e.x,y:e.y}),o.waypoints=a,wn(t.draggerGfx=Cc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(o,qc),i.addMarker(o,Nc)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,o=t.hover,r=t.type;if(o){if(i.addMarker(o,Bc),r===Ic)return;n?(i.removeMarker(o,jc),i.addMarker(o,Qc)):!1===n&&(i.removeMarker(o,Qc),i.addMarker(o,jc))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,o=t.target;n&&(i.removeMarker(n,Bc),i.removeMarker(n,o?Qc:jc))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,r=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,u=c.source,h=c.target,d=c.waypoints.slice(),p={x:t.x,y:t.y},f=n.hints||{},g={};o&&(f.connectionStart&&(g.connectionStart=f.connectionStart),f.connectionEnd&&(g.connectionEnd=f.connectionEnd),"reconnectStart"===l?Lc(n)?(g.connectionEnd=g.connectionEnd||p,g.source=h,g.target=a||u,d=d.reverse()):(g.connectionStart=g.connectionStart||p,g.source=a||u,g.target=h):"reconnectEnd"===l?Lc(n)?(g.connectionStart=g.connectionStart||p,g.source=a||h,g.target=u,d=d.reverse()):(g.connectionEnd=g.connectionEnd||p,g.source=u,g.target=a||h):(g.noCropping=!0,g.noLayout=!0,d[r]=p),l===Ic&&(d=e.cropWaypoints(c,d)),g.waypoints=d,o.drawPreview(n,i,g)),or(s,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,r=t.draggerGfx,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,qn(r),i.removeMarker(n,Nc),i.removeMarker(n,qc),s&&(i.removeMarker(s,Qc),i.removeMarker(s,a?Qc:jc)),o&&o.cleanUp(t)}))}Fc.$inject=["bendpointMove","injector","eventBus","canvas"];var Vc="connect-hover",Xc="djs-updating";function zc(e,t,n){return Yc(e,t,e[t]+n)}function Yc(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function Wc(e){return"x"===e?"y":"x"}function Hc(e,t,n){var i,o;return e.original?e.original:(i=Ao(t),Yc(e,o=Wc(n),i[o]))}function Uc(e,t,n,i,o,r){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function l(e){o.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var i=e.newWaypoints,o=function(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]);return Yc(t,i,Math.min(Math.max(r+20,e[i]),o-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],Wc(e.axis));or(e.draggerGfx,o.x,o.y)}this.start=function(e,t,o){var r,s,a,l,c=n.getGraphics(t),u=o-1,h=o,d=t.waypoints,p=d[u],f=d[h],g=wc(n,d,e);(s=Xi(p,f))&&(a="v"===s?"x":"y",0===u&&(p=Hc(p,t.source,a)),h===d.length-1&&(f=Hc(f,t.target,a)),r={connection:t,segmentStartIndex:u,segmentEndIndex:h,segmentStart:p,segmentEnd:f,axis:a,dragPosition:l=g?g.point:{x:(p.x+f.x)/2,y:(p.y+f.y)/2}},i.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:r}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,i=e.connection,o=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Ec(o,t.segmentStart,t.segmentEnd),wn(t.draggerGfx).add("djs-dragging"),n.addMarker(i,Xc)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,o=i.connection,r=i.segmentStartIndex,s=i.segmentEndIndex,u=i.segmentStart,h=i.segmentEnd,d=i.axis,p=i.originalWaypoints.slice(),f=zc(u,d,e["d"+d]),g=zc(h,d,e["d"+d]),m=p.length,v=0;p[r]=f,p[s]=g,r<2&&(t=Mo(o.source,f),1===r?"intersect"===t&&(p.shift(),p[0]=f,v--):"intersect"!==t&&(p.unshift(u),v++)),s>m-3&&(n=Mo(o.target,g),s===m-2?"intersect"===n&&(p.pop(),p[p.length-1]=g):"intersect"!==n&&p.push(h)),i.newWaypoints=o.waypoints=a(o,p),c(i,v,e),i.newSegmentStartIndex=r+v,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,Vc)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Vc)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&qn(t.draggerGfx),n.removeMarker(i,Xc)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,i=t.newWaypoints,o=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,i=e.filter((function(i,o){return!Vi(e[o-1],e[o+1],i)||(n=o<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,o),l=a(n,s.waypoints),c=s.segmentOffset,u={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:o+c}};r.updateWaypoints(n,l,u)}))}Uc.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Gc=Math.abs,Zc=Math.round;function Kc(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Zc(e.x+e.width/2),y:Zc(e.y+e.height/2)}}function Jc(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function eu(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,o=e[t],r=e.snapped=e.snapped||{};return!1===n?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function tu(e){return e.children||[]}var nu=Math.abs,iu=Math.round;function ou(e){function t(e,t){if(v(e)){for(var n=e.length;n--;)if(nu(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?$c(t,e):e.width?{x:iu(e.width/2+e.x),y:iu(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,o,r=function(e){var t=e.context,i=t.snapPoints,o=t.connection,r=o.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,u=t.axis;if(i)return i;var h=[r[a-1],s,l,r[c+1]];return a<2&&h.unshift(n(o.source,e)),c>r.length-3&&h.unshift(n(o.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},k(h,(function(e){e&&(e=e.original||e,"y"===u&&i.horizontal.push(e.y),"x"===u&&i.vertical.push(e.x))})),i}(e),s=e.x,a=e.y;if(r){var l=s-(i=t(r.vertical,s)),c=a-(o=t(r.horizontal,a));F(e,{dx:e.dx-l,dy:e.dy-c,x:i,y:o}),(l||-1!==r.vertical.indexOf(s))&&eu(e,"x",i),(c||-1!==r.horizontal.indexOf(a))&&eu(e,"y",o)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);Eo(t)&&i&&i.x&&i.y&&(eu(e,"x",i.x),eu(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,o,r=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var o=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},k(o,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(r),a=r.hover,l=a&&n(a,e),c=e.x,u=e.y;if(s){var h=c-(i=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=u-(o=t(l?s.horizontal.concat([l.y]):s.horizontal,u));F(e,{dx:e.dx-h,dy:e.dy-d,x:e.x-h,y:e.y-d}),(h||-1!==s.vertical.indexOf(c))&&eu(e,"x",i),(d||-1!==s.horizontal.indexOf(u))&&eu(e,"y",o)}}))}ou.$inject=["eventBus"];var ru={__depends__:[uc,gc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Pc],bendpointMove:["type",Dc],bendpointMovePreview:["type",Fc],connectionSegmentMove:["type",Uc],bendpointSnapping:["type",ou]};const su=new Ia;function au(e){this._scheduled={},e.on("diagram.destroy",(()=>{Object.keys(this._scheduled).forEach((e=>{this.cancel(e)}))}))}au.$inject=["eventBus"],au.prototype.schedule=function(e,t=su.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},au.prototype._schedule=function(e,t){const n=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}(),i=setTimeout((()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(e){n.reject(e)}}catch(e){console.error("Scheduler#_schedule execution failed",e)}}));return{executionId:i,promise:n.promise}},au.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},au.prototype._cancel=function(e){clearTimeout(e.executionId)};var lu={scheduler:["type",au]},cu=".entry";function uu(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}uu.$inject=["canvas","elementRegistry","eventBus","scheduler"],uu.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 o=i.target,r=v(o)?o:[o];if(r.filter((function(e){return n.includes(e)})).length){e.close();var s=r.filter((function(t){return e._elementRegistry.get(t.id)}));s.length&&e._updateAndOpen(s.length>1?s:s[0])}}})),this._eventBus.on("canvas.viewbox.changed",(function(){e._updatePosition()})),this._eventBus.on("element.marker.update",(function(t){if(e.isOpen()){var n=t.element,i=e._current;(v(i.target)?i.target:[i.target]).includes(n)&&e._updateVisibility()}})),this._container=this._createContainer()},uu.prototype._createContainer=function(){var e=Di('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},uu.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},uu.prototype.getEntries=function(e){var t=this._getProviders(),n=v(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(t,(function(t){if(_(t[n])){var o=t[n](e);_(o)?i=o(i):k(o,(function(e,t){i[t]=e}))}})),i},uu.prototype.trigger=function(e,t,n){var i,o,r=this,s=t.delegateTarget||t.target;return s?(i=mi(s,"data-action"),o=t.originalEvent||t,"mouseover"!==e?"mouseout"===e?(clearTimeout(this._timeout),void(this._mouseout&&(this._mouseout(),this._mouseout=null))):this.triggerEntry(i,e,o,n):void(this._timeout=setTimeout((function(){r._mouseout=r.triggerEntry(i,"hover",o,n)}),300))):t.preventDefault()},uu.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries[e];if(r){var s=r.action;if(!1!==this._eventBus.fire("contextPad.trigger",{entry:r,event:n})){if(_(s)){if("click"===t)return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},uu.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},uu.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},uu.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),i=this._createHtml(e);k(n,(function(e,n){var o,r=e.group||"default",s=Di(e.html||'<div class="entry" draggable="true"></div>');mi(s,"data-action",n),(o=Ii("[data-group="+ul(r)+"]",i))||(mi(o=Di('<div class="group"></div>'),"data-group",r),i.appendChild(o)),o.appendChild(s),e.className&&function(e,t){var n=yi(e);t=v(t)?t:t.split(/\s+/g),t.forEach((function(e){n.add(e)}))}(s,e.className),e.title&&mi(s,"title",e.title),e.imageUrl&&(mi(t=Di("<img>"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",s.appendChild(t))})),yi(i).add("open"),this._current={entries:n,html:i,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},uu.prototype._createHtml=function(e){var t=this,n=Di('<div class="djs-context-pad"></div>');return Ti.bind(n,cu,"click",(function(e){t.trigger("click",e)})),Ti.bind(n,cu,"dragstart",(function(e){t.trigger("dragstart",e)})),Ti.bind(n,cu,"mouseover",(function(e){t.trigger("mouseover",e)})),Ti.bind(n,cu,"mouseout",(function(e){t.trigger("mouseout",e)})),Si.bind(n,"mousedown",(function(e){e.stopPropagation()})),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},uu.prototype.getPad=function(e){let t;return console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888")),t=this.isOpen()&&function(e,t){return e=v(e)?e:[e],t=v(t)?t:[t],e.length===t.length&&S(e,(function(e){return t.includes(e)}))}(this._current.target,e)?this._current.html:this._createHtml(e),{html:t}},uu.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},uu.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return v(e)===v(n)&&(v(e)?e.length===n.length&&S(e,(function(e){return n.includes(e)})):n===e)},uu.prototype.isShown=function(){return this.isOpen()&&yi(this._current.html).has("open")},uu.prototype.show=function(){this.isOpen()&&(yi(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},uu.prototype.hide=function(){this.isOpen()&&(yi(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},uu.prototype._getPosition=function(e){if(!v(e)&&Eo(e)){var t=this._canvas.viewbox(),n=(r=e).waypoints[r.waypoints.length-1],i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+8*this._canvas.zoom(),top:o}}var r,s=this._canvas.getContainer().getBoundingClientRect(),a=this._getTargetBounds(e);return{left:a.right-s.left+8*this._canvas.zoom(),top:a.top-s.top}},uu.prototype._updatePosition=function(){this._scheduler.schedule((()=>{if(this.isOpen()){var e=this._current.html,t=this._getPosition(this._current.target);"x"in t&&"y"in t?(e.style.left=t.x+"px",e.style.top=t.y+"px"):["top","right","bottom","left"].forEach((function(n){n in t&&(e.style[n]=t[n]+"px")}))}}),"ContextPad#_updatePosition")},uu.prototype._updateVisibility=function(){this._scheduler.schedule((()=>{if(this.isOpen()){var e=this,t=this._current.target;(v(t)?t:[t]).some((function(t){return e._canvas.hasMarker(t,"djs-element-hidden")}))?e.hide():e.show()}}),"ContextPad#_updateVisibility")},uu.prototype._getTargetBounds=function(e){var t=this;return(v(e)?e:[e]).map((function(e){return t._canvas.getGraphics(e)})).reduce((function(e,t){const n=t.getBoundingClientRect();return e.top=Math.min(e.top,n.top),e.right=Math.max(e.right,n.right),e.bottom=Math.max(e.bottom,n.bottom),e.left=Math.min(e.left,n.left),e.x=e.left,e.y=e.top,e.width=e.right-e.left,e.height=e.bottom-e.top,e}),{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};var hu={__depends__:[$a,lu,Fa],contextPad:["type",uu]};function du(e,t,n,i){function o(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,r=e.hover;if(n.hover=r,!m(t=n.canExecute=o(i,r))){if(!1!==t)return n.source=i,void(n.target=r);m(t=n.canExecute=o(r,i))||!1!==t&&(n.source=r,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,o=t.connectionStart,r={x:e.x,y:e.y},s=t.source,a=t.target;if(!i)return!1;var l=null,c={connectionStart:pu(t)?r:o,connectionEnd:pu(t)?o:r};y(i)&&(l=i),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,i,o){y(i)||(o=i,i=Ao(n)),t.init(e,"connect",{autoActivate:o,data:{shape:n,context:{start:n,connectionStart:i}}})}}function pu(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}du.$inject=["eventBus","dragging","modeling","rules"];var fu="connect-ok",gu="connect-not-ok";function mu(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,o=t.hover,r=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,u=t.connectionEnd||{x:e.x,y:e.y},h=c,d=u;pu(t)&&(h=u,d=c),i.drawPreview(t,n,{source:r||s,target:l||o,connectionStart:h,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,o=t.canExecute;null!==o&&n.addMarker(i,o?fu:gu)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,fu),n.removeMarker(t,gu))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}mu.$inject=["injector","eventBus","canvas"];var vu={__depends__:[La,gc,uc],__init__:["connectPreview"],connect:["type",du],connectPreview:["type",mu]};const yu=new Ia("ps");var bu=["marker-start","marker-mid","marker-end"],_u=["circle","ellipse","line","path","polygon","polyline","path","rect"];function xu(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}xu.$inject=["elementRegistry","eventBus","canvas","styles"],xu.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},xu.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},xu.prototype.addDragger=function(e,t,n,i="djs-dragger"){var o=En(n=n||this.getGfx(e)),r=n.getBoundingClientRect();return this._cloneMarkers(ir(o),i),xn(o,this._styles.cls(i,[],{x:r.top,y:r.left})),yn(t,o),xn(o,"data-preview-support-element-id",e.id),o},xu.prototype.addFrame=function(e,t){var n=Tn("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return yn(t,n),xn(n,"data-preview-support-element-id",e.id),n},xu.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach((e=>{i._cloneMarkers(e,t,n)})),function(e){return-1!==_u.indexOf(e.nodeName)}(e)&&bu.forEach((function(o){if(xn(e,o)){var r=function(e,t,n){var i=(o=xn(e,t),o.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var o;return Ii("marker#"+i,n||document)}(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}}))},xu.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,yu.next()].join("-"),s=Ii("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||En(n);a.id=r,wn(a).add(o);var l=Ii(":scope > defs",e);l||yn(e,l=Tn("defs")),yn(l,a);var c=function(e){return"url(#"+e+")"}(a.id);xn(t,i,c)};var Ou={__init__:["previewSupport"],previewSupport:["type",xu]},wu="drop-ok",Cu="drop-not-ok",ku="attach-ok",Eu="new-parent",Su="create";function $u(e,t,n,i,o){function r(t,n){[ku,wu,Cu,Eu].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===Su&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,s=t.source,a=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);Pu(e);var l={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i,r){if(!t)return!1;var s=w(e=C(e,(function(t){var n=t.labelTarget;return!(t.parent||So(t)&&-1!==e.indexOf(n))})),(function(e){return!Eo(e)})),a=!1,l=!1,c=!1;Tu(e)&&(a=o.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=Tu(e)?o.allowed("shape.create",{position:n,shape:s,source:i,target:t}):o.allowed("elements.create",{elements:e,position:n,target:t}));var u=r.connectionTarget;return c||a?(s&&i&&(l=o.allowed("connection.create",{source:u===i?s:i,target:u===i?i:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,i,l,s,a);i&&null!==c&&(t.target=i,c&&c.attach?r(i,ku):r(i,c?Eu:Cu))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&r(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,o=t.shape,r=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,u=t.hints||{};if(!1===a||!s)return!1;Pu(e);var h={x:e.x,y:e.y};o=c?i.appendShape(n,o,h,s,{attach:l,connection:!0===c?{}:c,connectionTarget:u.connectionTarget}):w(r=i.createElements(r,h,s,F({},u,{attach:l})),(function(e){return!Eo(e)})),F(t,{elements:r,shape:o}),F(e,{elements:r,shape:o})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,i){v(n)||(n=[n]);var o=w(n,(function(e){return!Eo(e)}));if(o){i=F({elements:n,hints:{},shape:o},i||{}),k(n,(function(e){b(e.x)||(e.x=0),b(e.y)||(e.y=0)}));var r=ni(C(n,(function(e){return!e.hidden})));k(n,(function(e){Eo(e)&&(e.waypoints=P(e.waypoints,(function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}}))),F(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})})),t.init(e,Su,{cursor:"grabbing",autoActivate:!0,data:{shape:o,elements:n,context:i}})}}}function Pu(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 Tu(e){return e&&1===e.length&&!Eo(e[0])}$u.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ru(e,t,n,i,o){t.on("create.move",750,(function(t){var r=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Tn("g");xn(t,o.cls("djs-drag-group",["no-events"]));var r=Tn("g");return e.forEach((function(e){var o;e.hidden||(e.waypoints?(o=n._createContainer("connection",r),n.drawConnection(ir(o),e)):(o=n._createContainer("shape",r),n.drawShape(ir(o),e),or(o,e.x,e.y)),i.addDragger(e,t,o))})),t}(a)),r?(l.parentNode||yn(e.getActiveLayer(),l),or(l,t.x,t.y)):qn(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&qn(t)}))}Ru.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var Au,Mu,Du,Lu,Iu,Qu,ju,Bu={__depends__:[uc,Ou,gc,La],__init__:["create","createPreview"],create:["type",$u],createPreview:["type",Ru]},Nu={},qu=[],Fu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Vu(e,t){for(var n in t)e[n]=t[n];return e}function Xu(e){var t=e.parentNode;t&&t.removeChild(e)}function zu(e,t,n){var i,o,r,s={};for(r in t)"key"==r?i=t[r]:"ref"==r?o=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?Au.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===s[r]&&(s[r]=e.defaultProps[r]);return Yu(e,s,i,o,null)}function Yu(e,t,n,i,o){var r={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==o?++Du:o};return null==o&&null!=Mu.vnode&&Mu.vnode(r),r}function Wu(e){return e.children}function Hu(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Fu.test(t)?n:n+"px"}function Uu(e,t,n,i,o){var r;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||Hu(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||Hu(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])r=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i||e.addEventListener(t,r?Zu:Gu,r):e.removeEventListener(t,r?Zu:Gu,r);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("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 Gu(e){Lu=!0;try{return this.l[e.type+!1](Mu.event?Mu.event(e):e)}finally{Lu=!1}}function Zu(e){Lu=!0;try{return this.l[e.type+!0](Mu.event?Mu.event(e):e)}finally{Lu=!1}}function Ku(e,t){this.props=e,this.context=t}function Ju(e,t){if(null==t)return e.__?Ju(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?Ju(e):null}function eh(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 eh(e)}}function th(e){Lu?setTimeout(e):ju(e)}function nh(e){(!e.__d&&(e.__d=!0)&&Iu.push(e)&&!ih.__r++||Qu!==Mu.debounceRendering)&&((Qu=Mu.debounceRendering)||th)(ih)}function ih(){var e,t,n,i,o,r,s,a;for(Iu.sort((function(e,t){return e.__v.__b-t.__v.__b}));e=Iu.shift();)e.__d&&(t=Iu.length,i=void 0,o=void 0,s=(r=(n=e).__v).__e,(a=n.__P)&&(i=[],(o=Vu({},r)).__v=r.__v+1,lh(a,r,o,n.__n,void 0!==a.ownerSVGElement,null!=r.__h?[s]:null,i,null==s?Ju(r):s,r.__h),ch(i,r),r.__e!=s&&eh(r)),Iu.length>t&&Iu.sort((function(e,t){return e.__v.__b-t.__v.__b})));ih.__r=0}function oh(e,t,n,i,o,r,s,a,l,c){var u,h,d,p,f,g,m,v=i&&i.__k||qu,y=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(p=n.__k[u]=null==(p=t[u])||"boolean"==typeof p?null:"string"==typeof p||"number"==typeof p||"bigint"==typeof p?Yu(null,p,null,null,p):Array.isArray(p)?Yu(Wu,{children:p},null,null,null):p.__b>0?Yu(p.type,p.props,p.key,p.ref?p.ref:null,p.__v):p)){if(p.__=n,p.__b=n.__b+1,null===(d=v[u])||d&&p.key==d.key&&p.type===d.type)v[u]=void 0;else for(h=0;h<y;h++){if((d=v[h])&&p.key==d.key&&p.type===d.type){v[h]=void 0;break}d=null}lh(e,p,d=d||Nu,o,r,s,a,l,c),f=p.__e,(h=p.ref)&&d.ref!=h&&(m||(m=[]),d.ref&&m.push(d.ref,null,p),m.push(h,p.__c||f,p)),null!=f?(null==g&&(g=f),"function"==typeof p.type&&p.__k===d.__k?p.__d=l=rh(p,l,e):l=sh(e,p,d,v,f,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=e&&(l=Ju(d))}for(n.__e=g,u=y;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=ah(i).nextSibling),hh(v[u],v[u]));if(m)for(u=0;u<m.length;u++)uh(m[u],m[++u],m[++u])}function rh(e,t,n){for(var i,o=e.__k,r=0;o&&r<o.length;r++)(i=o[r])&&(i.__=e,t="function"==typeof i.type?rh(i,t,n):sh(n,i,i,o,i.__e,t));return t}function sh(e,t,n,i,o,r){var s,a,l;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=r||null==o.parentNode)e:if(null==r||r.parentNode!==e)e.appendChild(o),s=null;else{for(a=r,l=0;(a=a.nextSibling)&&l<i.length;l+=1)if(a==o)break e;e.insertBefore(o,r),s=r}return void 0!==s?s:o.nextSibling}function ah(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=ah(n)))return i;return null}function lh(e,t,n,i,o,r,s,a,l){var c,u,h,d,p,f,g,m,v,y,b,_,x,O,w,C=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,r=[a]),(c=Mu.__b)&&c(t);try{e:if("function"==typeof C){if(m=t.props,v=(c=C.contextType)&&i[c.__c],y=c?v?v.props.value:c.__:i,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in C&&C.prototype.render?t.__c=u=new C(m,y):(t.__c=u=new Ku(m,y),u.constructor=C,u.render=dh),v&&v.sub(u),u.props=m,u.state||(u.state={}),u.context=y,u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=C.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=Vu({},u.__s)),Vu(u.__s,C.getDerivedStateFromProps(m,u.__s))),d=u.props,p=u.state,u.__v=t,h)null==C.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==C.getDerivedStateFromProps&&m!==d&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(m,y),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(m,u.__s,y)||t.__v===n.__v){for(t.__v!==n.__v&&(u.props=m,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<u._sb.length;b++)u.__h.push(u._sb[b]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(m,u.__s,y),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(d,p,f)}))}if(u.context=y,u.props=m,u.__P=e,_=Mu.__r,x=0,"prototype"in C&&C.prototype.render){for(u.state=u.__s,u.__d=!1,_&&_(t),c=u.render(u.props,u.state,u.context),O=0;O<u._sb.length;O++)u.__h.push(u._sb[O]);u._sb=[]}else do{u.__d=!1,_&&_(t),c=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++x<25);u.state=u.__s,null!=u.getChildContext&&(i=Vu(Vu({},i),u.getChildContext())),h||null==u.getSnapshotBeforeUpdate||(f=u.getSnapshotBeforeUpdate(d,p)),w=null!=c&&c.type===Wu&&null==c.key?c.props.children:c,oh(e,Array.isArray(w)?w:[w],t,n,i,o,r,s,a,l),u.base=t.__e,t.__h=null,u.__h.length&&s.push(u),g&&(u.__E=u.__=null),u.__e=!1}else null==r&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,i,o,r,s,a){var l,c,u,h=n.props,d=t.props,p=t.type,f=0;if("svg"===p&&(o=!0),null!=r)for(;f<r.length;f++)if((l=r[f])&&"setAttribute"in l==!!p&&(p?l.localName===p:3===l.nodeType)){e=l,r[f]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),r=null,a=!1}if(null===p)h===d||a&&e.data===d||(e.data=d);else{if(r=r&&Au.call(e.childNodes),c=(h=n.props||Nu).dangerouslySetInnerHTML,u=d.dangerouslySetInnerHTML,!a){if(null!=r)for(h={},f=0;f<e.attributes.length;f++)h[e.attributes[f].name]=e.attributes[f].value;(u||c)&&(u&&(c&&u.__html==c.__html||u.__html===e.innerHTML)||(e.innerHTML=u&&u.__html||""))}if(function(e,t,n,i,o){var r;for(r in n)"children"===r||"key"===r||r in t||Uu(e,r,null,n[r],i);for(r in t)o&&"function"!=typeof t[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===t[r]||Uu(e,r,t[r],n[r],i)}(e,d,h,o,a),u)t.__k=[];else if(f=t.props.children,oh(e,Array.isArray(f)?f:[f],t,n,i,o&&"foreignObject"!==p,r,s,r?r[0]:n.__k&&Ju(n,0),a),null!=r)for(f=r.length;f--;)null!=r[f]&&Xu(r[f]);a||("value"in d&&void 0!==(f=d.value)&&(f!==e.value||"progress"===p&&!f||"option"===p&&f!==h.value)&&Uu(e,"value",f,h.value,!1),"checked"in d&&void 0!==(f=d.checked)&&f!==e.checked&&Uu(e,"checked",f,h.checked,!1))}return e}(n.__e,t,n,i,o,r,s,l);(c=Mu.diffed)&&c(t)}catch(e){t.__v=null,(l||null!=r)&&(t.__e=a,t.__h=!!l,r[r.indexOf(a)]=null),Mu.__e(e,t,n)}}function ch(e,t){Mu.__c&&Mu.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Mu.__e(e,t.__v)}}))}function uh(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Mu.__e(e,n)}}function hh(e,t,n){var i,o;if(Mu.unmount&&Mu.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||uh(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Mu.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&hh(i[o],t,n||"function"!=typeof e.type);n||null==e.__e||Xu(e.__e),e.__=e.__e=e.__d=void 0}function dh(e,t,n){return this.constructor(e,n)}function ph(e,t,n){var i,o,r;Mu.__&&Mu.__(e,t),o=(i="function"==typeof n)?null:t.__k,r=[],lh(t,e=(!i&&n||t).__k=zu(Wu,null,[e]),o||Nu,Nu,void 0!==t.ownerSVGElement,!i&&n?[n]:o?null:t.firstChild?Au.call(t.childNodes):null,r,!i&&n?n:o?o.__e:t.firstChild,i),ch(r,e)}Au=qu.slice,Mu={__e:function(e,t,n,i){for(var o,r,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},Du=0,Lu=!1,Ku.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Vu({},this.state),"function"==typeof e&&(e=e(Vu({},n),this.props)),e&&Vu(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),nh(this))},Ku.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),nh(this))},Ku.prototype.render=Wu,Iu=[],ju="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ih.__r=0;var fh=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var s=t[r++],a=t[r]?(t[0]|=s?1:2,n[t[r++]]):t[++r];3===s?i[0]=a:4===s?i[1]=Object.assign(i[1]||{},a):5===s?(i[1]=i[1]||{})[t[++r]]=a:6===s?i[1][t[++r]]+=a+"":s?(o=e.apply(a,fh(e,a,n,["",null])),i.push(o),a[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(a)}return i},gh=new Map;var mh,vh,yh,bh,_h=function(e){var t=gh.get(this);return t||(t=new Map,gh.set(this,t)),(t=fh(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,i=1,o="",r="",s=[0],a=function(e){1===i&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,e,o):3===i&&(e||o)?(s.push(3,e,o),i=2):2===i&&"..."===o&&e?s.push(4,e,0):2===i&&o&&!e?s.push(5,0,!0,o):i>=5&&((o||!e&&5===i)&&(s.push(i,0,o,n),i=6),e&&(s.push(i,e,0,n),i=6)),o=""},l=0;l<e.length;l++){l&&(1===i&&a(),a(l));for(var c=0;c<e[l].length;c++)t=e[l][c],1===i?"<"===t?(a(),s=[s],i=3):o+=t:4===i?"--"===o&&">"===t?(i=1,o=""):o=t+o[0]:r?t===r?r="":o+=t:'"'===t||"'"===t?r=t:">"===t?(a(),i=1):i&&("="===t?(i=5,n=o,o=""):"/"===t&&(i<5||">"===e[l][c+1])?(a(),3===i&&(s=s[0]),i=s,(s=s[0]).push(2,0,i),i=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),i=2):o+=t),3===i&&"!--"===o&&(i=4,s=s[0])}return a(),s}(e)),t),arguments,[])).length>1?t:t[0]}.bind(zu),xh=0,Oh=[],wh=[],Ch=Mu.__b,kh=Mu.__r,Eh=Mu.diffed,Sh=Mu.__c,$h=Mu.unmount;function Ph(e,t){Mu.__h&&Mu.__h(vh,e,xh||t),xh=0;var n=vh.__H||(vh.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:wh}),n.__[e]}function Th(e){return xh=1,function(e,t){var n=Ph(mh++,2);if(n.t=e,!n.__c&&(n.__=[Fh(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],i=n.t(t,e);t!==i&&(n.__N=[i,n.__[1]],n.__c.setState({}))}],n.__c=vh,!vh.u)){vh.u=!0;var i=vh.shouldComponentUpdate;vh.shouldComponentUpdate=function(e,t,o){if(!n.__c.__H)return!0;var r=n.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!i||i.call(this,e,t,o);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&n.__c.props===e)&&(!i||i.call(this,e,t,o))}}return n.__N||n.__}(Fh,e)}function Rh(e,t){var n=Ph(mh++,3);!Mu.__s&&qh(n.__H,t)&&(n.__=e,n.i=t,vh.__H.__h.push(n))}function Ah(e,t){var n=Ph(mh++,4);!Mu.__s&&qh(n.__H,t)&&(n.__=e,n.i=t,vh.__h.push(n))}function Mh(e){return xh=5,Dh((function(){return{current:e}}),[])}function Dh(e,t){var n=Ph(mh++,7);return qh(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Lh(e,t){return xh=8,Dh((function(){return e}),t)}function Ih(){for(var e;e=Oh.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Bh),e.__H.__h.forEach(Nh),e.__H.__h=[]}catch(t){e.__H.__h=[],Mu.__e(t,e.__v)}}Mu.__b=function(e){vh=null,Ch&&Ch(e)},Mu.__r=function(e){kh&&kh(e),mh=0;var t=(vh=e.__c).__H;t&&(yh===vh?(t.__h=[],vh.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=wh,e.__N=e.i=void 0}))):(t.__h.forEach(Bh),t.__h.forEach(Nh),t.__h=[])),yh=vh},Mu.diffed=function(e){Eh&&Eh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Oh.push(t)&&bh===Mu.requestAnimationFrame||((bh=Mu.requestAnimationFrame)||jh)(Ih)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==wh&&(e.__=e.__V),e.i=void 0,e.__V=wh}))),yh=vh=null},Mu.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Bh),e.__h=e.__h.filter((function(e){return!e.__||Nh(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Mu.__e(n,e.__v)}})),Sh&&Sh(e,t)},Mu.unmount=function(e){$h&&$h(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Bh(e)}catch(e){t=e}})),n.__H=void 0,t&&Mu.__e(t,n.__v))};var Qh="function"==typeof requestAnimationFrame;function jh(e){var t,n=function(){clearTimeout(i),Qh&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Qh&&(t=requestAnimationFrame(n))}function Bh(e){var t=vh,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),vh=t}function Nh(e){var t=vh;e.__c=e.__(),vh=t}function qh(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Fh(e,t){return"function"==typeof t?t(e):t}function Vh(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Vh(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Xh(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Vh(e))&&(i&&(i+=" "),i+=t);return i}function zh(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,s=Dh((()=>t.reduce(((e,t)=>{const n=t.group||"default",i=e.find((e=>e.id===n));return i?i.entries.push(t):e.push({id:n,entries:[t]}),e}),[])),[t]);return _h`
<div class="djs-popup-header">
<h3 class="djs-popup-title" title=${r}>${r}</h3>
${s.map((e=>_h`
<ul key=${e.id} class="djs-popup-header-group" data-header-group=${e.id}>
${e.entries.map((e=>_h`
<li key=${e.id}>
<${e.action?"button":"span"}
class=${function(e,t){return Xh("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}(e,e===i)}
onClick=${t=>e.action&&n(t,e)}
title=${e.title||e.label}
data-id=${e.id}
onMouseEnter=${()=>e.action&&o(e)}
onMouseLeave=${()=>e.action&&o(null)}
onFocus=${()=>e.action&&o(e)}
onBlur=${()=>e.action&&o(null)}
>
${e.imageUrl&&_h`<img class="djs-popup-entry-icon" src=${e.imageUrl} alt="" />`||e.imageHtml&&_h`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:e.imageHtml}} />`}
${e.label?_h`
<span class="djs-popup-label">${e.label}</span>
`:null}
</${e.action?"button":"span"}>
</li>
`))}
</ul>
`))}
</div>
`}function Yh(e){const{entry:t,selected:n,onMouseEnter:i,onMouseLeave:o,onAction:r}=e;return _h`
<li
class=${Xh("entry",{selected:n})}
data-id=${t.id}
title=${t.title||t.label}
tabIndex="0"
onClick=${r}
onFocus=${i}
onBlur=${o}
onMouseEnter=${i}
onMouseLeave=${o}
onDragStart=${e=>r(e,t,"dragstart")}
draggable=${!0}
>
<div class="djs-popup-entry-content">
<span
class=${Xh("djs-popup-entry-name",t.className)}
>
${t.imageUrl&&_h`<img class="djs-popup-entry-icon" src=${t.imageUrl} alt="" />`||t.imageHtml&&_h`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:t.imageHtml}} />`}
${t.label?_h`
<span class="djs-popup-label">
${t.label}
</span>
`:null}
</span>
${t.description&&_h`
<span
class="djs-popup-entry-description"
title=${t.description}
>
${t.description}
</span>
`}
</div>
${t.documentationRef&&_h`
<div class="djs-popup-entry-docs">
<a
href="${t.documentationRef}"
onClick=${e=>e.stopPropagation()}
title="Open element documentation"
target="_blank"
rel="noopener"
>
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<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"/>
</svg>
</a>
</div>
`}
</li>
`}function Wh(e){const{selectedEntry:t,setSelectedEntry:n,entries:i,...o}=e,r=Mh(),s=Dh((()=>function(e){const t=[],n=e=>t.find((t=>e.id===t.id)),i=e=>!!n(e),o=e=>"string"==typeof e?{id:e}:e;return e.forEach((e=>{const r=e.group?o(e.group):{id:"default"};i(r)?n(r).entries.push(e):t.push({...r,entries:[e]})})),t}(i)),[i]);return Ah((()=>{const e=r.current;if(!e)return;const t=e.querySelector(".selected");var n;t&&("function"==typeof(n=t).scrollIntoViewIfNeeded?n.scrollIntoViewIfNeeded():n.scrollIntoView({scrollMode:"if-needed",block:"nearest"}))}),[t]),_h`
<div class="djs-popup-results" ref=${r}>
${s.map((e=>_h`
${e.name&&_h`
<div key=${e.id} class="entry-header" title=${e.name}>
${e.name}
</div>
`}
<ul class="djs-popup-group" data-group=${e.id}>
${e.entries.map((e=>_h`
<${Yh}
key=${e.id}
entry=${e}
selected=${e===t}
onMouseEnter=${()=>n(e)}
onMouseLeave=${()=>n(null)}
...${o}
/>
`))}
</ul>
`))}
</div>
`}function Hh(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:s,width:a,scale:l,search:c,emptyPlaceholder:u,searchFn:h,entries:d,onOpened:p,onClosed:f}=e,m=Dh((()=>!!g(c)&&d.length>5),[c,d]),[v,y]=Th(""),b=Lh(((e,t)=>{if(!m)return e;if(!t.trim())return e.filter((({rank:e=0})=>e>=0));const n=e.filter((({searchable:e})=>!1!==e));return h(n,t,{keys:["label","description","search"]}).map((({item:e})=>e))}),[m]),[x,O]=Th(b(d,v)),[w,C]=Th(x[0]),k=Lh((e=>{w&&e.includes(w)||C(e[0]),O(e)}),[w,O,C]);Rh((()=>{k(b(d,v))}),[v,d]);const E=Lh((e=>{let t=x.indexOf(w)+e;t<0&&(t=x.length-1),t>=x.length&&(t=0),C(x[t])}),[x,w,C]),S=Lh((e=>"Enter"===e.key&&w?n(e,w):"ArrowUp"===e.key?(E(-1),e.preventDefault()):"ArrowDown"===e.key?(E(1),e.preventDefault()):void 0),[n,w,E]),$=Lh((e=>{Li(e.target,"input")&&y((()=>e.target.value))}),[y]);Rh((()=>(p(),()=>{f()})),[]);const P=Dh((()=>s||o.length>0),[s,o]);return _h`
<${Uh}
onClose=${t}
onKeyup=${$}
onKeydown=${S}
className=${i}
position=${r}
width=${a}
scale=${l}
>
${P&&_h`
<${zh}
headerEntries=${o}
onSelect=${n}
selectedEntry=${w}
setSelectedEntry=${C}
title=${s}
/>
`}
${d.length>0&&_h`
<div class="djs-popup-body">
${m&&_h`
<div class="djs-popup-search">
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<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"/>
</svg>
<input type="text" spellcheck=${!1} aria-label="${s}" />
</div>
`}
<${Wh}
entries=${x}
selectedEntry=${w}
setSelectedEntry=${C}
onAction=${n}
/>
</div>
`}
${u&&0===x.length&&_h`
<div class="djs-popup-no-results">${_(u)?u(v):u}</div>
`}
</${Uh}>
`}function Uh(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,position:s}=e,a=Mh();return Ah((()=>{if("function"!=typeof s)return;const e=a.current,t=s(e);e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}),[a.current,s]),Ah((()=>{const e=a.current;if(!e)return;(e.querySelector("input")||e).focus()}),[]),Rh((()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),t()},n=e=>{if(!xi(e.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",e),document.body.addEventListener("click",n),()=>{document.documentElement.removeEventListener("keydown",e),document.body.removeEventListener("click",n)}}),[]),_h`
<div
class=${Xh("djs-popup",o)}
style=${function(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`,"transform-origin":"top left"}}(e)}
onKeydown=${n}
onKeyup=${i}
ref=${a}
tabIndex="-1"
>
${r}
</div>
`}var Gh=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function Zh(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=g(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",(()=>{this.close()})),t.on("element.changed",(e=>{const t=this.isOpen()&&this._current.target;e.element===t&&this.refresh()}))}function Kh(e,t){return Jh(t)-Jh(e)}function Jh(e){return e.reduce(((e,t)=>e+function(e){const t=Math.log(e.value.length);if(!e.match)return-.07*t;return(e.start?e.end?131.9:7.87:e.wordStart?2.19:1)*t}(t)),0)}function ed(e="",t=""){return e.localeCompare(t)}function td(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}Zh.$inject=["config.popupMenu","eventBus","canvas","search"],Zh.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,s=Object.entries(n).map((([e,t])=>({id:e,...t}))),a=Object.entries(i).map((([e,t])=>({id:e,...t}))),l=e&&(t=>this._ensureVisible(t,e)),c=this._updateScale(this._current.container);ph(_h`
<${Hh}
onClose=${e=>this.close(e)}
onSelect=${(e,t,n)=>this.trigger(e,t,n)}
position=${l}
className=${t}
entries=${s}
headerEntries=${a}
emptyPlaceholder=${o}
scale=${c}
onOpened=${this._onOpened.bind(this)}
onClosed=${this._onClosed.bind(this)}
searchFn=${this._search}
...${{...r}}
/>
`,this._current.container)},Zh.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:o,headerEntries:r,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:r,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Zh.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Zh.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),o=this._getHeaderEntries(e,n);return{entries:i,headerEntries:o,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(i).length||Object.keys(o).length)}},Zh.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Zh.prototype.reset=function(){const e=this._current.container;ph(null,e),ji(e)},Zh.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Zh.prototype._onOpened=function(){this._emit("opened")},Zh.prototype._onClosed=function(){this._emit("closed")},Zh.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=Di(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Zh.prototype._bindAutoClose=function(){this._eventBus.once(Gh,this.close,this)},Zh.prototype._unbindAutoClose=function(){this._eventBus.off(Gh,this.close,this)},Zh.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),i=this._config.scale,o=n;return!0!==i&&(!1===i?(e=1,t=1):(e=i.min,t=i.max),g(e)&&n<e&&(o=e),g(t)&&n>t&&(o=t)),o},Zh.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,s=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,s=t.y-i.height):o.x?(r=t.x-i.width,s=t.y):o.y&&t.y<i.height?(r=t.x,s=10):o.y&&(r=t.x,s=t.y-i.height),t.y<n.top&&(s=t.y+i.height),{x:r,y:s}},Zh.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},Zh.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Zh.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Zh.prototype._getEntries=function(e,t){var n={};return k(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);_(i)?n=i(n):k(i,(function(e,t){n[t]=e}))}else k(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=z(e,["id"])}))})),n},Zh.prototype._getHeaderEntries=function(e,t){var n={};return k(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);_(i)?n=i(n):k(i,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;k(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=z(e,["id"])}))}})),n},Zh.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>_(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Zh.prototype.isOpen=function(){return!!this._current},Zh.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=mi(xi(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const i=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(_(i)){if("click"===n)return i(e,t)}else if(i[n])return i[n](e,t)},Zh.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 nd={search:["value",function(e,t,n){const{keys:i}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const o=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:i,tokens:o}=n.reduce(((n,i)=>{const o=e[i],{tokens:r,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(td),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),s=new RegExp(r,"ig");let a,l=0;for(;a=s.exec(e);){const[o]=a,r=a.index,s=a.index+o.length,c=0===r,u=s===e.length,h=!!a.groups.all,d=c||/\s/.test(e.charAt(r-1)),p=u||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:o,index:a.index,match:!0,wordStart:d,wordEnd:p,start:c,end:u,all:h});const f=h?t:[o];for(const e of f)i[e.toLowerCase()]=!0;l=a.index+o.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:i}}(o,t);return{tokens:{...n.tokens,[i]:r},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(i).length!==t.length)return null;return o}(e,o,i);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const i of e){const e=Kh(t.tokens[i],n.tokens[i]);if(0!==e)return e;const o=ed(t.item[i],n.item[i]);if(0!==o)return o}return 0}}(i))}]},id={__depends__:[nd],__init__:["popupMenu"],popupMenu:["type",Zh]},od=Math.round;function rd(e,t){this._modeling=e,this._eventBus=t}function sd(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}rd.$inject=["modeling","eventBus"],rd.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,s=t.height||e.height,a=t.x||e.x,l=t.y||e.y,c=od(a+r/2),u=od(l+s/2),h=i.replaceShape(e,F({},t,{x:c,y:u,width:r,height:s}),n);return o.fire("replace.end",{element:e,newElement:h,hints:n}),h},sd.$inject=["selection","eventBus"];var ad={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",sd],replace:["type",rd]};function ld(e,t,n,i){this.replaceElement=function(n,i,o){o=o||{};var r=i.type,s=n.businessObject,a=e.create(r),l={type:r,businessObject:a};if(l.width=n.width,l.height=n.height,a.name=s.name,i.table){var c=e.create("dmn:DecisionTable");c.$parent=a;var u=e.create("dmn:OutputClause");u.typeRef="string",u.$parent=c,c.output=[u];var h=e.create("dmn:InputClause");h.$parent=c;var d=e.create("dmn:LiteralExpression",{typeRef:"string"});h.inputExpression=d,d.$parent=h,c.input=[h],cd(a,c,e)}if(i.expression){var p=e.create("dmn:LiteralExpression"),f=e.create("dmn:InformationItem",{name:s.name});cd(a,p,e,f)}return t.replaceElement(n,l,o)}}function cd(e,t,n,i){if(Dt(e,"dmn:Decision"))e.decisionLogic=t,t.$parent=e;else if(Dt(e,"dmn:BusinessKnowledgeModel")){var o=n.create("dmn:FunctionDefinition",{body:t});e.encapsulatedLogic=o,o.$parent=e,t.$parent=o}i&&(e.variable=i,i.$parent=e)}ld.$inject=["drdFactory","replace","selection","modeling"];var ud={__depends__:[ad,La],drdReplace:["type",ld]},hd=[{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}}],dd=[{label:"Empty",actionName:"replace-with-empty",className:"dmn-icon-clear",target:{type:"dmn:BusinessKnowledgeModel",table:!1,expression:!1}},{label:"Literal Expression",actionName:"replace-with-literal-expression",className:"dmn-icon-literal-expression",target:{type:"dmn:BusinessKnowledgeModel",table:!1,expression:!0}}];function pd(e,t,n,i,o,r){this._popupMenu=e,this._modeling=t,this._moddle=n,this._drdReplace=i,this._rules=o,this._translate=r,this.register()}pd.$inject=["popupMenu","modeling","moddle","drdReplace","rules","translate"],pd.prototype.register=function(){this._popupMenu.registerProvider("dmn-replace",this)},pd.prototype.getEntries=function(e){var t,n,i=e.businessObject;return this._rules.allowed("shape.replace",{element:e})?Dt(i,"dmn:Decision")?(n=Bt(i),t=C(hd,(function(e){var t="replace-with-empty-decision"===e.actionName&&n,i="replace-with-decision-table"===e.actionName&&!Dt(n,"dmn:DecisionTable"),o="replace-with-literal-expression"===e.actionName&&!Dt(n,"dmn:LiteralExpression");return t||i||o})),this._createEntries(e,t)):Dt(i,"dmn:BusinessKnowledgeModel")?(n=Bt(i),t=C(dd,(function(e){var t="replace-with-empty"===e.actionName&&n,i="replace-with-decision-table"===e.actionName&&!Dt(n,"dmn:DecisionTable"),o="replace-with-literal-expression"===e.actionName&&!Dt(n,"dmn:LiteralExpression");return t||i||o})),this._createEntries(e,t)):[]:[]},pd.prototype._createEntries=function(e,t){var n=[],i=this;return k(t,(function(t){var o=i._createMenuEntry(t,e);n.push(o)})),n},pd.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}},pd.prototype.getHeaderEntries=function(e){return[]};var fd={__depends__:[ga,id,ud],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",pd]};function gd(e,t,n,i,o,r,s,a,l,c,u,h){u=u||{},t.registerProvider(this),this._contextPad=t,this._modeling=n,this._elementFactory=i,this._connect=o,this._create=r,this._rules=s,this._popupMenu=a,this._canvas=l,this._translate=c,!1!==u.autoPlace&&(this._autoPlace=h.get("autoPlace",!1)),e.on("create.end",250,(function(e){var n=e.context.shape;if(wa(e)){var i=t.getEntries(n);i.replace&&i.replace.action.click(e,n)}}))}gd.$inject=["eventBus","contextPad","modeling","elementFactory","connect","create","rules","popupMenu","canvas","translate","config.contextPad","injector"],gd.prototype.getContextPadEntries=function(e){var t=this._modeling,n=this._elementFactory,i=this._connect,o=this._create,r=this._popupMenu,s=this._contextPad,a=this._rules,l=this._translate,c=this._autoPlace,u={};if("label"===e.type)return u;var h=e.businessObject;function d(e,t,n){i.start(e,t,n)}function p(e,t,i,r){function s(t,i){var s=n.createShape(F({type:e},r));o.start(t,s,{source:i,hints:{connectionTarget:i}})}var a=c?function(t,i){var o=n.createShape(F({type:e},r));c.append(i,o,{connectionTarget:i})}:s;return{group:"model",className:t,title:i,action:{dragstart:s,click:a}}}Dt(h,"dmn:Decision")&&F(u,{"append.decision":p("dmn:Decision","dmn-icon-decision",l("Append decision"))}),jt(h,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:KnowledgeSource"])&&F(u,{"append.knowledge-source":p("dmn:KnowledgeSource","dmn-icon-knowledge-source",l("Append knowledge source"))}),jt(h,["dmn:BusinessKnowledgeModel","dmn:Decision"])&&F(u,{"append.business-knowledge-model":p("dmn:BusinessKnowledgeModel","dmn-icon-business-knowledge",l("Append business knowledge model"))}),jt(h,["dmn:Decision","dmn:KnowledgeSource"])&&F(u,{"append.input-data":p("dmn:InputData","dmn-icon-input-data",l("Append input data"))}),Dt(h,"dmn:DRGElement")&&F(u,{"append.text-annotation":p("dmn:TextAnnotation","dmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"dmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),Dt(h,"dmn:TextAnnotation")&&F(u,{connect:{group:"connect",className:"dmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),r.isEmpty(e,"dmn-replace")||F(u,{replace:{group:"edit",className:"dmn-icon-screw-wrench",title:l("Change type"),action:{click:function(e,t){var n=F(function(e){var t=s.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}}(t),{cursor:{x:e.x,y:e.y}});r.open(t,"dmn-replace",n)}}}});var f=a.allowed("elements.delete",{elements:[e]});return v(f)&&(f=f[0]===e),f&&F(u,{delete:{group:"edit",className:"dmn-icon-trash",title:l("Delete"),action:{click:function(n){t.removeElements([e])}}}}),u},gd.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n=this._translate,i={};return this._isDeleteAllowed(e)&&F(i,{delete:{group:"edit",className:"dmn-icon-trash",title:n("Delete"),action:{click:(e,n)=>t.removeElements(n.slice())}}}),i},gd.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return v(t)?S(e,(e=>t.includes(e))):t};var md={__depends__:[ga,hu,La,vu,Bu,fd],__init__:["contextPadProvider"],contextPadProvider:["type",gd]};function vd(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)}vd.$inject=["injector","canvas","graphicsFactory","elementFactory"],vd.prototype.drawPreview=function(e,t,n){n=n||{};var i,o,r,s=e.connectionPreviewGfx,a=e.getConnection,l=n.source,c=n.target,u=n.waypoints,h=n.connectionStart,d=n.connectionEnd,p=n.noLayout,f=n.noCropping,g=n.noNoop,m=this;s||(s=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),kn(s),a||(a=e.getConnection=(o=function(e,t,n){return m.getConnection(e,t,n)},r={},function(e){var t=JSON.stringify(e),n=r[t];return n||(n=r[t]=o.apply(null,arguments)),n})),t&&(i=a(t,l,c)),i?(i.waypoints=u||[],this._layouter&&!p&&(i.waypoints=this._layouter.layoutConnection(i,{source:l,target:c,connectionStart:h,connectionEnd:d,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[l?Ao(l):h,c?Ao(c):d]),this._connectionDocking&&(l||c)&&!f&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,l,c)),this._graphicsFactory.drawConnection(s,i,{stroke:"var(--element-dragger-color)"})):!g&&this.drawNoopPreview(s,n)},vd.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||Ao(n),r=t.connectionEnd||Ao(i),s=this.cropWaypoints(o,r,n,i);yn(e,this.createNoopConnection(s[0],s[1]))},vd.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),s=i&&o.getShapePath(i),a=o.getConnectionPath({waypoints:[e,t]});return[e=n&&Do(r,a,!0)||e,t=i&&Do(s,a,!1)||t]},vd.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&qn(e.connectionPreviewGfx)},vd.prototype.getConnection=function(e){var t=function(e){return y(e)?e:{}}(e);return this._elementFactory.createConnection(t)},vd.prototype.createConnectionPreviewGfx=function(){var e=Tn("g");return xn(e,{pointerEvents:"none"}),wn(e).add("djs-dragger"),yn(this._canvas.getActiveLayer(),e),e},vd.prototype.createNoopConnection=function(e,t){return Un([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var yd={__init__:["connectionPreview"],connectionPreview:["type",vd]};const bd=/\s/,_d=/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i,xd=/^[a-z_][\w-.]*$/i,Od=/\$\{([^}]*)\}/g;function wd(e,t){const 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(Od,"$1")}(e),function(e){return bd.test(e)}(e))return"Id must not contain spaces.";if(!xd.test(e))return _d.test(e)?"Id must not contain prefix.":"Id must be a valid QName."}(t):"Element must have ID."}function Cd(e,t,n,i,o){this._eventBus=e,this._modeling=t,this._canvas=n,this._definitionPropertiesView=i,this._translate=o,e.on("definitionIdView.create",(function(e){this._container=e.html;var t=sn(".dmn-definitions-name",this._container),n=sn(".dmn-definitions-id",this._container);this._setup(t,"name"),this._setup(n,"id")}),this)}Cd.$inject=["eventBus","modeling","canvas","definitionPropertiesView","translate"],Cd.prototype.update=function(e,t){var n=this._canvas.getRootElement(),i={};if(i[e]=t,"id"===e){var o=wd(Qt(n),t);if(o)return void this._addErrorMessage(o);this._clearErrorMessage()}this._modeling.updateProperties(n,i)},Cd.prototype._setup=function(e,t){var n=this;e.setAttribute("contenteditable",!0),e.addEventListener("input",N((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()}))},Cd.prototype._addErrorMessage=function(e){const t='<span class="dmn-definitions-error-message">'+this._translate(e)+"</span>";var n=sn(".dmn-definitions-id",this._container);this._clearErrorMessage(),Xt(n).add("dmn-definitions-error"),n.parentElement.appendChild(rn(t))},Cd.prototype._clearErrorMessage=function(){var e=sn(".dmn-definitions-id",this._container);if(Xt(e).has("dmn-definitions-error")){Xt(e).remove("dmn-definitions-error");const t=sn(".dmn-definitions-error-message",this._container);e.parentNode.removeChild(t)}};var kd={__depends__:[za],__init__:["definitionPropertiesEdit","definitionPropertiesPaletteAdapter"],definitionPropertiesEdit:["type",Cd],definitionPropertiesPaletteAdapter:["type",Xa]},Ed={horizontal:["x","width"],vertical:["y","height"]};function Sd(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return v(n)?n:n?e:[]}))}Sd.$inject=["modeling","rules"],Sd.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Sd.prototype.trigger=function(e,t){var n,i,o=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return o.distributeElements(n,this._axis,this._dimension),n},Sd.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(k(t,(function(e){o=e(o,n,i)})),o):e},Sd.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return k(D(e,i),(function(e,r){var s,a=n._findRange(e,i,o),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},Sd.prototype._setOrientation=function(e){var t=Ed[e];this._axis=t[0],this._dimension=t[1]},Sd.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)},Sd.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var $d={__init__:["distributeElements"],distributeElements:["type",Sd]};function Pd(e){e.registerFilter((function(e){return C(e,(function(e){var t=jt(e,["dmn:AuthorityRequirement","dmn:InformationRequirement","dmn:KnowledgeRequirement","dmn:Association","dmn:TextAnnotation"]);return!(e.labelTarget||t)}))}))}Pd.$inject=["distributeElements"];var Td={__depends__:[$d],__init__:["drdDistributeElements"],drdDistributeElements:["type",Pd]},Rd="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 Md(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),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),c=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",(function(){t.undo()})),this.register("redo",(function(){t.redo()}))),r&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return r.copy(e)})),r&&this.register("paste",(function(){r.paste()})),o&&this.register("stepZoom",(function(e){o.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&i&&a&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,o=a.allowed("elements.delete",{elements:e});!1!==o&&(t=v(o)?o:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.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 Md(e,Rd);return this._actions[e](t)},Ad.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);k(e,(function(e,t){n._registerAction(t,e)}))},Ad.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Md(e,"is already registered");this._actions[e]=t},Ad.prototype.unregister=function(e){if(!this.isRegistered(e))throw Md(e,Rd);this._actions[e]=void 0},Ad.prototype.getActions=function(){return Object.keys(this._actions)},Ad.prototype.isRegistered=function(e){return!!this._actions[e]};var Dd={__init__:["editorActions"],editorActions:["type",Ad]};function Ld(e){e.invoke(Ad,this)}qt(Ld,Ad),Ld.$inject=["injector"],Ld.prototype._registerDefaultActions=function(e){Ad.prototype._registerDefaultActions.call(this,e);const t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("lassoTool",!1),r=e.get("handTool",!1),s=e.get("directEditing",!1),a=e.get("distributeElements",!1),l=e.get("alignElements",!1),c=e.get("searchPad",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),o=n.filter((function(t){return t!==e}));return i.select(o),o})),i&&a&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length>2&&a.trigger(t,n)})),i&&l&&this._registerAction("alignElements",(function(e){var t=i.get(),n=e.type;t.length>1&&l.trigger(t,n)})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),r&&this._registerAction("handTool",(function(){r.toggle()})),i&&s&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&s.activate(e[0])})),i&&c&&this._registerAction("find",(function(){c.toggle()}))};var Id={__depends__:[Dd],editorActions:["type",Ld]};function Qd(e){return e.dmnDI&&e.dmnDI.diagrams&&e.dmnDI.diagrams[0]}function jd(e,t,n,i){n.on("import.start",(({definitions:n})=>{Qd(n)||function(n){var o=n.dmnDI;o||(o=e.create("dmndi:DMNDI"),n.set("dmnDI",o));var r=e.create("dmndi:DMNDiagram");o.set("diagrams",[r]);var s=0;k(n.get("drgElement"),(function(n){if(Dt(n,"dmn:Decision")){var o=t._getDefaultSize(n),a=e.createDiShape(n,{x:150+30*s,y:150+30*s,width:o.width,height:o.height});i.updateDiParent(a,r),s++}}))}(n)}))}jd.$inject=["drdFactory","elementFactory","eventBus","drdUpdater"];var Bd={__init__:["diGenerator"],diGenerator:["type",jd]},Nd=10;function qd(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Fd(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var o=this;t.on("diagram.init",800,(function(){o.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(!(!o.active||n&&ml(n))){var i=t.context,r=i.gridSnappingContext;r||(r=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},r=function(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,s=r.snapLocation,a=r.snapOffset;if(a&&b(a[t]))return a[t];a||(a=r.snapOffset={});b(a[t])||(a[t]=0);if(!o)return a[t];n.get(o.id)||(Vd(t)?a[t]+=o[t]+o.width/2:a[t]+=o[t]+o.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=o.width/2:/right/.test(s)&&(a[t]+=o.width/2):/top/.test(s)?a[t]-=o.height/2:/bottom/.test(s)&&(a[t]+=o.height/2);return a[t]}(t,n,e);r&&(i.offset=r);var s=function(e,t){var n=e.context,i=n.createConstraints,o=n.resizeConstraints||{},r=n.gridSnappingContext,s=r.snapConstraints;if(s&&s[t])return s[t];s||(s=r.snapConstraints={});s[t]||(s[t]={});var a=n.direction;i&&(Vd(t)?(s.x.min=i.left,s.x.max=i.right):(s.y.min=i.top,s.y.max=i.bottom));var l=o.min,c=o.max;l&&(Vd(t)?zd(a)?s.x.max=l.left:s.x.min=l.right:Xd(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(Vd(t)?zd(a)?s.x.min=c.left:s.x.max=c.right:Xd(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&F(i,s),Jc(t,n)||o.snapEvent(t,n,i)}))}}))}function Vd(e){return"x"===e}function Xd(e){return-1!==e.indexOf("n")}function zd(e){return-1!==e.indexOf("w")}Fd.prototype.snapEvent=function(e,t,n){eu(e,t,this.snapValue(e[t],n))},Fd.prototype.getGridSpacing=function(){return Nd},Fd.prototype.snapValue=function(e,t){var n,i,o=0;return t&&t.offset&&(o=t.offset),e=qd(e+=o,Nd),t&&t.min&&b(n=t.min)&&(n=qd(n+o,Nd,"ceil"),e=Math.max(e,n)),t&&t.max&&b(i=t.max)&&(i=qd(i+o,Nd,"floor"),e=Math.min(e,i)),e-=o},Fd.prototype.isActive=function(){return this.active},Fd.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Fd.prototype.toggleActive=function(){this.setActive(!this.active)},Fd.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Yd(e){this._eventBus=e}function Wd(e){return function(t,n,i,o,r){(_(t)||b(t))&&(r=o,o=i,i=n,n=t,t=null),this.on(t,e,n,i,o,r)}}function Hd(e,t){Yd.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 o=t.shape,r=t.newBounds;x(i)?t.newBounds=n.snapComplex(r,i):t.newBounds=n.snapSimple(o,r)}}))}Yd.$inject=["eventBus"],Yd.prototype.on=function(e,t,n,i,o,r){if((_(t)||b(t))&&(r=o,o=i,i=n,n=t,t=null),_(n)&&(r=o,o=i,i=n,n=1e3),y(o)&&(r=o,o=!1),!_(i))throw new Error("handlerFn must be a function");v(e)||(e=[e]);var s=this._eventBus;k(e,(function(e){var a=["commandStack",e,t].filter((function(e){return e})).join(".");s.on(a,n,o?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,r):i,r)}))},Yd.prototype.canExecute=Wd("canExecute"),Yd.prototype.preExecute=Wd("preExecute"),Yd.prototype.preExecuted=Wd("preExecuted"),Yd.prototype.execute=Wd("execute"),Yd.prototype.executed=Wd("executed"),Yd.prototype.postExecute=Wd("postExecute"),Yd.prototype.postExecuted=Wd("postExecuted"),Yd.prototype.revert=Wd("revert"),Yd.prototype.reverted=Wd("reverted"),Hd.$inject=["eventBus","gridSnapping","modeling"],qt(Hd,Yd),Hd.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},Hd.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},Hd.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),F(e,r),e},Hd.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),F(e,r),e};function Ud(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))}))}Ud.$inject=["eventBus","gridSnapping"];var Gd={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Hd],gridSnappingSpaceToolBehavior:["type",Ud]}],__init__:["gridSnapping"],gridSnapping:["type",Fd]},Zd="keyboard.keydown",Kd="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function Jd(e,t){var n=this;this._config=e=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()})),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Kd));var i=e&&!1!==e.bind;t.on("canvas.init",(function(e){n._target=e.svg,i&&n.bind(),n._fire("init")}))}Jd.$inject=["config.keyboard","eventBus"],Jd.prototype._keydownHandler=function(e){this._keyHandler(e,Zd)},Jd.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Jd.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Zd,n)&&e.preventDefault()}},Jd.prototype._isEventIgnored=function(e){return!1},Jd.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Kd)),this.unbind(),e=this._node=this._target,Si.bind(e,"keydown",this._keydownHandler),Si.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Jd.prototype.getBinding=function(){return this._node},Jd.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Si.unbind(e,"keydown",this._keydownHandler),Si.unbind(e,"keyup",this._keyupHandler)),this._node=null},Jd.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Jd.prototype.addListener=function(e,t,n){_(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Zd,e,t)},Jd.prototype.removeListener=function(e,t){this._eventBus.off(t||Zd,e)},Jd.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Jd.prototype.isCmd=ml,Jd.prototype.isShift=yl,Jd.prototype.isKey=vl;function ep(e,t){var n=this;e.on("editorActions.init",500,(function(e){var i=e.editorActions;n.registerBindings(t,i)}))}ep.$inject=["eventBus","keyboard"],ep.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){if(bl(e.keyEvent))return t.trigger("undo"),!0})),n("redo",(function(e){if(_l(e.keyEvent))return t.trigger("redo"),!0})),n("copy",(function(e){if(function(e){return ml(e)&&vl(dl,e)}(e.keyEvent))return t.trigger("copy"),!0})),n("paste",(function(e){if(function(e){return ml(e)&&vl(pl,e)}(e.keyEvent))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(vl(["+","Add","="],n)&&ml(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(vl(["-","Subtract"],n)&&ml(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(vl("0",n)&&ml(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(vl(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var tp={__init__:["keyboard","keyboardBindings"],keyboard:["type",Jd],keyboardBindings:["type",ep]};function np(e){e.invoke(ep,this)}qt(np,ep),np.$inject=["injector"],np.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}ep.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})),n("find",(function(n){var i=n.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0}))};var ip={__depends__:[tp],__init__:["keyboardBindings"],keyboardBindings:["type",np]},op={moveSpeed:50,moveSpeedAccelerated:200};function rp(e,t,n){var i=this;this._config=F({},op,e||{}),t.addListener((function(e){var n=e.keyEvent,o=i._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var r,s=t.isShift(n)?o.moveSpeedAccelerated:o.moveSpeed;switch(n.key){case"ArrowLeft":case"Left":r="left";break;case"ArrowUp":case"Up":r="up";break;case"ArrowRight":case"Right":r="right";break;case"ArrowDown":case"Down":r="down"}return i.moveCanvas({speed:s,direction:r}),!0}})),this.moveCanvas=function(e){var t=0,i=0,o=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=o;break;case"up":i=o;break;case"right":t=-o;break;case"down":i=-o}n.scroll({dx:t,dy:i})}}rp.$inject=["config.keyboardMove","keyboard","canvas"];var sp={__depends__:[tp],__init__:["keyboardMove"],keyboardMove:["type",rp]},ap={moveSpeed:1,moveSpeedAccelerated:10},lp="left",cp="right",up="down",hp={ArrowLeft:lp,Left:lp,ArrowUp:"up",Up:"up",ArrowRight:cp,Right:cp,ArrowDown:up,Down:up},dp={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 pp(e,t,n,i,o){var r=this;this._config=F({},ap,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=hp[n.key];if(i&&!t.isCmd(n)){var o=t.isShift(n);return r.moveSelection(i,o),!0}})),this.moveSelection=function(e,t){var r=o.get();if(r.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=dp[e](s);i.allowed("elements.move",{shapes:r})&&n.moveElements(r,a)}}}pp.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var fp={__depends__:[tp,La],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",pp]};function gp(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)}gp.$inject=["eventBus","injector"],gp.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},gp.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(void 0===o){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},gp.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},gp.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},gp.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},gp.prototype.register=function(e,t){this._setHandler(e,t)},gp.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},gp.prototype.canUndo=function(){return!!this._getUndoAction()},gp.prototype.canRedo=function(){return!!this._getRedoAction()},gp.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},gp.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},gp.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},gp.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const e of i)if(o=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return o},gp.prototype._createId=function(){return this._uid++},gp.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},gp.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},gp.prototype._pushAction=function(e){const 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)},gp.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:M("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},gp.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=v(e)?e:[e],t.dirty=t.dirty.concat(e))},gp.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},gp.prototype._revertedAction=function(e){this._stackIdx--},gp.prototype._getHandler=function(e){return this._handlerMap[e]},gp.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 mp={commandStack:["type",gp]};function vp(e,t,n,i){e.on("element.changed",(function(i){var o=i.element;(o.parent||o===t.getRootElement())&&(i.gfx=n.getGraphics(o)),i.gfx&&e.fire(ii(o)+".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)}))}vp.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var yp={__init__:["changeSupport"],changeSupport:["type",vp]};function bp(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 _p,xp,Op,wp={};function Cp(){_p=window.addEventListener?"addEventListener":"attachEvent",xp=window.removeEventListener?"removeEventListener":"detachEvent",Op="addEventListener"!==_p?"on":""}var kp,Ep=bp({__proto__:null,bind:wp.bind=function(e,t,n,i){return _p||Cp(),e[_p](Op+t,n,i||!1),n},unbind:wp.unbind=function(e,t,n,i){return xp||Cp(),e[xp](Op+t,n,i||!1),n},default:wp},[wp]),Sp=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(Pp,i)?Pp[i]:Pp._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},$p=!1;"undefined"!=typeof document&&((kp=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',$p=!kp.getElementsByTagName("link").length,kp=void 0);var Pp={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:$p?[1,"X<div>","</div>"]:[0,"",""]};Pp.td=Pp.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Pp.option=Pp.optgroup=[1,'<select multiple="multiple">',"</select>"],Pp.thead=Pp.tbody=Pp.colgroup=Pp.caption=Pp.tfoot=[1,"<table>","</table>"],Pp.polyline=Pp.ellipse=Pp.polygon=Pp.circle=Pp.text=Pp.line=Pp.path=Pp.rect=Pp.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Tp=Sp;function Rp(e){e.parentNode&&e.parentNode.removeChild(e)}var Ap=Math.min,Mp=Math.max;function Dp(e){e.preventDefault()}function Lp(e){e.stopPropagation()}function Ip(e){var t;this.container=e.container,this.parent=Tp('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=(t="[contenteditable]",(this.parent||document).querySelector(t)),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=q(this.autoResize,this),this.handlePaste=q(this.handlePaste,this)}function Qp(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ip({container:t.getContainer(),keyHandler:q(this._handleKey,this),resizeHandler:q(this._handleResize,this)})}Ip.prototype.create=function(e,t,n,i){var o=this.parent,r=this.content,s=this.container;i=this.options=i||{};var a=X(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);F(o.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"},a);var l=X(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return F(r.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&F(r.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),r.innerText=n,Ep.bind(r,"keydown",this.keyHandler),Ep.bind(r,"mousedown",Lp),Ep.bind(r,"paste",this.handlePaste),i.autoResize&&Ep.bind(r,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(r.lastChild,r.lastChild&&r.lastChild.length),o},Ip.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 o=this.autoResize(i);o&&this.resizeHandler(o)}},Ip.prototype.insertText=function(e){e=function(e){return e.replace(/\r\n|\r|\n/g,"\n")}(e),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Ip.prototype._insertTextIE=function(e){var t,n,i,o=this.getSelection(),r=o.startContainer,s=o.endContainer,a=o.startOffset,l=o.endOffset,c=o.commonAncestorContainer,u=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var h=r.textContent;r.textContent=h.substring(0,a)+e+h.substring(l),n=r,i=a+e.length}else if(r===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,u[a]),n=d,i=d.textContent.length}else{var p=u.indexOf(r),f=u.indexOf(s);u.forEach((function(t,n){n===p?t.textContent=r.textContent.substring(0,a)+e+s.textContent.substring(l):n>p&&n<=f&&Rp(t)})),n=r,i=a+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},Ip.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(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},Ip.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,u;n=this.resizeHandle=Tp('<div class="djs-direct-editing-resize-handle"></div>');var h=function(n){Dp(n),Lp(n);var h=Ap(Mp(c+n.clientX-a,i),r),d=Ap(Mp(u+n.clientY-l,o),s);t.style.width=h+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:u,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){Dp(e),Lp(e),Ep.unbind(document,"mousemove",h,!1),Ep.unbind(document,"mouseup",d,!1)};Ep.bind(n,"mousedown",(function(e){Dp(e),Lp(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,u=n.height,Ep.bind(document,"mousemove",h),Ep.bind(document,"mouseup",d)}))}F(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)},Ip.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ep.unbind(t,"keydown",this.keyHandler),Ep.unbind(t,"mousedown",Lp),Ep.unbind(t,"input",this.autoResize),Ep.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Rp(n)),Rp(e)},Ip.prototype.getValue=function(){return this.content.innerText.trim()},Ip.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Ip.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)},Qp.$inject=["eventBus","canvas"],Qp.prototype.registerProvider=function(e){this._providers.push(e)},Qp.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Qp.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Qp.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Qp.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},Qp.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue();o===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Qp.prototype.getValue=function(){return this._textbox.getValue()},Qp.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())},Qp.prototype._handleResize=function(e){this._fire("resize",e)},Qp.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=w(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 jp={__depends__:[$a],__init__:["directEditing"],directEditing:["type",Qp]},Bp="djs-label-hidden";function Np(e,t,n,i,o){this._canvas=e,this._modeling=i,this._textRenderer=o,this._eventBus=n,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;(Dt(n,"dmn:Decision")||Dt(n,"dmn:InputData")||Dt(n,"dmn:BusinessKnowledgeModel")||Dt(n,"dmn:KnowledgeSource")||Dt(n,"dmn:TextAnnotation"))&&t.activate(n)})),n.on("autoPlace.end",500,(function(e){t.activate(e.shape)})),this._eventBus.on(["directEditing.complete","directEditing.cancel"],(function(t){var n=t.active;if(n){var i=n.element.label||n.element;e.removeMarker(i,Bp)}}))}Np.$inject=["canvas","directEditing","eventBus","modeling","textRenderer"],Np.prototype.activate=function(e){var t=kl(e);if(g(t)){var n={text:t};F(n,this.getEditingBBox(e));var i={},o=n.style||{};return Dt(e,"dmn:DRGElement")&&(F(i,{centerVertically:!0}),F(o,{backgroundColor:null,border:null})),Dt(e,"dmn:TextAnnotation")&&F(i,{resizable:!0}),F(n,{options:i,style:o}),this._canvas.addMarker(e,Bp),n}},Np.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x,y:i.y},r=t.zoom(),s=this._textRenderer.getDefaultStyle(),a=s.fontSize*r,l=s.lineHeight,c={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};return Dt(e,"dmn:DRGElement")&&(F(o,{width:i.width,height:i.height}),F(c,{fontSize:a+"px",lineHeight:l,paddingTop:7*r+"px",paddingBottom:7*r+"px",paddingLeft:5*r+"px",paddingRight:5*r+"px"})),Dt(e,"dmn:TextAnnotation")&&(F(o,{width:i.width,height:i.height,minWidth:30*r,minHeight:10*r}),F(c,{textAlign:"left",paddingTop:5*r+"px",paddingBottom:7*r+"px",paddingLeft:7*r+"px",paddingRight:5*r+"px",fontSize:a+"px",lineHeight:l})),{bounds:o,style:c}},Np.prototype.update=function(e,t,n,i){var o,r,s;Dt(e,"dmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,o)};var qp={__depends__:[mp,yp,jp],__init__:["labelEditingProvider"],labelEditingProvider:["type",Np]};function Fp(e,t){t.invoke(Yd,this),this.preExecute("connection.create",(function(t){var n=t.connection,i=n.businessObject,o=t.source,r=t.target;Dt(n,"dmn:Association")?((i.sourceRef=e.create("dmn:DMNElementReference",{href:"#"+o.id})).$parent=i,(i.targetRef=e.create("dmn:DMNElementReference",{href:"#"+r.id})).$parent=i):(i["required"+function(e){if(Dt(e,"dmn:BusinessKnowledgeModel"))return"Knowledge";if(Dt(e,"dmn:Decision"))return"Decision";if(Dt(e,"dmn:InputData"))return"Input";if(Dt(e,"dmn:KnowledgeSource"))return"Authority"}(o)]=e.create("dmn:DMNElementReference",{href:"#"+o.id})).$parent=i}),!0)}Fp.$inject=["drdFactory","injector"],qt(Fp,Yd);function Vp(e,t,n,i){function o(e,i,o){i||(i=e.incoming.filter((function(e){return Dt(e,"dmn:InformationRequirement")})));var r={};o?r[o]=i:r=function(e,t){var n={};return t.forEach((function(t){var i=Mo(t.source,e).split("-").shift();n[i]||(n[i]=[]),n[i].push(t)})),n}(e,i),k(r,(function(i,o){i=function(e,t){var n;n=t.includes("top")||t.includes("bottom")?"x":"y";return e.sort((function(e,t){return Ao(e.source)[n]-Ao(t.source)[n]}))}(i,o);var r=function(e,t,n){return e.map((function(i,o){var r=i.source,s=Ao(r),a=Po(r),l=Po(t),c=e.length;return n.includes("bottom")?{start:{x:s.x,y:a.top},end:{x:l.left+t.width/(c+1)*(o+1),y:l.bottom}}:n.includes("top")?{start:{x:s.x,y:a.bottom},end:{x:l.left+t.width/(c+1)*(o+1),y:l.top}}:n.includes("right")?{start:{x:a.left,y:s.y},end:{x:l.right,y:l.top+t.height/(c+1)*(o+1)}}:{start:{x:a.right,y:s.y},end:{x:l.left,y:l.top+t.height/(c+1)*(o+1)}}}))}(i,e,o);i.forEach(((e,i)=>{var o=r[i].start,s=r[i].end,a=t.layoutConnection(e,{connectionStart:o,connectionEnd:s});n.updateWaypoints(e,a)}))}))}e.invoke(Yd,this),this.preExecute(["connection.create","connection.reconnect"],(function(e){var t=e.connection,n=e.newSource||e.source,o=e.newTarget||e.target;if((!Dt(t,"dmn:InformationRequirement")||i.allowed("connection.connect",{connection:t,source:n,target:o}))&&Dt(t,"dmn:InformationRequirement")){var r=Mo(n,o);e.hints||(e.hints={}),F(e.hints,function(e,t,n){var i=Ao(e),o=Ao(t);n.includes("bottom")?(i.y=e.y,o.y=t.y+t.height):n.includes("top")?(i.y=e.y+e.height,o.y=t.y):n.includes("right")?(i.x=e.x,o.x=t.x+t.width):(i.x=e.x+e.width,o.x=t.x);return{connectionStart:i,connectionEnd:o}}(n,o,r))}}),!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(Dt(t,"dmn:InformationRequirement")){var r=Mo(n,i),s=i.incoming.filter((e=>{var t=Mo(e.source,e.target);return Dt(e,"dmn:InformationRequirement")&&Xp(t,r)}));s.length&&o(i,s,r)}}),!0),this.preExecute("connection.reconnect",(function(e){var t=e.connection,n=t.source,i=t.target;if(Dt(t,"dmn:InformationRequirement")){var r=Mo(n,i),s=i.incoming.filter((e=>{var n=Mo(e.source,e.target);return e!==t&&Dt(e,"dmn:InformationRequirement")&&Xp(n,r)}));s.length&&o(i,s,r)}}),!0),this.postExecuted("elements.move",500,(function(e){var t=e.shapes,n=e.closure.enclosedConnections;t.forEach((function(e){if(jt(e,["dmn:Decision","dmn:InputData"])){var t=e.incoming.filter((function(e){return Dt(e,"dmn:InformationRequirement")&&!n[e.id]}));t.length&&o(e,t),e.outgoing.forEach((function(e){Dt(e,"dmn:InformationRequirement")&&!n[e.id]&&o(e.target)}))}}))}),!0)}function Xp(e,t){return e&&t&&e.split("-").shift()===t.split("-").shift()}function zp(e,t,n){e.invoke(Yd,this),this.preExecute("connection.reconnect",(function(e){var i=e.connection,o=e.newSource||i.source,r=e.newTarget||i.target,s=i.waypoints.slice(),a=n.allowed("connection.reconnect",{connection:i,source:o,target:r});a&&a.type!==i.type&&(e.connection=t.connect(o,r,{type:a.type,waypoints:s}),t.removeConnection(i))}),!0)}function Yp(e,t,n){Yd.call(this,e),this._modeling=t,this.postExecuted(["shape.replace"],1500,(function(e){var i=e.context,o=i.oldShape,r=i.newShape;t.unclaimId(o.businessObject.id,o.businessObject),t.updateProperties(r,{id:o.id}),n.select(r)}))}Vp.$inject=["injector","layouter","modeling","rules"],qt(Vp,Yd),qt(zp,Yd),zp.$inject=["injector","modeling","rules"],qt(Yp,Yd),Yp.$inject=["eventBus","modeling","selection"];const Wp="id";class Hp extends Yd{constructor(e){super(e),this.executed("element.updateProperties",this.updateIds.bind(this))}updateIds({context:e}){const{element:t,oldProperties:n,properties:i}=e,o=Qt(t);if(this.shouldSkipUpdate(o,n,i))return;const r=function(e){let t=e;for(;!Dt(t,"dmn:Definitions");)t=t.$parent;return t}(o);r.get("drgElement").forEach((e=>{!function(e,t,n){const i={authorityRequirement:()=>{e.authorityRequirement.forEach((e=>{const{requiredAuthority:i,requiredDecision:o,requiredInput:r}=e;i&&i.href===`#${t}`&&(i.href=`#${n}`),o&&o.href===`#${t}`&&(o.href=`#${n}`),r&&r.href===`#${t}`&&(r.href=`#${n}`)}))},informationRequirement:()=>{e.informationRequirement.forEach((e=>{const{requiredDecision:i,requiredInput:o}=e;i&&i.href===`#${t}`&&(i.href=`#${n}`),o&&o.href===`#${t}`&&(o.href=`#${n}`)}))},knowledgeRequirement:()=>{e.knowledgeRequirement.forEach((e=>{const{requiredKnowledge:i}=e;i&&i.href===`#${t}`&&(i.href=`#${n}`)}))}};k(i,((t,n)=>{e[n]&&t()}))}(e,n.id,i.id)}));r.get("artifact").forEach((e=>{!function(e,t,n){const i={sourceRef:()=>{const{sourceRef:i}=e;i.href===`#${t}`&&(i.href=`#${n}`)},targetRef:()=>{const{targetRef:i}=e;i.href===`#${t}`&&(i.href=`#${n}`)}};k(i,((t,n)=>{e[n]&&t()}))}(e,n.id,i.id)}))}shouldSkipUpdate(e,t,n){return!function(e,t){return Wp in e&&Wp in t}(t,n)||!Dt(e,"dmn:DRGElement")&&!Dt(e,"dmn:TextAnnotation")}}Hp.$inject=["eventBus"];let Up=class extends Yd{static $inject=["eventBus","modeling"];constructor(e,t){super(e),this._modeling=t,this.postExecuted("element.updateProperties",this.updateVariableFromElement),this.postExecuted("element.updateLabel",this.updateVariableFromLabel)}updateVariableFromLabel=({context:e})=>{const{element:t,newLabel:n}=e,i=Qt(t).variable;i&&this._modeling.updateProperties(i,{name:n})};updateVariableFromElement=({context:e})=>{const{element:t,properties:n}=e,i=Qt(t);i.variable&&(Dt(t,"dmn:Decision")||Dt(t,"dmn:BusinessKnowledgeModel"))&&this.isNameChanged(n)&&(this.isVariable(t)||this.shouldSyncVariable(t)||this.syncElementVariableChange(i))};isNameChanged(e){return"name"in e}isVariable(e){const t=function(e){return e.$parent}(e);return Dt(e,"dmn:InformationItem")&&t&&t.get("variable")===e}shouldSyncVariable(e){const t=Qt(e),n=t.get("variable");return n&&t.name===n.name}syncElementVariableChange(e){const t=e.get("name"),n=e.variable;this._modeling.updateProperties(n,{name:t})}};var Gp={__init__:["createConnectionBehavior","idChangeBehavior","nameChangeBehavior","layoutConnectionBehavior","replaceConnectionBehavior","replaceElementBehavior"],createConnectionBehavior:["type",Fp],idChangeBehavior:["type",Hp],nameChangeBehavior:["type",Up],layoutConnectionBehavior:["type",Vp],replaceConnectionBehavior:["type",zp],replaceElementBehavior:["type",Yp]};function Zp(e){Yd.call(this,e),this.init()}function Kp(e){e.invoke(Zp,this)}function Jp(e,t){if(!e||nf(e)||!t||nf(t))return null;if(e===t)return!1;if(Dt(e,"dmn:BusinessKnowledgeModel")&&jt(t,["dmn:BusinessKnowledgeModel","dmn:Decision"]))return{type:"dmn:KnowledgeRequirement"};if(Dt(e,"dmn:Decision")){if(Dt(t,"dmn:Decision"))return{type:"dmn:InformationRequirement"};if(Dt(t,"dmn:KnowledgeSource"))return{type:"dmn:AuthorityRequirement"}}if(Dt(e,"dmn:Definitions")||Dt(t,"dmn:Definitions"))return!1;if(Dt(e,"dmn:InputData")){if(Dt(t,"dmn:Decision"))return{type:"dmn:InformationRequirement"};if(Dt(t,"dmn:KnowledgeSource"))return{type:"dmn:AuthorityRequirement"}}return Dt(e,"dmn:KnowledgeSource")&&jt(t,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:KnowledgeSource"])?{type:"dmn:AuthorityRequirement"}:!!(Dt(e,"dmn:TextAnnotation")&&!Dt(t,"dmn:TextAnnotation")||!Dt(e,"dmn:TextAnnotation")&&Dt(t,"dmn:TextAnnotation"))&&{type:"dmn:Association"}}function ef(e,t){return jt(e,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:InputData","dmn:KnowledgeSource","dmn:TextAnnotation"])&&Dt(t,"dmn:Definitions")}function tf(e,t){return v(e)||(e=[e]),!t||!(!S(e,(function(e){return jt(e,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:InputData","dmn:KnowledgeSource","dmn:TextAnnotation","dmn:InformationRequirement","dmn:AuthorityRequirement","dmn:KnowledgeRequirement","dmn:Association"])}))||!Dt(t,"dmn:Definitions"))}function nf(e){return!!e.labelTarget}Zp.$inject=["eventBus"],qt(Zp,Yd),Zp.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)}))},Zp.prototype.init=function(){},qt(Kp,Zp),Kp.$inject=["injector"],Kp.prototype.init=function(){this.addRule("connection.create",(function(e){return Jp(e.source,e.target)})),this.addRule("connection.reconnect",(function(e){return e.connection,Jp(e.source,e.target)})),this.addRule("connection.updateWaypoints",(function(e){const 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,tf(n,t)})),this.addRule("shape.create",(function(e){return ef(e.shape,e.target)})),this.addRule("shape.resize",(function(e){return Dt(e.shape,"dmn:TextAnnotation")}))},Kp.prototype.canConnect=Jp,Kp.prototype.canCreate=ef,Kp.prototype.canMove=tf;var of={__depends__:[gc],__init__:["drdRules"],drdRules:["type",Kp]};function rf(e){this._model=e}function sf(e,t,n,i,o){o.invoke(Yd,this),this._definitionPropertiesView=t,this._drdFactory=n,this._drdRules=i;var r=this;function s(e){var t=e.connection,n=e.parent,i=e.shape;t&&!Dt(t,"dmn:Association")&&(n=t.target),r.updateParent(i||t,n)}function a(e){var t=e.connection,n=e.shape,i=e.parent||e.newParent;t&&!Dt(t,"dmn:Association")&&(i=t.target),r.updateParent(n||t,i)}function l(e){var t=e.shape;(Dt(t,"dmn:DRGElement")||Dt(t,"dmn:TextAnnotation"))&&r.updateBounds(t)}function c(e){r.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"],s,!0),this.reverted(["connection.create","connection.delete","connection.move","shape.create","shape.delete"],a,!0),this.executed(["shape.create","shape.move","shape.resize"],l,!0),this.reverted(["shape.create","shape.move","shape.resize"],l,!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;Dt(t,"dmn:Association")?s(e):r.updateSemanticParent(n,i)}),!0),this.reverted("connection.create",(function(e){a(e)}),!0),this.executed("connection.reconnect",(function(e){var t=e.connection.businessObject,n=e.newTarget.businessObject;Dt(t,"dmn:Association")||r.updateSemanticParent(t,n)}),!0),this.reverted("connection.reconnect",(function(e){var t=e.connection.businessObject,n=e.oldTarget.businessObject;Dt(t,"dmn:Association")||r.updateSemanticParent(t,n)}),!0),this.executed("element.updateProperties",(function(e){t.update()}),!0),this.reverted("element.updateProperties",(function(e){t.update()}),!0)}function af(e,t){this._modeling=e,this._canvas=t}function lf(e){this._modeling=e}function cf(e,t){this._canvas=e,this._layouter=t}rf.$inject=["moddle"],rf.prototype._needsId=function(e){return jt(e,["dmn:Artifact","dmn:DMNElement","dmn:DRGElement","dmndi:DMNDiagram","dmndi:DMNDiagramElement"])},rf.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},rf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},rf.prototype.createDiShape=function(e,t,n){return this.create("dmndi:DMNShape",F({dmnElementRef:e,bounds:this.createDiBounds(t)},n))},rf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},rf.prototype.createDiEdge=function(e,t,n){return this.create("dmndi:DMNEdge",{dmnElementRef:e,waypoint:this.createDiWaypoints(t)},n)},rf.prototype.createDiWaypoints=function(e){var t=this;return e.map((function(e){return t.createDiWaypoint(e)}))},rf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",X(e,["x","y"]))},rf.prototype.createExtensionElements=function(){return this.create("dmn:ExtensionElements",{values:[]})},qt(sf,Yd),sf.$inject=["connectionDocking","definitionPropertiesView","drdFactory","drdRules","injector"],sf.prototype.updateBounds=function(e){F(e.businessObject.di.bounds,{x:e.x,y:e.y,width:e.width,height:e.height})},sf.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}))},sf.prototype.updateParent=function(e,t){var n=e.parent;Dt(e,"dmn:DRGElement")||Dt(e,"dmn:Artifact")||(n=t);var i=e.businessObject,o=n&&n.businessObject;this.updateSemanticParent(i,o),this.updateDiParent(i.di,o&&o.di)},sf.prototype.updateSemanticParent=function(e,t){var n,i;e.$parent!==t&&(Dt(e,"dmn:DRGElement")?i="drgElement":Dt(e,"dmn:Artifact")?i="artifact":Dt(e,"dmn:InformationRequirement")?i="informationRequirement":Dt(e,"dmn:AuthorityRequirement")?i="authorityRequirement":Dt(e,"dmn:KnowledgeRequirement")&&(i="knowledgeRequirement"),e.$parent&&Bi(n=e.$parent.get(i),e),t?(n=t.get(i))&&(n.push(e),e.$parent=t):e.$parent=null)},sf.prototype.updateDiParent=function(e,t){if(e.$parent!==t){if(!jt(e,["dmndi:DMNEdge","dmndi:DMNShape"]))throw new Error("unsupported");for(var n=t||e;!Dt(n,"dmndi:DMNDiagram");)n=n.$parent;var i=n.get("diagramElements");t?(e.$parent=n,Ni(i,e)):(e.$parent=null,Bi(i,e))}},af.$inject=["modeling","canvas"],af.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;k(n,(function(e){var n={x:0,y:0};g(i.left)?n.x=i.left-e.x:g(i.right)?n.x=i.right-e.width-e.x:g(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:g(i.top)?n.y=i.top-e.y:g(i.bottom)?n.y=i.bottom-e.height-e.y:g(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},af.prototype.postExecute=function(e){},lf.$inject=["modeling"],lf.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},lf.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))},cf.$inject=["canvas","layouter"],cf.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,o=e.parent,r=e.parentIndex,s=e.hints;if(!n||!i)throw new Error("source and target required");if(!o)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,o,r),t},cf.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var uf=Math.round;function hf(e){this._modeling=e}hf.$inject=["modeling"],hf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,s=this._modeling;k(t,(function(e){b(e.x)||(e.x=0),b(e.y)||(e.y=0)}));var a=ni(C(t,(function(e){return!e.hidden})));k(t,(function(e){Eo(e)&&(e.waypoints=P(e.waypoints,(function(e){return{x:uf(e.x-a.x-a.width/2+o.x),y:uf(e.y-a.y-a.height/2+o.y)}}))),F(e,{x:uf(e.x-a.x-a.width/2+o.x),y:uf(e.y-a.y-a.height/2+o.y)})}));var l=Zn(t),c={};k(t,(function(e){if(Eo(e))c[e.id]=b(i)?s.createConnection(c[e.source.id],c[e.target.id],i,e,e.parent||n,r):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,r);else{var t=F({},r);-1===l.indexOf(e)&&(t.autoResize=!1),So(e)&&(t=z(t,["attach"])),c[e.id]=b(i)?s.createShape(e,X(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,X(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=R(c)};var df=Math.round;function pf(e){this._canvas=e}function ff(e){pf.call(this,e)}pf.$inject=["canvas"],pf.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?F(t,n):F(t,{x:n.x-df(t.width/2),y:n.y-df(t.height/2)}),this._canvas.addShape(t,i,o),t},pf.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},qt(ff,pf),ff.$inject=["canvas"];var gf=pf.prototype.execute;ff.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,gf.call(this,e)};var mf=pf.prototype.revert;function vf(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 yf(e,t){this._canvas=e,this._modeling=t}function bf(e,t){this._modeling=e,this._elementRegistry=t}function _f(e,t){this._canvas=e,this._modeling=t}function xf(e){this._modeling=e}ff.prototype.revert=function(e){return e.shape.labelTarget=null,mf.call(this,e)},yf.$inject=["canvas","modeling"],yf.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;vf(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),vf(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},yf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=qi(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},yf.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ni(n.children,t,i),this._canvas.addConnection(t,n),t},bf.$inject=["modeling","elementRegistry"],bf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;k(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},_f.$inject=["canvas","modeling"],_f.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;vf(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),vf(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),vf(n.children,(function(e){Eo(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},_f.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=qi(i.children,n),t.removeShape(n),n},_f.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return Ni(i.children,n,o),t.addShape(n,i),n},xf.$inject=["modeling"];var Of={x:"y",y:"x"};function wf(e,t){this._layouter=e,this._canvas=t}function Cf(){}function kf(e,t,n){var i=Ga(t),o=Ga(n),r=Za(e,i),s=r.x*(n.width/t.width),a=r.y*(n.height/t.height);return $o({x:o.x+s,y:o.y+a})}function Ef(e,t,n){var i=Rf(e),o=Af(i,t),r=i[0];return o.length?o[o.length-1]:kf(r.original||r,n,t)}function Sf(e,t,n){var i=Rf(e),o=Af(i,t),r=i[i.length-1];return o.length?o[0]:kf(r.original||r,n,t)}function $f(e,t,n){var i=Rf(e),o=Tf(t,n),r=i[0];return kf(r.original||r,o,t)}function Pf(e,t,n){var i=Rf(e),o=Tf(t,n),r=i[i.length-1];return kf(r.original||r,o,t)}function Tf(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Rf(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Af(e,t){return C(P(e,Mf),(function(e){return function(e,t){return"intersect"===Mo(t,e,1)}(e,t)}))}function Mf(e){return e.original||e}function Df(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Lf(e){this._modeling=e}function If(e){this._helper=new Lf(e)}function Qf(e){this._modeling=e,this._helper=new Lf(e)}function jf(e){this._modeling=e}function Bf(e){return e.original||e}function Nf(e,t){this._modeling=e,this._rules=t}function qf(e){this._modeling=e}function Ff(e,t){return-1!==e.indexOf(t)}function Vf(e){this._modeling=e}function Xf(e){return F({},e)}function zf(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Yf(e,t,n){var i=zf(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Wf(e,t){return-1!==e.indexOf(t)}function Hf(e){this._modeling=e}function Uf(e){var t={};return k(e,(function(e){t[e.id]=e.hidden,e.children&&(t=F({},t,Uf(e.children)))})),t}function Gf(e,t){var n=[];return k(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Gf(e.children,e.collapsed||t)))})),n}function Zf(e,t){var n=[];return k(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Zf(e.children,t)))})),n}function Kf(e){this._modeling=e}function Jf(e,t){return Bi(e&&e.attachers,t)}function eg(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ni(i,t,n)}}function tg(){}function ng(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function ig(e){this._moddle=e}function og(){function e(e,t){var n=e.label||e,i=e.labelTarget||e;return function(e,t,n){var i=e.businessObject,o=Cl(i);o&&(i[o]=t),n&&(e.hidden=!t)}(n,t,i!==n),[n,i]}this.execute=function(t){return t.oldLabel=kl(t.element),e(t.element,t.newLabel)},this.revert=function(t){return e(t.element,t.oldLabel)}}xf.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[o],e.range.max)}function s(e){return e[i]+e[o]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,u,h=n[0],d=a(n),p=n[d],f=0;k(n,(function(e,c){var u,h,p;e.elements.length<2?c&&c!==n.length-1&&(r(e,e.elements[0]),f+=l(e.range)):(h=(u=D(e.elements,i))[0],c===d&&(h=u[a(u)]),p=s(h),e.range=null,k(u,(function(n){!function(e,n){var o={y:0};o[i]=e-s(n),o[i]&&(o[Of[i]]=0,t.moveElements([n],o,n.parent))}(p,n),null!==e.range?r(e,n):e.range={min:n[i],max:n[i]+n[o]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),u=Math.abs(p.range.min-h.range.max),(c=Math.round((u-f)/(n.length-1)))<n.length-1||k(n,(function(e,r){var s,a={};e!==h&&e!==p&&(s=n[r-1],e.range.max=0,k(e.elements,(function(n,r){a[Of[i]]=0,a[i]=s.range.max-n[i]+c,e.range.min!==n[i]&&(a[i]+=n[i]-e.range.min),a[i]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[i]+n[o],r?e.range.max:0)})))}))},xf.prototype.postExecute=function(e){},wf.$inject=["layouter","canvas"],wf.prototype.execute=function(e){var t=e.connection;return F(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},wf.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Cf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Bi(r.children,t),Ni(i.children,t,o),t.parent=i,k(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},Cf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Bi(n.children,t),Ni(i.children,t,o),t.parent=i,k(t.waypoints,(function(e){e.x-=r.x,e.y-=r.y,e.original&&(e.original.x-=r.x,e.original.y-=r.y)})),t},Df.prototype.add=function(e,t){return this.addAll([e],t)},Df.prototype.addAll=function(e,t){var n=function(e,t,n){f(t)&&(t=!0),y(t)&&(n=t,t=!0);var i=ri((n=n||{}).allShapes),o=ri(n.allConnections),r=ri(n.enclosedElements),s=ri(n.enclosedConnections),a=ri(n.topLevel,t&&A(e,(function(e){return e.id})));function l(e){a[e.source.id]&&a[e.target.id]&&(a[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(s[e.id]=r[e.id]=e),o[e.id]=e}return ei(e,(function(e){if(r[e.id]=e,!e.waypoints)return i[e.id]=e,k(e.incoming,l),k(e.outgoing,l),e.children;s[e.id]=o[e.id]=e})),{allShapes:i,allConnections:o,topLevel:a,enclosedConnections:s,enclosedElements:r}}(e,!!t,this);return F(this,n),this},Lf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Lf.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),k(s,(function(e){r.moveShape(e,t,c[e.id]&&!u&&n,{recurse:!1,layout:!1})})),k(a,(function(e){var i=!!s[e.source.id],o=!!s[e.target.id];l[e.id]&&i&&o?r.moveConnection(e,t,c[e.id]&&!u&&n):r.layoutConnection(e,{connectionStart:i&&$f(e,e.source,t),connectionEnd:o&&Pf(e,e.target,t)})}))},Lf.prototype.getClosure=function(e){return(new Df).addAll(e,!0)},If.$inject=["modeling"],If.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},If.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)},Qf.$inject=["modeling"],Qf.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=X(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Bi(r.children,t),Ni(i.children,t,o),F(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Qf.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;!1!==i.layout&&(k(t.incoming,(function(e){o.layoutConnection(e,{connectionEnd:Pf(e,t,n)})})),k(t.outgoing,(function(e){o.layoutConnection(e,{connectionStart:$f(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},Qf.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return Ni(n.children,t,i),F(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Qf.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Qf.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},jf.$inject=["modeling"],jf.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return v(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},jf.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},s={};r.connectionStart&&(s.connectionStart=r.connectionStart),r.connectionEnd&&(s.connectionEnd=r.connectionEnd),!1!==r.layoutConnection&&(!n||i&&"source"!==r.docking||(s.connectionStart=s.connectionStart||Bf(v(o)?o[0]:o)),!i||n&&"target"!==r.docking||(s.connectionEnd=s.connectionEnd||Bf(v(o)?o[o.length-1]:o)),r.newWaypoints&&(s.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,s))},jf.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o},Nf.$inject=["modeling","rules"],Nf.prototype.preExecute=function(e){var t,n=this,i=this._modeling,o=this._rules,r=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return o.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,u={x:s.x,y:s.y},h={x:r.x,y:r.y,width:r.width,height:r.height};t=e.newShape=e.newShape||n.createShape(s,u,r.parent,a),r.host&&i.updateAttachment(t,r.host),!1!==a.moveChildren&&(c=r.children.slice(),i.moveElements(c,{x:0,y:0},t,a));var d=r.incoming.slice(),p=r.outgoing.slice();k(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,Sf(e,t,h),a)})),k(p,(function(e){var i=e.target;l(t,i,e)&&n.reconnectStart(e,t,Ef(e,t,h),a)}))},Nf.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Nf.prototype.execute=function(e){},Nf.prototype.revert=function(e){},Nf.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Nf.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Nf.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},qf.$inject=["modeling"],qf.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},F(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},qf.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds;!1!==(e.hints||{}).layout&&(k(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:Sf(e,n,i)})})),k(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:Ef(e,n,i)})})))},qf.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return F(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Vf.$inject=["modeling"],Vf.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,s={};this.moveShapes(i,t),k(o,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return k(e.concat(t),(function(i){var o=i.incoming,r=i.outgoing;k(o.concat(r),(function(i){var o=i.source,r=i.target;(Ff(e,o)||Ff(e,r)||Ff(t,o)||Ff(t,r))&&(Ff(n,i)||n.push(i))}))})),n}(i,o),t,n,r,i,o,s)},Vf.prototype.execute=function(){},Vf.prototype.revert=function(){},Vf.prototype.moveShapes=function(e,t){var n=this;k(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Vf.prototype.resizeShapes=function(e,t,n){var i=this;k(e,(function(e){var o=function(e,t,n){var i=e.x,o=e.y,r=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:i,y:o+l,width:r,height:s-l};case"s":return{x:i,y:o,width:r,height:s+l};case"w":return{x:i+a,y:o,width:r-a,height:s};case"e":return{x:i,y:o,width:r+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);i._modeling.resizeShape(e,o,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Vf.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,s){var a=this,l=o.concat(r);k(e,(function(e){var c=e.source,u=e.target,h=function(e){return P(e.waypoints,(function(e){return(e=Xf(e)).original&&(e.original=Xf(e.original)),e}))}(e),d=zf(n),p={};Wf(l,c)&&Wf(l,u)?(h=P(h,(function(e){return Yf(e,i,n)&&(e[d]=e[d]+t[d]),e.original&&Yf(e.original,i,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,h,{labelBehavior:!1})):(Wf(l,c)||Wf(l,u))&&(Wf(o,c)?p.connectionStart=$f(e,c,t):Wf(o,u)?p.connectionEnd=Pf(e,u,t):Wf(r,c)?p.connectionStart=Ef(e,c,s[c.id]):Wf(r,u)&&(p.connectionEnd=Sf(e,u,s[u.id])),a._modeling.layoutConnection(e,p))}))},Hf.$inject=["modeling"],Hf.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Uf(n),t.collapsed=!t.collapsed;var i=Gf(n,t.collapsed);return[t].concat(i)},Hf.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Zf(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Kf.$inject=["modeling"],Kf.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Jf(i,t),eg(n,t),t.host=n,t},Kf.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Jf(n,t),eg(i,t,o),t},tg.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},tg.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},ng.$inject=["eventBus","elementFactory","commandStack"],ng.prototype.getHandlers=function(){return{"shape.append":lf,"shape.create":pf,"shape.delete":_f,"shape.move":Qf,"shape.resize":qf,"shape.replace":Nf,"shape.toggleCollapse":Hf,spaceTool:Vf,"label.create":ff,"connection.create":cf,"connection.delete":yf,"connection.move":Cf,"connection.layout":wf,"connection.updateWaypoints":tg,"connection.reconnect":jf,"elements.create":hf,"elements.move":If,"elements.delete":bf,"elements.distribute":xf,"elements.align":af,"element.updateAttachment":Kf}},ng.prototype.registerHandlers=function(e){k(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},ng.prototype.moveShape=function(e,t,n,i,o){"object"==typeof i&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},ng.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ng.prototype.moveElements=function(e,t,n,i){var o,r=(i=i||{}).attach,s=n;!0===r?(o=n,s=n.parent):!1===r&&(o=null);var a={shapes:e,delta:t,newParent:s,newHost:o,hints:i};this._commandStack.execute("elements.move",a)},ng.prototype.moveConnection=function(e,t,n,i,o){"object"==typeof i&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},ng.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ng.prototype.createConnection=function(e,t,n,i,o,r){"object"==typeof n&&(r=o,o=i,i=n,n=void 0);var s={source:e,target:t,parent:o,parentIndex:n,connection:i=this._create("connection",i),hints:r};return this._commandStack.execute("connection.create",s),s.connection},ng.prototype.createShape=function(e,t,n,i,o){"number"!=typeof i&&(o=i,i=void 0);var r,s,a=(o=o||{}).attach;e=this._create("shape",e),a?(r=n.parent,s=n):r=n;var l={position:t,shape:e,parent:r,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",l),l.shape},ng.prototype.createElements=function(e,t,n,i,o){v(e)||(e=[e]),"number"!=typeof i&&(o=i,i=void 0);var r={position:t,elements:e,parent:n,parentIndex:i,hints:o=o||{}};return this._commandStack.execute("elements.create",r),r.elements},ng.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},ng.prototype.appendShape=function(e,t,n,i,o){o=o||{};var r={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},ng.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ng.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ng.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ng.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ng.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ng.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ng.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},ng.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},ng.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ng.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},ng.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,F(i,{docking:"source"}))},ng.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,F(i,{docking:"target"}))},ng.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ng.prototype._create=function(e,t){return t instanceof Go?t:this._elementFactory.create(e,t)},ng.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},ig.$inject=["moddle"],ig.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},ig.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)};const rg="id";function sg(e,t){this._elementRegistry=e,this._moddle=t}function ag(e,t){return rg in e&&e[rg]!==t[rg]}function lg(e,t){k(t,(function(t,n){e.set(n,t)}))}function cg(e){this._elementRegistry=e}function ug(e,t){k(t,(function(t,n){e.set(n,t)}))}function hg(e,t,n){this._canvas=e,this._drdRules=t,n.invoke(ng,this)}function dg(){}sg.$inject=["elementRegistry","moddle"],sg.prototype.execute=function(e){const{element:t,properties:n}=e,i=[t];if(!t)throw new Error("element required");const o=this._elementRegistry,r=this._moddle.ids,s=Qt(t),a=e.oldProperties||function(e,t){return E(t,(function(t,n){return t[n]=e.get(n),t}),{})}(s,T(n));return ag(n,s)&&(r.unclaim(s[rg]),o.updateId(t,n[rg]),r.claim(n[rg],s)),"name"in n&&t.label&&i.push(t.label),lg(s,n),e.oldProperties=a,e.changed=i,i},sg.prototype.revert=function(e){const{element:t,properties:n,oldProperties:i}=e,o=Qt(t),r=this._elementRegistry,s=this._moddle.ids;return lg(o,i),ag(n,o)&&(s.unclaim(n[rg]),r.updateId(t,i[rg]),s.claim(i[rg],o)),e.changed},cg.$inject=["elementRegistry"],cg.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||[t],r=e.oldProperties||function(e,t){return E(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,T(i));return ug(n,i),e.oldProperties=r,e.changed=o,o},cg.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return ug(n,t),i},qt(hg,ng),hg.$inject=["canvas","drdRules","injector"],hg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},hg.prototype.connect=function(e,t,n,i){var o=this._drdRules,r=this._canvas.getRootElement();return n||(n=o.canConnect(e,t)||{type:"dmn:Association"}),this.createConnection(e,t,n,r,i)},hg.prototype.getHandlers=function(){var e=ng.prototype.getHandlers.call(this);return e["id.updateClaim"]=ig,e["element.updateLabel"]=og,e["element.updateProperties"]=sg,e["element.updateModdleProperties"]=cg,e},hg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},hg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},hg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},hg.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},dg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Ao(t.source||e.source),t.connectionEnd||Ao(t.target||e.target)]};function pg(e){this._connectionDocking=e}function fg(e,t){return e?e.original||e:Ao(t)}function gg(e){return F({original:e.point.original||e.point},e.actual)}function mg(e,t){this._elementRegistry=e,this._graphicsFactory=t}qt(pg,dg),pg.$inject=["connectionDocking"],pg.prototype.layoutConnection=function(e,t){var n=this._connectionDocking;t||(t={});var i=t.source||e.source,o=t.target||e.target,r=t.waypoints||e.waypoints||[],s=t.connectionStart,a=t.connectionEnd,l=Mo(i,o);if(s||(s=fg(r[0],i)),a||(a=fg(r[r.length-1],o)),Dt(e,"dmn:InformationRequirement")){r=[s,a];var c=n.getCroppedWaypoints(F({},e,{waypoints:r}),i,o),u={x:(a=c.pop()).x,y:a.y};return l.includes("bottom")?u.y+=20:l.includes("top")?u.y-=20:l.includes("right")?u.x+=20:u.x-=20,r=c.concat([u,a])}return[s,a]},mg.$inject=["elementRegistry","graphicsFactory"],mg.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(gg(i)),r.push(gg(o)),r},mg.prototype.getDockingPoint=function(e,t,n){var i,o,r=e.waypoints;return{point:o=r[i=n?0:r.length-1],actual:this._getIntersection(t,e,n)||o,idx:i}},mg.prototype._getIntersection=function(e,t,n){return Do(this._getShapePath(e),this._getConnectionPath(t),n)},mg.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mg.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mg.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var vg={__init__:["modeling","drdUpdater"],__depends__:[Gp,of,za,mp,La,yp],drdFactory:["type",rf],drdUpdater:["type",sf],elementFactory:["type",Hl],modeling:["type",hg],layouter:["type",pg],connectionDocking:["type",mg]};function yg(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function o(e){var t=Tn("rect");return xn(t,F({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,r=Ii(".djs-outline",n);r||yn(n,r=i.getOutline(t)||o()),i.updateShapeOutline(r,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,r=Ii(".djs-outline",n);r||yn(n,r=o()),i.updateConnectionOutline(r,t)}))}yg.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&k(i,(function(i){n=n||i.updateOutline(t,e)})),n||xn(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},yg.prototype.updateConnectionOutline=function(e,t){var n=ni(t);xn(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},yg.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},yg.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},yg.prototype.getOutline=function(e){var t;return k(this._getProviders(),(function(n){_(n.getOutline)&&(t=t||n.getOutline(e))})),t},yg.$inject=["eventBus","styles","elementRegistry"];function bg(e,t,n){this._canvas=t;var i=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;i._updateMultiSelectionOutline(t)}))}bg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");kn(t);var n=e.length>1;if(wn(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}}(ni(e)),o=Tn("rect");xn(o,F({rx:3},i)),wn(o).add("djs-selection-outline"),yn(t,o)}},bg.$inject=["eventBus","canvas","selection"];var _g={__depends__:[La],__init__:["outline","multiSelectionOutline"],outline:["type",yg],multiSelectionOutline:["type",bg]},xg=Math.round;function Og(e,t,n,i,o){function r(e,t,n,i){return o.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function s(e,n,i,o){if(y(i)&&(o=i,i=!1),!n.waypoints&&n.parent&&!wn(e.target).has("djs-hit-no-move")){var r=function(e){return{x:e.x+xg(e.width/2),y:e.y+xg(e.height/2)}}(n);return t.init(e,r,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:o||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,o=i.get().slice();-1===o.indexOf(n)&&(o=[n]),o=function(e){var t=A(e,"id");return C(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(o),F(t,{shapes:o,validatedShapes:o,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=r(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,i=n.validatedShapes,o=e.hover,s={x:e.dx,y:e.dy};t=r(i,s,{x:e.x,y:e.y},o),n.delta=s,n.canExecute=t,n.target=null!==t?o:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,o=t.canExecute,r="attach"===o,s=t.shapes;if(!1===o)return!1;i.x=xg(i.x),i.y=xg(i.y),0===i.x&&0===i.y||n.moveElements(s,i,t.target,{primaryShape:t.shape,attach:r})})),e.on("element.mousedown",(function(e){if(Oa(e)){var t=va(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}Og.$inject=["eventBus","dragging","modeling","selection","rules"];var wg="djs-dragging",Cg="drop-ok",kg="drop-not-ok",Eg="new-parent",Sg="attach-ok";function $g(e,t,n,i){function o(e){var t=function(e){var t=C(e,(function(t){return!Eo(t)||w(e,L({id:t.source.id}))&&w(e,L({id:t.target.id}))}));return t}(r(e));return t}function r(e){var t=ti(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),i=t.concat(n);return[...new Set(i)]}function s(e,n){[Sg,Cg,kg,Eg].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}e.on("shape.move.start",499,(function(e){var s,a,l=e.context,c=l.shapes,u=l.allDraggedElements,h=o(c);if(!l.dragGroup){var d=Tn("g");xn(d,n.cls("djs-drag-group",["no-events"])),yn(t.getActiveLayer(),d),l.dragGroup=d}h.forEach((function(e){i.addDragger(e,l.dragGroup)})),u?(s=[u,r(c)],u=Array.prototype.concat.apply([],s)):u=r(c),k(u,(function(e){t.addMarker(e,wg)})),l.allDraggedElements=u,l.differentParents=1!==(a=A(c,(function(e){return e.parent&&e.parent.id})),T(a).length)})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,i=t.target,o=t.shape.parent,r=t.canExecute;i&&("attach"===r?s(i,Sg):t.canExecute&&o&&i.id!==o.id?s(i,Eg):s(i,t.canExecute?Cg:kg)),or(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&s(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,i=n.allDraggedElements,o=n.dragGroup;k(i,(function(e){t.removeMarker(e,wg)})),o&&qn(o)})),this.makeDraggable=function(e,n,o){i.addDragger(n,e.dragGroup),o&&t.addMarker(n,wg),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}$g.$inject=["eventBus","canvas","styles","previewSupport"];var Pg={__depends__:[$a,La,_g,gc,uc,Ou],__init__:["move","movePreview"],move:["type",Og],movePreview:["type",$g]};const Tg={width:135,height:46},Rg={width:100,height:63};function Ag(e,t,n){return Tn("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function Mg(e,t){this._styles=t,e.registerProvider(this)}function Dg(e,t){var n;return"dmn:BusinessKnowledgeModel"===t?n=Tg:"dmn:KnowledgeSource"===t&&(n=Rg),e.width===n.width&&e.height===n.height}Mg.$inject=["outline","styles"],Mg.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;return Dt(e,"dmn:InputData")?xn(n=Tn("rect"),F({x:-5,y:-5,rx:27,width:e.width+10,height:e.height+10},t)):Dt(e,"dmn:BusinessKnowledgeModel")&&Dg(e,"dmn:BusinessKnowledgeModel")?n=Ag("\nM2.45221 16.0068L18.7175 1.74436L18.0615 0.996331L18.7175 1.74436C19.2646 1.26455 19.9676 \n1 20.6953 1H140.926C142.583 1 143.926 2.34295 143.926 3.99967L143.93 37.5457C143.93 \n38.3668 143.593 39.152 142.999 39.7183L143.689 40.4424L142.999 39.7183L127.299 \n54.6723C126.741 55.2036 126 55.5 125.23 55.5H4.53787C2.88599 55.5 1.54491 54.1646 1.5379 \n52.5127L1.43066 27.229L1.43065 27.2248L1.4301 18.2626C1.43005 \n17.3986 1.80255 16.5765 2.45221 16.0068Z\n",{x:-6,y:-6},t):Dt(e,"dmn:KnowledgeSource")&&Dg(e,"dmn:KnowledgeSource")&&(n=Ag("\nM1.79494 63.0032L1.2941 63.6423L1.79493 63.0032C1.71778 62.9427 1.6428 62.8741 1.57288 \n62.8L1.01736 63.3241L1.57288 62.8C1.20495 62.41 1 61.8941 1 61.3579V2.65067C1 1.74066 \n1.73867 1.00345 2.64868 1.00526L108.006 1.2145C109.66 1.21778 111 2.55996 111 \n4.21449V21.7015V61.6762C111 63.3188 109.679 64.656 108.037 64.676L107.06 64.6879C106.66 \n64.6927 106.26 64.6165 105.89 64.4652C105.04 64.1176 104.222 63.78 103.43 \n63.4531C93.4866 59.3517 87.6891 56.9603 76.3991 58.1057C71.7035 58.5821 66.8747 60.74 \n61.5721 63.1744C61.3243 63.2881 61.0753 63.4026 60.825 63.5177C55.6712 65.8868 49.9696 \n68.5077 43.2365 70.3468C31.101 73.6617 15.2135 73.5179 1.79494 63.0032Z\n",{x:-6,y:-1.5},t)),n},Mg.prototype.updateOutline=function(e){return!!jt(e,["dmn:InputData","dmn:BusinessKnowledgeModel","dmn:KnowledgeSource"])};var Lg={__depends__:[_g],__init__:["outlineProvider"],outlineProvider:["type",Mg]},Ig=".djs-palette-toggle",Qg=".entry",jg=Ig+", "+Qg,Bg="djs-palette-",Ng="open",qg="two-column";function Fg(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 Vg(e,t){var n=t.getPaletteEntries();return _(n)?n(e):(k(n,(function(t,n){e[n]=t})),e)}Fg.$inject=["eventBus","canvas"],Fg.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Fg.prototype.getEntries=function(){return this._getProviders().reduce(Vg,{})},Fg.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Fg.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Di(Fg.HTML_MARKUP);n.appendChild(i),yi(n).add(Bg+"shown"),Ti.bind(i,jg,"click",(function(t){if(Li(t.delegateTarget,Ig))return e.toggle();e.trigger("click",t)})),Si.bind(i,"mousedown",(function(e){e.stopPropagation()})),Ti.bind(i,Qg,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Fg.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Fg.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,o=this._eventBus,r=yi(i),s=yi(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),r.toggle(qg,t),s.toggle(Bg+qg,t),"open"in e&&(r.toggle(Ng,e.open),s.toggle(Bg+Ng,e.open)),o.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Fg.prototype._update=function(){var e=Ii(".djs-palette-entries",this._container),t=this._entries=this.getEntries();_i(e),k(t,(function(t,n){var i=t.group||"default",o=Ii("[data-group="+ul(i)+"]",e);o||(mi(o=Di('<div class="group"></div>'),"data-group",i),e.appendChild(o));var r=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Di(r);if(o.appendChild(s),!t.separator&&(mi(s,"data-action",n),t.title&&mi(s,"title",t.title),t.className&&function(e,t){var n=yi(e),i=v(t)?t:t.split(/\s+/g);i.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=Di("<img>");mi(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Fg.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=mi(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},Fg.prototype.triggerEntry=function(e,t,n,i){var o,r;if((o=this._entries[e])&&(r=o.action,!1!==this._eventBus.fire("palette.trigger",{entry:o,event:n}))){if(_(r)){if("click"===t)return r(n,i)}else if(r[t])return r[t](n,i);n.preventDefault()}},Fg.prototype._layoutChanged=function(){this._toggleState({})},Fg.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Fg.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Fg.prototype.open=function(){this._toggleState({open:!0})},Fg.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Fg.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Fg.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=Ii(".djs-palette-entries",this._container),this._toolsContainer=Ii("[data-group=tools]",t)),k(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=yi(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},Fg.prototype.isOpen=function(){return yi(this._container).has(Ng)},Fg.prototype._getParentContainer=function(){return this._canvas.getContainer()},Fg.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Xg={__init__:["palette"],palette:["type",Fg]};function zg(e){this._eventBus=e,this._tools=[],this._active=null}zg.$inject=["eventBus"],zg.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)},zg.prototype.isActive=function(e){return e&&this._active===e},zg.prototype.length=function(e){return this._tools.length},zg.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},zg.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),k(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&xi(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Yg={__depends__:[uc],__init__:["toolManager"],toolManager:["type",zg]};function Wg(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)}))}Wg.$inject=["eventBus"],Wg.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,s,!1,!1,!1,!1,0,null);return n}(0,0)};var Hg={__init__:["mouse"],mouse:["type",Wg]},Ug="crosshair";function Gg(e,t,n,i,o,r,s){this._selection=o,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,i=t.getActiveLayer();xn(n=e.frame=Tn("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),yn(i,n)},c=function(e){var t=e.frame,n=e.bbox;xn(t,{x:n.x,y:n.y,width:n.width,height:n.height})},u=function(e){e.frame&&qn(e.frame)};r.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(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",0,(function(e){var t=e.context,n=Zg(e),o=i.filter((function(e){return e})),r=Ca(e);a.select(o,n,r?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Zg(e),l(t),t.selection=o.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Zg(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;u(t)})),e.on("element.mousedown",1500,(function(e){if(Ca(e))return a.activateLasso(e.originalEvent),!0}))}function Zg(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}}Gg.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Gg.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Ug,data:{context:{}}})},Gg.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Ug,data:{context:{}},keepSelection:!0})},Gg.prototype.select=function(e,t,n=[]){var i=function(e,t){var n={};return k(e,(function(e){var i=e;i.waypoints&&(i=ni(i)),!b(t.y)&&i.x>t.x&&(n[e.id]=e),!b(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(b(t.width)&&b(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:b(t.width)&&b(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select([...n,...R(i)])},Gg.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Gg.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Kg={__depends__:[Yg,Hg],__init__:["lassoTool"],lassoTool:["type",Gg]},Jg=1500,em="grab";function tm(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var s=this,a=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Jg,(function(e){if(wa(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Jg,(function(e){if(nm(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Jg,(function(e){nm(e.keyEvent)&&s.isActive()&&s.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(){s.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!wa(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function nm(e){return vl("Space",e)}tm.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],tm.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:em,data:{context:n||{}}})},tm.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:em,data:{context:{reactivate:n}}})},tm.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},tm.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var im={__depends__:[Yg,Hg],__init__:["handTool"],handTool:["type",tm]};function om(e,t,n,i,o,r){this._palette=e,this._create=t,this._elementFactory=n,this._handTool=i,this._lassoTool=o,this._translate=r,e.registerProvider(this)}om.$inject=["palette","create","elementFactory","handTool","lassoTool","translate"],om.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,o=this._handTool,r=this._lassoTool,s=this._translate;function a(e,t,o,r,s){function a(t){var o=i.createShape(F({type:e},s));n.start(t,o)}return{group:t,className:o,title:r,action:{dragstart:a,click:a}}}return F(t,{"hand-tool":{group:"tools",className:"dmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"dmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(e){r.activateSelection(e)}}},"tool-separator":{group:"tools",separator:!0},"create.decision":a("dmn:Decision","drd","dmn-icon-decision",s("Create decision")),"create.input-data":a("dmn:InputData","drd","dmn-icon-input-data",s("Create input data")),"create.knowledge-source":a("dmn:KnowledgeSource","drd","dmn-icon-knowledge-source",s("Create knowledge source")),"create.business-knowledge-model":a("dmn:BusinessKnowledgeModel","drd","dmn-icon-business-knowledge",s("Create knowledge model"))}),t};var rm={__depends__:[ga,Xg,Bu,Kg,im],__init__:["paletteProvider"],paletteProvider:["type",om]},sm=Math.max,am=Math.min;function lm(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return b(o)&&(i=(/top|left/.test(e)?am:sm)(i,o)),b(r)&&(i=(/top|left/.test(e)?sm:am)(i,r)),i}function cm(e,t){return void 0!==e?e:20}function um(e){return!e.waypoints&&"label"!==e.type}function hm(e,t){var n;if((n=void 0===e.length?C(e.children,um):e).length)return function(e,t){var n,i,o,r;return"object"==typeof t?(n=cm(t.left),i=cm(t.right),o=cm(t.top),r=cm(t.bottom)):n=i=o=r=cm(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}(ni(n),t)}function dm(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(e,t){var n,i=e.shape,r=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var i=n.x,o=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(r.y=e.y+o,r.height=e.height-o):-1!==t.indexOf("s")&&(r.height=e.height+o),-1!==t.indexOf("e")?r.width=e.width+i:-1!==t.indexOf("w")&&(r.x=e.x+i,r.width=e.width-i),r}(i,r,t),e.newBounds=function(e,t){if(!t)return e;var n=Po(e);return To({top:lm("top",n,t),right:lm("right",n,t),bottom:lm("bottom",n,t),left:lm("left",n,t)})}(n,s),e.canExecute=o.canResize(e)}function s(e){var t,i=e.shape,o=e.canExecute,r=e.newBounds;if(o){if(t=r,!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(i,r={x:Math.round(t.x),y:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height)}))return;n.resizeShape(i,r)}}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=o.computeMinResizeBox(t)),t.resizeConstraints={min:Po(i)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};r(e.context,t)})),e.on("resize.end",(function(e){s(e.context)}))}function pm(e,t){var n=Ao(e),i=Po(e),o={x:n.x,y:n.y};return-1!==t.indexOf("n")?o.y=i.top:-1!==t.indexOf("s")&&(o.y=i.bottom),-1!==t.indexOf("e")?o.x=i.right:-1!==t.indexOf("w")&&(o.x=i.left),o}function fm(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"}dm.prototype.canResize=function(e){var t=this._rules,n=X(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},dm.prototype.activate=function(e,t,n){var i,o,r=this._dragging;if("string"==typeof n&&(n={direction:n}),!(o=(i=F({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");r.init(e,pm(t,o),"resize",{autoActivate:!0,cursor:fm(o),data:{shape:t,context:i}})},dm.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var o=Po(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},s=i?Po(i):r;return To({top:am(r.top,s.top),left:am(r.left,s.left),bottom:sm(r.bottom,s.bottom),right:sm(r.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},hm(t,e.childrenBoxPadding))},dm.$inject=["eventBus","rules","modeling","dragging"];var gm="djs-resizing",mm="resize-not-ok";function vm(e,t,n){e.on("resize.move",500,(function(e){var i,o,r,s;i=e.context,o=i.shape,r=i.newBounds,(s=i.frame)||(s=i.frame=n.addFrame(o,t.getActiveLayer()),t.addMarker(o,gm)),r.width>5&&xn(s,{x:r.x,width:r.width}),r.height>5&&xn(s,{y:r.y,height:r.height}),i.canExecute?wn(s).remove(mm):wn(s).add(mm)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&qn(n.frame),t.removeMarker(i,gm)}))}vm.$inject=["eventBus","canvas","previewSupport"];var ym=-6,bm="djs-resizer",_m=["n","w","s","e","nw","ne","se","sw"];function xm(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",(function(e){var t=e.newSelection;o.removeResizers(),1===t.length&&k(t,q(o.addResizer,o))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(o.removeResizers(),o.addResizer(t))}))}xm.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(t){Oa(t)&&i.activate(t,e,n)}Si.bind(t,"mousedown",o),Si.bind(t,"touchstart",o)},xm.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=ym);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=ym);return t}(i),s=Tn("g");wn(s).add(bm),wn(s).add(bm+"-"+e.id),wn(s).add(bm+"-"+i),yn(o,s);var a=Tn("rect");xn(a,{x:-4+r.x,y:-4+r.y,width:8,height:8}),wn(a).add(bm+"-visual"),yn(s,a);var l=Tn("rect");return xn(l,{x:-10+r.x,y:-10+r.y,width:20,height:20}),wn(l).add(bm+"-hit"),yn(s,l),function(e,t,n){var i=Dn();i.setTranslate(t,n);var o=Dn();o.setRotate(0,0,0);var r=Dn();r.setScale(1,1),Vn(e,[i,o,r])}(s,t,n),s},xm.prototype.createResizer=function(e,t){var n=pm(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xm.prototype.addResizer=function(e){var t=this;!Eo(e)&&this._resize.canResize({shape:e})&&k(_m,(function(n){t.createResizer(e,n)}))},xm.prototype.removeResizers=function(){kn(this._getResizersParent())},xm.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xm.$inject=["eventBus","canvas","selection","resize"];var Om={__depends__:[gc,uc,Ou],__init__:["resize","resizePreview","resizeHandles"],resize:["type",dm],resizePreview:["type",vm],resizeHandles:["type",xm]};function wm(e){e.on(["bendpoint.move.move","bendpoint.move.end"],2e3,(function(e){var t=e.context,n=t.allowed,i=t.hover,o=t.source,r=t.target,s=t.type;if(t.hints||(t.hints={}),delete t.hints.connectionStart,delete t.hints.connectionEnd,(!n||"dmn:InformationRequirement"===n.type)&&i&&jt(i,["dmn:Decision","dmn:InputData"])&&o!==r){var a="reconnectStart"===s||"reconnectEnd"===s,l=Mo(o,r);a&&i===o?(!function(e,t){var n=e.context,i=n.source,o=Cm(i,t),r=e.x-o.x,s=e.y-o.y;e.x-=r,e.y-=s,e.dx-=r,e.dy-=s}(e,l),t.hints.connectionEnd=km(r,l)):a&&i===r&&(t.hints.connectionStart=Cm(o,l),function(e,t){var n=e.context,i=n.target,o=km(i,t),r=0,s=0;t.includes("top")||t.includes("bottom")?s=e.y-o.y:r=e.x-o.x;e.x-=r,e.y-=s,e.dx-=r,e.dy-=s}(e,l))}}))}function Cm(e,t){var n=Po(e),i=Ao(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 km(e,t){var n=Po(e),i=Ao(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}wm.$inject=["eventBus"];function Em(e){e.on(["connect.hover","connect.move","connect.end"],250,(function(e){var t=e.context,n=t.canExecute,i=t.hover,o=t.source,r=t.target;if(n&&"dmn:InformationRequirement"===n.type){var s=Mo(o,r);t.connectionStart=Ao(o),t.connectionEnd=i===o?Ao(r):{x:e.x,y:e.y},s.includes("bottom")?(t.connectionStart.y=Po(o).top,t.connectionEnd.y=Po(r).bottom):s.includes("top")?(t.connectionStart.y=Po(o).bottom,t.connectionEnd.y=Po(r).top):s.includes("right")?(t.connectionStart.x=Po(o).left,t.connectionEnd.x=Po(r).right):(t.connectionStart.x=Po(o).right,t.connectionEnd.x=Po(r).left)}else delete t.connectionStart,delete t.connectionEnd}))}function Sm(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function $m(){this._snapValues={}}Em.$inject=["eventBus"],Sm.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Sm.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Sm.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Sm.prototype.getSnapLocations=function(){return this._snapLocations},Sm.prototype.setSnapLocations=function(e){this._snapLocations=e},Sm.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new $m).initDefaults(this._defaultSnaps),n},$m.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)},$m.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&function(e,t,n){var i,o;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(o=t[i],Gc(o-e)<=n)return o}(e[n],o[n],i)},$m.prototype.initDefaults=function(e){var t=this;k(e||{},(function(e,n){k(e,(function(e){t.add(n,e)}))}))};function Pm(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,o=t.shape,r=t.snapContext,s=t.target;if((!e.originalEvent||!ml(e.originalEvent))&&!Jc(e)&&s){var a=r.pointsForTarget(s);a.initialized||((a=i.addSnapTargetPoints(a,o,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}Pm.$inject=["elementRegistry","eventBus","snapping"],Pm.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,o=i.shape,r=i.snapContext;r||(r=i.snapContext=new Sm);var s=(t=n.get(o.id)?Kc(o,e):{x:e.x+Kc(o).x,y:e.y+Kc(o).y}).x-o.width/2,a=t.y-o.height/2,l=t.x+o.width/2,c=t.y+o.height/2;return r.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),So(o)||(r.setSnapOrigin("top-left",{x:s-e.x,y:a-e.y}),r.setSnapOrigin("bottom-right",{x:l-e.x,y:c-e.y})),r},Pm.prototype.addSnapTargetPoints=function(e,t,n){return k(this.getSnapTargets(t,n),(function(n){if(So(n))So(t)&&e.add("mid",Kc(n));else if(Eo(n)){if(n.waypoints.length<3)return;k(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Kc(n))})),b(t.x)&&b(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Kc(t)),e):e},Pm.prototype.getSnapTargets=function(e,t){return tu(t).filter((function(e){return!e.hidden}))};function Tm(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,o=i.shape,r=o.parent,s=i.direction,a=i.snapContext;if(!(e.originalEvent&&ml(e.originalEvent)||Jc(e))){var l=a.pointsForTarget(r);l.initialized||((l=n.addSnapTargetPoints(l,o,r,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&eu(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&eu(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function Rm(e,t){var n=Ao(e),i=Po(e),o={x:n.x,y:n.y};return-1!==t.indexOf("n")?o.y=i.top:-1!==t.indexOf("s")&&(o.y=i.bottom),-1!==t.indexOf("e")?o.x=i.right:-1!==t.indexOf("w")&&(o.x=i.left),o}Tm.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new Sm);var r=Rm(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Tm.prototype.addSnapTargetPoints=function(e,t,n,i){return k(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",Rm(t,i)),e},Tm.$inject=["eventBus","snapping"],Tm.prototype.getSnapTargets=function(e,t){return tu(t).filter((function(t){return!(n=t,i=e,n.host===i||Eo(t)||function(e){return!!e.hidden}(t)||So(t));var n,i}))};function Am(e){this._canvas=e,this._asyncHide=N(q(this.hide,this),1e3)}Am.$inject=["canvas"],Am.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),o={x:Jc(e,"x"),y:Jc(e,"y")};k(i,(function(i){var r=n.getSnapOrigin(i),s={x:e.x+r.x,y:e.y+r.y};if(k(["x","y"],(function(e){var n;o[e]||void 0!==(n=t.snap(s,i,e,7))&&(o[e]={value:n,originValue:n-r[e]})})),o.x&&o.y)return!1})),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),k(["x","y"],(function(t){var n=o[t];y(n)&&eu(e,t,n.originValue)}))},Am.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Tn("path");return xn(n,{d:"M0,0 L0,0"}),wn(n).add("djs-snap-line"),yn(t,n),{update:function(t){b(t)?xn(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):xn(n,{display:"none"})}}},Am.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Am.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Am.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Am.prototype.hide=function(){k(this._snapLines,(function(e){e.update()}))};var Mm={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Pm],resizeSnapping:["type",Tm],snapping:["type",Am]}],__init__:["bendpointSnapping","connectSnapping"],bendpointSnapping:["type",wm],connectSnapping:["type",Em]};function Dm(e){Tl.call(this,e)}function Lm(e,t){Fm(e,"dmn:Decision")?function(e,t){for(const n of e.get("informationRequirement"))Im(n,t);for(const n of e.get("knowledgeRequirement"))jm(n,t)}(e,t):Fm(e,"dmn:BusinessKnowledgeModel")?function(e,t){for(const n of e.get("knowledgeRequirement"))jm(n,t)}(e,t):Fm(e,"dmn:Expression")&&function(e,t){Fm(e,"dmn:FunctionDefinition")&&function(e,t){const n=e.get("formalParameter");for(const e of n)Bm(e,t)}(e,t)}(e,t)}function Im(e,t){const n=e.get("requiredInput");n&&function(e,t){const n=qm(e,t.rootElement);if(!n)return;const i=n.get("name");if(!i)return;t.variables.push({name:i,origin:n})}(n,t);const i=e.get("requiredDecision");i&&function(e,t){const n=qm(e,t.rootElement);if(!n)return;const i=n.get("name");if(!i)return;const o={name:i,origin:n},r=n.get("decisionLogic");r&&function(e,t){if(Fm(e,"dmn:DecisionTable")){!function(e,t){if(1===e.length){const n={...Qm(e[0]),name:t.name};return void Object.assign(t,n)}const n=e.map(Qm);t.entries=n.filter((e=>!!e.name))}(e.get("output"),t)}}(r,o);t.variables.push(o)}(i,t)}function Qm(e){const t={name:e.name};return e.typeRef&&(t.detail=e.typeRef),t}function jm(e,t){const n=e.get("requiredKnowledge");n&&function(e,t){const n=qm(e,t.rootElement);if(!n)return;Fm(n,"dmn:BusinessKnowledgeModel")&&function(e,t){const n=e.get("name");if(!n)return;const i={name:n,origin:e},o=e.get("encapsulatedLogic");o&&function(e,t){const n=e.get("formalParameter"),i=n.map(((e,t)=>{const n={name:e.get("name")||`param ${t+1}`,type:e.get("typeRef")};return n.type||delete n.type,n}));Object.assign(t,{type:"function",params:i})}(o,i);t.variables.push(i)}(n,t)}(n,t)}function Bm(e,t){const n=e.get("name");if(!n)return;const i={name:n,origin:e};e.get("typeRef")&&(i.detail=e.get("typeRef")),t.variables.push(i)}function Nm(e){let t=e;for(;t.$parent;)t=t.$parent;return t}function qm(e,t){const n=e.get("href");if(!n||!n.startsWith("#"))return;const i=n.slice(1);return t.get("drgElement").find((e=>e.get("id")===i))}function Fm(e,t){return e.$instanceOf(t)}qt(Dm,Tl),Dm.prototype._modelingModules=[Il,ic,pc,ru,md,yd,kd,Td,Id,Bd,Gd,ip,sp,fp,qp,vg,Pg,Lg,rm,Om,Mm],Dm.prototype._modules=[].concat(Dm.prototype._modules,Dm.prototype._modelingModules);class Vm{constructor(e){e.registerProvider(this)}getVariables(e,t){return e.concat(function(e){const t={variables:[],rootElement:Nm(e)};for(let n=e;n;n=n.$parent)Lm(n,t);return t.variables}(t))}}Vm.$inject=["variableResolver"];const Xm={__init__:["dmnVariableProvider"],dmnVariableProvider:["type",Vm],variableResolver:["type",class{constructor(){this._providers=[]}registerProvider(e){this._providers.push(e)}getVariables(e){return this._providers.reduce(((t,n)=>n.getVariables(t,e)),[])}}]};class zm{constructor(e){F(this,e),Gm(this,"businessObject",{writable:!0})}}class Ym extends zm{constructor(e){super(e),Gm(this,"root",{writable:!0}),Gm(this,"cells",{enumerable:!0,value:this.cells||[]})}}class Wm extends zm{constructor(e){super(e),Gm(this,"root",{writable:!0}),Gm(this,"cells",{enumerable:!0,value:this.cells||[]})}}class Hm extends zm{constructor(e){super(e),Gm(this,"row",{writable:!0}),Gm(this,"col",{writable:!0})}}const Um={root:class extends zm{constructor(e){super(e),Gm(this,"rows",{enumerable:!0,value:this.rows||[]}),Gm(this,"cols",{enumerable:!0,value:this.cols||[]})}},row:Ym,col:Wm,cell:Hm};function Gm(e,t,n){Object.defineProperty(e,t,n)}let Zm=class{constructor(){this._uid=12}create(e,t={}){return t.id||(t.id=e+"_"+this._uid++),function(e,t){const n=Um[e];if(!n)throw new Error("unknown type "+e);return new n(t)}(e,t)}createRoot(e){return this.create("root",e)}createRow(e){return this.create("row",e)}createCol(e){return this.create("col",e)}createCell(e){return this.create("cell",e)}},Km=class{constructor(e){this._eventBus=e,this._elements={},e.on("table.clear",this.clear.bind(this))}add(e,t){const{id:n}=e;this._elements[n]=e}remove(e){const t=e.id||e;delete this._elements[t]}get(e){return this._elements[e]}getAll(){return Jm(this._elements)}forEach(e){Jm(this._elements).forEach((t=>e(t)))}filter(e){return Jm(this._elements).filter((t=>e(t)))}clear(){this._elements={}}updateId(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)}_validateId(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")}};function Jm(e){return Object.keys(e).map((function(t){return e[t]}))}Km.$inject=["eventBus"];let ev=class{constructor(e){this._listeners={},e.on("elements.changed",(({elements:e})=>{this.elementsChanged(e)})),e.on("root.remove",(t=>{const n=t.root.id;this._listeners[n]&&e.once("root.add",(e=>{const t=e.root.id;this.updateId(n,t)}))})),e.on("element.updateId",(({element:e,newId:t})=>{this.updateId(e.id,t)}))}elementsChanged(e){const t={},n=e.length;for(let i=0;i<n;i++){const{id:n}=e[i];if(t[n])return;t[n]=!0;const o=this._listeners[n]&&this._listeners[n].length;if(o)for(let e=0;e<o;e++)this._listeners[n][e]&&this._listeners[n][e]()}}onElementsChanged(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e][this._listeners[e].length]=t}offElementsChanged(e,t){if(this._listeners[e])if(t){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}else this._listeners[e].length=0}updateId(e,t){this._listeners[e]&&(this._listeners[t]=this._listeners[e],delete this._listeners[e])}};ev.$inject=["eventBus"];class tv extends Bs{constructor(e){super(e);const t=this._injector=e.injector;this._sheet=t.get("sheet"),this._changeSupport=t.get("changeSupport"),this._components=t.get("components"),this._eventBus=t.get("eventBus");const n=t.get("throttle");this.onElementsChanged=this.onElementsChanged.bind(this),this.onScroll=n(this.onScroll.bind(this))}onElementsChanged(){this.forceUpdate()}onScroll(){this._eventBus.fire("sheet.scroll")}getChildContext(){return{changeSupport:this._changeSupport,components:this._components,injector:this._injector}}componentWillMount(){const{id:e}=this._sheet.getRoot();this._changeSupport.onElementsChanged(e,this.onElementsChanged)}componentWillUnmount(){const{id:e}=this._sheet.getRoot();this._changeSupport.offElementsChanged(e,this.onElementsChanged)}render(){const{rows:e,cols:t}=this._sheet.getRoot(),n=this._components.getComponents("table.before"),i=this._components.getComponents("table.after"),o=this._components.getComponent("table.head"),r=this._components.getComponent("table.body"),s=this._components.getComponent("table.foot");return kr(1,"div","tjs-container",[n&&n.map(((e,t)=>Er(2,e,null,t))),kr(1,"div","tjs-table-container",kr(1,"table","tjs-table",[o&&Er(2,o,{rows:e,cols:t}),r&&Er(2,r,{rows:e,cols:t}),s&&Er(2,s,{rows:e,cols:t})],0),2,{onScroll:this.onScroll}),i&&i.map(((e,t)=>Er(2,e,null,t)))],0)}}let nv=class{constructor(e,t,n,i,o){const{container:r}=n;this._container=r,i.on("root.added",(()=>{Ds(Er(2,tv,{injector:o}),r)})),i.on("root.remove",(()=>{Ds(null,r)}))}getContainer(){return this._container}};nv.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var iv={__init__:["changeSupport","components","renderer"],changeSupport:["type",ev],components:["type",class{constructor(){this._listeners={}}getComponent(e,t){const n=this._listeners[e];if(!n)return;let i;for(let e=0;e<n.length&&(i=n[e].callback(t),!i);e++);return i}getComponents(e,t){const n=this._listeners[e],i=[];if(!n)return i;for(let e=0;e<n.length;e++){const o=n[e].callback(t);o&&i.push(o)}return i.length,i}onGetComponent(e,t,n){if(_(t)&&(n=t,t=1e3),!b(t))throw new Error("priority must be a number");const i=this._getListeners(e);let o,r;const s={priority:t,callback:n};for(r=0;o=i[r];r++)if(o.priority<t)return void i.splice(r,0,s);i.push(s)}offGetComponent(e,t){const n=this._getListeners(e);let i,o,r;if(t)for(r=n.length-1;i=n[r];r--)o=i.callback,o===t&&n.splice(r,1);else n.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}],renderer:["type",nv]};class ov{constructor(e,t){this._elementRegistry=e,this._eventBus=t,this._root=null,t.on("table.clear",(()=>{this.setRoot(null)}))}setRoot(e){if(this._root){const e=this._root;this._eventBus.fire("root.remove",{root:e}),this._root=null,this._eventBus.fire("root.removed",{root:e})}e&&this._eventBus.fire("root.add",{root:e}),this._root=e,e&&this._eventBus.fire("root.added",{root:e})}getRoot(){return this._root||this.setRoot({id:"__implicitroot",rows:[],cols:[]}),this._root}addRow(e,t){const n=this.getRoot();if(n.cols.length!=e.cells.length)throw new Error("number of cells is not equal to number of cols");return void 0===t&&(t=n.rows.length),rv(t,n.rows,e),e.root=n,this._elementRegistry.add(e),e.cells.forEach(((i,o)=>{this._elementRegistry.add(i),i.row=e,i.col=n.cols[o],rv(t,n.cols[o].cells,i)})),this._eventBus.fire("row.add",{row:e}),e}removeRow(e){const t=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));const n=t.rows.indexOf(e);-1!==n&&(sv(n,t.rows),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach(((e,i)=>{this._elementRegistry.remove(e),e.col=void 0,sv(n,t.cols[i].cells)})),this._eventBus.fire("row.remove",{row:e}))}addCol(e,t){const n=this.getRoot();if(this._elementRegistry.add(e),n.rows.length!=e.cells.length)throw new Error("number of cells is not equal to number of rows");return void 0===t&&(t=n.cols.length),rv(t,n.cols,e),e.root=n,e.cells.forEach(((i,o)=>{this._elementRegistry.add(i),i.col=e,i.row=n.rows[o],rv(t,n.rows[o].cells,i)})),this._eventBus.fire("col.add",{col:e}),e}removeCol(e){const t=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));const n=t.cols.indexOf(e);-1!==n&&(sv(n,t.cols),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach(((e,i)=>{this._elementRegistry.remove(e),e.row=void 0,sv(n,t.rows[i].cells)})),this._eventBus.fire("col.remove",{col:e}))}resized(){this._eventBus.fire("sheet.resized")}}function rv(e,t,n){return t.splice(e,0,n)}function sv(e,t){return t.splice(e,1)}function av(e=!0){const t="number"==typeof e?e:e?300:0;return t?e=>function(e,t){let n=!1;return function(...i){n||(e(...i),n=!0,setTimeout((()=>{n=!1}),t))}}(e,t):e=>e}ov.$inject=["elementRegistry","eventBus"],av.$inject=["config.throttle"];var lv={__depends__:[iv],__init__:["elementFactory","sheet"],elementFactory:["type",Zm],elementRegistry:["type",Km],eventBus:["type",H],sheet:["type",ov],throttle:["factory",av]};class cv{constructor(e={}){let{injector:t}=e;if(!t){let{modules:n,config:i}=this._init(e);t=function(e,t){const n=[{config:["value",e]},lv].concat(t||[]),i=new gn(n);return i.init(),i}(i,n)}this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("table.init"),this.get("eventBus").fire("diagram.init")}_init(e){let{modules:t,...n}=e;return{modules:t,config:n}}destroy(){const e=this.get("eventBus");e.fire("table.destroy"),e.fire("diagram.destroy")}clear(){const e=this.get("eventBus");e.fire("table.clear"),e.fire("diagram.clear")}}function uv(e){if(!e)return"<null>";const t=e.id?` id="${e.id}"`:"";return`<${e.$type}${t} />`}function hv(e,t){function n(t,n,i){if(t.gfx)throw new Error(`already rendered ${uv(t)}`);return e.element(t,n,i)}function i(e,t,i){k(e,(function(e){n(e,t,i)}))}function o(e,t,i){k(e,(function(e){n(e,t,i)}))}return{handleDecision:function(t){t.id||(t.id="decision");const r=t.decisionLogic;if(!r)throw new Error(`no table for ${uv(t)}`);{if(!r.output)throw new Error(`missing output for ${uv(r)}`);const t=(c=r,e.table(c));r.input&&i(r.input,t,r),i(r.output,t,r),s=r.rule,a=t,l=r,k(s,(function(e){n(e,a,l),o(e.inputEntry,e),o(e.outputEntry,e)}))}var s,a,l,c}}}function dv(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)}const pv=Object.prototype.toString;function fv(e){return new gv(e)}function gv(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function mv(e,t,n){var i=n?e:e.parentNode;return i&&"function"==typeof i.closest&&i.closest(t)||null}gv.prototype.add=function(e){return this.list.add(e),this},gv.prototype.remove=function(e){return"[object RegExp]"==pv.call(e)?this.removeMatching(e):(this.list.remove(e),this)},gv.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},gv.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},gv.prototype.array=function(){return Array.from(this.list)},gv.prototype.has=gv.prototype.contains=function(e){return this.list.contains(e)};var vv,yv,bv,_v={};function xv(){vv=window.addEventListener?"addEventListener":"attachEvent",yv=window.removeEventListener?"removeEventListener":"detachEvent",bv="addEventListener"!==vv?"on":""}var Ov,wv=dv({__proto__:null,bind:_v.bind=function(e,t,n,i){return vv||xv(),e[vv](bv+t,n,i||!1),n},unbind:_v.unbind=function(e,t,n,i){return yv||xv(),e[yv](bv+t,n,i||!1),n},default:_v},[_v]),Cv=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(Ev,i)?Ev[i]:Ev._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},kv=!1;"undefined"!=typeof document&&((Ov=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',kv=!Ov.getElementsByTagName("link").length,Ov=void 0);var Ev={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:kv?[1,"X<div>","</div>"]:[0,"",""]};Ev.td=Ev.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ev.option=Ev.optgroup=[1,'<select multiple="multiple">',"</select>"],Ev.thead=Ev.tbody=Ev.colgroup=Ev.caption=Ev.tfoot=[1,"<table>","</table>"],Ev.polyline=Ev.ellipse=Ev.polygon=Ev.circle=Ev.text=Ev.line=Ev.path=Ev.rect=Ev.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Sv=Cv;function $v(e,t){return e&&"function"==typeof e.matches&&e.matches(t)||!1}function Pv(e,t){return(t=t||document).querySelector(e)}function Tv(e,t){return(t=t||document).querySelectorAll(e)}function Rv(e){e.parentNode&&e.parentNode.removeChild(e)}function Av(e,t){const{elements:n,index:i}=e;return i[t]?e:{elements:[...n,t],index:{...i,[t]:!0}}}function Mv(...e){let t={elements:[],index:{}};return e.forEach((function(e){const n=typeof e;"string"===n&&e.length>0?t=Av(t,e):"object"===n&&null!==e&&Object.keys(e).forEach((function(n){e[n]&&(t=Av(t,n))}))})),function(e,t){return e.elements.join(t)}(t," ")}function Dv(e){return Lv(e.constructor,e)}function Lv(e,t){const n=e.$inject;if(!n)return;const{injector:i}=t.context,o=[...n,function(...e){for(const i in e){const o=n[i],r=e[i];t[o]=r}}];i.invoke(o)}function Iv(e,t){Object.keys(t).forEach((function(n){if("$inject"===n||"__init"===n)return;const i=t[n];"constructor"===n&&i.call(e,e.props,e.context);const o=e[n];if(void 0!==o){if("function"!=typeof o)throw new Error(`failed to mixin <${n}>: cannot combine with non-fn component value`);e[n]=function(e,...t){return function(...n){let i;return t.forEach((function(t){if(i=t.call(e,...n),void 0!==i)return!1})),i}.bind(e)}(e,o,i)}else e[n]=i.bind(e)})),"$inject"in t&&Lv(t,e),"__init"in t&&t.__init.call(e,e.props,e.context)}const Qv={getSelectionClasses(){const{selected:e,selectedSecondary:t,focussed:n}=this.state;return Mv({selected:e,"selected-secondary":t,focussed:n})},selectionChanged(e){this.setState(e)},componentWillUpdate(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!1)},componentDidUpdate(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!0)},componentDidMount(){this.updateSelectionSubscription(!0)},componentWillUnmount(){this.updateSelectionSubscription(!1)},updateSelectionSubscription(e){const{elementId:t}=this.props;t&&t&&this.eventBus[e?"on":"off"](`selection.${t}.changed`,this.selectionChanged)},$inject:["eventBus"]};class jv extends Bs{constructor(e,t){super(e,t),Iv(this,Qv),Dv(this)}getRenderProps(...e){const{className:t,elementId:n,coords:i,...o}=this.props,r={className:Mv(...e,this.getSelectionClasses(),t)};return n&&(r["data-element-id"]=n),i&&(r["data-coords"]=i),{...r,...o}}}class Bv extends jv{constructor(e,t){super(e,t),this.state={}}render(){const{children:e}=this.props;return $r(kr(1,"td",null,e,0,{...this.getRenderProps("cell")}))}}const Nv={slotFill(e,t){const{type:n,context:i,...o}=e,r=this.components.getComponent(n,i)||t;return r?$r(Er(2,r,{...i,...o})):null},slotFills(e){const{type:t,context:n,...i}=e;return this.components.getComponents(t,n).map((e=>$r(Er(2,e,{...n,...i}))))},$inject:["components"]};class qv extends Bs{constructor(e,t){super(e,t),Iv(this,Nv),Dv(this)}componentDidMount(){this.changeSupport.onElementsChanged(this.getRoot(),this.onElementsChanged)}componentWillUnmount(){this.changeSupport.offElementsChanged(this.getRoot(),this.onElementsChanged)}onElementsChanged=()=>{this.forceUpdate()};getRoot(){return this.sheet.getRoot()}render(){const e=(this.getRoot().businessObject.get("annotationsWidth")||400)+"px";return kr(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}})}}function Fv(e){const{row:t}=e,{id:n,description:i}=t.businessObject;return Er(2,Bv,{className:"annotation",elementId:n,children:i||"-"})}function Vv(e){e.onGetComponent("cell",(({cellType:e})=>"after-label-cells"===e?qv:"after-rule-cells"===e?Fv:void 0))}qv.$inject=["changeSupport","sheet","translate"],Vv.$inject=["components"];var Xv={__init__:["annotationsProvider"],annotationsProvider:["type",Vv]};function zv(e,t){return F({id:e.id,type:e.$type,businessObject:e},t)}class Yv{constructor(e,t,n){this._elementFactory=e,this._eventBus=t,this._sheet=n}add(e){let t;if(Dt(e,"dmn:DecisionTable"))t=this._elementFactory.createRoot(zv(e)),this._sheet.setRoot(t);else if(Dt(e,"dmn:InputClause"))t=this._elementFactory.createCol(zv(e)),this._sheet.addCol(t);else if(Dt(e,"dmn:OutputClause"))t=this._elementFactory.createCol(zv(e)),this._sheet.addCol(t);else if(Dt(e,"dmn:DecisionRule")){e.inputEntry||(e.inputEntry=[]),e.outputEntry||(e.outputEntry=[]);const n=[...e.inputEntry,...e.outputEntry].map((e=>this._elementFactory.createCell(zv(e))));t=this._elementFactory.createRow(F(zv(e),{cells:n})),this._sheet.addRow(t)}return this._eventBus.fire("dmnElement.added",{element:t}),t}}Yv.$inject=["elementFactory","eventBus","sheet"];var Wv={__depends__:[{__depends__:[ga],tableImporter:["type",Yv]},iv]};class Hv extends Bs{constructor(e,t){super(e,t),Iv(this,Nv),this._sheet=t.injector.get("sheet"),this._changeSupport=t.changeSupport}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this._sheet.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this._sheet.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}render(){const e=this._sheet.getRoot();if(!Dt(e,"dmn:DMNElement"))return null;const t=Qt(e),n=t.input,i=t.output;return kr(1,"thead",null,kr(1,"tr",null,[kr(1,"th","index-column"),this.slotFills({type:"cell",context:{cellType:"before-label-cells"}}),n&&n.map(((e,t)=>{const i=e.width||"192px";return this.slotFill({type:"cell",context:{cellType:"input-header",input:e,index:t,inputsLength:n.length,width:i},key:e.id},Uv)})),i.map(((e,t)=>this.slotFill({type:"cell",context:{cellType:"output-header",output:e,index:t,outputsLength:i.length},key:e.id},Gv))),this.slotFills({type:"cell",context:{cellType:"after-label-cells"}})],0),2)}}function Uv(e,t){const{input:n,className:i,index:o}=e,{label:r,inputExpression:s,inputValues:a}=n,l=t.injector.get("translate");return kr(1,"th",(i||"")+" input-cell",[kr(1,"div","clause",l(0===o?"When":"And"),0),r?kr(1,"div","input-label",r,0,{title:l("Input label: ")+r}):kr(1,"div","input-expression",s.text,0,{title:l("Input expression: ")+s.text}),kr(1,"div","input-variable",a&&a.text||s.typeRef,0,{title:a&&a.text?l("Input values"):l("Input type")})],0,{"data-col-id":n.id},n.id)}function Gv(e,t){const{output:n,className:i,index:o}=e,{label:r,name:s,outputValues:a,typeRef:l}=n,c=t.injector.get("translate");return kr(1,"th",(i||"")+" output-cell",[kr(1,"div","clause",c(0===o?"Then":"And"),0),r?kr(1,"div","output-label",r,0,{title:c("Output label")}):kr(1,"div","output-name",s,0,{title:c("Output name")}),kr(1,"div","output-variable",a&&a.text||l,0,{title:a&&a.text?c("Output values"):c("Output type")})],0,null,n.id)}function Zv(e){e.onGetComponent("table.head",(()=>Hv))}Zv.$inject=["components"];var Kv={__init__:["decisionTableHeadProvider"],decisionTableHeadProvider:["type",Zv]};let Jv=class extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Dv(this)}render(){const e=this.sheet.getRoot();if(!Dt(e,"dmn:DMNElement"))return null;const{name:t}=e.businessObject.$parent,n=this.components.getComponent("hit-policy")||ey;return kr(1,"div","decision-table-properties",[kr(1,"div","decision-table-name",t,0,{title:this._translate("Decision name: ")+t}),kr(1,"div","decision-table-header-separator"),Er(2,n)],4)}};function ey(){return null}Jv.$inject=["sheet","components"];let ty=class{constructor(e){e.onGetComponent("table.before",500,(()=>Jv))}};ty.$inject=["components"];var ny={__init__:["decisionTableProperties"],decisionTableProperties:["type",ty]};class iy extends Bs{render(){const{row:e,rowIndex:t}=this.props,{components:n}=this.context,i=n.getComponents("cell-inner",{cellType:"rule-index",row:e,rowIndex:t});return kr(1,"td","rule-index",[i&&i.map((n=>Er(2,n,{row:e,rowIndex:t}))),t+1],0,{"data-element-id":e.id,"data-row-id":e.id})}}class oy{constructor(e){e.onGetComponent("cell",(({cellType:e})=>{if("before-rule-cells"===e)return iy}))}}oy.$inject=["components"];var ry={__init__:["decisionRuleIndices"],decisionRuleIndices:["type",oy]};const sy=[{label:"FEEL",value:"feel"}];class ay{constructor(e){this._injector=e;const t=e.get("config.expressionLanguages")||{};this._config={options:sy,defaults:{editor:"feel"}},t.options&&(this._config.options=t.options);const n=this._getLegacyDefaults();F(this._config.defaults,n,t.defaults)}getDefault(e){const{defaults:t}=this._config,n=t[e]||t.editor;return this._getLanguageByValue(n)||this.getAll()[0]}getLabel(e){const t=this._getLanguageByValue(e);return t?t.label:e}getAll(){return this._config.options}_getLegacyDefaults(){const e={},t=this._injector,n=t.get("config.defaultInputExpressionLanguage"),i=t.get("config.defaultOutputExpressionLanguage");return n&&(e.inputCell=n),i&&(e.outputCell=i),e}_getLanguageByValue(e){return w(this.getAll(),(t=>e===t.value))}}ay.$inject=["injector"];var ly={__init__:["expressionLanguages"],expressionLanguages:["type",ay]};class cy{constructor(e){this._feelLanguageContext=e}getConfig(){return this._feelLanguageContext}}cy.$inject=["config.feelLanguageContext"];var uy={__init__:["feelLanguageContext"],feelLanguageContext:["type",cy]};class hy extends Bs{render({rows:e,cols:t}){const{components:n}=this.context;return kr(1,"tbody",null,e.map(((e,i)=>{const o=n.getComponent("row",{rowType:"rule"});return o&&Er(2,o,{row:e,rowIndex:i,cols:t},e.id)})),0)}}class dy extends Bs{constructor(e,t){super(e,t),Iv(this,Nv)}render(){const{row:e,rowIndex:t,cols:n}=this.props,{cells:i}=e;return kr(1,"tr",null,[this.slotFills({type:"cell",context:{cellType:"before-rule-cells",row:e,rowIndex:t}}),i.map(((i,o)=>this.slotFill({type:"cell",context:{cellType:"rule",cell:i,rowIndex:t,colIndex:o},key:i.id,row:e,col:n[o]}))),this.slotFills({type:"cell",context:{cellType:"after-rule-cells",row:e,rowIndex:t}})],0)}}class py extends Bs{render(){const{cell:e,row:t,col:n}=this.props;return Dt(e,"dmn:UnaryTests")?Er(2,Bv,{className:"input-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":n.id,children:e.businessObject.text}):Er(2,Bv,{className:"output-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":n.id,children:e.businessObject.text})}}let fy=class{constructor(e){e.onGetComponent("table.body",(()=>hy)),e.onGetComponent("row",(({rowType:e})=>{if("rule"===e)return dy})),e.onGetComponent("cell",(({cellType:e})=>{if("rule"===e)return py}))}};fy.$inject=["components"];var gy={__depends__:[ly,uy],__init__:["decisionRules"],decisionRules:["type",fy]};const 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"}];class vy extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Dv(this)}getRoot(){return this.sheet.getRoot()}render(){const e=this.getRoot().businessObject,{aggregation:t,hitPolicy:n}=e,i=w(my,(e=>function(e,t){return e.hitPolicy===t.hitPolicy&&e.aggregation===t.aggregation}(e.value,{aggregation:t,hitPolicy:n})));return kr(1,"div","hit-policy header",[kr(1,"label","dms-label",this._translate("Hit policy:"),0),kr(1,"span","hit-policy-value",this._translate(i.label),0)],4,{title:this._translate(i.explanation)})}}function yy(e){e.onGetComponent("hit-policy",(()=>vy))}vy.$inject=["sheet"],yy.$inject=["components"];var by={__init__:["hitPolicyProvider"],hitPolicyProvider:["type",yy]};let _y=class extends Bs{constructor(e,t){super(e,t);const{injector:n}=t;this._translate=n.get("translate"),this._eventBus=n.get("eventBus")}onClick=()=>{this._eventBus.fire("showDrd")};render(){return kr(1,"div","view-drd",kr(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}},xy=class{constructor(e,t,n,i){this._injector=n,this._sheet=i,e.onGetComponent("table.before",(()=>{if(this.canViewDrd())return _y})),t.on("showDrd",(()=>{const e=n.get("_parent",!1),t=Oy(i.getRoot());if(!t)return;const o=e.getView(t);e.open(o)}))}canViewDrd(){const e=this._injector.get("_parent",!1);if(!e)return!1;const t=Oy(this._sheet.getRoot());return!!e.getView(t)}};function Oy(e){const{businessObject:t}=e;if(!t)return;return t.$parent.$parent}xy.$inject=["components","eventBus","injector","sheet"];var wy={__init__:["viewDrd"],viewDrd:["type",xy]};let Cy=class{constructor(e){e.onGetComponent("table.before",(()=>Fs))}};Cy.$inject=["components"];var ky={__init__:["poweredBy"],poweredBy:["type",Cy]};let Ey=class e extends cv{constructor(t={}){const n=e._createContainer();super(F(t,{renderer:{container:n}})),this._container=n}open(e){var t=this;return new Promise(((n,i)=>{var o;try{return t._decision&&t.clear(),t._decision=e,function(e,t,n){const i=e.get("tableImporter"),o=e.get("eventBus"),r=e.get("sheet");e.get("modeling",!1);let s,a=[];o.fire("import.render.start",{decision:t});try{!function(e){new hv({create:(e,t,n,o)=>i.create(e,t,n,o),table:e=>i.add(e),element:(e,t,n)=>i.add(e,t,n),error(e,t){a.push({message:e,context:t})}}).handleDecision(e)}(t)}catch(e){s=e}o.fire("import.render.complete",{error:s,warnings:a}),o.fire("elements.changed",{elements:[r.getRoot()]}),n(s,a)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){o=e}o?(o.warnings=o.warnings||[],i(o)):n({warnings:[]})}))}_init(e){let{modules:t,additionalModules:n,...i}=e,o=t||this.getModules();return{modules:[ky,...o,...n||[],...[{decisionTable:["value",this]}]],config:i}}on(e,t,n,i){return this.get("eventBus").on(e,t,n,i)}off(e,t){this.get("eventBus").off(e,t)}_emit(e,t){return this.get("eventBus").fire(e,t)}attachTo(e){if(!e)throw new Error("parentNode required");this.detach();const t=this._container;e.appendChild(t),this._emit("attach",{})}detach(){const e=this._container;e.parentNode&&(this._emit("detach",{}),Rv(e))}destroy(){super.destroy(),this.detach()}getModules(){return e._getModules()}static _getModules(){return[Xv,Wv,ga,Kv,ny,ry,gy,by,wy]}static _createContainer(){return Sv('<div class="dmn-decision-table-container"></div>')}};class Sy extends Bs{constructor(e,t){super(e,t),Dv(this),this.addRule=this.addRule.bind(this)}componentWillMount(){this._eventBus=this.context.injector.get("eventBus")}handleClick=e=>{e.stopPropagation(),this.addRule(e.target.dataset.colIndex)};addRule(e){this._eventBus.fire("addRule",{colIndex:e})}render(){const{cols:e}=this.props,t=[kr(1,"td","add-rule-add",kr(1,"button","dmn-icon-plus action-icon",null,1,{title:this.translate("Add rule")}),2)],{businessObject:n}=this.sheet.getRoot();n.input&&n.input.length||t.push(kr(1,"td","input-cell",Sr("-"),2));for(let n=0;n<e.length+1;n++){let i="add-rule";const o=e[n]&&e[n].businessObject;let r="";o?(o.$instanceOf("dmn:InputClause")&&(i+=" input-cell",r="-"),o.$instanceOf("dmn:OutputClause")&&(i+=" output-cell")):i+=" annotation",t.push(kr(1,"td",i,r,0,{"data-col-index":n}))}return kr(1,"tfoot","actionable add-rule",kr(1,"tr",null,t,0),2,{onClick:this.handleClick})}}Sy.$inject=["sheet","translate"];class $y{constructor(e,t,n,i){e.onGetComponent("table.foot",(()=>Sy)),n.on("addRule",((e,n)=>{const o=t.trigger("addRule"),r=n.colIndex;o.cells[r]?i.select(o.cells[r]):i.select(o.cells[0])}))}}$y.$inject=["components","editorActions","eventBus","selection"];class Py{constructor(e,t,n){this._elementRegistry=e,this._eventBus=t,this._renderer=n,this._selection=void 0,t.on("diagram.clear",(()=>{this._selection=void 0}))}select(e){x(e)&&(e=this._elementRegistry.get(e));const t=this._selection;t!==e&&(this._selection=e,this._eventBus.fire("selection.changed",{oldSelection:t,selection:e}))}deselect(){const e=this._selection;this._selection=void 0,this._eventBus.fire("selection.changed",{oldSelection:e,selection:this._selection})}get(){return this._selection}hasSelection(){return!!this._selection}}Py.$inject=["elementRegistry","eventBus","renderer"];class Ty{constructor(e,t,n,i){this._elementRegistry=e,this._renderer=n,this._selection=i,t.on(["cell.click","cell.contextmenu"],(({id:t})=>{const n=e.get(t);n&&i.select(n)})),t.on("row.remove",(({row:e})=>{const t=i.get();t&&e===t.row&&i.deselect()})),t.on("col.remove",(({col:e})=>{const t=i.get();t&&e===t.col&&i.deselect()}))}}Ty.$inject=["elementRegistry","eventBus","renderer","selection"];var Ry={__init__:["selection","selectionBehavior"],selection:["type",Py],selectionBehavior:["type",Ty]};function Ay(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)}function My(e,t,n){var i=n?e:e.parentNode;return i&&"function"==typeof i.closest&&i.closest(t)||null}var Dy,Ly,Iy,Qy={};function jy(){Dy=window.addEventListener?"addEventListener":"attachEvent",Ly=window.removeEventListener?"removeEventListener":"detachEvent",Iy="addEventListener"!==Dy?"on":""}var By,Ny=Ay({__proto__:null,bind:Qy.bind=function(e,t,n,i){return Dy||jy(),e[Dy](Iy+t,n,i||!1),n},unbind:Qy.unbind=function(e,t,n,i){return Ly||jy(),e[Ly](Iy+t,n,i||!1),n},default:Qy},[Qy]);"undefined"!=typeof document&&((By=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',By.getElementsByTagName("link").length,By=void 0);const qy=["click","dblclick","contextmenu","mousedown","mouseup","mouseenter","mouseleave","mouseout","mouseover","mousemove","focusin","focusout","drag","dragstart","dragend","dragover","dragenter","dragleave","drop"];class Fy{constructor(e,t){var n,i,o;o=e=>{const{target:t,type:n}=e,i=My(t,"[data-element-id]",!0);if(!i)return;const o=i.getAttribute("data-element-id");if(o){const t=this._eventBus.createEvent({id:o,event:e,node:i,target:i});this._eventBus.fire(`cell.${n}`,t),t.defaultPrevented&&e.preventDefault(),t.cancelBubble&&e.stopPropagation()}},(i="_handleEvent")in(n=this)?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o,this._eventBus=t,this._container=e.container,t.on("table.init",(()=>{this._addEventListeners(qy)})),t.on("table.destroy",(()=>{this._removeEventListeners(qy)}))}_addEventListeners(e){const t=this._container;e.forEach((e=>{t.addEventListener(e,this._handleEvent)}))}_removeEventListeners(e){const t=this._container;e.forEach((e=>{t.removeEventListener(e,this._handleEvent)}))}}Fy.$inject=["config.renderer","eventBus"];var Vy={__init__:["interactionEvents"],interactionEvents:["type",Fy]},Xy="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function zy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yy,Wy={exports:{}},Hy=Wy.exports;
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */var Uy=(Yy||(Yy=1,function(e){var t;t=void 0!==Xy?Xy:Hy,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,o=-1,r="",s=n.charCodeAt(0);++o<i;)0!=(t=n.charCodeAt(o))?r+=t>=1&&t<=31||127==t||0==o&&t>=48&&t<=57||1==o&&t>=48&&t<=57&&45==s?"\\"+t.toString(16)+" ":0==o&&1==i&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(o):n.charAt(o):r+="�";return r};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(t)}(Wy)),Wy.exports),Gy=zy(Uy),Zy=function(e,t){return e^t};var Ky=/\b(Array|Date|Object|Math|JSON)\b/g,Jy=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(Ky,"").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 eb=tb;function tb(e,t){if(!(this instanceof tb))return new tb(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 nb(e,t){var n="nextSibling"==e;return function(i,o,r){i=this.compile(i),o=o&&o>0?o:1;for(var s=this.node,a=this.closingTag,l=this._revisit;s;){if(Zy(n,a)&&s[t])s=s[t],a=!n;else if(1==s.nodeType&&!s[t]&&Zy(n,a)){if(a=n,!l)continue}else if(s[e])s=s[e],a=!n;else if(s=s.parentNode,a=n,!l)continue;if(!s||this.higher(s,this.root))break;if(i(s)&&this.selects(s,r)&&this.rejects(s,r)){if(--o)continue;return r||(this.node=s),this.closingTag=a,s}}return null}}tb.prototype.reset=function(e){return this.node=e||this.start,this},tb.prototype.revisit=function(e){return this._revisit=null==e||e,this},tb.prototype.opening=function(){return 1==this.node.nodeType&&(this.closingTag=!1),this},tb.prototype.atOpening=function(){return!this.closingTag},tb.prototype.closing=function(){return 1==this.node.nodeType&&(this.closingTag=!0),this},tb.prototype.atClosing=function(){return this.closingTag},tb.prototype.next=nb("nextSibling","firstChild"),tb.prototype.previous=tb.prototype.prev=nb("previousSibling","lastChild"),tb.prototype.select=function(e){return e=this.compile(e),this._selects.push(e),this},tb.prototype.selects=function(e,t){var n=this._selects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!0;return!1},tb.prototype.reject=function(e){return e=this.compile(e),this._rejects.push(e),this},tb.prototype.rejects=function(e,t){var n=this._rejects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!1;return!0},tb.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},tb.prototype.compile=function(e){switch(typeof e){case"number":return function(t){return e==t.nodeType};case"string":return new Function("node","return "+Jy(e,"node."));case"function":return e;default:return function(){return!0}}},tb.prototype.peak=tb.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},tb.prototype.use=function(e){return e(this),this};var ib=window.getSelection();function ob(e){ib.removeAllRanges(),ib.addRange(e)}function rb(e,t){var n=function(e,t){var n,i=t.start,o=t.end,r=document.createRange(),s=eb(e.firstChild,e),a=s.node,l=!1,c=0;for(;a;){if(c===i&&(l?r.setStartAfter(a):r.setStartBefore(a)),c===o)return l?r.setEndAfter(a):r.setEndBefore(a),r;if(l||(lb(a)||a.previousSibling&&(cb(a)||ub(a)))&&c++,ab(a)){if(n=a.textContent.length,c<=i&&c+n>i&&r.setStart(a,i-c),c+n>o)return r.setEnd(a,o-c),r;c+=n}a=s.next(),l=s.closingTag}c<=i&&(e.lastChild?r.setStartAfter(e.lastChild):r.setStart(e,0));e.lastChild?r.setEndAfter(e.lastChild):r.setEnd(e,0);return r}(e,t);ob(n)}function sb(e){if(!function(e){if(!ib.rangeCount)return null;var t=ib.focusNode;return ab(t)&&(t=t.parentNode),e==t||e.contains(t)}(e))return null;var t,n,i=ib.getRangeAt(0),o=i.startContainer,r=i.endContainer,s=i.startOffset,a=i.endOffset,l=eb(e.firstChild,e),c=l.node,u=!1,h=0;function d(e,t){return 1===arguments.length&&(t=e),e.parentNode===r&&t==r.childNodes[a]}function p(e,t){return 1===arguments.length&&(t=e),e.parentNode===o&&t==o.childNodes[s]}for(;c&&(p(c)&&(n=h),!d(c));){if(u||(lb(c)||t&&t.nextSibling==c&&(cb(c)||ub(c)))&&h++,ab(c)){if(o===c&&(n=h+s),r===c){h+=a;break}h+=c.textContent.length}if((ab(c)||u)&&(p(c,c.nextSibling)&&(n=h),d(c,c.nextSibling)))break;t=c,c=l.next(),u=l.closingTag}return{start:void 0===n?h:n,end:h}}function ab(e){return 3===e.nodeType}function lb(e){return 1===e.nodeType&&"BR"===e.nodeName}function cb(e){return 1===e.nodeType&&"DIV"===e.nodeName}function ub(e){return 1===e.nodeType&&"P"===e.nodeName}function hb(e){return e.getAttribute("data-element-id")}function db(e,t){return Pv(`[data-element-id="${Gy(e)}"]`,t)}function pb(e){return mv(e,"[data-element-id]",!0)}function fb(e){const t="[contenteditable]";return $v(e,t)?e:Pv(t,e)}const gb={above:!0,below:!0,right:!0,left:!0};function mb(e,t,n,i,o){const{container:r}=e;let s=null;function a(e,n){t.fire("selection."+e+".changed",n),t.fire("cellSelection.changed",{elementId:e,selection:n})}function l(e,t=!0){s!==e&&a(s,{selected:!1,focussed:!1}),s=e,e&&a(e,{selected:!0,focussed:t}),e?i.select(e):i.deselect()}t.on("cell.click",500,(function(e){const t=e.target;if(function(e){return mv(e,".no-deselect",!0)}(t))return;const n=pb(t);l(n&&hb(n),!e.defaultPrevented)})),t.on("cell.focusin",500,(function(e){const t=hb(e.target),n=!e.defaultPrevented;return e.stopPropagation(),l(t,n)})),t.on("cell.focusout",500,(function(e){a(hb(e.target),{focussed:!1})})),t.on("cellSelection.changed",(function(e){const{elementId:t,selection:n}=e,i=db(t,r);n.focussed&&i&&function(e){const t=fb(e);if(!t)return;if(!document.body.contains(t))return;if(document.activeElement===t)return;t.focus();const n=sb(t);n&&0!==n.end||window.getSelection().setPosition(t.firstChild,t.firstChild.length)}(i)})),t.on("selection.changed",(function(e){const{selection:t,oldSelection:n}=e;var i=t&&t.id,o=n&&n.id;i&&i!==s?l(t.id):o&&o===s&&l()})),this.isCellSelected=function(){return!!s},this.getCellSelection=function(){return s},this.selectCell=function(e){if(!s)return;if(!(e in gb))throw new Error("direction must be any of { above, below, left, right }");const t=function(e){const t=e.getAttribute("data-coords");if(!t)return null;const[n,i]=t.split(":");return{row:n,col:i}}(db(s,r));if(!t)return!1;const n=function(e,t){const{row:n,col:i}=e;if("above"===t||"below"===t){const o=parseInt(n,10);if(isNaN(o))return e;return{col:i,row:"above"===t?o-1:o+1}}if("left"===t||"right"===t){const o=parseInt(i,10);if(isNaN(o))return e;return{row:n,col:"left"===t?o-1:o+1}}throw new Error("invalid direction <"+t+">")}(t,e),i=function(e,t){const n=`${e.row}:${e.col}`;return Pv(`[data-coords="${Gy(n)}"]`,t)}(n,r);if(!i)return!1;const o=hb(i);return o&&l(o,{focussed:!0,selected:!0}),!0},t.on("contextMenu.close",(function(){if(s)return l(s)}))}mb.$inject=["config.renderer","eventBus","sheet","selection","elementRegistry"];var vb={__depends__:[Vy,Ry],__init__:["cellSelection"],cellSelection:["type",mb]};function yb(){}yb.prototype.get=function(){return this._data},yb.prototype.set=function(e){this._data=e},yb.prototype.clear=function(){var e=this._data;return delete this._data,e},yb.prototype.isEmpty=function(){return!this._data};var bb={clipboard:["type",yb]};const _b=2e3;class xb extends Zp{constructor(e,t){super(e),this._sheet=t}init(){this.addRule("col.move",_b,(({col:e,index:t})=>{const{businessObject:n}=this._sheet.getRoot(),{input:i}=n;return Lt(e)?t<i.length:t>=i.length})),this.addRule("col.remove",_b,(({col:e})=>{const{cols:t}=this._sheet.getRoot();return!It(e)||t.filter((e=>It(e))).length>1})),this.addRule("paste",_b,(({data:e,target:t})=>{if(!e||!t)return!1;const{root:n}=e;return t instanceof Ym?this.canPasteRows(n):t instanceof Wm&&this.canPasteCols(n,t)}))}canPasteRows(e){const{cols:t}=this._sheet.getRoot();return S(e,(e=>"row"===e.type&&(e.cells.length===t.length&&S(e.cells,((e,n)=>Lt(t[n])?"dmn:UnaryTests"===e.businessObject.$type:"dmn:LiteralExpression"===e.businessObject.$type)))))}canPasteCols(e,t){const{rows:n}=this._sheet.getRoot();return S(e,(e=>"col"===e.type&&(e.cells.length===n.length&&(Lt(t)?"dmn:InputClause"===e.businessObject.$type:"dmn:OutputClause"===e.businessObject.$type))))}}xb.$inject=["eventBus","sheet"];var Ob={__depends__:[{__depends__:[gc]}],__init__:["decisionTableModelingRules"],decisionTableModelingRules:["type",xb]};class wb{constructor(e,t,n){this._clipboard=e,this._modeling=t,this._sheet=n}execute(e){let{data:t}=e;return e.oldData=this._clipboard.get(),this._clipboard.set(t),this._sheet.getRoot()}postExecute(e){let{elements:t}=e;t.forEach((e=>{e instanceof Ym?this._modeling.removeRow(e):e instanceof Wm&&this._modeling.removeCol(e)}))}revert(e){const{oldData:t}=e;return this._clipboard.set(t),this._sheet.getRoot()}}wb.$inject=["clipboard","modeling","sheet"];const Cb=[function(e,t,n,i){var o=n,r={...t,type:$b(e)};if(e instanceof Ym||e instanceof Wm){let t=i(e.cells,o);r.cells=t.root,o=t.descriptorCache}return{root:r,descriptorCache:o}},function(e,t,n){var i=e.businessObject;if(!i)return{root:t,descriptorCache:n};var o=Pb(i,n);return{root:{...t,businessObject:o.root},descriptorCache:o.descriptorCache}}],kb=[function(e,t,n){var i=e.root.businessObject;if(!i)return{root:t,reviveCache:n};var o=Ab({root:i,descriptorCache:e.descriptorCache},n);return{root:{...t,businessObject:o.root},reviveCache:o.reviveCache}},function(e,t,n,i){var o=e.root,r=e.descriptorCache,s={...t};t.businessObject&&t.businessObject.id&&(s.id=t.businessObject.id);if("row"===o.type||"col"===o.type){let e=i({root:o.cells,descriptorCache:r},n);s.cells=e.root,n=e.reviveCache}var a=new(function(e){switch(e.type){case"row":return Ym;case"cell":return Hm;case"col":return Wm;default:throw new Error("unknown element type: #"+e.type)}}(o))(s);a instanceof Ym?a.cells.forEach((e=>{e.row=a})):a instanceof Wm&&a.cells.forEach((e=>{e.col=a}));return{root:a,reviveCache:n}}];function Eb(e,t,n){return n=n||Cb,t=t||{},v(e)?function(e,t,n){return E(e,((e,t)=>{var i=e.descriptorCache,o=e.root;let{root:r,descriptorCache:s}=Sb(t,i,n);return{root:[...o,r],descriptorCache:{...i,...s}}}),{root:[],descriptorCache:t})}(e,t,n):Sb(e,t,n)}function Sb(e,t,n){var i=e.id,o={id:i},r=t.elements||{},s=r[i];if(s)return{root:s,descriptorCache:t};let a=function(e,t,n,i){function o(e,t){return Eb(e,t,n)}return E(n,(function(t,n){return n(e,t.root,t.descriptorCache,o)}),{root:t,descriptorCache:i})}(e,o,n,{...t,elements:r});return{root:a.root,descriptorCache:{...a.descriptorCache,elements:{...a.descriptorCache.elements,[i]:a.root}}}}function $b(e){if(e instanceof Ym)return"row";if(e instanceof Wm)return"col";if(e instanceof Hm)return"cell";throw new Error("cannot deduce element type: #"+e.id)}function Pb(e,t){var n,i,o=e.id;if(o&&(i=(n=t.boCache||{})[o]))return{root:i,descriptorCache:t};var r={$type:e.$type};return o&&(r.id=o,n={...n,[o]:r},t={...t,boCache:n}),e.$descriptor.properties.forEach((function(n){var i=e[n.name];if(i){if(v(i)&&(i=i.map((e=>{var n=Pb(e,t);return t=n.descriptorCache,n.root}))),i.$type){let e=Pb(i,t);t=e.descriptorCache,i=e.root}r[n.name]=i}})),{root:r,descriptorCache:t}}function Tb(e,t,n){return n=n||kb,t=t||{},v(e.root)?function(e,t,n){let i=e.root,o=e.descriptorCache;return E(i,((e,t)=>{var i=e.reviveCache,r=e.root;let{root:s,reviveCache:a}=Rb({root:t,descriptorCache:o},i,n);return{root:[...r,s],reviveCache:a}}),{root:[],reviveCache:t})}(e,t,n):Rb(e,t,n)}function Rb(e,t,n){var i=e.root.id,o=t.elements||{},r=o[i];if(r)return{root:r,reviveCache:t};let s=function(e,t,n,i){function o(e,t){return Tb(e,t,n)}return E(n,(function(t,n){return n(e,t.root,t.reviveCache,o)}),{root:t,reviveCache:i})}(e,{id:i},n,{...t,elements:o});return{root:s.root,reviveCache:{...s.reviveCache,elements:{...s.reviveCache.elements,[i]:s.root}}}}function Ab(e,t){var n=e.root,i=n.id;let o,r;if(i&&(o=t.boCache||{},r=o[i],r))return{root:r,reviveCache:t};var s={};T(n).forEach((e=>{let i,r;n[e].$type?(r=Ab({root:n[e]},t),i=r.root,t=r.reviveCache,o=t.boCache||{}):i=v(n[e])?n[e].map((e=>(r=Ab({root:e},t),t=r.reviveCache,o=t.boCache||{},r.root))):n[e],s[e]=i}));const a=s.$type;delete s.$type,t._keepIds&&!t._model.ids.assigned(s.id)||delete s.id;var l=t._dmnFactory.create(a,s);return k(s,(e=>{e.$type&&(e.$parent=l),v(e)&&e.forEach((e=>e.$parent=l))})),i&&(o={...o,[i]:l},t={...t,boCache:o}),{root:l,reviveCache:t}}class Mb{constructor(e,t,n,i,o,r,s,a){this._clipboard=e,this._dmnFactory=t,this._elementFactory=n,this._elementRegistry=i,this._eventBus=o,this._model=r,this._modeling=s,this._sheet=a}postExecute(e){let{element:t,after:n}=e;const i=this._clipboard.get();if(!i)throw new Error("missing clipboard data");const o=this._sheet.getRoot(),r=Tb(i.elements,{_dmnFactory:this._dmnFactory,_keepIds:i.keepIds,_model:this._model}).root;if(t instanceof Ym){let e=o.rows.indexOf(t);if(-1===e)return;r.forEach((t=>{n&&e++,this._modeling.addRow(t,e)}))}else if(t instanceof Wm){let e=o.cols.indexOf(t);if(-1===e)return;r.forEach((t=>{n&&e++,this._modeling.addCol(t,e)}))}return e.oldElements=this._clipboard.get(),this._sheet.getRoot()}revert(e){}}Mb.$inject=["clipboard","dmnFactory","elementFactory","elementRegistry","eventBus","moddle","modeling","sheet"];class Db{constructor(e,t,n,i,o,r){this._clipboard=e,this._commandStack=t,this._eventBus=n,this._modeling=i,this._sheet=o,this._rules=r,t.registerHandler("cut",wb),t.registerHandler("paste",Mb)}copy(e){v(e)||(e=[e]);const t={elements:Eb(e)};this._eventBus.fire("copyCutPaste.copy",{data:t}),this._clipboard.set(t)}cut(e){v(e)||(e=[e]);const t={elements:Eb(e),keepIds:!0},n={elements:e,data:t};this._eventBus.fire("copyCutPaste.cut",{data:t}),this._commandStack.execute("cut",n)}pasteBefore(e){return this._paste(e,{before:!0})}pasteAfter(e){return this._paste(e,{after:!0})}_paste(e,t){const n=this._clipboard.get();if(!n)return;return!!this._rules.allowed("paste",{data:n.elements,target:e})&&(this._commandStack.execute("paste",{element:e,...t}),this._clipboard.clear(),!0)}pasteAt(e){}}Db.$inject=["clipboard","commandStack","eventBus","modeling","sheet","rules"];var Lb={__depends__:[bb,Ob],__init__:["copyCutPaste"],copyCutPaste:["type",Db]};class Ib{constructor(e,t,n,i,o,r){const s={addRule:()=>n.addRow({type:"dmn:DecisionRule"}),addRuleAbove(e){let t=e&&e.rule;if(!t&&!i.hasSelection())return;t=t||i.get().row;const o=r.getRoot().rows.indexOf(t);return-1!==o?n.addRow({type:"dmn:DecisionRule"},o):void 0},addRuleBelow(e){let t=e&&e.rule;if(!t&&!i.hasSelection())return;t=t||i.get().row;const o=r.getRoot().rows.indexOf(t);return-1!==o?n.addRow({type:"dmn:DecisionRule"},o+1):void 0},removeRule(e){let t=e&&e.rule;(t||i.hasSelection())&&(t=t||i.get().row,n.removeRow(t))},addInput(){const e=r.getRoot().businessObject,{input:t}=e;return n.addCol({type:"dmn:InputClause"},t?t.length:0)},addInputLeft(e){let t=e&&e.input;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:InputClause"},o):void 0},addInputRight(e){let t=e&&e.input;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:InputClause"},o+1):void 0},removeInput(e){let t=e&&e.input;(t||i.hasSelection())&&(t=t||i.get().col,n.removeCol(t))},addOutput(){const e=r.getRoot().businessObject,t=e.get("input"),i=e.get("output");return n.addCol({type:"dmn:OutputClause"},t.length+i.length)},addOutputLeft(e){let t=e&&e.output;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:OutputClause"},o):void 0},addOutputRight(e){let t=e&&e.output;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:OutputClause"},o+1):void 0},removeOutput(e){let t=e&&e.output;(t||i.hasSelection())&&(t=t||i.get().col,n.removeCol(t))},addClause(){if(!i.hasSelection())return;const e=i.get().col;return Dt(e,"dmn:InputClause")?s.addInput({input:e}):Dt(e,"dmn:OutputClause")?s.addOutput({output:e}):void 0},addClauseLeft(){if(!i.hasSelection())return;const e=i.get().col;return Dt(e,"dmn:InputClause")?s.addInputLeft({input:e}):Dt(e,"dmn:OutputClause")?s.addOutputLeft({output:e}):void 0},addClauseRight(){if(!i.hasSelection())return;const e=i.get().col;return Dt(e,"dmn:InputClause")?s.addInputRight({input:e}):Dt(e,"dmn:OutputClause")?s.addOutputRight({output:e}):void 0},removeClause(){if(!i.hasSelection())return;const e=i.get().col;return Dt(e,"dmn:InputClause")?s.removeInput({input:e}):Dt(e,"dmn:OutputClause")?s.removeOutput({output:e}):void 0},selectCellAbove:()=>o.selectCell("above"),selectCellBelow:()=>o.selectCell("below"),copy({element:t}){e.copy(t)},cut({element:t}){e.cut(t)},pasteBefore:({element:t})=>e.pasteBefore(t),pasteAfter:({element:t})=>e.pasteAfter(t)};t.register(s)}}Ib.$inject=["copyCutPaste","editorActions","modeling","selection","cellSelection","sheet"];const Qb="is not a registered action";let jb=class{constructor(e,t,n,i){this._actions={undo(){e.undo()},redo(){e.redo()},select({cell:e}){i.select(e)},deselect(){i.deselect()},addRow({attrs:e,index:t}){n.addRow(e,t)},removeRow({row:e}){n.removeRow(e)},moveRow({row:e,index:t}){n.moveRow(e,t)},addCol({attrs:e,index:t}){n.addCol(e,t)},removeCol({col:e}){n.removeCol(e)},moveCol({col:e,index:t}){n.moveCol(e,t)}}}trigger(e,t){if(!this._actions[e])throw Bb(e,Qb);return this._actions[e](t)}register(e,t){if("string"==typeof e)return this._registerAction(e,t);k(e,((e,t)=>{this._registerAction(t,e)}))}_registerAction(e,t){if(this.isRegistered(e))throw Bb(e,"is already registered");this._actions[e]=t}unregister(e){if(!this.isRegistered(e))throw Bb(e,Qb);this._actions[e]=void 0}isRegistered(e){return!!this._actions[e]}};function Bb(e,t){return new Error(e+" "+t)}jb.$inject=["commandStack","eventBus","modeling","selection"];var Nb,qb,Fb={__depends__:[Ry],__init__:["editorActions"],editorActions:["type",jb]},Vb={__depends__:[vb,Lb,Fb,Ry],__init__:["decisionTableEditorActions"],decisionTableEditorActions:["type",Ib]},Xb={__depends__:[Vb],__init__:["addRule"],addRule:["type",$y]};var zb,Yb=function(){if(qb)return Nb;qb=1;var e=/["'&<>]/;return Nb=function(t){var n,i=""+t,o=e.exec(i);if(!o)return i;var r="",s=0,a=0;for(s=o.index;s<i.length;s++){switch(i.charCodeAt(s)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}a!==s&&(r+=i.substring(a,s)),a=s+1,r+=n}return a!==s?r+i.substring(a,s):r},Nb}(),Wb=zy(Yb),Hb={exports:{}};var Ub=function(){if(zb)return Hb.exports;function e(e,t){return{start:e,end:void 0===t?e:t}}return zb=1,Hb.exports=function(t,n,i){var o=t.start,r=o,s=(i.length,n.length);i.length,n.length;var a=n.substring(o);return i.lastIndexOf(a)===i.length-a.length&&(n=n.substring(0,n.length-a.length),i=i.substring(0,i.length-a.length)),s=function(e,t){var n,i,o,r=0,s=0;t.length>e.length?(i=t,o=e):(i=e,o=t);for(;r<i.length;)i.charAt(r)!==o.charAt(s)?(n||(n={l_start:r,s_start:s}),r++):(n&&!n.complete&&(n.l_end=r,n.s_end=s,n.complete=!0),s++,r++);n&&!n.complete&&(n.complete=!0,n.s_end=o.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"}}(n,i),s&&(r="remove"===s.type?s.newStart:s.newEnd),e(r)},Hb.exports.range=e,Hb.exports}(),Gb=zy(Ub);class Zb extends Bs{constructor(e,t){var n;super(e,t),this.state={},((n=window.navigator.userAgent).indexOf("MSIE ")>0||n.indexOf("Trident/")>0)&&(this.onInputIEPolyfill=e=>{var t=this.node.innerHTML;setTimeout((()=>{var n=this.node.innerHTML;t!==n&&this.onInput(e)}),0)})}componentWillUpdate(e,t){var n=this.node,i=t.focussed&&sb(n);this.selected=i&&{range:i,text:Kb(n)}}componentDidUpdate(){var e=this.selected;if(!e)return;const t=e.range,n=e.text,i=this.node,o=Kb(i);rb(i,o!==n?Gb(t,n,o):t)}onFocus=e=>{var t=this.props.onFocus;this.setState({focussed:!0}),"function"==typeof t&&t(e)};onBlur=e=>{const{onBlur:t,onChange:n,value:i}=this.props;if(this.setState({focussed:!1}),"function"==typeof n&&this.node){const e=Kb(this.node);e!==i&&n(e)}"function"==typeof t&&t(e)};onkeydown=e=>{if(13===e.which){if(e.preventDefault(),this.props.ctrlForNewline&&!function(e){return e.metaKey||e.ctrlKey}(e))return;if(this.props.singleLine)return;e.stopPropagation(),function(){var e=ib,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),ob(n)}(),this.onInput(e)}};onInput=e=>{var t=this.props.onInput;"function"==typeof t&&t(Kb(this.node))};onkeypress=e=>{this.onInputIEPolyfill&&this.onInputIEPolyfill(e)};onPaste=e=>{if(this.onInputIEPolyfill&&this.onInputIEPolyfill(e),this.props.singleLine){const t=(e.clipboardData||window.clipboardData).getData("text");document.execCommand("insertText",!1,t.replace(/\n/g," ")),e.preventDefault()}};getClassName(){const{className:e,placeholder:t,value:n}=this.props;return[e||"","content-editable",!n&&t?"placeholder":""].join(" ")}render(e){var{label:t,value:n,placeholder:i}=e;return n=Wb(n).replace(/\r?\n/g,"<br/>")+"<br/>",kr(1,"div",this.getClassName(),null,1,{"aria-label":t,role:"textbox","aria-multiline":!this.props.singleLine,tabIndex:"0",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,(e=>this.node=e))}}function Kb(e){return e.innerText.replace(/\n$/,"")}class Jb extends Bs{constructor(e,t){super(e,t),this.state={changing:!1,focussed:!1};const{injector:n}=t,i=n.get("debounceInput");this.inputChanged=i((e=>{const{onChange:t}=this.props;"function"==typeof t&&t(e);const n=this.state.changing;this.setState({changing:n!==e&&n})})),this.onInput=e=>{var t=(this.props.validate||function(){})(e);this.setState({changing:e,invalid:t}),t||this.inputChanged(e)}}onFocus=e=>{this.setState({focussed:!0});var{onFocus:t}=this.props;"function"==typeof t&&t(e)};onBlur=e=>{this.setState({focussed:!1});const{invalid:t}=this.state;t&&this.setState({changing:!1,invalid:!1});const{onBlur:n}=this.props;"function"==typeof n&&n(e)};getClassName(){var{className:e,value:t}=this.props,{changing:n,focussed:i,invalid:o}=this.state;return e+=" editable",i&&(e+=" focussed"),o&&(e+=" invalid"),t||n||(e+=" empty"),e}getDisplayValue(){var{value:e,placeholder:t}=this.props,{focussed:n,changing:i}=this.state;return"string"==typeof i&&(e=i),e||(e=n?"":t||""),e}getEditor(e={}){return Er(2,Zb,{className:e.className,ctrlForNewline:this.props.ctrlForNewline,label:this.props.label,onFocus:this.onFocus,onBlur:this.onBlur,onInput:this.onInput,value:this.getDisplayValue()})}}class e_ extends Bs{constructor(e,t){super(e,t),Dv(this)}componentWillMount(){const{row:e}=this.props;this.changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const{row:e}=this.props;this.changeSupport.offElementsChanged(e.id,this.onElementsChanged)}onElementsChanged=()=>{this.forceUpdate()};setAnnotationValue=e=>{const{row:t}=this.props;this.modeling.editAnnotation(t.businessObject,e)};render(){const{row:e,rowIndex:t}=this.props,{description:n,id:i}=e.businessObject;return Er(2,Bv,{className:"annotation",onChange:this.setAnnotationValue,coords:`${t}:annotation`,value:n,elementId:i,"data-row-id":e.id,children:Er(2,t_,{label:this.translate("Annotation"),ctrlForNewline:!0,className:"annotation-editor",onChange:this.setAnnotationValue,value:n})})}}e_.$inject=["changeSupport","modeling","translate"];class t_ extends Jb{render(){return kr(1,"div",this.getClassName(),this.getEditor(),0)}}function n_(e){e.onGetComponent("cell",(({cellType:e})=>"after-label-cells"===e?qv:"after-rule-cells"===e?e_:void 0))}n_.$inject=["components"];function i_(e){return function(t){return!1!==e?N(t,b(e)?e:300):t}}i_.$inject=["config.debounceInput"];var o_,r_,s_,a_,l_,c_,u_={debounceInput:["factory",i_]},h_={__depends__:[u_],__init__:["annotationsProvider"],annotationsProvider:["type",n_]};function d_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function p_(){if(a_)return s_;a_=1;var e=/\b(Array|Date|Object|Math|JSON)\b/g;return s_=function(t,n){var i=function(e){for(var t=[],n=0;n<e.length;n++)~t.indexOf(e[n])||t.push(e[n]);return t}(function(t){return t.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(e,"").match(/[a-zA-Z_]\w*/g)||[]}(t));return n&&"string"==typeof n&&(n=function(e){return function(t){return e+t}}(n)),n?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}))}(t,i,n):i},s_}var f_=function(){if(c_)return l_;c_=1;var e=(r_||(r_=1,o_=function(e,t){return e^t}),o_),t=p_();function n(e,t){if(!(this instanceof n))return new n(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 i(t,n){var i="nextSibling"==t;return function(o,r,s){o=this.compile(o),r=r&&r>0?r:1;for(var a=this.node,l=this.closingTag,c=this._revisit;a;){if(e(i,l)&&a[n])a=a[n],l=!i;else if(1==a.nodeType&&!a[n]&&e(i,l)){if(l=i,!c)continue}else if(a[t])a=a[t],l=!i;else if(a=a.parentNode,l=i,!c)continue;if(!a||this.higher(a,this.root))break;if(o(a)&&this.selects(a,s)&&this.rejects(a,s)){if(--r)continue;return s||(this.node=a),this.closingTag=l,a}}return null}}return l_=n,n.prototype.reset=function(e){return this.node=e||this.start,this},n.prototype.revisit=function(e){return this._revisit=null==e||e,this},n.prototype.opening=function(){return 1==this.node.nodeType&&(this.closingTag=!1),this},n.prototype.atOpening=function(){return!this.closingTag},n.prototype.closing=function(){return 1==this.node.nodeType&&(this.closingTag=!0),this},n.prototype.atClosing=function(){return this.closingTag},n.prototype.next=i("nextSibling","firstChild"),n.prototype.previous=n.prototype.prev=i("previousSibling","lastChild"),n.prototype.select=function(e){return e=this.compile(e),this._selects.push(e),this},n.prototype.selects=function(e,t){var n=this._selects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!0;return!1},n.prototype.reject=function(e){return e=this.compile(e),this._rejects.push(e),this},n.prototype.rejects=function(e,t){var n=this._rejects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!1;return!0},n.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},n.prototype.compile=function(e){switch(typeof e){case"number":return function(t){return e==t.nodeType};case"string":return new Function("node","Object.freeze(node); return "+t(e,"node."));case"function":return e;default:return function(){return!0}}},n.prototype.peak=n.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},n.prototype.use=function(e){return e(this),this},l_}(),g_=d_(f_),m_=window.getSelection();function v_(e,t){var n=function(e,t){var n,i=t.start,o=t.end,r=document.createRange(),s=g_(e.firstChild,e),a=s.node,l=!1,c=0;for(;a;){if(c===i&&(l?r.setStartAfter(a):r.setStartBefore(a)),c===o)return l?r.setEndAfter(a):r.setEndBefore(a),r;if(l||(b_(a)||a.previousSibling&&(__(a)||x_(a)))&&c++,y_(a)){if(n=a.textContent.length,c<=i&&c+n>i&&r.setStart(a,i-c),c+n>o)return r.setEnd(a,o-c),r;c+=n}a=s.next(),l=s.closingTag}c<=i&&(e.lastChild?r.setStartAfter(e.lastChild):r.setStart(e,0));e.lastChild?r.setEndAfter(e.lastChild):r.setEnd(e,0);return r}(e,t);!function(e){m_?.removeAllRanges(),m_?.addRange(e)}(n)}function y_(e){return 3===e.nodeType}function b_(e){return 1===e.nodeType&&"BR"===e.nodeName}function __(e){return 1===e.nodeType&&"DIV"===e.nodeName}function x_(e){return 1===e.nodeType&&"P"===e.nodeName}function O_(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const w_={position:"absolute"};class C_ extends Bs{constructor(e,t){super(e,t),O_(this,"open",(({position:e,context:t})=>{this.close(),this.setState({isOpen:!0,position:e||{x:0,y:0},context:t||{}})})),O_(this,"close",(()=>{this.state.isOpen&&this.setState({context:void 0,isOpen:!1,position:{x:0,y:0}})})),O_(this,"triggerClose",(()=>{this.eventBus.fire("contextMenu.close")})),this.state={isOpen:!1,position:{x:0,y:0}},Dv(this)}componentDidMount(){this.eventBus.on("contextMenu.open",this.open),this.eventBus.on("contextMenu.close",this.close)}componentWillUnmount(){this.eventBus.off("contextMenu.open",this.open),this.eventBus.off("contextMenu.close",this.close)}render(){const{isOpen:e,context:t,position:n}=this.state;if(!e)return null;const i=this.components.getComponents("context-menu",t);return i.length?Er(2,k_,{className:"context-menu no-deselect",context:t,position:n,offset:t.offset||{x:0,y:0},autoFocus:!1!==t.autoFocus,autoClose:!1!==t.autoClose,components:i,onClose:this.triggerClose}):null}}C_.$inject=["eventBus","components"];let k_=class extends Bs{constructor(e,t){super(e,t),O_(this,"onGlobalMouseDown",(e=>{this.checkClose(e.target)})),O_(this,"onGlobalKey",(e=>{var t=e.which;13!==t&&27!==t||(e.stopPropagation(),e.preventDefault(),this.close())})),O_(this,"onFocusChanged",(e=>{this.checkClose(e.target)})),O_(this,"setNode",(e=>{this.node=e;const{autoFocus:t}=this.props;var n;e&&(this.updatePosition(),t&&(n=function(e,t){return(t=t||document).querySelector(e)}(S_,e))&&(n.focus(),n.selectionStart&&"text"===n.type?n.selectionStart=1e5:"contentEditable"in n&&v_(n,{start:1e5,end:1e5})))})),Dv(this)}close(){const{onClose:e}=this.props;_(e)&&e()}checkClose(e){const{autoClose:t}=this.props;if(t){var n=this.node;n&&n!==e&&(n.contains(e)||this.close())}}componentDidMount(){document.addEventListener("focusin",this.onFocusChanged),document.addEventListener("keydown",this.onGlobalKey),document.addEventListener("mousedown",this.onGlobalMouseDown)}componentWillUnmount(){document.removeEventListener("focusin",this.onFocusChanged),document.removeEventListener("keydown",this.onGlobalKey),document.removeEventListener("mousedown",this.onGlobalMouseDown)}updatePosition(){const{position:e,offset:t}=this.props,{node:n}=this,i=n.getBoundingClientRect();e.width||(e.width=0),e.height||(e.height=0);const 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"));const{scrollLeft:r,scrollTop:s}=function(e){const t=My(e,".tjs-container");if(!t)return{scrollTop:0,scrollLeft:0};const{scrollLeft:n,scrollTop:i}=t;return{scrollTop:i,scrollLeft:n}}(n),a={};let l,c,u;e.align&&(l=e.align.split("-"));"left"===(l&&l[1]||(e.x+e.width/2>o.width/2?"left":"right"))?(c=e.x-o.left-i.width+t.x+r,n.classList.remove("right"),n.classList.add("left")):(c=-o.left+e.x+e.width-t.x+r,n.classList.remove("left"),n.classList.add("right")),c=l?c:E_(c,0+r,o.width-i.width+r),a.left=c+"px";"top"===(l&&l[0]||(e.y+e.height/2>o.height/2?"top":"bottom"))?(u=e.y-o.top-i.height+t.y+s,n.classList.remove("bottom"),n.classList.add("top")):(u=-o.top+e.y-t.y+s,n.classList.remove("top"),n.classList.add("bottom")),u=l?u:E_(u,0+s,o.height-i.height+s),a.top=u+"px",a.overflowY="auto",a.maxHeight=o.height-u+s+"px",F(this.node.style,w_,a)}render(){const{context:e,components:t,className:n}=this.props;return kr(1,"div",n,t.map(((t,n)=>Er(2,t,{context:e},n))),0,{onContextMenu:e=>e.preventDefault()},null,this.setNode)}};function E_(e,t,n){return Math.max(t,Math.min(n,e))}k_.$inject=["renderer"];const S_="\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";let $_=class{constructor(e,t,n){this._eventBus=t,e.onGetComponent("table.before",(()=>C_))}open(e,t){this._eventBus.fire("contextMenu.open",{position:e,context:t})}close(){this._eventBus.fire("contextMenu.close")}};$_.$inject=["components","eventBus","renderer"];var P_={__init__:["contextMenu"],contextMenu:["type",$_]};function T_(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function R_(e){return e.shiftKey}class A_{constructor(e,t,n,i,o,r,s){this._clipboard=n,this._cellSelection=i,this._elementRegistry=o,this._editorActions=r,this._keyboard=e.get("keyboard",!1),this._renderer=s,this._keyboard&&(t.on("keyboard.init",this._registerBindings),t.on("keyboard.bind",(()=>{wv.bind(document,"copy",this._clearClipboard,!0),wv.bind(document,"cut",this._clearClipboard,!0)})),t.on("keyboard.unbind",(()=>{wv.unbind(document,"copy",this._clearClipboard,!0),wv.unbind(document,"cut",this._clearClipboard,!0)})))}_clearClipboard=()=>{this._clipboard.clear()};_getSelectedCell(){const e=this._cellSelection.getCellSelection();if(!e)return;const t=this._elementRegistry.get(e);if(!t)return;const n=db(e,this._renderer.getContainer()),i=fb(n);if(document.activeElement!==i)return;const o=sb(n);return o&&o.start!==o.end?void 0:t}_registerBindings=()=>{[(e,t)=>{if(T_(t)&&67===e){const e=this._getSelectedCell();if(!e)return;return R_(t)?this._editorActions.trigger("copy",{element:e.col}):this._editorActions.trigger("copy",{element:e.row}),!0}},(e,t)=>{if(T_(t)&&88===e){const e=this._getSelectedCell();if(!e)return;return R_(t)?this._editorActions.trigger("cut",{element:e.col}):this._editorActions.trigger("cut",{element:e.row}),!0}},(e,t)=>{let n;if(T_(t)&&86===e){const e=this._getSelectedCell();if(!e)return;R_(t)?(n=this._editorActions.trigger("pasteAfter",{element:e.col}),n&&this._cellSelection.selectCell("right")):(n=this._editorActions.trigger("pasteAfter",{element:e.row}),n&&this._cellSelection.selectCell("below"))}return void 0!==n}].forEach((e=>{this._keyboard.addListener(e)}))}}A_.$inject=["injector","eventBus","clipboard","cellSelection","elementRegistry","editorActions","renderer"];var M_={__depends__:[bb,vb],__init__:["copyCutPasteKeyBindings"],copyCutPasteKeyBindings:["type",A_]};class D_ extends Bs{constructor(e,t){super(e,t),Dv(this)}onClick=e=>{this.editorActions.trigger("addInput")};render(){return kr(1,"th","input-cell create-inputs header actionable",[this.translate("Input"),Sr(" "),kr(1,"button","add-input dmn-icon-plus action-icon",null,1,{title:this.translate("Add input")})],0,{onClick:this.onClick,title:this.translate("Add input")})}}D_.$inject=["editorActions","translate"];class L_ extends Bs{constructor(e,t){super(e,t),Dv(this)}onClick=e=>{this.editorActions.trigger("addInput")};render(){return kr(1,"td","input-cell create-inputs",Sr("-"),2,{onClick:this.onClick,title:this.translate("Add input")})}}L_.$inject=["editorActions","translate"];class I_{constructor(e,t){e.onGetComponent("cell",500,(({cellType:e})=>{const{businessObject:n}=t.getRoot();if(!n.input||!n.input.length)return"before-label-cells"===e?D_:"before-rule-cells"===e?L_:void 0}))}}I_.$inject=["components","sheet"];var Q_={__depends__:[Vb],__init__:["createInputsProvider"],createInputsProvider:["type",I_]};const j_=["string","boolean","number","date","time","dateTime","dayTimeDuration","yearMonthDuration","Any"];class B_{constructor(e){this._dataTypes=e||j_}getAll(){return this._dataTypes}}B_.$inject=["config.dataTypes"];var N_={__init__:["dataTypes"],dataTypes:["type",B_]};class q_{constructor(e,t,n,i,o,r,s,a,l,c,u){this._contextMenu=t,this._clipboard=n,this._editorActions=i,this._elementRegistry=r,this._eventBus=o,this._modeling=s,this._selection=a,this._sheet=l,this._rules=c,this._translate=u,this._getEntries=this._getEntries.bind(this),e.onGetComponent("context-menu",((t={})=>{if(t.contextMenuType&&"context-menu"===t.contextMenuType){const n=this._getEntries(t),i=function(e){return e instanceof Hm}(this._elementRegistry.get(t.id))&&e.getComponents("context-menu-cell-additional",t);if(i&&i.length){const e=kr(1,"div","context-menu-group context-menu-group-cell",i,0,{role:"presentation"});n.push(e)}return()=>kr(1,"div","context-menu-flex",n,0,{tabIndex:0,role:"menu","aria-label":"Decision table context menu"})}})),o.on("cell.contextmenu",(({event:e,id:n,node:i})=>{e.preventDefault(),t.open({x:e.pageX,y:e.pageY},{contextMenuType:"context-menu",event:e,id:n})}))}_getEntries(e){const t=t=>{const n=t.cells.map((e=>e.id)).indexOf(e.id),i=this._editorActions.trigger("addRuleAbove",{rule:t});i.cells[n]?this._selection.select(i.cells[n]):this._selection.select(i.cells[0]),this._contextMenu.close()},n=t=>{const n=t.cells.map((e=>e.id)).indexOf(e.id),i=this._editorActions.trigger("addRuleBelow",{rule:t});i.cells[n]?this._selection.select(i.cells[n]):this._selection.select(i.cells[0]),this._contextMenu.close()},i=e=>{this._editorActions.trigger("removeRule",{rule:e}),this._contextMenu.close()},o=e=>{this._editorActions.trigger("addInputLeft",{input:e}),this._contextMenu.close()},r=e=>{this._editorActions.trigger("addInputRight",{input:e}),this._contextMenu.close()},s=e=>{this._editorActions.trigger("removeInput",{input:e}),this._contextMenu.close()},a=e=>{this._editorActions.trigger("addOutputLeft",{output:e}),this._contextMenu.close()},l=e=>{this._editorActions.trigger("addOutputRight",{output:e}),this._contextMenu.close()},c=e=>{this._editorActions.trigger("removeOutput",{output:e}),this._contextMenu.close()},u=e=>{this._editorActions.trigger("copy",{element:e}),this._contextMenu.close()},h=e=>{this._editorActions.trigger("cut",{element:e}),this._contextMenu.close()},d=e=>{this._editorActions.trigger("pasteBefore",{element:e}),this._contextMenu.close()},p=e=>{this._editorActions.trigger("pasteAfter",{element:e}),this._contextMenu.close()},f=e&&e.id;if(!f)return null;const g=this._elementRegistry.get(f);if(!g)return null;const m=this._clipboard.get()||{},v=[],y=g.row||g;if(Dt(y,"dmn:DecisionRule")){const e=this._rules.allowed("paste",{data:m.elements,target:y});v.push(kr(1,"div","context-menu-group",[kr(1,"div","context-menu-group-entry context-menu-entry-copy-rule",this._translate("Copy rule"),0,{onClick:()=>u(y),tabIndex:"-1",role:"menuitem"}),kr(1,"div","context-menu-group-entry context-menu-entry-cut-rule",this._translate("Cut rule"),0,{onClick:()=>h(y),tabIndex:"-1",role:"menuitem"}),kr(1,"div",`context-menu-group-entry ${e?"":"disabled"} context-menu-entry-paste-rule-above`,this._translate("Paste rule above"),0,{onClick:()=>d(y),tabIndex:"-1",role:"menuitem","aria-disabled":!e}),kr(1,"div",`context-menu-group-entry ${e?"":"disabled"} context-menu-entry-paste-rule-below`,this._translate("Paste rule below"),0,{onClick:()=>p(y),tabIndex:"-1",role:"menuitem","aria-disabled":!e})],4,{role:"presentation"}),kr(1,"div","context-menu-group",[kr(1,"div","context-menu-group-entry context-menu-entry-add-rule-above",this._translate("Add rule above"),0,{onClick:()=>t(y),tabIndex:"-1",role:"menuitem"}),kr(1,"div","context-menu-group-entry context-menu-entry-add-rule-below",this._translate("Add rule below"),0,{onClick:()=>n(y),tabIndex:"-1",role:"menuitem"}),kr(1,"div","context-menu-group-entry context-menu-entry-remove-rule",this._translate("Remove rule"),0,{onClick:()=>i(y),tabIndex:"-1",role:"menuitem"})],4,{role:"presentation"}))}else if(Dt(g,"dmn:InputClause")){const e=Dt(g,"dmn:InputClause")?g:g.col,t=this._rules.allowed("col.remove",{col:g.col||g}),n=this._rules.allowed("paste",{data:m.elements,target:g.col||g});v.push(kr(1,"div","context-menu-group",[kr(1,"div","context-menu-group-entry context-menu-entry-copy-input",this._translate("Copy input column"),0,{onClick:()=>u(e),tabIndex:"-1",role:"menuitem"}),kr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-cut-input`,this._translate("Cut input column"),0,{onClick:()=>h(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t}),kr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-input-left`,this._translate("Paste input column left"),0,{onClick:()=>d(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n}),kr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-input-right`,this._translate("Paste input column right"),0,{onClick:()=>p(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n})],4,{role:"presentation"}),kr(1,"div","context-menu-group",[kr(1,"div","context-menu-group-entry context-menu-entry-add-input-left",this._translate("Add input column left"),0,{onClick:()=>o(e),tabIndex:"-1",role:"menuitem"}),kr(1,"div","context-menu-group-entry context-menu-entry-add-input-right",this._translate("Add input column right"),0,{onClick:()=>r(e),tabIndex:"-1",role:"menuitem"}),kr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-remove-input`,this._translate("Remove input column"),0,{onClick:()=>s(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t})],4,{role:"presentation"}))}else if(Dt(g,"dmn:OutputClause")||Dt(g.col,"dmn:OutputClause")){const e=Dt(g,"dmn:OutputClause")?g:g.col,t=this._rules.allowed("col.remove",{col:g.col||g}),n=this._rules.allowed("paste",{data:m.elements,target:g.col||g});v.push(kr(1,"div","context-menu-group",[kr(1,"div","context-menu-group-entry context-menu-entry-copy-output",this._translate("Copy output column"),0,{onClick:()=>u(e),tabIndex:"-1",role:"menuitem"}),kr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-cut-output`,this._translate("Cut output column"),0,{onClick:()=>h(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t}),kr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-output-left`,this._translate("Paste output column left"),0,{onClick:()=>d(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n}),kr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-output-right`,this._translate("Paste output column right"),0,{onClick:()=>p(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n})],4,{role:"presentation"}),kr(1,"div","context-menu-group",[kr(1,"div","context-menu-group-entry context-menu-entry-add-output-left",this._translate("Add output column left"),0,{onClick:()=>a(e),tabIndex:"-1",role:"menuitem"}),kr(1,"div","context-menu-group-entry context-menu-entry-add-output-right",this._translate("Add output column right"),0,{onClick:()=>l(e),tabIndex:"-1",role:"menuitem"}),kr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-remove-output`,this._translate("Remove output column"),0,{onClick:()=>c(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t})],4,{role:"presentation"}))}return v}}q_.$inject=["components","contextMenu","clipboard","editorActions","eventBus","elementRegistry","modeling","selection","sheet","rules","translate"];const F_=["row.add","row.remove","col.add","col.remove"];class V_{constructor(e,t){t.on("commandStack.executed",(({command:t})=>{-1!==F_.indexOf(t)&&e.close()})),t.on("commandStack.reverted",(()=>{e.close()}))}}V_.$inject=["contextMenu","eventBus"];class X_{constructor(e){e.on("contextMenu.open",(()=>this.addEventListeners())),e.on("contextMenu.close",(()=>this.removeEventListeners())),e.on("commandStack.executed",(()=>this.removeEventListeners()))}addEventListeners=()=>{document.addEventListener("keydown",this.handleKeyEvent),document.addEventListener("mouseover",this.handleMouseOver)};removeEventListeners=()=>{document.removeEventListener("keydown",this.handleKeyEvent),document.removeEventListener("mouseover",this.handleMouseOver)};handleKeyEvent=e=>{"ArrowUp"===e.key?(e.preventDefault(),this.move(e.target,-1)):"ArrowDown"===e.key?(e.preventDefault(),this.move(e.target,1)):"Enter"===e.key&&(e.preventDefault(),this.clickCurrentEntry())};handleMouseOver=()=>{this.getEntries().forEach((e=>{return(t=e).style.removeProperty("background-color"),void t.style.removeProperty("pointer-events");var t}));const{focused:e}=this.getActiveEntries(document);e&&fv(e).remove("focused")};getEntries=()=>Array.from(Tv(".context-menu-group-entry")).filter((e=>!fv(e).has("disabled")));getActiveEntries=e=>{const t=Pv(".context-menu-group-entry:hover",e),n=Pv(".context-menu-group-entry.focused",e);return{hover:t,focused:n,current:n||t}};move=(e,t)=>{const n=this.getEntries(),{current:i,hover:o}=this.getActiveEntries(e);if(!i){return void fv(n[0]).add("focused")}const r=n.indexOf(i)+t;let s=n[r];var a;r<0&&(s=n[n.length-1]),r>=n.length&&(s=n[0]),o&&((a=o).style.setProperty("pointer-events","none"),a.style.setProperty("background-color","transparent")),fv(i).remove("focused"),fv(s).add("focused"),s.style.removeProperty("background-color")};clickCurrentEntry=()=>{const{current:e}=this.getActiveEntries(document);e&&e.click()}}X_.$inject=["eventBus"];var z_={__depends__:[Vb,P_,Ob],__init__:["decisionTableContextMenu","contextMenuCloseBehavior","contextMenuKeyboard"],decisionTableContextMenu:["type",q_],contextMenuCloseBehavior:["type",V_],contextMenuKeyboard:["type",X_]};class Y_ extends Bs{constructor(e,t){super(e,t),Iv(this,Nv),this._translate=t.injector.get("translate")}onClick=e=>{const{output:t}=this.props;this._eventBus.fire("output.edit",{event:e,output:t})};onContextmenu=e=>{const{id:t}=this.props.output;this._eventBus.fire("cell.contextmenu",{event:e,id:t})};onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const{injector:e}=this.context;this._changeSupport=this.context.changeSupport,this._eventBus=e.get("eventBus"),this._elementRegistry=e.get("elementRegistry");const{output:t}=this.props;this._changeSupport.onElementsChanged(t.id,this.onElementsChanged)}componentWillUnmount(){const{output:e}=this.props;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}render(){const{output:e,index:t,outputsLength:n}=this.props,{label:i,name:o,outputValues:r,typeRef:s}=e,a=e.width?e.width+"px":"192px";return kr(1,"th","output-cell output-editor",[this.slotFills({type:"cell-inner",context:{cellType:"output-cell",col:this._elementRegistry.get(e.id),index:t,outputsLength:n},col:e}),kr(1,"div","clause",0===t?this._translate("Then"):this._translate("And"),0),i?kr(1,"div","output-label",i,0,{title:this._translate("Output label: ")+i}):kr(1,"div","output-name",o,0,{title:this._translate("Output name: ")+o}),kr(1,"div","output-variable",r&&r.text||this._translate(s||""),0,{title:r&&r.text?this._translate("Output values"):this._translate("Output type")})],0,{"data-col-id":e.id,onDblClick:this.onClick,onContextMenu:this.onContextmenu,style:{width:a}})}}class W_ extends Bs{constructor(e,t){super(e,t),this.state={value:e.value}}onInput=e=>{const{onInput:t}=this.props,n=e.target.value;this.setState({value:n},(()=>{"function"==typeof t&&t(n)}))};onChange=e=>{const{onChange:t}=this.props;"function"==typeof t&&t(e.target.value)};onKeyDown=e=>{const{onKeyDown:t}=this.props;"function"==typeof t&&t(e)};onKeyUp=e=>{const{onKeyUp:t}=this.props;"function"==typeof t&&t(e)};componentDidUpdate(e){const{value:t}=this.props;t!==e.value&&t!==this.state.value&&this.setState({value:t})}render(){const{className:e,label:t,id:n,placeholder:i,type:o}=this.props,{value:r}=this.state;return kr(64,"input",[e||"","dms-input"].join(" "),null,1,{"aria-label":t,placeholder:i||"",onChange:this.onChange,onInput:this.onInput,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,spellCheck:"false",type:o||"text",value:r,id:n})}}class H_ extends Bs{constructor(e,t){super(e,t),this.translate=t.injector?t.injector.get("translate"):U_,this.setName=e=>{e=e||void 0,this.handleChange({name:e})},this.setLabel=e=>{e=e||void 0,this.handleChange({label:e})}}handleChange(e){var{onChange:t}=this.props;"function"==typeof t&&t(e)}render(){const{name:e,label:t}=this.props;return kr(1,"div","context-menu-container ref-output-editor output-edit",[kr(1,"div","dms-form-control",Er(2,Zb,{label:this.translate("Output label"),className:"dms-output-label",value:t||"",placeholder:this.translate("Output"),singleLine:!0,onInput:this.setLabel}),2),kr(1,"div","dms-form-control",[kr(1,"label","dms-label",this.translate("Output name"),0),Er(2,W_,{label:this.translate("Output name"),className:"ref-output-name",value:e||"",onInput:this.setName})],4)],4)}}function U_(e){return e}class G_ extends Bs{constructor(e,t){super(e,t),this.state={},Dv(this),this.persistChanges=this.debounceInput(this.persistChanges)}persistChanges=()=>{const{output:e}=this.props.context,{unsaved:t}=this.state;t&&(this.modeling.updateProperties(e,t),this.setState({unsaved:!1}))};handleChange=e=>{this.setState({unsaved:{...this.state.unsaved,...e}},this.persistChanges)};getValue(e){const{output:t}=this.props.context,{unsaved:n}=this.state;return n&&e in n?n[e]:t.get(e)}render(){return Er(2,H_,{name:this.getValue("name"),label:this.getValue("label"),onChange:this.handleChange})}}G_.$inject=["debounceInput","modeling"];class Z_ extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._eventBus=t.injector.get("eventBus")}onClick=e=>{const{col:t}=this.props;this._eventBus.fire("output.edit",{event:e,output:t})};render(){return kr(1,"button","edit-button dmn-icon-edit",null,1,{"aria-label":this._translate("Edit output"),type:"button",onClick:this.onClick})}}class K_{constructor(e,t,n,i){e.onGetComponent("cell",(({cellType:e})=>{if("output-header"===e)return Y_})),e.onGetComponent("context-menu",((e={})=>{if("output-edit"===e.contextMenuType)return G_})),e.onGetComponent("cell-inner",((e={})=>{const{cellType:t}=e;if("output-cell"===t)return Z_})),n.on("output.edit",(({event:e,output:n})=>{const{target:i}=e,o=mv(i,"th",!0),{left:r,top:s}=o.getBoundingClientRect(),a=function(e){if(!$v(e,".output-cell + .output-cell"))return{x:-1,y:0}}(o);t.open({x:r,y:s,align:"bottom-right"},{contextMenuType:"output-edit",output:n,offset:a})}))}}K_.$inject=["components","contextMenu","eventBus","renderer"];class J_ extends Bs{constructor(e,t){super(e,t),Iv(this,Nv),this._translate=t.injector.get("translate")}onClick=e=>{const{input:t}=this.props;this._eventBus.fire("input.edit",{event:e,input:t})};onContextmenu=e=>{const{id:t}=this.props.input;this._eventBus.fire("cell.contextmenu",{event:e,id:t})};onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const{injector:e}=this.context;this._changeSupport=this.context.changeSupport,this._sheet=e.get("sheet"),this._eventBus=e.get("eventBus"),this._elementRegistry=e.get("elementRegistry");const t=this._sheet.getRoot(),{input:n}=this.props;this._changeSupport.onElementsChanged(t.id,this.onElementsChanged),this._changeSupport.onElementsChanged(n.id,this.onElementsChanged)}componentWillUnmount(){const e=this._sheet.getRoot(),{input:t}=this.props;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged),this._changeSupport.offElementsChanged(t.id,this.onElementsChanged)}render(){const{input:e,index:t,inputsLength:n}=this.props,{inputExpression:i,inputValues:o}=e,r=e.get("label"),s=e.width?e.width+"px":"192px";return kr(1,"th","input-cell input-editor",[this.slotFills({type:"cell-inner",context:{cellType:"input-cell",col:this._elementRegistry.get(e.id),index:t,inputsLength:n},col:e}),kr(1,"div","clause",0===t?this._translate("When"):this._translate("And"),0),r?kr(1,"div","input-label",r,0,{title:this._translate("Input label: ")+r}):kr(1,"div","input-expression",i.text,0,{title:this._translate("Input expression: ")+i.text}),kr(1,"div","input-variable",o&&o.text||this._translate(i.typeRef||""),0,{title:o&&o.text?this._translate("Input values"):this._translate("Input type")})],0,{"data-col-id":e.id,onDblClick:this.onClick,onContextMenu:this.onContextmenu,style:{width:s}})}}let ex=[],tx=[];function nx(e){if(e<768)return!1;for(let t=0,n=ex.length;;){let i=t+n>>1;if(e<ex[i])n=i;else{if(!(e>=tx[i]))return!0;t=i+1}if(t==n)return!1}}function ix(e){return e>=127462&&e<=127487}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let t=0,n=0;t<e.length;t++)(t%2?tx:ex).push(n+=e[t])})();function ox(e,t,n=!0,i=!0){return(n?rx:sx)(e,t,i)}function rx(e,t,n){if(t==e.length)return t;t&&lx(e.charCodeAt(t))&&cx(e.charCodeAt(t-1))&&t--;let i=ax(e,t);for(t+=ux(i);t<e.length;){let o=ax(e,t);if(8205==i||8205==o||n&&nx(o))t+=ux(o),i=o;else{if(!ix(o))break;{let n=0,i=t-2;for(;i>=0&&ix(ax(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function sx(e,t,n){for(;t>0;){let i=rx(e,t-2,n);if(i<t)return i;t--}return 0}function ax(e,t){let n=e.charCodeAt(t);if(!cx(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return lx(i)?i-56320+(n-55296<<10)+65536:n}function lx(e){return e>=56320&&e<57344}function cx(e){return e>=55296&&e<56320}function ux(e){return e<65536?1:2}class hx{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=_x(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),px.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=_x(this,e,t);let n=[];return this.decompose(e,t,n,0),px.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new mx(this),o=new mx(e);for(let e=t,r=t;;){if(i.next(e),o.next(e),e=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(r+=i.value.length,i.done||r>=n)return!0}}iter(e=1){return new mx(this,e)}iterRange(e,t=this.length){return new vx(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new yx(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new dx(e):px.from(dx.split(e,[])):hx.empty}}class dx extends hx{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let o=0;;o++){let r=this.text[o],s=i+r.length;if((t?n:s)>=e)return new bx(i,s,n,r);i=s+1,n++}}decompose(e,t,n,i){let o=e<=0&&t>=this.length?this:new dx(gx(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=fx(o.text,e.text.slice(),0,o.length);if(t.length<=32)n.push(new dx(t,e.length+o.length));else{let e=t.length>>1;n.push(new dx(t.slice(0,e)),new dx(t.slice(e)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof dx))return super.replace(e,t,n);[e,t]=_x(this,e,t);let i=fx(this.text,fx(n.text,gx(this.text,0,e)),t),o=this.length+n.length-(t-e);return i.length<=32?new dx(i,o):px.from(dx.split(i,[]),o)}sliceString(e,t=this.length,n="\n"){[e,t]=_x(this,e,t);let i="";for(let o=0,r=0;o<=t&&r<this.text.length;r++){let s=this.text[r],a=o+s.length;o>e&&r&&(i+=n),e<a&&t>o&&(i+=s.slice(Math.max(0,e-o),t-o)),o=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let o of e)n.push(o),i+=o.length+1,32==n.length&&(t.push(new dx(n,i)),n=[],i=-1);return i>-1&&t.push(new dx(n,i)),t}}class px extends hx{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let o=0;;o++){let r=this.children[o],s=i+r.length,a=n+r.lines-1;if((t?a:s)>=e)return r.lineInner(e,t,n,i);i=s+1,n=a+1}}decompose(e,t,n,i){for(let o=0,r=0;r<=t&&o<this.children.length;o++){let s=this.children[o],a=r+s.length;if(e<=a&&t>=r){let o=i&((r<=e?1:0)|(a>=t?2:0));r>=e&&a<=t&&!o?n.push(s):s.decompose(e-r,t-r,n,o)}r=a+1}}replace(e,t,n){if([e,t]=_x(this,e,t),n.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let r=this.children[i],s=o+r.length;if(e>=o&&t<=s){let a=r.replace(e-o,t-o,n),l=this.lines-r.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let o=this.children.slice();return o[i]=a,new px(o,this.length-(t-e)+n.length)}return super.replace(o,s,a)}o=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=_x(this,e,t);let i="";for(let o=0,r=0;o<this.children.length&&r<=t;o++){let s=this.children[o],a=r+s.length;r>e&&o&&(i+=n),e<a&&t>r&&(i+=s.sliceString(e-r,t-r,n)),r=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof px))return 0;let n=0,[i,o,r,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,o+=t){if(i==r||o==s)return n;let a=this.children[i],l=e.children[o];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new dx(n,t)}let i=Math.max(32,n>>5),o=i<<1,r=i>>1,s=[],a=0,l=-1,c=[];function u(e){let t;if(e.lines>o&&e instanceof px)for(let t of e.children)u(t);else e.lines>r&&(a>r||!a)?(h(),s.push(e)):e instanceof dx&&a&&(t=c[c.length-1])instanceof dx&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new dx(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>i&&h(),a+=e.lines,l+=e.length+1,c.push(e))}function h(){0!=a&&(s.push(1==c.length?c[0]:px.from(c,l)),l=-1,a=c.length=0)}for(let t of e)u(t);return h(),1==s.length?s[0]:new px(s,t)}}function fx(e,t,n=0,i=1e9){for(let o=0,r=0,s=!0;r<e.length&&o<=i;r++){let a=e[r],l=o+a.length;l>=n&&(l>i&&(a=a.slice(0,i-o)),o<n&&(a=a.slice(n-o)),s?(t[t.length-1]+=a,s=!1):t.push(a)),o=l+1}return t}function gx(e,t,n){return fx(e,[""],t,n)}hx.empty=new dx([""],0);class mx{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof dx?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],o=this.offsets[n],r=o>>1,s=i instanceof dx?i.text.length:i.children.length;if(r==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof dx){let o=i.text[r+(t<0?-1:0)];if(this.offsets[n]+=t,o.length>Math.max(0,e))return this.value=0==e?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=i.children[r+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof dx?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class vx{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new mx(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class yx{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(hx.prototype[Symbol.iterator]=function(){return this.iter()},mx.prototype[Symbol.iterator]=vx.prototype[Symbol.iterator]=yx.prototype[Symbol.iterator]=function(){return this});let bx=class{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}};function _x(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function xx(e,t,n=!0,i=!0){return ox(e,t,n,i)}function Ox(e,t){let n=e.charCodeAt(t);if(!(i=n,i>=55296&&i<56320&&t+1!=e.length))return n;var i;let o=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(o)?o-56320+(n-55296<<10)+65536:n}function wx(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function Cx(e){return e<65536?1:2}const kx=/\r\n?|\n/;var Ex=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Ex||(Ex={}));class Sx{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let o=this.sections[t++],r=this.sections[t++];r<0?(e(n,i,o),i+=o):i+=r,n+=o}}iterChangedRanges(e,t=!1){Rx(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new Sx(e)}composeDesc(e){return this.empty?e:e.empty?this:Mx(this,e)}mapDesc(e,t=!1){return e.empty?this:Ax(this,e,t)}mapPos(e,t=-1,n=Ex.Simple){let i=0,o=0;for(let r=0;r<this.sections.length;){let s=this.sections[r++],a=this.sections[r++],l=i+s;if(a<0){if(l>e)return o+(e-i);o+=s}else{if(n!=Ex.Simple&&l>=e&&(n==Ex.TrackDel&&i<e&&l>e||n==Ex.TrackBefore&&i<e||n==Ex.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==i||t<0?o:o+a;o+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return o}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let o=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&o>=e)return!(i<e&&o>t)||"cover";i=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Sx(e)}static create(e){return new Sx(e)}}class $x extends Sx{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Rx(this,((t,n,i,o,r)=>e=e.replace(i,i+(n-t),r)),!1),e}mapDesc(e,t=!1){return Ax(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,o=0;i<t.length;i+=2){let r=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=r;let a=i>>1;for(;n.length<a;)n.push(hx.empty);n.push(r?e.slice(o,o+r):hx.empty)}o+=r}return new $x(t,n)}compose(e){return this.empty?e:e.empty?this:Mx(this,e,!0)}map(e,t=!1){return e.empty?this:Ax(this,e,t,!0)}iterChanges(e,t=!1){Rx(this,e,t)}get desc(){return Sx.create(this.sections)}filter(e){let t=[],n=[],i=[],o=new Dx(this);e:for(let r=0,s=0;;){let a=r==e.length?1e9:e[r++];for(;s<a||s==a&&0==o.len;){if(o.done)break e;let e=Math.min(o.len,a-s);Px(i,e,-1);let r=-1==o.ins?-1:0==o.off?o.ins:0;Px(t,e,r),r>0&&Tx(n,t,o.text),o.forward(e),s+=e}let l=e[r++];for(;s<l;){if(o.done)break e;let e=Math.min(o.len,l-s);Px(t,e,-1),Px(i,e,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(e),s+=e}}return{changes:new $x(t,n),filtered:Sx.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):0==i?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],o=[],r=0,s=null;function a(e=!1){if(!e&&!i.length)return;r<t&&Px(i,t-r,-1);let n=new $x(i,o);s=s?s.compose(n.map(s)):n,i=[],o=[],r=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof $x){if(l.length!=t)throw new RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:c}=l;if(e>s||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let u=c?"string"==typeof c?hx.of(c.split(n||kx)):c:hx.empty,h=u.length;if(e==s&&0==h)return;e<r&&a(),e>r&&Px(i,e-r,-1),Px(i,s-e,h),Tx(o,i,u),r=s}}(e),a(!s),s}static empty(e){return new $x(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let o=e[i];if("number"==typeof o)t.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some(((e,t)=>t&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)t.push(o[0],0);else{for(;n.length<i;)n.push(hx.empty);n[i]=hx.of(o.slice(1)),t.push(o[0],n[i].length)}}}return new $x(t,n)}static createSet(e,t){return new $x(e,t)}}function Px(e,t,n,i=!1){if(0==t&&n<=0)return;let o=e.length-2;o>=0&&n<=0&&n==e[o+1]?e[o]+=t:o>=0&&0==t&&0==e[o]?e[o+1]+=n:i?(e[o]+=t,e[o+1]+=n):e.push(t,n)}function Tx(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<i;)e.push(hx.empty);e.push(n)}}function Rx(e,t,n){let i=e.inserted;for(let o=0,r=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)o+=a,r+=a;else{let c=o,u=r,h=hx.empty;for(;c+=a,u+=l,l&&i&&(h=h.append(i[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(o,c,r,u,h),o=c,r=u}}}function Ax(e,t,n,i=!1){let o=[],r=i?[]:null,s=new Dx(e),a=new Dx(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);Px(o,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(Px(o,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(Px(o,0,s.ins),r&&Tx(r,o,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return r?$x.createSet(o,r):Sx.create(o);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.len<n))break;n-=a.len,a.next()}Px(o,t,e<s.i?s.ins:0),r&&e<s.i&&Tx(r,o,s.text),e=s.i,s.forward(s.len-n)}}}}function Mx(e,t,n=!1){let i=[],o=n?[]:null,r=new Dx(e),s=new Dx(t);for(let e=!1;;){if(r.done&&s.done)return o?$x.createSet(i,o):Sx.create(i);if(0==r.ins)Px(i,r.len,0,e),r.next();else if(0!=s.len||s.done){if(r.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(r.len2,s.len),n=i.length;if(-1==r.ins){let n=-1==s.ins?-1:s.off?0:s.ins;Px(i,t,n,e),o&&n&&Tx(o,i,s.text)}else-1==s.ins?(Px(i,r.off?0:r.len,t,e),o&&Tx(o,i,r.textBit(t))):(Px(i,r.off?0:r.len,s.off?0:s.ins,e),o&&!s.off&&Tx(o,i,s.text));e=(r.ins>t||s.ins>=0&&s.len>t)&&(e||i.length>n),r.forward2(t),s.forward(t)}}else Px(i,0,s.ins,e),o&&Tx(o,i,s.text),s.next()}}class Dx{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?hx.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?hx.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lx{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new Lx(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Ix.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Ix.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Ix.range(e.anchor,e.head)}static create(e,t,n){return new Lx(e,t,n)}}class Ix{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Ix.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Ix([this.main],0)}addRange(e,t=!0){return Ix.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Ix.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((e=>e.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ix(e.ranges.map((e=>Lx.fromJSON(e))),e.main)}static single(e,t=e){return new Ix([Ix.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let o=e[i];if(o.empty?o.from<=n:o.from<n)return Ix.normalized(e.slice(),t);n=o.to}return new Ix(e,t)}static cursor(e,t=0,n,i){return Lx.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(e,t,n,i){let o=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return t<e?Lx.create(t,e,48|o):Lx.create(e,t,(t>e?8:0)|o)}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;n<e.length;n++){let i=e[n],o=e[n-1];if(i.empty?i.from<=o.to:i.from<o.to){let r=o.from,s=Math.max(i.to,o.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?Ix.range(s,r):Ix.range(r,s))}}return new Ix(e,t)}}function Qx(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let jx=0;class Bx{constructor(e,t,n,i,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=jx++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}get reader(){return this}static define(e={}){return new Bx(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Nx),!!e.static,e.enables)}of(e){return new qx([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qx(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qx(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function Nx(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class qx{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=jx++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,o=this.id,r=e[o]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[r]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Vx(e,c)){let t=n(e);if(s?!Fx(t,e.values[r],i):!i(t,e.values[r]))return e.values[r]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[o];if(null!=l){let o=oO(t,l);if(this.dependencies.every((n=>n instanceof Bx?t.facet(n)===e.facet(n):!(n instanceof Yx)||t.field(n,!1)==e.field(n,!1)))||(s?Fx(a=n(e),o,i):i(a=n(e),o)))return e.values[r]=o,0}else a=n(e);return e.values[r]=a,1}}}}function Fx(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function Vx(e,t){let n=!1;for(let i of t)1&iO(e,i)&&(n=!0);return n}function Xx(e,t,n){let i=n.map((t=>e[t.id])),o=n.map((e=>e.type)),r=i.filter((e=>!(1&e))),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<i.length;t++){let r=oO(e,i[t]);if(2==o[t])for(let e of r)n.push(e);else n.push(r)}return t.combine(n)}return{create(e){for(let t of i)iO(e,t);return e.values[s]=a(e),1},update(e,n){if(!Vx(e,r))return 0;let i=a(e);return t.compare(i,e.values[s])?0:(e.values[s]=i,1)},reconfigure(e,o){let r=Vx(e,i),l=o.config.facets[t.id],c=o.facet(t);if(l&&!r&&Nx(n,l))return e.values[s]=c,0;let u=a(e);return t.compare(u,c)?(e.values[s]=c,0):(e.values[s]=u,1)}}}const zx=Bx.define({static:!0});class Yx{constructor(e,t,n,i,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=o,this.provides=void 0}static define(e){let t=new Yx(jx++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(zx).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],o=this.updateF(i,n);return this.compareF(i,o)?0:(e.values[t]=o,1)},reconfigure:(e,n)=>{let i,o=e.facet(zx),r=n.facet(zx);return(i=o.find((e=>e.field==this)))&&i!=r.find((e=>e.field==this))?(e.values[t]=i.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,zx.of({field:this,create:e})]}get extension(){return this}}const Wx=4,Hx=3,Ux=2,Gx=1;function Zx(e){return t=>new Jx(t,e)}const Kx={highest:Zx(0),high:Zx(Gx),default:Zx(Ux),low:Zx(Hx),lowest:Zx(Wx)};class Jx{constructor(e,t){this.inner=e,this.prec=t}}class eO{of(e){return new tO(this,e)}reconfigure(e){return eO.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class tO{constructor(e,t){this.compartment=e,this.inner=t}}class nO{constructor(e,t,n,i,o,r){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=o,this.facets=r,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],o=Object.create(null),r=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],o=new Map;function r(e,s){let a=o.get(e);if(null!=a){if(a<=s)return;let t=i[a].indexOf(e);t>-1&&i[a].splice(t,1),e instanceof tO&&n.delete(e.compartment)}if(o.set(e,s),Array.isArray(e))for(let t of e)r(t,s);else if(e instanceof tO){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(e.compartment)||e.inner;n.set(e.compartment,i),r(i,s)}else if(e instanceof Jx)r(e.inner,e.prec);else if(e instanceof Yx)i[s].push(e),e.provides&&r(e.provides,s);else if(e instanceof qx)i[s].push(e),e.facet.extensions&&r(e.facet.extensions,Ux);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(t,s)}}return r(e,Ux),i.reduce(((e,t)=>e.concat(t)))}(e,t,r))n instanceof Yx?i.push(n):(o[n.facet.id]||(o[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push((t=>e.slot(t)));let c=null==n?void 0:n.config.facets;for(let e in o){let t=o[e],i=t[0].facet,r=c&&c[e]||[];if(t.every((e=>0==e.type)))if(s[i.id]=a.length<<1|1,Nx(r,t))a.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(s[e.id]=a.length<<1|1,a.push(e.value)):(s[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));s[i.id]=l.length<<1,l.push((e=>Xx(e,i,t)))}}let u=l.map((e=>e(s)));return new nO(e,r,u,s,a,o)}}function iO(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let o=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|o}function oO(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const rO=Bx.define(),sO=Bx.define({combine:e=>e.some((e=>e)),static:!0}),aO=Bx.define({combine:e=>e.length?e[0]:void 0,static:!0}),lO=Bx.define(),cO=Bx.define(),uO=Bx.define(),hO=Bx.define({combine:e=>!!e.length&&e[0]});class dO{constructor(e,t){this.type=e,this.value=t}static define(){return new pO}}class pO{of(e){return new dO(this,e)}}class fO{constructor(e){this.map=e}of(e){return new gO(this,e)}}class gO{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new gO(this.type,t)}is(e){return this.type==e}static define(e={}){return new fO(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}gO.reconfigure=gO.define(),gO.appendConfig=gO.define();class mO{constructor(e,t,n,i,o,r){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=o,this.scrollIntoView=r,this._doc=null,this._state=null,n&&Qx(n,t.newLength),o.some((e=>e.type==mO.time))||(this.annotations=o.concat(mO.time.of(Date.now())))}static create(e,t,n,i,o,r){return new mO(e,t,n,i,o,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(mO.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function vO(e,t){let n=[];for(let i=0,o=0;;){let r,s;if(i<e.length&&(o==t.length||t[o]>=e[i]))r=e[i++],s=e[i++];else{if(!(o<t.length))return n;r=t[o++],s=t[o++]}!n.length||n[n.length-1]<r?n.push(r,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function yO(e,t,n){var i;let o,r,s;return n?(o=t.changes,r=$x.empty(t.changes.length),s=e.changes.compose(t.changes)):(o=t.changes.map(e.changes),r=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(o)),{changes:s,selection:t.selection?t.selection.map(r):null===(i=e.selection)||void 0===i?void 0:i.map(o),effects:gO.mapEffects(e.effects,o).concat(gO.mapEffects(t.effects,r)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function bO(e,t,n){let i=t.selection,o=OO(t.annotations);return t.userEvent&&(o=o.concat(mO.userEvent.of(t.userEvent))),{changes:t.changes instanceof $x?t.changes:$x.of(t.changes||[],n,e.facet(aO)),selection:i&&(i instanceof Ix?i:Ix.single(i.anchor,i.head)),effects:OO(t.effects),annotations:o,scrollIntoView:!!t.scrollIntoView}}function _O(e,t,n){let i=bO(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let o=1;o<t.length;o++){!1===t[o].filter&&(n=!1);let r=!!t[o].sequential;i=yO(i,bO(e,t[o],r?i.changes.newLength:e.doc.length),r)}let o=mO.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(uO),i=e;for(let o=n.length-1;o>=0;o--){let r=n[o](e);r&&Object.keys(r).length&&(i=yO(i,bO(t,r,e.changes.newLength),!0))}return i==e?e:mO.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(lO)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:vO(n,t))}if(!0!==n){let i,o;if(!1===n)o=e.changes.invertedDesc,i=$x.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,o=t.filtered.mapDesc(t.changes).invertedDesc}e=mO.create(t,i,e.selection&&e.selection.map(o),gO.mapEffects(e.effects,o),e.annotations,e.scrollIntoView)}let i=t.facet(cO);for(let n=i.length-1;n>=0;n--){let o=i[n](e);e=o instanceof mO?o:Array.isArray(o)&&1==o.length&&o[0]instanceof mO?o[0]:_O(t,OO(o),!1)}return e}(o):o)}mO.time=dO.define(),mO.userEvent=dO.define(),mO.addToHistory=dO.define(),mO.remote=dO.define();const xO=[];function OO(e){return null==e?xO:Array.isArray(e)?e:[e]}var wO=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(wO||(wO={}));const CO=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let kO;try{kO=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(gV){}function EO(e){return t=>{if(!/\S/.test(t))return wO.Space;if(function(e){if(kO)return kO.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||CO.test(n)))return!0}return!1}(t))return wO.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return wO.Word;return wO.Other}}class SO{constructor(e,t,n,i,o,r){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=o,r&&(r._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)iO(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return iO(this,n),oO(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return _O(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:o}=n;for(let t of e.effects)t.is(eO.reconfigure)?(n&&(o=new Map,n.compartments.forEach(((e,t)=>o.set(t,e))),n=null),o.set(t.value.compartment,t.value.extension)):t.is(gO.reconfigure)?(n=null,i=t.value):t.is(gO.appendConfig)&&(n=null,i=OO(i).concat(t.value));if(n)t=e.startState.values.slice();else{n=nO.resolve(i,o,this),t=new SO(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values}let r=e.startState.facet(sO)?e.newSelection:e.newSelection.asSingle();new SO(n,e.newDoc,r,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:Ix.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),o=[n.range],r=OO(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(i);for(let e=0;e<n;e++)o[e]=o[e].map(l);let c=i.mapDesc(a,!0);o.push(s.range.map(c)),i=i.compose(l),r=gO.mapEffects(r,l).concat(gO.mapEffects(OO(s.effects),c))}return{changes:i,selection:Ix.create(o,t.mainIndex),effects:r}}changes(e=[]){return e instanceof $x?e:$x.of(e,this.doc.length,this.facet(SO.lineSeparator))}toText(e){return hx.of(e.split(this.facet(SO.lineSeparator)||kx))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(iO(this,t),oO(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof Yx&&null!=this.config.address[i.id]&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let o=n[t],r=e[t];i.push(o.init((e=>o.spec.fromJSON(r,e))))}return SO.create({doc:e.doc,selection:Ix.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=nO.resolve(e.extensions||[],new Map),n=e.doc instanceof hx?e.doc:hx.of((e.doc||"").split(t.staticFacet(SO.lineSeparator)||kx)),i=e.selection?e.selection instanceof Ix?e.selection:Ix.single(e.selection.anchor,e.selection.head):Ix.single(0);return Qx(i,n.length),t.staticFacet(sO)||(i=i.asSingle()),new SO(t,n,i,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(SO.tabSize)}get lineBreak(){return this.facet(SO.lineSeparator)||"\n"}get readOnly(){return this.facet(hO)}phrase(e,...t){for(let t of this.facet(SO.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let o of this.facet(rO))for(let r of o(this,t,n))Object.prototype.hasOwnProperty.call(r,e)&&i.push(r[e]);return i}charCategorizer(e){return EO(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),o=this.charCategorizer(e),r=e-n,s=e-n;for(;r>0;){let e=xx(t,r,!1);if(o(t.slice(e,r))!=wO.Word)break;r=e}for(;s<i;){let e=xx(t,s);if(o(t.slice(s,e))!=wO.Word)break;s=e}return r==s?null:Ix.range(r+n,s+n)}}function $O(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let o=t[e],r=i[e];if(void 0===r)i[e]=o;else if(r===o||void 0===o);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](r,o)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}SO.allowMultipleSelections=sO,SO.tabSize=Bx.define({combine:e=>e.length?e[0]:4}),SO.lineSeparator=aO,SO.readOnly=hO,SO.phrases=Bx.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),SO.languageData=rO,SO.changeFilter=lO,SO.transactionFilter=cO,SO.transactionExtender=uO,eO.reconfigure=gO.define();class PO{eq(e){return this==e}range(e,t=e){return TO.create(e,t,this)}}PO.prototype.startSide=PO.prototype.endSide=0,PO.prototype.point=!1,PO.prototype.mapMode=Ex.TrackDel;let TO=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,i){return new e(t,n,i)}};function RO(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class AO{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let o=n?this.to:this.from;for(let r=i,s=o.length;;){if(r==s)return r;let i=r+s>>1,a=o[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==r)return a>=0?r:s;a>=0?s=i:r=i+1}}between(e,t,n,i){for(let o=this.findIndex(t,-1e9,!0),r=this.findIndex(n,1e9,!1,o);o<r;o++)if(!1===i(this.from[o]+e,this.to[o]+e,this.value[o]))return!1}map(e,t){let n=[],i=[],o=[],r=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,u=this.value[a],h=this.from[a]+e,d=this.to[a]+e;if(h==d){let e=t.mapPos(h,u.startSide,u.mapMode);if(null==e)continue;if(l=c=e,u.startSide!=u.endSide&&(c=t.mapPos(h,u.endSide),c<l))continue}else if(l=t.mapPos(h,u.startSide),c=t.mapPos(d,u.endSide),l>c||l==c&&u.startSide>0&&u.endSide<=0)continue;(c-l||u.endSide-u.startSide)<0||(r<0&&(r=l),u.point&&(s=Math.max(s,c-l)),n.push(u),i.push(l-r),o.push(c-r))}return{mapped:n.length?new AO(i,o,n,s):null,pos:r}}}class MO{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new MO(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:o=this.length}=e,r=e.filter;if(0==t.length&&!r)return this;if(n&&(t=t.slice().sort(RO)),this.isEmpty)return t.length?MO.of(t):this;let s=new IO(this,null,-1).goto(0),a=0,l=[],c=new DO;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!r||i>this.chunkEnd(s.chunkIndex)||o<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!r||i>s.to||o<s.from||r(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(TO.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?MO.empty:this.nextLayer.update({add:l,filter:r,filterFrom:i,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let r=this.chunkPos[o],s=this.chunk[o],a=e.touchesRange(r,r+s.length);if(!1===a)i=Math.max(i,s.maxPoint),t.push(s),n.push(e.mapPos(r));else if(!0===a){let{mapped:o,pos:a}=s.map(r,e);o&&(i=Math.max(i,o.maxPoint),t.push(o),n.push(a))}}let o=this.nextLayer.map(e);return 0==t.length?o:new MO(n,t,o||MO.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],r=this.chunk[i];if(t>=o&&e<=o+r.length&&!1===r.between(o,e-o,t-o,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return QO.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return QO.from(e).goto(t)}static compare(e,t,n,i,o=-1){let r=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o)),s=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o)),a=LO(r,s,n),l=new BO(r,a,o),c=new BO(s,a,o);n.iterGaps(((e,t,n)=>NO(l,e,c,t,n,i))),n.empty&&0==n.length&&NO(l,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let o=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(o.length!=r.length)return!1;if(!o.length)return!0;let s=LO(o,r),a=new BO(o,s,0).goto(n),l=new BO(r,s,0).goto(n);for(;;){if(a.to!=l.to||!qO(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,o=-1){let r=new BO(e,null,o).goto(t),s=t,a=r.openStart;for(;;){let e=Math.min(r.to,n);if(r.point){let n=r.activeForPoint(r.to),o=r.pointFrom<t?n.length+1:r.point.startSide<0?n.length:Math.min(n.length,a);i.point(s,e,r.point,n,o,r.pointRank),a=Math.min(r.openEnd(e),n.length)}else e>s&&(i.span(s,e,r.active,a),a=r.openEnd(e));if(r.to>n)return a+(r.point&&r.to>n?1:0);s=r.to,r.next()}}static of(e,t=!1){let n=new DO;for(let i of e instanceof TO?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(RO(t,i)>0)return e.slice().sort(RO);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return MO.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=MO.empty;i=i.nextLayer)t=new MO(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}MO.empty=new MO([],[],null,-1),MO.empty.nextLayer=MO.empty;class DO{finishChunk(e){this.chunks.push(new AO(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new DO)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(MO.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=MO.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function LO(e,t,n){let i=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&i.set(t.chunk[e],t.chunkPos[e]);let o=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let r=i.get(e.chunk[t]);null==r||(n?n.mapPos(r):r)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(r,r+e.chunk[t].length))||o.add(e.chunk[t])}return o}class IO{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class QO{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let o=0;o<e.length;o++)for(let r=e[o];!r.isEmpty;r=r.nextLayer)r.maxPoint>=n&&i.push(new IO(r,t,n,o));return 1==i.length?i[0]:new QO(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)jO(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)jO(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),jO(this.heap,0)}}}function jO(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let o=e[i];if(i+1<e.length&&o.compare(e[i+1])>=0&&(o=e[i+1],i++),n.compare(o)<0)break;e[i]=n,e[t]=o,t=i}}class BO{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=QO.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){FO(this.active,e),FO(this.activeTo,e),FO(this.activeRank,e),this.minActive=XO(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||i-this.activeTo[t])>0;)t++;VO(this.active,t,n),VO(this.activeTo,t,i),VO(this.activeRank,t,o),e&&VO(e,t,this.cursor.from),this.minActive=XO(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&FO(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function NO(e,t,n,i,o,r){e.goto(t),n.goto(i);let s=i+o,a=i,l=i-t;for(;;){let t=e.to+l-n.to,i=t||e.endSide-n.endSide,o=i<0?e.to+l:n.to,c=Math.min(o,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&qO(e.activeForPoint(e.to),n.activeForPoint(n.to))||r.comparePoint(a,c,e.point,n.point):c>a&&!qO(e.active,n.active)&&r.compareRange(a,c,e.active,n.active),o>s)break;(t||e.openEnd!=n.openEnd)&&r.boundChange&&r.boundChange(o),a=o,i<=0&&e.next(),i>=0&&n.next()}}function qO(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!e[n].eq(t[n]))return!1;return!0}function FO(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function VO(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function XO(e,t){let n=-1,i=1e9;for(let o=0;o<t.length;o++)(t[o]-i||e[o].endSide-e[n].endSide)<0&&(n=o,i=t[o]);return n}function zO(e,t,n=e.length){let i=0;for(let o=0;o<n&&o<e.length;)9==e.charCodeAt(o)?(i+=t-i%t,o++):(i++,o=xx(e,o));return i}const YO="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),WO="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),HO="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class UO{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function o(e,t,r,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return r.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))o(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),s,r);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");o(i(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+s+";")}(a.length||c)&&r.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)o(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=HO[YO]||1;return HO[YO]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[WO],o=n&&n.nonce;i?o&&i.setNonce(o):i=new ZO(e,o),i.mount(Array.isArray(t)?t:[t])}}let GO=new Map;class ZO{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=GO.get(n);if(t)return e.adoptedStyleSheets=[t.sheet,...e.adoptedStyleSheets],e[WO]=t;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],GO.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let i=e.head||e;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],e[WO]=this}mount(e){let t=this.sheet,n=0,i=0;for(let o=0;o<e.length;o++){let r=e[o],s=this.modules.indexOf(r);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,r),t)for(let e=0;e<r.rules.length;e++)t.insertRule(r.rules[e],n++)}else{for(;i<s;)n+=this.modules[i++].rules.length;n+=r.rules.length,i++}}if(!t){let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var KO={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},JO={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ew="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),tw="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),nw="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),iw=tw||ew&&+ew[1]<57,ow=0;ow<10;ow++)KO[48+ow]=KO[96+ow]=String(ow);for(ow=1;ow<=24;ow++)KO[ow+111]="F"+ow;for(ow=65;ow<=90;ow++)KO[ow]=String.fromCharCode(ow+32),JO[ow]=String.fromCharCode(ow);for(var rw in KO)JO.hasOwnProperty(rw)||(JO[rw]=KO[rw]);function sw(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i];"string"==typeof o?e.setAttribute(i,o):null!=o&&(e[i]=o)}t++}for(;t<arguments.length;t++)aw(e,arguments[t]);return e}function aw(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)aw(e,t[n])}}let lw="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},cw="undefined"!=typeof document?document:{documentElement:{style:{}}};const uw=/Edge\/(\d+)/.exec(lw.userAgent),hw=/MSIE \d/.test(lw.userAgent),dw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(lw.userAgent),pw=!!(hw||dw||uw),fw=!pw&&/gecko\/(\d+)/i.test(lw.userAgent),gw=!pw&&/Chrome\/(\d+)/.exec(lw.userAgent),mw="webkitFontSmoothing"in cw.documentElement.style,vw=!pw&&/Apple Computer/.test(lw.vendor),yw=vw&&(/Mobile\/\w+/.test(lw.userAgent)||lw.maxTouchPoints>2);var bw={mac:yw||/Mac/.test(lw.platform),windows:/Win/.test(lw.platform),linux:/Linux|X11/.test(lw.platform),ie:pw,ie_version:hw?cw.documentMode||6:dw?+dw[1]:uw?+uw[1]:0,gecko:fw,gecko_version:fw?+(/Firefox\/(\d+)/.exec(lw.userAgent)||[0,0])[1]:0,chrome:!!gw,chrome_version:gw?+gw[1]:0,ios:yw,android:/Android\b/.test(lw.userAgent),webkit:mw,webkit_version:mw?+(/\bAppleWebKit\/(\d+)/.exec(lw.userAgent)||[0,0])[1]:0,safari:vw,safari_version:vw?+(/\bVersion\/(\d+(\.\d+)?)/.exec(lw.userAgent)||[0,0])[1]:0,tabSize:null!=cw.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function _w(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const xw=Object.create(null);function Ow(e,t,n){if(e==t)return!0;e||(e=xw),t||(t=xw);let i=Object.keys(e),o=Object.keys(t);if(i.length-0!=o.length-0)return!1;for(let r of i)if(r!=n&&(-1==o.indexOf(r)||e[r]!==t[r]))return!1;return!0}function ww(e,t,n){let i=!1;if(t)for(let o in t)n&&o in n||(i=!0,"style"==o?e.style.cssText="":e.removeAttribute(o));if(n)for(let o in n)t&&t[o]==n[o]||(i=!0,"style"==o?e.style.cssText=n[o]:e.setAttribute(o,n[o]));return i}function Cw(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class kw{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ew=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Ew||(Ew={}));class Sw extends PO{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new $w(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Tw(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:o,end:r}=Rw(e,i);t=(o?i?-3e8:-1:5e8)-1,n=1+(r?i?2e8:1:-6e8)}return new Tw(e,t,n,i,e.widget||null,!0)}static line(e){return new Pw(e)}static set(e,t=!1){return MO.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Sw.none=MO.empty;class $w extends Sw{constructor(e){let{start:t,end:n}=Rw(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?_w(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||xw}eq(e){return this==e||e instanceof $w&&this.tagName==e.tagName&&Ow(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}$w.prototype.point=!1;class Pw extends Sw{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Pw&&this.spec.class==e.spec.class&&Ow(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Pw.prototype.mapMode=Ex.TrackBefore,Pw.prototype.point=!0;class Tw extends Sw{constructor(e,t,n,i,o,r){super(t,n,o,e),this.block=i,this.isReplace=r,this.mapMode=i?t<=0?Ex.TrackBefore:Ex.TrackAfter:Ex.TrackDel}get type(){return this.startSide!=this.endSide?Ew.WidgetRange:this.startSide<=0?Ew.WidgetBefore:Ew.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Tw&&function(e,t){return e==t||!!(e&&t&&e.compare(t))}(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function Rw(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function Aw(e,t,n,i=0){let o=n.length-1;o>=0&&n[o]+i>=e?n[o]=Math.max(n[o],t):n.push(e,t)}Tw.prototype.point=!0;class Mw extends PO{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Mw&&this.tagName==e.tagName&&Ow(this.attributes,e.attributes)}static create(e){return new Mw(e.tagName,e.attributes||xw)}static set(e,t=!1){return MO.of(e,t)}}function Dw(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Lw(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function Iw(e,t){if(!t.anchorNode)return!1;try{return Lw(e,t.anchorNode)}catch(e){return!1}}function Qw(e){return 3==e.nodeType?Gw(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function jw(e,t,n,i){return!!n&&(qw(e,t,n,i,-1)||qw(e,t,n,i,1))}function Bw(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Nw(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function qw(e,t,n,i,o){for(;;){if(e==n&&t==i)return!0;if(t==(o<0?0:Fw(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Bw(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(o<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=o<0?Fw(e):0}}}function Fw(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Vw(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Xw(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function zw(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}Mw.prototype.startSide=Mw.prototype.endSide=-1;class Yw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Fw(t):0),n,Math.min(e.focusOffset,n?Fw(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let Ww,Hw=null;function Uw(e){if(e.setActive)return e.setActive();if(Hw)return e.focus(Hw);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Hw?{get preventScroll(){return Hw={preventScroll:!0},!0}}:void 0),!Hw){Hw=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],o=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=o&&(n.scrollLeft=o)}}}function Gw(e,t,n=t){let i=Ww||(Ww=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function Zw(e,t,n,i){let o={key:t,code:t,keyCode:n,which:n,cancelable:!0};i&&({altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,metaKey:o.metaKey}=i);let r=new KeyboardEvent("keydown",o);r.synthetic=!0,e.dispatchEvent(r);let s=new KeyboardEvent("keyup",o);return s.synthetic=!0,e.dispatchEvent(s),r.defaultPrevented||s.defaultPrevented}function Kw(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Jw(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=Fw(n)}else{if(!n.parentNode||Nw(n))return null;i=Bw(n),n=n.parentNode}}}function eC(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||Nw(n))return null;i=Bw(n)+1,n=n.parentNode}}}bw.safari&&bw.safari_version>=26&&(Hw=!1);class tC{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new tC(e.parentNode,Bw(e),t)}static after(e,t){return new tC(e.parentNode,Bw(e)+1,t)}}var nC=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(nC||(nC={}));const iC=nC.LTR,oC=nC.RTL;function rC(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const sC=rC("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),aC=rC("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),lC=Object.create(null),cC=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);lC[t]=n,lC[n]=-t}function uC(e){return e<=247?sC[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?aC[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const hC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class dC{get dir(){return this.level%2?oC:iC}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let o=-1;for(let r=0;r<e.length;r++){let s=e[r];if(s.from<=t&&s.to>=t){if(s.level==n)return r;(o<0||(0!=i?i<0?s.from<t:s.to>t:e[o].level>s.level))&&(o=r)}}if(o<0)throw new RangeError("Index out of range");return o}}function pC(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],o=t[n];if(i.from!=o.from||i.to!=o.to||i.direction!=o.direction||!pC(i.inner,o.inner))return!1}return!0}const fC=[];function gC(e,t,n,i,o,r,s){let a=i%2?2:1;if(i%2==o%2)for(let l=t,c=0;l<n;){let t=!0,u=!1;if(c==r.length||l<r[c].from){let e=fC[l];e!=a&&(t=!1,u=16==e)}let h=t||1!=a?null:[],d=t?i:i+1,p=l;e:for(;;)if(c<r.length&&p==r[c].from){if(u)break e;let f=r[c];if(!t)for(let e=f.to,t=c+1;;){if(e==n)break e;if(!(t<r.length&&r[t].from==e)){if(fC[e]==a)break e;break}e=r[t++].to}if(c++,h)h.push(f);else{f.from>l&&s.push(new dC(l,f.from,d)),mC(e,f.direction==iC!=!(d%2)?i+1:i,o,f.inner,f.from,f.to,s),l=f.to}p=f.to}else{if(p==n||(t?fC[p]!=a:fC[p]==a))break;p++}h?gC(e,l,p,i+1,o,h,s):l<p&&s.push(new dC(l,p,d)),l=p}else for(let l=n,c=r.length;l>t;){let n=!0,u=!1;if(!c||l>r[c-1].to){let e=fC[l-1];e!=a&&(n=!1,u=16==e)}let h=n||1!=a?null:[],d=n?i:i+1,p=l;e:for(;;)if(c&&p==r[c-1].to){if(u)break e;let f=r[--c];if(!n)for(let e=f.from,n=c;;){if(e==t)break e;if(!n||r[n-1].to!=e){if(fC[e-1]==a)break e;break}e=r[--n].from}if(h)h.push(f);else{f.to<l&&s.push(new dC(f.to,l,d)),mC(e,f.direction==iC!=!(d%2)?i+1:i,o,f.inner,f.from,f.to,s),l=f.from}p=f.from}else{if(p==t||(n?fC[p-1]!=a:fC[p-1]==a))break;p--}h?gC(e,p,l,i+1,o,h,s):p<l&&s.push(new dC(p,l,d)),l=p}}function mC(e,t,n,i,o,r,s){let a=t%2?2:1;!function(e,t,n,i,o){for(let r=0;r<=i.length;r++){let s=r?i[r-1].to:t,a=r<i.length?i[r].from:n,l=r?256:o;for(let t=s,n=l,i=l;t<a;t++){let o=uC(e.charCodeAt(t));512==o?o=n:8==o&&4==i&&(o=16),fC[t]=4==o?2:o,7&o&&(i=o),n=o}for(let e=s,t=l,i=l;e<a;e++){let o=fC[e];if(128==o)e<a-1&&t==fC[e+1]&&24&t?o=fC[e]=t:fC[e]=256;else if(64==o){let o=e+1;for(;o<a&&64==fC[o];)o++;let r=e&&8==t||o<n&&8==fC[o]?1==i?1:8:256;for(let t=e;t<o;t++)fC[t]=r;e=o-1}else 8==o&&1==i&&(fC[e]=1);t=o,7&o&&(i=o)}}}(e,o,r,i,a),function(e,t,n,i,o){let r=1==o?2:1;for(let s=0,a=0,l=0;s<=i.length;s++){let c=s?i[s-1].to:t,u=s<i.length?i[s].from:n;for(let t,n,i,s=c;s<u;s++)if(n=lC[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(cC[e+1]==-n){let t=cC[e+2],n=2&t?o:4&t?1&t?r:o:0;n&&(fC[s]=fC[cC[e]]=n),a=e;break}}else{if(189==cC.length)break;cC[a++]=s,cC[a++]=t,cC[a++]=l}else if(2==(i=fC[s])||1==i){let e=i==o;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=cC[t+2];if(2&n)break;if(e)cC[t+2]|=2;else{if(4&n)break;cC[t+2]|=4}}}}}(e,o,r,i,a),function(e,t,n,i){for(let o=0,r=i;o<=n.length;o++){let s=o?n[o-1].to:e,a=o<n.length?n[o].from:t;for(let l=s;l<a;){let s=fC[l];if(256==s){let s=l+1;for(;;)if(s==a){if(o==n.length)break;s=n[o++].to,a=o<n.length?n[o].from:t}else{if(256!=fC[s])break;s++}let c=1==r,u=c==(1==(s<t?fC[s]:i))?c?1:2:i;for(let t=s,i=o,r=i?n[i-1].to:e;t>l;)t==r&&(t=n[--i].from,r=i?n[i-1].to:e),fC[--t]=u;l=s}else r=s,l++}}}(o,r,i,a),gC(e,o,r,t,n,i,s)}function vC(e){return[new dC(0,e,0)]}let yC="";function bC(e,t,n,i,o){var r;let s=i.head-e.from,a=dC.find(t,s,null!==(r=i.bidiLevel)&&void 0!==r?r:-1,i.assoc),l=t[a],c=l.side(o,n);if(s==c){let e=a+=o?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!o,n),c=l.side(o,n)}let u=xx(e.text,s,l.forward(o,n));(u<l.from||u>l.to)&&(u=c),yC=e.text.slice(Math.min(s,u),Math.max(s,u));let h=a==(o?t.length-1:0)?null:t[a+(o?1:-1)];return h&&u==c&&h.level+(o?0:1)<l.level?Ix.cursor(h.side(!o,n)+e.from,h.forward(o,n)?1:-1,h.level):Ix.cursor(u+e.from,l.forward(o,n)?-1:1,l.level)}function _C(e,t,n){for(let i=t;i<n;i++){let t=uC(e.charCodeAt(i));if(1==t)return iC;if(2==t||4==t)return oC}return iC}const xC=Bx.define(),OC=Bx.define(),wC=Bx.define(),CC=Bx.define(),kC=Bx.define(),EC=Bx.define(),SC=Bx.define(),$C=Bx.define(),PC=Bx.define(),TC=Bx.define({combine:e=>e.some((e=>e))}),RC=Bx.define({combine:e=>e.some((e=>e))}),AC=Bx.define();class MC{constructor(e,t="nearest",n="nearest",i=5,o=5,r=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=o,this.isSnapshot=r}map(e){return e.empty?this:new MC(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new MC(Ix.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const DC=gO.define({map:(e,t)=>e.map(t)}),LC=gO.define();function IC(e,t,n){let i=e.facet(CC);i.length?i[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const QC=Bx.define({combine:e=>!e.length||e[0]});let jC=0;const BC=Bx.define({combine:e=>e.filter(((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0}))});class NC{constructor(e,t,n,i,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(BC.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(BC.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:o,decorations:r}=t||{};return new NC(jC++,e,n,i,(e=>{let t=[];return r&&t.push(XC.of((t=>{let n=t.plugin(e);return n?r(n):Sw.none}))),o&&t.push(o(e)),t}))}static fromClass(e,t){return NC.define(((t,n)=>new e(t,n)),t)}}class qC{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(IC(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){IC(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){IC(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const FC=Bx.define(),VC=Bx.define(),XC=Bx.define(),zC=Bx.define(),YC=Bx.define(),WC=Bx.define(),HC=Bx.define();function UC(e,t){let n=e.state.facet(HC);if(!n.length)return n;let i=n.map((t=>t instanceof Function?t(e):t)),o=[];return MO.spans(i,t.from,t.to,{point(){},span(e,n,i,r){let s=e-t.from,a=n-t.from,l=o;for(let e=i.length-1;e>=0;e--,r--){let n,o=i[e].spec.bidiIsolate;if(null==o&&(o=_C(t.text,s,a)),r>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==o)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:o,inner:[]};l.push(e),l=e.inner}}}}),o}const GC=Bx.define();function ZC(e){let t=0,n=0,i=0,o=0;for(let r of e.state.facet(GC)){let s=r(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(i=Math.max(i,s.top)),null!=s.bottom&&(o=Math.max(o,s.bottom)))}return{left:t,right:n,top:i,bottom:o}}const KC=Bx.define();class JC{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new JC(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let i=0,o=0,r=0;;){let s=i<e.length?e[i].fromB:1e9,a=o<t.length?t[o]:1e9,l=Math.min(s,a);if(1e9==l)break;let c=l+r,u=l,h=c;for(;;)if(o<t.length&&t[o]<=u){let n=t[o+1];o+=2,u=Math.max(u,n);for(let t=i;t<e.length&&e[t].fromB<=u;t++)r=e[t].toA-e[t].toB;h=Math.max(h,n+r)}else{if(!(i<e.length&&e[i].fromB<=u))break;{let t=e[i++];u=Math.max(u,t.toB),h=Math.max(h,t.toA),r=t.toA-t.toB}}n.push(new JC(c,h,l,u))}return n}}class ek{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=$x.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges(((e,t,n,o)=>i.push(new JC(e,t,n,o)))),this.changedRanges=i}static create(e,t,n){return new ek(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}const tk=[];class nk{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return tk}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;null==t[i]&&e.removeAttribute(i)}for(let n in t){let i=t[n];"style"==n?e.style.cssText=i:e.getAttribute(n)!=i&&e.setAttribute(n,i)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Bw(this.dom),i=this.length?e>0:t>0;return new tC(this.parent.dom,n+(i?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof rk)return e;return null}static get(e){return e.cmTile}}class ik extends nk{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,i=null,o=(null==e?void 0:e.node)==n?e:null,r=0;for(let s of this.children){if(s.sync(e),r+=s.length+s.breakAfter,t=i?i.nextSibling:n.firstChild,o&&t!=s.dom&&(o.written=!0),s.dom.parentNode==n)for(;t&&t!=s.dom;)t=ok(t);else n.insertBefore(s.dom,t);i=s.dom}for(t=i?i.nextSibling:n.firstChild,o&&t&&(o.written=!0);t;)t=ok(t);this.length=r}}function ok(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class rk extends ik{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=nk.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,o=0;;)if(i==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&o++,i=t.pop()}else{let r=n.children[i++];if(r instanceof sk)t.push(i),n=r,i=0;else{let t=o+r.length,n=e(r,o);if(void 0!==n)return n;o=t+r.breakAfter}}}resolveBlock(e,t){let n,i,o=-1,r=-1;if(this.blockTiles(((s,a)=>{let l=a+s.length;if(e>=a&&e<=l){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(n=void 0)}(a<e||e==l&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget())&&(n=s,o=e-a),(l>e||e==a&&(t>1?s.length:s.covers(-1)))&&(!i||!s.isWidget()&&i.isWidget())&&(i=s,r=e-a)}})),!n&&!i)throw new Error("No tile at position "+e);return n&&t<0||!i?{tile:n,offset:o}:{tile:i,offset:r}}}class sk extends ik{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new sk(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ak extends ik{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new ak(t||document.createElement("div"),e);return t&&n||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,o=-1,r=null,s=-1;!function e(a,l){for(let c=0,u=0;c<a.children.length&&u<=l;c++){let h=a.children[c],d=u+h.length;d>=l&&(h.isComposite()?e(h,l-u):(!r||r.isHidden&&(t>0||n&&lk(r,h)))&&(d>l||32&h.flags)?(r=h,s=l-u):(u<l||16&h.flags&&!h.isHidden)&&(i=h,o=l-u)),u=d}}(this,e);let a=(t<0?i:r)||i||r;return a?{tile:a,offset:a==i?o:s}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Qw(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:i}=n;if(this.dom.contains(e.dom))return e.isText()?new tC(e.dom,Math.min(e.dom.nodeValue.length,i)):e.domPosFor(i,16&e.flags?1:32&e.flags?-1:t);let o=n.tile.parent,r=!1;for(let e of o.children){if(r)return new tC(e.dom,0);e==n.tile&&(r=!0)}}return new tC(this.dom,0)}}function lk(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class ck extends ik{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new ck(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class uk extends nk{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let i=e,o=e,r=0;0==e&&t<0||e==n&&t>=0?bw.chrome||bw.gecko||(e?(i--,r=1):o<n&&(o++,r=-1)):t<0?i--:o<n&&o++;let s=Gw(this.dom,i,o).getClientRects();if(!s.length)return null;let a=s[(r?r<0:t>=0)?0:s.length-1];return bw.safari&&!r&&0==a.width&&(a=Array.prototype.find.call(s,(e=>e.width))||a),r?Vw(a,r<0):a||null}static of(e,t){let n=new uk(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class hk extends nk{constructor(e,t,n,i){super(e,t,i),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return Vw(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let i=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let o=i?t.length-1:0;n=t[o],!(e>0?0==o:o==t.length-1||n.top<n.bottom);o+=i?-1:1);return Vw(n,!i)}}get overrideDOMText(){if(!this.length)return hx.empty;let{root:e}=this;if(!e)return hx.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,o){return o||(o=e.toDOM(t),e.editable||(o.contentEditable="false")),new hk(o,n,e,i)}}class dk extends nk{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!1}get overrideDOMText(){return hx.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class pk{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:o,beforeBreak:r,parents:s}=this;for(;e||t>0;)if(i.isComposite())if(r){if(!e)break;n&&n.break(),e--,r=!1}else if(o==i.children.length){if(!e&&!s.length)break;n&&n.leave(i),r=!!i.breakAfter,({tile:i,index:o}=s.pop()),o++}else{let a=i.children[o],l=a.breakAfter;!(t>0?a.length<=e:a.length<e)||n&&!1===n.skip(a,0,a.length)&&a.isComposite?(s.push({tile:i,index:o}),i=a,o=0,n&&a.isComposite()&&n.enter(a)):(r=!!l,o++,e-=a.length)}else if(o==i.length)r=!!i.breakAfter,({tile:i,index:o}=s.pop()),o++;else{if(!e)break;{let t=Math.min(e,i.length-o);n&&n.skip(i,o,o+t),e-=t,o+=t}}return this.tile=i,this.index=o,this.beforeBreak=r,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class fk{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class gk{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var o;this.flushBuffer();let r=this.ensureMarks(t,n),s=r.lastChild;if(!s||!s.isText()||8&s.flags)r.append(i||uk.of(e,null===(o=this.cache.find(uk))||void 0===o?void 0:o.dom));else{this.cache.reused.set(s,2),(r.children[r.children.length-1]=new uk(s.dom,s.text+e)).parent=r}this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?Ok(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],o=i.lastChild;if(o instanceof ck&&o.mark.eq(n.mark))o.dom!=n.dom&&o.setDOM(Ok(n.dom)),i=o;else{if(this.cache.reused.get(n)){let e=nk.get(n.dom);e&&e.setDOM(Ok(n.dom))}let e=ck.of(n.mark,n.dom);i.append(e),i=e}this.cache.reused.set(n,2)}let o=new uk(e.text,e.text.nodeValue);o.flags|=8,i.append(o)}addInlineWidget(e,t,n){let i=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);i||this.flushBuffer();let o=this.ensureMarks(t,n);i||16&e.flags||o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=xk);let i=ak.start(e,t||(null===(n=this.cache.find(ak))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let o=e.length-1;o>=0;o--){let r,s=e[o];if(t>0&&(r=i.lastChild)&&r instanceof ck&&r.mark.eq(s))i=r,t--;else{let e=ck.of(s,null===(n=this.cache.find(ck,(e=>e.mark.eq(s))))||void 0===n?void 0:n.dom);i.append(e),i=e,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&_k(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||bw.ios&&_k(this.curLine,!0))||this.curLine.append(this.cache.findWidget(Ck,0,32)||new hk(Ck.toDOM(),0,Ck,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new fk(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof sk&&i.wrapper.eq(n.wrapper))t=i;else{let i=sk.of(n.wrapper,null===(e=this.cache.find(sk,(e=>e.wrapper.eq(n.wrapper))))||void 0===e?void 0:e.dom);t.append(i),t=i}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(dk,void 0,1);return n&&(n.flags=t),n||new dk(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class mk{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skipCount);if(this.skipCount=0,i)throw new Error("Ran out of text content when drawing inline views");this.text=t;let o=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,o)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const vk=[hk,ak,uk,ck,dk,sk,rk];for(let e=0;e<vk.length;e++)vk[e].bucket=e;class yk{constructor(e){this.view=e,this.buckets=vk.map((()=>[])),this.index=vk.map((()=>0)),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,o=this.buckets[i],r=this.index[i];for(let e=o.length-1;e>=0;e--){let s=(e+r)%o.length,a=o[s];if((!t||t(a))&&!this.reused.has(a))return o.splice(s,1),s<r&&this.index[i]--,this.reused.set(a,n),a}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let o=0,r=0;;o++){if(o==i.length){if(r)return null;r=1,o=0}let s=i[o];if(!this.reused.has(s)&&(0==r?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view)))return i.splice(o,1),o<this.index[0]&&this.index[0]--,this.reused.set(s,1),s.length=t,s.flags=-498&s.flags|n,s}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}}class bk{constructor(e,t,n,i,o){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new yk(e),this.text=new mk(e.state.doc),this.builder=new gk(this.cache,new rk(e,e.contentDOM),MO.iter(n)),this.cache.reused.set(t,2),this.old=new pk(t)}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,o=0,r=0;;){let s=r<e.length?e[r++]:null,a=s?s.fromA:this.old.root.length;if(a>i){let e=a-i;this.preserve(e,!r,!s),i=a,o+=e}if(!s)break;this.forward(s.fromA,s.toA),t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.emit(o,t.range.fromB),this.builder.addComposition(t,n),this.emit(t.range.toB,s.toB)):this.emit(o,s.toB),o=s.toB,i=s.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let i=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;i instanceof ck&&t.push(i.mark)}return t}(this.old),o=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let r=n>0||t<e.length?hk.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&r.flags?(r.flags&=-2,this.builder.addBlockWidget(r)):(this.builder.ensureLine(null),this.builder.addInlineWidget(r,i,o),o=i.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),i,o)):this.builder.addText(e.text,i,o,this.cache.reuse(e)),o=i.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof dk)this.cache.add(e);else{if(!(e instanceof ck))return!1;this.builder.ensureLine(null),this.builder.addMark(e,i,o),this.cache.reused.set(e,1),o=i.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof ck&&i.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?i.length&&(i.length=o=0):e instanceof ck&&(i.shift(),o=Math.min(o,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,o=0,r=MO.spans(this.decorations,e,t,{point:(e,t,r,s,a,l)=>{if(r instanceof Tw){if(this.disallowBlockEffectsFor[l]){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=s.length,a>s.length)i.continueWidget(t-e);else{let o=r.widget||(r.block?wk.block:wk.inline),l=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;e.block&&(t|=256);return t}(r),c=this.cache.findWidget(o,t-e,l)||hk.of(o,this.view,t-e,l);r.block?(r.startSide>0&&i.addLineStartIfNotCovered(n),i.addBlockWidget(c)):(i.ensureLine(n),i.addInlineWidget(c,s,a))}n=null}else n=function(e,t){let n=t.spec.attributes,i=t.spec.class;if(!n&&!i)return e;e||(e={class:"cm-line"});n&&_w(n,e);i&&(e.class+=" "+i);return e}(n,r);t>e&&this.text.skip(t-e)},span:(e,t,o,r)=>{for(let s=e;s<t;){let e=this.text.next(Math.min(512,t-s));null==e?(i.addLineStartIfNotCovered(n),i.addBreak(),s++):(i.ensureLine(n),i.addText(e,o,r),s+=e.length),n=null}}});i.addLineStartIfNotCovered(n),this.openWidget=r>o,this.openMarks=r}forward(e,t){this.old.advance(t-e,1,{skip:(e,t,n)=>{(e.isText()||n==e.length)&&this.cache.add(e)},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}})}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let e=nk.get(i);if(i==this.view.contentDOM)break;e instanceof ck?t.push(e):(null==e?void 0:e.isLine())?n=e:"DIV"!=i.nodeName||n||i==this.view.contentDOM?t.push(ck.of(new $w({tagName:i.nodeName.toLowerCase(),attributes:Cw(i)}),i)):n=new ak(i,xk)}return{line:n,marks:t}}}function _k(e,t){let n=e=>{for(let i of e.children)if((t?i.isText():i.length)||n(i))return!0;return!1};return n(e)}const xk={class:"cm-line"};function Ok(e){let t=nk.get(e);return t&&t.setDOM(e.cloneNode()),e}class wk extends kw{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}wk.inline=new wk("span"),wk.block=new wk("div");const Ck=new class extends kw{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class kk{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Sw.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new rk(e,e.contentDOM),this.updateInner([new JC(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every((({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges(((e,i)=>{e<t.to&&i>t.from&&(n=!0)}));return n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let o=i>-1?function(e,t,n){let i=Sk(e,n);if(!i)return null;let{node:o,from:r,to:s}=i,a=o.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc;return{range:new JC(l.mapPos(r),l.mapPos(s),r,s),text:o}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:i}=this.hasComposition;n=new JC(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(bw.ie||bw.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let r=this.decorations,s=this.blockWrappers;this.updateDeco();let a=function(e,t,n){let i=new $k;return MO.compare(e,t,n,i),i.changes}(r,this.decorations,e.changes);a.length&&(n=JC.extendWithRanges(n,a));let l=function(e,t,n){let i=new Pk;return MO.compare(e,t,n,i),i.changes}(s,this.blockWrappers,e.changes);return l.length&&(n=JC.extendWithRanges(n,l)),o&&!n.some((e=>e.fromA<=o.range.fromA&&e.toA>=o.range.toA))&&(n=o.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length)&&(this.updateInner(n,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore((()=>{if(t||e.length){let n=this.tile,i=new bk(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=i.run(e,t),Ek(n,i.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=bw.chrome||bw.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),!i||!i.written&&n.selectionRange.focusNode==i.node&&this.tile.dom.contains(i.node)||(this.forceSelection=!0),this.tile.dom.style.height=""}));let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Tk&&i.push(e.dom);n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(LC)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,o=i==n,r=!o&&!(this.view.state.facet(QC)||n.tabIndex>-1)&&Iw(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(o||t||r))return;let s=this.forceSelection;this.forceSelection=!1;let a,l,c=this.view.state.selection.main;if(c.empty?l=a=this.inlineDOMNearPos(c.anchor,c.assoc||1):(l=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),a=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),bw.gecko&&c.empty&&!this.hasComposition&&(1==(u=a).node.nodeType&&u.node.firstChild&&(0==u.offset||"false"==u.node.childNodes[u.offset-1].contentEditable)&&(u.offset==u.node.childNodes.length||"false"==u.node.childNodes[u.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null))),a=l=new tC(e,0),s=!0}var u;let h=this.view.observer.selectionRange;!s&&h.focusNode&&(jw(a.node,a.offset,h.anchorNode,h.anchorOffset)&&jw(l.node,l.offset,h.focusNode,h.focusOffset)||this.suppressWidgetCursorChange(h,c))||(this.view.observer.ignore((()=>{bw.android&&bw.chrome&&n.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Dw(this.view.root);if(e)if(c.empty){if(bw.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0)}(a.node,a.offset);if(e&&3!=e){let t=(1==e?Jw:eC)(a.node,a.offset);t&&(a=new tC(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch(e){}}else{let t=document.createRange();c.anchor>c.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;r&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new tC(h.anchorNode,h.anchorOffset),this.impreciseHead=l.precise?null:new tC(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&jw(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Dw(e.root),{anchorNode:i,anchorOffset:o}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let r=this.lineAt(t.head,t.assoc);if(!r)return;let s=r.posAtStart;if(t.head==s||t.head==s+r.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(i,o)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let i=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?i+t:i+(t?n.length:0):i;{let o;if(e==n.dom)o=n.dom.childNodes[t];else{let i=0==Fw(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}o=i<0?e:e.nextSibling}if(o==n.dom.firstChild)return i;for(;o&&!nk.get(o);)o=o.nextSibling;if(!o)return i+n.length;for(let e=0,t=i;;e++){let i=n.children[e];if(i.dom==o)return t;t+=i.length+i.breakAfter}}}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i,o=-1,r=!1,s=-1,a=!1;return this.tile.blockTiles(((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(r=!0)}else{let c=l+t.length;if(l<=e&&(n=t,o=e-l,r=c<e),c>=e&&!i&&(i=t,s=e-l,a=l>e),l>e&&i)return!0}})),n||i?(r&&i?n=null:a&&n&&(i=null),n&&t<0||!i?n.domIn(o,t):i.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof Tk?null:n.coordsInWidget(i,t,!0):n.coordsIn(i,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;return function e(t,n){if(t.isComposite())for(let i of t.children){if(i.length>=n){let t=e(i,n);if(t)return t}if((n-=i.length)<0)break}else if(t.isText()&&n<t.length){let e=xx(t.text,n);if(e==n)return null;let i=Gw(t.dom,n,e).getClientRects();for(let e=0;e<i.length;e++){let t=i[e];if(e==i.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,o=this.view.contentDOM.clientWidth,r=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==nC.LTR,l=0,c=(e,u,h)=>{for(let d=0;d<e.children.length&&!(u>i);d++){let i=e.children[d],p=u+i.length,f=i.dom.getBoundingClientRect(),{height:g}=f;if(h&&!d&&(l+=f.top-h.top),i instanceof sk)p>n&&c(i,u,f);else if(u>=n&&(l>0&&t.push(-l),t.push(g+l),l=0,r)){let e=i.dom.lastChild,t=e?Qw(e):[];if(t.length){let e=t[t.length-1],n=a?e.right-f.left:f.right-e.left;n>s&&(s=n,this.minWidth=o,this.minWidthFrom=u,this.minWidthTo=p)}}h&&d==e.children.length-1&&(l+=h.bottom-f.bottom),u=p+i.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?nC.RTL:nC.LTR}measureTextSize(){let e=this.tile.blockTiles((e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let i of e.children){if(!i.isText()||/[^ -~]/.test(i.text))return;let e=Qw(i.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}}));if(e)return e;let t,n,i,o=document.createElement("div");return o.className="cm-line",o.style.width="99999px",o.style.position="absolute",o.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.tile.dom.appendChild(o);let e=Qw(o.firstChild)[0];t=o.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,i=e&&e.height?e.height:t,o.remove()})),{lineHeight:t,charWidth:n,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let o=i==t.viewports.length?null:t.viewports[i],r=o?o.from-1:this.view.state.doc.length;if(r>n){let i=(t.lineBlockAt(r).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Sw.replace({widget:new Tk(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))}if(!o)break;n=o.to+1}return Sw.set(e)}updateDeco(){let e=1,t=this.view.state.facet(XC).map((t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t)),n=!1,i=this.view.state.facet(YC).map(((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e}));for(i.length&&(this.dynamicDecorationMap[e++]=n,t.push(MO.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(zC).map((e=>"function"==typeof e?e(this.view):e))}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(AC))try{if(t(this.view,e.range,e))return!0}catch(e){IC(this.view.state,e,"scroll handler")}let t,{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let o=ZC(this.view),r={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,i,o,r,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,h=!1;u&&!h;)if(1==u.nodeType){let e,d=u==l.body,p=1,f=1;if(d)e=Xw(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:p,scaleY:f}=zw(u,t)),e={left:t.left,right:t.left+u.clientWidth*p,top:t.top,bottom:t.top+u.clientHeight*f}}let g=0,m=0;if("nearest"==o)t.top<e.top?(m=t.top-(e.top+s),n>0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+s,n<0&&t.top-m<e.top&&(m=t.top-(e.top+s)));else{let i=t.bottom-t.top,r=e.bottom-e.top;m=("center"==o&&i<=r?t.top+i/2-r/2:"start"==o||"center"==o&&n<0?t.top-s:t.bottom-r+s)-e.top}if("nearest"==i?t.left<e.left?(g=t.left-(e.left+r),n>0&&t.right>e.right+g&&(g=t.right-e.right+r)):t.right>e.right&&(g=t.right-e.right+r,n<0&&t.left<e.left+g&&(g=t.left-(e.left+r))):g=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==a?t.left-r:t.right-(e.right-e.left)+r)-e.left,g||m)if(d)c.scrollBy(g,m);else{let e=0,n=0;if(m){let e=u.scrollTop;u.scrollTop+=m/f,n=(u.scrollTop-e)*f}if(g){let t=u.scrollLeft;u.scrollLeft+=g/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-g)<1&&(i="nearest"),n&&Math.abs(n-m)<1&&(o="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else{if(11!=u.nodeType)break;u=u.host}}(this.view.scrollDOM,r,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==nC.LTR)}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Ek(this.tile)}}function Ek(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)Ek(n,t)}}function Sk(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=Jw(n.focusNode,n.focusOffset),o=eC(n.focusNode,n.focusOffset),r=i||o;if(o&&i&&o.node!=i.node){let t=nk.get(o.node);if(!t||t.isText()&&t.text!=o.node.nodeValue)r=o;else if(e.docView.lastCompositionAfterCursor){let e=nk.get(i.node);!e||e.isText()&&e.text!=i.node.nodeValue||(r=o)}}if(e.docView.lastCompositionAfterCursor=r!=i,!r)return null;let s=t-r.offset;return{from:s,to:s+r.node.nodeValue.length,node:r.node}}let $k=class{constructor(){this.changes=[]}compareRange(e,t){Aw(e,t,this.changes)}comparePoint(e,t){Aw(e,t,this.changes)}boundChange(e){Aw(e,e,this.changes)}};class Pk{constructor(){this.changes=[]}compareRange(e,t){Aw(e,t,this.changes)}comparePoint(){}boundChange(e){Aw(e,e,this.changes)}}class Tk extends kw{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Rk(e,t,n,i,o){let r=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;r+=Math.floor((o-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+function(e,t,n,i){for(let i=0,o=0;;){if(o>=t)return i;if(i==e.length)break;o+=9==e.charCodeAt(i)?n-o%n:1,i=xx(e,i)}return!0===i?-1:e.length}(s,r,e.state.tabSize)}function Ak(e,t,n,i){let o=function(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let e;for(let o of i.type){if(o.from>t)break;if(!(o.to<t)){if(o.from<t&&o.to>t)return o;e&&(o.type!=Ew.Text||e.type==o.type&&!(n<0?o.from<t:o.to>t))||(e=o)}}return e||i}return i}(e,t.head,t.assoc||-1),r=i&&o.type==Ew.Text&&(e.lineWrapping||o.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>o.from?t.head-1:t.head):null;if(r){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(o.from),s=e.posAtCoords({x:n==(i==nC.LTR)?t.right-1:t.left+1,y:(r.top+r.bottom)/2});if(null!=s)return Ix.cursor(s,n?-1:1)}return Ix.cursor(n?o.to:o.from,n?-1:1)}function Mk(e,t,n,i){let o=e.state.doc.lineAt(t.head),r=e.bidiSpans(o),s=e.textDirectionAt(o.from);for(let a=t,l=null;;){let t=bC(o,r,s,a,n),c=yC;if(!t){if(o.number==(n?e.state.doc.lines:1))return a;c="\n",o=e.state.doc.line(o.number+(n?1:-1)),r=e.bidiSpans(o),t=e.visualLineSide(o,!n)}if(l){if(!l(c))return a}else{if(!i)return t;l=i(c)}a=t}}function Dk(e,t,n){for(;;){let i=0;for(let o of e)o.between(t-1,t+1,((e,o,r)=>{if(t>e&&t<o){let r=i||n||(t-e<o-t?-1:1);t=r<0?e:o,i=r}}));if(!i)return t}}function Lk(e,t){let n=null;for(let i=0;i<t.ranges.length;i++){let o=t.ranges[i],r=null;if(o.empty){let t=Dk(e,o.from,0);t!=o.from&&(r=Ix.cursor(t,-1))}else{let t=Dk(e,o.from,-1),n=Dk(e,o.to,1);t==o.from&&n==o.to||(r=Ix.range(o.from==o.anchor?t:n,o.from==o.head?t:n))}r&&(n||(n=t.ranges.slice()),n[i]=r)}return n?Ix.create(n,t.mainIndex):t}function Ik(e,t,n){let i=Dk(e.state.facet(WC).map((t=>t(e))),n.from,t.head>n.from?-1:1);return i==n.from?n:Ix.cursor(i,i<n.from?1:-1)}class Qk{constructor(e,t){this.pos=e,this.assoc=t}}function jk(e,t,n,i){let o,r=e.contentDOM.getBoundingClientRect(),s=r.top+e.viewState.paddingTop,{x:a,y:l}=t,c=l-s;for(;;){if(c<0)return new Qk(0,1);if(c>e.viewState.docHeight)return new Qk(e.state.doc.length,-1);if(o=e.elementAtHeight(c),null==i)break;if(o.type==Ew.Text){let t=e.docView.coordsAt(i<0?o.from:o.to,i);if(t&&(i<0?t.top<=c+s:t.bottom>=c+s))break}let t=e.viewState.heightOracle.textHeight/2;c=i>0?o.bottom+t:o.top-t}if(e.viewport.from>=o.to||e.viewport.to<=o.from){if(n)return null;if(o.type==Ew.Text){let t=Rk(e,r,o,a,l);return new Qk(t,t==o.from?1:-1)}}if(o.type!=Ew.Text)return c<(o.top+o.bottom)/2?new Qk(o.from,1):new Qk(o.to,-1);let u=e.docView.lineAt(o.from,2);return u&&u.length==o.length||(u=e.docView.lineAt(o.from,-2)),Bk(e,u,o.from,a,l)}function Bk(e,t,n,i,o){let r=-1,s=null,a=1e9,l=1e9,c=o,u=o,h=(e,t)=>{for(let n=0;n<e.length;n++){let h=e[n];if(h.top==h.bottom)continue;let d=h.left>i?h.left-i:h.right<i?i-h.right:0,p=h.top>o?h.top-o:h.bottom<o?o-h.bottom:0;h.top<=u&&h.bottom>=c&&(c=Math.min(h.top,c),u=Math.max(h.bottom,u),p=0),(r<0||(p-l||d-a)<0)&&(r>=0&&l&&a<d&&s.top<=u-2&&s.bottom>=c+2?l=0:(r=t,a=d,l=p,s=h))}};if(t.isText()){for(let e=0;e<t.length;){let n=xx(t.text,e);if(h(Gw(t.dom,e,n).getClientRects(),e),!a&&!l)break;e=n}return i>(s.left+s.right)/2==(Nk(e,r+n)==nC.LTR)?new Qk(n+xx(t.text,r),-1):new Qk(n+r,1)}{if(!t.length)return new Qk(n,1);for(let e=0;e<t.children.length;e++){let n=t.children[e];if(!(48&n.flags)&&(h((1==n.dom.nodeType?n.dom:Gw(n.dom,0,n.length)).getClientRects(),e),!a&&!l))break}let c=t.children[r],u=t.posBefore(c,n);return c.isComposite()||c.isText()?Bk(e,c,u,Math.max(s.left,Math.min(s.right,i)),o):i>(s.left+s.right)/2==(Nk(e,r+n)==nC.LTR)?new Qk(u+c.length,-1):new Qk(u,1)}}function Nk(e,t){let n=e.state.doc.lineAt(t);return e.bidiSpans(n)[dC.find(e.bidiSpans(n),t-n.from,-1,1)].dir}const qk="";class Fk{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(SO.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=qk}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let o=nk.get(i),r=i.nextSibling;if(r==t){(null==o?void 0:o.breakAfter)&&!r&&this.lineBreak();break}let s=nk.get(r);(o&&s?o.breakAfter:(o?o.breakAfter:Nw(i))||Nw(r)&&("BR"!=i.nodeName||(null==o?void 0:o.isWidget()))&&this.text.length>e)&&!Xk(r,t)&&this.lineBreak(),i=r}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let o,r=-1,s=1;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(o=i.exec(t))&&(r=o.index,s=o[0].length),this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=r+s}}readNode(e){let t=nk.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Vk(e,n.node,n.offset)?t:0))}}function Vk(e,t,n){for(;;){if(!t||n<Fw(t))return!1;if(t==e)return!0;n=Bw(t)+1,t=t.parentNode}}function Xk(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=nk.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class zk{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Yk{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:r}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Wk(e.docView.tile,t,n,0))){let t=o||r?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:o,focusOffset:r}=e.observer.selectionRange;n&&(t.push(new zk(n,i)),o==n&&r==i||t.push(new zk(o,r)));return t}(e),n=new Fk(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?Ix.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=o&&o.node==t.focusNode&&o.offset==t.focusOffset||!Lw(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=r&&r.node==t.anchorNode&&r.offset==t.anchorOffset||!Lw(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((bw.ios||bw.chrome)&&e.state.selection.main.empty&&n!=i&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,i),o=Math.max(n,i),r=s.from-t,a=s.to-o;0!=r&&1!=r&&0!=t||0!=a&&-1!=a&&o!=e.state.doc.length||(n=0,i=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ix.range(i,n)):this.newSel=Ix.single(i,n)}}}function Wk(e,t,n,i){if(e.isComposite()){let o=-1,r=-1,s=-1,a=-1;for(let l=0,c=i,u=i;l<e.children.length;l++){let i=e.children[l],h=c+i.length;if(c<t&&h>n)return Wk(i,t,n,c);if(h>=t&&-1==o&&(o=l,r=c),c>n&&i.dom.parentNode==e.dom){s=l,a=u;break}u=h,c=h+i.breakAfter}return{from:r,to:a<0?i+e.length:a,startDOM:(o?e.children[o-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Hk(e,t){let n,{newSel:i}=t,o=e.state.selection.main,r=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:i,to:s}=t.bounds,a=o.from,l=null;(8===r||bw.android&&t.text.length<s-i)&&(a=o.to,l="end");let c=Gk(e.state.doc.sliceString(i,s,qk),t.text,a-i,l);c&&(bw.chrome&&13==r&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==qk+qk&&c.toB--,n={from:i+c.from,to:i+c.toA,insert:hx.of(t.text.slice(c.from,c.toB).split(qk))})}else i&&(!e.hasFocus&&e.state.facet(QC)||i.main.eq(o))&&(i=null);if(!n&&!i)return!1;if(!n&&t.typeOver&&!o.empty&&i&&i.main.empty?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:(bw.mac||bw.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Ix.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:hx.of([n.insert.toString().replace("."," ")])}):n&&n.from>=o.from&&n.to<=o.to&&(n.from!=o.from||n.to!=o.to)&&o.to-o.from-(n.to-n.from)<=4?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,o.to))}:e.state.doc.lineAt(o.from).to<o.to&&e.docView.lineHasWidget(o.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:o.from,to:o.to,insert:e.state.toText(e.inputState.insertingText)}:bw.chrome&&n&&n.from==n.to&&n.from==o.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Ix.single(i.main.anchor-1,i.main.head-1)),n={from:o.from,to:o.to,insert:hx.of([" "])}),n)return Uk(e,n,i,r);if(i&&!i.main.eq(o)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(i=Lk(e.state.facet(WC).map((t=>t(e))),i))),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}function Uk(e,t,n,i=-1){if(bw.ios&&e.inputState.flushIOSKey(t))return!0;let o=e.state.selection.main;if(bw.android&&(t.to==o.to&&(t.from==o.from||t.from==o.from-1&&" "==e.state.sliceDoc(t.from,o.from))&&1==t.insert.length&&2==t.insert.lines&&Zw(e.contentDOM,"Enter",13)||(t.from==o.from-1&&t.to==o.to&&0==t.insert.length||8==i&&t.insert.length<t.to-t.from&&t.to>o.head)&&Zw(e.contentDOM,"Backspace",8)||t.from==o.from&&t.to==o.to+1&&0==t.insert.length&&Zw(e.contentDOM,"Delete",46)))return!0;let r,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>r||(r=function(e,t,n){let i,o=e.state,r=o.selection.main,s=-1;if(t.from==t.to&&t.from<r.from||t.from>r.to){let n=t.from<r.from?-1:1,i=n<0?r.from:r.to,a=Dk(o.facet(WC).map((t=>t(e))),i,n);t.from==a&&(s=a)}if(s>-1)i={changes:t,selection:Ix.cursor(t.from+t.insert.length,-1)};else if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=r.from<t.from?o.sliceDoc(r.from,t.from):"",s=r.to>t.to?o.sliceDoc(t.to,r.to):"";i=o.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=o.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(o.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=r.to+10&&t.to>=r.to-10){let l,c=e.state.sliceDoc(t.from,t.to),u=n&&Sk(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(r.head);let h=r.to-t.to;i=o.changeByRange((n=>{if(n.from==r.from&&n.to==r.to)return{changes:s,range:a||n.map(s)};let i=n.to-h,u=i-c.length;if(e.state.sliceDoc(u,i)!=c||i>=l.from&&u<=l.to)return{range:n};let d=o.changes({from:u,to:i,insert:t.insert}),p=n.to-r.to;return{changes:d,range:a?Ix.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):n.map(d)}}))}else i={changes:s,selection:a&&o.selection.replaceRange(a)}}let a="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1));return o.update(i,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(EC).some((n=>n(e,t.from,t.to,s,a)))||e.dispatch(a()),!0}function Gk(e,t,n,i){let o=Math.min(e.length,t.length),r=0;for(;r<o&&e.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==o&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==i){n-=s+Math.max(0,r-Math.min(s,a))-r}if(s<r&&e.length<t.length){r-=n<=r&&n>=s?r-n:0,a=r+(a-s),s=r}else if(a<r){r-=n<=r&&n>=a?r-n:0,s=r+(s-a),a=r}return{from:r,toA:s,toB:a}}class Zk{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,bw.safari&&e.contentDOM.addEventListener("input",(()=>null)),bw.gecko&&function(e){xE.has(e)||(xE.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=nk.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then((()=>this.runHandlers(e.type,e))):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Jk(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let o=!t[e].handlers.length,r=n[e];r&&o!=!r.handlers.length&&(i.removeEventListener(e,this.handleEvent),r=null),r||i.addEventListener(e,this.handleEvent,{passive:o})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&nE.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),bw.android&&bw.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!bw.ios||e.synthetic||e.altKey||e.metaKey||!((t=eE.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||tE.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&(!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,Zw(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0)))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(bw.safari&&!bw.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Kk(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){IC(n.state,e)}}}function Jk(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,i=e&&e.plugin.domEventHandlers,o=e&&e.plugin.domEventObservers;if(i)for(let e in i){let o=i[e];o&&n(e).handlers.push(Kk(t.value,o))}if(o)for(let e in o){let i=o[e];i&&n(e).observers.push(Kk(t.value,i))}}for(let e in rE)n(e).handlers.push(rE[e]);for(let e in sE)n(e).observers.push(sE[e]);return t}const eE=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],tE="dthko",nE=[16,17,18,20,91,92,224,225];function iE(e){return.7*Math.max(0,e)+8}class oE{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,i=e.ownerDocument;for(let o=e.parentNode;o&&!(o==i.body||t&&n);)if(1==o.nodeType)!n&&o.scrollHeight>o.clientHeight&&(n=o),!t&&o.scrollWidth>o.clientWidth&&(t=o),o=o.assignedSlot||o.parentNode;else{if(11!=o.nodeType)break;o=o.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(WC).map((t=>t(e)));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(SO.allowMultipleSelections)&&function(e,t){let n=e.state.facet(xC);return n.length?n[0](t):bw.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=Dw(e.root);if(!i||0==i.rangeCount)return!0;let o=i.getRangeAt(0).getClientRects();for(let e=0;e<o.length;e++){let n=o[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=gE(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&function(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,i=0,o=0,r=this.view.win.innerWidth,s=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:r}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:s}=this.scrollParents.y.getBoundingClientRect());let a=ZC(this.view);e.clientX-a.left<=i+6?t=-iE(i-e.clientX):e.clientX+a.right>=r-6&&(t=iE(e.clientX-r)),e.clientY-a.top<=o+6?n=-iE(o-e.clientY):e.clientY+a.bottom>=s-6&&(n=iE(e.clientY-s)),this.setScrollSpeed(t,n)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Lk(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some((e=>e.isUserEvent("input.type")))?this.destroy():this.style.update(e)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const rE=Object.create(null),sE=Object.create(null),aE=bw.ie&&bw.ie_version<15||bw.ios&&bw.webkit_version<604;function lE(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function cE(e,t){t=lE(e.state,$C,t);let n,{state:i}=e,o=1,r=i.toText(t),s=r.lines==i.selection.ranges.length,a=null!=vE&&i.selection.ranges.every((e=>e.empty))&&vE==r.toString();if(a){let e=-1;n=i.changeByRange((n=>{let a=i.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=i.toText((s?r.line(o++).text:t)+i.lineBreak);return{changes:{from:a.from,insert:l},range:Ix.cursor(n.from+l.length)}}))}else n=s?i.changeByRange((e=>{let t=r.line(o++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Ix.cursor(e.from+t.length)}})):i.replaceSelection(r);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function uE(e,t,n,i){if(1==i)return Ix.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),o=e.doc.lineAt(t),r=t-o.from;if(0==o.length)return Ix.cursor(t);0==r?n=1:r==o.length&&(n=-1);let s=r,a=r;n<0?s=xx(o.text,r,!1):a=xx(o.text,r);let l=i(o.text.slice(s,a));for(;s>0;){let e=xx(o.text,s,!1);if(i(o.text.slice(e,s))!=l)break;s=e}for(;a<o.length;){let e=xx(o.text,a);if(i(o.text.slice(a,e))!=l)break;a=e}return Ix.range(s+o.from,a+o.from)}(e.state,t,n);{let i=e.docView.lineAt(t,n),o=e.state.doc.lineAt(i?i.posAtEnd:t),r=i?i.posAtStart:o.from,s=i?i.posAtEnd:o.to;return s<e.state.doc.length&&s==o.to&&s++,Ix.range(r,s)}}sE.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},rE.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),sE.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},sE.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},rE.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(wC))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=gE(t),o=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),o=o.map(e.changes))},get(t,r,s){let a,l=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=uE(e,l.pos,l.assoc,i);if(n.pos!=l.pos&&!r){let t=uE(e,n.pos,n.assoc,i),o=Math.min(t.from,c.from),r=Math.max(t.to,c.to);c=o<c.from?Ix.range(o,r):Ix.range(r,o)}return r?o.replaceRange(o.main.extend(c.from,c.to)):s&&1==i&&o.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:o}=e.ranges[n];if(i<=t&&o>=t)return Ix.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(o,l.pos))?a:s?o.addRange(c):Ix.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new oE(e,t,n,i)),i&&e.observer.ignore((()=>{Uw(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()}));let o=e.inputState.mouseSelection;if(o)return o.start(t),!1===o.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const hE=bw.ie&&bw.ie_version<=11;let dE=null,pE=0,fE=0;function gE(e){if(!hE)return e.detail;let t=dE,n=fE;return dE=e,fE=Date.now(),pE=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(pE+1)%3:1}function mE(e,t,n,i){if(!(n=lE(e.state,$C,n)))return;let o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=e.inputState,s=i&&r&&function(e,t){let n=e.state.facet(OC);return n.length?n[0](t):bw.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:r.from,to:r.to}:null,a={from:o,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(o,-1),head:l.mapPos(o,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}rE.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.tile.nearest(t.target);if(i&&i.isWidget()){let e=i.posAtStart,t=e+i.length;(e>=n.to||t<=n.from)&&(n=Ix.range(e,t))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",lE(e.state,PC,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},rE.dragend=e=>(e.inputState.draggedContent=null,!1),rE.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),o=0,r=()=>{++o==n.length&&mE(e,t,i.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=r,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),r()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return mE(e,t,n,!0),!0}return!1},rE.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=aE?null:t.clipboardData;return n?(cE(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),cE(e,n.value)}),50)}(e),!1)};let vE=null;rE.copy=rE.cut=(e,t)=>{let{text:n,ranges:i,linewise:o}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let o=-1;for(let{from:i}of e.selection.ranges){let r=e.doc.lineAt(i);r.number>o&&(t.push(r.text),n.push({from:r.from,to:Math.min(e.doc.length,r.to+1)})),o=r.number}i=!0}return{text:lE(e,PC,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!o)return!1;vE=o?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=aE?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout((()=>{i.remove(),e.focus()}),50)}(e,n),!1)};const yE=dO.define();function bE(e,t){let n=[];for(let i of e.facet(SC)){let o=i(e,t);o&&n.push(o)}return n.length?e.update({effects:n,annotations:yE.of(!0)}):null}function _E(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=bE(e.state,t);n?e.dispatch(n):e.update([])}}),10)}sE.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),_E(e)},sE.blur=e=>{e.observer.clearSelectionRange(),_E(e)},sE.compositionstart=sE.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},sE.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,bw.chrome&&bw.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50))},sE.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},rE.beforeinput=(e,t)=>{var n,i;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let t=o[0],n=e.posAtDOM(t.startContainer,t.startOffset),r=e.posAtDOM(t.endContainer,t.endOffset);return Uk(e,{from:n,to:r,insert:e.state.toText(i)},null),!0}}let o;if(bw.chrome&&bw.android&&(o=eE.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(o.key,o.keyCode),"Backspace"==o.key||"Delete"==o.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return bw.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),bw.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout((()=>sE.compositionend(e,t)),20),!1};const xE=new Set;const OE=["pre-wrap","normal","pre-line","break-spaces"];let wE=!1;function CE(){wE=!1}class kE{constructor(e){this.lineWrapping=e,this.doc=hx.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return OE.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(t=!0,this.heightSamples[Math.floor(10*i)]=!0)}return t}refresh(e,t,n,i,o,r){let s=OE.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=o,a){this.heightSamples={};for(let e=0;e<r.length;e++){let t=r[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class EE{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class SE{constructor(e,t,n,i,o){this.from=e,this.length=t,this.top=n,this.height=i,this._content=o}get type(){return"number"==typeof this._content?Ew.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Tw?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new SE(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var $E=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}($E||($E={}));const PE=.001;class TE{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>PE&&(wE=!0),this.height=e)}replace(e,t,n){return TE.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let o=this,r=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:u}=i[s],h=o.lineAt(a,$E.ByPosNoHeight,n.setDoc(t),0,0),d=h.to>=l?h:o.lineAt(l,$E.ByPosNoHeight,n,0,0);for(u+=d.to-l,l=d.to;s>0&&h.from<=i[s-1].toA;)a=i[s-1].fromA,c=i[s-1].fromB,s--,a<h.from&&(h=o.lineAt(a,$E.ByPosNoHeight,n,0,0));c+=h.from-a,a=h.from;let p=jE.build(n.setDoc(r),e,c,u);o=RE(o,o.replace(a,l,p))}return o.updateHeight(n,0)}static empty(){return new DE(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,o=0;for(;;)if(t==n)if(i>2*o){let o=e[t-1];o.break?e.splice(--t,1,o.left,null,o.right):e.splice(--t,1,o.left,o.right),n+=1+o.break,i-=o.size}else{if(!(o>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,o-=t.size}}else if(i<o){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(o+=t.size)}let r=0;return null==e[t-1]?(r=1,t--):null==e[t]&&(r=1,n++),new IE(TE.of(e.slice(0,t)),r,TE.of(e.slice(n)))}}function RE(e,t){return e==t?e:(e.constructor!=t.constructor&&(wE=!0),t)}TE.prototype.size=1;const AE=Sw.replace({});class ME extends TE{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new SE(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new SE(i,0,n,this.spaceAbove,AE):this.mainBlock(n,i)}lineAt(e,t,n,i,o){let r=this.mainBlock(i,o);return this.spaceAbove?this.blockAt(0,n,i,o).join(r):r}forEachLine(e,t,n,i,o,r){e<=o+this.length&&t>=o&&r(this.lineAt(0,$E.ByPos,n,i,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class DE extends ME{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new SE(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof DE||i instanceof LE&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof LE?i=new DE(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):TE.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class LE extends TE{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,o=e.doc.lineAt(t+this.length).number,r=o-i+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*r);n=t/r,this.length>r+1&&(s=(this.height-t)/(this.length-r-1))}else n=this.height/r;return{firstLine:i,lastLine:o,perLine:n,perChar:s}}blockAt(e,t,n,i){let{firstLine:o,lastLine:r,perLine:s,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let o=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),r=t.doc.lineAt(o),l=s+r.length*a,c=Math.max(n,e-l/2);return new SE(r.from,r.length,c,l,0)}{let i=Math.max(0,Math.min(r-o,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(o+i);return new SE(a,l,n+s*i,s,0)}}lineAt(e,t,n,i,o){if(t==$E.ByHeight)return this.blockAt(e,n,i,o);if(t==$E.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new SE(t,i-t,0,0,0)}let{firstLine:r,perLine:s,perChar:a}=this.heightMetrics(n,o),l=n.doc.lineAt(e),c=s+l.length*a,u=l.number-r,h=i+s*u+a*(l.from-o-u);return new SE(l.from,l.length,Math.max(i,Math.min(h,i+this.height-c)),c,0)}forEachLine(e,t,n,i,o,r){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,o);for(let c=e,u=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;u+=a*n+l*(e-o-n)}let i=a+l*t.length;r(new SE(t.from,t.length,u,i,0)),u+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof LE?n[n.length-1]=new LE(e.length+i):n.push(null,new LE(i-1))}if(e>0){let t=n[0];t instanceof LE?n[0]=new LE(e+t.length):n.unshift(new LE(e-1),null)}return TE.of(n)}decomposeLeft(e,t){t.push(new LE(e-1),null)}decomposeRight(e,t){t.push(null,new LE(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let o=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],r=Math.max(t,i.from),s=-1;for(i.from>t&&n.push(new LE(i.from-t-1).updateHeight(e,t));r<=o&&i.more;){let t=e.doc.lineAt(r).length;n.length&&n.push(null);let o=i.heights[i.index++],a=0;o<0&&(a=-o,o=i.heights[i.index++]),-1==s?s=o:Math.abs(o-s)>=PE&&(s=-2);let l=new DE(t,o,a);l.outdated=!1,n.push(l),r+=t+1}r<=o&&n.push(null,new LE(o-r).updateHeight(e,r));let a=TE.of(n);return(s<0||Math.abs(a.height-this.height)>=PE||Math.abs(s-this.heightMetrics(e,t).perLine)>=PE)&&(wE=!0),RE(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class IE extends TE{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,o,i+this.left.length+this.break)}lineAt(e,t,n,i,o){let r=i+this.left.height,s=o+this.left.length+this.break,a=t==$E.ByHeight?e<r:e<s,l=a?this.left.lineAt(e,t,n,i,o):this.right.lineAt(e,t,n,r,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==$E.ByPosNoHeight?$E.ByPosNoHeight:$E.ByPos;return a?l.join(this.right.lineAt(s,c,n,r,s)):this.left.lineAt(s,c,n,i,o).join(l)}forEachLine(e,t,n,i,o,r){let s=i+this.left.height,a=o+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,i,o,r),t>=a&&this.right.forEachLine(e,t,n,s,a,r);else{let l=this.lineAt(a,$E.ByPos,n,i,o);e<l.from&&this.left.forEachLine(e,l.from-1,n,i,o,r),l.to>=e&&l.from<=t&&r(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,r)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let o=[];e>0&&this.decomposeLeft(e,o);let r=o.length;for(let e of n)o.push(e);if(e>0&&QE(o,r-1),t<this.length){let e=o.length;this.decomposeRight(t,o),QE(o,e)}return TE.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?TE.of(this.break?[e,null,t]:[e,t]):(this.left=RE(this.left,e),this.right=RE(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:o,right:r}=this,s=t+o.length+this.break,a=null;return i&&i.from<=t+o.length&&i.more?a=o=o.updateHeight(e,t,n,i):o.updateHeight(e,t,n),i&&i.from<=s+r.length&&i.more?a=r=r.updateHeight(e,s,n,i):r.updateHeight(e,s,n),a?this.balanced(o,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function QE(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof LE&&(i=e[t+1])instanceof LE&&e.splice(t-1,3,new LE(n.length+1+i.length))}class jE{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof DE?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new DE(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let r=t-e;n.block?this.addBlock(new ME(r,i,n)):(r||o||i>=5)&&this.addLineDeco(i,o,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new DE(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new LE(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof DE)return e;let t=new DE(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof DE||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new DE(0,-1,0));let n=e;for(let e of this.nodes)e instanceof DE&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,i){let o=new jE(n,e);return MO.spans(t,n,i,o,0),o.finish(n)}}class BE{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&Aw(e,t,this.changes,5)}}function NE(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,o=i.defaultView||window,r=Math.max(0,n.left),s=Math.min(o.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(o.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=i.body;)if(1==t.nodeType){let n=t,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();r=Math.max(r,i.left),s=Math.min(s,i.right),a=Math.max(a,i.top),l=Math.min(t==e.parentNode?o.innerHeight:l,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:r-n.left,right:Math.max(r,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function qE(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class FE{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],o=t[n];if(i.from!=o.from||i.to!=o.to||i.size!=o.size)return!1}return!0}draw(e,t){return Sw.replace({widget:new VE(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class VE extends kw{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class XE{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=HE,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=nC.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(VC).some((e=>"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new kE(t),this.stateDeco=e.facet(XC).filter((e=>"function"!=typeof e)),this.heightMap=TE.empty().applyChanges(this.stateDeco,hx.empty,this.heightOracle.setDoc(e.doc),[new JC(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Sw.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>i>=e&&i<=t))){let{from:t,to:n}=this.lineBlockAt(i);e.push(new zE(t,n))}}return this.viewports=e.sort(((e,t)=>e.from-t.from)),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?HE:new UE(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(GE(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(XC).filter((e=>"function"!=typeof e));let i=e.changedRanges,o=JC.extendWithRanges(i,function(e,t,n){let i=new BE;return MO.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:$x.empty(this.state.doc.length))),r=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);CE(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=r||wE)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=r);let a=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(RC)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?nC.RTL:nC.LTR;let r=this.heightOracle.mustRefreshForWrapping(o),s=t.getBoundingClientRect(),a=r||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=zw(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,l|=16,r=a=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,h=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==h||(this.paddingTop=u,this.paddingBottom=h,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Kw(e.scrollDOM);let p=(this.printing?qE:NE)(t,this.paddingTop),f=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=s.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(r=!0),r||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();r=n>0&&i.refresh(o,n,s,a,Math.max(5,v/s),t),r&&(e.docView.minWidth=0,l|=16)}f>0&&g>0?c=Math.max(f,g):f<0&&g<0&&(c=Math.min(f,g)),CE();for(let n of this.viewports){let o=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(r?TE.empty().applyChanges(this.stateDeco,hx.empty,this.heightOracle,[new JC(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,r,new EE(n.from,o))}wE&&(l|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(r?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,o=this.heightOracle,{visibleTop:r,visibleBottom:s}=this,a=new zE(i.lineAt(r-1e3*n,$E.ByHeight,o,0,0).from,i.lineAt(s+1e3*(1-n),$E.ByHeight,o,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=i.lineAt(e,$E.ByPos,o,0,0);n="center"==t.y?(s.top+s.bottom)/2-r/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-r,a=new zE(i.lineAt(n-500,$E.ByHeight,o,0,0).from,i.lineAt(n+r+500,$E.ByHeight,o,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new zE(this.heightMap.lineAt(n,$E.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,$E.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,$E.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,$E.ByPos,this.heightOracle,0,0),{visibleTop:r,visibleBottom:s}=this;return(0==e||i<=r-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=s+Math.max(10,Math.min(n,250)))&&i>r-2e3&&o<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new FE(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,o=i>>1,r=i<<1;if(this.defaultTextDirection!=nC.LTR&&!n)return[];let s=[],a=(i,r,l,c)=>{if(r-i<o)return;let u=this.state.selection.main,h=[u.from];u.empty||h.push(u.to);for(let e of h)if(e>i&&e<r)return a(i,e-10,l,c),void a(e+10,r,l,c);let d=function(e,t){for(let n of e)if(t(n))return n;return}(e,(e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-i)<o&&Math.abs(e.to-r)<o&&!h.some((t=>e.from<t&&e.to>t))));if(!d){if(r<l.to&&t&&n&&t.visibleRanges.some((e=>e.from<=r&&e.to>=r))){let e=t.moveToLineBoundary(Ix.cursor(r),!1,!0).head;e>i&&(r=e)}let e=this.gapSize(l,i,r,c);d=new FE(i,r,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<r||t.type!=Ew.Text)return;let o=function(e,t,n){let i=[],o=e,r=0;MO.spans(n,e,t,{span(){},point(e,t){e>o&&(i.push({from:o,to:e}),r+=e-o),o=t}},20),o<t&&(i.push({from:o,to:t}),r+=t-o);return{total:r,ranges:i}}(t.from,t.to,this.stateDeco);if(o.total<r)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,r=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let i=WE(o,c),s=((this.visibleBottom-this.visibleTop)/2+r)/t.height;e=i-s,n=i+s}else e=(this.visibleTop-t.top-r)/t.height,n=(this.visibleBottom-t.top+r)/t.height;s=YE(o,e),l=YE(o,n)}else{let n=o.total*this.heightOracle.charWidth,r=i*this.heightOracle.charWidth,a=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let u,h,d=this.pixelViewport.left+a,p=this.pixelViewport.right+a;if(null!=c){let e=WE(o,c),t=((p-d)/2+r)/n;u=e-t,h=e+t}else u=(d-r)/n,h=(p+r)/n;s=YE(o,u),l=YE(o,h)}s>t.from&&a(t.from,s,t,o),l<t.to&&a(l,t.to,t,o)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,i){let o=WE(i,n)-WE(i,t);return this.heightOracle.lineWrapping?e.height*o:i.total*this.heightOracle.charWidth*o}updateLineGaps(e){FE.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Sw.set(e.map((e=>e.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];MO.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let t=0;t<n.length&&!(8&i);t++){let o=this.visibleRanges[t],r=n[t];o.from==r.from&&o.to==r.to||(i|=4,e&&e.mapPos(o.from,-1)==r.from&&e.mapPos(o.to,1)==r.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||GE(this.heightMap.lineAt(e,$E.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((t=>t.top<=e&&t.bottom>=e))||GE(this.heightMap.lineAt(this.scaler.fromDOM(e),$E.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return GE(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class zE{constructor(e,t){this.from=e,this.to=t}}function YE({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:o}=t[e],r=o-n;if(i<=r)return n+i;i-=r}}function WE(e,t){let n=0;for(let{from:i,to:o}of e.ranges){if(t<=o){n+=t-i;break}n+=o-i}return n/e.total}const HE={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class UE{constructor(e,t,n){let i=0,o=0,r=0;this.viewports=n.map((({from:n,to:o})=>{let r=t.lineAt(n,$E.ByPos,e,0,0).top,s=t.lineAt(o,$E.ByPos,e,0,0).bottom;return i+=s-r,{from:n,to:o,top:r,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=r+(e.top-o)*this.scale,r=e.domBottom=e.domTop+(e.bottom-e.top),o=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return i+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,i=o.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return n+(e-i)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,i=o.domBottom}}eq(e){return e instanceof UE&&(this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every(((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)))}}function GE(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new SE(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((e=>GE(e,t))):e._content)}const ZE=Bx.define({combine:e=>e.join(" ")}),KE=Bx.define({combine:e=>e.indexOf(!0)>-1}),JE=UO.newName(),eS=UO.newName(),tS=UO.newName(),nS={"&light":"."+eS,"&dark":"."+tS};function iS(e,t,n){return new UO(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const oS=iS("."+JE,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},nS),rS={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},sS=bw.ie&&bw.ie_version<=11;class aS{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Yw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(bw.ie&&bw.ie_version<=11||bw.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!bw.android||!1===e.constructor.EDIT_CONTEXT||bw.chrome&&bw.chrome_version<126||(this.editContext=new uS(e),e.state.facet(QC)&&(e.contentDOM.editContext=this.editContext.editContext)),sS&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()})),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(QC)?n.root.activeElement!=this.dom:!Iw(this.dom,i))return;let o=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);o&&o.isWidget()&&o.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(bw.ie&&bw.ie_version<=11||bw.android&&bw.chrome)&&!n.state.selection.main.empty&&i.focusNode&&jw(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Dw(e.root);if(!t)return!1;let n=bw.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return cS(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?cS(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=Iw(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,i=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;for(i=Math.min(i,Fw(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=Fw(n))}else{if(n==e)return!0;i=Bw(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,rS),sS&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),sS&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Zw(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((()=>{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let o of e){let e=this.readMutation(o);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Iw(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Yk(this.view,e,t,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=Hk(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=lS(t,e.previousSibling||e.target.previousSibling,-1),i=lS(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(QC)!=e.state.facet(QC)&&(e.view.contentDOM.editContext=e.state.facet(QC)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function lS(e,t,n){for(;t;){let i=nk.get(t);if(i&&i.parent==e)return i;let o=t.parentNode;t=o!=e.dom?o:n>0?t.nextSibling:t.previousSibling}return null}function cS(e,t){let n=t.startContainer,i=t.startOffset,o=t.endContainer,r=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return jw(s.node,s.offset,o,r)&&([n,i,o,r]=[o,r,n,i]),{anchorNode:n,anchorOffset:i,focusNode:o,focusOffset:r}}class uS{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let i=e.state.selection.main,{anchor:o,head:r}=i,s=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>n.text.length;s==this.from&&o<this.from?s=o:a==this.to&&o>this.to&&(a=o);let c=Gk(e.state.sliceDoc(s,a),n.text,(l?i.from:i.to)-s,l?"end":null);if(!c){let t=Ix.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(t.main.eq(i)||e.dispatch({selection:t,userEvent:"select"}))}let u={from:c.from+s,to:c.toA+s,insert:hx.of(n.text.slice(c.from,c.toB).split("\n"))};if((bw.mac||bw.android)&&u.from==r-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(u={from:s,to:a,insert:hx.of([n.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Uk(e,u,Ix.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],o=null;for(let t=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);t<r;t++){let n=e.coordsForChar(t);o=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||o||new DOMRect,i.push(o)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(i)){let o=this.toEditorPos(e.rangeStart),r=this.toEditorPos(e.rangeEnd);if(o<r){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(i)?1:2}px`;n.push(Sw.mark({attributes:{style:e}}).range(o,r))}}}e.dispatch({effects:LC.of(Sw.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=Dw(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges(((o,r,s,a,l)=>{if(n)return;let c=l.length-(r-o);if(i&&r>=i.to){if(i.from==o&&i.to==r&&i.insert.eq(l))return i=this.pendingContextChange=null,t+=c,void(this.to+=c);i=null,this.revertPending(e.state)}if(o+=t,(r+=t)<=this.from)this.from+=c,this.to+=c;else if(o<this.to){if(o<this.from||r>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(o),this.toContextPos(r),l.toString()),this.to+=c}t+=c})),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some((e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to))))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class hS{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach((e=>n(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new XE(e.state||SO.create(e)),e.scrollTo&&e.scrollTo.is(DC)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(BC).map((e=>new qC(e)));for(let e of this.plugins)e.update(this);this.observer=new aS(this),this.inputState=new Zk(this),this.inputState.ensureHandlers(this.plugins),this.docView=new kk(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then((()=>this.requestMeasure()))}dispatch(...e){let t=1==e.length&&e[0]instanceof mO?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,o=this.state;for(let t of e){if(t.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=t.state}if(this.destroyed)return void(this.viewState.state=o);let r=this.hasFocus,s=0,a=null;e.some((e=>e.annotation(yE)))?(this.inputState.notifiedFocused=r,s=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=bE(o,r),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(c=null)):this.observer.clear(),o.facet(SO.phrases)!=this.state.facet(SO.phrases))return this.setState(o);t=ek.create(this,o,e),t.flags|=s;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;u=new MC(e.empty?e:Ix.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(DC)&&(u=e.value.clip(this.state))}this.viewState.update(t,u),this.bidiCache=fS.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(KC)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(ZE)!=t.state.facet(ZE)&&(this.viewState.mustMeasureContent=!0),(n||i||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(kC))try{e(t)}catch(e){IC(this.state,e,"update listener")}(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Hk(this,c)&&l.force&&Zw(this.contentDOM,l.key,l.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new XE(e),this.plugins=e.facet(BC).map((e=>new qC(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new kk(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(BC),n=e.state.facet(BC);if(t!=n){let i=[];for(let o of n){let n=t.indexOf(o);if(n<0)i.push(new qC(o));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){IC(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:r}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(r<0)if(Kw(n))o=-1,r=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);o=e.from,r=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((e=>{try{return e.read(this)}catch(e){return IC(this.state,e),pS}})),c=ek.create(this,this.state,[]),u=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c),u&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=pS)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){IC(this.state,e)}if(u&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,r=-1;continue}{let e=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-r;if(e>1||e<-1){i+=e,n.scrollTop=i/this.scaleY,r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(kC))e(t)}get themeClasses(){return JE+" "+(this.state.facet(KE)?tS:eS)+" "+this.state.facet(ZE)}updateAttrs(){let e=gS(this,FC,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(QC)?"true":"false",class:"cm-content",style:`${bw.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),gS(this,VC,t);let n=this.observer.ignore((()=>{let n=ww(this.contentDOM,this.contentAttrs,t),i=ww(this.dom,this.editorAttrs,e);return n||i}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)if(e.is(hS.announce)){t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value}}mountStyles(){this.styleModules=this.state.facet(KC);let e=this.state.facet(hS.cspNonce);UO.mount(this.root,this.styleModules.concat(oS).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find((t=>t.plugin==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Ik(this,e,Mk(this,e,t,n))}moveByGroup(e,t){return Ik(this,e,Mk(this,e,t,(t=>function(e,t,n){let i=e.state.charCategorizer(t),o=i(n);return e=>{let t=i(e);return o==wO.Space&&(o=t),o==t}}(this,e.head,t))))}visualLineSide(e,t){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),o=n[t?n.length-1:0];return Ix.cursor(o.side(t,i)+e.from,o.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,n=!0){return Ak(this,e,t,n)}moveVertically(e,t,n){return Ik(this,e,function(e,t,n,i){let o=t.head,r=n?1:-1;if(o==(n?e.state.doc.length:0))return Ix.cursor(o,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(o,t.assoc||-1),u=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=r<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(o);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(o-t.from))),s=(r<0?t.top:t.bottom)+u}let h=l.left+a,d=null!=i?i:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=jk(e,{x:h,y:s+(d+t)*r},!1,r);return Ix.cursor(n.pos,n.assoc,void 0,a)}}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=jk(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),jk(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),o=this.bidiSpans(i);return Vw(n,o[dC.find(o,e-i.from,-1,t)].dir==nC.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(TC)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>dS)return vC(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||pC(i.isolates,t=UC(this,e))))return i.order;t||(t=UC(this,e));let i=function(e,t,n){if(!e)return[new dC(0,0,t==oC?1:0)];if(t==iC&&!n.length&&!hC.test(e))return vC(e.length);if(n.length)for(;e.length>fC.length;)fC[fC.length]=256;let i=[],o=t==iC?0:1;return mC(e,o,o,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new fS(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||bw.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{Uw(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return DC.of(new MC("number"==typeof e?Ix.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return DC.of(new MC(Ix.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return NC.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return NC.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=UO.newName(),i=[ZE.of(n),KC.of(iS(`.${n}`,e))];return t&&t.dark&&i.push(KE.of(!0)),i}static baseTheme(e){return Kx.lowest(KC.of(iS("."+JE,e,nS)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&nk.get(n)||nk.get(e);return(null===(t=null==i?void 0:i.root)||void 0===t?void 0:t.view)||null}}hS.styleModule=KC,hS.inputHandler=EC,hS.clipboardInputFilter=$C,hS.clipboardOutputFilter=PC,hS.scrollHandler=AC,hS.focusChangeEffect=SC,hS.perLineTextDirection=TC,hS.exceptionSink=CC,hS.updateListener=kC,hS.editable=QC,hS.mouseSelectionStyle=wC,hS.dragMovesSelection=OC,hS.clickAddsSelectionRange=xC,hS.decorations=XC,hS.blockWrappers=zC,hS.outerDecorations=YC,hS.atomicRanges=WC,hS.bidiIsolatedRanges=HC,hS.scrollMargins=GC,hS.darkTheme=KE,hS.cspNonce=Bx.define({combine:e=>e.length?e[0]:""}),hS.contentAttributes=VC,hS.editorAttributes=FC,hS.lineWrapping=hS.contentAttributes.of({class:"cm-lineWrapping"}),hS.announce=gO.define();const dS=4096,pS={};class fS{constructor(e,t,n,i,o,r){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=o,this.order=r}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:nC.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let r=e[o];r.dir!=i||t.touchesRange(r.from,r.to)||n.push(new fS(t.mapPos(r.from,1),t.mapPos(r.to,-1),r.dir,r.isolates,!1,r.order))}return n}}function gS(e,t,n){for(let i=e.state.facet(t),o=i.length-1;o>=0;o--){let t=i[o],r="function"==typeof t?t(e):t;r&&_w(r,n)}return n}const mS=bw.mac?"mac":bw.windows?"win":bw.linux?"linux":"key";function vS(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const yS=Kx.default(hS.domEventHandlers({keydown:(e,t)=>function(e,t,n,i){wS=t;let o=function(e){var t=!(iw&&(e.ctrlKey||e.altKey||e.metaKey)||nw&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?JO:KO)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),r=Ox(o,0),s=Cx(r)==o.length&&" "!=o,a="",l=!1,c=!1,u=!1;xS&&xS.view==n&&xS.scope==i&&(a=xS.prefix+" ",nE.indexOf(t.keyCode)<0&&(c=!0,xS=null));let h,d,p=new Set,f=e=>{if(e){for(let t of e.run)if(!p.has(t)&&(p.add(t),t(n)))return e.stopPropagation&&(u=!0),!0;e.preventDefault&&(e.stopPropagation&&(u=!0),c=!0)}return!1},g=e[i];g&&(f(g[a+vS(o,t,!s)])?l=!0:!s||!(t.altKey||t.metaKey||t.ctrlKey)||bw.windows&&t.ctrlKey&&t.altKey||bw.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=KO[t.keyCode])||h==o?s&&t.shiftKey&&f(g[a+vS(o,t,!0)])&&(l=!0):(f(g[a+vS(h,t,!0)])||t.shiftKey&&(d=JO[t.keyCode])!=o&&d!=h&&f(g[a+vS(d,t,!1)]))&&(l=!0),!l&&f(g._any)&&(l=!0));c&&(l=!0);l&&u&&t.stopPropagation();return wS=null,l}(function(e){let t=e.facet(bS),n=_S.get(t);n||_S.set(t,n=function(e,t=mS){let n=Object.create(null),i=Object.create(null),o=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},r=(e,i,r,s,a)=>{var l,c;let u=n[e]||(n[e]=Object.create(null)),h=i.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let i,o,r,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e<n.length-1;++e){const a=n[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))r=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==t?s=!0:o=!0}}return i&&(a="Alt-"+a),o&&(a="Ctrl-"+a),s&&(a="Meta-"+a),r&&(a="Shift-"+a),a}(e,t)));for(let t=1;t<h.length;t++){let n=h.slice(0,t).join(" ");o(n,!0),u[n]||(u[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let i=xS={view:t,prefix:n,scope:e};return setTimeout((()=>{xS==i&&(xS=null)}),OS),!0}]})}let d=h.join(" ");o(d,!1);let p=u[d]||(u[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=u._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});r&&p.run.push(r),s&&(p.preventDefault=!0),a&&(p.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:o}=i;for(let t in e)e[t].run.push((e=>o(e,wS)))}let o=i[t]||i.key;if(o)for(let t of e)r(t,o,i.run,i.preventDefault,i.stopPropagation),i.shift&&r(t,"Shift-"+o,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[])));return n}(t.state),e,t,"editor")})),bS=Bx.define({enables:yS}),_S=new WeakMap;let xS=null;const OS=4e3;let wS=null;let CS=class extends kw{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Qw(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Vw(t[0],"rtl"!=n.direction),o=parseInt(n.lineHeight);return i.bottom-i.top>1.5*o?{left:i.left,right:i.right,top:i.top,bottom:i.top+o}:i}ignoreEvent(){return!1}};function kS(e){let t=NC.fromClass(class{constructor(t){this.view=t,this.placeholder=e?Sw.set([Sw.widget({widget:new CS(e),side:1}).range(0)]):Sw.none}get decorations(){return this.view.state.doc.length?Sw.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,hS.contentAttributes.of({"aria-placeholder":e})]:t}const ES="-10000px";class SS{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e));let o=null;this.tooltipViews=this.tooltips.map((e=>o=n(e,o)))}update(e,t){var n;let i=e.state.facet(this.facet),o=i.filter((e=>e));if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let r=[],s=t?[]:null;for(let n=0;n<o.length;n++){let i=o[n],a=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(a=e)}if(a<0)r[n]=this.createTooltipView(i,n?r[n-1]:null),s&&(s[n]=!!i.above);else{let i=r[n]=this.tooltipViews[a];s&&(s[n]=t[a]),i.update&&i.update(e)}}}for(let e of this.tooltipViews)r.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach(((e,n)=>t[n]=e)),t.length=s.length),this.input=i,this.tooltips=o,this.tooltipViews=r,!0}}function $S(e={}){return TS.of(e)}function PS(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const TS=Bx.define({combine:e=>{var t,n,i;return{position:bw.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find((e=>e.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||PS}}}),RS=new WeakMap,AS=NC.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(TS);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new SS(e,IS,((e,t)=>this.createTooltip(e,t)),(e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()})),this.above=this.manager.tooltips.map((e=>!!e.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(TS);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=ES,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(bw.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),o=ZC(this.view);return{visible:{left:i.left+o.left,top:i.top+o.top,right:i.right-o.right,bottom:i.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(TS).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:i,scaleX:o,scaleY:r}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=e.pos[a],d=e.size[a];if(!h||!1!==l.clip&&(h.bottom<=Math.max(n.top,i.top)||h.top>=Math.min(n.bottom,i.bottom)||h.right<Math.max(n.left,i.left)-.1||h.left>Math.min(n.right,i.right)+.1)){u.style.top=ES;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,f=p?7:0,g=d.right-d.left,m=null!==(t=RS.get(c))&&void 0!==t?t:d.bottom-d.top,v=c.offset||LS,y=this.view.textDirection==nC.LTR,b=d.width>i.right-i.left?y?i.left:i.right-d.width:y?Math.max(i.left,Math.min(h.left-(p?14:0)+v.x,i.right-g)):Math.min(Math.max(i.left,h.left-g+(p?14:0)-v.x),i.right-g),_=this.above[a];!l.strictSide&&(_?h.top-m-f-v.y<i.top:h.bottom+m+f+v.y>i.bottom)&&_==i.bottom-h.bottom>h.top-i.top&&(_=this.above[a]=!_);let x=(_?h.top-i.top:i.bottom-h.bottom)-f;if(x<m&&!1!==c.resize){if(x<this.view.defaultLineHeight){u.style.top=ES;continue}RS.set(c,m),u.style.height=(m=x)/r+"px"}else u.style.height&&(u.style.height="");let O=_?h.top-m-f-v.y:h.bottom+f+v.y,w=b+g;if(!0!==c.overlap)for(let e of s)e.left<w&&e.right>b&&e.top<O+m&&e.bottom>O&&(O=_?e.top-m-2-f:e.bottom+f+2);if("absolute"==this.position?(u.style.top=(O-e.parent.top)/r+"px",MS(u,(b-e.parent.left)/o)):(u.style.top=O/r+"px",MS(u,b/o)),p){let e=h.left+(y?v.x:-v.x)-(b+14-7);p.style.left=e/o+"px"}!0!==c.overlap&&s.push({left:b,top:O,right:w,bottom:O+m}),u.classList.toggle("cm-tooltip-above",_),u.classList.toggle("cm-tooltip-below",!_),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=ES}},{eventObservers:{scroll(){this.maybeMeasure()}}});function MS(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const DS=hS.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),LS={x:0,y:0},IS=Bx.define({enables:[AS,DS]}),QS=Bx.define({combine:e=>e.reduce(((e,t)=>e.concat(t)),[])});class jS{static create(e){return new jS(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new SS(e,QS,((e,t)=>this.createHostedView(e,t)),(e=>e.dom.remove()))}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(void 0!==i)if(void 0===t)t=i;else if(t!==i)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const BS=IS.compute([QS],(e=>{let t=e.facet(QS);return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.map((e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos}))),create:jS.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class NS{constructor(e,t,n,i,o){this.view=e,this.source=t,this.field=n,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let i,o=1;if(n.isWidget())i=n.posAtStart;else{if(i=e.posAtCoords(t),null==i)return;let n=e.coordsAtPos(i);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let r=e.bidiSpans(e.state.doc.lineAt(i)).find((e=>e.from<=i&&e.to>=i)),s=r&&r.dir==nC.RTL?-1:1;o=t.x<n.left?-s:s}let r=this.source(e,i,o);if(null==r?void 0:r.then){let t=this.pending={pos:i};r.then((n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))}),(t=>IC(e.state,t,"hover tooltip")))}else!r||Array.isArray(r)&&!r.length||e.dispatch({effects:this.setHover.of(Array.isArray(r)?r:[r])})}get tooltip(){let e=this.view.plugin(AS),t=e?e.manager.tooltips.findIndex((e=>e.create==jS.create)):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:o}=this;if(i.length&&o&&!function(e,t){let n,{left:i,right:o,top:r,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();r=Math.min(e.top,r),s=Math.max(e.bottom,s)}return t.clientX>=i-qS&&t.clientX<=o+qS&&t.clientY>=r-qS&&t.clientY<=s+qS}(o.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,r=null!==(n=null===(t=i[0])||void 0===t?void 0:t.end)&&void 0!==n?n:o;(o==r?this.view.posAtCoords(this.lastMove)==o:function(e,t,n,i,o){let r=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(r.left>i||r.right<i||r.top>o||Math.min(r.bottom,s)<o)return!1;let a=e.posAtCoords({x:i,y:o},!1);return a>=t&&a<=n}(this.view,o,r,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const qS=4;function FS(e,t={}){let n=gO.define(),i=Yx.define({create:()=>[],update(e,i){if(e.length&&(t.hideOnChange&&(i.docChanged||i.selection)?e=[]:t.hideOn&&(e=e.filter((e=>!t.hideOn(i,e)))),i.docChanged)){let t=[];for(let n of e){let e=i.changes.mapPos(n.pos,-1,Ex.TrackDel);if(null!=e){let o=Object.assign(Object.create(null),n);o.pos=e,null!=o.end&&(o.end=i.changes.mapPos(o.end)),t.push(o)}}e=t}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(XS)&&(e=[]);return e},provide:e=>QS.from(e)});return{active:i,extension:[i,NC.define((o=>new NS(o,e,i,n,t.hoverTime||300))),BS]}}function VS(e,t){let n=e.plugin(AS);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const XS=gO.define(),zS=Bx.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}}),YS=NC.fromClass(class{constructor(e){this.input=e.state.facet(US),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(zS);this.top=new WS(e,!0,t.topContainer),this.bottom=new WS(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(zS);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new WS(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new WS(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(US);if(n!=this.input){let t=n.filter((e=>e)),i=[],o=[],r=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),i.push(t),(t.top?o:r).push(t)}this.specs=t,this.panels=i,this.top.sync(o),this.bottom.sync(r);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>hS.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class WS{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=HS(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=HS(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function HS(e){let t=e.nextSibling;return e.remove(),t}const US=Bx.define({enables:YS});class GS extends PO{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}GS.prototype.elementClass="",GS.prototype.toDOM=void 0,GS.prototype.mapMode=Ex.TrackBefore,GS.prototype.startSide=GS.prototype.endSide=-1,GS.prototype.point=!0;const ZS=Bx.define(),KS=Bx.define(),JS=Bx.define(),e$=Bx.define({combine:e=>e.some((e=>e))});const t$=NC.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(JS).map((t=>new r$(e,t))),this.fixed=!e.state.facet(e$);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(e$)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=MO.iter(this.view.state.facet(ZS),this.view.viewport.from),i=[],o=this.gutters.map((e=>new o$(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(e.type)){let t=!0;for(let r of e.type)if(r.type==Ew.Text&&t){i$(n,i,r.from);for(let e of o)e.line(this.view,r,i);t=!1}else if(r.widget)for(let e of o)e.widget(this.view,r)}else if(e.type==Ew.Text){i$(n,i,e.from);for(let t of o)t.line(this.view,e,i)}else if(e.widget)for(let t of o)t.widget(this.view,e);for(let e of o)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(JS),n=e.state.facet(JS),i=e.docChanged||e.heightChanged||e.viewportChanged||!MO.eq(e.startState.facet(ZS),e.state.facet(ZS),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(i=!0);else{i=!0;let o=[];for(let i of n){let n=t.indexOf(i);n<0?o.push(new r$(this.view,i)):(this.gutters[n].update(e),o.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),o.indexOf(e)<0&&e.destroy();for(let e of o)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=o}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>hS.scrollMargins.of((t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let i=n.dom.offsetWidth*t.scaleX,o=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==nC.LTR?{left:i,right:o}:{right:i,left:o}}))});function n$(e){return Array.isArray(e)?e:[e]}function i$(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class o${constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=MO.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,o=(t.top-this.height)/e.scaleY,r=t.height/e.scaleY;if(this.i==i.elements.length){let t=new s$(e,r,o,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,r,o,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];i$(this.cursor,i,t.from),n.length&&(i=i.concat(n));let o=this.gutter.config.lineMarker(e,t,i);o&&i.unshift(o);let r=this.gutter;(0!=i.length||r.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let n of e.state.facet(KS)){let o=n(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class r${constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(i=>{let o,r=i.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let e=r.getBoundingClientRect();o=(e.top+e.bottom)/2}else o=i.clientY;let s=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,s,i)&&i.preventDefault()}));this.markers=n$(t.markers(e)),t.initialSpacer&&(this.spacer=new s$(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=n$(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!MO.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class s${constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let o=0,r=0;;){let s=r,a=o<t.length?t[o++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=r;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!0;break}}else s=this.markers.length;for(;r<s;){let e=this.markers[r++];if(e.toDOM){e.destroy(i);let t=i.nextSibling;i.remove(),i=t}}if(!a)break;a.toDOM&&(l?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),l&&r++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const a$=Bx.define(),l$=Bx.define(),c$=Bx.define({combine:e=>$O(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let i=n[e],o=t[e];n[e]=i?(e,t,n)=>i(e,t,n)||o(e,t,n):o}return n}})});class u$ extends GS{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function h$(e,t){return e.state.facet(c$).formatNumber(t,e.state)}const d$=JS.compute([c$],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(a$),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new u$(h$(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let i of e.state.facet(l$)){let o=i(e,t,n);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(c$)!=e.state.facet(c$),initialSpacer:e=>new u$(h$(e,f$(e.state.doc.lines))),updateSpacer(e,t){let n=h$(t.view,f$(t.view.state.doc.lines));return n==e.number?e:new u$(n)},domEventHandlers:e.facet(c$).domEventHandlers,side:"before"})));function p$(e={}){return[c$.of(e),[t$],d$]}function f$(e){let t=9;for(;t<e;)t=10*t+9;return t}const g$=1024;let m$=0;class v${constructor(e,t){this.from=e,this.to=t}}class y${constructor(e={}){this.id=m$++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=x$.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}y$.closedBy=new y$({deserialize:e=>e.split(" ")}),y$.openedBy=new y$({deserialize:e=>e.split(" ")}),y$.group=new y$({deserialize:e=>e.split(" ")}),y$.isolate=new y$({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),y$.contextHash=new y$({perNode:!0}),y$.lookAhead=new y$({perNode:!0}),y$.mounted=new y$({perNode:!0});class b${constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[y$.mounted.id]}}const _$=Object.create(null);class x${constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):_$,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new x$(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(y$.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(y$.group),i=-1;i<(n?n.length:0);i++){let o=t[i<0?e.name:n[i]];if(o)return o}}}}x$.none=new x$("",Object.create(null),0,8);class O${constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let t of e){let e=t(n);if(e){i||(i=Object.assign({},n.props));let t=e[1],o=e[0];o.combine&&o.id in i&&(t=o.combine(i[o.id],t)),i[o.id]=t}}t.push(i?new x$(n.name,i,n.id,n.flags):n)}return new O$(t)}}const w$=new WeakMap,C$=new WeakMap;var k$;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(k$||(k$={}));class E${constructor(e,t,n,i,o){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[e,t]of o)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=b$.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new B$(this.topNode,e)}cursorAt(e,t=0,n=0){let i=w$.get(this)||this.topNode,o=new B$(i);return o.moveTo(e,t),w$.set(this,o._tree),o}get topNode(){return new A$(this,0,0,null)}resolve(e,t=0){let n=T$(w$.get(this)||this.topNode,e,t,!1);return w$.set(this,n),n}resolveInner(e,t=0){let n=T$(C$.get(this)||this.topNode,e,t,!0);return C$.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let i=e.resolveInner(t,n),o=null;for(let e=i instanceof A$?i:i.context.parent;e;e=e.parent)if(e.index<0){let r=e.parent;(o||(o=[i])).push(r.resolve(t,n)),e=r}else{let r=b$.get(e.tree);if(r&&r.overlay&&r.overlay[0].from<=t&&r.overlay[r.overlay.length-1].to>=t){let s=new A$(r.tree,r.overlay[0].from+e.from,-1,e);(o||(o=[i])).push(T$(s,t,n,!1))}}return o?Q$(o):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:o=this.length}=e,r=e.mode||0,s=(r&k$.IncludeAnonymous)>0;for(let e=this.cursor(r|k$.IncludeAnonymous);;){let r=!1;if(e.from<=o&&e.to>=i&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;r=!0}for(;r&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;r=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:V$(x$.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new E$(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new E$(x$.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:o=g$,reused:r=[],minRepeatType:s=i.types.length}=e,a=Array.isArray(n)?new S$(n,n.length):n,l=i.types,c=0,u=0;function h(e,t,n,y,b,_){let{id:x,start:O,end:w,size:C}=a,k=u,E=c;if(C<0){if(a.next(),-1==C){let t=r[x];return n.push(t),void y.push(O-e)}if(-3==C)return void(c=x);if(-4==C)return void(u=x);throw new RangeError(`Unrecognized record size: ${C}`)}let S,$,P=l[x],T=O-e;if(w-O<=o&&($=m(a.pos-t,b))){let t=new Uint16Array($.size-$.skip),n=a.pos-$.size,o=t.length;for(;a.pos>n;)o=v($.start,t,o);S=new $$(t,w-$.start,i),T=$.start-e}else{let e=a.pos-C;a.next();let t=[],n=[],i=x>=s?x:-1,r=0,l=w;for(;a.pos>e;)i>=0&&a.id==i&&a.size>=0?(a.end<=l-o&&(f(t,n,O,r,a.end,l,i,k,E),r=t.length,l=a.end),a.next()):_>2500?d(O,e,t,n):h(O,e,t,n,i,_+1);if(i>=0&&r>0&&r<t.length&&f(t,n,O,r,O,l,i,k,E),t.reverse(),n.reverse(),i>-1&&r>0){let e=p(P,E);S=V$(P,t,n,0,t.length,0,w-O,e,e)}else S=g(P,t,n,w-O,k-w,E)}n.push(S),y.push(T)}function d(e,t,n,r){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:i}=a;if(i>4)a.next();else{if(c>-1&&t<c)break;c<0&&(c=n-o),s.push(e,t,n),l++,a.next()}}if(l){let t=new Uint16Array(4*l),o=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-o,t[n++]=s[e+2]-o,t[n++]=n;n.push(new $$(t,s[2]-o,i)),r.push(o-e)}}function p(e,t){return(n,i,o)=>{let r,s,a=0,l=n.length-1;if(l>=0&&(r=n[l])instanceof E$){if(!l&&r.type==e&&r.length==o)return r;(s=r.prop(y$.lookAhead))&&(a=i[l]+r.length+s)}return g(e,n,i,o,a,t)}}function f(e,t,n,o,r,s,a,l,c){let u=[],h=[];for(;e.length>o;)u.push(e.pop()),h.push(t.pop()+n-r);e.push(g(i.types[a],u,h,s-r,l-s,c)),t.push(r-n)}function g(e,t,n,i,o,r,s){if(r){let e=[y$.contextHash,r];s=s?[e].concat(s):[e]}if(o>25){let e=[y$.lookAhead,o];s=s?[e].concat(s):[e]}return new E$(e,t,n,i,s)}function m(e,t){let n=a.fork(),i=0,r=0,l=0,c=n.end-o,u={size:0,start:0,skip:0};e:for(let o=n.pos-e;n.pos>o;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=r,u.skip=l,l+=4,i+=4,n.next();continue}let a=n.pos-e;if(e<0||a<o||n.start<c)break;let h=n.id>=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;h+=4}else n.id>=s&&(h+=4);n.next()}r=d,i+=e,l+=h}return(t<0||i==e)&&(u.size=i,u.start=r,u.skip=l),u.size>4?u:void 0}function v(e,t,n){let{id:i,start:o,end:r,size:l}=a;if(a.next(),l>=0&&i<s){let s=n;if(l>4){let i=a.pos-(l-4);for(;a.pos>i;)n=v(e,t,n)}t[--n]=s,t[--n]=r-e,t[--n]=o-e,t[--n]=i}else-3==l?c=i:-4==l&&(u=i);return n}let y=[],b=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,y,b,-1,0);let _=null!==(t=e.length)&&void 0!==t?t:y.length?b[0]+y[0].length:0;return new E$(l[e.topID],y.reverse(),b.reverse(),_)}(e)}}E$.empty=new E$(x$.none,[],[],0);class S${constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new S$(this.buffer,this.index)}}class $${constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return x$.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),n==(e+=4))return o;let r=[];for(;e<n;)r.push(this.childString(e)),e=this.buffer[e+3];return o+"("+r.join(",")+")"}findChild(e,t,n,i,o){let{buffer:r}=this,s=-1;for(let a=e;a!=t&&!(P$(o,i,r[a+1],r[a+2])&&(s=a,n>0));a=r[a+3]);return s}slice(e,t,n){let i=this.buffer,o=new Uint16Array(t-e),r=0;for(let s=e,a=0;s<t;){o[a++]=i[s++],o[a++]=i[s++]-n;let t=o[a++]=i[s++]-n;o[a++]=i[s++]-e,r=Math.max(r,t)}return new $$(o,r,this.set)}}function P$(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function T$(e,t,n,i){for(var o;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!i&&e instanceof A$&&e.index<0?null:e.parent;if(!t)return e;e=t}let r=i?0:k$.IgnoreOverlays;if(i)for(let i=e,s=i.parent;s;i=s,s=i.parent)i instanceof A$&&i.index<0&&(null===(o=s.enter(t,n,r))||void 0===o?void 0:o.from)!=i.from&&(e=s);for(;;){let i=e.enter(t,n,r);if(!i)return e;e=i}}class R${cursor(e=0){return new B$(this,e)}getChild(e,t=null,n=null){let i=M$(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return M$(this,e,t,n)}resolve(e,t=0){return T$(this,e,t,!1)}resolveInner(e,t=0){return T$(this,e,t,!0)}matchContext(e){return D$(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class A$ extends R${constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,o=0){for(let r=this;;){for(let{children:s,positions:a}=r._tree,l=t>0?s.length:-1;e!=l;e+=t){let l=s[e],c=a[e]+r.from;if(P$(i,n,c,c+l.length))if(l instanceof $$){if(o&k$.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-c,i);if(s>-1)return new I$(new L$(r,l,e,c),null,s)}else if(o&k$.IncludeAnonymous||!l.type.isAnonymous||N$(l)){let s;if(!(o&k$.IgnoreMounts)&&(s=b$.get(l))&&!s.overlay)return new A$(s.tree,c,e,r);let a=new A$(l,c,e,r);return o&k$.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,i)}}if(o&k$.IncludeAnonymous||!r.type.isAnonymous)return null;if(e=r.index>=0?r.index+t:t<0?-1:r._parent._tree.children.length,r=r._parent,!r)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let i;if(!(n&k$.IgnoreOverlays)&&(i=b$.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:o}of i.overlay)if((t>0?e<=n:e<n)&&(t<0?o>=n:o>n))return new A$(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function M$(e,t,n,i){let o=e.cursor(),r=[];if(!o.firstChild())return r;if(null!=n)for(let e=!1;!e;)if(e=o.type.is(n),!o.nextSibling())return r;for(;;){if(null!=i&&o.type.is(i))return r;if(o.type.is(t)&&r.push(o.node),!o.nextSibling())return null==i?r:[]}}function D$(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class L${constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class I$ extends R${get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new I$(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&k$.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new I$(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new I$(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new I$(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,o=n.buffer[this.index+3];if(o>i){let r=n.buffer[this.index+1];e.push(n.slice(i,o,r)),t.push(0)}return new E$(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Q$(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let i=n instanceof A$&&n.index<0?null:n.parent,o=e.slice();return i?o[t]=i:o.splice(t,1),new j$(o,n)}class j${constructor(e,t){this.heads=e,this.node=t}get next(){return Q$(this.heads)}}class B${get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof A$)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return!!e&&(e instanceof A$?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return!(o<0)&&(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&k$.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&k$.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&k$.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(i.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let i=t+e,o=e<0?-1:n._tree.children.length;i!=o;i+=e){let e=n._tree.children[i];if(this.mode&k$.IncludeAnonymous||e instanceof $$||!e.type.isAnonymous||N$(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,o=this.stack.length;o>=0;){for(let r=e;r;r=r._parent)if(r.index==i){if(i==this.index)return r;t=r,n=o+1;break e}i=this.stack[--o]}for(let e=n;e<this.stack.length;e++)t=new I$(this.buffer,t,this.stack[e]);return this.bufferNode=new I$(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return D$(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return D$(this._tree,e,i);let r=n[t.buffer[this.stack[o]]];if(!r.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}}function N$(e){return e.children.some((e=>e instanceof $$||!e.type.isAnonymous||N$(e)))}const q$=new WeakMap;function F$(e,t){if(!e.isAnonymous||t instanceof $$||t.type!=e)return 1;let n=q$.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof E$)){n=1;break}n+=F$(e,i)}q$.set(t,n)}return n}function V$(e,t,n,i,o,r,s,a,l){let c=0;for(let n=i;n<o;n++)c+=F$(e,t[n]);let u=Math.ceil(1.5*c/8),h=[],d=[];return function t(n,i,o,s,a){for(let c=o;c<s;){let o=c,p=i[c],f=F$(e,n[c]);for(c++;c<s;c++){let t=F$(e,n[c]);if(f+t>=u)break;f+=t}if(c==o+1){if(f>u){let e=n[o];t(e.children,e.positions,0,e.children.length,i[o]+a);continue}h.push(n[o])}else{let t=i[c-1]+n[c-1].length-p;h.push(V$(e,n,i,o,c,p,t,null,l))}d.push(p+a-r)}}(t,n,i,o,0),(a||l)(h,d,s)}class X${constructor(e,t,n,i,o=!1,r=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(o?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new X$(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],o=1,r=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s<t.length?t[s]:null,u=c?c.fromA:1e9;if(u-a>=n)for(;r&&r.from<u;){let t=r;if(a>=t.from||u<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,u)-l;t=e>=n?null:new X$(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&i.push(t),r.to>u)break;r=o<e.length?e[o++]:null}if(!c)break;a=c.toA,l=c.toA-c.toB}return i}}class z${startParse(e,t,n){return"string"==typeof e&&(e=new Y$(e)),n=n?n.length?n.map((e=>new v$(e.from,e.to))):[new v$(0,0)]:[new v$(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class Y${constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}class W${constructor(e,t,n,i,o){this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.from=o}}function H$(e){if(!e.length||e.some((e=>e.from>=e.to)))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class U${constructor(e,t,n,i,o,r,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=o,this.target=r,this.prev=s,this.depth=0,this.ranges=[]}}const G$=new y$({perNode:!0});class Z${constructor(e,t,n,i,o){this.nest=t,this.input=n,this.fragments=i,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new E$(e.type,e.children,e.positions,e.length,e.propValues.concat([[G$,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[y$.mounted.id]=new b$(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new nP(this.fragments),t=null,n=null,i=new B$(new A$(this.baseTree,this.ranges[0].from,0,null),k$.IncludeAnonymous|k$.IgnoreMounts);e:for(let o,r;;){let s,a=!0;if(null!=this.stoppedAt&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find((e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay));if(e)for(let n of e.mount.overlay){let o=n.from+e.pos,r=n.to+e.pos;o>=i.from&&r<=i.to&&!t.ranges.some((e=>e.from<r&&e.to>o))&&t.ranges.push({from:o,to:r})}}a=!1}else if(n&&(r=K$(n.ranges,i.from,i.to)))a=2!=r;else if(!i.type.isAnonymous&&(o=this.nest(i,this.input))&&(i.from<i.to||!o.overlay)){i.tree||(eP(i),t&&t.depth++,n&&n.depth++);let r=e.findMounts(i.from,o.parser);if("function"==typeof o.overlay)t=new U$(o.parser,o.overlay,r,this.inner.length,i.from,i.tree,t);else{let e=iP(this.ranges,o.overlay||(i.from<i.to?[new v$(i.from,i.to)]:[]));e.length&&H$(e),!e.length&&o.overlay||this.inner.push(new W$(o.parser,e.length?o.parser.startParse(this.input,rP(r,e),e):o.parser.startParse(""),o.overlay?o.overlay.map((e=>new v$(e.from-i.from,e.to-i.from))):null,i.tree,e.length?e[0].from:i.from)),o.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):a=!1}}else if(t&&(s=t.predicate(i))&&(!0===s&&(s=new v$(i.from,i.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(a&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&! --t.depth){let e=iP(this.ranges,t.ranges);e.length&&(H$(e),this.inner.splice(t.index,0,new W$(t.parser,t.parser.startParse(this.input,rP(t.mounts,e),e),t.ranges.map((e=>new v$(e.from-t.start,e.to-t.start))),t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function K$(e,t,n){for(let i of e){if(i.from>=n)break;if(i.to>t)return i.from<=t&&i.to>=n?2:1}return 0}function J$(e,t,n,i,o,r){if(t<n){let s=e.buffer[t+1];i.push(e.slice(t,n,s)),o.push(s-r)}}function eP(e){let{node:t}=e,n=[],i=t.context.buffer;do{n.push(e.index),e.parent()}while(!e.tree);let o=e.tree,r=o.children.indexOf(i),s=o.children[r],a=s.buffer,l=[r];o.children[r]=function e(i,o,r,c,u,h){let d=n[h],p=[],f=[];J$(s,i,d,p,f,c);let g=a[d+1],m=a[d+2];l.push(p.length);let v=h?e(d+4,a[d+3],s.set.types[a[d]],g,m-g,h-1):t.toTree();return p.push(v),f.push(g-c),J$(s,a[d+3],o,p,f,c),new E$(r,p,f,u)}(0,a.length,x$.none,0,s.length,n.length-1);for(let t of l){let n=e.tree.children[t],i=e.tree.positions[t];e.yield(new A$(n,i+e.from,t,e._tree))}}class tP{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(k$.IncludeAnonymous|k$.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,k$.IgnoreOverlays|k$.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof E$))break;t=t.children[0]}return!1}}let nP=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=null!==(t=n.tree.prop(G$))&&void 0!==t?t:n.to,this.inner=new tP(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(G$))&&void 0!==e?e:t.to,this.inner=new tP(t.tree,-t.offset)}}findMounts(e,t){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let o=null===(n=e.tree)||void 0===n?void 0:n.prop(y$.mounted);if(o&&o.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let n=this.fragments[t];if(n.from>=e.to)break;n.tree==this.curFrag.tree&&i.push({frag:n,pos:e.from-n.offset,mount:o})}}}return i}};function iP(e,t){let n=null,i=t;for(let o=1,r=0;o<e.length;o++){let s=e[o-1].to,a=e[o].from;for(;r<i.length;r++){let e=i[r];if(e.from>=a)break;e.to<=s||(n||(i=n=t.slice()),e.from<s?(n[r]=new v$(e.from,s),e.to>a&&n.splice(r+1,0,new v$(a,e.to))):e.to>a?n[r--]=new v$(a,e.to):n.splice(r--,1))}}return i}function oP(e,t,n,i){let o=0,r=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let u=o==e.length?1e9:s?e[o].to:e[o].from,h=r==t.length?1e9:a?t[r].to:t[r].from;if(s!=a){let e=Math.max(l,n),t=Math.min(u,h,i);e<t&&c.push(new v$(e,t))}if(l=Math.min(u,h),1e9==l)break;u==l&&(s?(s=!1,o++):s=!0),h==l&&(a?(a=!1,r++):a=!0)}return c}function rP(e,t){let n=[];for(let{pos:i,mount:o,frag:r}of e){let e=i+(o.overlay?o.overlay[0].from:0),s=e+o.tree.length,a=Math.max(r.from,e),l=Math.min(r.to,s);if(o.overlay){let s=o.overlay.map((e=>new v$(e.from+i,e.to+i))),c=oP(t,s,a,l);for(let t=0,i=a;;t++){let s=t==c.length,a=s?l:c[t].from;if(a>i&&n.push(new X$(i,a,o.tree,-e,r.from>=i||r.openStart,r.to<=a||r.openEnd)),s)break;i=c[t].to}}else n.push(new X$(a,l,o.tree,-e,r.from>=e||r.openStart,r.to<=s||r.openEnd))}return n}let sP=0;class aP{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=sP++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof aP&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new aP(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new cP(e);return e=>e.modified.indexOf(t)>-1?e:cP.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let lP=0;class cP{constructor(e){this.name=e,this.instances=[],this.id=lP++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>n.base==e&&function(e,t){return e.length==t.length&&e.every(((e,n)=>e==t[n]))}(t,n.modified)));if(n)return n;let i=[],o=new aP(e.name,i,e,t);for(let e of t)e.instances.push(o);let r=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,o=t.length;i<o;i++)t.push(t[i].concat(e[n]));return t.sort(((e,t)=>t.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of r)i.push(cP.get(t,e));return o}}function uP(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],o=2,r=e;for(let t=0;;){if("..."==r&&t>0&&t+3==e.length){o=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){o=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);r=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new dP(i,o,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return hP.add(t)}const hP=new y$({combine(e,t){let n,i,o;for(;e||t;){if(!e||t&&e.depth>=t.depth?(o=t,t=t.next):(o=e,e=e.next),n&&n.mode==o.mode&&!o.context&&!n.context)continue;let r=new dP(o.tags,o.mode,o.context);n?n.next=r:i=r,n=r}return i}});class dP{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function pP(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:i,all:o=null}=t||{};return{style:e=>{let t=o;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function fP(e,t,n,i=0,o=e.length){let r=new gP(i,Array.isArray(t)?t:[t],n);r.highlightRange(e.cursor(),i,o,"",r.highlighters),r.flush(o)}dP.empty=new dP([],2,null);class gP{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,o){let{type:r,from:s,to:a}=e;if(s>=n||a<=t)return;r.isTop&&(o=this.highlighters.filter((e=>!e.scope||e.scope(r))));let l=i,c=function(e){let t=e.type.prop(hP);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||dP.empty,u=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(o,c.tags);if(u&&(l&&(l+=" "),l+=u,1==c.mode&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(t,s),l),c.opaque)return;let h=e.tree&&e.tree.prop(y$.mounted);if(h&&h.overlay){let r=e.node.enter(h.overlay[0].from+s,1),c=this.highlighters.filter((e=>!e.scope||e.scope(h.tree.type))),u=e.firstChild();for(let d=0,p=s;;d++){let f=d<h.overlay.length?h.overlay[d]:null,g=f?f.from+s:a,m=Math.max(t,p),v=Math.min(n,g);if(m<v&&u)for(;e.from<v&&(this.highlightRange(e,m,v,i,o),this.startSpan(Math.min(v,e.to),l),!(e.to>=g)&&e.nextSibling()););if(!f||g>n)break;p=f.to+s,p>t&&(this.highlightRange(r.cursor(),Math.max(t,f.from+s),Math.min(n,p),"",c),this.startSpan(Math.min(n,p),l))}u&&e.parent()}else if(e.firstChild()){h&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,o),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const mP=aP.define,vP=mP(),yP=mP(),bP=mP(yP),_P=mP(yP),xP=mP(),OP=mP(xP),wP=mP(xP),CP=mP(),kP=mP(CP),EP=mP(),SP=mP(),$P=mP(),PP=mP($P),TP=mP(),RP={comment:vP,lineComment:mP(vP),blockComment:mP(vP),docComment:mP(vP),name:yP,variableName:mP(yP),typeName:bP,tagName:mP(bP),propertyName:_P,attributeName:mP(_P),className:mP(yP),labelName:mP(yP),namespace:mP(yP),macroName:mP(yP),literal:xP,string:OP,docString:mP(OP),character:mP(OP),attributeValue:mP(OP),number:wP,integer:mP(wP),float:mP(wP),bool:mP(xP),regexp:mP(xP),escape:mP(xP),color:mP(xP),url:mP(xP),keyword:EP,self:mP(EP),null:mP(EP),atom:mP(EP),unit:mP(EP),modifier:mP(EP),operatorKeyword:mP(EP),controlKeyword:mP(EP),definitionKeyword:mP(EP),moduleKeyword:mP(EP),operator:SP,derefOperator:mP(SP),arithmeticOperator:mP(SP),logicOperator:mP(SP),bitwiseOperator:mP(SP),compareOperator:mP(SP),updateOperator:mP(SP),definitionOperator:mP(SP),typeOperator:mP(SP),controlOperator:mP(SP),punctuation:$P,separator:mP($P),bracket:PP,angleBracket:mP(PP),squareBracket:mP(PP),paren:mP(PP),brace:mP(PP),content:CP,heading:kP,heading1:mP(kP),heading2:mP(kP),heading3:mP(kP),heading4:mP(kP),heading5:mP(kP),heading6:mP(kP),contentSeparator:mP(CP),list:mP(CP),quote:mP(CP),emphasis:mP(CP),strong:mP(CP),link:mP(CP),monospace:mP(CP),strikethrough:mP(CP),inserted:mP(),deleted:mP(),changed:mP(),invalid:mP(),meta:TP,documentMeta:mP(TP),annotation:mP(TP),processingInstruction:mP(TP),definition:aP.defineModifier("definition"),constant:aP.defineModifier("constant"),function:aP.defineModifier("function"),standard:aP.defineModifier("standard"),local:aP.defineModifier("local"),special:aP.defineModifier("special")};for(let e in RP){let t=RP[e];t instanceof aP&&(t.name=e)}var AP;pP([{tag:RP.link,class:"tok-link"},{tag:RP.heading,class:"tok-heading"},{tag:RP.emphasis,class:"tok-emphasis"},{tag:RP.strong,class:"tok-strong"},{tag:RP.keyword,class:"tok-keyword"},{tag:RP.atom,class:"tok-atom"},{tag:RP.bool,class:"tok-bool"},{tag:RP.url,class:"tok-url"},{tag:RP.labelName,class:"tok-labelName"},{tag:RP.inserted,class:"tok-inserted"},{tag:RP.deleted,class:"tok-deleted"},{tag:RP.literal,class:"tok-literal"},{tag:RP.string,class:"tok-string"},{tag:RP.number,class:"tok-number"},{tag:[RP.regexp,RP.escape,RP.special(RP.string)],class:"tok-string2"},{tag:RP.variableName,class:"tok-variableName"},{tag:RP.local(RP.variableName),class:"tok-variableName tok-local"},{tag:RP.definition(RP.variableName),class:"tok-variableName tok-definition"},{tag:RP.special(RP.variableName),class:"tok-variableName2"},{tag:RP.definition(RP.propertyName),class:"tok-propertyName tok-definition"},{tag:RP.typeName,class:"tok-typeName"},{tag:RP.namespace,class:"tok-namespace"},{tag:RP.className,class:"tok-className"},{tag:RP.macroName,class:"tok-macroName"},{tag:RP.propertyName,class:"tok-propertyName"},{tag:RP.operator,class:"tok-operator"},{tag:RP.comment,class:"tok-comment"},{tag:RP.meta,class:"tok-meta"},{tag:RP.invalid,class:"tok-invalid"},{tag:RP.punctuation,class:"tok-punctuation"}]);const MP=new y$;const DP=new y$;class LP{constructor(e,t,n=[],i=""){this.data=e,this.name=i,SO.prototype.hasOwnProperty("tree")||Object.defineProperty(SO.prototype,"tree",{get(){return jP(this)}}),this.parser=t,this.extension=[WP.of(this),SO.languageData.of(((e,t,n)=>{let i=IP(e,t,n),o=i.type.prop(MP);if(!o)return[];let r=e.facet(o),s=i.type.prop(DP);if(s){let o=i.resolve(t-i.from,n);for(let t of s)if(t.test(o,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(r)}}return r}))].concat(n)}isActiveAt(e,t,n=-1){return IP(e,t,n).type.prop(MP)==this.data}findRegions(e){let t=e.facet(WP);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(MP)==this.data)return void n.push({from:t,to:t+e.length});let o=e.prop(y$.mounted);if(o){if(o.tree.prop(MP)==this.data){if(o.overlay)for(let e of o.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(o.overlay){let e=n.length;if(i(o.tree,o.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let o=e.children[n];o instanceof E$&&i(o,e.positions[n]+t)}};return i(jP(e),0),n}get allowsNesting(){return!0}}function IP(e,t,n){let i=e.facet(WP),o=jP(e).topNode;if(!i||i.allowsNesting)for(let e=o;e;e=e.enter(t,n,k$.ExcludeBuffers))e.type.isTop&&(o=e);return o}LP.setState=gO.define();class QP extends LP{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,Bx.define({combine:n?e=>e.concat(n):void 0}));var n;return new QP(t,e.parser.configure({props:[MP.add((e=>e.isTop?t:void 0))]}),e.name)}configure(e,t){return new QP(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function jP(e){let t=e.field(LP.state,!1);return t?t.tree:E$.empty}class BP{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let NP=null;class qP{constructor(e,t,n=[],i,o,r,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=o,this.viewport=r,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new qP(e,t,[],E$.empty,0,n,[],null)}startParse(){return this.parser.startParse(new BP(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=E$.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(X$.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}}))}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(X$.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=NP;NP=this;try{return e()}finally{NP=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=FP(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:o,viewport:r,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,o)=>t.push({fromA:e,toA:n,fromB:i,toB:o}))),n=X$.applyChanges(n,t),i=E$.empty,o=0,r={from:e.mapPos(r.from,-1),to:e.mapPos(r.to,1)},this.skipped.length){s=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);n<i&&s.push({from:n,to:i})}}}return new qP(this.parser,t,n,i,o,r,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:i}=this.skipped[t];n<e.to&&i>e.from&&(this.fragments=FP(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends z${createParse(t,n,i){let o=i[0].from,r=i[i.length-1].to,s={parsedPos:o,advance(){let t=NP;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=r,new E$(x$.none,[],[],r-o)},stoppedAt:null,stopAt(){}};return s}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return NP}}function FP(e,t,n){return X$.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class VP{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new VP(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=qP.create(e.facet(WP).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new VP(n)}}LP.state=Yx.define({create:VP.init,update(e,t){for(let e of t.effects)if(e.is(LP.setState))return e.value;return t.startState.facet(WP)!=t.state.facet(WP)?VP.init(t.state):e.apply(t)}});let XP=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(XP=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const zP="undefined"!=typeof navigator&&(null===(AP=navigator.scheduling)||void 0===AP?void 0:AP.isInputPending)?()=>navigator.scheduling.isInputPending():null,YP=NC.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(LP.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(LP.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=XP(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,o=n.field(LP.state);if(o.tree==o.context.tree&&o.context.isDone(i+1e5))return;let r=Date.now()+Math.min(this.chunkBudget,100,e&&!zP?Math.max(25,e.timeRemaining()-5):1e9),s=o.context.treeLen<i&&n.doc.length>i+1e3,a=o.context.work((()=>zP&&zP()||Date.now()>r),i+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:LP.setState.of(new VP(o.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>IC(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),WP=Bx.define({combine:e=>e.length?e[0]:null,enables:e=>[LP.state,YP,hS.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class HP{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const UP=Bx.define(),GP=Bx.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function ZP(e){let t=e.facet(GP);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function KP(e,t){let n="",i=e.tabSize,o=e.facet(GP)[0];if("\t"==o){for(;t>=i;)n+="\t",t-=i;o=" "}for(let e=0;e<t;e++)n+=o;return n}function JP(e,t){e instanceof SO&&(e=new eT(e));for(let n of e.state.facet(UP)){let i=n(e,t);if(void 0!==i)return i}let n=jP(e.state);return n.length>=t?function(e,t,n){let i=t.resolveStack(n),o=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(o!=i.node){let e=[];for(let t=o;t&&!(t.from<i.node.from||t.to>i.node.to||t.from==i.node.from&&t.type==i.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return nT(i,e,n)}(e,n,t):null}class eT{constructor(e,t={}){this.state=e,this.options=t,this.unit=ZP(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:o}=this.options;return null!=i&&i>=n.from&&i<=n.to?o&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.countColumn(n,e-i),r=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return r>-1&&(o+=r-this.countColumn(n,n.search(/\S|$/))),o}countColumn(e,t=e.length){return zO(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let e=o(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const tT=new y$;function nT(e,t,n){for(let i=e;i;i=i.next){let e=iT(i.node);if(e)return e(rT.create(t,n,i))}return 0}function iT(e){let t=e.type.prop(tT);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(y$.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>lT(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?oT:null}function oT(){return 0}class rT extends eT{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new rT(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(sT(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return nT(this.context.next,this.base,this.pos)}}function sT(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function aT({closing:e,align:t=!0,units:n=1}){return i=>lT(i,t,n,e)}function lT(e,t,n,i,o){let r=e.textAfter,s=r.match(/^\s*/)[0].length,a=i&&r.slice(s,s+i.length)==i||o==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let o=e.options.simulateBreak,r=e.state.doc.lineAt(n.from),s=null==o||o<=r.from?r.to:Math.min(r.to,o);for(let e=n.to;;){let o=t.childAfter(e);if(!o||o==i)return null;if(!o.type.isSkipped){if(o.from>=s)return null;let e=/^ */.exec(r.text.slice(n.to-r.from))[0].length;return{from:n.from,to:n.to+e}}e=o.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}function cT({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}function uT(){return SO.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,o=n.lineAt(i);if(i>o.from+200)return e;let r=n.sliceString(o.from,i);if(!t.some((e=>e.test(r))))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=JP(s,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],o=KP(s,n);i!=o&&l.push({from:t.from,to:t.from+i.length,insert:o})}return l.length?[e,{changes:l,sequential:!0}]:e}))}const hT=new y$;function dT(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}class pT{constructor(e,t){let n;function i(e){let t=UO.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const o="string"==typeof t.all?t.all:t.all?i(t.all):void 0,r=t.scope;this.scope=r instanceof LP?e=>e.prop(MP)==r.data:r?e=>e==r:void 0,this.style=pP(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:o}).style,this.module=n?new UO(n):null,this.themeType=t.themeType}static define(e,t){return new pT(e,t||{})}}const fT=Bx.define(),gT=Bx.define({combine:e=>e.length?[e[0]]:null});function mT(e){let t=e.facet(fT);return t.length?t:e.facet(gT)}function vT(e,t){let n,i=[bT];return e instanceof pT&&(e.module&&i.push(hS.styleModule.of(e.module)),n=e.themeType),n?i.push(fT.computeN([hS.darkTheme],(t=>t.facet(hS.darkTheme)==("dark"==n)?[e]:[]))):i.push(fT.of(e)),i}class yT{constructor(e){this.markCache=Object.create(null),this.tree=jP(e.state),this.decorations=this.buildDeco(e,mT(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=jP(e.state),n=mT(e.state),i=n!=mT(e.startState),{viewport:o}=e.view,r=e.changes.mapPos(this.decoratedTo,1);t.length<o.to&&!i&&t.type==this.tree.type&&r>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=r):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return Sw.none;let n=new DO;for(let{from:i,to:o}of e.visibleRanges)fP(this.tree,t,((e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=Sw.mark({class:i})))}),i,o);return n.finish()}}const bT=Kx.high(NC.fromClass(yT,{decorations:e=>e.decorations}));RP.meta,RP.link,RP.heading,RP.emphasis,RP.strong,RP.strikethrough,RP.keyword,RP.atom,RP.bool,RP.url,RP.contentSeparator,RP.labelName,RP.literal,RP.inserted,RP.string,RP.deleted,RP.regexp,RP.escape,RP.string,RP.variableName,RP.variableName,RP.typeName,RP.namespace,RP.className,RP.variableName,RP.macroName,RP.propertyName,RP.comment,RP.invalid;const _T=hS.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),xT="()[]{}",OT=Bx.define({combine:e=>$O(e,{afterCursor:!0,brackets:xT,maxScanDistance:1e4,renderMatch:kT})}),wT=Sw.mark({class:"cm-matchingBracket"}),CT=Sw.mark({class:"cm-nonmatchingBracket"});function kT(e){let t=[],n=e.matched?wT:CT;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const ET=Yx.define({create:()=>Sw.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],i=t.state.facet(OT);for(let e of t.state.selection.ranges){if(!e.empty)continue;let o=AT(t.state,e.head,-1,i)||e.head>0&&AT(t.state,e.head-1,1,i)||i.afterCursor&&(AT(t.state,e.head,1,i)||e.head<t.state.doc.length&&AT(t.state,e.head+1,-1,i));o&&(n=n.concat(i.renderMatch(o,t.state)))}return Sw.set(n,!0)},provide:e=>hS.decorations.from(e)}),ST=[ET,_T];function $T(e={}){return[OT.of(e),ST]}const PT=new y$;function TT(e,t,n){let i=e.prop(t<0?y$.openedBy:y$.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function RT(e){let t=e.type.prop(PT);return t?t(e.node):e}function AT(e,t,n,i={}){let o=i.maxScanDistance||1e4,r=i.brackets||xT,s=jP(e),a=s.resolveInner(t,n);for(let i=a;i;i=i.parent){let o=TT(i.type,n,r);if(o&&i.from<i.to){let s=RT(i);if(s&&(n>0?t>=s.from&&t<s.to:t>s.from&&t<=s.to))return MT(e,t,n,i,s,o,r)}}return function(e,t,n,i,o,r,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!u.next().done&&e<=r;){let r=u.value;n<0&&(e+=r.length);let a=t+e*n;for(let e=n>0?0:r.length-1,t=n>0?r.length:-1;e!=t;e+=n){let t=s.indexOf(r[e]);if(!(t<0||i.resolveInner(a+e,1).type!=o))if(t%2==0==n>0)h++;else{if(1==h)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};h--}}n>0&&(e+=r.length)}return u.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,o,r)}function MT(e,t,n,i,o,r,s){let a=i.parent,l={from:o.from,to:o.to},c=0,u=null==a?void 0:a.cursor();if(u&&(n<0?u.childBefore(i.from):u.childAfter(i.to)))do{if(n<0?u.to<=i.from:u.from>=i.to){if(0==c&&r.indexOf(u.type.name)>-1&&u.from<u.to){let e=RT(u);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(TT(u.type,n,s))c++;else if(TT(u.type,-n,s)){if(0==c){let e=RT(u);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}const DT=Object.create(null),LT=[x$.none],IT=[],QT=Object.create(null),jT=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])jT[e]=NT(DT,t);function BT(e,t){IT.indexOf(e)>-1||(IT.push(e),console.warn(t))}function NT(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||RP[n];i?"function"==typeof i?t.length?t=t.map(i):BT(n,`Modifier ${n} used at start of tag`):t.length?BT(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:BT(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),o=i+" "+n.map((e=>e.id)),r=QT[o];if(r)return r.id;let s=QT[o]=x$.define({id:LT.length,name:i,props:[uP({[i]:n})]});return LT.push(s),s.id}nC.RTL,nC.LTR;class qT{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=jP(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),o=i.search(YT(e,!1));return o<0?null:{from:n+o,to:this.pos,text:i.slice(o)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function FT(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function VT(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=FT(t)+FT(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(t);return e=>{let o=e.matchBefore(i);return o||e.explicit?{from:o?o.from:e.pos,options:t,validFor:n}:null}}class XT{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function zT(e){return e.selection.main.from}function YT(e,t){var n;let{source:i}=e,o=t&&"^"!=i[0],r="$"!=i[i.length-1];return o||r?new RegExp(`${o?"^":""}(?:${i})${r?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const WT=dO.define();function HT(e,t,n,i){let{main:o}=e.selection,r=n-o.from,s=i-o.from;return{...e.changeByRange((a=>{if(a!=o&&n!=i&&e.sliceDoc(a.from+r,a.from+s)!=e.sliceDoc(n,i))return{range:a};let l=e.toText(t);return{changes:{from:a.from+r,to:i==o.from?a.to:a.from+s,insert:l},range:Ix.cursor(a.from+r+l.length)}})),scrollIntoView:!0,userEvent:"input.complete"}}const UT=new WeakMap;function GT(e){if(!Array.isArray(e))return e;let t=UT.get(e);return t||UT.set(e,t=VT(e)),t}const ZT=gO.define(),KT=gO.define();class JT{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Ox(e,t),i=Cx(n);this.chars.push(n);let o=e.slice(t,t+i),r=o.toUpperCase();this.folded.push(Ox(r==o?o.toLowerCase():r,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:o,byWord:r}=this;if(1==t.length){let i=Ox(e,0),o=Cx(i),r=o==e.length?0:-100;if(i==t[0]);else{if(i!=n[0])return null;r+=-200}return this.ret(r,[0,o])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let o=0,r=Math.min(e.length,200);o<r&&l<a;){let r=Ox(e,o);r!=t[l]&&r!=n[l]||(i[l++]=o),o+=Cx(r)}if(l<a)return null}let c=0,u=0,h=!1,d=0,p=-1,f=-1,g=/[a-z]/.test(e),m=!0;for(let i=0,l=Math.min(e.length,200),v=0;i<l&&u<a;){let l=Ox(e,i);s<0&&(c<a&&l==t[c]&&(o[c++]=i),d<a&&(l==t[d]||l==n[d]?(0==d&&(p=i),f=i+1,d++):d=0));let y,b=l<255?l>=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=wx(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!i||1==b&&g||0==v&&0!=b)&&(t[u]==l||n[u]==l&&(h=!0)?r[u++]=i:r.length&&(m=!1)),v=b,i+=Cx(l)}return u==a&&0==r[0]&&m?this.result((h?-200:0)-100,r,e):d==a&&0==p?this.ret(-200-e.length+(f==e.length?0:-100),[0,f]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[p,f]):u==a?this.result((h?-200:0)-100-700+(m?0:-1100),r,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[],o=0;for(let e of t){let t=e+(this.astral?Cx(Ox(n,e)):1);o&&i[o-1]==e?i[o-1]=t:(i[o++]=e,i[o++]=t)}return this.ret(e-n.length,i)}}class eR{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const tR=Bx.define({combine:e=>$O(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:iR,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>nR(e(n),t(n)),optionClass:(e,t)=>n=>nR(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function nR(e,t){return e?t?e+" "+t:e:t}function iR(e,t,n,i,o,r){let s,a,l=e.textDirection==nC.RTL,c=l,u=!1,h="top",d=t.left-o.left,p=o.right-t.right,f=i.right-i.left,g=i.bottom-i.top;if(c&&d<Math.min(f,p)?c=!1:!c&&p<Math.min(f,d)&&(c=!0),f<=(c?d:p))s=Math.max(o.top,Math.min(n.top,o.bottom-g))-t.top,a=Math.min(400,c?d:p);else{u=!0,a=Math.min(400,(l?t.right:o.right-t.left)-30);let e=o.bottom-t.bottom;e>=g||e>t.top?s=n.bottom-t.top:(h="bottom",s=t.bottom-n.top)}return{style:`${h}: ${s/((t.bottom-t.top)/r.offsetHeight)}px; max-width: ${a/((t.right-t.left)/r.offsetWidth)}px`,class:"cm-completionInfo-"+(u?l?"left-narrow":"right-narrow":c?"left":"right")}}function oR(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class rR{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:o,selected:r}=i.open,s=e.state.facet(tR);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,i){let o=document.createElement("span");o.className="cm-completionLabel";let r=e.displayLabel||e.label,s=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>s&&o.appendChild(document.createTextNode(r.slice(s,t)));let a=o.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(r.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<r.length&&o.appendChild(document.createTextNode(r.slice(s))),o},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort(((e,t)=>e.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=oR(o.length,r,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(n=>{let{options:i}=e.state.field(t).open;for(let t,o=n.target;o&&o!=this.dom;o=o.parentNode)if("LI"==o.nodeName&&(t=/-(\d+)$/.exec(o.id))&&+t[1]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault()})),this.dom.addEventListener("focusout",(t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(tR).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:KT.of(null)})})),this.showOptions(o,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:o,selected:r,disabled:s}=n.open;i.open&&i.open.options==o||(this.range=oR(o.length,r,e.state.facet(tR).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),s!=(null===(t=i.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=oR(t.options.length,t.selected,this.view.state.facet(tR).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:o}=i;if(!o)return;let r="string"==typeof o?document.createTextNode(o):o(i);if(!r)return;"then"in r?r.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)})).catch((e=>IC(this.view.state,e,"completion info"))):(this.addInfoPane(r,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):i--;return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/o:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/o)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let e=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return i.top>Math.min(o.bottom,t.bottom)-10||i.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(tR).positionInfo(this.view,t,i,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",(e=>{e.target==i&&e.preventDefault()}));let o=null;for(let r=n.from;r<n.to;r++){let{completion:s,match:a}=e[r],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;if(e!=o&&(r>n.from||0==n.from))if(o=e,"string"!=typeof l&&l.header)i.appendChild(l.header(l));else{i.appendChild(document.createElement("completion-section")).textContent=e}}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+r,c.setAttribute("role","option");let u=this.optionClass(s);u&&(c.className=u);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function sR(e,t){return n=>new rR(n,e,t)}function aR(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class lR{constructor(e,t,n,i,o,r){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=o,this.disabled=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new lR(this.options,dR(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,o,r){if(i&&!r&&e.some((e=>e.isPending)))return i.setDisabled();let s=function(e,t){let n=[],i=null,o=null,r=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some((t=>t.name==e))||i.push("string"==typeof t?{name:e}:t)}},s=t.facet(tR);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)r(new XT(t,i.source,e?e(t):[],1e9-n.length));else{let n,a=t.sliceDoc(i.from,i.to),l=s.filterStrict?new eR(a):new JT(a);for(let t of i.result.options)if(n=l.match(t.label)){let s=t.displayLabel?e?e(t,n.matched):[]:n.matched,a=n.score+(t.boost||0);if(r(new XT(t,i.source,s,a)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;o||(o=Object.create(null)),o[e]=Math.max(a,o[e]||-1e9)}}}}if(i){let e=Object.create(null),t=0,r=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?o[t.name]-o[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of i.sort(r))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let a=[],l=null,c=s.compareCompletions;for(let e of n.sort(((e,t)=>t.score-e.score||c(e.completion,t.completion)))){let t=e.completion;!l||l.label!=t.label||l.detail!=t.detail||null!=l.type&&null!=t.type&&l.type!=t.type||l.apply!=t.apply||l.boost!=t.boost?a.push(e):aR(e.completion)>aR(l)&&(a[a.length-1]=e),l=e.completion}return a}(e,t);if(!s.length)return i&&e.some((e=>e.isPending))?i.setDisabled():null;let a=t.facet(tR).selectOnOpen?0:-1;if(i&&i.selected!=a&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new lR(s,dR(n,a),{pos:e.reduce(((e,t)=>t.hasResult()?Math.min(e,t.from):e),1e8),create:xR,above:o.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new lR(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new lR(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class cR{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new cR(pR,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(tR),i=(n.override||t.languageDataAt("autocomplete",zT(t)).map(GT)).map((t=>{let i=this.active.find((e=>e.source==t))||new gR(t,this.active.some((e=>0!=e.state))?1:0);return i.update(e,n)}));i.length==this.active.length&&i.every(((e,t)=>e==this.active[t]))&&(i=this.active);let o=this.open,r=e.effects.some((e=>e.is(vR)));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;i<t.length&&!t[i].hasResult();)i++;let o=n==e.length,r=i==t.length;if(o||r)return o==r;if(e[n++].result!=t[i++].result)return!1}}(i,this.active)||r?o=lR.build(i,t,this.id,o,n,r):o&&o.disabled&&!i.some((e=>e.isPending))&&(o=null),!o&&i.every((e=>!e.isPending))&&i.some((e=>e.hasResult()))&&(i=i.map((e=>e.hasResult()?new gR(e.source,0):e)));for(let t of e.effects)t.is(yR)&&(o=o&&o.setSelected(t.value,this.id));return i==this.active&&o==this.open?this:new cR(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?uR:hR}}const uR={"aria-autocomplete":"list"},hR={};function dR(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const pR=[];function fR(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(WT);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class gR{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=fR(e,t),i=this;(8&n||16&n&&this.touches(e))&&(i=new gR(i.source,0)),4&n&&0==i.state&&(i=new gR(this.source,1)),i=i.updateFor(e,n);for(let t of e.effects)if(t.is(ZT))i=new gR(i.source,1,t.value);else if(t.is(KT))i=new gR(i.source,0);else if(t.is(vR))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(zT(e.state))}}class mR extends gR{constructor(e,t,n,i,o,r){super(e,3,t),this.limit=n,this.result=i,this.from=o,this.to=r}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let o=e.changes.mapPos(this.from),r=e.changes.mapPos(this.to,1),s=zT(e.state);if(s>r||!i||2&t&&(zT(e.startState)==this.from||s<this.limit))return new gR(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return function(e,t,n,i){if(!e)return!1;let o=t.sliceDoc(n,i);return"function"==typeof e?e(o,n,i,t):YT(e,!0).test(o)}(i.validFor,e.state,o,r)?new mR(this.source,this.explicit,a,i,o,r):i.update&&(i=i.update(i,o,r,new qT(e.state,s,!1)))?new mR(this.source,this.explicit,a,i,i.from,null!==(n=i.to)&&void 0!==n?n:zT(e.state)):new gR(this.source,1,this.explicit)}map(e){if(e.empty)return this;return(this.result.map?this.result.map(this.result,e):this.result)?new mR(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new gR(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const vR=gO.define({map:(e,t)=>e.map((e=>e.map(t)))}),yR=gO.define(),bR=Yx.define({create:()=>cR.start(),update:(e,t)=>e.update(t),provide:e=>[IS.from(e,(e=>e.tooltip)),hS.contentAttributes.from(e,(e=>e.attrs))]});function _R(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(bR).active.find((e=>e.source==t.source));return i instanceof mR&&("string"==typeof n?e.dispatch({...HT(e.state,n,i.from,i.to),annotations:WT.of(t.completion)}):n(e,t.completion,i.from,i.to),!0)}const xR=sR(bR,_R);function OR(e,t="option"){return n=>{let i=n.state.field(bR,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(tR).interactionDelay)return!1;let o,r=1;"page"==t&&(o=VS(n,i.open.tooltip))&&(r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:s}=i.open.options,a=i.open.selected>-1?i.open.selected+r*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:yR.of(a)}),!0}}const wR=e=>!!e.state.field(bR,!1)&&(e.dispatch({effects:ZT.of(!0)}),!0);class CR{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const kR=NC.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(bR).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(bR),n=e.state.facet(tR);if(!e.selectionSet&&!e.docChanged&&e.startState.field(bR)==t)return;let i=e.transactions.some((e=>{let t=fR(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)}));for(let t=0;t<this.running.length;t++){let n=this.running[t];if(i||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){IC(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some((e=>e.effects.some((e=>e.is(ZT)))))&&(this.pendingStart=!0);let o=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((e=>e.isPending&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),o):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(bR);for(let e of t.active)e.isPending&&!this.running.some((t=>t.active.source==e.source))&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(tR).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=zT(t),i=new qT(t,n,e.explicit,this.view),o=new CR(e,i);this.running.push(o),Promise.resolve(e.source(i)).then((e=>{o.context.aborted||(o.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:KT.of(null)}),IC(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(tR).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(tR),i=this.view.state.field(bR);for(let o=0;o<this.running.length;o++){let r=this.running[o];if(void 0===r.done)continue;if(this.running.splice(o--,1),r.done){let i=zT(r.updates.length?r.updates[0].startState:this.view.state),o=Math.min(i,r.done.from+(r.active.explicit?0:1)),s=new mR(r.active.source,r.active.explicit,o,r.done,r.done.from,null!==(e=r.done.to)&&void 0!==e?e:i);for(let e of r.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=i.active.find((e=>e.source==r.active.source));if(s&&s.isPending)if(null==r.done){let e=new gR(r.active.source,0);for(let t of r.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:vR.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(bR,!1);if(t&&t.tooltip&&this.view.state.facet(tR).closeOnBlur){let n=t.open&&VS(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:KT.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:ZT.of(!1)})),20),this.composing=0}}}),ER="object"==typeof navigator&&/Win/.test(navigator.platform),SR=Kx.highest(hS.domEventHandlers({keydown(e,t){let n=t.state.field(bR,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!ER||!e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],o=n.active.find((e=>e.source==i.source)),r=i.completion.commitCharacters||o.result.commitCharacters;return r&&r.indexOf(e.key)>-1&&_R(t,i),!1}})),$R=hS.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class PR{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class TR{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,Ex.TrackDel),n=e.mapPos(this.to,1,Ex.TrackDel);return null==t||null==n?null:new TR(this.field,t,n)}}class RR{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],o=e.doc.lineAt(t),r=/^\s*/.exec(o.text)[0];for(let o of this.lines){if(n.length){let n=r,s=/^\t*/.exec(o)[0].length;for(let t=0;t<s;t++)n+=e.facet(GP);i.push(t+n.length-s),o=n+o.slice(s)}n.push(o),t+=o.length+1}let s=this.fieldPositions.map((e=>new TR(e.field,i[e.line]+e.from,i[e.line]+e.to)));return{text:n,ranges:s}}static parse(e){let t,n=[],i=[],o=[];for(let r of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(r);){let e=t[1]?+t[1]:null,s=t[2]||t[3]||"",a=-1,l=s.replace(/\\[{}]/g,(e=>e[1]));for(let t=0;t<n.length;t++)(null!=e?n[t].seq==e:l&&n[t].name==l)&&(a=t);if(a<0){let t=0;for(;t<n.length&&(null==e||null!=n[t].seq&&n[t].seq<e);)t++;n.splice(t,0,{seq:e,name:l}),a=t;for(let e of o)e.field>=a&&e.field++}for(let e of o)if(e.line==i.length&&e.from>t.index){let n=t[2]?3+(t[1]||"").length:2;e.from-=n,e.to-=n}o.push(new PR(a,i.length,t.index,t.index+l.length)),r=r.slice(0,t.index)+s+r.slice(t.index+t[0].length)}r=r.replace(/\\([{}])/g,((e,t,n)=>{for(let e of o)e.line==i.length&&e.from>n&&(e.from--,e.to--);return t})),i.push(r)}return new RR(i,o)}}let AR=Sw.widget({widget:new class extends kw{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),MR=Sw.mark({class:"cm-snippetField"});class DR{constructor(e,t){this.ranges=e,this.active=t,this.deco=Sw.set(e.map((e=>(e.from==e.to?AR:MR).range(e.from,e.to))),!0)}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new DR(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const LR=gO.define({map:(e,t)=>e&&e.map(t)}),IR=gO.define(),QR=Yx.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(LR))return n.value;if(n.is(IR)&&e)return new DR(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>hS.decorations.from(e,(e=>e?e.deco:Sw.none))});function jR(e,t){return Ix.create(e.filter((e=>e.field==t)).map((e=>Ix.range(e.from,e.to))))}function BR(e){let t=RR.parse(e);return(e,n,i,o)=>{let{text:r,ranges:s}=t.instantiate(e.state,i),{main:a}=e.state.selection,l={changes:{from:i,to:o==a.from?a.to:o,insert:hx.of(r)},scrollIntoView:!0,annotations:n?[WT.of(n),mO.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=jR(s,0)),s.some((e=>e.field>0))){let t=new DR(s,0),n=l.effects=[LR.of(t)];void 0===e.state.field(QR,!1)&&n.push(gO.appendConfig.of([QR,VR,zR,$R]))}e.dispatch(e.state.update(l))}}function NR(e){return({state:t,dispatch:n})=>{let i=t.field(QR,!1);if(!i||e<0&&0==i.active)return!1;let o=i.active+e,r=e>0&&!i.ranges.some((t=>t.field==o+e));return n(t.update({selection:jR(i.ranges,o),effects:LR.of(r?null:new DR(i.ranges,o)),scrollIntoView:!0})),!0}}const qR=[{key:"Tab",run:NR(1),shift:NR(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(QR,!1)&&(t(e.update({effects:LR.of(null)})),!0)}],FR=Bx.define({combine:e=>e.length?e[0]:qR}),VR=Kx.highest(bS.compute([FR],(e=>e.facet(FR))));function XR(e,t){return{...t,apply:BR(e)}}const zR=hS.domEventHandlers({mousedown(e,t){let n,i=t.state.field(QR,!1);if(!i||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let o=i.ranges.find((e=>e.from<=n&&e.to>=n));return!(!o||o.field==i.active)&&(t.dispatch({selection:jR(i.ranges,o.field),effects:LR.of(i.ranges.some((e=>e.field>o.field))?new DR(i.ranges,o.field):null),scrollIntoView:!0}),!0)}}),YR={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},WR=gO.define({map(e,t){let n=t.mapPos(e,-1,Ex.TrackAfter);return null==n?void 0:n}}),HR=new class extends PO{};HR.startSide=1,HR.endSide=-1;const UR=Yx.define({create:()=>MO.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(WR)&&(e=e.update({add:[HR.range(n.value,n.value+1)]}));return e}});function GR(){return[eA,UR]}const ZR="()[]{}<>«»»«[]{}";function KR(e){for(let t=0;t<16;t+=2)if(ZR.charCodeAt(t)==e)return ZR.charAt(t+1);return wx(e<128?e:e+1)}const JR="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),eA=hS.inputHandler.of(((e,t,n,i)=>{if((JR?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let o=e.state.selection.main;if(i.length>2||2==i.length&&1==Cx(Ox(i,0))||t!=o.from||n!=o.to)return!1;let r=function(e,t){let n=function(e,t){return e.languageDataAt("closeBrackets",t)[0]||YR}(e,e.selection.main.head),i=n.brackets||YR.brackets;for(let o of i){let r=KR(Ox(o,0));if(t==o)return r==o?rA(e,o,i.indexOf(o+o+o)>-1,n):iA(e,o,r,n.before||YR.before);if(t==r&&tA(e,e.selection.main.from))return oA(e,o,r)}return null}(e.state,i);return!!r&&(e.dispatch(r),!0)}));function tA(e,t){let n=!1;return e.field(UR).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function nA(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Cx(Ox(n,0)))}function iA(e,t,n,i){let o=null,r=e.changeByRange((r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:n,from:r.to}],effects:WR.of(r.to+t.length),range:Ix.range(r.anchor+t.length,r.head+t.length)};let s=nA(e.doc,r.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:t+n,from:r.head},effects:WR.of(r.head+t.length),range:Ix.cursor(r.head+t.length)}:{range:o=r}}));return o?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function oA(e,t,n){let i=null,o=e.changeByRange((t=>t.empty&&nA(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Ix.cursor(t.head+n.length)}:i={range:t}));return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function rA(e,t,n,i){let o=i.stringPrefixes||YR.stringPrefixes,r=null,s=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:WR.of(i.to+t.length),range:Ix.range(i.anchor+t.length,i.head+t.length)};let s,a=i.head,l=nA(e.doc,a);if(l==t){if(sA(e,a))return{changes:{insert:t+t,from:a},effects:WR.of(a+t.length),range:Ix.cursor(a+t.length)};if(tA(e,a)){let i=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+i.length,insert:i},range:Ix.cursor(a+i.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=aA(e,a-2*t.length,o))>-1&&sA(e,s))return{changes:{insert:t+t+t+t,from:a},effects:WR.of(a+t.length),range:Ix.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=wO.Word&&aA(e,a,o)>-1&&!function(e,t,n,i){let o=jP(e).resolveInner(t,-1),r=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let s=0;s<5;s++){let s=e.sliceDoc(o.from,Math.min(o.to,o.from+n.length+r)),a=s.indexOf(n);if(!a||a>-1&&i.indexOf(s.slice(0,a))>-1){let t=o.firstChild;for(;t&&t.from==o.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=o.to==t&&o.parent;if(!l)break;o=l}return!1}(e,a,t,o))return{changes:{insert:t+t,from:a},effects:WR.of(a+t.length),range:Ix.cursor(a+t.length)}}return{range:r=i}}));return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function sA(e,t){let n=jP(e).resolveInner(t+1);return n.parent&&n.from==t}function aA(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=wO.Word)return t;for(let o of n){let n=t-o.length;if(e.sliceDoc(n,t)==o&&i(e.sliceDoc(n-1,n))!=wO.Word)return n}return-1}function lA(e={}){return[SR,bR,tR.of(e),kR,uA,$R]}const cA=[{key:"Ctrl-Space",run:wR},{mac:"Alt-`",run:wR},{mac:"Alt-i",run:wR},{key:"Escape",run:e=>{let t=e.state.field(bR,!1);return!(!t||!t.active.some((e=>0!=e.state)))&&(e.dispatch({effects:KT.of(null)}),!0)}},{key:"ArrowDown",run:OR(!0)},{key:"ArrowUp",run:OR(!1)},{key:"PageDown",run:OR(!0,"page")},{key:"PageUp",run:OR(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(bR,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(tR).interactionDelay)&&_R(e,t.open.options[t.open.selected])}}],uA=Kx.highest(bS.computeN([tR],(e=>e.facet(tR).defaultKeymap?[cA]:[])));function hA(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(i(n.update(o)),!0)}}const dA=hA(yA,0),pA=hA(vA,0),fA=hA(((e,t)=>vA(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),o=n.to<=i.to?i:e.doc.lineAt(n.to);o.from>i.from&&o.from==n.to&&(o=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let r=t.length-1;r>=0&&t[r].to>i.from?t[r].to=o.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:o.to})}return t}(t))),0);function gA(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const mA=50;function vA(e,t,n=t.selection.ranges){let i=n.map((e=>gA(t,e.from).block));if(!i.every((e=>e)))return null;let o=n.map(((e,n)=>function(e,{open:t,close:n},i,o){let r,s,a=e.sliceDoc(i-mA,i),l=e.sliceDoc(o,o+mA),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(l)[0].length,h=a.length-c;if(a.slice(h-t.length,h)==t&&l.slice(u,u+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-i<=2*mA?r=s=e.sliceDoc(i,o):(r=e.sliceDoc(i,i+mA),s=e.sliceDoc(o-mA,o));let d=/^\s*/.exec(r)[0].length,p=/\s*$/.exec(s)[0].length,f=s.length-p-n.length;return r.slice(d,d+t.length)==t&&s.slice(f,f+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(r.charAt(d+t.length))?1:0},close:{pos:o-p-n.length,margin:/\s/.test(s.charAt(f-1))?1:0}}:null}(t,i[n],e.from,e.to)));if(2!=e&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}])))};if(1!=e&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=i[n],{open:r,close:s}=t;e.push({from:r.pos-o.open.length,to:r.pos+r.margin},{from:s.pos-s.margin,to:s.pos+o.close.length})}return{changes:e}}return null}function yA(e,t,n=t.selection.ranges){let i=[],o=-1;for(let{from:e,to:r}of n){let n=i.length,s=1e9,a=gA(t,e).line;if(a){for(let n=e;n<=r;){let l=t.doc.lineAt(n);if(l.from>o&&(e==r||r>l.from)){o=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),i.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.to+1}if(s<1e9)for(let e=n;e<i.length;e++)i[e].indent<i[e].line.text.length&&(i[e].indent=s);i.length==n+1&&(i[n].single=!0)}}if(2!=e&&i.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:r,single:s}of i)!s&&r||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of i)if(n>=0){let i=t.from+n,r=i+o.length;" "==t.text[r-t.from]&&r++,e.push({from:i,to:r})}return{changes:e}}return null}function bA(e,t){return Ix.create(e.ranges.map(t),e.mainIndex)}function _A(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function xA({state:e,dispatch:t},n){let i=bA(e.selection,n);return!i.eq(e.selection,!0)&&(t(_A(e,i)),!0)}function OA(e,t){return Ix.cursor(t?e.to:e.from)}function wA(e,t){return xA(e,(n=>n.empty?e.moveByChar(n,t):OA(n,t)))}function CA(e){return e.textDirectionAt(e.state.selection.main.head)==nC.LTR}const kA=e=>wA(e,!CA(e)),EA=e=>wA(e,CA(e));function SA(e,t){return xA(e,(n=>n.empty?e.moveByGroup(n,t):OA(n,t)))}function $A(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function PA(e,t,n){let i,o,r=jP(e).resolveInner(t.head),s=n?y$.closedBy:y$.openedBy;for(let i=t.head;;){let t=n?r.childAfter(i):r.childBefore(i);if(!t)break;$A(e,t,s)?r=t:i=n?t.to:t.from}return o=r.type.prop(s)&&(i=n?AT(e,r.from,1):AT(e,r.to,-1))&&i.matched?n?i.end.to:i.end.from:n?r.to:r.from,Ix.cursor(o,n?-1:1)}function TA(e,t){return xA(e,(n=>{if(!n.empty)return OA(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)}))}const RA=e=>TA(e,!1),AA=e=>TA(e,!0);function MA(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,i=0,o=0;if(n){for(let t of e.state.facet(hS.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(o=Math.max(null==n?void 0:n.bottom,o))}t=e.scrollDOM.clientHeight-i-o}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:o,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function DA(e,t){let n,i=MA(e),{state:o}=e,r=bA(o.selection,(n=>n.empty?e.moveVertically(n,t,i.height):OA(n,t)));if(r.eq(o.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(o.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+i.marginTop,l=s.bottom-i.marginBottom;t&&t.top>a&&t.bottom<l&&(n=hS.scrollIntoView(r.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(_A(o,r),{effects:n}),!0}const LA=e=>DA(e,!1),IA=e=>DA(e,!0);function QA(e,t,n){let i=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?i.to:i.from)&&(o=e.moveToLineBoundary(t,n,!1)),!n&&o.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(o=Ix.cursor(i.from+n))}return o}function jA(e,t){let n=bA(e.state.selection,(e=>{let n=t(e);return Ix.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(_A(e.state,n)),!0)}function BA(e,t){return jA(e,(n=>e.moveByChar(n,t)))}const NA=e=>BA(e,!CA(e)),qA=e=>BA(e,CA(e));function FA(e,t){return jA(e,(n=>e.moveByGroup(n,t)))}function VA(e,t){return jA(e,(n=>e.moveVertically(n,t)))}const XA=e=>VA(e,!1),zA=e=>VA(e,!0);function YA(e,t){return jA(e,(n=>e.moveVertically(n,t,MA(e).height)))}const WA=e=>YA(e,!1),HA=e=>YA(e,!0),UA=({state:e,dispatch:t})=>(t(_A(e,{anchor:0})),!0),GA=({state:e,dispatch:t})=>(t(_A(e,{anchor:e.doc.length})),!0),ZA=({state:e,dispatch:t})=>(t(_A(e,{anchor:e.selection.main.anchor,head:0})),!0),KA=({state:e,dispatch:t})=>(t(_A(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function JA(e,t){let{state:n}=e,i=n.selection,o=n.selection.ranges.slice();for(let i of n.selection.ranges){let r=n.doc.lineAt(i.head);if(t?r.to<e.state.doc.length:r.from>0)for(let n=i;;){let i=e.moveVertically(n,t);if(i.head<r.from||i.head>r.to){o.some((e=>e.head==i.head))||o.push(i);break}if(i.head==n.head)break;n=i}}return o.length!=i.ranges.length&&(e.dispatch(_A(n,Ix.create(o,o.length-1))),!0)}function eM(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,o=i.changeByRange((i=>{let{from:o,to:r}=i;if(o==r){let s=t(i);s<o?(n="delete.backward",s=tM(e,s,!1)):s>o&&(n="delete.forward",s=tM(e,s,!0)),o=Math.min(o,s),r=Math.max(r,s)}else o=tM(e,o,!1),r=tM(e,r,!0);return o==r?{range:i}:{changes:{from:o,to:r},range:Ix.cursor(o,o<i.head?-1:1)}}));return!o.changes.empty&&(e.dispatch(i.update(o,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?hS.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function tM(e,t,n){if(e instanceof hS)for(let i of e.state.facet(hS.atomicRanges).map((t=>t(e))))i.between(t,t,((e,i)=>{e<t&&i>t&&(t=n?i:e)}));return t}const nM=(e,t,n)=>eM(e,(i=>{let o,r,s=i.from,{state:a}=e,l=a.doc.lineAt(s);if(n&&!t&&s>l.from&&s<l.from+200&&!/[^ \t]/.test(o=l.text.slice(0,s-l.from))){if("\t"==o[o.length-1])return s-1;let e=zO(o,a.tabSize)%ZP(a)||ZP(a);for(let t=0;t<e&&" "==o[o.length-1-t];t++)s--;r=s}else r=xx(l.text,s-l.from,t,t)+l.from,r==s&&l.number!=(t?a.doc.lines:1)?r+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(r-l.from,s-l.from))&&(r=xx(l.text,r-l.from,!1,!1)+l.from);return r})),iM=e=>nM(e,!1,!0),oM=e=>nM(e,!0,!1),rM=(e,t)=>eM(e,(n=>{let i=n.head,{state:o}=e,r=o.doc.lineAt(i),s=o.charCategorizer(i);for(let e=null;;){if(i==(t?r.to:r.from)){i==n.head&&r.number!=(t?o.doc.lines:1)&&(i+=t?1:-1);break}let a=xx(r.text,i-r.from,t)+r.from,l=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&i==n.head||(e=c),i=a}return i})),sM=e=>rM(e,!1);function aM(e){let t=[],n=-1;for(let i of e.selection.ranges){let o=e.doc.lineAt(i.from),r=e.doc.lineAt(i.to);if(i.empty||i.to!=r.from||(r=e.doc.lineAt(i.to-1)),n>=o.number){let e=t[t.length-1];e.to=r.to,e.ranges.push(i)}else t.push({from:o.from,to:r.to,ranges:[i]});n=r.number+1}return t}function lM(e,t,n){if(e.readOnly)return!1;let i=[],o=[];for(let t of aM(e)){if(n?t.to==e.doc.length:0==t.from)continue;let r=e.doc.lineAt(n?t.to+1:t.from-1),s=r.length+1;if(n){i.push({from:t.to,to:r.to},{from:t.from,insert:r.text+e.lineBreak});for(let n of t.ranges)o.push(Ix.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{i.push({from:r.from,to:t.from},{from:t.to,insert:e.lineBreak+r.text});for(let e of t.ranges)o.push(Ix.range(e.anchor-s,e.head-s))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:Ix.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0)}function cM(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of aM(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let o=e.changes(i);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const uM=dM(!1),hM=dM(!0);function dM(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((n=>{let{from:i,to:o}=n,r=t.doc.lineAt(i),s=!e&&i==o&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=jP(e).resolveInner(t),o=i.childBefore(t),r=i.childAfter(t);return o&&r&&o.to<=t&&r.from>=t&&(n=o.type.prop(y$.closedBy))&&n.indexOf(r.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(o.to,r.from))?{from:o.to,to:r.from}:null}(t,i);e&&(i=o=(o<=r.to?r:t.doc.lineAt(o)).to);let a=new eT(t,{simulateBreak:i,simulateDoubleBreak:!!s}),l=JP(a,i);for(null==l&&(l=zO(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<r.to&&/\s/.test(r.text[o-r.from]);)o++;s?({from:i,to:o}=s):i>r.from&&i<r.from+100&&!/\S/.test(r.text.slice(0,i))&&(i=r.from);let c=["",KP(t,l)];return s&&c.push(KP(t,a.lineIndent(r.from,-1))),{changes:{from:i,to:o,insert:hx.of(c)},range:Ix.cursor(i+1+c[1].length)}}));return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function pM(e,t){let n=-1;return e.changeByRange((i=>{let o=[];for(let r=i.from;r<=i.to;){let s=e.doc.lineAt(r);s.number>n&&(i.empty||i.to>s.from)&&(t(s,o,i),n=s.number),r=s.to+1}let r=e.changes(o);return{changes:o,range:Ix.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}}))}const fM=[{key:"Ctrl-b",run:kA,shift:NA,preventDefault:!0},{key:"Ctrl-f",run:EA,shift:qA},{key:"Ctrl-p",run:RA,shift:XA},{key:"Ctrl-n",run:AA,shift:zA},{key:"Ctrl-a",run:e=>xA(e,(t=>Ix.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>jA(e,(t=>Ix.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>xA(e,(t=>Ix.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>jA(e,(t=>Ix.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:oM},{key:"Ctrl-h",run:iM},{key:"Ctrl-k",run:e=>eM(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}))},{key:"Ctrl-Alt-h",run:sM},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:hx.of(["",""])},range:Ix.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),o=n==i.from?n-1:xx(i.text,n-i.from,!1)+i.from,r=n==i.to?n+1:xx(i.text,n-i.from,!0)+i.from;return{changes:{from:o,to:r,insert:e.doc.slice(n,r).append(e.doc.slice(o,n))},range:Ix.cursor(r)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:IA}],gM=[{key:"ArrowLeft",run:kA,shift:NA,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>SA(e,!CA(e)),shift:e=>FA(e,!CA(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>xA(e,(t=>QA(e,t,!CA(e)))),shift:e=>jA(e,(t=>QA(e,t,!CA(e)))),preventDefault:!0},{key:"ArrowRight",run:EA,shift:qA,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>SA(e,CA(e)),shift:e=>FA(e,CA(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>xA(e,(t=>QA(e,t,CA(e)))),shift:e=>jA(e,(t=>QA(e,t,CA(e)))),preventDefault:!0},{key:"ArrowUp",run:RA,shift:XA,preventDefault:!0},{mac:"Cmd-ArrowUp",run:UA,shift:ZA},{mac:"Ctrl-ArrowUp",run:LA,shift:WA},{key:"ArrowDown",run:AA,shift:zA,preventDefault:!0},{mac:"Cmd-ArrowDown",run:GA,shift:KA},{mac:"Ctrl-ArrowDown",run:IA,shift:HA},{key:"PageUp",run:LA,shift:WA},{key:"PageDown",run:IA,shift:HA},{key:"Home",run:e=>xA(e,(t=>QA(e,t,!1))),shift:e=>jA(e,(t=>QA(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:UA,shift:ZA},{key:"End",run:e=>xA(e,(t=>QA(e,t,!0))),shift:e=>jA(e,(t=>QA(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:GA,shift:KA},{key:"Enter",run:uM,shift:uM},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:iM,shift:iM,preventDefault:!0},{key:"Delete",run:oM,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:sM,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>rM(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>eM(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})),preventDefault:!0},{mac:"Mod-Delete",run:e=>eM(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})),preventDefault:!0}].concat(fM.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),mM=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>xA(e,(t=>PA(e.state,t,!CA(e)))),shift:e=>jA(e,(t=>PA(e.state,t,!CA(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>xA(e,(t=>PA(e.state,t,CA(e)))),shift:e=>jA(e,(t=>PA(e.state,t,CA(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>lM(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>cM(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>lM(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>cM(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>JA(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>JA(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=Ix.create([n.main]):n.main.empty||(i=Ix.create([Ix.cursor(n.main.head)])),!!i&&(t(_A(e,i)),!0)}},{key:"Mod-Enter",run:hM},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=aM(e).map((({from:t,to:n})=>Ix.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:Ix.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=bA(e.selection,(t=>{let n=jP(e),i=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Ix.range(n.to,n.from)}return t}));return!n.eq(e.selection)&&(t(_A(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(pM(e,((t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let o=zO(i,e.tabSize),r=0,s=KP(e,Math.max(0,o-ZP(e)));for(;r<i.length&&r<s.length&&i.charCodeAt(r)==s.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+i.length,insert:s.slice(r)})})),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(pM(e,((t,n)=>{n.push({from:t.from,insert:e.facet(GP)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new eT(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=pM(e,((t,o,r)=>{let s=JP(i,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=KP(e,s);(a!=l||r.from<t.from+a.length)&&(n[t.from]=s,o.push({from:t.from,to:t.from+a.length,insert:l}))}));return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(aM(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),i=bA(t.selection,(t=>{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),o=e.coordsAtPos(t.head,t.assoc||1);o&&(n=i.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t){let n=!1,i=bA(e.selection,(t=>{let i=AT(e,t.head,-1)||AT(e,t.head,1)||t.head>0&&AT(e,t.head-1,1)||t.head<e.doc.length&&AT(e,t.head+1,-1);if(!i||!i.end)return t;n=!0;let o=i.start.from==t.head?i.end.to:i.end.from;return Ix.cursor(o)}));return!!n&&(t(_A(e,i)),!0)}(e,t)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=gA(e.state,n.from);return i.line?dA(e):!!i.block&&fA(e)}},{key:"Alt-A",run:pA},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat(gM);class vM{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class yM{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=n.facet(TM).markerFilter;i&&(e=i(e,n));let o=e.slice().sort(((e,t)=>e.from-t.from||e.to-t.to)),r=new DO,s=[],a=0,l=n.doc.iter(),c=0,u=n.doc.length;for(let e=0;;){let t,n,i=e==o.length?null:o[e];if(!i&&!s.length)break;if(s.length)t=a,n=s.reduce(((e,t)=>Math.min(e,t.to)),i&&i.from>t?i.from:1e8);else{if(t=i.from,t>u)break;n=i.to,s.push(i),e++}for(;e<o.length;){let i=o[e];if(i.from!=t||!(i.to>i.from||i.to==t)){n=Math.min(i.from,n);break}s.push(i),e++,n=Math.min(i.to,n)}n=Math.min(n,u);let h=!1;if(s.some((e=>e.from==t&&(e.to==n||n==u)))&&(h=t==n,!h&&n-t<10)){let e=t-(c+l.value.length);e>0&&(l.next(e),c=t);for(let e=t;;){if(e>=n){h=!0;break}if(!l.lineBreak&&c+l.value.length>e)break;e=c+l.value.length,c+=l.value.length,l.next()}}let d=qM(s);if(h)r.add(t,t,Sw.widget({widget:new LM(d),diagnostics:s.slice()}));else{let e=s.reduce(((e,t)=>t.markClass?e+" "+t.markClass:e),"");r.add(t,n,Sw.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some((e=>e.to>n))}))}if(a=n,a==u)break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1)}let h=r.finish();return new yM(h,t,bM(h))}}function bM(e,t=null,n=0){let i=null;return e.between(n,1e9,((e,n,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(i){if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new vM(i.from,n,i.diagnostic)}else i=new vM(e,n,t||o.diagnostics[0])})),i}function _M(e,t){return e.field(CM,!1)?t:t.concat(gO.appendConfig.of(FM))}const xM=gO.define(),OM=gO.define(),wM=gO.define(),CM=Yx.define({create:()=>new yM(Sw.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,o=e.panel;if(e.selected){let o=t.changes.mapPos(e.selected.from,1);i=bM(n,e.selected.diagnostic,o)||bM(n,null,o)}!n.size&&o&&t.state.facet(TM).autoPanel&&(o=null),e=new yM(n,o,i)}for(let n of t.effects)if(n.is(xM)){let i=t.state.facet(TM).autoPanel?n.value.length?QM.open:null:e.panel;e=yM.init(n.value,i,t.state)}else n.is(OM)?e=new yM(e.diagnostics,n.value?QM.open:null,e.selected):n.is(wM)&&(e=new yM(e.diagnostics,e.panel,n.value));return e},provide:e=>[US.from(e,(e=>e.panel)),hS.decorations.from(e,(e=>e.diagnostics))]}),kM=Sw.mark({class:"cm-lintRange cm-lintRange-active"});function EM(e,t,n){let i,{diagnostics:o}=e.state.field(CM),r=-1,s=-1;o.between(t-(n<0?1:0),t+(n>0?1:0),((e,o,{spec:a})=>{if(t>=e&&t<=o&&(e==o||(t>e||n>0)&&(t<o||n<0)))return i=a.diagnostics,r=e,s=o,!1}));let a=e.state.facet(TM).tooltipFilter;return i&&a&&(i=a(i,e.state)),i?{pos:r,end:s,above:e.state.doc.lineAt(r).to<s,create:()=>({dom:SM(e,i)})}:null}function SM(e,t){return sw("ul",{class:"cm-tooltip-lint"},t.map((t=>DM(e,t,!1))))}const $M=e=>{let t=e.state.field(CM,!1);return!(!t||!t.panel)&&(e.dispatch({effects:OM.of(!1)}),!0)},PM=NC.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(TM);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(TM);t.length&&function(e,t,n){let i=[],o=-1;for(let r of e)r.then((n=>{i.push(n),clearTimeout(o),i.length==e.length?t(i):o=setTimeout((()=>t(i)),200)}),n)}(t.map((e=>Promise.resolve(e(this.view)))),(t=>{this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:_M(e,[xM.of(t)])}}(this.view.state,t.reduce(((e,t)=>e.concat(t)))))}),(e=>{IC(this.view.state,e)}))}}update(e){let t=e.state.facet(TM);(e.docChanged||t!=e.startState.facet(TM)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});const TM=Bx.define({combine:e=>({sources:e.map((e=>e.source)).filter((e=>null!=e)),...$O(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:RM,tooltipFilter:RM,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,i,o)=>e(n,i,o)||t(n,i,o):e:t,autoPanel:(e,t)=>e||t})})});function RM(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function AM(e,t={}){return[TM.of({source:e,config:t}),PM,FM]}function MM(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let i=n[e];if(/[a-zA-Z]/.test(i)&&!t.some((e=>e.toLowerCase()==i.toLowerCase()))){t.push(i);continue e}}t.push("")}return t}function DM(e,t,n){var i;let o=n?MM(t.actions):[];return sw("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},sw("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(i=t.actions)||void 0===i?void 0:i.map(((n,i)=>{let r=!1,s=i=>{if(i.preventDefault(),r)return;r=!0;let o=bM(e.state.field(CM).diagnostics,t);o&&n.apply(e,o.from,o.to)},{name:a}=n,l=o[i]?a.indexOf(o[i]):-1,c=l<0?a:[a.slice(0,l),sw("u",a.slice(l,l+1)),a.slice(l+1)];return sw("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${o[i]})"`}.`},c)})),t.source&&sw("div",{class:"cm-diagnosticSource"},t.source))}class LM extends kw{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return sw("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class IM{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=DM(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class QM{constructor(e){this.view=e,this.items=[];this.list=sw("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)$M(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=MM(n.actions);for(let o=0;o<i.length;o++)if(i[o].toUpperCase().charCodeAt(0)==t.keyCode){let t=bM(this.view.state.field(CM).diagnostics,n);t&&n.actions[o].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=sw("div",{class:"cm-panel-lint"},this.list,sw("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>$M(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(CM).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(CM),n=0,i=!1,o=null,r=new Set;for(e.between(0,this.view.state.doc.length,((e,s,{spec:a})=>{for(let e of a.diagnostics){if(r.has(e))continue;r.add(e);let s,a=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){a=t;break}a<0?(s=new IM(this.view,e),this.items.splice(n,0,s),i=!0):(s=this.items[a],a>n&&(this.items.splice(n,a-n),i=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),o=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}}));n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new IM(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=bM(this.view.state.field(CM).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:wM.of(t)})}static open(e){return new QM(e)}}function jM(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const BM=hS.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:jM("#d11")},".cm-lintRange-warning":{backgroundImage:jM("orange")},".cm-lintRange-info":{backgroundImage:jM("#999")},".cm-lintRange-hint":{backgroundImage:jM("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function NM(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function qM(e){let t="hint",n=1;for(let i of e){let e=NM(i.severity);e>n&&(n=e,t=i.severity)}return t}const FM=[CM,hS.decorations.compute([CM],(e=>{let{selected:t,panel:n}=e.field(CM);return t&&n&&t.from!=t.to?Sw.set([kM.range(t.from,t.to)]):Sw.none})),FS(EM,{hideOn:function(e,t){let n=t.pos,i=t.end||n,o=e.state.facet(TM).hideOn(e,n,i);if(null!=o)return o;let r=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(xM)))&&!e.changes.touchesRange(r.from,Math.max(r.to,i)))}}),BM];class VM{constructor(e,t,n,i,o,r,s,a,l,c=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=o,this.score=r,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new VM(e,[],t,n,n,0,[],0,i?new XM(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:o}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),s=o.dynamicPrecedence(i);if(s&&(this.score+=s),0==n)return this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),void this.reduceContext(i,this.reducePos);let a=this.stack.length-3*(n-1)-(262144&e?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let u=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-u;if(i<o.minRepeatTerm||131072&e){let e=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,e,h+4,!0)}if(262144&e)this.state=this.stack[a];else{let e=this.stack[a-3];this.state=o.getGoto(e,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=4,o=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,i=this.buffer.length;if(0==i&&e.parent&&(i=e.bufferBase-e.parent.bufferBase,e=e.parent),i>0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(o&&this.pos!=n){let o=this.buffer.length;if(o>0&&(0!=this.buffer[o-4]||this.buffer[o-1]<0)){let e=!1;for(let t=o;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let o=e,{parser:r}=this.p;(i>this.pos||t<=r.maxNode)&&(this.pos=i,r.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,n),this.shiftContext(t,n),t<=r.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new VM(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new zM(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,o=0;o<t.length;o+=2)(i=t[o+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[o],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let i=t[e+1];n.some(((e,t)=>1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let i=t[e+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[e],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=65535&t,o=this.stack.length-3*n;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,o)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-o;if(n>1){let i=65535&t,o=this.stack.length-3*n;if(o>=0&&e.getGoto(this.stack[o],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,o+1);if(null!=e)return e}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new XM(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class XM{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class zM{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class YM{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new YM(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new YM(this.stack,this.pos,this.index)}}function WM(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,o=0;i<e.length;){let r=0;for(;;){let t=e.charCodeAt(i++),n=!1;if(126==t){r=65535;break}t>=92&&t--,t>=34&&t--;let o=t-32;if(o>=46&&(o-=46,n=!0),r+=o,n)break;r*=46}n?n[o++]=r:n=new t(r)}return n}class HM{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const UM=new HM;class GM{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=UM,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!i)return null;let e=this.ranges[--i];o-=n.from-e.to,n=e}for(;t<0?o>n.to:o>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];o+=e.from-n.to,n=e}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(e,1);if(null==i)return-1;if(t=i,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,i=this.range;for(;i.to<=t;)i=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=UM,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class ZM{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,i,o,r){let s=0,a=1<<i,{dialect:l}=n.p.parser;e:for(;a&e[s];){let n=e[s+1];for(let i=s+3;i<n;i+=2)if((e[i+1]&a)>0){let n=e[i];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||eD(n,t.token.value,o,r))){t.acceptToken(n);break}}let i=t.next,c=0,u=e[s+2];if(!(t.next<0&&u>c&&65535==e[n+3*u-3])){for(;c<u;){let o=c+u>>1,r=n+o+(o<<1),a=e[r],l=e[r+1]||65536;if(i<a)u=o;else{if(!(i>=l)){s=e[r+2],t.advance();continue e}c=o+1}}break}s=e[n+3*u-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}ZM.prototype.contextual=ZM.prototype.fallback=ZM.prototype.extend=!1,ZM.prototype.fallback=ZM.prototype.extend=!1;class KM{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function JM(e,t,n){for(let i,o=t;65535!=(i=e[o]);o++)if(i==n)return o-t;return-1}function eD(e,t,n,i){let o=JM(n,i,t);return o<0||JM(n,i,e)<o}const tD="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let nD=null;function iD(e,t,n){let i=e.cursor(k$.IncludeAnonymous);for(i.moveTo(t);;)if(!(n<0?i.childBefore(t):i.childAfter(t)))for(;;){if((n<0?i.to<t:i.from>t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}let oD=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?iD(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?iD(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],r=this.start[t]+n.positions[i];if(r>e)return this.nextStart=r,null;if(o instanceof E$){if(r==e){if(r<this.safeFrom)return null;let e=r+o.length;if(e<=this.safeTo){let t=o.prop(y$.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,r+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(r),this.index.push(0))}else this.index[t]++,this.nextStart=r+o.length}}};class rD{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new HM))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:o}=i,r=i.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let i=0;i<o.length;i++){if(!(1<<i&r))continue;let l=o[i],c=this.tokens[i];if((!n||l.fallback)&&((l.contextual||c.start!=e.pos||c.mask!=r||c.context!=s)&&(this.updateCachedToken(c,l,e),c.mask=r,c.context=s),c.lookAhead>c.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new HM,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new HM,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i<t.specialized.length;i++)if(t.specialized[i]==e.value){let o=t.specializers[i](this.stream.read(e.start,e.end),n);if(o>=0&&n.p.parser.dialect.allows(o>>1)){1&o?e.extended=o>>1:e.value=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t<i;t+=3)if(this.actions[t]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:o}=e,{parser:r}=e.p,{data:s}=r;for(let e=0;e<2;e++)for(let a=r.stateSlot(o,e?2:1);;a+=3){if(65535==s[a]){if(1!=s[a+1]){0==i&&2==s[a+1]&&(i=this.putAction(dD(s,a+2),t,n,i));break}a=dD(s,a+2)}s[a]==t&&(i=this.putAction(dD(s,a+1),t,n,i))}return i}}class sD{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new GM(t,i),this.tokens=new rD(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[VM.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>4*e.bufferLength?new oD(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,o=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<n.length;r++){let s=n[r];for(;;){if(this.tokens.mainToken=null,s.pos>i)o.push(s);else{if(this.advanceStack(s,o,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!o.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return tD&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw tD&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,o);if(n)return tD&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(o.length>e)for(o.sort(((e,t)=>t.score-e.score));o.length>e;)o.pop();o.some((e=>e.reducePos>i))&&this.recovering--}else if(o.length>1){e:for(let e=0;e<o.length-1;e++){let t=o[e];for(let n=e+1;n<o.length;n++){let i=o[n];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){o.splice(e--,1);continue e}o.splice(n--,1)}}}o.length>12&&(o.sort(((e,t)=>t.score-e.score)),o.splice(12,o.length-12))}this.minStackPos=o[0].pos;for(let e=1;e<o.length;e++)o[e].pos<this.minStackPos&&(this.minStackPos=o[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:o}=this,r=tD?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(i);s;){let i=this.parser.nodeSet.types[s.type.id]==s.type?o.getGoto(e.state,s.type.id):-1;if(i>-1&&s.length&&(!t||(s.prop(y$.contextHash)||0)==n))return e.useNode(s,i),tD&&console.log(r+this.stackID(e)+` (via reuse of ${o.getName(s.type.id)})`),!0;if(!(s instanceof E$)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(!(a instanceof E$&&0==s.positions[0]))break;s=a}}let s=o.stateSlot(e.state,4);if(s>0)return e.reduce(s),tD&&console.log(r+this.stackID(e)+` (via always-reduce ${o.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let s=0;s<a.length;){let l=a[s++],c=a[s++],u=a[s++],h=s==a.length||!n,d=h?e:e.split(),p=this.tokens.mainToken;if(d.apply(l,c,p?p.start:d.pos,u),tD&&console.log(r+this.stackID(d)+` (via ${65536&l?`reduce of ${o.getName(65535&l)}`:"shift"} for ${o.getName(c)} @ ${i}${d==e?"":", split"})`),h)return!0;d.pos>i?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return aD(e,t),!0}}runRecovery(e,t,n){let i=null,o=!1;for(let r=0;r<e.length;r++){let s=e[r],a=t[r<<1],l=t[1+(r<<1)],c=tD?this.stackID(s)+" -> ":"";if(s.deadEnd){if(o)continue;if(o=!0,s.restart(),tD&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}let u=s.split(),h=c;for(let e=0;e<10&&u.forceReduce();e++){if(tD&&console.log(h+this.stackID(u)+" (via force-reduce)"),this.advanceFully(u,n))break;tD&&(h=this.stackID(u)+" -> ")}for(let e of s.recoverByInsert(a))tD&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),tD&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),aD(s,n)):(!i||i.score<s.score)&&(i=s)}return i}stackToTree(e){return e.close(),E$.build({buffer:YM.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(nD||(nD=new WeakMap)).get(e);return t||nD.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function aD(e,t){for(let n=0;n<t.length;n++){let i=t[n];if(i.pos==e.pos&&i.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class lD{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}const cD=e=>e;class uD{constructor(e){this.start=e.start,this.shift=e.shift||cD,this.reduce=e.reduce||cD,this.reuse=e.reuse||cD,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class hD extends z${constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map((t=>e.topRules[t][1])),i=[];for(let e=0;e<t.length;e++)i.push([]);function o(e,t,n){i[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=y$[e]);for(let n=1;n<t.length;){let i=t[n++];if(i>=0)o(i,e,t[n++]);else{let r=t[n+-i];for(let s=-i;s>0;s--)o(t[n++],e,r);n++}}}this.nodeSet=new O$(t.map(((t,o)=>x$.define({name:o>=this.minRepeatTerm?void 0:t,id:o,props:i[o],top:n.indexOf(o)>-1,error:0==o,skipped:e.skippedNodes&&e.skippedNodes.indexOf(o)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=g$;let r=WM(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(pD),this.states=WM(e.states,Uint32Array),this.data=WM(e.stateData),this.goto=WM(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map((e=>"number"==typeof e?new ZM(r,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new sD(this,e,t,n);for(let o of this.wrappers)i=o(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let o=i[t+1];;){let t=i[o++],r=1&t,s=i[o++];if(r&&n)return s;for(let n=o+(t>>1);o<n;o++)if(i[o]==e)return s;if(r)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let o,r=this.stateSlot(e,i?2:1);;r+=3){if(65535==(o=n[r])){if(1!=n[r+1]){if(2==n[r+1])return dD(n,r+2);break}o=n[r=dD(n,r+2)]}if(o==t||0==o)return dD(n,r+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=dD(this.data,n+2)}i=t(dD(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=dD(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(hD.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let o=e.specializers.find((e=>e.from==n.external));if(!o)return n;let r=Object.assign(Object.assign({},n),{external:o.to});return t.specializers[i]=pD(r),r}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,o=this.dialects[t[e]];65535!=(n=this.data[o++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new lD(e,n,i)}static deserialize(e){return new hD(e)}}function dD(e,t){return e[t]|e[t+1]<<16}function pD(e){if(e.external){let t=e.extend?1:0;return(n,i)=>e.external(n,i)<<1|t}return e.get}const fD=122,gD=123,mD=4,vD=131,yD=19,bD=140,_D=23,xD=141,OD=41,wD=68,CD=154,kD=70,ED=155,SD=72,$D=156,PD=168,TD=89,RD=90,AD=170,MD=97,DD=172,LD="undefined"!=typeof process&&process.env&&/\bfparse(:dbg)?\b/.test(process.env.LOG),ID="undefined"!=typeof process&&process.env&&/\bfparse:dbg\b/.test(process.env.LOG),QD="undefined"!=typeof process&&process.env&&/\bcontext\b/.test(process.env.LOG),jD=[9,11,12,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],BD=FD("\n\r"),ND="*".charCodeAt(0),qD=FD("'./-+*^");function FD(e){return Array.from(e).map((e=>e.charCodeAt(0)))}function VD(e){return e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}function XD(e,t){return t.concat(e.split(/\n/g).join("\n"+t))}function zD(e,t=0){const n=e.peek(t);return n===ND&&e.peek(t+1)===ND?{offset:2,token:"**"}:(i=n,qD.includes(i)?{offset:1,token:String.fromCharCode(n)}:null);var i}function YD(e,t=0,n=!1){for(let o=!1,r=[],s=0;;s++){const a=e.peek(t+s);if(!(63===(i=a)||i>=65&&i<=90||95===i||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=55296&&i<=56319||i>=56320&&i<=57343||(o||n)&&VD(a)))return r.length?{token:String.fromCharCode(...r),offset:s}:null;o||(o=!0),r.push(a)}var i}function WD(e,t){for(let i=!1,o=0;;o++){let r=e.peek(t+o);if(n=r,!jD.includes(n))return i?{token:" ",offset:o}:null;i||(i=!0)}var n}const HD={[fD]:"identifier",[gD]:"nameIdentifier"},UD=new KM(((e,t)=>{ID&&console.log("%s: T <identifier | nameIdentifier>",e.pos);const n=function(e,t){const{keys:n,prefixes:i}=t.contextCache(),o=t.tokens;for(let t=0,r=[],s=null;;){const a=o.length+r.length>0,l=r.length>0,c=YD(e,t,a)||a&&zD(e,t)||l&&WD(e,t);if(!c)return s;const{token:u,offset:h}=c;if(t+=h," "===u)continue;r=[...r,u];const d=[...o,...r].join(" ");if(n.has(d)){const e=r[0];s={token:e,offset:e.length,term:123}}if(!i.has(d)){if(nL.some((e=>e===d))){const e=r[0];s={token:e,offset:e.length,term:122}}if(!nL.some((e=>e.startsWith(d))))return s}}}(e,t.context),i=t.context.tokens,o=n||YD(e,0,i.length>0);o&&(e.advance(o.offset),e.acceptToken(n?n.term:122),LD&&console.log("%s: MATCH <%s> <%s>",e.pos,n?HD[n.term]:"identifier",o.token))}),{contextual:!0}),GD=new KM(((e,t)=>{ID&&console.log("%s: T <propertyIdentifier>",e.pos);const n=YD(e,0,t.context.tokens.length>0);n&&(e.advance(n.offset),e.acceptToken(121),LD&&console.log("%s: MATCH <propertyIdentifier> <%s>",e.pos,n.token))})),ZD=new KM(((e,t)=>{let n;ID&&console.log("%s: T <insertSemi>",e.pos);let i=!1;for(n=0;;n++){const t=e.peek(n);if(!jD.includes(t)){BD.includes(t)&&(i=!0);break}}if(i){const t=YD(e,n+1);if(WD(e,n+1)||t&&/^(then|else|return|satisfies)$/.test(t.token))return;LD&&console.log("%s: MATCH <insertSemi>",e.pos),e.acceptToken(124)}})),KD={[$D]:"FunctionInvocation",[ED]:"FilterExpression",[CD]:"PathExpression"},JD={[DD]:"Context",[AD]:"FunctionDefinition",[vD]:"ForExpression",[PD]:"List",[bD]:"IfExpression",[xD]:"QuantifiedExpression"},eL={[MD]:"Context",[RD]:"FunctionDefinition",[mD]:"ForExpression",[TD]:"List",[yD]:"IfExpression",[_D]:"QuantifiedExpression",[wD]:"PathExpression",[SD]:"FunctionInvocation",[kD]:"FilterExpression",[OD]:"ArithmeticExpression"};let tL=class e{constructor(e){this.fn=e}get(e){return this.fn(e)}static of(t){return new e(t)}};const nL=Object.keys({"date and time":1,date:1,time:1,duration:1});function iL(e,t){const n=lL(e),i=function(e){const t=[];for(let n=1;n<=e.length;n++)t.push(e.substring(0,n));return t}(n);t.keys.add(n);for(const e of i)t.prefixes.add(e);return t.originalMap.set(n,e),t}function oL(e){const t=rL();for(const n of e.getKeys())iL(n,t);return t}function rL(e){return{keys:new Set(e?.keys),prefixes:new Set(e?.prefixes),originalMap:new Map(e?.originalMap)}}let sL=class{constructor(e={}){this.value=e}getKeys(){return Object.keys(this.value)}get(e){const t=this.value[e],n=this.constructor;return n.isAtomic(t)?t:n.of(t)}set(e,t){return new(0,this.constructor)({...this.value,[e]:t})}merge(e){const t=this.constructor;return new t(t.__merge(this.value,e))}static isAtomic(e){return!e||e instanceof this||e instanceof tL||"object"!=typeof e}static of(...e){return new this(e.reduce(((e,t)=>this.__merge(e,t)),{}))}static __unwrap(e){return e?e instanceof this?e.value:this.isAtomic(e)?{}:e:{}}static __merge(e,t){const n=Object.assign({},this.__unwrap(e));for(const[e,i]of Object.entries(this.__unwrap(t)))i instanceof tL?n[e]=i:O(n,e)?n[e]=this.__merge(n[e],i):n[e]=i;return n}},aL=class e{constructor({name:e="Expressions",tokens:t=[],children:n=[],parent:i=null,context:o,value:r,raw:s,__cache:a}){this.name=e,this.tokens=t,this.children=n,this.parent=i,this.context=o,this.value=r,this.raw=s,this.__cache=a}get root(){let e=this;for(;e.parent;)e=e.parent;return e}get cache(){const e=this.root;return e.__cache||(e.__cache=new WeakMap),e.__cache}enterScope(e){const t=this.of({name:e,parent:this});return QD&&console.log("[%s] enter",t.path,t.context),t}exitScope(e){return this.parent?(QD&&console.log("[%s] exit %o\n%s",this.path,this.context,XD(e," ")),this.parent.pushChild(this)):(QD&&console.log("[%s] NO exit %o\n%s",this.path,this.context,XD(e," ")),this)}token(e){return QD&&console.log("[%s] token <%s> + <%s>",this.path,this.tokens.join(" "),e),this.assign({tokens:[...this.tokens,e]})}literal(e){return QD&&console.log("[%s] literal %o",this.path,e),this.pushChild(this.of({name:"Literal",value:e}))}computedValue(){for(let e=this;;e=dL(e.children)){if(!e)return null;if(e.value)return e.value}}contextCache(){let e=this.cache.get(this.context);return e||(e=oL(this.context),this.cache.set(this.context,e)),e}get path(){return this.parent?.path?.concat(" > ",this.name)||this.name}get(e){const t=e&&lL(e),n=this.contextCache().originalMap.get(t);if(void 0===n)return;const i=this.context.get(n);return i instanceof tL?i.get(this):i}resolveName(){const e=this.tokens.join(" "),t=this.assign({tokens:[]}),n=this.of({name:"VariableName",parent:t,value:this.get(e),raw:e});return QD&&console.log("[%s] resolve name <%s=%s>",n.path,e,this.get(e)),t.pushChild(n)}pushChild(e){if(!e)return this;const t=this.assign({children:[...this.children,e]});return e.parent=t,t}pushChildren(e){let t=this;for(const n of e)t=t.pushChild(n);return t}declareName(){if(0===this.tokens.length)throw Error("no tokens to declare name");const e=this.tokens.join(" ");return QD&&console.log("[%s] declareName <%s>",this.path,e),this.assign({tokens:[]}).pushChild(this.of({name:"Name",value:e}))}define(e,t){if("string"!=typeof e)return QD&&console.log("[%s] no define <%s=%s>",this.path,e,t),this;QD&&console.log("[%s] define <%s=%s>",this.path,e,t);const n=this.context,i=n.set(e,t),o=iL(e,rL(this.cache.get(n)||oL(n)));return this.cache.set(i,o),this.assign({context:i})}assign(t={}){return e.of({...this,...t})}of(t={}){const n={context:this.context,parent:this.parent};return e.of({...n,...t})}static of(t){const{name:n,tokens:i=[],children:o=[],parent:r=null,context:s,value:a,raw:l,__cache:c}=t;if(!s)throw new Error("must provide <context>");return new e({name:n,tokens:[...i],children:[...o],context:s,parent:r,value:a,raw:l,__cache:c})}};function lL(e){return e.replace(/\s*([./\-'+]|\*\*?)\s*/g," $1 ").replace(/\s{2,}/g," ").trim()}function cL(e,t,n){const i=e.children.filter((e=>e.name!==t)),o=e.children.filter((e=>e.name===t)),r=i[0],s=i[Math.max(1,i.length-1)],a=r?.computedValue(),l=s?.computedValue()||null;return e.assign({children:o}).enterScope(t).pushChildren(i).exitScope(n).define(a,l)}function uL(e={},t=sL){const n=aL.of({context:t.of(e)});return new uD({start:n,reduce(e,n,i,o){if(19===n){const[n,i]=e.children.slice(-2);e=e.assign({value:t.of(n?.computedValue(),i?.computedValue())})}if(89===n&&(e=e.assign({value:t.of(...e.children.map((e=>e?.computedValue())))})),70===n){const[t,n]=e.children.slice(-2);e=e.assign({value:t?.computedValue()})}if(72===n){const[t,...n]=e.children;"get value"===t?.raw&&(e=function(e,t){if(!t.length)return e.assign({value:null});"Name"===t[0].name&&(t=function(e,t){const n={};for(let t=0;t<e.length;t+=2){const[i,o]=e.slice(t,t+2);n[i.value]=o}return t.map((e=>n[e]))}(t,["m","key"]));if(2!==t.length)return e.assign({value:null});const[n,i]=t,o=i?.computedValue(),r=n?.computedValue();if(!r||"object"!=typeof r||"string"!=typeof o)return e.assign({value:null});return e.assign({value:[lL(o),o].reduce(((e,t)=>r.get(t)||e),null)})}(e,n))}const r=JD[n];if(r)return e.enterScope(r);const s=KD[n];if(s){const{children:i,context:o}=e,r=i.slice(0,-1),a=dL(i);let l=null;return 154===n&&(l=t.of(a?.computedValue())),155===n&&(l=t.of(o,a?.computedValue()).set("item",a?.computedValue())),e.assign({children:r}).enterScope(s).pushChild(a).assign({context:l||o})}const a=o.read(o.pos,i.pos);if(eL[n])return e.exitScope(a);if(98===n){const n=e.children.filter((e=>"ContextEntry"!==e.name)),i=n[0],o=dL(n);return cL(e,"ContextEntry",a).assign({value:t.of(e.value).set(i?.computedValue(),o?.computedValue())})}if(7===n||27===n)return cL(e,"InExpression",a);if(139===n)return e.define("partial",tL.of((e=>dL(e.children)?.computedValue())));if(76===n){const t=dL(e.children).computedValue();return e.define(t,1)}if(145===n||146===n||147===n){const t=e.children.slice(0,-1),n=dL(e.children);return e.assign({children:t}).enterScope("ArithmeticExpression").pushChild(n)}if(148===n)return e.enterScope("ArithmeticExpression");if(9===n||10===n||101===n)return e.token(a);if(80===n)return e.literal(a.replace(/^"|"$/g,""));if(81===n)return e.literal("true"===a);if(79===n)return e.literal(parseFloat(a));if(161===n)return e.literal(null);if(47===n)return e.resolveName();if(8===n||100===n)return e.declareName();if((128===n||37===n)&&e.tokens.length>0)throw new Error("uncleared name");if(128===n){let t=e;for(;t.parent;)t=t.exitScope(a);return t}return e}})}const hL=uL({});function dL(e){return e[e.length-1]}const pL=uP({StringLiteral:RP.string,NumericLiteral:RP.number,BooleanLiteral:RP.bool,"AtLiteral!":RP.special(RP.string),CompareOp:RP.compareOperator,ArithOp:RP.arithmeticOperator,"for if then else some every satisfies between return":RP.controlKeyword,"in instance of and or":RP.operatorKeyword,function:RP.definitionKeyword,as:RP.keyword,"Type/...":RP.typeName,Wildcard:RP.special(RP.variableName),null:RP.null,LineComment:RP.lineComment,BlockComment:RP.blockComment,'VariableName! "?"':RP.variableName,"DateTimeConstructor! SpecialFunctionName!":RP.function(RP.special(RP.variableName)),"List Interval":RP.list,Context:RP.definition(RP.literal),"Name!":RP.definition(RP.variableName),"Key/Name! ContextEntryType/Name!":RP.definition(RP.propertyName),"PathExpression/VariableName!":RP.function(RP.propertyName),"FormalParameter/ParameterName!":RP.function(RP.definition(RP.variableName)),"( )":RP.paren,"[ ]":RP.squareBracket,"{ }":RP.brace,".":RP.derefOperator,", ;":RP.separator,"..":RP.punctuation}),fL={__proto__:null,for:10,in:32,return:36,if:40,then:42,else:44,some:48,every:50,satisfies:56,or:60,and:64,between:72,instance:86,of:89,days:101,time:103,duration:105,years:107,months:109,date:111,list:117,context:123,function:130,null:156,true:332,false:332,"?":170,external:186,not:211},gL=hD.deserialize({version:14,states:"C|O`QYOOO`QYOOO$yQYOOOOQU'#Ce'#CeO%TQYO'#C`O&^QYO'#FQOOQQ'#Ff'#FfO&hQYO'#FfO`QYO'#DVOOQU'#En'#EnO(_Q^O'#D]OOQU'#D^'#D^OOQU'#D]'#D]OOQO'#Fn'#FnO*[QWO'#DvOOQQ'#D}'#D}OOQQ'#EO'#EOOOQQ'#EP'#EPO*aOWO'#ESO*[QWO'#EQOOQQ'#EQ'#EQOOQQ'#Ft'#FtOOQQ'#Fr'#FrOOQQ'#Fz'#FzOOQQ'#EU'#EUO`QYO'#EWOOQQ'#FS'#FSO*iQ^O'#FSO,`QYO'#EXO,gQWO'#EYOOQP'#GO'#GOO,lQXO'#EaOOQQ'#F{'#F{OOQQ'#FR'#FRQOQWOOOOQQ'#FT'#FTOOQQ'#F^'#F^O`QYO'#CoOOQQ'#F_'#F_O%TQYO'#CsO,zQYO'#DwOOQQ'#Fs'#FsO-PQYO'#EROOQO'#ER'#ERO`QYO'#EVO`QYO'#EUOOQO'#F|'#F|Q-XQWOOO-^QYO'#DRO.TQWO'#FbOOQO'#DT'#DTO.`QYO'#FfO.gQWOOO/^QYO'#CdO/kQYO'#FVOOQQ'#Cc'#CcO/pQYO'#FUOOQQ'#Cb'#CbO/xQYO,58zO`QYO,59iOOQQ'#Fc'#FcOOQQ'#Fd'#FdOOQQ'#Fe'#FeO`QYO,59qO`QYO,59qO`QYO,59qOOQQ'#Fl'#FlO/}QYO,5:^OOQQ'#Fm'#FmO`QYO,5:`O`QYO,59eO`QYO,59gO`QYO,59iO1|QYO,59iO2TQYO,59rOOQQ,5:i,5:iO2YQYO,59qOOQU-E8l-E8lO3|QYO'#FoOOQQ,5:b,5:bOOQQ,5:n,5:nOOQQ,5:l,5:lO4TQYO,5:rOOQQ,5;n,5;nO4_QYO,5:qO4lQWO,5:sO4qQYO,5:tOOQP'#Ee'#EeO5hQXO'#EdOOQO'#Ec'#EcO5oQWO'#EbO5tQWO'#GPO5|QWO,5:{O6RQYO,59ZO/kQYO'#FaOOQQ'#Cw'#CwO6YQYO'#F`OOQQ'#Cv'#CvO6bQYO,59_O6gQYO,5:cO6lQYO,5:mO4WQYO,5:qO6qQYO,5:pO`QYO'#EwQ-XQWOOO`QYO'#EmO7hQWO,5;|O`QYOOOOQR'#Cf'#CfOOQQ'#Ej'#EjO8bQYO,59OO`QYO,5;qOOQQ'#FY'#FYO%TQYO'#EkO8rQYO,5;pO`QYO1G.fOOQQ'#F]'#F]O9iQYO1G/TO<`QYO1G/]O<jQYO1G/]O<tQYO1G/]OOQQ1G/x1G/xO>hQYO1G/zO>oQYO1G/PO?xQYO1G/ROARQYO1G/TO`QYO1G/TOOQQ1G/T1G/TOAiQYO1G/^OBWQ^O'#CdOCjQYO'#FqOOQO'#Dz'#DzOCtQWO'#DyOCyQWO'#FpOOQO'#Dx'#DxOOQO'#D{'#D{ODRQWO,5<ZOOQQ1G0^1G0^O`QYO1G0]O`QYO'#EsODWQWO,5<]OOQQ1G0_1G0_ODcQWO'#E[ODnQWO'#F}OOQO'#EZ'#EZODvQWO1G0`OOQP'#Eu'#EuOD{QXO,5;OO`QYO,5:|OESQXO'#EvOE_QWO,5<kOOQQ1G0g1G0gO`QYO1G.uO`QYO,5;{O%TQYO'#ElOEgQYO,5;zO`QYO1G.yOEoQYO1G/}OOQO1G0X1G0XOOQO,5;c,5;cOOQO-E8u-E8uOOQO,5;X,5;XOOQO-E8k-E8kOEtQWOOOOQQ-E8h-E8hOEyQYO'#CmOOQQ1G1]1G1]OOQQ,5;V,5;VOOQQ-E8i-E8iOFWQYO7+$QOOQQ7+%f7+%fO`QYO7+$oOF}QYO,5:rOG[QWO7+$oOGaQYO'#D[OOQQ'#DZ'#DZOITQYO'#D_OIYQYO'#D_OI_QYO'#D_OIdQ`O'#DgOIiQ`O'#DjOInQ`O'#DnOOQQ7+$x7+$xO`QYO,5:eO%TQYO'#ErOIsQWO,5<[OOQQ1G1u1G1uOJyQYO7+%wOKWQYO,5;_OOQO-E8q-E8qOAiQYO,5:vO%TQYO'#EtOKeQWO,5<iOKmQYO7+%zOOQP-E8s-E8sOKtQYO1G0hOOQO,5;b,5;bOOQO-E8t-E8tOLOQYO7+$aOLVQYO1G1gOOQQ,5;W,5;WOOQQ-E8j-E8jOLaQYO7+$eOOQO7+%i7+%iO`QYO,59XOMWQYO<<HZOOQQ<<HZ<<HZO/}QYO'#EoONaQYO,59vO!!TQYO,59yO!!YQYO,59yO!!_QYO,59yO!!dQYO,5:RO%TQYO,5:UO!#RQbO,5:YO!#YQYO1G0POOQO,5;^,5;^OOQO-E8p-E8pO!#dQYO<<IcOOQQ<<Ic<<IcOOQO1G0b1G0bOOQO,5;`,5;`OOQO-E8r-E8rO!&fQYO'#E^OOQQ<<If<<IfO`QYO<<IfO`QYO<<G{O!']QYO1G.sOOQQ,5;Z,5;ZOOQQ-E8m-E8mO!'gQYO1G/eOOQQ1G/e1G/eO!'lQbO'#D]O!'}Q`O'#D[O!(YQ`O1G/mO!(_QWO'#DmO!(dQ`O'#FhOOQO'#Dl'#DlO!(lQ`O1G/pOOQO'#Dq'#DqO!(qQ`O'#FjOOQO'#Dp'#DpO!(yQ`O1G/tOOQQAN?QAN?QO!)OQYOAN=gOOQQ7+%P7+%PO!)uQ`O,59vOOQQ7+%X7+%XO!!dQYO,5:XO%TQYO'#EpO!*QQ`O,5<SOOQQ7+%[7+%[O!!dQYO'#EqO!*YQ`O,5<UO!*bQ`O7+%`OOQO1G/s1G/sOOQO,5;[,5;[OOQO-E8n-E8nOOQO,5;],5;]OOQO-E8o-E8oOAiQYO<<HzOOQQAN>fAN>fO/}QYO'#EoO!!dQYO<<HzO!*gQ`O7+%`O!*lQ`O1G/tO!#RQbO,5:YO!*qQ`O'#Dn",stateData:"!+U~O#rOS#sOSPOSQOS~OTsOZVO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$k`O$laO$mbO~OTsO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$k`O$laO$mbO~OZ!TO#]!UO~P#VO#nRO#oRO~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO!i!fO#z!dOv$bX~O#l#tX$t#tX~P%]O$i!mOT$YXZ$YX[$YXd$YXh$YXi$YXr$YXs$YXv$YX!T$YX!U$YX!V$YX!X$YX!c$YX!g$YX!i$YX!p$YX!w$YX#S$YX#n$YX#o$YX$Z$YX$j$YX$k$YX$l$YX$m$YX~O#nRO#oROZ!PX[!PX]!PX^!PX_!PX`!PXn!PXp!PXr!PXs!PXt!PXv!PX{!PX!i!PX#l!PX#p!PX#z!PX$t!PX$O!PXx!PX#}!PX!g!PXe!PXb!PX#R!PXf!PXl!PX~Ov!pO~O$j`O$k`O~O#p!uOZ#vX[#vX]#vX^#vX_#vX`#vXn#vXp#vXr#vXs#vXt#vXv#vX{#vX!i#vX#l#vX#z#vX$t#vX$O#vXx#vX#}#vX!g#vXe#vXb#vX#R#vXf#vXl#vX~O!g$eP~P`Ov!xO~O#m!yO$j`O$k`O#R$sP~Op#VO~Op#WOv!uX~O$t#ZO~O#luX$OuX$tuXxuX#}uX!guXeuXbuX#RuXfuXluX~P%]O$O#]O#l$UXx$UX~O#l#[X~P&hOv#_O~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O$]WX~O`WXxWX$OWX~P.lO`#dO~O$O#eOb#xX~Ob#hO~O#nRO#oRO$ZZO~OTsOZVO[UOdtOhvOivOr}Os}O!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$k`O$laO$mbO~Ov#rO~P0YO|#tO~O{!lO!i!fO#z!dOZya[ya]ya^ya_ya`yanyapyaryasyatyav$bX#lya$tya$Oyaxya#}ya!gyaeyabya#Ryafyalya~Ox$eP~P`Ox#}O#}$OO~P%]O#}$OO$O$PO!g$eX~P%]O!g$RO~O#nRO#oROx$qP~OZ#`O[#`O]#`O^#`O_#`O#m!yO#z#`O#{#`O~O$]#WX~P4|O$]$YO~O$O$ZO#R$sX~O#R$]O~Oe$^O~P%]O$O$`Ol$SX~Ol$bO~O!W$cO~O!T$dO~O#l!xa$t!xa$O!xax!xa#}!xa!g!xae!xab!xa#R!xaf!xal!xa~P%]O$O#]O#l$Uax$Ua~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O~O`Wa$]WaxWa$OWa~P7sO$O#eOb#xa~OZ!^O[!^O]!_O^!_O_!`O{!lO!i!fO#z!dOv$bX~O`qinqipqirqisqitqi#lqi$tqi$Oqixqi#}qi!gqieqibqi#Rqifqilqi~P8zO_!`O{!lO!i!fO#z!dOZyi[yi`yinyipyiryisyityiv$bX#lyi$tyi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O]!_O^!_O~P:rO]yi^yi~P:rO{!lO!i!fO#z!dOZyi[yi]yi^yi_yi`yinyipyiryisyityiv$bX#lyi$tyi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O!g$pO~P%]O`!kOp!iOr!]Os!]Ot!jOnmi#lmi$tmi$Omixmi#}mi!gmiemibmi#Rmifmilmi~P8zO`!kOr!]Os!]Ot!jOnoipoi#loi$toi$Ooixoi#}oi!goieoiboi#Roifoiloi~P8zO`!kOn!hOp$qOr!]Os!]Ot!jO~P8zO!S$vO!V$wO!X$xO![$yO!_$zO!c${O#nRO#oRO$ZZO~OZ#bX[#bX]#bX^#bX_#bX`#bXn#bXp#bXr#bXs#bXt#bXv#bXx#bX{#bX!i#bX#n#bX#o#bX#p#bX#z#bX$O#bX~P.lO$O$POx$eX~P%]O$]$}O~O$O%OOx$dX~Ox%QO~O$O$PO!g$eax$ea~O$]%UOx#OX$O#OX~O$O%VOx$qX~Ox%XO~O$]#Wa~P4|O#m!yO$j`O$k`O~O$O$ZO#R$sa~O$O$`Ol$Sa~O!U%cO~OxrO~O#}%dObaX$OaX~P%]O#lSq$tSq$OSqxSq#}Sq!gSqeSqbSq#RSqfSqlSq~P%]Ox#}O#}$OO$OuX~P%]Ox%fO~O#z%gOZ!OX[!OX]!OX^!OX_!OX`!OXn!OXp!OXr!OXs!OXt!OXv!OX{!OX!i!OX#l!OX$t!OX$O!OXx!OX#}!OX!g!OXe!OXb!OX#R!OXf!OXl!OX~Op%iO~Op%jO~Op%kO~O!]%lO~O!]%mO~O!]%nO~O$O%OOx$da~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO#z!dOv$bX~Ox%sO!g%sO!i%rO~PI{O!g#ga$O#gax#ga~P%]O$O%VOx$qa~O#P%yO~P`O#R#Ui$O#Ui~P%]Of%zO~P%]Ol$Ti$O$Ti~P%]O#lgq$tgq$Ogqxgq#}gq!ggqegqbgq#Rgqfgqlgq~P%]O`qynqypqyrqysqytqy#lqy$tqy$Oqyxqy#}qy!gqyeqybqy#Rqyfqylqy~P8zO#z%gOZ!Oa[!Oa]!Oa^!Oa_!Oa`!Oan!Oap!Oar!Oas!Oat!Oav!Oa{!Oa!i!Oa#l!Oa$t!Oa$O!Oax!Oa#}!Oa!g!Oae!Oab!Oa#R!Oaf!Oal!Oa~O!T&OO~O!W&OO~O!T&PO~O!S$vO!V$wO!X$xO![$yO!_$zO!c&uO#nRO#oRO$ZZO~O!Y$^P~P!!dOx!mi$O!mi~P%]OT$aXZ$aX[$aX]!yy^!yy_!yy`!yyd$aXh$aXi$aXn!yyp!yyr$aXs$aXt!yyv$aX{!yy!T$aX!U$aX!V$aX!X$aX!c$aX!g$aX!i$aX!p$aX!w$aX#S$aX#l!yy#n$aX#o$aX#z!yy$Z$aX$i$aX$j$aX$k$aX$l$aX$m$aX$t!yy$O!yyx!yy#}!yye!yyb!yy#R!yyf!yyl!yy~O#l#QX$t#QX$O#QXx#QX#}#QX!g#QXe#QXb#QX#R#QXf#QXl#QX~P%]Obai$Oai~P%]O!U&_O~O#nRO#oRO!Y!PX#z!PX$O!PX~O#z&pO!Y!OX$O!OX~O!Y&aO~O$]&bO~O$O&cO!Y$[X~O!Y&eO~O$O&fO!Y$^X~O!Y&hO~O#lc!R$tc!R$Oc!Rxc!R#}c!R!gc!Rec!Rbc!R#Rc!Rfc!Rlc!R~P%]O#z&pO!Y!Oa$O!Oa~O$O&cO!Y$[a~O$O&fO!Y$^a~O$_&nO~O$_&qO~O!Y&rO~O!]&tO~O$Z$j~$j$k_^$i#zQP]Q~",goto:"E}$tPPPP$uP%n%q%w&Z'tPPPPPP'}P$uPPP$uPP(Q(TP$uP$uP$uPPP(ZP(fP$u$uPP(o)U)a*n)UPPPPPPP)UPP)UP+s+v)UP+|,S$uP$uP$u,Z-S-V-]-SP-e.^-e-e/^0VP$u1O$u1w1w2p2sP2yPP1w3P3V/Y3ZPP3cP3f3m3s3y4P5[5f5l5r5x6P6V6]6cPPPPPPPP6i6r8y9r:k:nPP:rPP:x:{;t<m<p<t<y=h>W>wP?pP?sP?w@jA]BUB[B_$uBeBePPPPPC^8yDVEOEREz!mjOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR![SQ!YSR$m#eS!WS#eS#Qw$`W#w!p!x%O%VT&T%m&c#WXOPQWYilu|}!]!a!b!c!e!g!h!i!j!k#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&Q&b&f&n&p&q&tb!VSw!x#e$`%O%V%m&cU#a!V#b#uR#u!pU#a!V#b#uT$W!z$XR$l#cR#UwQ#SwR%`$`U!RQ#_#rQ#s!kR$g#]QrQQ$i#_R$s#rQ$|#tQ%t%UQ&S%lU&X%n&f&tQ&i&bT&o&n&qc$u#t%U%l%n&b&f&n&q&t!lkOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ#m!eU$t#t%U&nS%|%g&p]&R%l%n&b&f&q&t#V[OPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&b&f&n&p&q&tR&W%mQ&U%mR&j&cQ&[%nR&s&tS&Y%n&tR&l&f!m]OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#|!pQ#y!pR%p%OS#x!p%OT$S!x%V!meOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!leOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!rbT!{o$Z!mcOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mdOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mhOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mpOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$V!xQ$T!xR%u%VQ%x%XR&]%yQ!}oR%[$ZT!|o$ZS!zo$ZT$W!z$XRrQS#b!V#uR$j#bQ#f!YR$n#fQ$a#SR%a$aQ#^!RR$h#^!vYOPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%y%z&nS!oY&Q_&Q%l%n&b&f&p&q&tQ%h$tS%}%h&`R&`&RQ&d&UR&k&dQ&g&YR&m&gQ%P#yR%q%PS$Q!v#vR%T$QQ%W$TR%v%WQ$X!zR%Y$XQ$[!}R%]$[Q#[!PR$f#[QrOQ!PPR$e#ZUTOP#ZW!QQ!k#]#_Q!nWQ!tiQ!vlQ#PuQ#X|Q#Y}Q#i!]Q#j!aQ#k!bQ#l!cQ#n!gQ#o!hQ#p!iQ#q!jQ#v!pQ$k#cQ$o#gQ$r#rQ%R$OQ%S$PQ%Z$YQ%^$^Q%_$_Q%b$bQ%e$qQ%o$}S%w%X%yQ%{%dR&^%z!mqOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mSOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR!ZST!XS#eQ#c!WR$_#QR#g![!muOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mwOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#TwT#Rw$`V!SQ#_#r!X!aT!Q!t!v#P#X#Y#i#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!Z!bT!Q!t!v#P#X#Y#i#j#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!]!cT!Q!t!v#P#X#Y#i#j#k#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!mWOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR&V%mT&Z%n&t!a!eT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!a!gT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!m^OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!q^R!scR#z!pQ!wlR#{!p!mfOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mlOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mmOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$U!x!moOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#Oo",nodeNames:"⚠ LineComment BlockComment Expression ForExpression for InExpressions InExpression Name Identifier Identifier ArithOp ArithOp ArithOp ArithOp ArithOp in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression InstanceOfExpression instance of Type QualifiedName VariableName BacktickIdentifier SpecialType days time duration years months date > ListType list < ContextType context ContextEntryTypes ContextEntryType FunctionType function ArgumentTypes ArgumentType PathExpression ] FilterExpression [ FunctionInvocation SpecialFunctionName NamedParameters NamedParameter ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral DateTimeConstructor AtLiteral ? SimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition FormalParameters FormalParameter external FunctionBody } { Context ContextEntry Key Name Identifier Expressions UnaryTests Wildcard not",maxTerm:174,context:hL,nodeProps:[["group",-17,4,19,23,29,31,33,41,42,68,70,72,85,86,88,89,90,97,"Expr",47,"Expr Expr",-5,78,79,80,81,82,"Expr Literal"],["closedBy",38,")",71,"]",96,"}"],["openedBy",40,"(",69,"[",95,"{"]],propSources:[pL],skippedNodes:[0,1,2],repeatNodeCount:14,tokenData:"2t~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx*[xy*ayz*fz{*k{|*x|}*}}!O+S!O!P+a!P!Q,k!Q![.f![!].}!]!^/S!^!_/X!_!`$i!`!a/h!b!c/r!}#O/w#P#Q/|#Q#R*s#S#T0R#o#p2j#q#r2o$f$g#i#BY#BZ#i$IS$I_#i$I|$I}$^$I}$JO$^$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~#nY#r~XY#iZ[#ipq#i$f$g#i#BY#BZ#i$IS$I_#i$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~$cO#s~~$fP!_!`$i~$nOr~~$qXOY$nYZ%^Zr$nrs'us#O$n#O#P'|#P;'S$n;'S;=`)c<%lO$n~%aVOr%^rs%vs#O%^#O#P%{#P;'S%^;'S;=`'S<%lO%^~%{O$j~~&OWOr%^rs&hs#O%^#O#P%{#P;'S%^;'S;=`'Y;=`<%l%^<%lO%^~&mV$j~Or%^rs%vs#O%^#O#P%{#P;'S%^;'S;=`'S<%lO%^~'VP;=`<%l%^~']WOr%^rs%vs#O%^#O#P%{#P;'S%^;'S;=`'S;=`<%l%^<%lO%^~'|O$j~$k~~(PYOY$nYZ$nZr$nrs(os#O$n#O#P'|#P;'S$n;'S;=`)i;=`<%l$n<%lO$n~(vX$j~$k~OY$nYZ%^Zr$nrs'us#O$n#O#P'|#P;'S$n;'S;=`)c<%lO$n~)fP;=`<%l$n~)lYOY$nYZ%^Zr$nrs'us#O$n#O#P'|#P;'S$n;'S;=`)c;=`<%l$n<%lO$n~*aO#{~~*fOv~~*kOx~~*pP^~z{*s~*xO_~~*}O[~~+SO$O~R+XPZP!`!a+[Q+aO$_Q~+fQ#z~!O!P+l!Q![+q~+qO#}~~+vR$i~!Q![+q!g!h,P#X#Y,P~,SR{|,]}!O,]!Q![,c~,`P!Q![,c~,hP$i~!Q![,c~,pQ]~z{,v!P!Q-}~,yTOz,vz{-Y{;'S,v;'S;=`-w<%lO,v~-]VOz,vz{-Y{!P,v!P!Q-r!Q;'S,v;'S;=`-w<%lO,v~-wOQ~~-zP;=`<%l,v~.SSP~OY-}Z;'S-};'S;=`.`<%lO-}~.cP;=`<%l-}~.kS$i~!O!P.w!Q![.f!g!h,P#X#Y,P~.zP!Q![+q~/SO$]~~/XO$t~R/`P!]QsP!_!`/cP/hOsPR/oP!YQsP!_!`/c~/wO$m~~/|O!i~~0RO!g~~0UVO#O0R#O#P0k#P#S0R#S#T1r#T;'S0R;'S;=`1w<%lO0R~0nWO#O0R#O#P0k#P#S0R#S#T1W#T;'S0R;'S;=`1};=`<%l0R<%lO0R~1]V$Z~O#O0R#O#P0k#P#S0R#S#T1r#T;'S0R;'S;=`1w<%lO0R~1wO$Z~~1zP;=`<%l0R~2QWO#O0R#O#P0k#P#S0R#S#T1r#T;'S0R;'S;=`1w;=`<%l0R<%lO0R~2oO#S~~2tO#R~",tokenizers:[GD,UD,ZD,0,1],topRules:{Expression:[0,3],Expressions:[1,102],UnaryTests:[2,103]},dialects:{camunda:2568},dynamicPrecedences:{31:-1,68:1,72:-1,74:-1},specialized:[{term:122,get:e=>fL[e]||-1}],tokenPrec:2571});function mL(e){const t=[];return e.iterate({enter:e=>{const n=e.node;if(!n.type.isError)return;const i=n.parent,o=vL(n),r={from:n.from,to:n.to,severity:"error",type:"Syntax Error"};if(n.from!==n.to)r.message=`Unrecognized token in <${i.name}>`;else if(o)r.message=`Unrecognized token <${o.name}> in <${i.name}>`,r.to=o.to;else{const e=i.enterUnfinishedNodesBefore(n.to);r.message=`Incomplete <${(e||i).name}>`}t.push(r)}}),t}function vL(e){return e?e.nextSibling||vL(e.parent):null}var yL={create:e=>({enter(t){if("FilterExpression"!==t.name)return;const n=e.readContent(t.from,t.to);if(/\[\s*0\s*\]$/.test(n)){const{from:i,to:o}=t;e.report({from:i,to:o,message:"First item is accessed via [1]",severity:"warning",type:"first-item",actions:[{name:"fix",apply(t,r=i,s=o){e.updateContent(r,s,n.replace(/\[\s*0\s*\]$/,"[1]"))}}]})}}})};const bL=[yL];function _L(e){const{readContent:t,syntaxTree:n,updateContent:i}=e,o=[],r={readContent:t,report:e=>{o.push(e)},updateContent:i},s=bL.map((e=>e.create(r)));return n.iterate({enter:e=>{for(const t of s)t.enter&&t.enter(e)},leave:e=>{for(const t of s)t.leave&&t.leave(e)}}),o}const xL=[XR("function(${params}) ${body}",{label:"function",detail:"definition",type:"keyword"}),XR("for ${var} in ${collection} return ${value}",{label:"for",detail:"expression",type:"keyword"}),XR("every ${var} in ${collection} satisfies ${condition}",{label:"every",detail:"quantified expression",type:"keyword"}),XR("some ${var} in ${collection} satisfies ${condition}",{label:"some",detail:"quantified expression",type:"keyword"}),XR("if ${condition} then ${value} else ${other value}",{label:"if",detail:"block",type:"keyword"}),XR("{ ${key}: ${value} }",{label:"context",detail:"block",type:"keyword"}),XR("null",{label:"null",detail:"literal",type:"keyword"}),XR("true",{label:"true",detail:"literal",type:"keyword"}),XR("false",{label:"false",detail:"literal",type:"keyword"})];function OL(){return OL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},OL.apply(null,arguments)}function wL(e){const{context:t,after:n,before:i,keyword:o}=e;return function(e,t){const{nodes:n,before:i,after:o,keyword:r}=e;return e=>{const{state:s,pos:a}=e,l=TL(jP(s).resolveInner(a,-1),n);if(!l)return null;const[c]=l;return $L(c,a,[r,i])||function(e,t,n){return PL(e,t,n,1)}(c,a,[r,o])||o&&!$L(c,a,[o])?null:t(e)}}({nodes:t,before:i,after:n,keyword:o},VT([{label:o,type:"keyword",boost:10}]))}const CL=[wL({context:"InExpression",keyword:"in"}),wL({context:"IfExpression",keyword:"then",after:"if",before:"else"}),wL({context:"IfExpression",keyword:"else",after:"then"}),wL({context:"QuantifiedExpression",keyword:"satisfies"}),wL({context:"ForExpression",after:"InExpressions",keyword:"return"})],kL=["StringLiteral","Identifier","LineComment","BlockComment","PathExpression","Context","Key","ParameterName"],EL=["Expr","ContextEntry"];function SL(e){return function(e){const t=[...kL,...EL];return n=>{const{state:i,pos:o}=n,r=TL(jP(i).resolveInner(o,-1),t);if(r){const[e,t]=r;if(kL.includes(t))return null}return e(n)}}(VT(e.map((e=>OL({},e,{type:"text"})))))}function $L(e,t,n){return PL(e,t,n,-1)}function PL(e,t,n,i){let o=e[i>0?"childAfter":"childBefore"](t);for(;o;){if(n.includes(o.name))return o;if(o.type.isError&&o.firstChild&&n.includes(o.firstChild.name))return o.firstChild;o=o[i>0?"nextSibling":"prevSibling"]}return null}function TL(e,t){for(Array.isArray(t)||(t=[t]);e;e=e.parent){const n=e.type,i=t.find((e=>e&&n.is(e)));if(i)return[e,i];if(n.isTop)break}return null}const RL=QP.define({parser:gL.configure({props:[tT.add({Context:aT({closing:"}"}),"List FilterExpression":aT({closing:"]"}),"ParenthesizedExpression FunctionInvocation":cT({except:/^\s*\)/}),"ForExpression QuantifiedExpression IfExpression":cT({except:/^\s*(then|else|return|satisfies)\b/}),FunctionDefinition:cT({except:/^\s*(\(|\))/})}),hT.add({Context:dT,List:dT,ParenthesizedExpression:dT,FunctionDefinition(e){const t=e.getChild(")");return t?{from:t.to,to:e.to}:null}})]}),languageData:{indentOnInput:/^\s*(\)|\}|\]|then|else|return|satisfies)$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}}),AL=RL.configure({top:"UnaryTests"},"FEEL unary tests"),ML=RL.configure({top:"Expression"},"FEEL expression");const DL=[{name:"not",type:"function",params:[{name:"negand"}],info:'<p>Returns the logical negation of the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">not(negand: boolean): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">not(true)\n// false\n\nnot(null)\n// null\n</code></pre>\n'},{name:"is defined",type:"function",params:[{name:"value"}],info:'<p><em>Camunda Extension</em></p>\n<p>Checks if a given value is not <code>null</code>. If the value is <code>null</code> then the function returns <code>false</code>.\nOtherwise, the function returns <code>true</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">is defined(value: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">is defined(1)\n// true\n\nis defined(null)\n// false\n\nis defined(x)\n// false - if no variable "x" exists\n\nis defined(x.y)\n// false - if no variable "x" exists or it doesn't have a property "y"\n</code></pre>\n<p>:::caution Breaking change</p>\n<p>This function worked differently in previous versions. It returned <code>true</code> if the value was <code>null</code>.\nSince this version, the function returns <code>false</code> if the value is <code>null</code>.</p>\n<p>:::</p>\n'},{name:"get or else",type:"function",params:[{name:"value"},{name:"default"}],info:'<p><em>Camunda Extension</em></p>\n<p>Return the provided value parameter if not <code>null</code>, otherwise return the default parameter</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get or else(value: Any, default: Any): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get or else("this", "default")\n// "this"\n\nget or else(null, "default")\n// "default"\n\nget or else(null, null)\n// null\n</code></pre>\n'},{name:"assert",type:"function",params:[{name:"value"},{name:"condition"}],info:'<p><em>Camunda Extension</em></p>\n<p>Verify that the given condition is met. If the condition is <code>true</code>, the function returns the value.\nOtherwise, the evaluation fails with an error.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">assert(value: Any, condition: Any)\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">assert(x, x != null)\n// "value" - if x is "value"\n// error - if x is null or doesn't exist\n\nassert(x, x >= 0)\n// 4 - if x is 4\n// error - if x is less than zero\n</code></pre>\n'},{name:"assert",type:"function",params:[{name:"value"},{name:"condition"},{name:"cause"}],info:'<p><em>Camunda Extension</em></p>\n<p>Verify that the given condition is met. If the condition is <code>true</code>, the function returns the value.\nOtherwise, the evaluation fails with an error containing the given message.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">assert(value: Any, condition: Any, cause: String)\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">assert(x, x != null, "'x' should not be null")\n// "value" - if x is "value"\n// error('x' should not be null) - if x is null or doesn't exist\n\nassert(x, x >= 0, "'x' should be positive")\n// 4 - if x is 4\n// error('x' should be positive) - if x is less than zero\n</code></pre>\n'},{name:"get value",type:"function",params:[{name:"context"},{name:"key"}],info:'<p>Returns the value of the context entry with the given key.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get value(context: context, key: string): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get value({foo: 123}, "foo")\n// 123\n\nget value({a: 1}, "b")\n// null\n</code></pre>\n'},{name:"get value",type:"function",params:[{name:"context"},{name:"keys"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the value of the context entry for a context path defined by the given keys.</p>\n<p>If <code>keys</code> contains the keys <code>[k1, k2]</code> then it returns the value at the nested entry <code>k1.k2</code> of the context.</p>\n<p>If <code>keys</code> are empty or the nested entry defined by the keys doesn't exist in the context, it returns <code>null</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get value(context: context, keys: list<string>): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get value({x:1, y: {z:0}}, ["y", "z"])\n// 0\n\nget value({x: {y: {z:0}}}, ["x", "y"])\n// {z:0}\n\nget value({a: {b: 3}}, ["b"])\n// null\n</code></pre>\n'},{name:"get entries",type:"function",params:[{name:"context"}],info:'<p>Returns the entries of the context as a list of key-value-pairs.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get entries(context: context): list<context>\n</code></pre>\n<p>The return value is a list of contexts. Each context contains two entries for "key" and "value".</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get entries({foo: 123})\n// [{key: "foo", value: 123}]\n</code></pre>\n'},{name:"context put",type:"function",params:[{name:"context"},{name:"key"},{name:"value"}],info:'<p>Adds a new entry with the given key and value to the context. Returns a new context that includes the entry.</p>\n<p>If an entry for the same key already exists in the context, it overrides the value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context put(context: context, key: string, value: Any): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context put({x:1}, "y", 2)\n// {x:1, y:2}\n</code></pre>\n<p>:::info\nThe function <code>context put()</code> replaced the previous function <code>put()</code> (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::</p>\n'},{name:"context put",type:"function",params:[{name:"context"},{name:"keys"},{name:"value"}],info:'<p>Adds a new entry with the given value to the context. The path of the entry is defined by the keys. Returns a new context that includes the entry.</p>\n<p>If <code>keys</code> contains the keys <code>[k1, k2]</code> then it adds the nested entry <code>k1.k2 = value</code> to the context.</p>\n<p>If an entry for the same keys already exists in the context, it overrides the value.</p>\n<p>If <code>keys</code> are empty, it returns <code>null</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context put(context: context, keys: list<string>, value: Any): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context put({x:1}, ["y"], 2)\n// {x:1, y:2}\n\ncontext put({x:1, y: {z:0}}, ["y", "z"], 2)\n// {x:1, y: {z:2}}\n\ncontext put({x:1}, ["y", "z"], 2)\n// {x:1, y: {z:2}}\n</code></pre>\n'},{name:"context merge",type:"function",params:[{name:"contexts"}],info:'<p>Union the given contexts. Returns a new context that includes all entries of the given contexts.</p>\n<p>If an entry for the same key already exists in a context, it overrides the value. The entries are overridden in the same order as in the list of contexts.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context merge(contexts: list<context>): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context merge([{x:1}, {y:2}])\n// {x:1, y:2}\n\ncontext merge([{x:1, y: 0}, {y:2}])\n// {x:1, y:2}\n</code></pre>\n<p>:::info\nThe function <code>context merge()</code> replaced the previous function <code>put all()</code> (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::</p>\n'},{name:"string",type:"function",params:[{name:"from"}],info:'<p>Returns the given value as a string representation.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string(from: Any): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string(1.1)\n// "1.1"\n\nstring(date("2012-12-25"))\n// "2012-12-25"\n</code></pre>\n'},{name:"number",type:"function",params:[{name:"from"}],info:'<p>Parses the given string to a number.</p>\n<p>Returns <code>null</code> if the string is not a number.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">number(from: string): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">number("1500.5")\n// 1500.5\n</code></pre>\n'},{name:"context",type:"function",params:[{name:"entries"}],info:'<p>Constructs a context of the given list of key-value pairs. It is the reverse function to <a href="feel-built-in-functions-context.md#get-entriescontext">get entries()</a>.</p>\n<p>Each key-value pair must be a context with two entries: <code>key</code> and <code>value</code>. The entry with name <code>key</code> must have a value of the type <code>string</code>.</p>\n<p>It might override context entries if the keys are equal. The entries are overridden in the same order as the contexts in the given list.</p>\n<p>Returns <code>null</code> if one of the entries is not a context or if a context doesn't contain the required entries.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context(entries: list<context>): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context([{"key":"a", "value":1}, {"key":"b", "value":2}])\n// {a:1, b:2}\n</code></pre>\n'},{name:"date",type:"function",params:[{name:"from"}],info:'<p>Returns a date from the given value.</p>\n<p>Returns <code>null</code> if the string is not a valid calendar date. For example, <code>"2024-06-31"</code> is invalid because June has\nonly 30 days.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date(from: string): date\n</code></pre>\n<p>Parses the given string into a date.</p>\n<pre><code class="language-feel">date(from: date and time): date\n</code></pre>\n<p>Extracts the date component from the given date and time.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date("2018-04-29")\n// date("2018-04-29")\n\ndate(date and time("2012-12-25T11:00:00"))\n// date("2012-12-25")\n</code></pre>\n'},{name:"date",type:"function",params:[{name:"year"},{name:"month"},{name:"day"}],info:'<p>Returns a date from the given components.</p>\n<p>Returns <code>null</code> if the components don't represent a valid calendar date. For example, <code>2024,6,31</code> is invalid because\nJune has only 30 days.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date(year: number, month: number, day: number): date\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date(2012, 12, 25)\n// date("2012-12-25")\n</code></pre>\n'},{name:"time",type:"function",params:[{name:"from"}],info:'<p>Returns a time from the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">time(from: string): time\n</code></pre>\n<p>Parses the given string into a time.</p>\n<pre><code class="language-feel">time(from: date and time): time\n</code></pre>\n<p>Extracts the time component from the given date and time.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">time("12:00:00")\n// time("12:00:00")\n\ntime(date and time("2012-12-25T11:00:00"))\n// time("11:00:00")\n</code></pre>\n'},{name:"time",type:"function",params:[{name:"hour"},{name:"minute"},{name:"second"}],info:'<p>Returns a time from the given components.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">time(hour: number, minute: number, second: number): time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">time(23, 59, 0)\n// time("23:59:00")\n</code></pre>\n'},{name:"time",type:"function",params:[{name:"hour"},{name:"minute"},{name:"second"},{name:"offset"}],info:'<p>Returns a time from the given components, including a timezone offset.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">time(hour: number, minute: number, second: number, offset: days and time duration): time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">time(14, 30, 0, duration("PT1H"))\n// time("14:30:00+01:00")\n</code></pre>\n'},{name:"date and time",type:"function",params:[{name:"from"}],info:'<p>Parses the given string into a date and time.</p>\n<p>Returns <code>null</code> if the string is not a valid calendar date. For example, <code>"2024-06-31T10:00:00"</code> is invalid because\nJune has only 30 days.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date and time(from: string): date and time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date and time("2018-04-29T09:30:00")\n// date and time("2018-04-29T09:30:00")\n</code></pre>\n'},{name:"date and time",type:"function",params:[{name:"date"},{name:"time"}],info:'<p>Returns a date and time from the given components.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date and time(date: date, time: time): date and time\n</code></pre>\n<pre><code class="language-feel">date and time(date: date and time, time: time): date and time\n</code></pre>\n<p>Returns a date and time value that consists of the date component of <code>date</code> combined with <code>time</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date and time(date("2012-12-24"),time("T23:59:00"))\n// date and time("2012-12-24T23:59:00")\n\ndate and time(date and time("2012-12-25T11:00:00"),time("T23:59:00"))\n// date and time("2012-12-25T23:59:00")\n</code></pre>\n'},{name:"date and time",type:"function",params:[{name:"date"},{name:"timezone"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the given date and time value at the given timezone.</p>\n<p>If <code>date</code> has a different timezone than <code>timezone</code> then it adjusts the time to match the local time of <code>timezone</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date and time(date: date and time, timezone: string): date and time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date and time(@"2020-07-31T14:27:30@Europe/Berlin", "America/Los_Angeles")\n// date and time("2020-07-31T05:27:30@America/Los_Angeles")\n\ndate and time(@"2020-07-31T14:27:30", "Z")\n// date and time("2020-07-31T12:27:30Z")\n</code></pre>\n'},{name:"duration",type:"function",params:[{name:"from"}],info:'<p>Parses the given string into a duration. The duration is either a days and time duration or a years and months duration.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">duration(from: string): days and time duration\n</code></pre>\n<pre><code class="language-feel">duration(from: string): years and months duration\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">duration("P5D")\n// duration("P5D")\n\nduration("P32Y")\n// duration("P32Y")\n</code></pre>\n'},{name:"years and months duration",type:"function",params:[{name:"from"},{name:"to"}],info:'<p>Returns the years and months duration between <code>from</code> and <code>to</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">years and months duration(from: date, to: date): years and months duration\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">years and months duration(date("2011-12-22"), date("2013-08-24"))\n// duration("P1Y8M")\n</code></pre>\n'},{name:"list contains",type:"function",params:[{name:"list"},{name:"element"}],info:'<p>Returns <code>true</code> if the given list contains the element. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">list contains(list: list, element: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">list contains([1,2,3], 2)\n// true\n</code></pre>\n'},{name:"count",type:"function",params:[{name:"list"}],info:'<p>Returns the number of elements of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">count(list: list): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">count([1,2,3])\n// 3\n</code></pre>\n'},{name:"min",type:"function",params:[{name:"list"}],info:'<p>Returns the minimum of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">min(list: list): Any\n</code></pre>\n<p>All elements in <code>list</code> should have the same type and be comparable.</p>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">min([1,2,3])\n// 1\n\nmin(1,2,3)\n// 1\n</code></pre>\n'},{name:"max",type:"function",params:[{name:"list"}],info:'<p>Returns the maximum of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">max(list: list): Any\n</code></pre>\n<p>All elements in <code>list</code> should have the same type and be comparable.</p>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">max([1,2,3])\n// 3\n\nmax(1,2,3)\n// 3\n</code></pre>\n'},{name:"sum",type:"function",params:[{name:"list"}],info:'<p>Returns the sum of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sum(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sum([1,2,3])\n// 6\n\nsum(1,2,3)\n// 6\n</code></pre>\n'},{name:"product",type:"function",params:[{name:"list"}],info:'<p>Returns the product of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">product(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">product([2, 3, 4])\n// 24\n\nproduct(2, 3, 4)\n// 24\n</code></pre>\n'},{name:"mean",type:"function",params:[{name:"list"}],info:'<p>Returns the arithmetic mean (i.e. average) of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">mean(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">mean([1,2,3])\n// 2\n\nmean(1,2,3)\n// 2\n</code></pre>\n'},{name:"median",type:"function",params:[{name:"list"}],info:'<p>Returns the median element of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">median(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">median(8, 2, 5, 3, 4)\n// 4\n\nmedian([6, 1, 2, 3])\n// 2.5\n</code></pre>\n'},{name:"stddev",type:"function",params:[{name:"list"}],info:'<p>Returns the standard deviation of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">stddev(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">stddev(2, 4, 7, 5)\n// 2.0816659994661326\n\nstddev([2, 4, 7, 5])\n// 2.0816659994661326\n</code></pre>\n'},{name:"mode",type:"function",params:[{name:"list"}],info:'<p>Returns the mode of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">mode(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">mode(6, 3, 9, 6, 6)\n// [6]\n\nmode([6, 1, 9, 6, 1])\n// [1, 6]\n</code></pre>\n'},{name:"all",type:"function",params:[{name:"list"}],info:'<p>Returns <code>false</code> if any element of the given list is <code>false</code>. Otherwise, returns <code>true</code>.</p>\n<p>If the given list is empty, it returns <code>true</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">all(list: list<boolean>): boolean\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">all([true,false])\n// false\n\nall(false,null,true)\n// false\n</code></pre>\n<p>:::info\nThe function <code>all()</code> replaced the previous function <code>and()</code>. The previous function is deprecated and\nshould not be used anymore.\n:::</p>\n'},{name:"any",type:"function",params:[{name:"list"}],info:'<p>Returns <code>true</code> if any element of the given list is <code>true</code>. Otherwise, returns <code>false</code>.</p>\n<p>If the given list is empty, it returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">any(list: list<boolean>): boolean\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">any([false,true])\n// true\n\nany(false,null,true)\n// true\n</code></pre>\n<p>:::info\nThe function <code>any()</code> replaced the previous function <code>or()</code>. The previous function is deprecated and\nshould not be used anymore.\n:::</p>\n'},{name:"sublist",type:"function",params:[{name:"list"},{name:"start position"}],info:'<p>Returns a partial list of the given value starting at <code>start position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sublist(list: list, start position: number): list\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sublist([1,2,3], 2)\n// [2,3]\n</code></pre>\n'},{name:"sublist",type:"function",params:[{name:"list"},{name:"start position"},{name:"length"}],info:'<p>Returns a partial list of the given value starting at <code>start position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sublist(list: list, start position: number, length: number): list\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sublist([1,2,3], 1, 2)\n// [1,2]\n</code></pre>\n'},{name:"append",type:"function",params:[{name:"list"},{name:"items"}],info:'<p>Returns the given list with all <code>items</code> appended.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">append(list: list, items: Any): list\n</code></pre>\n<p>The parameter <code>items</code> can be a single element or a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">append([1], 2, 3)\n// [1,2,3]\n</code></pre>\n'},{name:"concatenate",type:"function",params:[{name:"lists"}],info:'<p>Returns a list that includes all elements of the given lists.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">concatenate(lists: list): list\n</code></pre>\n<p>The parameter <code>lists</code> is a sequence of lists.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">concatenate([1,2],[3])\n// [1,2,3]\n\nconcatenate([1],[2],[3])\n// [1,2,3]\n</code></pre>\n'},{name:"insert before",type:"function",params:[{name:"list"},{name:"position"},{name:"newItem"}],info:'<p>Returns the given list with <code>newItem</code> inserted at <code>position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">insert before(list: list, position: number, newItem: Any): list\n</code></pre>\n<p>The <code>position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">insert before([1,3],1,2)\n// [2,1,3]\n</code></pre>\n'},{name:"remove",type:"function",params:[{name:"list"},{name:"position"}],info:'<p>Returns the given list without the element at <code>position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">remove(list: list, position: number): list\n</code></pre>\n<p>The <code>position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">remove([1,2,3], 2)\n// [1,3]\n</code></pre>\n'},{name:"reverse",type:"function",params:[{name:"list"}],info:'<p>Returns the given list in revered order.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">reverse(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">reverse([1,2,3])\n// [3,2,1]\n</code></pre>\n'},{name:"index of",type:"function",params:[{name:"list"},{name:"match"}],info:'<p>Returns an ascending list of positions containing <code>match</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">index of(list: list, match: Any): list<number>\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">index of([1,2,3,2],2)\n// [2,4]\n</code></pre>\n'},{name:"union",type:"function",params:[{name:"list"}],info:'<p>Returns a list that includes all elements of the given lists without duplicates.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">union(list: list): list\n</code></pre>\n<p>The parameter <code>list</code> is a sequence of lists.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">union([1,2],[2,3])\n// [1,2,3]\n</code></pre>\n'},{name:"distinct values",type:"function",params:[{name:"list"}],info:'<p>Returns the given list without duplicates.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">distinct values(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">distinct values([1,2,3,2,1])\n// [1,2,3]\n</code></pre>\n'},{name:"duplicate values",type:"function",params:[{name:"list"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns all duplicate values of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">duplicate values(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">duplicate values([1,2,3,2,1])\n// [1,2]\n</code></pre>\n'},{name:"flatten",type:"function",params:[{name:"list"}],info:'<p>Returns a list that includes all elements of the given list without nested lists.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">flatten(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">flatten([[1,2],[[3]], 4])\n// [1,2,3,4]\n</code></pre>\n'},{name:"sort",type:"function",params:[{name:"list"},{name:"precedes"}],info:'<p>Returns the given list sorted by the <code>precedes</code> function.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sort(list: list, precedes: function<(Any, Any) -> boolean>): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sort(list: [3,1,4,5,2], precedes: function(x,y) x < y)\n// [1,2,3,4,5]\n</code></pre>\n'},{name:"string join",type:"function",params:[{name:"list"}],info:'<p>Joins a list of strings into a single string. This is similar to\nJava's <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string join(list: list<string>): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string join(["a","b","c"])\n// "abc"\n\nstring join(["a",null,"c"])\n// "ac"\n\nstring join([])\n// ""\n</code></pre>\n'},{name:"string join",type:"function",params:[{name:"list"},{name:"delimiter"}],info:'<p>Joins a list of strings into a single string. This is similar to\nJava's <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<p>The resulting string contains a <code>delimiter</code> between each element.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string join(list: list<string>, delimiter: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string join(["a"], "X")\n// "a"\n\nstring join(["a","b","c"], ", ")\n// "a, b, c"\n</code></pre>\n'},{name:"string join",type:"function",params:[{name:"list"},{name:"delimiter"},{name:"prefix"},{name:"suffix"}],info:'<p><em>Camunda Extension</em></p>\n<p>Joins a list of strings into a single string. This is similar to\nJava's <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<p>The resulting string starts with <code>prefix</code>, contains a <code>delimiter</code> between each element, and ends\nwith <code>suffix</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string join(list: list<string>, delimiter: string, prefix: string, suffix: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string join(["a","b","c"], ", ", "[", "]")\n// "[a, b, c]"\n</code></pre>\n'},{name:"is empty",type:"function",params:[{name:"list"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns <code>true</code> if the given list is empty. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">is empty(list: list): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">is empty([])\n// true\n\nis empty([1,2,3])\n// false\n</code></pre>\n'},{name:"partition",type:"function",params:[{name:"list"},{name:"size"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns consecutive sublists of a list, each of the same size (the final list may be smaller).</p>\n<p>If <code>size</code> is less than <code>0</code>, it returns <code>null</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">partition(list: list, size: number): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">partition([1,2,3,4,5], 2)\n// [[1,2], [3,4], [5]]\n\npartition([], 2)\n// []\n\npartition([1,2], 0)\n// null\n</code></pre>\n'},{name:"fromAi",type:"function",params:[{name:"value"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the unmodified <code>value</code> parameter.</p>\n<ul>\n<li>The purpose of this function is solely to tag the value as being generated by an AI integration.</li>\n<li>The actual handling is not performed by the FEEL engine, but by a custom integration such as a connector or a job worker.</li>\n</ul>\n<p>The main use case of this function is to be used in combination with\nthe <a href="../../../connectors/out-of-the-box-connectors/agentic-ai-aiagent.md">AI Agent connector</a>.</p>\n<p>See the following function overloads for additional function parameters.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">fromAi(value: Any): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">fromAi(toolCall.searchQuery)\n// toolCall.searchQuery contents\n\nfromAi(toolCall.userId)\n// toolCall.userId contents\n\nfromAi("A")\n// "A" - does not make much sense and might be flagged as an error by the integration consuming the definition\n</code></pre>\n'},{name:"fromAi",type:"function",params:[{name:"value"},{name:"description"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the unmodified <code>value</code> parameter.</p>\n<p>In addition to the previous overload, it also accepts an optional <code>description</code> parameter to provide a textual description of the value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">fromAi(value: Any, description: string): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">fromAi(toolCall.searchQuery, "The search query used to find the best match.")\n// toolCall.searchQuery contents\n\nfromAi(toolCall.searchQuery, null)\n// toolCall.searchQuery contents\n</code></pre>\n'},{name:"fromAi",type:"function",params:[{name:"value"},{name:"description"},{name:"type"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the unmodified <code>value</code> parameter.</p>\n<p>In addition to the previous overload, it also accepts an optional <code>type</code> parameter to provide type information about the value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">fromAi(value: Any, description: string, type: string): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">fromAi(toolCall.searchQuery, "The search query used to find the best match.", "string")\n// toolCall.searchQuery contents\n\nfromAi(toolCall.userId, "The user's ID", "number")\n// toolCall.userId contents\n\nfromAi(toolCall.userId, null, "number")\n// toolCall.userId contents\n\nfromAi(value: toolCall.userId, type: "number")\n// toolCall.userId contents\n</code></pre>\n'},{name:"fromAi",type:"function",params:[{name:"value"},{name:"description"},{name:"type"},{name:"schema"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the unmodified <code>value</code> parameter.</p>\n<p>In addition to the previous overload, it also accepts an optional <code>schema</code> parameter to provide a (partial) <a href="https://json-schema.org/">JSON schema</a> for the value.</p>\n<ul>\n<li>The schema is not validated by the FEEL engine but might be by a custom integration consuming the information.</li>\n<li>From the engine side it is possible to specify both a <code>type</code> and a <code>schema</code>, and it depends on the integration as to which value takes precedence.</li>\n</ul>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">fromAi(value: Any, description: string, type: string, schema: context): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">fromAi(toolCall.documentType, "The document type to provide", "string", {\n enum: ["invoice", "receipt", "contract"]\n})\n// toolCall.documentType contents\n\nfromAi(value: toolCall.documentType, description: "The document type to provide", schema: {\n type: "string",\n enum: ["invoice", "receipt", "contract"]\n})\n// toolCall.documentType contents\n\nfromAi(toolCall.tags, "Tags to apply to the blog post", "array", {\n items: {\n type: "string"\n }\n})\n// toolCall.tags contents\n</code></pre>\n'},{name:"fromAi",type:"function",params:[{name:"value"},{name:"description"},{name:"type"},{name:"schema"},{name:"options"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the unmodified <code>value</code> parameter.</p>\n<p>In addition to the previous overload, it also accepts an optional <code>options</code> parameter to provide additional options for the integration handling the value definition.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">fromAi(value: Any, description: string, type: string, schema: context, options: context): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">fromAi(toolCall.documentType, "The document type to provide", "string", null, {\n strict: true,\n required: false\n})\n// toolCall.documentType contents\n\nfromAi(value: toolCall.documentType, options: {\n strict: true,\n required: false\n})\n// toolCall.documentType contents\n</code></pre>\n'},{name:"decimal",type:"function",params:[{name:"n"},{name:"scale"}],info:'<p>Rounds the given value at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">decimal(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">decimal(1/3, 2)\n// .33\n\ndecimal(1.5, 0)\n// 2\n</code></pre>\n'},{name:"floor",type:"function",params:[{name:"n"}],info:'<p>Rounds the given value with rounding mode flooring.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">floor(n: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">floor(1.5)\n// 1\n\nfloor(-1.5)\n// -2\n</code></pre>\n'},{name:"floor",type:"function",params:[{name:"n"},{name:"scale"}],info:'<p>Rounds the given value with rounding mode flooring at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">floor(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">floor(-1.56, 1)\n// -1.6\n</code></pre>\n'},{name:"ceiling",type:"function",params:[{name:"n"}],info:'<p>Rounds the given value with rounding mode ceiling.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">ceiling(n: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">ceiling(1.5)\n// 2\n\nceiling(-1.5)\n// -1\n</code></pre>\n'},{name:"ceiling",type:"function",params:[{name:"n"},{name:"scale"}],info:'<p>Rounds the given value with rounding mode ceiling at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">ceiling(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">ceiling(-1.56, 1)\n// -1.5\n</code></pre>\n'},{name:"round up",type:"function",params:[{name:"n"},{name:"scale"}],info:'<p>Rounds the given value with the rounding mode round-up at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round up(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round up(5.5)\n// 6\n\nround up(-5.5)\n// -6\n\nround up(1.121, 2)\n// 1.13\n\nround up(-1.126, 2)\n// -1.13\n</code></pre>\n'},{name:"round down",type:"function",params:[{name:"n"},{name:"scale"}],info:'<p>Rounds the given value with the rounding mode round-down at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round down(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round down(5.5, 0)\n// 5\n\nround down (-5.5, 0)\n// -5\n\nround down (1.121, 2)\n// 1.12\n\nround down (-1.126, 2)\n// -1.12\n</code></pre>\n'},{name:"round half up",type:"function",params:[{name:"n"},{name:"scale"}],info:'<p>Rounds the given value with the rounding mode round-half-up at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round half up(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round half up(5.5, 0)\n// 6\n\nround half up(-5.5, 0)\n// -6\n\nround half up(1.121, 2)\n// 1.12\n\nround half up(-1.126, 2)\n// -1.13\n</code></pre>\n'},{name:"round half down",type:"function",params:[{name:"n"},{name:"scale"}],info:'<p>Rounds the given value with the rounding mode round-half-down at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round half down(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round half down (5.5, 0)\n// 5\n\nround half down (-5.5, 0)\n// -5\n\nround half down (1.121, 2)\n// 1.12\n\nround half down (-1.126, 2)\n// -1.13\n</code></pre>\n'},{name:"abs",type:"function",params:[{name:"number"}],info:'<p>Returns the absolute value of the given numeric value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">abs(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">abs(10)\n// 10\n\nabs(-10)\n// 10\n</code></pre>\n'},{name:"modulo",type:"function",params:[{name:"dividend"},{name:"divisor"}],info:'<p>Returns the remainder of the division of dividend by divisor.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">modulo(dividend: number, divisor: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">modulo(12, 5)\n// 2\n</code></pre>\n'},{name:"sqrt",type:"function",params:[{name:"number"}],info:'<p>Returns the square root of the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sqrt(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sqrt(16)\n// 4\n</code></pre>\n'},{name:"log",type:"function",params:[{name:"number"}],info:'<p>Returns the natural logarithm (base e) of the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">log(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">log(10)\n// 2.302585092994046\n</code></pre>\n'},{name:"exp",type:"function",params:[{name:"number"}],info:'<p>Returns the Euler’s number e raised to the power of the given number .</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">exp(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">exp(5)\n// 148.4131591025766\n</code></pre>\n'},{name:"odd",type:"function",params:[{name:"number"}],info:'<p>Returns <code>true</code> if the given value is odd. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">odd(number: number): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">odd(5)\n// true\n\nodd(2)\n// false\n</code></pre>\n'},{name:"even",type:"function",params:[{name:"number"}],info:'<p>Returns <code>true</code> if the given is even. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">even(number: number): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">even(5)\n// false\n\neven(2)\n// true\n</code></pre>\n'},{name:"random number",type:"function",params:[],info:'<p><em>Camunda Extension</em></p>\n<p>Returns a random number between <code>0</code> and <code>1</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">random number(): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">random number()\n// 0.9701618132579795\n</code></pre>\n'},{name:"before",type:"function",params:[{name:"point1"},{name:"point2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(point1: Any, point2: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before(1, 10)\n// true\n\nbefore(10, 1)\n// false\n</code></pre>\n'},{name:"before",type:"function",params:[{name:"range"},{name:"point"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before([1..5], 10)\n// true\n</code></pre>\n'},{name:"before",type:"function",params:[{name:"point"},{name:"range"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before(1, [2..5])\n// true\n</code></pre>\n'},{name:"before",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before([1..5], [6..10])\n// true\n\nbefore([1..5),[5..10])\n// true\n</code></pre>\n'},{name:"after",type:"function",params:[{name:"point1"},{name:"point2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(point1: Any, point2: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after(10, 1)\n// true\n\nafter(1, 10)\n// false\n</code></pre>\n'},{name:"after",type:"function",params:[{name:"range"},{name:"point"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after([1..5], 10)\n// false\n</code></pre>\n'},{name:"after",type:"function",params:[{name:"point"},{name:"range"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after(12, [2..5])\n// true\n</code></pre>\n'},{name:"after",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after([6..10], [1..5])\n// true\n\nafter([5..10], [1..5))\n// true\n</code></pre>\n'},{name:"meets",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">meets(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">meets([1..5], [5..10])\n// true\n\nmeets([1..3], [4..6])\n// false\n\nmeets([1..3], [3..5])\n// true\n\nmeets([1..5], (5..8])\n// false\n</code></pre>\n'},{name:"met by",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">met by(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">met by([5..10], [1..5])\n// true\n\nmet by([3..4], [1..2])\n// false\n\nmet by([3..5], [1..3])\n// true\n\nmet by((5..8], [1..5))\n// false\n\nmet by([5..10], [1..5))\n// false\n</code></pre>\n'},{name:"overlaps",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">overlaps(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">overlaps([5..10], [1..6])\n// true\n\noverlaps((3..7], [1..4])\n// true\n\noverlaps([1..3], (3..6])\n// false\n\noverlaps((5..8], [1..5))\n// false\n\noverlaps([4..10], [1..5))\n// true\n</code></pre>\n'},{name:"overlaps before",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">overlaps before(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">overlaps before([1..5], [4..10])\n// true\n\noverlaps before([3..4], [1..2])\n// false\n\noverlaps before([1..3], (3..5])\n// false\n\noverlaps before([1..5), (3..8])\n// true\n\noverlaps before([1..5), [5..10])\n// false\n</code></pre>\n'},{name:"overlaps after",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">overlaps after(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">overlaps after([4..10], [1..5])\n// true\n\noverlaps after([3..4], [1..2])\n// false\n\noverlaps after([3..5], [1..3))\n// false\n\noverlaps after((5..8], [1..5))\n// false\n\noverlaps after([4..10], [1..5))\n// true\n</code></pre>\n'},{name:"finishes",type:"function",params:[{name:"point"},{name:"range"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finishes(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finishes(5, [1..5])\n// true\n\nfinishes(10, [1..7])\n// false\n</code></pre>\n'},{name:"finishes",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finishes(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finishes([3..5], [1..5])\n// true\n\nfinishes((1..5], [1..5))\n// false\n\nfinishes([5..10], [1..10))\n// false\n</code></pre>\n'},{name:"finished by",type:"function",params:[{name:"range"},{name:"point"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finished by(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finished by([5..10], 10)\n// true\n\nfinished by([3..4], 2)\n// false\n</code></pre>\n'},{name:"finished by",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finished by(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finished by([1..5], [3..5])\n// true\n\nfinished by((5..8], [1..5))\n// false\n\nfinished by([5..10], (1..10))\n// false\n</code></pre>\n'},{name:"includes",type:"function",params:[{name:"range"},{name:"point"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">includes(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">includes([5..10], 6)\n// true\n\nincludes([3..4], 5)\n// false\n</code></pre>\n'},{name:"includes",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">includes(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">includes([1..10], [4..6])\n// true\n\nincludes((5..8], [1..5))\n// false\n\nincludes([1..10], [1..5))\n// true\n</code></pre>\n'},{name:"during",type:"function",params:[{name:"point"},{name:"range"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">during(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">during(5, [1..10])\n// true\n\nduring(12, [1..10])\n// false\n\nduring(1, (1..10])\n// false\n</code></pre>\n'},{name:"during",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">during(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">during([4..6], [1..10))\n// true\n\nduring((1..5], (1..10])\n// true\n</code></pre>\n'},{name:"starts",type:"function",params:[{name:"point"},{name:"range"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">starts(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">starts(1, [1..5])\n// true\n\nstarts(1, (1..8])\n// false\n</code></pre>\n'},{name:"starts",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">starts(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">starts((1..5], [1..5])\n// false\n\nstarts([1..10], [1..5])\n// false\n\nstarts((1..5), (1..10))\n// true\n</code></pre>\n'},{name:"started by",type:"function",params:[{name:"range"},{name:"point"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">started by(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">started by([1..10], 1)\n// true\n\nstarted by((1..10], 1)\n// false\n</code></pre>\n'},{name:"started by",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">started by(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">started by([1..10], [1..5])\n// true\n\nstarted by((1..10], [1..5))\n// false\n\nstarted by([1..10], [1..10))\n// true\n</code></pre>\n'},{name:"coincides",type:"function",params:[{name:"point1"},{name:"point2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">coincides(point1: Any, point2: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">coincides(5, 5)\n// true\n\ncoincides(3, 4)\n// false\n</code></pre>\n'},{name:"coincides",type:"function",params:[{name:"range1"},{name:"range2"}],info:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">coincides(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">coincides([1..5], [1..5])\n// true\n\ncoincides((1..5], [1..5))\n// false\n\ncoincides([1..5], [2..6])\n// false\n</code></pre>\n'},{name:"substring",type:"function",params:[{name:"string"},{name:"start position"}],info:'<p>Returns a substring of the given value starting at <code>start position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring(string: string, start position: number): string\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring("foobar", 3)\n// "obar"\n\nsubstring("foobar", -2)\n// "ar"\n</code></pre>\n'},{name:"substring",type:"function",params:[{name:"string"},{name:"start position"},{name:"length"}],info:'<p>Returns a substring of the given value, starting at <code>start position</code> with the given <code>length</code>. If <code>length</code> is greater than\nthe remaining characters of the value, it returns all characters from <code>start position</code> until the end.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring(string: string, start position: number, length: number): string\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring("foobar", 3, 3)\n// "oba"\n\nsubstring("foobar", -3, 2)\n// "ba"\n\nsubstring("foobar", 3, 10)\n// "obar"\n</code></pre>\n'},{name:"string length",type:"function",params:[{name:"string"}],info:'<p>Returns the number of characters in the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string length(string: string): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string length("foo")\n// 3\n</code></pre>\n'},{name:"upper case",type:"function",params:[{name:"string"}],info:'<p>Returns the given value with all characters are uppercase.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">upper case(string: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">upper case("aBc4")\n// "ABC4"\n</code></pre>\n'},{name:"lower case",type:"function",params:[{name:"string"}],info:'<p>Returns the given value with all characters are lowercase.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">lower case(string: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">lower case("aBc4")\n// "abc4"\n</code></pre>\n'},{name:"substring before",type:"function",params:[{name:"string"},{name:"match"}],info:'<p>Returns a substring of the given value that contains all characters before <code>match</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring before(string: string, match: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring before("foobar", "bar")\n// "foo"\n</code></pre>\n'},{name:"substring after",type:"function",params:[{name:"string"},{name:"match"}],info:'<p>Returns a substring of the given value that contains all characters after <code>match</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring after(string: string, match: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring after("foobar", "ob")\n// "ar"\n</code></pre>\n'},{name:"contains",type:"function",params:[{name:"string"},{name:"match"}],info:'<p>Returns <code>true</code> if the given value contains the substring <code>match</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">contains(string: string, match: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">contains("foobar", "of")\n// false\n</code></pre>\n'},{name:"starts with",type:"function",params:[{name:"string"},{name:"match"}],info:'<p>Returns <code>true</code> if the given value starts with the substring <code>match</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">starts with(string: string, match: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">starts with("foobar", "fo")\n// true\n</code></pre>\n'},{name:"ends with",type:"function",params:[{name:"string"},{name:"match"}],info:'<p>Returns <code>true</code> if the given value ends with the substring <code>match</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">ends with(string: string, match: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">ends with("foobar", "r")\n// true\n</code></pre>\n'},{name:"matches",type:"function",params:[{name:"input"},{name:"pattern"}],info:'<p>Returns <code>true</code> if the given value matches the <code>pattern</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">matches(input: string, pattern: string): boolean\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">matches("foobar", "^fo*bar")\n// true\n</code></pre>\n'},{name:"matches",type:"function",params:[{name:"input"},{name:"pattern"},{name:"flags"}],info:'<p>Returns <code>true</code> if the given value matches the <code>pattern</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">matches(input: string, pattern: string, flags: string): boolean\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p>The <code>flags</code> can contain one or more of the following characters:</p>\n<ul>\n<li><code>s</code> (dot-all)</li>\n<li><code>m</code> (multi-line)</li>\n<li><code>i</code> (case insensitive)</li>\n<li><code>x</code> (comments)</li>\n</ul>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">matches("FooBar", "foo", "i")\n// true\n</code></pre>\n'},{name:"replace",type:"function",params:[{name:"input"},{name:"pattern"},{name:"replacement"}],info:'<p>Returns the resulting string after replacing all occurrences of <code>pattern</code> with <code>replacement</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">replace(input: string, pattern: string, replacement: string): string\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p>The <code>replacement</code> can access the match groups by using <code>$</code> and the number of the group, for example,\n<code>$1</code> to access the first group.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">replace("abcd", "(ab)|(a)", "[1=$1][2=$2]")\n// "[1=ab][2=]cd"\n\nreplace("0123456789", "(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3")\n// "(012) 345-6789"\n</code></pre>\n'},{name:"replace",type:"function",params:[{name:"input"},{name:"pattern"},{name:"replacement"},{name:"flags"}],info:'<p>Returns the resulting string after replacing all occurrences of <code>pattern</code> with <code>replacement</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">replace(input: string, pattern: string, replacement: string, flags: string): string\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p>The <code>replacement</code> can access the match groups by using <code>$</code> and the number of the group, for example,\n<code>$1</code> to access the first group.</p>\n<p>The <code>flags</code> can contain one or more of the following characters:</p>\n<ul>\n<li><code>s</code> (dot-all)</li>\n<li><code>m</code> (multi-line)</li>\n<li><code>i</code> (case insensitive)</li>\n<li><code>x</code> (comments)</li>\n</ul>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">replace("How do you feel?", "Feel", "FEEL", "i")\n// "How do you FEEL?"\n</code></pre>\n'},{name:"split",type:"function",params:[{name:"string"},{name:"delimiter"}],info:'<p>Splits the given value into a list of substrings, breaking at each occurrence of the <code>delimiter</code> pattern.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">split(string: string, delimiter: string): list<string>\n</code></pre>\n<p>The <code>delimiter</code> is a string that contains a regular expression.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">split("John Doe", "\\s" )\n// ["John", "Doe"]\n\nsplit("a;b;c;;", ";")\n// ["a", "b", "c", "", ""]\n</code></pre>\n'},{name:"extract",type:"function",params:[{name:"string"},{name:"pattern"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns all matches of the pattern in the given string. Returns an empty list if the pattern doesn't\nmatch.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">extract(string: string, pattern: string): list<string>\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">extract("references are 1234, 1256, 1378", "12[0-9]*")\n// ["1234","1256"]\n</code></pre>\n'},{name:"trim",type:"function",params:[{name:"string"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the given string without leading and trailing spaces.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">trim(string: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">trim(" hello world ")\n// "hello world"\n\ntrim("hello world ")\n// "hello world"\n</code></pre>\n'},{name:"uuid",type:"function",params:[],info:'<p><em>Camunda Extension</em></p>\n<p>Returns a UUID (Universally Unique Identifier) with 36 characters.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">uuid(): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">uuid()\n// "7793aab1-d761-4d38-916b-b7270e309894"\n</code></pre>\n'},{name:"to base64",type:"function",params:[{name:"value"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns the given string encoded in Base64 format.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">to base64(value: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">to base64("FEEL")\n// "RkVFTA=="\n</code></pre>\n'},{name:"is blank",type:"function",params:[{name:"string"}],info:'<p><em>Camunda Extension</em></p>\n<p>Returns <code>true</code> if the given string is blank (empty or contains only whitespaces).</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">is blank(string: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">is blank("")\n// true\n\nis blank(" ")\n// true\n\nis blank("hello world")\n// false\n</code></pre>\n'},{name:"now",type:"function",params:[],info:'<p>Returns the current date and time including the timezone.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">now(): date and time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">now()\n// date and time("2020-07-31T14:27:30@Europe/Berlin")\n</code></pre>\n'},{name:"today",type:"function",params:[],info:'<p>Returns the current date.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">today(): date\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">today()\n// date("2020-07-31")\n</code></pre>\n'},{name:"day of week",type:"function",params:[{name:"date"}],info:'<p>Returns the day of the week according to the Gregorian calendar. Note that it always returns the English name of the day.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">day of week(date: date): string\n</code></pre>\n<pre><code class="language-feel">day of week(date: date and time): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">day of week(date("2019-09-17"))\n// "Tuesday"\n\nday of week(date and time("2019-09-17T12:00:00"))\n// "Tuesday"\n</code></pre>\n'},{name:"day of year",type:"function",params:[{name:"date"}],info:'<p>Returns the Gregorian number of the day within the year.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">day of year(date: date): number\n</code></pre>\n<pre><code class="language-feel">day of year(date: date and time): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">day of year(date("2019-09-17"))\n// 260\n\nday of year(date and time("2019-09-17T12:00:00"))\n// 260\n</code></pre>\n'},{name:"week of year",type:"function",params:[{name:"date"}],info:'<p>Returns the Gregorian number of the week within the year, according to ISO 8601.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">week of year(date: date): number\n</code></pre>\n<pre><code class="language-feel">week of year(date: date and time): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">week of year(date("2019-09-17"))\n// 38\n\nweek of year(date and time("2019-09-17T12:00:00"))\n// 38\n</code></pre>\n'},{name:"month of year",type:"function",params:[{name:"date"}],info:'<p>Returns the month of the year according to the Gregorian calendar. Note that it always returns the English name of the month.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">month of year(date: date): string\n</code></pre>\n<pre><code class="language-feel">month of year(date: date and time): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">month of year(date("2019-09-17"))\n// "September"\n\nmonth of year(date and time("2019-09-17T12:00:00"))\n// "September"\n</code></pre>\n'},{name:"abs",type:"function",params:[{name:"n"}],info:'<p>Returns the absolute value of a given duration.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">abs(n: days and time duration): days and time duration\n</code></pre>\n<pre><code class="language-feel">abs(n: years and months duration): years and months duration\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">abs(duration("-PT5H"))\n// "duration("PT5H")"\n\nabs(duration("PT5H"))\n// "duration("PT5H")"\n\nabs(duration("-P2M"))\n// duration("P2M")\n</code></pre>\n'},{name:"last day of month",type:"function",params:[{name:"date"}],info:'<p><em>Camunda Extension</em></p>\n<p>Takes the month of the given date or date-time value and returns the last day of this month.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">last day of month(date: date): date\n</code></pre>\n<pre><code class="language-feel">last day of month(date: date and time): date\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">last day of month(date("2022-10-01"))\n// date("2022-10-31"))\n\nlast day of month(date and time("2022-10-16T12:00:00"))\n// date("2022-10-31"))\n</code></pre>\n'}];var LL=[AM((e=>{if(0===e.state.doc.length)return[];const t=jP(e.state),n=(i={syntaxTree:t,readContent:(t,n)=>e.state.sliceDoc(t,n),updateContent:(t,n,i)=>e.dispatch({changes:{from:t,to:n,insert:i}})},[...mL(i.syntaxTree),..._L(i)]);var i;return n.map((e=>({...e,source:e.type})))}))];var IL=[hS.theme({"& .cm-content":{padding:"0px"},"& .cm-line":{padding:"0px"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-completionInfo":{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis"},"&.cm-editor":{height:"100%"},"& .cm-completionInfo > *":{whiteSpace:"normal"},"& .cm-completionInfo ul":{margin:0,paddingLeft:"15px"},"& .cm-completionInfo pre":{marginBottom:0,whiteSpace:"pre-wrap"},"& .cm-completionInfo p":{marginTop:0},"& .cm-completionInfo p:not(:last-of-type)":{marginBottom:0}}),hS.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),vT(pT.define([{tag:RP.variableName,class:"variableName"},{tag:RP.name,class:"variableName"},{tag:RP.number,class:"number"},{tag:RP.string,class:"string"},{tag:RP.bool,class:"bool"},{tag:RP.function(RP.variableName),class:"function"},{tag:RP.function(RP.special(RP.variableName)),class:"function"},{tag:RP.controlKeyword,class:"control"},{tag:RP.operatorKeyword,class:"control"}]))];function QL(e){return e&&e.from===e.to}function jL(e){return!!e&&("PathExpression"===e.name||jL(e.parent))}function BL({variables:e}){return t=>{const n=jP(t.state).resolve(t.pos,-1);if(!jL(n))return null;const i=function(e){for(;e;){if("PathExpression"===e.name)return e;e=e.parent}}(n),o=n===i?t.pos:n.from,r=NL(i,t);let s=e;for(var a=0;a<r.length-1;a++){var l=s.find((e=>e.name===r[a].name));if(!l)return null;if("optional"!==l.isList&&!!l.isList!==r[a].isList)return null;s=l.entries}if(!s)return null;return{from:o,options:s.map((e=>({label:e.name,type:"variable",info:e.info,detail:e.detail})))}}}function NL(e,t){let n=[];for(let i=e.firstChild;i;i=i.nextSibling)"PathExpression"===i.name?n.push(...NL(i,t)):"FilterExpression"===i.name?n.push(...qL(i,t)):n.push({name:FL(i,t),isList:!1});return n}function qL(e,t){const n=e.firstChild;if("PathExpression"===n.name){const e=NL(n,t);return e[e.length-1].isList=!0,e}return[{name:FL(n,t),isList:!0}]}function FL(e,t){return t.state.sliceDoc(e.from,e.to)}function VL({variables:e=[],builtins:t=[]}){const n=function(e,t){return[].concat(e.map((e=>XL(e))),t.map((e=>XL(e))))}(e,t);return n.length?e=>{const{pos:t,state:i}=e,o=jP(i).resolve(t,-1);return function(e,t){const n=e.nextSibling;return QL(e)||n&&n.from===t&&QL(n)}(o,t)?e.explicit?{from:t,options:n}:null:!function(e){return e&&e.parent&&"VariableName"===e.parent.name}(o)||jL(o)?null:{from:o.from,options:n}}:e=>null}function XL(e,t){return"function"===e.type?function(e,t){const{name:n,info:i,detail:o,params:r=[]}=e,s=r.map((({name:e,type:t},n)=>({name:e||`param ${n+1}`,type:t}))),a=`${n}(${s.map((e=>"${"+e.name+"}")).join(", ")})`,l=s.map((({name:e,type:t})=>t?`${e}: ${t}`:e)).join(", "),c=`${n}(${l})`;return XR(a,{label:c,type:"function",info:i,detail:o,boost:t})}(e,t):{label:e.name,type:"variable",info:e.info,detail:e.detail,boost:t}}function zL({variables:e=[],builtins:t=[]}){return[BL({variables:e}),VL({variables:e,builtins:t}),VT(xL),...CL]}function YL(e){return function(e={}){const t="unaryTests"===e.dialect?AL:ML,n=e.parserDialect,i=uL(e.context),o=t.configure({contextTracker:i,dialect:n}),r=e.completions||[SL(xL),CL].flat();return new HP(o,[...r.map((e=>o.data.of({autocomplete:e})))])}(e)}const WL=Bx.define(),HL=Bx.define(),UL=Bx.define(),GL=Bx.define();function ZL({dialect:e="expression",parserDialect:t,variables:n=[],builtins:i=[],completions:o=zL({builtins:i,variables:n})}){const r=function(e){return e.slice().reverse().reduce(((e,t)=>(e[t.name]=()=>{},e)),{})}([...n,...i]);return[UL.of(e),WL.of(i),HL.of(n),GL.of(t),YL({dialect:e,parserDialect:t,context:r,completions:o})]}const KL=DL.map((e=>({...e,info:()=>wt(e.info)}))),JL=new eO,eI=new eO;function tI({extensions:e=[],dialect:t="expression",parserDialect:n,container:i,contentAttributes:o={},tooltipContainer:r,onChange:s=()=>{},onKeyDown:a=()=>{},onLint:l=()=>{},placeholder:c="",readOnly:u=!1,value:h="",builtins:d=KL,variables:p=[]}){const f=hS.updateListener.of((e=>{e.docChanged&&s(e.state.doc.toString())})),g=hS.updateListener.of((e=>{const t=e.transactions.flatMap((e=>e.effects)).filter((e=>e.is(xM)));if(!t.length)return;const n=t.flatMap((e=>e.value));l(n)})),m=hS.domEventHandlers({keydown:a});"string"==typeof r&&(r=document.querySelector(r));const v=r?$S({tooltipSpace:function(){return r.getBoundingClientRect()}}):[],y=[lA(),JL.of(ZL({dialect:t,builtins:d,variables:p,parserDialect:n})),$T(),uT(),GR(),hS.contentAttributes.of(o),f,m,bS.of([...mM]),LL,g,v,eI.of(kS(c)),IL,...e];return u&&y.push(hS.editable.of(!1)),this._cmEditor=new hS({state:SO.create({doc:h,extensions:y}),parent:i}),this}tI.prototype.setValue=function(e){this._cmEditor.dispatch({changes:{from:0,to:this._cmEditor.state.doc.length,insert:e}})},tI.prototype.focus=function(e){const t=this._cmEditor;if(t.contentDOM.focus(),t.focus(),"number"==typeof e){const n=t.state.doc.length;t.dispatch({selection:{anchor:e<=n?e:n}})}},tI.prototype.getSelection=function(){return this._cmEditor.state.selection},tI.prototype.setVariables=function(e){const t={builtins:(n=this._cmEditor.state).facet(WL)[0],variables:n.facet(HL)[0],dialect:n.facet(UL)[0],parserDialect:n.facet(GL)[0]};var n;this._cmEditor.dispatch({effects:[JL.reconfigure(ZL({...t,variables:e}))]})},tI.prototype.setPlaceholder=function(e){this._cmEditor.dispatch({effects:eI.reconfigure(kS(e))})};let nI=class extends Bs{constructor(e,t){super(e,t),this.node=null,this.editor=null,this.state={value:e.value},this._feelLanguageContext=t.injector?.get("feelLanguageContext",!1)}_getFeelLanguageContext(){return this._feelLanguageContext&&this._feelLanguageContext.getConfig()}componentDidMount(){const e=this._getFeelLanguageContext();this.editor=new tI({contentAttributes:{"aria-label":this.props.label},parserDialect:e?.parserDialect,builtins:e?.builtins,dialect:this.props.feelLanguageDialect,container:this.node,onChange:this.handleChange,value:this.state.value,variables:this.props.variables||[],extensions:[hS.lineWrapping]}),this.node.addEventListener("mousedown",this.handleMouseEvent),this.node.addEventListener("keydown",this.handleKeyDownCapture,!0),this.node.addEventListener("keydown",this.handleKeyDown),this.props.autoFocus&&this.editor.focus(this.state.value.length)}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&t!==this.state.value&&this.setState({value:t},(()=>{this.editor.setValue(t)})),function(e,t){return JSON.stringify(e)===JSON.stringify(t)}(e.variables,this.props.variables)||this.editor.setVariables(this.props.variables)}componentWillUnmount(){this.node.removeEventListener("mousedown",this.handleMouseEvent),this.node.removeEventListener("keydown",this.handleKeyDownCapture,!0),this.node.removeEventListener("keydown",this.handleKeyDown)}handleMouseEvent=e=>{e.stopPropagation()};handleKeyDownCapture=e=>{if("Enter"===e.key){if(function(e){return e.querySelector(".cm-tooltip-autocomplete")}(this.node))return void(e.triggeredFromAutocomplete=!0);this.props.ctrlForNewline&&!function(e){return e.metaKey||e.ctrlKey}(e)&&e.preventDefault(),this.props.singleLine&&e.preventDefault()}};handleKeyDown=e=>{["Enter","Escape"].includes(e.key)&&e.triggeredFromAutocomplete&&e.stopPropagation()};handleChange=e=>{const{onInput:t}=this.props;this.setState({value:e}),t&&t(e)};handleBlur=()=>{const{onBlur:e,onChange:t}=this.props;t&&this.state.value!==this.props.value&&t(this.state.value),e&&e()};setNode=e=>{this.node=e};render(){return kr(1,"div",["literal-expression",this.props.className||""].join(" "),null,1,{onClick:this.handleMouseEvent,onFocusIn:this.props.onFocus,onFocusOut:this.handleBlur},null,this.setNode)}};class iI extends Bs{constructor(e,t){super(e,t),this.translate=t.injector.get("translate"),this.expressionLanguages=t.injector.get("expressionLanguages",!1),this.variableResolver=t.injector.get("variableResolver",!1),this.handleValue=e=>{let t={text:e};this.handleChange(t)},this.handleLabelChange=e=>{var t=e||void 0;this.handleChange({label:t})}}handleChange(e){var{onChange:t}=this.props;"function"==typeof t&&t(e)}getExpressionEditorComponent(){return this.expressionLanguages&&"feel"!==this.expressionLanguages.getDefault("inputCell").value?Zb:nI}handleKeyDown=e=>{"Enter"===e.key&&e.stopPropagation()};_getVariables(){return this.variableResolver&&this.variableResolver.getVariables(this.props.element)}render(){const{label:e,text:t}=this.props,n=this.getExpressionEditorComponent(),i=this._getVariables();return kr(1,"div","context-menu-container ref-input-editor input-edit",[kr(1,"div","dms-form-control",Er(2,Zb,{label:this.translate("Input label"),className:"dms-input-label",value:e||"",placeholder:this.translate("Input"),singleLine:!0,onInput:this.handleLabelChange}),2),kr(1,"div","dms-form-control",[kr(1,"label","dms-label",this.translate("Expression"),0),Er(2,n,{label:this.translate("Input expression"),placeholder:this.translate("Enter expression"),className:["ref-text","dms-input"].join(" "),onInput:this.handleValue,value:t||"",variables:i})],4)],4,{onKeyDown:this.handleKeyDown})}}class oI extends Bs{constructor(e,t){super(e,t),this.state={},Dv(this),this.persistChanges=this.debounceInput(this.persistChanges)}persistChanges=()=>{const{input:e}=this.props.context,{unsaved:t}=this.state;if(!t)return;const{label:n,...i}=t;var o,r={};"label"in t&&(r.label=n),o=i,Object.keys(o).length&&(r.inputExpression=i),this.modeling.updateProperties(e,r),this.setState({unsaved:!1})};handleChange=e=>{this.setState({unsaved:{...this.state.unsaved,...e}},this.persistChanges)};getValue(e){let{input:t}=this.props.context;const{unsaved:n}=this.state;let i=t;return"text"===e&&(i=i.inputExpression),n&&e in n?n[e]:i.get(e)}render(){return Er(2,iI,{label:this.getValue("label"),text:this.getValue("text"),element:this.props.context.input,onChange:this.handleChange})}}oI.$inject=["debounceInput","modeling","injector"];class rI extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._eventBus=t.injector.get("eventBus")}onClick=e=>{const{col:t}=this.props;this._eventBus.fire("input.edit",{event:e,input:t})};render(){return kr(1,"button","edit-button dmn-icon-edit",null,1,{"aria-label":this._translate("Edit input"),type:"button",onClick:this.onClick})}}class sI{constructor(e,t,n,i){e.onGetComponent("cell",(({cellType:e})=>{if("input-header"===e)return J_})),e.onGetComponent("context-menu",((e={})=>{if("input-edit"===e.contextMenuType)return oI})),e.onGetComponent("cell-inner",((e={})=>{const{cellType:t}=e;if("input-cell"===t)return rI})),n.on("input.edit",(({event:e,input:n})=>{const{target:i}=e,o=mv(i,"th",!0),{left:r,top:s}=o.getBoundingClientRect();t.open({x:r,y:s,align:"bottom-right"},{contextMenuType:"input-edit",input:n})}))}}sI.$inject=["components","contextMenu","eventBus","renderer"];class aI extends Bs{constructor(e,t){super(e,t),Dv(this);const{value:n}=e;this.state={value:n,optionsVisible:!1},this._portalEl=null}componentDidMount(){document.addEventListener("mousedown",this.onGlobalClick),document.addEventListener("focusin",this.onFocusChanged),this.keyboard.addListener(this.onKeyboard)}componentWillUnmount(){document.removeEventListener("focusin",this.onFocusChanged),document.removeEventListener("mousedown",this.onGlobalClick),this.keyboard.removeListener(this.onKeyboard),this.removePortalEl()}componentWillReceiveProps(e){const{value:t}=e;this.setState({value:t})}componentWillUpdate(e,t){const{optionsVisible:n}=t;n?this._portalEl||this.addPortalEl():this._portalEl&&this.removePortalEl()}componentDidUpdate(){const{optionsVisible:e}=this.state;if(!e||!this.inputNode)return;const t=this.getOptionsBounds();F(this._portalEl.style,t)}getOptionsBounds(){const e=this.renderer.getContainer(),{top:t,left:n,bottom:i}=e.getBoundingClientRect(),{top:o,left:r,width:s,height:a,bottom:l}=this.inputNode.getBoundingClientRect(),c=o+a-t+e.scrollTop,u={top:`${c}px`,left:`${r-n+e.scrollLeft}px`,width:`${s}px`,"max-height":`calc(100% - ${c}px)`};if(i-l<a){const e=i-o;u.bottom=`${e}px`,u["max-height"]=`calc(100% - ${e})`,delete u.top}return u}addPortalEl(){this._portalEl=wt('<div class="dms-select-options"></div>');this.renderer.getContainer().appendChild(this._portalEl),this._portalEl.addEventListener("mousedown",lI)}removePortalEl(){this._portalEl&&(this._portalEl.removeEventListener("mousedown",lI),Ct(this._portalEl),this._portalEl=null)}onChange=e=>{this.setState({value:e});const{onChange:t}=this.props;"function"==typeof t&&t(e)};onInputClick=e=>{e.preventDefault(),e.stopPropagation(),this.setOptionsVisible(!this.state.optionsVisible),this.focusInput()};onInput=e=>{const{value:t}=e.target;this.onChange(t)};onOptionClick=(e,t)=>{t.preventDefault(),t.stopPropagation(),this.setOptionsVisible(!1),this.onChange(e),this.focusInput()};focusInput(){const e=this.inputNode;e.focus(),"selectionStart"in e&&(e.selectionStart=1e5)}checkClose(e){!this._portalEl||this._portalEl.contains(e)||this.parentNode.contains(e)||this.setOptionsVisible(!1)}onFocusChanged=e=>{this.checkClose(e.target)};onGlobalClick=e=>{this.checkClose(e.target)};select(e){const{options:t}=this.props,{value:n}=this.state;if(!t)return;const i=t.filter((e=>e.value===n))[0],o=i?t.indexOf(i):-1,r=-1===o?1===e?0:t.length-1:(o+e)%t.length,s=t[r<0?t.length+r:r];this.onChange(s.value)}setOptionsVisible(e){this.setState({optionsVisible:e})}onKeyDown=e=>{const{optionsVisible:t}=this.state;var n=e.which;40!==n&&38!==n||(e.stopPropagation(),e.preventDefault(),t?this.select(40===n?1:-1):this.setOptionsVisible(!0)),t&&(13!==n&&27!==n||(e.stopPropagation(),e.preventDefault(),this.setOptionsVisible(!1)))};onKeyboard=e=>{const{optionsVisible:t}=this.state;if(t)return 27===e?(this.setOptionsVisible(!1),!0):void 0};renderOptions(e,t){return kr(1,"div","options",e.map((e=>kr(1,"div",["option",t===e?"active":""].join(" "),e.label,0,{"data-value":e.value,onClick:t=>this.onOptionClick(e.value,t)}))),0)}render(){const{className:e,label:t,id:n,options:i,noInput:o,title:r}=this.props,{optionsVisible:s,value:a}=this.state,l=!!i&&i.filter((e=>e.value===a))[0],c=l?l.label:a;return kr(1,"div",[e||"","dms-input-select"].join(" "),[o?kr(1,"div","dms-input",c,0,{"aria-label":t,tabIndex:"0",onKeyDown:this.onKeyDown},null,(e=>this.inputNode=e)):kr(64,"input","dms-input",null,1,{"aria-label":t,onInput:this.onInput,onKeyDown:this.onKeyDown,spellCheck:"false",type:"text",value:a,id:n},null,(e=>this.inputNode=e)),kr(1,"span",["dms-input-select-icon",s?"dmn-icon-up":"dmn-icon-down"].join(" ")),s&&(u=this.renderOptions(i,l),h=this._portalEl,kr(1024,h,null,u,0,null,mr(u)?null:u.key,null))],0,{title:r,onClick:this.onInputClick},null,(e=>this.parentNode=e));var u,h}}function lI(e){e.stopPropagation()}aI.$inject=["keyboard","renderer"];class cI extends Bs{constructor(e,t){super(e),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling"),this._dataTypes=t.injector.get("dataTypes")}onTypeChange=e=>{const t=this.getElement(),n=Dt(t,"dmn:LiteralExpression")?t.$parent:t;let i;Lt(n)?i={inputExpression:{typeRef:e}}:It(n)&&(i={typeRef:e}),this._modeling.updateProperties(n,i)};getElement(){return this.props.context.input||this.props.context.output}render(){const e=this.getElement(),t=(Dt(e,"dmn:InputClause")?e.inputExpression:e).typeRef,n=this._dataTypes.getAll().map((e=>({label:this._translate(e),value:e}))),i=this._translate("Type");return kr(1,"div","type-ref-edit context-menu-container",kr(1,"div","dms-form-control",[kr(1,"label","dms-label",[i,Sr(":")],0),Er(2,aI,{className:"type-ref-edit-select",label:i,onChange:this.onTypeChange,options:n,value:t})],4),2)}}class uI{constructor(e){e.onGetComponent("context-menu",750,((e={})=>{const{contextMenuType:t}=e;if("input-edit"===t||"output-edit"===t)return cI}))}}uI.$inject=["components"];var hI={__depends__:[P_,N_],__init__:["typeRefEditingProvider"],typeRefEditingProvider:["type",uI]};class dI extends Yd{constructor(e,t){super(e),this.postExecuted("element.updateProperties",(e=>{const{element:n,properties:i}=e.context,o=Lt(n)?i.inputExpression:i;if(o&&o.typeRef&&"string"!==o.typeRef){const e=Dt(n,"dmn:LiteralExpression")?n.$parent:n;t.editAllowedValues(e,null)}}))}}dI.$inject=["eventBus","modeling"];let pI=class extends Bs{constructor(e,t){super(e,t);const{items:n}=e;this.state={items:n}}componentWillReceiveProps(e){const{items:t}=e;this.setState({items:t})}getRemoveClickHandler=e=>t=>{t.stopPropagation(),this.removeItem(e)};getToggleClickHandler=e=>t=>{t.stopPropagation(),this.toggleItem(e)};removeItem=e=>{const{onChange:t}=this.props,n=this.state.items.filter((t=>t!==e));this.setState({items:n}),t&&t(n)};toggleItem=e=>{const{onChange:t,type:n}=this.props,i=this.state.items.map((t=>(t===e?t.isChecked=!t.isChecked:"radio"===n&&(t.isChecked=!1),t)));this.setState({items:i}),t&&t(i)};render(){const{className:e,items:t,type:n,labelComponent:i}=this.props,o=["dms-list-component"];e&&o.push(e);const r=function(e){const t=[];for(let n in e)t.push([n,e[n]]);return t}(A(t,"group"));return kr(1,"div",o.join(" "),r.map((e=>{const t=e[0],o=e[1];return kr(1,"div","group",[i&&i(t)||kr(1,"h4","dms-heading",t,0),kr(1,"ul","items no-wrap",o.map((e=>kr(1,"li","item",[n&&kr(64,"input","item-toggle",null,1,{type:n,checked:e.isChecked,onClick:this.getToggleClickHandler(e)}),Sr(" "),e.value,e.isRemovable&&kr(1,"span","remove dmn-icon-clear",null,1,{title:"Remove item",onClick:this.getRemoveClickHandler(e)})],0))),0)],0)})),0)}};class fI extends Bs{constructor(e,t){super(e,t);const{validate:n,value:i}=e,o=n?n(i||""):void 0;this.state={validationWarning:o,value:i},this.onInput=this.onInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this)}componentWillReceiveProps(e){const{validate:t,value:n}=e,i=t?t(n||""):void 0;this.setState({validationWarning:i,value:n})}onInput(e){const{onInput:t,validate:n}=this.props,i=n?n(e):void 0;this.setState({validationWarning:i,value:e}),"function"==typeof t&&t&&t({isValid:!i,value:e})}onKeyDown(e){const{target:t}=e,{value:n}=t,{onKeyDown:i,validate:o}=this.props,r=o?o(n):void 0;"function"==typeof i&&i({isValid:!r,value:n,event:e})}onKeyUp(e){const{target:t}=e,{value:n}=t,{onKeyUp:i,validate:o}=this.props,r=o?o(n):void 0;"function"==typeof i&&i({isValid:!r,value:n,event:e})}render(){const{placeholder:e,type:t,className:n,label:i}=this.props,{validationWarning:o,value:r}=this.state,s=["dms-validated-input",n].join(" "),a=[];return o&&a.push("invalid"),kr(1,"div",s,[Er(2,W_,{className:a,label:i,onInput:this.onInput,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,placeholder:e||"",type:t,value:r||""}),o&&kr(1,"p","dms-hint dms-validation-warning",o,0)],0)}}function gI(e){if(!e||function(e){return""===e}(e.trim()))return{values:[]};let t=e.split(",");const n={values:[]};let i="";return t.forEach((e=>{i+=e,/^"[^"]*"$/.test(i.trim())?(n.values.push(i.trim()),i=""):i+=","})),i?void 0:n}let mI=class extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling"),this._changeSupport=t.changeSupport;const n=this.getAllowedValuesTarget(),i=gI(n.inputValues&&n.inputValues.text||n.outputValues&&n.outputValues.text||"");this.state=i?{values:i.values.map((e=>({value:e,isCheckable:!1,isRemovable:!0,group:this._translate("Predefined values")}))),inputValue:""}:{values:null,inputValue:""}}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this.getAllowedValuesTarget();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this.getAllowedValuesTarget();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}setPredefinedValues=e=>{const t=this.getAllowedValuesTarget();this.setState({values:e}),this._modeling.editAllowedValues(t,e&&function(e){return e.map((e=>e.value))}(e))};onListChange=e=>{this.setPredefinedValues(e)};getAllowedValuesTarget(){const e=this.getElement();return Dt(e,"dmn:LiteralExpression")?e.$parent:e}onInput=({isValid:e,value:t})=>{this.setState({inputValue:t})};onKeyDown=({isValid:e,event:t})=>{if(13===t.keyCode&&(t.stopPropagation(),t.preventDefault(),e)){const{inputValue:e,values:t}=this.state,n=gI(e);this.onListChange((t||[]).concat(n.values.map((e=>({value:e,isCheckable:!1,isRemovable:!0,group:this._translate("Predefined values")}))))),this.setState({inputValue:""})}};handleRemovePredifinedValuesClick=e=>{e.stopPropagation(),this.removePredefinedValues()};removePredefinedValues=()=>{this.setPredefinedValues(null)};getElement(){return this.props.context.output||this.props.context.input.inputExpression}render(){const e=this.getElement(),{inputValue:t,values:n}=this.state;return"string"===e.typeRef?kr(1,"div","context-menu-container allowed-values-edit",kr(1,"div","dms-form-control",[!yI(n)&&n.length>0&&Er(2,pI,{labelComponent:vI,items:n,onChange:this.onListChange}),!yI(n)&&!n.length&&kr(1,"div",null,[kr(1,"label","dms-label",this._translate("Predefined values"),0),kr(1,"span","placeholder",this._translate("No values"),0)],4),!yI(n)&&kr(1,"p","dms-hint",kr(1,"button","del-values",this._translate("Clear predefined values"),0,{type:"button",onClick:this.handleRemovePredifinedValuesClick}),2),kr(1,"label","dms-label",this._translate("Add predefined values"),0),Er(2,fI,{onInput:this.onInput,onKeyDown:this.onKeyDown,placeholder:this._translate('"value", "value", ...'),type:"text",validate:e=>{if(!gI(e))return this._translate("Strings must be in double quotes")},value:t})],0),2):null}};function vI(e){return kr(1,"label","dms-label",e,0)}function yI(e){return null===e}class bI{constructor(e){e.onGetComponent("context-menu",500,((e={})=>{const{contextMenuType:t}=e;if("input-edit"===t||"output-edit"===t)return mI}))}}bI.$inject=["components"];var _I={__init__:["allowedValuesUpdateBehavior","allowedValuesEditingProvider"],allowedValuesUpdateBehavior:["type",dI],allowedValuesEditingProvider:["type",bI]};class xI extends Bs{constructor(e,t){super(e,t),this._sheet=t.injector.get("sheet"),this._eventBus=t.injector.get("eventBus"),this._changeSupport=t.changeSupport,this._translate=t.injector.get("translate")}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}getRoot(){return this._sheet.getRoot()}handleClick=e=>{e.stopPropagation(),this.add()};add=()=>{this._eventBus.fire("addInput")};render(){return kr(1,"div","add-input actionable",kr(1,"button","dmn-icon-plus action-icon",null,1,{title:this._translate("Add input")}),2,{onClick:this.handleClick})}}class OI extends Bs{constructor(e,t){super(e,t),this._sheet=t.injector.get("sheet"),this._eventBus=t.injector.get("eventBus"),this._changeSupport=t.changeSupport,this._translate=t.injector.get("translate")}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}getRoot(){return this._sheet.getRoot()}handleClick=e=>{e.stopPropagation(),this.add()};add=()=>{this._eventBus.fire("addOutput")};render(){return kr(1,"div","add-output actionable",kr(1,"button","dmn-icon-plus action-icon",null,1,{title:this._translate("Add output")}),2,{onClick:this.handleClick})}}function wI(e,t,n){e.onGetComponent("cell-inner",((e={})=>{const{cellType:t,index:n,inputsLength:i,outputsLength:o}=e;return"input-cell"===t&&n===i-1?xI:"output-cell"===t&&n===o-1?OI:void 0})),n.on("addInput",(()=>{t.trigger("addInput")})),n.on("addOutput",(()=>{t.trigger("addOutput")}))}wI.$inject=["components","editorActions","eventBus"];var CI={__depends__:[Vb],__init__:["addInputOutputProvider"],addInputOutputProvider:["type",wI]},kI="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/pull/662";let EI=class{constructor(e,t,n,i,o){this._config=e||{},this._editorActions=n,this._eventBus=t,this._cellSelection=i,this._listeners=[],t.on("table.destroy",this._destroy),t.on("table.init",this._init),t.on("attach",(()=>{this._config.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(kI)),this._target=o.getContainer(),this._config&&!1!==this._config.bind&&this.bind()})),t.on("detach",this.unbind)}_init=()=>{this._registerDefaultBindings(),this._fire("init")};_destroy=()=>{this._fire("destroy"),this.unbind(),this._listeners=null};_keyHandler=e=>{var t,n,i=this._listeners,o=e.keyCode||e.charCode||-1;for(t=0;n=i[t];t++)if(n(o,e))return e.preventDefault(),void e.stopPropagation()};bind(e){e&&console.error("unsupported argument <node>",new Error(kI)),this.unbind(),e=this._node=this._target,wv.bind(e,"keydown",this._keyHandler),this._fire("bind")}getBinding(){return this._node}unbind=()=>{var e=this._node;e&&(this._fire("unbind"),wv.unbind(e,"keydown",this._keyHandler)),this._node=null};_fire(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})}_registerDefaultBindings(){var e=this._listeners,t=this._editorActions,n=this._cellSelection;e.push((function(e,n){if(T_(n)&&!R_(n)&&90===e)return t.trigger("undo"),!0})),e.push((function(e,n){if(T_(n)&&(89===e||90===e&&R_(n)))return t.trigger("redo"),!0})),e.push((function(e,n){if(13===e&&!T_(n)&&R_(n)&&pb(n.target))return t.trigger("selectCellAbove"),!0})),e.push((function(e,i){if(13!==e||T_(i)||R_(i))return;if(!pb(i.target))return;const o=t.trigger("selectCellBelow"),r=n.getCellSelection();if(!o&&r&&"__decisionProperties_name"!==r){const e=t.trigger("addRule");return t.trigger("selectCellBelow"),e}return!0}))}addListener(e){this._listeners.unshift(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}};EI.$inject=["config.keyboard","eventBus","editorActions","cellSelection","renderer"];var SI={__depends__:[Vb],__init__:["keyboard"],keyboard:["type",EI]},$I={__depends__:[CI,_I,P_,u_,ly,uy,SI,hI],__init__:["inputEditingProvider","outputEditingProvider"],inputEditingProvider:["type",sI],outputEditingProvider:["type",K_]};function PI(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let TI=class{constructor(e,t,n,i){PI(this,"handleDragOver",(e=>{RI(e);const t=My(e.target,".dmn-decision-table-container td,\n .dmn-decision-table-container th",!0);let n=!!t;const{hoverEl:i}=this._dragContext;i&&i!==t&&(this._emit("dragAndDrop.dragLeave",e),this._dragContext.targetEl=null,this._dragContext.hoverEl=null),t&&(t!==i&&(this._dragContext.hoverEl=t,n=this._emit("dragAndDrop.dragEnter",e),!1!==n&&(this._dragContext.targetEl=t)),n=this._emit("dragAndDrop.dragOver",e)),e.dataTransfer.dropEffect=!1!==n?"move":"none"})),PI(this,"handleDrop",(e=>{RI(e);const t=this._emit("dragAndDrop.drop",e);if(t){const{draggedElement:e}=this._dragContext;if(e instanceof Ym){const{rows:n}=this._sheet.getRoot();let i=n.indexOf(t);this._modeling.moveRow(e,i)}else if(e instanceof Wm){const{cols:n}=this._sheet.getRoot();let i=n.indexOf(t);this._modeling.moveCol(e,i)}}this.handleDragEnd(e)})),PI(this,"handleDragEnd",(e=>{RI(e),this._unbindListeners(),this._emit("dragAndDrop.dragEnd",e),this._dragContext=null})),this._eventBus=e,this._renderer=t,this._modeling=n,this._sheet=i,this._dragContext=null,e.on("table.destroy",(()=>{this._unbindListeners()}))}_bindListeners(){Ny.bind(document,"dragover",this.handleDragOver),Ny.bind(document,"drop",this.handleDrop),Ny.bind(document,"dragend",this.handleDragEnd)}_unbindListeners(){Ny.unbind(document,"dragover",this.handleDragOver),Ny.unbind(document,"drop",this.handleDrop),Ny.unbind(document,"dragend",this.handleDragEnd)}_emit(e,t){return this._eventBus.fire(e,{dragContext:this._dragContext,originalEvent:t})}startDrag(e,t){RI(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)}};function RI(e,t){e.stopPropagation(),!0!==t&&e.preventDefault()}TI.$inject=["eventBus","renderer","modeling","sheet"];var AI={__init__:["dragAndDrop"],dragAndDrop:["type",TI]};const MI="top",DI="left";class LI{constructor(e,t,n,i,o,r,s,a){this._elementRegistry=t,this._dragAndDrop=i,this._renderer=o,this._rules=r,this._sheet=s,this._translate=a,e.onGetComponent("cell-inner",(({cellType:e,col:t,row:n})=>{if("rule-index"===e)return()=>kr(1,"span","dmn-icon-drag vertical",Sr(" "),2,{draggable:"true",onDragStart:e=>this.startDrag(n,e),title:this._translate("Move rule")});if("input-cell"===e||"output-cell"===e){let e="Move "+(Lt(t)?"Input":"Output");return()=>kr(1,"span","dmn-icon-drag horizontal",null,1,{draggable:"true",onDragStart:e=>this.startDrag(t,e),title:e})}})),n.on("dragAndDrop.dragEnter",(e=>{const{dragContext:t}=e,{draggedElement:n,hoverEl:i}=t;if(n instanceof Ym)return!0;if(n instanceof Wm){const e=function(e,t,n){const i=t.get(e.dataset.colId);if(!i)return-1;const{cols:o}=n.getRoot();return o.indexOf(i)}(i,this._elementRegistry,this._sheet);if(-1===e)return!1;return this._rules.allowed("col.move",{col:n,index:e})}return!1})),n.on("dragAndDrop.dragLeave",(e=>{const{dragContext:t}=e,{targetEl:n}=t;if(!n)return;jI(this._renderer.getContainer())})),n.on("dragAndDrop.dragOver",(e=>{const{dragContext:t,originalEvent:n}=e,{draggedElement:i,lastPosition:o,targetEl:r}=t,s=this._renderer.getContainer();if(!r)return!1;let a;return i instanceof Ym&&(a=NI(n,r)),i instanceof Wm&&(a=BI(n,r)),o===a||(jI(s),i instanceof Ym&&II(r,s,a===MI?"top":"bottom"),i instanceof Wm&&QI(r,s,a===DI?"left":"right"),t.lastPosition=a),!0})),n.on("dragAndDrop.drop",(e=>{const{dragContext:t,originalEvent:n}=e,{draggedElement:i,targetEl:o}=t;if(!o)return!1;if(i instanceof Ym){const e=NI(n,o),t=o.dataset.rowId,r=this._elementRegistry.get(t);if(!r||r===i)return;const s=function(e,t,n,i){i.indexOf(e)>i.indexOf(t)&&(t=function(e,t){const n=t.indexOf(e);return t[Math.min(t.length-1,n+1)]}(t,i));return n===MI?function(e,t){const n=t.indexOf(e);return t[Math.max(0,n-1)]}(t,i):t}(i,r,e,this._sheet.getRoot().rows);if(s===i)return;return s}if(i instanceof Wm){const e=BI(n,o),t=o.dataset.colId,r=this._elementRegistry.get(t);if(!r||r===i)return;const s=function(e,t,n,i){i.indexOf(e)>i.indexOf(t)&&(t=function(e,t){const n=t.indexOf(e);if(Lt(e)){const e=t.filter((e=>Lt(e))),i=e[e.length-1],o=t.indexOf(i);return t[Math.min(o,n+1)]}return t[Math.min(t.length-1,n+1)]}(t,i));return n===DI?function(e,t){const n=t.indexOf(e);if(It(e)){const e=t.filter((e=>It(e)))[0],i=t.indexOf(e);return t[Math.max(i,n-1)]}return t[Math.max(0,n-1)]}(t,i):t}(i,r,e,this._sheet.getRoot().cols);if(s===i)return;return s}})),n.on("dragAndDrop.dragEnd",this._cleanup)}startDrag(e,t){const n=this._renderer.getContainer();this._dragImage=Sv('<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 Ym?function(e,t){const n=Tv(`[data-row-id=${e.id}]`,t);k(n,(e=>{qI(e)&&fv(e).add("dragged")}))}(e,n):e instanceof Wm&&function(e,t){const n=Tv(`[data-col-id=${e.id}]`,t);k(n,(e=>{qI(e)&&fv(e).add("dragged")}))}(e,n),this._dragAndDrop.startDrag(e,t)}_cleanup=()=>{const e=this._renderer.getContainer();jI(e),function(e){const t=Tv(".dragged",e);k(t,(e=>{qI(e)&&fv(e).remove("dragged")}))}(e),this._dragImage&&(Rv(this._dragImage),this._dragImage=null)}}function II(e,t,n){const i=e.dataset.rowId;if(!i)return;k(Tv(`[data-row-id=${i}]`,t),(e=>{qI(e)&&(fv(e).add("dragover"),fv(e).add(n))}))}function QI(e,t,n){const i=e.dataset.colId;if(!i)return;k(Tv(`[data-col-id=${i}]`,t),(e=>{qI(e)&&(fv(e).add("dragover"),fv(e).add(n))}))}function jI(e){k(Tv(".dragover",e),(e=>{qI(e)&&(fv(e).remove("dragover"),fv(e).remove("top"),fv(e).remove("right"),fv(e).remove("bottom"),fv(e).remove("left"))}))}function BI(e,t){const n=t.getBoundingClientRect();return e.clientX<n.left+n.width/2?DI:"right"}function NI(e,t){const n=t.getBoundingClientRect();return e.clientY<n.top+n.height/2?MI:"bottom"}function qI(e){return e&&(1===e.nodeType||11==e.nodeType)}LI.$inject=["components","elementRegistry","eventBus","dragAndDrop","renderer","rules","sheet","translate"];var FI={__depends__:[AI,Ob],__init__:["dmnDragAndDrop"],dmnDragAndDrop:["type",LI]};class VI extends Bs{constructor(e,t){super(e,t),this._elementRegistry=t.injector.get("elementRegistry"),this._modeling=t.injector.get("modeling"),this._changeSupport=this.context.changeSupport;const{id:n}=this.props.context;this._element=this._elementRegistry.get(n)}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){this._element&&this._changeSupport.onElementsChanged(this._element.id,this.onElementsChanged)}componentDidMount(){const{autoFocus:e}=this.props.context;if(e&&this.node){Pv(".content-editable",this.node).focus()}}componentWillUnmount(){if(this._element){this._changeSupport.offElementsChanged(this._element.id,this.onElementsChanged);const{businessObject:e}=this._element,{description:t}=e;x(t)&&!t.length&&this.changeDescription(null)}}changeDescription=e=>{this._modeling.updateProperties(this._element,{description:e})};render(){if(!this._element)return;const{businessObject:e}=this._element,{description:t}=e;return x(t)?kr(1,"div","context-menu-container description-editor",Er(2,XI,{className:"dms-input",onChange:this.changeDescription,value:t}),2,null,null,(e=>this.node=e)):void 0}}let XI=class extends Jb{render(){return kr(1,"div",this.getClassName(),this.getEditor(),0)}};let zI=class{constructor(e,t,n,i,o,r,s){this._contextMenu=t,this._modeling=o,this._renderer=r,this._translate=s,i.on("cell.click",750,(e=>{if(e.defaultPrevented)return;const{target:i,id:o}=e,s=n.get(o);if(!jt(s,["dmn:UnaryTests","dmn:LiteralExpression"]))return;WI(s)||e.preventDefault();const a=YI(r.getContainer(),i.getBoundingClientRect());t.open(a,{contextMenuType:"cell-description",autoFocus:!1,id:o,offset:{x:4,y:4}})})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"cell-description"===e.contextMenuType){if(x(WI(n.get(e.id))))return VI}})),e.onGetComponent("context-menu-cell-additional",500,((e={})=>{if(e.contextMenuType&&"context-menu"===e.contextMenuType){const{id:t}=e;if(!t)return;const i=n.get(t);if(!i)return;const{businessObject:o}=i,{description:r}=o,s=x(r),a=s?()=>this.removeDescription(i):()=>this.addDescription(i);return kr(1,"div",`context-menu-group-entry ${s?"remove-description":"add-description"}`,x(r)?this._translate("Remove cell description"):this._translate("Add cell description"),0,{onClick:a})}}))}addDescription=e=>{this._modeling.updateProperties(e,{description:""});const t=this._renderer.getContainer(),n=YI(t,db(e.id,t).getBoundingClientRect());this._contextMenu.open(n,{contextMenuType:"cell-description",id:e.id,autoFocus:!0,offset:{x:4,y:4}})};removeDescription=e=>{this._modeling.updateProperties(e,{description:null}),this._contextMenu.close()}};function YI(e,t){const{top:n,left:i,width:o,height:r}=t;return{x:i+e.parentNode.scrollLeft-26,y:n+e.parentNode.scrollTop,width:o+52,height:r}}function WI(e){return e&&e.businessObject&&e.businessObject.description}zI.$inject=["components","contextMenu","elementRegistry","eventBus","modeling","renderer","translate"];var HI={__depends__:[P_,Vy],__init__:["description"],description:["type",zI]};let UI=class{constructor(e,t,n,i,o,r){this._modeling=n,this._translate=o,this._expressionLanguages=i,e.onGetComponent("context-menu-cell-additional",((e={})=>{if(e.contextMenuType&&"context-menu"===e.contextMenuType){const{event:n,id:i}=e;if(!i)return;const o=t.get(i);if(!o)return;if(!this._shouldDisplayContextMenuEntry(o))return;const s=e=>{r.open({x:(n||e).pageX,y:(n||e).pageY},{contextMenuType:"expression-language",id:i})};return kr(1,"div","context-menu-group-entry",this._translate("Change cell expression language"),0,{onClick:s})}})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"expression-language"===e.contextMenuType){const{id:n}=e;if(!n)return;const o=t.get(n);if(!o)return;const r=this._getElementExpressionLanguage(o),s=i.getAll(),a="context-menu-group-entry context-menu-entry-set-expression-language",l=this._translate("Expression language");return()=>kr(1,"div","context-menu-flex",kr(1,"div","context-menu-group",kr(1,"div",a,[kr(1,"div",null,l,0),Er(2,aI,{label:l,className:"expression-language",onChange:e=>this.onChange(o,e),options:s,value:r})],4),2),2)}})),e.onGetComponent("context-menu",((e={})=>{if("input-edit"===e.contextMenuType)return()=>{const{inputExpression:t}=e.input;if(!this._shouldDisplayContextMenuEntry(t))return;const n=this._getElementExpressionLanguage(t),o=i.getAll(),r=this._translate("Expression language");return kr(1,"div","context-menu-container ref-language",kr(1,"div","dms-form-control",[kr(1,"label","dms-label",r,0),Er(2,aI,{label:r,className:"ref-language",value:n||"",onChange:e=>this.onChange(t,e),options:o})],4),2)}}))}onChange(e,t){this._modeling.editExpressionLanguage(e,t)}_shouldDisplayContextMenuEntry(e){if(this._expressionLanguages.getAll().length>1)return!0;return this._getElementExpressionLanguage(e)!==this._getDefaultElementExpressionLanguage(e)}_getElementExpressionLanguage(e){return Qt(e).expressionLanguage||this._getDefaultElementExpressionLanguage(e)}_getDefaultElementExpressionLanguage(e){return this._expressionLanguages.getDefault(Lt(e.col)?"inputCell":"outputCell").value}};UI.$inject=["components","elementRegistry","modeling","expressionLanguages","translate","contextMenu"];var GI={__depends__:[ly],__init__:["expressionLanguage"],expressionLanguage:["type",UI]};class ZI extends Bs{constructor(e,t){super(e,t),Dv(this)}componentWillMount(){this.setupChangeListeners({bind:this.getBusinessObject().id})}componentWillUnmount(){this.setupChangeListeners({unbind:this.getBusinessObject().id})}setupChangeListeners({bind:e,unbind:t}){"string"==typeof t&&this.changeSupport.offElementsChanged(t,this.onElementsChanged),"string"==typeof e&&this.changeSupport.onElementsChanged(e,this.onElementsChanged)}getBusinessObject(){return this.sheet.getRoot().businessObject.$parent}onElementsChanged=()=>{this.forceUpdate()};setDecisionTableName=e=>{this.modeling.editDecisionTableName(e)};render(){const e=this.getBusinessObject(),{name:t}=e,n=this.components.getComponent("hit-policy")||JI;return kr(1,"div","decision-table-properties",[Er(2,KI,{label:this.translate("Decision name"),className:"decision-table-name",value:t,ctrlForNewline:!0,onBlur:eQ,onChange:this.setDecisionTableName,elementId:"__decisionProperties_name",coords:"0:__decisionProperties"}),kr(1,"div","decision-table-header-separator"),Er(2,n)],4)}}ZI.$inject=["sheet","modeling","changeSupport","components","translate"];class KI extends Jb{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Iv(this,Qv)}render(){const e=this.props.value;return kr(1,"div",Mv(this.getSelectionClasses(),this.getClassName()),this.getEditor(),0,{"data-element-id":this.props.elementId,"data-coords":this.props.coords,title:this._translate("Decision name: ")+e})}}function JI(){return null}function eQ(e){e.target.scroll(0,0)}class tQ{constructor(e){e.onGetComponent("table.before",500,(()=>ZI))}}tQ.$inject=["components"];var nQ={__depends__:[u_],__init__:["decisionTableProperties"],decisionTableProperties:["type",tQ]};class iQ extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Dv(this)}onChange=({aggregation:e,hitPolicy:t})=>{this.modeling.editHitPolicy(t,e)};onElementsChanged=()=>{this.forceUpdate()};componentDidMount(){this.changeSupport.onElementsChanged(this.getRoot().id,this.onElementsChanged)}componentWillUnmount(){this.changeSupport.offElementsChanged(this.getRoot().id,this.onElementsChanged)}getRoot(){return this.sheet.getRoot()}render(){const e=this.getRoot().businessObject,{aggregation:t,hitPolicy:n}=e,i=w(my,(e=>function(e,t){return e.hitPolicy===t.hitPolicy&&e.aggregation===t.aggregation}(e.value,{aggregation:t,hitPolicy:n})));return kr(1,"div","hit-policy",[kr(1,"label","dms-label",this._translate("Hit policy:"),0),Er(2,aI,{className:"hit-policy-edit-policy-select",label:this._translate("Hit policy"),onChange:this.onChange,options:my.map((e=>({...e,label:this._translate(e.label)}))),value:i.value,"data-hit-policy":"true",noInput:!0})],4,{title:this._translate(i.explanation)})}}function oQ(e){e.onGetComponent("hit-policy",(()=>iQ))}iQ.$inject=["changeSupport","sheet","modeling"],oQ.$inject=["components"];var rQ={__depends__:[P_],__init__:["hitPolicyProvider"],hitPolicyProvider:["type",oQ]};class sQ extends Yd{constructor(e,t){super(e),this.executed(["row.add","row.remove","col.add","col.remove"],aQ((e=>{var t=e.context,n=t.row||t.col;this.updateRoot(n,t.oldRoot)}))),this.reverted(["row.add","row.remove","col.add","col.remove"],aQ((e=>{var t=e.context,n=t.row||t.col;this.updateRoot(n,t.newRoot)})))}updateRoot(e,t){var n=e.root,i=e.businessObject;if(Dt(e,"dmn:DecisionRule")){if(t){let e=t.businessObject.get("rule"),n=e.indexOf(i);e.splice(n,1),i.$parent=null}if(n){let t=n.businessObject,o=n.rows.indexOf(e);t.get("rule").splice(o,0,i),i.$parent=t,e.cells.forEach(((t,n)=>{this.wireCell(t,e,n)}))}}if(Dt(e,"dmn:InputClause")||Dt(e,"dmn:OutputClause")){let o,r;if(t){let n=t.businessObject,s=n.get("input"),a=n.get("output");if(Dt(e,"dmn:InputClause")&&(o=s,r=s.indexOf(i)),Dt(e,"dmn:OutputClause")&&(o=a,r=a.indexOf(i)),-1===r)throw new Error("inconsistent model: clause not in table");o.splice(r,1),i.$parent=null,e.cells.forEach(((e,n)=>{this.unwireCell(e,t.rows[n])}))}if(n){let t,o,r=n.businessObject,s=r.get("input"),a=r.get("output"),l=n.cols.indexOf(e);Dt(e,"dmn:InputClause")&&(o=s,t=l),Dt(e,"dmn:OutputClause")&&(o=a,t=l-s.length),o.splice(t,0,i),i.$parent=r,e.cells.forEach(((e,t)=>{this.wireCell(e,n.rows[t],l)}))}}}unwireCell(e,t){var n=e.businessObject;let i,o,r=t.businessObject,s=r.get("inputEntry"),a=r.get("outputEntry");if(Dt(e,"dmn:UnaryTests")&&(i=s),Dt(e,"dmn:LiteralExpression")&&(i=a),o=i.indexOf(n),-1===o)throw new Error("cell not in row");i.splice(o,1),n.$parent=null}wireCell(e,t,n){var i=e.businessObject;let o,r,s=t.businessObject,a=s.get("inputEntry"),l=s.get("outputEntry");i.$parent!==s&&(Dt(e,"dmn:UnaryTests")&&(o=a,r=n),Dt(e,"dmn:LiteralExpression")&&(o=l,r=n-a.length),o.splice(r,0,i),i.$parent=s)}}function aQ(e){return function(t){var n=t.context;Dt(n.row||n.col,"dmn:DMNElement")&&e(t)}}sQ.$inject=["eventBus","sheet"];let lQ=class{constructor(e){this._model=e}create(e,t={}){var n=this._model.create(e,t||{});return Dt(n,"dmn:InputClause")&&(t.inputExpression?n.inputExpression=t.inputExpression:(n.inputExpression=this.create("dmn:LiteralExpression",{typeRef:"string"}),n.inputExpression.$parent=n)),Dt(n,"dmn:OutputClause")&&(n.typeRef=t.typeRef||"string"),(Dt(n,"dmn:UnaryTests")||Dt(n,"dmn:LiteralExpression"))&&(n.text=t.text||""),this._ensureId(n),n}_needsId(e){return Dt(e,"dmn:DMNElement")}_ensureId(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))}};lQ.$inject=["moddle"];class cQ extends Zm{constructor(e){super(),this._dmnFactory=e}create(e,t){const n=this._dmnFactory;let{businessObject:i,type:o,...r}=t;if(!i){if(!o){if("root"===e)o="dmn:DecisionTable";else if("cell"===e){let{col:e}=r;Dt(e,"dmn:OutputClause")&&(o="dmn:LiteralExpression"),Dt(e,"dmn:InputClause")&&(o="dmn:UnaryTests")}if(!o)throw new Error("cannot guess <type>")}i=n.create(o)}return super.create(e,{businessObject:i,id:i.id,...r})}}cQ.$inject=["dmnFactory"];class uQ{constructor(e,t){this._sheet=e,this._elementFactory=t}execute(e){const t=this._sheet,n=this._elementFactory,i=t.getRoot();let{row:o,index:r}=e;return void 0===r&&(r=e.index=i.rows.length),e.newRoot=i,o.cells.length||i.cols.forEach(((e,t)=>{const i=n.create("cell",{row:o,col:e});o.cells[t]=i})),t.addRow(o,r),t.getRoot()}revert(e){const{row:t}=e,n=this._sheet;return n.removeRow(t),n.getRoot()}}uQ.$inject=["sheet","elementFactory"];class hQ{constructor(e){this._sheet=e}execute(e){const t=this._sheet,n=t.getRoot();let{row:i}=e;const o=e.oldIndex=n.rows.indexOf(i);if(e.oldRoot=i.root,-1===o)throw new Error(`row#${i.id} not in sheet`);return t.removeRow(i),t.getRoot()}revert(e){const{row:t,oldIndex:n}=e,i=this._sheet;return i.addRow(t,n),i.getRoot()}}hQ.$inject=["sheet"];class dQ{constructor(e){this._modeling=e}preExecute(e){let{row:t}=e;this._modeling.removeRow(t)}postExecute(e){let{row:t,index:n}=e;this._modeling.addRow(t,n)}}dQ.$inject=["modeling"];class pQ{constructor(e,t){this._sheet=e,this._elementFactory=t}execute(e){const t=this._sheet,n=this._elementFactory,i=t.getRoot();let{col:o,index:r}=e;return void 0===r&&(r=e.index=i.cols.length),e.newRoot=i,o.cells.length||i.rows.forEach(((e,t)=>{const i=n.create("cell",{row:e,col:o});o.cells[t]=i})),t.addCol(o,r),t.getRoot()}revert(e){const{col:t}=e,n=this._sheet;return n.removeCol(t),n.getRoot()}}pQ.$inject=["sheet","elementFactory"];class fQ{constructor(e,t){this._sheet=e,this._elementFactory=t}execute(e){const t=this._sheet;let{col:n}=e;const i=e.oldRoot=n.root;if(-1===(e.oldIndex=i.cols.indexOf(n)))throw new Error(`col#${n.id} not in sheet`);return t.removeCol(n),t.getRoot()}revert(e){const{col:t,oldIndex:n}=e,i=this._sheet;return i.addCol(t,n),i.getRoot()}}fQ.$inject=["sheet","elementFactory"];class gQ{constructor(e){this._modeling=e}preExecute(e){let{col:t}=e;this._modeling.removeCol(t)}postExecute(e){let{col:t,index:n}=e;this._modeling.addCol(t,n)}}gQ.$inject=["modeling"];class mQ{execute(e){let{cell:t}=e;return t}revert(e){const{cell:t}=e;return t}}let vQ=class e{constructor(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n,e.on("table.init",(()=>{!function(e,t){k(e,(function(e,n){t.registerHandler(n,e)}))}(this.getHandlers(),n)}))}getHandlers(){return e._getHandlers()}static _getHandlers(){return{"row.add":uQ,"row.remove":hQ,"row.move":dQ,"col.add":pQ,"col.remove":fQ,"col.move":gQ,"cell.edit":mQ}}_create(e,t){return t instanceof zm?t:this._elementFactory.create(e,t)}addRow(e,t){const n=this._create("row",e),i={row:n,index:t};return this._commandStack.execute("row.add",i),n}removeRow(e){this._commandStack.execute("row.remove",{row:e})}moveRow(e,t){const n={row:e,index:t};this._commandStack.execute("row.move",n)}addCol(e,t){const n=this._create("col",e),i={col:n,index:t};return this._commandStack.execute("col.add",i),n}removeCol(e){this._commandStack.execute("col.remove",{col:e})}moveCol(e,t){const n={col:e,index:t};this._commandStack.execute("col.move",n)}editCell(e,t){const n={cell:e,...t};this._commandStack.execute("cell.edit",n)}};vQ.$inject=["eventBus","elementFactory","commandStack"];class yQ{constructor(e,t,n){this._dmnFactory=e,this._moddle=t,this._modeling=n}execute(e){const{element:t,allowedValues:n}=e;return Dt(t,"dmn:InputClause")?(t.inputValues?e.oldAllowedValues=t.inputValues.text:bQ(n)||(t.inputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),bQ(n)?t.inputValues&&delete t.inputValues:t.inputValues.text=n.join(",")):(t.outputValues&&t?e.oldAllowedValues=t.outputValues.text:bQ(n)||(t.outputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),bQ(n)?t.outputValues&&delete t.outputValues:t.outputValues.text=n.join(",")),t}revert(e){const{element:t,oldAllowedValues:n}=e;return Dt(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}}function bQ(e){return null===e}yQ.$inject=["dmnFactory","moddle","modeling"];const _Q="id";class xQ{constructor(e,t){this._elementRegistry=e,this._moddle=t}execute(e){const{element:t,properties:n}=e,i=Qt(t),{changed:o,oldProperties:r}=this.updateProperties(i,n);return e.oldProperties=r,[...o,t]}revert(e){const{element:t,oldProperties:n}=e;var i=Qt(t),{changed:o}=this.updateProperties(i,n);return[...o,t]}updateProperties(e,t){const n=this._moddle.ids;return E(t,((t,i,o)=>{const r=e.get(o);if(OQ(i)){if(!OQ(r))throw new Error(`non-existing property <${o}>: cannot update values`);let{changed:e,oldProperties:n}=this.updateProperties(r,i);return{changed:[...t.changed,...e,r],oldProperties:{...t.oldProperties,[o]:n}}}var s;return o===_Q&&(s=i,e[_Q]!==s)&&(n.unclaim(e[_Q]),this._elementRegistry.updateId(e,i),n.claim(i,e)),e.set(o,i),{changed:t.changed,oldProperties:{...t.oldProperties,[o]:r}}}),{changed:[],oldProperties:{}})}}function OQ(e){return g(e)&&y(e)}xQ.$inject=["elementRegistry","moddle"];class wQ{constructor(e){this._moddle=e}execute(e){const t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)}revert(e){const t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)}}wQ.$inject=["moddle"];let CQ=class e extends vQ{constructor(e,t,n,i){super(e,t,n),this._eventBus=e,this._elementFactory=t,this._commandStack=n,this._sheet=i}getHandlers(){return e._getHandlers()}static _getHandlers(){return F({},super._getHandlers(),{editAllowedValues:yQ,"element.updateProperties":xQ,"id.updateClaim":wQ})}editDecisionTableName(e){const t={element:this._sheet.getRoot().businessObject.$parent,properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}editDecisionTableId(e){const t={element:this._sheet.getRoot().businessObject.$parent,properties:{id:e}};this._commandStack.execute("element.updateProperties",t)}editHitPolicy(e,t){const n={element:this._sheet.getRoot().businessObject,properties:{hitPolicy:e,aggregation:t}};this._commandStack.execute("element.updateProperties",n)}updateProperties(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}editInputExpression(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}editOutputName(e,t){const n={element:e,properties:{name:t}};this._commandStack.execute("element.updateProperties",n)}editInputExpressionTypeRef(e,t){const n={element:e,properties:{typeRef:t}};this._commandStack.execute("element.updateProperties",n)}editOutputTypeRef(e,t){const n={element:e,properties:{typeRef:t}};this._commandStack.execute("element.updateProperties",n)}editCell(e,t){const n={element:e,properties:{text:t}};this._commandStack.execute("element.updateProperties",n)}editAnnotation(e,t){const n={element:e,properties:{description:t}};this._commandStack.execute("element.updateProperties",n)}editAllowedValues(e,t){const n={element:e,allowedValues:t};this._commandStack.execute("editAllowedValues",n)}editExpressionLanguage(e,t){const n={element:e,properties:{expressionLanguage:t}};this._commandStack.execute("element.updateProperties",n)}claimId(e,t){const n={id:e,element:t,claiming:!0};this._commandStack.execute("id.updateClaim",n)}unclaimId(e,t){const n={id:e,element:t};this._commandStack.execute("id.updateClaim",n)}};CQ.$inject=["eventBus","elementFactory","commandStack","sheet"];class kQ extends Yd{constructor(e,t,n){super(e),this._ids=t.ids,this._modeling=n,this.preExecute(["row.add","col.add"],(e=>{const t=e.context,n=t.row||t.col;this.claimId(n.businessObject),n.cells&&n.cells.forEach((e=>this.claimId(e.businessObject)))}))}claimId(e){e.id&&!this._ids.assigned(e.id)&&this._modeling.claimId(e.id,e),e.$descriptor.properties.forEach((t=>{const n=e[t.name];n&&(v(n)&&n.forEach((e=>this.claimId(e))),n.$type&&this.claimId(n))}))}}kQ.$inject=["eventBus","moddle","modeling"];class EQ extends Yd{constructor(e,t){super(e),this._modeling=t,this.preExecute(["row.remove","col.remove"],(e=>{const t=e.context,n=t.row||t.col;this.unclaimId(n.businessObject),n.cells&&n.cells.forEach((e=>this.unclaimId(e.businessObject)))}))}unclaimId(e){e.id&&this._modeling.unclaimId(e.id,e),e.$descriptor.properties.forEach((t=>{const n=e[t.name];n&&(v(n)&&n.forEach((e=>this.unclaimId(e))),n.$type&&this.unclaimId(n))}))}}EQ.$inject=["eventBus","modeling"];var SQ={__init__:["dmnUpdater","idChangeBehavior","nameChangeBehavior","modeling"],__depends__:[{__init__:["idClaimBehavior","idUnclaimBehavior"],idClaimBehavior:["type",kQ],idUnclaimBehavior:["type",EQ]},mp],dmnUpdater:["type",sQ],dmnFactory:["type",lQ],elementFactory:["type",cQ],idChangeBehavior:["type",Hp],nameChangeBehavior:["type",Up],modeling:["type",CQ]};class $Q extends Bs{constructor(e,t){super(e,t),this.changeCellValue=this.changeCellValue.bind(this),this.onElementsChanged=this.onElementsChanged.bind(this)}onElementsChanged(){this.forceUpdate()}componentWillMount(){const{injector:e}=this.context,{cell:t}=this.props,n=this._changeSupport=this.context.changeSupport;this._modeling=e.get("modeling"),n.onElementsChanged(t.id,this.onElementsChanged)}componentWillUnmount(){const{cell:e}=this.props;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}changeCellValue(e){const{cell:t}=this.props;this._modeling.editCell(t.businessObject,e)}render(){const{cell:e,rowIndex:t,row:n,col:i,colIndex:o}=this.props,r=Dt(e,"dmn:UnaryTests"),s=e.businessObject;return Er(2,Bv,{className:r?"input-cell":"output-cell",elementId:e.id,coords:`${t}:${o}`,"data-row-id":n.id,"data-col-id":i.id,children:Er(2,TQ,{placeholder:r?"-":"",onChange:this.changeCellValue,value:s.text,businessObject:s})})}}let PQ=class extends Bs{constructor(e,t){super(e,t),this.state={focussed:!1},this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}onFocus(){this.setState({focussed:!0})}onBlur(){this.setState({focussed:!1})}render(){const{focussed:e}=this.state;return kr(1,"div","feel-editor"+(e?" focussed":""),[e&&$r(Er(2,nI,{...this.props,autoFocus:!0,onBlur:this.onBlur})),$r(Er(2,Zb,{...this.props,onInput:()=>{},onFocus:this.onFocus}))],0,{onClick:this.onFocus})}};class TQ extends Bs{constructor(e,t){super(e,t),this._expressionLanguages=t.injector.get("expressionLanguages"),this._translate=t.injector.get("translate"),this._variableResolver=t.injector.get("variableResolver",!1)}isDefaultExpressionLanguage(e){const{expressionLanguage:t}=e,n=this.getDefaultExpressionLanguage().value;return!t||t===n}getDescription(e){return e.description}getExpressionLanguageLabel(e){const{expressionLanguage:t}=e,n=this.getDefaultExpressionLanguage();return this._expressionLanguages.getLabel(t)||n.label}isScript(){const{businessObject:e}=this.props,t=this.getDefaultExpressionLanguage();return!!this._isInputCell()&&(-1!==e.text.indexOf("\n")||e.expressionLanguage&&e.expressionLanguage!==t)}_isInputCell(){return Dt(this.props.businessObject,"dmn:UnaryTests")}getDefaultExpressionLanguage(){const e=this._isInputCell()?"inputCell":"outputCell";return this._expressionLanguages.getDefault(e)}getEditor(){return this.isFEEL()?PQ:Zb}isFEEL(){return"feel"===this.getExpressionLanguage()}getExpressionLanguage(){const{businessObject:e}=this.props;return e.expressionLanguage||this.getDefaultExpressionLanguage().value}_getVariables(){const{businessObject:e}=this.props;return this._variableResolver&&this._variableResolver.getVariables(e)}_getLabel(){return this._isInputCell()?this._translate("Input"):this._translate("Output")}render(){const{businessObject:e,placeholder:t,value:n,onChange:i}=this.props,o=this.getDescription(e),r=this.isDefaultExpressionLanguage(e),s=this.getExpressionLanguageLabel(e),a=this.isScript(),l=this.getEditor(),c=this._getVariables();return kr(1,"div","cell-editor",[x(o)&&kr(1,"div","description-indicator"),Er(2,l,{label:this._getLabel(),className:a?"script-editor":"",ctrlForNewline:!0,onInput:i,value:n,placeholder:t,variables:c,feelLanguageDialect:"unaryTests"}),!r&&kr(1,"span","dms-badge dmn-expression-language",[kr(1,"span","dms-badge-icon dmn-icon-file-code"),kr(1,"span","dms-badge-label",s,0)],4,{title:this._translate("Expression language: {expressionLanguageLabel}",{expressionLanguageLabel:s})})],0)}}class RQ{constructor(e){e.onGetComponent("cell",1500,(({cellType:e})=>{if("rule"===e)return $Q}))}}RQ.$inject=["components"];var AQ={__depends__:[u_,gy],__init__:["decisionRulesEditor"],decisionRulesEditor:["type",RQ]};class MQ extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this.state={top:0,left:0,isVisible:!1,isDisabled:!1,selection:null},Dv(this);const{debounceInput:n}=this;this.onClick=this.onClick.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.hideAndShowDebounced=this.hideAndShowDebounced.bind(this),this.showDebounced=n(this.showDebounced.bind(this)),this.updatePosition=this.updatePosition.bind(this)}componentDidMount(){const{eventBus:e}=this;e.on("cellSelection.changed",this.handleSelectionChanged),e.on("commandStack.changed",this.updatePosition),e.on("sheet.scroll",this.hideAndShowDebounced)}componentWillUnmount(){const{eventBus:e}=this;e.off("cellSelection.changed",this.handleSelectionChanged),e.off("commandStack.changed",this.updatePosition),e.off("sheet.scroll",this.hideAndShowDebounced)}hideAndShowDebounced(){this.state.isVisible&&(this.hide(),this.showDebounced())}showDebounced(){this.show()}hide(e={}){this.setState({...e,isVisible:!1})}show(e={}){this.setState({...e,isVisible:!0}),this.updatePosition()}handleSelectionChanged({elementId:e}){const{elementRegistry:t,expressionLanguages:n,simpleMode:i}=this,o=t.get(e);if(!o||!i.canSimpleEdit(o))return void this.hide({isDisabled:!1,selection:null});const r=!function(e,t,n){return!t||t===function(e,t){if(Lt(e.col))return t.getDefault("inputCell").value;if(It(e.col))return t.getDefault("outputCell").value}(e,n)}(o,o.businessObject.expressionLanguage,n);this.show({isDisabled:r,selection:o})}updatePosition(){const{selection:e}=this.state,{node:t}=this;if(!e||!t)return;const{renderer:n}=this,i=n.getContainer(),o=i.getBoundingClientRect(),r=db(e.id,i).getBoundingClientRect(),s=this.node.getBoundingClientRect(),{scrollLeft:a,scrollTop:l}=function(e){const t=mv(e,".tjs-table-container");if(!t)return{scrollTop:0,scrollLeft:0};const{scrollLeft:n,scrollTop:i}=t;return{scrollTop:i,scrollLeft:n}}(t),c={};r.left+r.width/2>o.width/2?c.left=-o.left+r.left-s.width+4+a+"px":c.left=-o.left+r.left+r.width-4+a+"px",r.top+r.height/2>o.height/2?c.top=-o.top+r.top-s.height+4+l+"px":c.top=-o.top+r.top-4+l+"px",F(this.node.style,c)}onClick(){const{eventBus:e}=this,{isDisabled:t}=this.state;if(t)return;const{selection:n}=this,i=n.get();i&&(e.fire("simpleMode.open",{element:i,node:db(i.id,this._container)}),this.hide())}render(){const{isDisabled:e,isVisible:t,top:n,left:i}=this.state,o=["simple-mode-button","no-deselect"];return e&&o.push("disabled"),t?kr(1,"div",o.join(" "),kr(1,"span","dmn-icon-edit"),2,{onClick:this.onClick,style:{top:n,left:i},title:e?this._translate("Editing not supported for set expression language"):this._translate("Edit")},null,(e=>this.node=e)):null}}MQ.$inject=["debounceInput","elementRegistry","eventBus","expressionLanguages","renderer","selection","simpleMode"];class DQ{constructor(e,t,n,i,o){this._providers=[],e.onGetComponent("table.before",(()=>MQ)),i.on("simpleMode.open",(({element:e,node:n})=>{const{left:i,top:r,width:s,height:a}=n.getBoundingClientRect(),l=o.getContainer();t.open({x:i+l.parentNode.scrollLeft,y:r+l.parentNode.scrollTop,width:s,height:a},{contextMenuType:"simple-mode-edit",element:e,offset:{x:4,y:4}})})),i.on("cell.click",(e=>{const{event:t,node:o,id:r}=e;if(function(e){if(e.altKey)return!1;return e.ctrlKey||e.metaKey}(t)){const t=n.get(r);t&&i.fire("simpleMode.open",{node:o,element:t}),e.preventDefault()}}))}registerProvider(e){this._providers.push(e)}canSimpleEdit(e){return this._providers.reduce(((t,n)=>t||n(e)),!1)}}DQ.$inject=["components","contextMenu","elementRegistry","eventBus","renderer"];var LQ={__depends__:[P_,vb,ly],__init__:["simpleMode"],simpleMode:["type",DQ]};const IQ="none";class QQ extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=function(e){return!e||function(e){return""===e}(e)?"none":"true"===e.trim()?"true":"false"===e.trim()?"false":void 0}(n.businessObject.text);this.state={value:i||IQ},this.editCell=this.editCell.bind(this),this.onChange=this.onChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onChange(e){const{element:t}=this.props.context;this.editCell(t.businessObject,e===IQ?"":e),this.setState({value:e})}render(){const{value:e}=this.state,t=[{label:"-",value:IQ},{label:this._translate("Yes"),value:"true"},{label:this._translate("No"),value:"false"}];return kr(1,"div","simple-boolean-edit context-menu-container",[kr(1,"h3","dms-heading",this._translate("Edit boolean"),0),kr(1,"h4","dms-heading",this._translate("Set value"),0),Er(2,aI,{label:this._translate("Boolean value"),noInput:!0,className:"dms-block",onChange:this.onChange,options:t,value:e})],4)}}class jQ{constructor(e,t){t.registerProvider((e=>(Lt(e.col)||It(e.col))&&"boolean"===BQ(e))),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if("boolean"===BQ(e.element))return QQ}}))}}function BQ(e){return Lt(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}jQ.$inject=["components","simpleMode"];var NQ={__depends__:[SI,LQ],__init__:["simpleBooleanEdit"],simpleBooleanEdit:["type",jQ]};const qQ=/^\d{4}(?:-\d\d){2}$/,FQ=/^\[date\("([^"]*)"\)..date\("([^"]*)"\)\]$/,VQ=/^(<|>)\s*date\("([^"]*)"\)$/,XQ=/^date\("([^"]*)"\)$/;function zQ(e){if(!qQ.test(e.trim()))return"Date must match pattern yyyy-MM-dd"}function YQ(e,t){return"exact"===e?`date("${t[0]}")`:"before"===e?`< date("${t[0]}")`:"after"===e?`> date("${t[0]}")`:"between"===e?`[date("${t[0]}")..date("${t[1]}")]`:void 0}function WQ(){const e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().slice(0,10)}function HQ(e){if(!e||""===e.trim())return{type:"exact",date:""};let t=e.match(FQ);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(VQ),t?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(XQ),t?{type:"exact",date:t[1]}:void 0))}const UQ="exact",GQ="between";let ZQ=class extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=HQ(n.businessObject.text);if(i){let e;e=i.date?[i.date,""]:i.dates?i.dates:["",""],this.state={type:i.type,dates:e}}else this.state={type:UQ,dates:["",""]};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onSetStartDateTodayClick=this.onSetStartDateTodayClick.bind(this),this.onSetEndDateTodayClick=this.onSetEndDateTodayClick.bind(this),this.onStartDateInput=this.onStartDateInput.bind(this),this.onEndDateInput=this.onEndDateInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{dates:n}=this.state;this.setState({type:e}),HQ(YQ(e,n))&&this.editCell(t.businessObject,YQ(e,n))}onSetStartDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=WQ();this.setState({dates:[i,t[1]]}),HQ(YQ(n,[i,t[1]]))&&this.editCell(e.businessObject,YQ(n,[i,t[1]]))}onSetEndDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=WQ();this.setState({dates:[t[0],i]}),HQ(YQ(n,[t[0],i]))&&this.editCell(e.businessObject,YQ(n,[t[0],i]))}onStartDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[e,n[1]]}),this.debouncedEditCell(t.businessObject,YQ(i,[e,n[1]]))}onEndDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[n[0],e]}),this.debouncedEditCell(t.businessObject,YQ(i,[n[0],e]))}render(){const{dates:e,type:t}=this.state,n=[{label:this._translate("Exactly"),value:UQ},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:GQ}];return kr(1,"div","context-menu-container simple-date-edit",[kr(1,"h3","dms-heading",this._translate("Edit date"),0),kr(1,"div","dms-fill-row",Er(2,aI,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:n,value:t}),2),kr(1,"h4","dms-heading",t===GQ?this._translate("Edit start date"):this._translate("Set date"),0),kr(1,"div",null,[Er(2,fI,{label:t===GQ?this._translate("Start date"):this._translate("Date"),className:"start-date-input dms-block",onInput:this.onStartDateInput,placeholder:this._translate("e.g. { sample }",{sample:WQ()}),validate:e=>zQ(e)&&this._translate(zQ(e)),value:e[0]}),kr(1,"p","dms-hint",[kr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetStartDateTodayClick}),Sr(".")],4)],4),t===GQ&&kr(1,"h4","dms-heading",this._translate("Edit end date"),0),t===GQ&&kr(1,"div",null,[Er(2,fI,{label:this._translate("End date"),className:"end-date-input dms-block",onInput:this.onEndDateInput,placeholder:this._translate("e.g. { sample }",{sample:WQ()}),validate:e=>zQ(e)&&this._translate(zQ(e)),value:e[1]}),kr(1,"p","dms-hint",[kr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetEndDateTodayClick}),Sr(".")],4)],4)],0)}},KQ=class extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=HQ(n.businessObject.text);this.state={date:i?i.date:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onClick=this.onClick.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onClick(){const{element:e}=this.props.context,t=WQ();this.setState({date:t}),this.editCell(e.businessObject,`date("${t}")`)}onInput({value:e}){const{element:t}=this.props.context;this.setState({date:e}),this.debouncedEditCell(t.businessObject,`date("${e}")`)}render(){const{date:e}=this.state;return kr(1,"div","context-menu-container simple-date-edit",[kr(1,"h3","dms-heading",this._translate("Edit date"),0),kr(1,"h4","dms-heading",this._translate("Set date"),0),kr(1,"div",null,[Er(2,fI,{label:this._translate("Date value"),onInput:this.onInput,placeholder:this._translate("e.g. { example } ",{example:WQ()}),validate:e=>zQ(e)&&this._translate(zQ(e)),value:e,className:"dms-block"}),kr(1,"p","dms-hint",kr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onClick}),2)],4)],4)}},JQ=class{constructor(e,t){t.registerProvider((e=>{const t=ej(e);return(Lt(e.col)||It(e.col))&&tj(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(tj(ej(e.element))){if(Lt(e.element.col))return ZQ;if(It(e.element.col))return KQ}}}))}};function ej(e){return Lt(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function tj(e){return"date"===e}JQ.$inject=["components","simpleMode"];var nj={__depends__:[SI,LQ],__init__:["simpleDateEdit"],simpleDateEdit:["type",JQ]};const ij=/^\d{4}(?:-\d\d){2}T(?:\d\d:){2}\d\d(?:Z|(?:[@+-][^")]+))?$/,oj=/^\[date and time\("([^"]*)"\)..date and time\("([^"]*)"\)\]$/,rj=/^(<|>)\s*date and time\("([^"]*)"\)$/,sj=/^date and time\("([^"]*)"\)$/;function aj(e){if(!ij.test(e.trim()))return"Date and time must match pattern yyyy-MM-ddTHH:mm:ss[time zone]"}function lj(e,t){return"exact"===e?`date and time("${t[0]}")`:"before"===e?`< date and time("${t[0]}")`:"after"===e?`> date and time("${t[0]}")`:"between"===e?`[date and time("${t[0]}")..date and time("${t[1]}")]`:void 0}function cj(){const e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().replace(".000Z","Z")}function uj(e){if(!e||""===e.trim())return{type:"exact",date:""};let t=e.match(oj);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(rj),t?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(sj),t?{type:"exact",date:t[1]}:void 0))}const hj="exact",dj="between";class pj extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=uj(n.businessObject.text);if(i){let e;e=i.date?[i.date,""]:i.dates?i.dates:["",""],this.state={type:i.type,dates:e}}else this.state={type:hj,dates:["",""]};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onSetStartDateTodayClick=this.onSetStartDateTodayClick.bind(this),this.onSetEndDateTodayClick=this.onSetEndDateTodayClick.bind(this),this.onStartDateInput=this.onStartDateInput.bind(this),this.onEndDateInput=this.onEndDateInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{dates:n}=this.state;this.setState({type:e}),uj(lj(e,n))&&this.editCell(t.businessObject,lj(e,n))}onSetStartDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=cj();this.setState({dates:[i,t[1]]}),uj(lj(n,[i,t[1]]))&&this.editCell(e.businessObject,lj(n,[i,t[1]]))}onSetEndDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=cj();this.setState({dates:[t[0],i]}),uj(lj(n,[t[0],i]))&&this.editCell(e.businessObject,lj(n,[t[0],i]))}onStartDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[e,n[1]]}),this.debouncedEditCell(t.businessObject,lj(i,[e,n[1]]))}onEndDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[n[0],e]}),this.debouncedEditCell(t.businessObject,lj(i,[n[0],e]))}render(){const{dates:e,type:t}=this.state,n=[{label:this._translate("Exactly"),value:hj},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:dj}];return kr(1,"div","context-menu-container simple-date-edit",[kr(1,"h3","dms-heading",this._translate("Edit date and time"),0),kr(1,"div","dms-fill-row",Er(2,aI,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:n,value:t}),2),kr(1,"h4","dms-heading",t===dj?this._translate("Edit start date and time"):this._translate("Set date and time"),0),kr(1,"div",null,[Er(2,fI,{label:t===dj?this._translate("Start date and time"):this._translate("Date and time"),className:"start-date-input dms-block",onInput:this.onStartDateInput,placeholder:this._translate("e.g. { sample }",{sample:cj()}),validate:e=>aj(e)&&this._translate(aj(e)),value:e[0]}),kr(1,"p","dms-hint",kr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetStartDateTodayClick}),2)],4),t===dj&&kr(1,"h4","dms-heading",this._translate("Edit end date and time"),0),t===dj&&kr(1,"div",null,[Er(2,fI,{label:this._translate("End date and time"),className:"end-date-input dms-block",onInput:this.onEndDateInput,placeholder:this._translate("e.g. { sample }",{sample:cj()}),validate:e=>aj(e)&&this._translate(aj(e)),value:e[1]}),kr(1,"p","dms-hint",kr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetEndDateTodayClick}),2)],4)],0)}}class fj extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=uj(n.businessObject.text);this.state={date:i?i.date:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onClick=this.onClick.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onClick(){const{element:e}=this.props.context,t=cj();this.setState({date:t}),this.editCell(e.businessObject,`date and time("${t}")`)}onInput({value:e}){const{element:t}=this.props.context;this.setState({date:e}),this.debouncedEditCell(t.businessObject,`date and time("${e}")`)}render(){const{date:e}=this.state;return kr(1,"div","context-menu-container simple-date-edit",[kr(1,"h3","dms-heading",this._translate("Edit date and time"),0),kr(1,"h4","dms-heading",this._translate("Set date and time"),0),kr(1,"div",null,[Er(2,fI,{label:this._translate("Date and time value"),onInput:this.onInput,placeholder:this._translate("e.g. { sample }",{sample:cj()}),validate:e=>aj(e)&&this._translate(aj(e)),value:e,className:"dms-block"}),kr(1,"p","dms-hint",kr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onClick}),2)],4)],4)}}let gj=class{constructor(e,t){t.registerProvider((e=>{const t=mj(e);return(Lt(e.col)||It(e.col))&&vj(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(vj(mj(e.element))){if(Lt(e.element.col))return pj;if(It(e.element.col))return fj}}}))}};function mj(e){return Lt(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function vj(e){return"dateTime"===e}gj.$inject=["components","simpleMode"];var yj={__depends__:[SI,LQ],__init__:["simpleDateTimeEdit"],simpleDateTimeEdit:["type",gj]};const bj={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function _j(e){return T(bj).filter((t=>e===bj[t]))[0]}function xj(e){if(!e||function(e){return""===e}(e.trim()))return{type:"comparison",values:[]};const t=function(e){const t=Cj(e);if(t)return{type:"comparison",operator:"equals",values:[t]};const{operator:n,value:i}=kj(/^(?<operator>=|(:?<|>)=?)\s*duration\("(?<value>[^"]*)"\)$/,e);if(n&&i)return{type:"comparison",values:[i],operator:_j(n)}}(e);if(t)return t;const n=function(e){const{start:t,end:n,firstValue:i,secondValue:o}=kj(/^(?<start>[[\]])duration\("(?<firstValue>[^"]*)"\)\.\.duration\("(?<secondValue>[^"]*)"\)(?<end>[[\]])$/,e);if(t&&n)return{type:"range",values:[i,o],start:"]"===t?"exclude":"include",end:"["===n?"exclude":"include"}}(e);return n||void 0}function Oj(e,t){return"equals"===e?`duration("${t}")`:`${bj[e]} duration("${t}")`}function wj(e,t,n,i){return`${"exclude"===n?"]":"["}duration("${e}")..duration("${t}")${"exclude"===i?"[":"]"}`}function Cj(e){const t=/^duration\("([^"]*)"\)$/.exec(e);return t&&t[1]}function kj(e,t){const{groups:n}=e.exec(t)||{groups:{}};return n}const Ej={yearMonthDuration:"Must match PnYnM",dayTimeDuration:"Must match PnDTnH"};class Sj extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._type=e.type,this.onInput=this.onInput.bind(this),this.validate=this.validate.bind(this),this.state={value:e.value}}onInput({value:e}){this.setState({value:e}),this.props.onInput(e)}validate(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(Ej[this._type])}_getPlaceholder(){if("yearMonthDuration"===this._type)return this._translate("e.g. { sample }",{sample:"P1Y2M"});"dayTimeDuration"===this._type&&this._translate("e.g. { sample }",{sample:"P1DT2H"})}render(){return Er(2,fI,{label:this.props.label,type:"text",onInput:this.onInput,placeholder:this._getPlaceholder(),validate:this.validate,value:this.state.value,className:this.props.className})}}const $j="comparison",Pj="range";class Tj extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context;this._type=function(e){return e.col.businessObject.inputExpression.typeRef}(n);const i=xj(n.businessObject.text,this._type);this.state=i?{type:i.type,comparisonOperator:i.operator||"equals",startValue:i.values[0]||"",endValue:i.values[1]||"",rangeStartType:i.start||"include",rangeEndType:i.end||"include"}:{type:$j,comparisonOperator:"equals",startValue:"",endValue:"",rangeStartType:"include",rangeEndType:"include"};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onComparisonOperatorChange=this.onComparisonOperatorChange.bind(this),this.onComparisonValueChange=this.onComparisonValueChange.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onRangeStartTypeChange=this.onRangeStartTypeChange.bind(this),this.onRangeStartValueChange=this.onRangeStartValueChange.bind(this),this.onRangeEndTypeChange=this.onRangeEndTypeChange.bind(this),this.onRangeEndValueChange=this.onRangeEndValueChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{comparisonOperator:n,startValue:i,endValue:o,rangeStartType:r,rangeEndType:s}=this.state;e===$j?this.editCell(t.businessObject,Oj(n,i)):this.editCell(t.businessObject,wj(i,o,r,s)),this.setState({type:e})}onComparisonOperatorChange(e){const{element:t}=this.props.context,{type:n,startValue:i}=this.state;n===$j&&(this.editCell(t.businessObject,Oj(e,i)),this.setState({comparisonOperator:e}))}onComparisonValueChange(e){const{element:t}=this.props.context,{type:n,comparisonOperator:i}=this.state;n===$j&&(this.debouncedEditCell(t.businessObject,Oj(i,e)),this.setState({startValue:e}))}onRangeStartTypeChange(e){const{element:t}=this.props.context,{type:n,startValue:i,endValue:o,rangeEndType:r}=this.state;n===Pj&&(this.editCell(t.businessObject,wj(i,o,e,r)),this.setState({rangeStartType:e}))}onRangeStartValueChange(e){const{element:t}=this.props.context,{type:n,endValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===Pj&&(this.editCell(t.businessObject,wj(e,i,o,r)),this.setState({startValue:e}))}onRangeEndTypeChange(e){const{element:t}=this.props.context,{type:n,startValue:i,endValue:o,rangeStartType:r}=this.state;n===Pj&&(this.editCell(t.businessObject,wj(i,o,r,e)),this.setState({rangeEndType:e}))}onRangeEndValueChange(e){const{element:t}=this.props.context,{type:n,startValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===Pj&&(this.editCell(t.businessObject,wj(i,e,o,r)),this.setState({endValue:e}))}renderComparison(e,t){const 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 kr(1,"div","comparison",[kr(1,"h4","dms-heading",Sr("Value"),2),kr(1,"div","dms-fill-row dms-input-duration-edit-row",[Er(2,aI,{label:this._translate("Comparison operator"),noInput:!0,onChange:this.onComparisonOperatorChange,options:n,value:e}),Sr(" "),Er(2,Sj,{label:this._translate("Duration value"),type:this._type,className:"comparison-duration-input",onInput:this.onComparisonValueChange,value:t})],4)],4)}renderRange(e,t,n,i){const o=[{label:this._translate("Include"),value:"include"},{label:this._translate("Exclude"),value:"exclude"}];return kr(1,"div","range",[kr(1,"h4","dms-heading",this._translate("Start value"),0),kr(1,"div","dms-fill-row dms-input-duration-edit-row",[Er(2,aI,{label:this._translate("Range start operator"),noInput:!0,onChange:this.onRangeStartTypeChange,options:o,value:n}),Sr(" "),Er(2,Sj,{label:this._translate("Range start value"),type:this._type,className:"range-start-duration-input",onInput:this.onRangeStartValueChange,value:e})],4),kr(1,"h4","dms-heading",this._translate("End value"),0),kr(1,"div","dms-fill-row dms-input-duration-edit-row",[Er(2,aI,{label:this._translate("Range end operator"),noInput:!0,onChange:this.onRangeEndTypeChange,options:o,value:i}),Sr(" "),Er(2,Sj,{label:this._translate("Range end value"),type:this._type,className:"range-end-duration-input",onInput:this.onRangeEndValueChange,value:t})],4)],4)}render(){const{type:e,comparisonOperator:t,startValue:n,endValue:i,rangeStartType:o,rangeEndType:r}=this.state,s=[{label:this._translate("Comparison"),value:$j},{label:this._translate("Range"),value:Pj}];return kr(1,"div","context-menu-container simple-duration-edit",[kr(1,"h3","dms-heading",this._translate("Edit duration"),0),kr(1,"div","dms-fill-row",Er(2,aI,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:s,value:e}),2),e===$j&&this.renderComparison(t,n),e===Pj&&this.renderRange(n,i,o,r)],0)}}class Rj extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context;this._type=function(e){return e.col.businessObject.typeRef}(n);const i=t.injector.get("debounceInput");this.debouncedEditCell=i(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onInput(e){const{element:t}=this.props.context;this.debouncedEditCell(t.businessObject,`duration("${e}")`)}render(){const e=Cj(this.props.context.element.businessObject.text,this._type);return kr(1,"div","context-menu-container simple-duration-edit",[kr(1,"h3","dms-heading",this._translate("Edit duration"),0),kr(1,"h4","dms-heading",this._translate("Set duration"),0),Er(2,Sj,{label:this._translate("Duration value"),onInput:this.onInput,value:e,type:this._type,className:"dms-block"})],4)}}class Aj{constructor(e,t){t.registerProvider((e=>{const t=Mj(e);return(Lt(e.col)||It(e.col))&&Lj(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(Lj(Mj(e.element))){if(Lt(e.element.col))return Tj;if(It(e.element.col))return Rj}}}))}}function Mj(e){return Lt(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}Aj.$inject=["components","simpleMode"];const Dj=["yearMonthDuration","dayTimeDuration"];function Lj(e){return Dj.includes(e)}var Ij={__depends__:[SI,LQ],__init__:["simpleDurationEdit"],simpleDurationEdit:["type",Aj]};const Qj=/^(-?(?:[0-9]|\.[0-9])+)$|^((?:<|>|=){0,2})\s*(-?(?:[0-9]|\.[0-9])+)$/,jj=/^(\[|\]){1}(-?(?:[0-9]|\.[0-9])+){1,}\.\.(-?(?:[0-9]|\.[0-9])+){1,}(\[|\]){1}$/,Bj={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function Nj(e){return T(Bj).filter((t=>e===Bj[t]))[0]}function qj(e){if(!e||function(e){return""===e}(e.trim()))return{type:"comparison"};const t=e.match(Qj),n=e.match(jj);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:Nj(t[2])}}else if(n)return{type:"range",values:[n[2],n[3]].map((e=>parseFloat(e))),start:"]"===n[1]?"exclude":"include",end:"["===n[4]?"exclude":"include"}}function Fj(e,t){return"equals"===e?`${t}`:`${Bj[e]} ${t}`}function Vj(e,t,n,i){return`${"exclude"===n?"]":"["}${e}..${t}${"exclude"===i?"[":"]"}`}const Xj="comparison",zj="range";class Yj extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=qj(n.businessObject.text);this.state=i?{type:i.type,comparisonOperator:i.operator||"equals",comparisonValue:i.value||0,rangeStartValue:i.values?i.values[0]:0,rangeEndValue:i.values?i.values[1]:0,rangeStartType:i.start||"include",rangeEndType:i.end||"include"}:{type:Xj,comparisonOperator:"equals",comparisonValue:0,rangeStartValue:0,rangeEndValue:0,rangeStartType:"include",rangeEndType:"include"};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onComparisonOperatorChange=this.onComparisonOperatorChange.bind(this),this.onComparisonValueChange=this.onComparisonValueChange.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onRangeStartTypeChange=this.onRangeStartTypeChange.bind(this),this.onRangeStartValueChange=this.onRangeStartValueChange.bind(this),this.onRangeEndTypeChange=this.onRangeEndTypeChange.bind(this),this.onRangeEndValueChange=this.onRangeEndValueChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{comparisonOperator:n,comparisonValue:i,rangeStartValue:o,rangeEndValue:r,rangeStartType:s,rangeEndType:a}=this.state;e===Xj?this.editCell(t.businessObject,Fj(n,i)):this.editCell(t.businessObject,Vj(o,r,s,a)),this.setState({type:e})}onComparisonOperatorChange(e){const{element:t}=this.props.context,{type:n,comparisonValue:i}=this.state;n===Xj&&(this.editCell(t.businessObject,Fj(e,i)),this.setState({comparisonOperator:e}))}onComparisonValueChange(e){const{element:t}=this.props.context,{type:n,comparisonOperator:i}=this.state;n===Xj&&(this.debouncedEditCell(t.businessObject,Fj(i,e)),this.setState({comparisonValue:e}))}onRangeStartTypeChange(e){const{element:t}=this.props.context,{type:n,rangeStartValue:i,rangeEndValue:o,rangeEndType:r}=this.state;n===zj&&(this.editCell(t.businessObject,Vj(i,o,e,r)),this.setState({rangeStartType:e}))}onRangeStartValueChange(e){const{element:t}=this.props.context,{type:n,rangeEndValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===zj&&(this.editCell(t.businessObject,Vj(e,i,o,r)),this.setState({rangeStartValue:e}))}onRangeEndTypeChange(e){const{element:t}=this.props.context,{type:n,rangeStartValue:i,rangeEndValue:o,rangeStartType:r}=this.state;n===zj&&(this.editCell(t.businessObject,Vj(i,o,r,e)),this.setState({rangeEndType:e}))}onRangeEndValueChange(e){const{element:t}=this.props.context,{type:n,rangeStartValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===zj&&(this.editCell(t.businessObject,Vj(i,e,o,r)),this.setState({rangeEndValue:e}))}renderComparison(e,t){const 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 kr(1,"div","comparison",[kr(1,"h4","dms-heading",this._translate("Value"),0),kr(1,"div","dms-fill-row",[Er(2,aI,{label:this._translate("Comparison operator"),noInput:!0,onChange:this.onComparisonOperatorChange,options:n,value:e}),Sr(" "),Er(2,W_,{label:this._translate("Value"),className:"comparison-number-input",onInput:this.onComparisonValueChange,type:"number",value:t})],4)],4)}renderRange(e,t,n,i){const o=[{label:this._translate("Include"),value:"include"},{label:this._translate("Exclude"),value:"exclude"}];return kr(1,"div","range",[kr(1,"h4","dms-heading",this._translate("Start value"),0),kr(1,"div","dms-fill-row",[Er(2,aI,{label:this._translate("Start value"),noInput:!0,onChange:this.onRangeStartTypeChange,options:o,value:n}),Sr(" "),Er(2,W_,{className:"range-start-number-input",onInput:this.onRangeStartValueChange,type:"number",value:e})],4),kr(1,"h4","dms-heading",this._translate("End value"),0),kr(1,"div","dms-fill-row",[Er(2,aI,{label:this._translate("End value"),noInput:!0,onChange:this.onRangeEndTypeChange,options:o,value:i}),Sr(" "),Er(2,W_,{className:"range-end-number-input",onInput:this.onRangeEndValueChange,type:"number",value:t})],4)],4)}render(){const{type:e,comparisonOperator:t,comparisonValue:n,rangeStartValue:i,rangeEndValue:o,rangeStartType:r,rangeEndType:s}=this.state,a=[{label:this._translate("Comparison"),value:Xj},{label:this._translate("Range"),value:zj}];return kr(1,"div","context-menu-container simple-number-edit",[kr(1,"h3","dms-heading",this._translate("Edit number"),0),kr(1,"div","dms-fill-row",Er(2,aI,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:a,value:e}),2),e===Xj&&this.renderComparison(t,n),e===zj&&this.renderRange(i,o,r,s)],0)}}class Wj extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=qj(n.businessObject.text);this.state=i?{value:i.value}:{value:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onInput(e){const{element:t}=this.props.context;this.debouncedEditCell(t.businessObject,e),this.setState({value:e})}render(){const{value:e}=this.state;return kr(1,"div","context-menu-container simple-number-edit",[kr(1,"h3","dms-heading",this._translate("Edit number"),0),kr(1,"h4","dms-heading",this._translate("Set value"),0),Er(2,W_,{onInput:this.onInput,type:"number",value:e})],4)}}class Hj{constructor(e,t){t.registerProvider((e=>{const t=Uj(e);return(Lt(e.col)||It(e.col))&&Zj(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(Zj(Uj(e.element))){if(Lt(e.element.col))return Yj;if(It(e.element.col))return Wj}}}))}}function Uj(e){return Lt(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}Hj.$inject=["components","simpleMode"];const Gj=["number","integer","long","double"];function Zj(e){return Gj.includes(e)}var Kj={__depends__:[SI,LQ],__init__:["simpleNumberEdit"],simpleNumberEdit:["type",Hj]};function Jj(e){if(!e||eB(e.trim()))return{type:"disjunction",values:[]};let t=e.split(",");const n={type:"disjunction",values:[]};let i="";if(t.forEach((e=>{i+=e,/^"[^"]*"$/.test(i.trim())?(n.values.push(i.trim()),i=""):i+=","})),!i)return n;n.type="negation",n.values=[],i="";const o=e.match(/^\s*not\((.*)\)\s*$/);return o&&(t=o[1].split(","),t.forEach((e=>{i+=e,/^"[^"]*"$/.test(i.trim())?(n.values.push(i.trim()),i=""):i+=","})),!i)?n:void 0}function eB(e){return""===e}const tB="disjunction",nB="negation";class iB extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");let n=Jj(e.context.element.businessObject.text);n||(n={values:[],type:tB});const i=function(e){const t=Lt(e)?e.inputValues:e.outputValues;return!t||eB(t.text)?[]:t.text.split(",").map((e=>e.trim()))}(e.context.element.col.businessObject),o=n.values.filter((e=>!rB(i,e))),r=Lt(e.context.element.col);let s=i.map((e=>({value:e,isChecked:rB(n.values,e),isRemovable:!1,group:this._translate("Predefined values")})));r&&(s=s.concat(o.map((e=>({value:e,isChecked:!0,isRemovable:!0,group:this._translate("Custom values")})))));let a="";r||!n.values.length||rB(i,n.values[0])||(a=n.values[0]),this.state={items:s,unaryTestsType:n.type,inputValue:a,isOutputValueInputChecked:""!==a};const l=t.injector.get("debounceInput");this.debouncedEditCell=l(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.addUnaryTestsListItem=this.addUnaryTestsListItem.bind(this),this.onInput=this.onInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onOutputValueInputClick=this.onOutputValueInputClick.bind(this),this.onUnaryTestsListChanged=this.onUnaryTestsListChanged.bind(this),this.onUnaryTestsTypeChange=this.onUnaryTestsTypeChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onUnaryTestsTypeChange(e){const{items:t}=this.state,n=oB(t),{element:i}=this.props.context;e===tB?(this.editCell(i.businessObject,n.join(",")),this.setState({unaryTestsType:tB})):(this.editCell(i.businessObject,`not(${n.join(",")})`),this.setState({unaryTestsType:nB}))}onUnaryTestsListChanged(e){const t=oB(e),{element:n}=this.props.context,{unaryTestsType:i}=this.state;i===tB?this.editCell(n.businessObject,t.join(",")):this.editCell(n.businessObject,`not(${t.join(",")})`),this.setState({items:e,isOutputValueInputChecked:!1})}onOutputValueInputClick(){const{element:e}=this.props.context,{inputValue:t,items:n}=this.state,i=Jj(t);!i||i.values.length>1||(this.editCell(e.businessObject,`${i.values.join("")}`),this.setState({items:n.map((e=>(e.isChecked=!1,e))),isOutputValueInputChecked:!0}))}onInput({isValid:e,value:t}){const{isOutputValueInputChecked:n}=this.state;this.setState({inputValue:t});const{element:i}=this.props.context;!Lt(i)&&e&&n&&this.debouncedEditCell(i.businessObject,t)}onKeyDown({isValid:e,event:t}){if(13!==t.keyCode)return;const{element:n}=this.props.context,i=Lt(n.col);!i&&e||(t.stopPropagation(),t.preventDefault()),e&&(i?this.addUnaryTestsListItem():this.onOutputValueInputClick())}addUnaryTestsListItem(){const{inputValue:e,items:t,unaryTestsType:n}=this.state,i=Jj(e);if(!i)return;const{element:o}=this.props.context,r=oB(t),s=[].concat(r,i.values);n===tB?this.editCell(o.businessObject,s.join(",")):this.editCell(o.businessObject,`not(${s.join(",")})`);const a=t.concat(i.values.map((e=>({value:e,isChecked:!0,isRemovable:!0,group:this._translate("Custom values")}))));this.setState({items:a,inputValue:""})}render(){const{element:e}=this.props.context,{inputValue:t,isOutputValueInputChecked:n,items:i,unaryTestsType:o}=this.state,r=[{label:this._translate("Match one"),value:tB},{label:this._translate("Match none"),value:nB}],s=Lt(e.col),a=o===nB,l=!s&&i.length>0;return kr(1,"div","simple-string-edit context-menu-container",[kr(1,"h3","dms-heading",this._translate("Edit string"),0),s&&kr(1,"p",null,Er(2,aI,{label:this._translate("String value"),noInput:!0,onChange:this.onUnaryTestsTypeChange,options:r,value:a?nB:tB},null,(e=>this.selectNode=e)),2),Er(2,pI,{onChange:this.onUnaryTestsListChanged,items:i,type:s?"checkbox":"radio"}),kr(1,"h4","dms-heading",s?this._translate("Add values"):this._translate("Set value"),0),kr(1,"div","dms-fill-row",[l&&kr(64,"input","cursor-pointer",null,1,{checked:n,onClick:this.onOutputValueInputClick,type:"radio",style:{marginRight:"8px"}}),Er(2,fI,{label:s?this._translate("Values"):this._translate("Value"),className:"dms-block",onKeyDown:this.onKeyDown,onInput:this.onInput,placeholder:s?this._translate('"value", "value", ...'):this._translate('"value"'),type:"text",validate:e=>{if(!Jj(e))return this._translate("Strings must be in double quotes")},value:t})],0)],0)}}function oB(e){return e.filter((e=>e.isChecked)).map((e=>e.value))}function rB(e,t){return-1!==e.indexOf(t)}class sB{constructor(e,t){t.registerProvider((e=>(Lt(e.col)||It(e.col))&&"string"===aB(e))),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if("string"===aB(e.element))return iB}}))}}function aB(e){return Lt(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}sB.$inject=["components","simpleMode"];var lB={__depends__:[SI,LQ],__init__:["simpleStringEdit"],simpleStringEdit:["type",sB]};const cB=/^(?:\d\d:){2}\d\d(?:Z|(?:[@+-][^")]+))?$/,uB=/^\[time\("([^"]*)"\)..time\("([^"]*)"\)\]$/,hB=/^(<|>)\s*time\("([^"]*)"\)$/,dB=/^time\("([^"]*)"\)$/;function pB(e){if(!cB.test(e.trim()))return"Time must match pattern hh:mm:ss[time zone]"}function fB(e,t){return"exact"===e?`time("${t[0]}")`:"before"===e?`< time("${t[0]}")`:"after"===e?`> time("${t[0]}")`:"between"===e?`[time("${t[0]}")..time("${t[1]}")]`:void 0}function gB(){return(new Date).toISOString().slice(11,-5)+"Z"}function mB(e){if(!e||""===e.trim())return{type:"exact",time:""};let t=e.match(uB);return t?{type:"between",times:[t[1],t[2]]}:(t=e.match(hB),t?{type:"<"===t[1]?"before":"after",time:t[2]}:(t=e.match(dB),t?{type:"exact",time:t[1]}:void 0))}const vB="exact",yB="between";class bB extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=mB(n.businessObject.text);if(i){let e;e=i.time?[i.time,""]:i.times?i.times:["",""],this.state={type:i.type,times:e}}else this.state={type:vB,times:["",""]};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onSetStartTimeNowClick=this.onSetStartTimeNowClick.bind(this),this.onSetEndTimeNowClick=this.onSetEndTimeNowClick.bind(this),this.onStartTimeInput=this.onStartTimeInput.bind(this),this.onEndTimeInput=this.onEndTimeInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{times:n}=this.state;this.setState({type:e}),mB(fB(e,n))&&this.editCell(t.businessObject,fB(e,n))}onSetStartTimeNowClick(){const{element:e}=this.props.context,{times:t,type:n}=this.state,i=gB();this.setState({times:[i,t[1]]}),mB(fB(n,[i,t[1]]))&&this.editCell(e.businessObject,fB(n,[i,t[1]]))}onSetEndTimeNowClick(){const{element:e}=this.props.context,{times:t,type:n}=this.state,i=gB();this.setState({times:[t[0],i]}),mB(fB(n,[t[0],i]))&&this.editCell(e.businessObject,fB(n,[t[0],i]))}onStartTimeInput({value:e}){const{element:t}=this.props.context,{times:n,type:i}=this.state;this.setState({times:[e,n[1]]}),this.debouncedEditCell(t.businessObject,fB(i,[e,n[1]]))}onEndTimeInput({value:e}){const{element:t}=this.props.context,{times:n,type:i}=this.state;this.setState({times:[n[0],e]}),this.debouncedEditCell(t.businessObject,fB(i,[n[0],e]))}render(){const{times:e,type:t}=this.state,n=[{label:this._translate("Exactly"),value:vB},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:yB}];return kr(1,"div","context-menu-container simple-time-edit",[kr(1,"h3","dms-heading",this._translate("Edit time"),0),kr(1,"div","dms-fill-row",Er(2,aI,{label:this._translate("Time"),noInput:!0,onChange:this.onTypeChange,options:n,value:t}),2),kr(1,"h4","dms-heading",t===yB?this._translate("Edit start time"):this._translate("Set time"),0),kr(1,"div",null,[Er(2,fI,{label:this._translate("Start time"),className:"start-time-input dms-block",onInput:this.onStartTimeInput,placeholder:this._translate("e.g. { example } ",{example:WQ()}),validate:e=>pB(e)&&this._translate(pB(e)),value:e[0]}),kr(1,"p","dms-hint",[kr(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onSetStartTimeNowClick}),Sr(".")],4)],4),t===yB&&kr(1,"h4","dms-heading",this._translate("Edit end time"),0),t===yB&&kr(1,"div",null,[Er(2,fI,{label:this._translate("End time"),className:"end-time-input dms-block",onInput:this.onEndTimeInput,placeholder:this._translate("e.g. { example } ",{example:WQ()}),validate:e=>pB(e)&&this._translate(pB(e)),value:e[1]}),kr(1,"p","dms-hint",[kr(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onSetEndTimeNowClick}),Sr(".")],4)],4)],0)}}class _B extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=mB(n.businessObject.text);this.state={date:i?i.date:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onClick=this.onClick.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onClick(){const{element:e}=this.props.context,t=gB();this.setState({date:t}),this.editCell(e.businessObject,`time("${t}")`)}onInput({value:e}){const{element:t}=this.props.context;this.setState({date:e}),this.debouncedEditCell(t.businessObject,`time("${e}")`)}render(){const{date:e}=this.state;return kr(1,"div","context-menu-container simple-time-edit",[kr(1,"h3","dms-heading",this._translate("Edit time"),0),kr(1,"h4","dms-heading",this._translate("Set time"),0),kr(1,"div",null,[Er(2,fI,{label:this._translate("Time value"),onInput:this.onInput,placeholder:this._translate("e.g. { example } ",{example:WQ()}),validate:e=>pB(e)&&this._translate(pB(e)),value:e,className:"dms-block"}),kr(1,"p","dms-hint",[kr(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onClick}),Sr(".")],4)],4)],4)}}class xB{constructor(e,t){t.registerProvider((e=>{const t=OB(e);return(Lt(e.col)||It(e.col))&&wB(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(wB(OB(e.element))){if(Lt(e.element.col))return bB;if(It(e.element.col))return _B}}}))}}function OB(e){return Lt(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function wB(e){return"time"===e}xB.$inject=["components","simpleMode"];var CB={__depends__:[SI,LQ],__init__:["simpleTimeEdit"],simpleTimeEdit:["type",xB]};class kB extends Bs{constructor(e,t){super(e,t),Dv(this)}componentDidMount(){const e=this.getRoot();this.changeSupport.onElementsChanged(e,this.onElementsChanged)}componentWillUnmount(){const e=this.getRoot();this.changeSupport.offElementsChanged(e,this.onElementsChanged)}getRoot(){return this.sheet.getRoot()}onElementsChanged=()=>{this.forceUpdate()};handleMouseDown=e=>{!function({node:e,event:t,minWidth:n,onEnd:i=EB}){t.preventDefault();const o=e.getBoundingClientRect().width,r=t.clientX;let s;function a(t){t.preventDefault();const n=c(t.clientX);s&&cancelAnimationFrame(s),s=requestAnimationFrame((()=>{e.style.width=n+"px"}))}function l(e){e.preventDefault(),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l);const t=c(e.clientX);i(t)}function c(e){const t=e-r;return Math.max(o+t,n)}document.addEventListener("mousemove",a),document.addEventListener("mouseup",l)}({node:mv(e.target,"th",!1),event:e,minWidth:this.props.minWidth||150,onEnd:this.saveWidth})};saveWidth=e=>{const{col:t}=this.props,n={};Dt(t,"dmn:DecisionTable")?n.annotationsWidth=e:n.width=e,this.modeling.updateProperties(t,n)};isLastInputOrOutput(){const{col:e}=this.props,t=Qt(this.getRoot());if(Dt(e,"dmn:InputClause")){const n=t.get("input");return n.indexOf(e)===n.length-1}if(Dt(e,"dmn:OutputClause")){const n=t.get("output");return n.indexOf(e)===n.length-1}}render(){const e=this.isLastInputOrOutput()?{right:"-7px",width:"27px"}:null;return kr(1,"div","resize-column-handle",null,1,{onMouseDown:this.handleMouseDown,title:this.translate("Resize"),style:e})}}function EB(){}function SB(e){e.onGetComponent("cell-inner",((e={})=>{const{cellType:t}=e;if("input-cell"===t||"output-cell"===t||"annotations"===t)return kB}))}kB.$inject=["sheet","changeSupport","translate","modeling"],SB.$inject=["components"];var $B={__init__:["columnResizeProvider"],columnResizeProvider:["type",SB]};let PB=class e extends Ey{getModules(){return[...Ey._getModules(),...e._getModules()]}static _getModules(){return[Xb,h_,vb,P_,Lb,M_,Q_,N_,z_,Vb,$I,$B,FI,HI,GI,ly,uy,SI,nQ,Fb,rQ,Vy,SQ,AQ,Ry,LQ,NQ,nj,yj,Ij,Kj,lB,CB,Xm]}};class TB{constructor(e){this._listeners={},e.on("elements.changed",(({elements:e})=>{this.elementsChanged(e)})),e.on("element.updateId",(({element:e,newId:t})=>{this.updateId(e.id,t)}))}elementsChanged(e){const t={},n=e.length;for(let i=0;i<n;i++){const{id:n}=e[i];if(t[n])return;t[n]=!0;const o=this._listeners[n]&&this._listeners[n].length;if(o)for(let e=0;e<o;e++)this._listeners[n][e]&&this._listeners[n][e]()}}onElementsChanged(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e][this._listeners[e].length]=t}offElementsChanged(e,t){if(this._listeners[e])if(t){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}else this._listeners[e].length=0}updateId(e,t){this._listeners[e]&&(this._listeners[t]=this._listeners[e],delete this._listeners[e])}}TB.$inject=["eventBus"];class RB extends Bs{constructor(e){super(e);const t=this._injector=e.injector;this._changeSupport=t.get("changeSupport"),this._components=t.get("components"),this._renderer=t.get("renderer")}getChildContext(){return{changeSupport:this._changeSupport,components:this._components,renderer:this._renderer,injector:this._injector}}render(){const e=this._components.getComponents("viewer");return kr(1,"div","viewer-container",e&&e.map(((e,t)=>Er(2,e,null,t))),0)}}class AB{constructor(e,t,n,i,o){const{container:r}=n;this._container=r,i.on("renderer.mount",(()=>{Ds(Er(2,RB,{injector:o}),r)})),i.on("renderer.unmount",(()=>{Ds(null,r)}))}getContainer(){return this._container}}AB.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var MB={__init__:["changeSupport","components","renderer"],changeSupport:["type",TB],components:["type",class{constructor(){this._listeners={}}getComponent(e,t){const n=this._listeners[e];if(!n)return;let i;for(let e=0;e<n.length&&(i=n[e].callback(t),!i);e++);return i}getComponents(e,t){const n=this._listeners[e];if(!n)return;const i=[];for(let e=0;e<n.length;e++){const o=n[e].callback(t);o&&i.push(o)}return i.length?i:void 0}onGetComponent(e,t,n){if(_(t)&&(n=t,t=1e3),!b(t))throw new Error("priority must be a number");const i=this._getListeners(e);let o,r;const s={priority:t,callback:n};for(r=0;o=i[r];r++)if(o.priority<t)return void i.splice(r,0,s);i.push(s)}offGetComponent(e,t){const n=this._getListeners(e);let i,o,r;if(t)for(r=n.length-1;i=n[r];r--)o=i.callback,o===t&&n.splice(r,1);else n.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}],eventBus:["type",H],renderer:["type",AB]};let DB=class{constructor(e={}){let{injector:t}=e;if(!t){let{modules:n,config:i}=this._init(e);t=function(e,t){const n=[{config:["value",e]},MB].concat(t||[]),i=new gn(n);return i.init(),i}(i,n)}this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("viewer.init")}_init(e){let{modules:t,...n}=e;return{modules:t,config:n}}destroy(){this.get("eventBus").fire("viewer.destroy")}clear(){this.get("eventBus").fire("viewer.clear")}};function LB(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 IB,QB,jB,BB={};function NB(){IB=window.addEventListener?"addEventListener":"attachEvent",QB=window.removeEventListener?"removeEventListener":"detachEvent",jB="addEventListener"!==IB?"on":""}var qB,FB=LB({__proto__:null,bind:BB.bind=function(e,t,n,i){return IB||NB(),e[IB](jB+t,n,i||!1),n},unbind:BB.unbind=function(e,t,n,i){return QB||NB(),e[QB](jB+t,n,i||!1),n},default:BB},[BB]),VB=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(zB,i)?zB[i]:zB._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},XB=!1;"undefined"!=typeof document&&((qB=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',XB=!qB.getElementsByTagName("link").length,qB=void 0);var zB={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:XB?[1,"X<div>","</div>"]:[0,"",""]};zB.td=zB.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],zB.option=zB.optgroup=[1,'<select multiple="multiple">',"</select>"],zB.thead=zB.tbody=zB.colgroup=zB.caption=zB.tfoot=[1,"<table>","</table>"],zB.polyline=zB.ellipse=zB.polygon=zB.circle=zB.text=zB.line=zB.path=zB.rect=zB.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var YB=VB;let WB=class{constructor(e,t){this._eventBus=t,this._viewer=e}getDecision(){return this._viewer.getDecision()}updateId(e,t){if(e!==this.getDecision())throw new Error("element !== decision");this._eventBus.fire("element.updateId",{element:e,newId:t}),e.id=t}};WB.$inject=["viewer","eventBus"];var HB={__init__:["elementRegistry"],elementRegistry:["type",WB]};class UB extends Bs{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{name:e}=this._viewer.getDecision();return kr(1,"div","decision-properties",kr(1,"h3","decision-name",e,0),2)}}let GB=class{constructor(e){e.onGetComponent("viewer",1500,(()=>UB))}};GB.$inject=["components"];var ZB={__init__:["decisionProperties"],decisionProperties:["type",GB]};let KB=class extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._viewer=t.injector.get("viewer")}render(){const{decisionLogic:e,variable:t}=this._viewer.getDecision();return kr(1,"div","literal-expression-properties",kr(1,"table",null,[kr(1,"tr",null,[kr(1,"td",null,this._translate("Variable name:"),0),kr(1,"td",null,kr(1,"span",null,t.name||"-",0),2)],4),kr(1,"tr",null,[kr(1,"td",null,this._translate("Variable type:"),0),kr(1,"td",null,kr(1,"span",null,this._translate(t.typeRef||"")||"-",0),2)],4),kr(1,"tr",null,[kr(1,"td",null,this._translate("Expression language:"),0),kr(1,"td",null,kr(1,"span",null,e.expressionLanguage||"-",0),2)],4)],4),2)}};class JB{constructor(e){e.onGetComponent("viewer",500,(()=>KB))}}JB.$inject=["components"];var eN={__depends__:[],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",JB]};let tN=class{constructor(e){e.onGetComponent("viewer",2e3,(()=>Fs))}};tN.$inject=["components"];var nN={__init__:["poweredBy"],poweredBy:["type",tN]};class iN extends Bs{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{text:e}=this._viewer.getDecision().decisionLogic;return kr(1,"div","textarea",kr(1,"div","content",e,0),2)}}let oN=class{constructor(e){e.onGetComponent("viewer",(()=>iN))}};oN.$inject=["components"];var rN={__init__:["textarea"],textarea:["type",oN]};let sN=class extends Bs{constructor(e,t){super(e,t);const{injector:n}=t;this._translate=n.get("translate"),this._eventBus=n.get("eventBus")}onClick=()=>{this._eventBus.fire("showDrd")};render(){return kr(1,"div","view-drd",kr(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}};sN.$inject=["translate"];let aN=class{constructor(e,t,n,i){this._injector=i,this._viewer=t,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return sN})),n.on("showDrd",(()=>{const e=i.get("_parent",!1),t=this.getDefinitions(),n=e.getView(t);e.open(n)}))}canViewDrd(){const e=this._injector.get("_parent",!1);if(!e)return;const t=this.getDefinitions();return!!e.getView(t)}getDefinitions(){return this._viewer.getDecision().$parent}};aN.$inject=["components","viewer","eventBus","injector"];var lN={__init__:["viewDrd"],viewDrd:["type",aN]};let cN=class e extends DB{constructor(t={}){const n=e._createContainer();super(F(t,{renderer:{container:n}})),this._container=n}open(e){var t=this;return new Promise((function(n,i){var o;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){o=e}o?(o.warnings=o.warnings||[],i(o)):n({warnings:[]})}))}_init(e){let{modules:t,additionalModules:n,...i}=e;return{modules:[...t||this.getModules(),...n||[],...[{viewer:["value",this]}]],config:i}}on(e,t,n,i){return this.get("eventBus").on(e,t,n,i)}off(e,t){this.get("eventBus").off(e,t)}_emit(e,t){return this.get("eventBus").fire(e,t)}getDecision(){return this._decision}attachTo(e){if(!e)throw new Error("parentNode required");this.detach(),e.appendChild(this._container),this._emit("attach",{})}detach(){const e=this._container;var t;e.parentNode&&(this._emit("detach",{}),(t=e).parentNode&&t.parentNode.removeChild(t))}destroy(){super.destroy(),this.detach()}getModules(){return e._getModules()}static _getModules(){return[HB,ga,ZB,eN,nN,rN,lN]}static _createContainer(){return YB('<div class="dmn-literal-expression-container"></div>')}};class uN extends Bs{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer"),this._modeling=t.injector.get("modeling"),this._translate=t.injector.get("translate"),this.setupChangeListeners({bind:this.getDecision().id})}componentWillUnmount(){this.setupChangeListeners({unbind:this.getDecision().id})}getDecision(){return this._viewer.getDecision()}onElementsChanged=()=>{this.forceUpdate()};setupChangeListeners({bind:e,unbind:t}){const{changeSupport:n}=this.context;"string"==typeof t&&n.offElementsChanged(t,this.onElementsChanged),"string"==typeof e&&n.onElementsChanged(e,this.onElementsChanged)}setDecisionName=e=>{this._modeling.editDecisionName(e)};render(){const{name:e}=this.getDecision();return kr(1,"header","decision-properties",Er(2,hN,{label:this._translate("Decision name"),className:"decision-name editor",value:e,onBlur:dN,onChange:this.setDecisionName}),2)}}class hN extends Jb{render(){return kr(1,"h3",this.getClassName(),this.getEditor(),0)}}function dN(e){e.target.scroll(0,0)}class pN{constructor(e){e.onGetComponent("viewer",1500,(()=>uN))}}pN.$inject=["components"];var fN={__depends__:[u_,ga],__init__:["decisionProperties"],decisionProperties:["type",pN]};const gN="is not a registered action";let mN=class{constructor(e,t){this._actions={undo(){e.undo()},redo(){e.redo()}}}trigger(e,t){if(!this._actions[e])throw vN(e,gN);return this._actions[e](t)}register(e,t){if("string"==typeof e)return this._registerAction(e,t);k(e,((e,t)=>{this._registerAction(t,e)}))}_registerAction(e,t){if(this.isRegistered(e))throw vN(e,"is already registered");this._actions[e]=t}unregister(e){if(!this.isRegistered(e))throw vN(e,gN);this._actions[e]=void 0}isRegistered(e){return!!this._actions[e]}};function vN(e,t){return new Error(e+" "+t)}mN.$inject=["commandStack","eventBus"];var yN={__init__:["editorActions"],editorActions:["type",mN]};function bN(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function _N(e){return e.shiftKey}var xN="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/pull/662";class ON{constructor(e,t,n,i){this._config=e||{},this._eventBus=t,this._editorActions=n,this._listeners=[],t.on("viewer.destroy",this._destroy),t.on("viewer.init",this._init),t.on("attach",(()=>{this._config.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(xN)),this._target=i.getContainer(),this._config&&!1!==this._config.bind&&this.bind()})),t.on("detach",this.unbind)}_init=()=>{this._registerDefaultBindings(),this._fire("init")};_destroy=()=>{this._fire("destroy"),this.unbind(),this._listeners=null};_keyHandler=e=>{var t,n,i=this._listeners,o=e.keyCode||e.charCode||-1;for(t=0;n=i[t];t++)if(n(o,e))return e.preventDefault(),void e.stopPropagation()};bind(e){e&&console.error("unsupported argument <node>",new Error(xN)),this.unbind(),e=this._node=this._target,FB.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")}getBinding(){return this._node}unbind=()=>{var e=this._node;e&&(this._fire("unbind"),FB.unbind(e,"keydown",this._keyHandler,!0)),this._node=null};_fire(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})}_registerDefaultBindings(){var e=this._listeners,t=this._editorActions;e.push((function(e,n){if(bN(n)&&!_N(n)&&90===e)return t.trigger("undo"),!0})),e.push((function(e,n){if(bN(n)&&(89===e||90===e&&_N(n)))return t.trigger("redo"),!0}))}addListener(e){this._listeners.unshift(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}}ON.$inject=["config.keyboard","eventBus","editorActions","renderer"];var wN={__depends__:[yN],__init__:["keyboard"],keyboard:["type",ON]};class CN extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._viewer=t.injector.get("viewer"),this._modeling=t.injector.get("modeling"),this._dataTypes=t.injector.get("dataTypes"),this._eventBus=t.injector.get("eventBus");const n=this._viewer.getDecision();this.state={name:n.variable.name,typeRef:n.variable.typeRef},this.setVariableName=this.setVariableName.bind(this),this.setVariableType=this.setVariableType.bind(this)}setVariableName(e){this._modeling.editVariableName(e),this.setState({name:e})}componentWillMount(){this._eventBus.on("elements.changed",this.onChange)}componentWillUnmount(){this._eventBus.off("elements.changed",this.onChange)}onChange=()=>{const e=this._viewer.getDecision();e.variable&&this.setState({name:e.variable.name})};setVariableType(e){""===e?(this._modeling.editVariableType(void 0),this.setState({typeRef:void 0})):(this._modeling.editVariableType(e),this.setState({typeRef:e}))}render(){const{name:e,typeRef:t}=this.state,n=this._dataTypes.getAll().map((e=>({label:this._translate(e),value:e})));return kr(1,"div","literal-expression-properties",kr(1,"table","variables-table",[kr(1,"tr",null,[kr(1,"td",null,this._translate("Variable name:"),0),kr(1,"td",null,Er(2,W_,{label:this._translate("Variable name"),className:"variable-name-input",onInput:this.setVariableName,placeholder:this._translate("name"),value:e||""}),2)],4),kr(1,"tr",null,[kr(1,"td",null,this._translate("Variable type:"),0),kr(1,"td",null,kr(1,"div","dms-fill-row",Er(2,aI,{label:this._translate("Variable type"),onChange:this.setVariableType,options:n,value:t,className:"variable-type-select dms-block"}),2),2)],4),Er(2,kN)],4),2)}}class kN extends Bs{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._viewer=t.injector.get("viewer"),this._modeling=t.injector.get("modeling"),this._expressionLanguages=t.injector.get("expressionLanguages"),this.setExpressionLanguage=this.setExpressionLanguage.bind(this)}setExpressionLanguage(e){""===e?this._modeling.editExpressionLanguage(void 0):this._modeling.editExpressionLanguage(e)}_getExpressionLanguage(){const e=this._viewer.getDecision().decisionLogic;return e&&e.expressionLanguage?e.expressionLanguage.toLowerCase():this._getDefaultExpressionLanguage()}_getDefaultExpressionLanguage(){return this._expressionLanguages.getDefault().value}_shouldRender(){if(this._expressionLanguages.getAll().length>1)return!0;return this._getExpressionLanguage()!==this._getDefaultExpressionLanguage()}render(){if(!this._shouldRender())return null;const e=this._getExpressionLanguage(),t=this._expressionLanguages.getAll();return kr(1,"tr",null,[kr(1,"td",null,this._translate("Expression language:"),0),kr(1,"td",null,kr(1,"div","dms-fill-row",Er(2,aI,{label:this._translate("Expression language"),onChange:this.setExpressionLanguage,options:t,value:e,className:"expression-language-select dms-block"}),2),2)],4)}}class EN{constructor(e){e.onGetComponent("viewer",500,(()=>CN))}}EN.$inject=["components"];var SN={__depends__:[u_,wN,ly,uy,N_],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",EN]};let $N=class e{constructor(e,t,n){this._commandStack=e,this._viewer=t,this._eventBus=n,n.on("viewer.init",(()=>{!function(e,t){k(e,(function(e,n){t.registerHandler(n,e)}))}(this.getHandlers(),e)}))}getHandlers(){return e._getHandlers()}static _getHandlers(){return{"element.updateProperties":xQ}}getDecision(){return this._viewer.getDecision()}editDecisionName(e){const t={element:this.getDecision(),properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}editDecisionId(e){const t={element:this.getDecision(),properties:{id:e}};this._commandStack.execute("element.updateProperties",t)}editLiteralExpressionText(e){const t={element:this.getDecision().decisionLogic,properties:{text:e}};this._commandStack.execute("element.updateProperties",t)}editExpressionLanguage(e){const t={element:this.getDecision().decisionLogic,properties:{expressionLanguage:e}};this._commandStack.execute("element.updateProperties",t)}editVariableName(e){const t={element:this.getDecision().variable,properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}editVariableType(e){const t={element:this.getDecision().variable,properties:{typeRef:e}};this._commandStack.execute("element.updateProperties",t)}updateProperties(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}};$N.$inject=["commandStack","viewer","eventBus"];var PN={__init__:["idChangeBehavior","nameChangeBehavior","modeling"],commandStack:["type",gp],idChangeBehavior:["type",Hp],nameChangeBehavior:["type",Up],modeling:["type",$N]};let TN=class extends Bs{constructor(e,t){super(e,t),this._modeling=t.injector.get("modeling"),this._viewer=t.injector.get("viewer"),this._expressionLanguages=t.injector.get("expressionLanguages"),this._variableResolver=t.injector.get("variableResolver",!1),this._translate=t.injector.get("translate"),this.editLiteralExpressionText=this.editLiteralExpressionText.bind(this),this.onElementsChanged=this.onElementsChanged.bind(this);const{id:n}=this.getLiteralExpression();t.changeSupport.onElementsChanged(n,this.onElementsChanged)}getLiteralExpression(){return this._viewer.getDecision().decisionLogic}onElementsChanged(){this.forceUpdate()}editLiteralExpressionText(e){this._modeling.editLiteralExpressionText(e)}getEditor(){return this.isFeel()?RN:AN}isFeel(){return"feel"===this.getExpressionLanguage()}getExpressionLanguage(){return this.getLiteralExpression().expressionLanguage||this._expressionLanguages.getDefault().value}_getVariables(){const e=this.getLiteralExpression();return this._variableResolver&&this._variableResolver.getVariables(e)}render(){const{text:e}=this.getLiteralExpression(),t=this.getEditor(),n=this._getVariables();return Er(2,t,{label:this._translate("Literal expression editor"),className:"textarea editor",value:e,onChange:this.editLiteralExpressionText,variables:n})}},RN=class extends Bs{render(){return Er(2,nI,{label:this.props.label,className:this.props.className,value:this.props.value,onInput:this.props.onChange,variables:this.props.variables})}},AN=class extends Jb{render(){return kr(1,"div",this.getClassName(),this.getEditor(),0)}};class MN{constructor(e){e.onGetComponent("viewer",(()=>TN))}}MN.$inject=["components"];var DN={__depends__:[u_,ga],__init__:["textarea"],textarea:["type",MN]};let LN=class e extends cN{getModules(){return[...cN._getModules(),...e._getModules()]}static _getModules(){return[fN,wN,SN,PN,ly,uy,N_,DN,Xm]}};var IN,QN=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(BN,i)?BN[i]:BN._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},jN=!1;"undefined"!=typeof document&&((IN=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',jN=!IN.getElementsByTagName("link").length,IN=void 0);var BN={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:jN?[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 NN=QN;function qN(e,{injector:t}){const n=t.get("components").getComponents("header");return kr(1,"div","dmn-boxed-expression-section dmn-boxed-expression-header",n&&n.map(((e,t)=>Er(2,e,null,t))),0)}function FN(e,{injector:t}){const n=t.get("components").getComponents("body");return kr(1,"div","dmn-boxed-expression-section dmn-boxed-expression-body",n&&n.map(((e,t)=>Er(2,e,null,t))),0)}function VN(e,{injector:t}){const n=t.get("components").getComponents("footer");return kr(1,"div","dmn-boxed-expression-section dmn-boxed-expression-footer",n&&n.map(((e,t)=>Er(2,e,null,t))),0)}var XN={__init__:["viewRenderer","tableJsSupport"],viewRenderer:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>qN)),e.onGetComponent("viewer",(()=>FN)),e.onGetComponent("viewer",(()=>VN))}}],tableJsSupport:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>{const t=e.getComponents("table.before")||[];return()=>kr(1,"div",null,t.map(((e,t)=>Er(2,e,null,t))),0)}))}}]};class zN{constructor(e){e.onGetComponent("viewer",2e3,(()=>Fs))}}zN.$inject=["components"];var YN={__init__:["poweredBy"],poweredBy:["type",zN]};function WN({expression:e},t){return kr(1,"div","textarea",kr(1,"div","content",t.injector.get("literalExpression").getText(e),0),2)}class HN{getText(e){return e.get("text")}}var UN={__init__:["literalExpressionComponent"],literalExpressionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(Dt(e,"dmn:LiteralExpression"))return WN}))}}],literalExpression:["type",HN]};let GN=class{getParameters(e){return e.get("formalParameter")}getBody(e){return e.get("body")}getKind(e){return e.get("kind")||"FEEL"}};function ZN({expression:e},t){const n=t.injector.get("functionDefinition"),i=n.getKind(e),o=n.getParameters(e),r=n.getBody(e);return kr(1,"div","function-definition",[Er(2,JN,{kind:i}),Er(2,eq,{parameters:o}),Er(2,nq,{expression:r})],4)}const KN={FEEL:"F",Java:"J",PMML:"P"};function JN({kind:e},t){const n=t.injector.get("translate");return kr(1,"div","function-definition-kind",KN[e],0,{title:n("Function kind: {kind}",{kind:e})})}function eq({parameters:e}){return kr(1,"div","function-definition-parameters",kr(1,"div",null,[Sr("("),e.reduce(((e,t)=>e.concat(Er(2,tq,{parameter:t}),", ")),[]).slice(0,-1),Sr(")")],0),2)}function tq({parameter:e}){const{name:t,typeRef:n}=e,i=t||"<unnamed>";return kr(1,"span",null,n?`${i}: ${n}`:i,0)}function nq({expression:e},t){return kr(1,"div","function-definition-body",Er(2,t.components.getComponent("expression",{expression:e}),{expression:e}),2)}var iq={__init__:["functionDefinitionComponent"],functionDefinition:["type",GN],functionDefinitionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(Dt(e,"dmn:FunctionDefinition"))return ZN}))}}]};class oq extends Bs{constructor(e,t){super(e,t);const{injector:n}=t;this._translate=n.get("translate"),this._eventBus=n.get("eventBus")}onClick=()=>{this._eventBus.fire("showDrd")};render(){return kr(1,"div","view-drd",kr(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}}oq.$inject=["translate"];class rq{constructor(e,t,n){this._injector=n,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return oq})),t.on("showDrd",(()=>{const e=n.get("_parent",!1),t=e.getDefinitions(),i=e.getView(t);e.open(i)}))}canViewDrd(){const e=this._injector.get("_parent",!1);if(!e)return;const t=e.getDefinitions();return!!e.getView(t)}}rq.$inject=["components","eventBus","injector"];var sq={__init__:["viewDrd"],viewDrd:["type",rq]};function aq(e,t){const n=t.injector.get("viewer"),{name:i}=n.getRootElement();return kr(1,"div","element-properties",kr(1,"h2","element-name",i,0),2)}class lq{constructor(e){e.onGetComponent("header",(()=>aq))}}lq.$inject=["components"];var cq={__init__:["elementProperties"],elementProperties:["type",lq]};function uq(e,{injector:t}){const n=t.get("components"),i=function(e){if(Dt(e,"dmn:Decision"))return e.get("decisionLogic");if(Dt(e,"dmn:BusinessKnowledgeModel"))return e.get("encapsulatedLogic")}(t.get("viewer").getRootElement());return Er(2,n.getComponent("expression",{expression:i}),{expression:i})}function hq({expression:e}){return kr(1,"div",null,kr(1,"span",null,[Sr("Expression of type "),e.$type,Sr(" is not supported.")],0,{style:"color:red;"}),2)}var dq={__init__:["elementLogic"],elementLogic:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("body",(()=>uq)),e.onGetComponent("expression",100,(()=>hq))}}]};class pq{static $inject=["viewer"];constructor(e){this._viewer=e}getName(){const e=this.getVariable(),t=this._getElement();return(e?e.get("name"):null)||t.get("name")}getType(){const e=this.getVariable();return e?e.get("typeRef"):"Any"}_getElement(){return this._viewer.getRootElement()}getVariable(){return this._getElement().get("variable")}}function fq(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("translate"),o=n.getName(),r=n.getType();return kr(1,"div","element-variable",[kr(1,"h2",null,Sr("Result"),2),kr(1,"div","element-variable-name",[kr(1,"span","element-variable-name-label",i("Variable name"),0),kr(1,"span",null,o,0)],4),kr(1,"div","element-variable-type",[kr(1,"span","element-variable-type-label",i("Variable type"),0),kr(1,"span",null,r,0)],4)],4)}var gq={__init__:["elementVariableComponent"],elementVariable:["type",pq],elementVariableComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("footer",(()=>fq))}}]};class mq extends DB{constructor(e={}){const t=mq._createContainer();super(F(e,{renderer:{container:t}})),this._container=t}open(e){const t=this.get("eventBus");return new Promise(((n,i)=>{let o;try{this.getRootElement()&&(this.clear(),t.fire("renderer.unmount")),this._setRootElement(e),t.fire("import",e),t.fire("renderer.mount")}catch(e){o=e}o?(o.warnings=o.warnings||[],i(o)):n({warnings:[]})}))}_init(e){let{modules:t,additionalModules:n,...i}=e;return{modules:[...t||this.getModules(),...n||[],...[{viewer:["value",this]}]],config:i}}on(e,t,n,i){return this.get("eventBus").on(e,t,n,i)}off(e,t){this.get("eventBus").off(e,t)}_emit(e,t){return this.get("eventBus").fire(e,t)}getRootElement(){return this._root}_setRootElement(e){this._root=e}attachTo(e){if(!e)throw new Error("parentNode required");this.detach(),e.appendChild(this._container),this._emit("attach",{})}detach(){const e=this._container;var t;e.parentNode&&(this._emit("detach",{}),(t=e).parentNode&&t.parentNode.removeChild(t))}destroy(){super.destroy(),this.detach()}getModules(){return[XN,ga,YN,sq,cq,dq,iq,UN,gq]}static _createContainer(){return NN('<div class="dmn-boxed-expression-container"></div>')}}var vq={__depends__:[tp],__init__:["keyboardBindings"],keyboardBindings:["type",class{static $inject=["editorActions","keyboard"];constructor(e,t){this.registerBindings(t,e)}registerBindings(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){if(bl(e.keyEvent))return t.trigger("undo"),!0})),n("redo",(function(e){if(_l(e.keyEvent))return t.trigger("redo"),!0}))}}]};function yq(e){return e.$parent}class bq{constructor(e,t,n){this._commandStack=e,this._viewer=t,this._eventBus=n,function(e,t){k(e,(function(e,n){t.registerHandler(n,e)}))}(this._getHandlers(),e)}_getHandlers(){return{"element.updateProperties":xQ}}updateProperties(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}}bq.$inject=["commandStack","viewer","eventBus"];var _q={__init__:["idChangeBehavior","modeling","nameChangeBehavior"],commandStack:["type",gp],idChangeBehavior:["type",Hp],modeling:["type",bq],nameChangeBehavior:["type",class extends Yd{static $inject=["eventBus","modeling"];constructor(e,t){super(e),this._modeling=t,this.postExecuted("element.updateProperties",this.updateName)}updateName=({context:e})=>{const{element:t,properties:n}=e;this.isNameChanged(n)&&(this.isVariable(t)?this.handleVariableNameChange(t):this.isVariableContainer(t)&&this.handleVariableContainerNameChange(t))};isNameChanged(e){return"name"in e}isVariable(e){const t=yq(e);return Dt(e,"dmn:InformationItem")&&t&&t.get("variable")===e}isVariableContainer(e){const t=e.get("variable");return t&&Dt(t,"dmn:InformationItem")}handleVariableNameChange(e){const t=yq(e),n=e.get("name");n!==t.get("name")&&this._modeling.updateProperties(t,{name:n})}handleVariableContainerNameChange(e){const t=e.get("variable"),n=e.get("name");t&&n!==t.get("name")&&this._modeling.updateProperties(t,{name:n})}}]};function xq(e,t){return function(n){return $r(Er(2,Oq,{...n,_component:e,_selectDependencies:t}))}}class Oq extends Bs{constructor(e,t){super(e,t),this._eventBus=t.injector.get("eventBus")}componentDidMount(){this._subscribe()}componentWillUnmount(){this._unsubscribe()}_subscribe(){this._eventBus.on("elements.changed",this.onChange)}_unsubscribe(){this._eventBus.off("elements.changed",this.onChange)}onChange=({elements:e})=>{this.props._selectDependencies(this.props).some((t=>e.includes(t)))&&this.forceUpdate()};render(){return $r(Er(2,this.props._component,{...this.props}))}}function wq(e){return $r(Er(2,nI,{...e,onChange:e.onChange}))}class Cq extends Jb{render(){return kr(1,"div",this.getClassName(),this.getEditor(),0)}}const kq=xq(class extends Bs{constructor(e,t){super(e,t),this._literalExpression=t.injector.get("literalExpression"),this._translate=t.injector.get("translate"),this._expressionLanguages=t.injector.get("expressionLanguages"),this._variableResolver=t.injector.get("variableResolver",!1)}getLiteralExpression(){return this.props.expression}editLiteralExpressionText=e=>{const t=this.getLiteralExpression();this._literalExpression.setText(t,e)};getEditor(){return this.isFeel()?wq:Cq}isFeel(){return function(e){for(let t=e;t;t=t.$parent){const e=t.get("expressionLanguage");if(e)return!("https://www.omg.org/spec/DMN/20191111/FEEL/"!==e&&!/feel/i.test(e));if(Dt(t,"dmn:FunctionDefinition"))return"FEEL"===(t.get("kind")||"FEEL")}return!0}(this.getLiteralExpression())}_getVariables(){const e=this.getLiteralExpression();return this._variableResolver&&this._variableResolver.getVariables(e)}render(){const{text:e}=this.getLiteralExpression(),t=this.getEditor(),n=this._getVariables();return Er(2,t,{label:this._translate("Literal expression"),className:"textarea editor",value:e,onChange:this.editLiteralExpressionText,variables:n})}},(e=>[e.expression]));class Eq extends HN{constructor(e){super(),this._modeling=e}setText(e,t){this._modeling.updateProperties(e,{text:t})}}Eq.$inject=["modeling"];var Sq={__init__:["literalExpressionComponent"],literalExpressionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(Dt(e,"dmn:LiteralExpression"))return kq}))}}],literalExpression:["type",Eq]};function $q({label:e,onClick:t}){return kr(1,"button","edit-button dmn-icon-edit",null,1,{"aria-label":e,type:"button",onClick:t})}const Pq=xq((function({expression:e},t){const n=t.injector.get("functionDefinition"),i=t.injector.get("contextMenu"),o=n.getKind(e),r=n.getParameters(e),s=n.getBody(e);return kr(1,"div","function-definition",[Er(2,Rq,{kind:o,openEditor:t=>{const n=Lq(t);i.open(n,{contextMenuType:"kind-editor",expression:e})}}),Er(2,Aq,{parameters:r,openEditor:t=>{const n=Lq(t);i.open(n,{contextMenuType:"formal-parameters-editor",expression:e})}}),Er(2,Dq,{expression:s,parameters:r})],4)}),(e=>[e.expression]));const Tq={FEEL:"F",Java:"J",PMML:"P"};function Rq({kind:e,openEditor:t},n){const i=n.injector.get("translate");return kr(1,"div","function-definition-kind",[Tq[e],Er(2,$q,{label:i("Edit function kind"),onClick:t})],0)}function Aq({openEditor:e,parameters:t},n){const i=n.injector.get("translate");return kr(1,"div","function-definition-parameters",[kr(1,"div",null,[Sr("("),t.reduce(((e,t)=>e.concat(Er(2,Mq,{parameter:t}),", ")),[]).slice(0,-1),Sr(")")],0),Er(2,$q,{label:i("Edit formal parameters"),onClick:e})],4)}const Mq=xq((function({parameter:e}){const{name:t,typeRef:n}=e,i=t||"<unnamed>";return kr(1,"span",null,n?`${i}: ${n}`:i,0)}),(e=>[e.parameter]));const Dq=xq((function({expression:e,parameters:t},n){return kr(1,"div","function-definition-body",Er(2,n.components.getComponent("expression",{expression:e}),{expression:e,parameters:t}),2)}),(e=>e.parameters));function Lq(e){const t=e.target.parentElement.getBoundingClientRect();return{x:t.x,y:t.y}}const Iq=[{value:"FEEL",label:"FEEL"},{value:"Java",label:"Java"},{value:"PMML",label:"PMML"}];function Qq({context:{expression:e}},t){const n=t.injector.get("functionDefinition"),i=t.injector.get("translate"),o=n.getKind(e);return kr(1,"div","context-menu-container",[kr(1,"h3",null,i("Edit function kind"),0),Er(2,aI,{label:i("Kind"),options:Iq,value:o,onChange:t=>{n.setKind(e,t)},noInput:!0})],4)}const jq=xq((function({context:{expression:e}},t){const n=t.injector.get("functionDefinition"),i=t.injector.get("translate"),o=n.getParameters(e);return kr(1,"div","context-menu-container formal-parameters",[kr(1,"h3",null,i("Edit formal parameters"),0),o.length?kr(1,"table",null,[kr(1,"thead",null,kr(1,"tr",null,[kr(1,"th",null,Sr("Name"),2),kr(1,"th",null,Sr("Type"),2)],4),2),kr(1,"tbody",null,o.map(((t,i)=>Er(2,Bq,{parameter:t,remove:()=>(t=>{n.removeParameter(e,t)})(t)},i))),0)],4):null,kr(1,"button","add-parameter",i("Add parameter"),0,{type:"button",onClick:()=>{n.addParameter(e)}})],0)}),(e=>[e.context.expression]));const Bq=xq((function({parameter:e,remove:t},n){const i=n.injector.get("dataTypes"),o=n.injector.get("translate"),r=n.injector.get("functionDefinition"),{name:s,typeRef:a}=e,l=i.getAll().map((e=>({label:o(e),value:e})));return kr(1,"tr","function-definition-parameter",[kr(1,"td",null,Er(2,W_,{onChange:t=>{r.updateParameter(e,{name:t})},value:s}),2),kr(1,"td",null,Er(2,aI,{onChange:t=>{r.updateParameter(e,{typeRef:t})},value:a,options:l}),2),kr(1,"td",null,kr(1,"button","dmn-icon-trash",null,1,{type:"button",onClick:t,"aria-label":o("Remove parameter")}),2)],4)}),(e=>[e.parameter]));var Nq={__init__:["formalParametersEditorComponent","functionDefinitionComponent","kindEditorComponent"],__depends__:[P_],formalParametersEditorComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"formal-parameters-editor"===e.contextMenuType)return jq}))}}],functionDefinition:["type",class extends GN{static $inject=["modeling","dmnFactory"];constructor(e,t){super(),this._modeling=e,this._dmnFactory=t}addParameter(e){this._modeling.updateProperties(e,{formalParameter:[...this.getParameters(e),this._dmnFactory.create("dmn:InformationItem",{name:"",typeRef:""})]})}removeParameter(e,t){this._modeling.updateProperties(e,{formalParameter:this.getParameters(e).filter((e=>e!==t))})}updateParameter(e,t){this._modeling.updateProperties(e,t)}setKind(e,t){this._modeling.updateProperties(e,{kind:t})}}],functionDefinitionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(Dt(e,"dmn:FunctionDefinition"))return Pq}))}}],kindEditorComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"kind-editor"===e.contextMenuType)return Qq}))}}]};const qq=xq((function(e,t){const{element:n}=e,i=t.injector.get("modeling"),o=t.injector.get("translate"),r=n.get("name");return Er(2,W_,{label:o("Element name"),className:"element-name editor",value:r,onChange:e=>{i.updateProperties(n,{name:e})}})}),(e=>[e.element]));function Fq(e,t){const n=t.injector.get("viewer").getRootElement();return kr(1,"div","element-properties",Er(2,qq,{element:n}),2)}class Vq{constructor(e){e.onGetComponent("header",(()=>Fq))}}Vq.$inject=["components"];var Xq={__depends__:[u_],__init__:["elementProperties"],elementProperties:["type",Vq]};class zq{constructor(e,t){this._eventBus=t,this._viewer=e}updateId(e,t){if(e!==this._viewer.getRootElement())throw new Error("element !== rootElement");this._eventBus.fire("element.updateId",{element:e,newId:t}),e.id=t}}zq.$inject=["viewer","eventBus"];var Yq={__init__:["elementRegistry"],elementRegistry:["type",zq],dmnFactory:["type",class{static $inject=["moddle"];constructor(e){this._moddle=e}create(e,t={}){return this._moddle.create(e,t)}}]};const Wq="dmn-boxed-expression-variable-type";function Hq(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("translate"),o=n.getName();return kr(1,"div","element-variable",[kr(1,"h2",null,Sr("Result"),2),kr(1,"div","element-variable-name",[kr(1,"span","element-variable-name-label",i("Variable name"),0),kr(1,"span",null,o,0)],4),kr(1,"div","element-variable-type",[kr(1,"label","element-variable-type-label",Sr("Result type"),2,{for:Wq}),Er(2,Uq)],4)],4)}function Uq(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("dataTypes"),o=t.injector.get("translate"),r=n.getType(),s=i.getAll().map((e=>({label:o(e),value:e})));return Er(2,aI,{value:r,onChange:e=>n.setType(e),options:s,id:Wq})}var Gq={__init__:["elementVariableComponent"],elementVariable:["type",class extends pq{static $inject=["viewer","modeling","dmnFactory"];constructor(e,t,n){super(e),this._modeling=t,this._dmnFactory=n}setType(e){const t=this.getVariable();if(t)this._modeling.updateProperties(t,{typeRef:e});else{const t=this._getElement();this._modeling.updateProperties(t,{variable:this._dmnFactory.create("dmn:InformationItem",{name:t.get("name"),typeRef:e})})}}}],elementVariableComponent:["type",class{static $inject=["components","elementVariable"];constructor(e,t){const n=xq(Hq,(()=>[t.getVariable()]));e.onGetComponent("footer",(()=>n))}}]};const Zq="is not a registered action";class Kq{constructor(e,t){this._actions={undo(){e.undo()},redo(){e.redo()}}}trigger(e,t){if(!this._actions[e])throw Jq(e,Zq);return this._actions[e](t)}register(e,t){if("string"==typeof e)return this._registerAction(e,t);k(e,((e,t)=>{this._registerAction(t,e)}))}_registerAction(e,t){if(this.isRegistered(e))throw Jq(e,"is already registered");this._actions[e]=t}unregister(e){if(!this.isRegistered(e))throw Jq(e,Zq);this._actions[e]=void 0}isRegistered(e){return!!this._actions[e]}}function Jq(e,t){return new Error(e+" "+t)}Kq.$inject=["commandStack","eventBus"];var eF={__init__:["editorActions"],editorActions:["type",Kq]};class tF extends mq{getModules(){return[...super.getModules(),Yq,_q,eF,Xq,Nq,ly,uy,Sq,vq,N_,Gq,Xm]}}class nF extends Nt{_getViewProviders(){return[{id:"drd",constructor:Dm,opens:"dmn:Definitions"},{id:"decisionTable",constructor:PB,opens:e=>Dt(e,"dmn:Decision")&&Dt(e.decisionLogic,"dmn:DecisionTable")},{id:"literalExpression",constructor:LN,opens:e=>Dt(e,"dmn:Decision")&&Dt(e.decisionLogic,"dmn:LiteralExpression")},{id:"boxedExpression",constructor:tF,opens:e=>Dt(e,"dmn:BusinessKnowledgeModel")&&Bt(e)}]}_getInitialView(e,...t){let n=super._getInitialView(e,...t);if(!n)return;const i=n.element;return Dt(i,"dmn:Definitions")&&!Qd(i)&&(n=w(e,(e=>!Dt(e.element,"dmn:Definitions")))||n),n}}function iF(e,t){var n,i,o=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",r=e.crossColor||"#CCC",s=-1;yn(t.getLayer("djs-origin",-1),n=sF("g",{"pointer-events":"none"})),!1!==e.showBorder&&yn(n,sF("path",{class:rF("border"),d:oF(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:o,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),yn(n,sF("path",{d:oF(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:rF("cross"),fill:"none",stroke:r,"stroke-width":"2px","stroke-linecap":"round"})),(i=sF("text",{x:-40,y:-10,fill:r,class:rF("label")})).textContent="(0, 0)",yn(n,i)}function oF(e){return e.join(" ")}function rF(e){return"djs-origin-"+e}function sF(e,t){var n=Tn(e);return xn(n,t),n}iF.$inject=["config.origin","canvas"];var aF={__init__:[iF]};var lF=1e5,cF=1e5;function uF(e,t){this._canvas=e;var n=this;t.on("diagram.init",(function(){n._init(),n.toggle(!0)})),t.on("gridSnapping.toggle",(function(e){var t=e.active;n.toggle(t),n._centerGridAroundViewbox()})),t.on("canvas.viewbox.changed",(function(e){var t=e.viewbox;n._centerGridAroundViewbox(t)}))}uF.prototype._init=function(){var e,t=(e="defs",(this._canvas._svg||document).querySelector(e));t||(t=Tn("defs"),yn(this._canvas._svg,t));var n=this._pattern=Tn("pattern"),i="djs-grid-pattern-"+Math.trunc(1e6*Math.random());xn(n,{id:i,width:Nd,height:Nd,patternUnits:"userSpaceOnUse"});var o=this._circle=Tn("circle");xn(o,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),yn(n,o),yn(t,n),xn(this._gfx=Tn("rect"),{x:-lF/2,y:-cF/2,width:lF,height:cF,fill:`url(#${i})`})},uF.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=Ao(e);xn(this._gfx,{x:-lF/2+qd(t.x,Nd),y:-cF/2+qd(t.y,Nd)})},uF.prototype.isVisible=function(){return this._visible},uF.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?yn(t,this._gfx):kn(t),this._visible=e}},uF.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},uF.$inject=["canvas","eventBus"];var hF={__init__:["grid"],grid:["type",uF]},dF={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function pF(e,t,n,i,o,r){function s(e,n){var i=n.offset,o=n.tolerance,r={};return["x","y"].forEach((function(n){var s=-e[n]+i[n],a=t.get("gridSnapping",!1);a&&(s=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(s,a.getGridSpacing())),r[n]=Math.abs(s)<o?0:s})),r}function a(){var t=o.viewbox().inner,n=o.getRootElement().children;if(n.length){var r=s(t,e);0===r.x&&0===r.y||i.execute("elements.alignToOrigin",{elements:n,delta:r})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,i=o.viewbox().scale;o.scroll({dx:e*n.x*i,dy:e*n.y*i})}))}}var c,u,h;e=function(e){var t=F({},dF,e||{});return b(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),i.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;r.moveElements(n,t)},execute:l(-1),revert:l(1)}),e.alignOnSave&&(c=t.get("_parent",!1),u=n,((h=c&&c._eventBus)||u).on("saveXML.start",1250,a),h&&u.on("diagram.destroy",(function(){h.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}pF.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var fF,gF,mF,vF,yF,bF,_F,xF,OF={__init__:["alignToOrigin"],alignToOrigin:["type",pF]},wF={},CF=[],kF=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,EF=Array.isArray;function SF(e,t){for(var n in t)e[n]=t[n];return e}function $F(e){var t=e.parentNode;t&&t.removeChild(e)}function PF(e,t,n){var i,o,r,s={};for(r in t)"key"==r?i=t[r]:"ref"==r?o=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?fF.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===s[r]&&(s[r]=e.defaultProps[r]);return TF(e,s,i,o,null)}function TF(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==o?++mF:o,__i:-1,__u:0};return null==o&&null!=gF.vnode&&gF.vnode(r),r}function RF(e){return e.children}function AF(e,t){this.props=e,this.context=t}function MF(e,t){if(null==t)return e.__?MF(e.__,e.__i+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?MF(e):null}function DF(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 DF(e)}}function LF(e){(!e.__d&&(e.__d=!0)&&vF.push(e)&&!IF.__r++||yF!==gF.debounceRendering)&&((yF=gF.debounceRendering)||bF)(IF)}function IF(){var e,t,n,i,o,r,s,a,l;for(vF.sort(_F);e=vF.shift();)e.__d&&(t=vF.length,i=void 0,r=(o=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=SF({},o)).__v=o.__v+1,gF.vnode&&gF.vnode(i),zF(s,i,o,n.__n,void 0!==s.ownerSVGElement,32&o.__u?[r]:null,a,null==r?MF(o):r,!!(32&o.__u),l),i.__.__k[i.__i]=i,YF(a,i,l),i.__e!=r&&DF(i)),vF.length>t&&vF.sort(_F));IF.__r=0}function QF(e,t,n,i,o,r,s,a,l,c,u){var h,d,p,f,g,m=i&&i.__k||CF,v=t.length;for(n.__d=l,function(e,t,n){var i,o,r,s,a,l=t.length,c=n.length,u=c,h=0;for(e.__k=[],i=0;i<l;i++)null!=(o=e.__k[i]=null==(o=t[i])||"boolean"==typeof o||"function"==typeof o?null:"string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?TF(null,o,null,null,o):EF(o)?TF(RF,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?TF(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)?(o.__=e,o.__b=e.__b+1,a=NF(o,n,s=i+h,u),o.__i=a,r=null,-1!==a&&(u--,(r=n[a])&&(r.__u|=131072)),null==r||null===r.__v?(-1==a&&h--,"function"!=typeof o.type&&(o.__u|=65536)):a!==s&&(a===s+1?h++:a>s?u>l-s?h+=a-s:h--:h=a<s&&a==s-1?a-s:0,a!==i+h&&(o.__u|=65536))):(r=n[i])&&null==r.key&&r.__e&&(r.__e==e.__d&&(e.__d=MF(r)),UF(r,r,!1),n[i]=null,u--);if(u)for(i=0;i<c;i++)null!=(r=n[i])&&!(131072&r.__u)&&(r.__e==e.__d&&(e.__d=MF(r)),UF(r,r))}(n,t,m),l=n.__d,h=0;h<v;h++)null!=(p=n.__k[h])&&"boolean"!=typeof p&&"function"!=typeof p&&(d=-1===p.__i?wF:m[p.__i]||wF,p.__i=h,zF(e,p,d,o,r,s,a,l,c,u),f=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&HF(d.ref,null,p),u.push(p.ref,p.__c||f,p)),null==g&&null!=f&&(g=f),65536&p.__u||d.__k===p.__k?l=jF(p,l,e):"function"==typeof p.type&&void 0!==p.__d?l=p.__d:f&&(l=f.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=l,n.__e=g}function jF(e,t,n){var i,o;if("function"==typeof e.type){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=jF(i[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function BF(e,t){return t=t||[],null==e||"boolean"==typeof e||(EF(e)?e.some((function(e){BF(e,t)})):t.push(e)),t}function NF(e,t,n,i){var o=e.key,r=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&o==l.key&&r===l.type)return n;if(i>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&r===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&o==l.key&&r===l.type)return a;a++}}return-1}function qF(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||kF.test(t)?n:n+"px"}function FF(e,t,n,i,o){var r;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||qF(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||qF(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])r=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,r?XF:VF,r)):e.removeEventListener(t,r?XF:VF,r);else{if(o)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&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function VF(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(gF.event?gF.event(e):e)}function XF(e){return this.l[e.type+!0](gF.event?gF.event(e):e)}function zF(e,t,n,i,o,r,s,a,l,c){var u,h,d,p,f,g,m,v,y,b,_,x,O,w,C,k=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),r=[a=t.__e=n.__e]),(u=gF.__b)&&u(t);e:if("function"==typeof k)try{if(v=t.props,y=(u=k.contextType)&&i[u.__c],b=u?y?y.props.value:u.__:i,n.__c?m=(h=t.__c=n.__c).__=h.__E:("prototype"in k&&k.prototype.render?t.__c=h=new k(v,b):(t.__c=h=new AF(v,b),h.constructor=k,h.render=GF),y&&y.sub(h),h.props=v,h.state||(h.state={}),h.context=b,h.__n=i,d=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=k.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=SF({},h.__s)),SF(h.__s,k.getDerivedStateFromProps(v,h.__s))),p=h.props,f=h.state,h.__v=t,d)null==k.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==k.getDerivedStateFromProps&&v!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(v,b),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=v,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),_=0;_<h._sb.length;_++)h.__h.push(h._sb[_]);h._sb=[],h.__h.length&&s.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(v,h.__s,b),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(p,f,g)}))}if(h.context=b,h.props=v,h.__P=e,h.__e=!1,x=gF.__r,O=0,"prototype"in k&&k.prototype.render){for(h.state=h.__s,h.__d=!1,x&&x(t),u=h.render(h.props,h.state,h.context),w=0;w<h._sb.length;w++)h.__h.push(h._sb[w]);h._sb=[]}else do{h.__d=!1,x&&x(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++O<25);h.state=h.__s,null!=h.getChildContext&&(i=SF(SF({},i),h.getChildContext())),d||null==h.getSnapshotBeforeUpdate||(g=h.getSnapshotBeforeUpdate(p,f)),QF(e,EF(C=null!=u&&u.type===RF&&null==u.key?u.props.children:u)?C:[C],t,n,i,o,r,s,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),m&&(h.__E=h.__=null)}catch(e){t.__v=null,l||null!=r?(t.__e=a,t.__u|=l?160:32,r[r.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),gF.__e(e,t,n)}else null==r&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=WF(n.__e,t,n,i,o,r,s,l,c);(u=gF.diffed)&&u(t)}function YF(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)HF(n[i],n[++i],n[++i]);gF.__c&&gF.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){gF.__e(e,t.__v)}}))}function WF(e,t,n,i,o,r,s,a,l){var c,u,h,d,p,f,g,m=n.props,v=t.props,y=t.type;if("svg"===y&&(o=!0),null!=r)for(c=0;c<r.length;c++)if((p=r[c])&&"setAttribute"in p==!!y&&(y?p.localName===y:3===p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null===y)return document.createTextNode(v);e=o?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,v.is&&v),r=null,a=!1}if(null===y)m===v||a&&e.data===v||(e.data=v);else{if(r=r&&fF.call(e.childNodes),m=n.props||wF,!a&&null!=r)for(m={},c=0;c<e.attributes.length;c++)m[(p=e.attributes[c]).name]=p.value;for(c in m)p=m[c],"children"==c||("dangerouslySetInnerHTML"==c?h=p:"key"===c||c in v||FF(e,c,null,p,o));for(c in v)p=v[c],"children"==c?d=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?f=p:"checked"==c?g=p:"key"===c||a&&"function"!=typeof p||m[c]===p||FF(e,c,p,m[c],o);if(u)a||h&&(u.__html===h.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(h&&(e.innerHTML=""),QF(e,EF(d)?d:[d],t,n,i,o&&"foreignObject"!==y,r,s,r?r[0]:n.__k&&MF(n,0),a,l),null!=r)for(c=r.length;c--;)null!=r[c]&&$F(r[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===y&&!f||"option"===y&&f!==m[c])&&FF(e,c,f,m[c],!1),c="checked",void 0!==g&&g!==e[c]&&FF(e,c,g,m[c],!1))}return e}function HF(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){gF.__e(e,n)}}function UF(e,t,n){var i,o;if(gF.unmount&&gF.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||HF(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){gF.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&UF(i[o],t,n||"function"!=typeof e.type);n||null==e.__e||$F(e.__e),e.__=e.__e=e.__d=void 0}function GF(e,t,n){return this.constructor(e,n)}function ZF(e,t,n){var i,o,r,s;gF.__&&gF.__(e,t),o=(i="function"==typeof n)?null:t.__k,r=[],s=[],zF(t,e=(!i&&n||t).__k=PF(RF,null,[e]),o||wF,wF,void 0!==t.ownerSVGElement,!i&&n?[n]:o?null:t.firstChild?fF.call(t.childNodes):null,r,!i&&n?n:o?o.__e:t.firstChild,i,s),YF(r,e,s)}function KF(e,t){var n={__c:t="__cC"+xF++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,LF(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}fF=CF.slice,gF={__e:function(e,t,n,i){for(var o,r,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},mF=0,AF.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=SF({},this.state),"function"==typeof e&&(e=e(SF({},n),this.props)),e&&SF(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),LF(this))},AF.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),LF(this))},AF.prototype.render=RF,vF=[],bF="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_F=function(e,t){return e.__v.__b-t.__v.__b},IF.__r=0,xF=0;var JF,eV,tV,nV,iV=0,oV=[],rV=[],sV=gF.__b,aV=gF.__r,lV=gF.diffed,cV=gF.__c,uV=gF.unmount;function hV(e,t){gF.__h&&gF.__h(eV,e,iV||t),iV=0;var n=eV.__H||(eV.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:rV}),n.__[e]}function dV(e){return iV=1,function(e,t,n){var i=hV(JF++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):kV(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=eV,!eV.u)){var o=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(e){return e.__c}));if(o.every((function(e){return!e.__N})))return!r||r.call(this,e,t,n);var s=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!r||r.call(this,e,t,n))};eV.u=!0;var r=eV.shouldComponentUpdate,s=eV.componentWillUpdate;eV.componentWillUpdate=function(e,t,n){if(this.__e){var i=r;r=void 0,o(e,t,n),r=i}s&&s.call(this,e,t,n)},eV.shouldComponentUpdate=o}return i.__N||i.__}(kV,e)}function pV(e,t){var n=hV(JF++,3);!gF.__s&&CV(n.__H,t)&&(n.__=e,n.i=t,eV.__H.__h.push(n))}function fV(e,t){var n=hV(JF++,4);!gF.__s&&CV(n.__H,t)&&(n.__=e,n.i=t,eV.__h.push(n))}function gV(e){return iV=5,mV((function(){return{current:e}}),[])}function mV(e,t){var n=hV(JF++,7);return CV(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function vV(e,t){return iV=8,mV((function(){return e}),t)}function yV(e){var t=eV.context[e.__c],n=hV(JF++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(eV)),t.props.value):e.__}function bV(){for(var e;e=oV.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(OV),e.__H.__h.forEach(wV),e.__H.__h=[]}catch(t){e.__H.__h=[],gF.__e(t,e.__v)}}gF.__b=function(e){eV=null,sV&&sV(e)},gF.__r=function(e){aV&&aV(e),JF=0;var t=(eV=e.__c).__H;t&&(tV===eV?(t.__h=[],eV.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=rV,e.__N=e.i=void 0}))):(t.__h.forEach(OV),t.__h.forEach(wV),t.__h=[],JF=0)),tV=eV},gF.diffed=function(e){lV&&lV(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==oV.push(t)&&nV===gF.requestAnimationFrame||((nV=gF.requestAnimationFrame)||xV)(bV)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==rV&&(e.__=e.__V),e.i=void 0,e.__V=rV}))),tV=eV=null},gF.__c=function(e,t){t.some((function(e){try{e.__h.forEach(OV),e.__h=e.__h.filter((function(e){return!e.__||wV(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],gF.__e(n,e.__v)}})),cV&&cV(e,t)},gF.unmount=function(e){uV&&uV(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{OV(e)}catch(e){t=e}})),n.__H=void 0,t&&gF.__e(t,n.__v))};var _V="function"==typeof requestAnimationFrame;function xV(e){var t,n=function(){clearTimeout(i),_V&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);_V&&(t=requestAnimationFrame(n))}function OV(e){var t=eV,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),eV=t}function wV(e){var t=eV;e.__c=e.__(),eV=t}function CV(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function kV(e,t){return"function"==typeof t?t(e):t}function EV(e,t){for(var n in t)e[n]=t[n];return e}function SV(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function $V(e){this.props=e}($V.prototype=new AF).isPureReactComponent=!0,$V.prototype.shouldComponentUpdate=function(e,t){return SV(this.props,e)||SV(this.state,t)};var PV=gF.__b;gF.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),PV&&PV(e)};var TV="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function RV(e){function t(t){var n=EV({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=TV,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var AV=gF.__e;gF.__e=function(e,t,n,i){if(e.then)for(var o,r=t;r=r.__;)if((o=r.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);AV(e,t,n,i)};var MV=gF.unmount;function DV(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=EV({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return DV(e,t,n)}))),e}function LV(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return LV(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function IV(){this.__u=0,this.t=null,this.__b=null}function QV(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function jV(){this.u=null,this.o=null}gF.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),MV&&MV(e)},(IV.prototype=new AF).__c=function(e,t){var n=t.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var o=QV(i.__v),r=!1,s=function(){r||(r=!0,n.__R=null,o?o(a):a())};n.__R=s;var a=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=LV(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.t.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(s,s)},IV.prototype.componentWillUnmount=function(){this.t=[]},IV.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=DV(this.__b,n,i.__O=i.__P)}this.__b=null}var o=t.__a&&PF(RF,null,e.fallback);return o&&(o.__u&=-33),[PF(RF,null,t.__a?null:e.children),o]};var BV=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function NV(e){return this.getChildContext=function(){return e.context},e.children}function qV(e){var t=this,n=e.i;t.componentWillUnmount=function(){ZF(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),ZF(PF(NV,{context:t.context},e.__v),t.l)}function FV(e,t){var n=PF(qV,{__v:e,i:t});return n.containerInfo=t,n}(jV.prototype=new AF).__a=function(e){var t=this,n=QV(t.__v),i=t.o.get(e);return i[0]++,function(o){var r=function(){t.props.revealOrder?(i.push(o),BV(t,e,i)):o()};n?n(r):r()}},jV.prototype.render=function(e){this.u=null,this.o=new Map;var t=BF(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},jV.prototype.componentDidUpdate=jV.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){BV(e,n,t)}))};var VV="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,XV=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,zV=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,YV=/[A-Z0-9]/g,WV="undefined"!=typeof document,HV=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};AF.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(AF.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var UV=gF.event;function GV(){}function ZV(){return this.cancelBubble}function KV(){return this.defaultPrevented}gF.event=function(e){return UV&&(e=UV(e)),e.persist=GV,e.isPropagationStopped=ZV,e.isDefaultPrevented=KV,e.nativeEvent=e};var JV={enumerable:!1,configurable:!0,get:function(){return this.class}},eX=gF.vnode;gF.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var o in t){var r=t[o];if(!("value"===o&&"defaultValue"in t&&null==r||WV&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var s=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===r?r="":"ondoubleclick"===s?o="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||HV(t.type)?"onfocus"===s?o="onfocusin":"onblur"===s?o="onfocusout":zV.test(o)?o=s:-1===n.indexOf("-")&&XV.test(o)?o=o.replace(YV,"-$&").toLowerCase():null===r&&(r=void 0):s=o="oninput","oninput"===s&&i[o=s]&&(o="oninputCapture"),i[o]=r}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=BF(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=BF(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",JV)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=VV,eX&&eX(e)};var tX=gF.__r;gF.__r=function(e){tX&&tX(e),e.__c};var nX=gF.diffed;gF.diffed=function(e){nX&&nX(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};var iX=0;function oX(e,t,n,i,o,r){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--iX,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return gF.vnode&&gF.vnode(c),c}var rX,sX={exports:{}};
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/var aX,lX=(rX||(rX=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e=[],i=0;i<arguments.length;i++){var o=arguments[i];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o)){if(o.length){var s=n.apply(null,o);s&&e.push(s)}}else if("object"===r){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){e.push(o.toString());continue}for(var a in o)t.call(o,a)&&o[a]&&e.push(a)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(sX)),sX.exports),cX=zy(lX),uX=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(dX,i)?dX[i]:dX._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},hX=!1;"undefined"!=typeof document&&((aX=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',hX=!aX.getElementsByTagName("link").length,aX=void 0);var dX={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:hX?[1,"X<div>","</div>"]:[0,"",""]};dX.td=dX.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],dX.option=dX.optgroup=[1,'<select multiple="multiple">',"</select>"],dX.thead=dX.tbody=dX.colgroup=dX.caption=dX.tfoot=[1,"<table>","</table>"],dX.polyline=dX.ellipse=dX.polygon=dX.circle=dX.text=dX.line=dX.path=dX.rect=dX.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var pX=uX;function fX(e,t){return(t=t||document).querySelector(e)}const gX=122,mX=123,vX=4,yX=131,bX=19,_X=140,xX=23,OX=141,wX=41,CX=68,kX=154,EX=70,SX=155,$X=72,PX=156,TX=167,RX=89,AX=90,MX=169,DX=97,LX=171,IX="undefined"!=typeof process&&process.env&&/\bfparse(:dbg)?\b/.test(process.env.LOG),QX="undefined"!=typeof process&&process.env&&/\bfparse:dbg\b/.test(process.env.LOG),jX="undefined"!=typeof process&&process.env&&/\bcontext\b/.test(process.env.LOG),BX=[9,11,12,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],NX=VX("\n\r"),qX="*".charCodeAt(0),FX=VX("'./-+*^");function VX(e){return Array.from(e).map((e=>e.charCodeAt(0)))}function XX(e){return e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}function zX(e,t){return t.concat(e.split(/\n/g).join("\n"+t))}function YX(e,t=0){const n=e.peek(t);return n===qX&&e.peek(t+1)===qX?{offset:2,token:"**"}:(i=n,FX.includes(i)?{offset:1,token:String.fromCharCode(n)}:null);var i}function WX(e,t=0,n=!1){for(let o=!1,r=[],s=0;;s++){const a=e.peek(t+s);if(!(63===(i=a)||i>=65&&i<=90||95===i||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=55296&&i<=56319||i>=56320&&i<=57343||(o||n)&&XX(a)))return r.length?{token:String.fromCharCode(...r),offset:s}:null;o||(o=!0),r.push(a)}var i}function HX(e,t){for(let i=!1,o=0;;o++){let r=e.peek(t+o);if(n=r,!BX.includes(n))return i?{token:" ",offset:o}:null;i||(i=!0)}var n}const UX={[gX]:"identifier",[mX]:"nameIdentifier"},GX=new KM(((e,t)=>{QX&&console.log("%s: T <identifier | nameIdentifier>",e.pos);const n=function(e,t){const n=t.contextKeys(),i=t.tokens;for(let t=0,o=[],r=null;;){const s=i.length+o.length>0,a=o.length>0,l=WX(e,t,s)||s&&YX(e,t)||a&&HX(e,t);if(!l)return r;const{token:c,offset:u}=l;if(t+=u," "===c)continue;o=[...o,c];const h=[...i,...o].join(" ");if(n.some((e=>e===h))){const e=o[0];r={token:e,offset:e.length,term:123}}if(!n.some((e=>e.startsWith(h)))){if(iz.some((e=>e===h))){const e=o[0];r={token:e,offset:e.length,term:122}}if(!iz.some((e=>e.startsWith(h))))return r}}}(e,t.context),i=t.context.tokens,o=n||WX(e,0,i.length>0);o&&(e.advance(o.offset),e.acceptToken(n?n.term:122),IX&&console.log("%s: MATCH <%s> <%s>",e.pos,n?UX[n.term]:"identifier",o.token))}),{contextual:!0}),ZX=new KM(((e,t)=>{QX&&console.log("%s: T <propertyIdentifier>",e.pos);const n=WX(e,0,t.context.tokens.length>0);n&&(e.advance(n.offset),e.acceptToken(121),IX&&console.log("%s: MATCH <propertyIdentifier> <%s>",e.pos,n.token))})),KX=new KM(((e,t)=>{let n;QX&&console.log("%s: T <insertSemi>",e.pos);let i=!1;for(n=0;;n++){const t=e.peek(n);if(!BX.includes(t)){NX.includes(t)&&(i=!0);break}}if(i){const t=WX(e,n+1);if(HX(e,n+1)||t&&/^(then|else|return|satisfies)$/.test(t.token))return;IX&&console.log("%s: MATCH <insertSemi>",e.pos),e.acceptToken(124)}})),JX={[PX]:"FunctionInvocation",[SX]:"FilterExpression",[kX]:"PathExpression"},ez={[LX]:"Context",[MX]:"FunctionDefinition",[yX]:"ForExpression",[TX]:"List",[_X]:"IfExpression",[OX]:"QuantifiedExpression"},tz={[DX]:"Context",[AX]:"FunctionDefinition",[vX]:"ForExpression",[RX]:"List",[bX]:"IfExpression",[xX]:"QuantifiedExpression",[CX]:"PathExpression",[$X]:"FunctionInvocation",[EX]:"FilterExpression",[wX]:"ArithmeticExpression"};let nz=class e{constructor(e){this.fn=e}get(e){return this.fn(e)}static of(t){return new e(t)}};const iz=Object.keys({"date and time":1,date:1,time:1,duration:1});let oz=class{constructor(e={}){this.value=e}getKeys(){return Object.keys(this.value)}get(e){const t=this.value[e],n=this.constructor;return n.isAtomic(t)?t:n.of(t)}set(e,t){return this.constructor.of({...this.value,[e]:t})}merge(e){const t=this.constructor;return new t(t.__merge(this.value,e))}static isAtomic(e){return!e||e instanceof this||e instanceof nz||"object"!=typeof e}static of(...e){return e.reduce(((e,t)=>e.merge(t)),new this({}))}static __unwrap(e){return e?e instanceof this?e.value:"object"!=typeof e?{}:{...e}:{}}static __merge(e,t){return E(this.__unwrap(t),((e,t,n)=>t instanceof nz?{...e,[n]:t}:(t=this.__unwrap(t),O(e,n)&&(t=this.__merge(this.__unwrap(e[n]),t)),{...e,[n]:t})),this.__unwrap(e))}},rz=class e{constructor({name:e="Expressions",tokens:t=[],children:n=[],parent:i=null,context:o,value:r,raw:s}){this.name=e,this.tokens=t,this.children=n,this.parent=i,this.context=o,this.value=r,this.raw=s}enterScope(e){const t=this.of({name:e,parent:this});return jX&&console.log("[%s] enter",t.path,t.context),t}exitScope(e){return this.parent?(jX&&console.log("[%s] exit %o\n%s",this.path,this.context,zX(e," ")),this.parent.pushChild(this)):(jX&&console.log("[%s] NO exit %o\n%s",this.path,this.context,zX(e," ")),this)}token(e){return jX&&console.log("[%s] token <%s> + <%s>",this.path,this.tokens.join(" "),e),this.assign({tokens:[...this.tokens,e]})}literal(e){return jX&&console.log("[%s] literal %o",this.path,e),this.pushChild(this.of({name:"Literal",value:e}))}computedValue(){for(let e=this;;e=cz(e.children)){if(!e)return null;if(e.value)return e.value}}contextKeys(){return this.context.getKeys().map(sz)}get path(){return this.parent?.path?.concat(" > ",this.name)||this.name}get(e){const t=[e,e&&sz(e)],n=this.context.getKeys().find((e=>t.includes(sz(e))));if(void 0===n)return;const i=this.context.get(n);return i instanceof nz?i.get(this):i}resolveName(){const e=this.tokens.join(" "),t=this.assign({tokens:[]}),n=this.of({name:"VariableName",parent:t,value:this.get(e),raw:e});return jX&&console.log("[%s] resolve name <%s=%s>",n.path,e,this.get(e)),t.pushChild(n)}pushChild(e){if(!e)return this;const t=this.assign({children:[...this.children,e]});return e.parent=t,t}pushChildren(e){let t=this;for(const n of e)t=t.pushChild(n);return t}declareName(){if(0===this.tokens.length)throw Error("no tokens to declare name");const e=this.tokens.join(" ");return jX&&console.log("[%s] declareName <%s>",this.path,e),this.assign({tokens:[]}).pushChild(this.of({name:"Name",value:e}))}define(e,t){if("string"!=typeof e)return jX&&console.log("[%s] no define <%s=%s>",this.path,e,t),this;jX&&console.log("[%s] define <%s=%s>",this.path,e,t);const n=this.context.set(e,t);return this.assign({context:n})}assign(t={}){return e.of({...this,...t})}of(t={}){const n={context:this.context,parent:this.parent};return e.of({...n,...t})}static of(t){const{name:n,tokens:i=[],children:o=[],parent:r=null,context:s,value:a,raw:l}=t;if(!s)throw new Error("must provide <context>");return new e({name:n,tokens:[...i],children:[...o],context:s,parent:r,value:a,raw:l})}};function sz(e){return e.replace(/\s*([./\-'+]|\*\*?)\s*/g," $1 ").replace(/\s{2,}/g," ").trim()}function az(e,t,n){const i=e.children.filter((e=>e.name!==t)),o=e.children.filter((e=>e.name===t)),r=i[0],s=i[Math.max(1,i.length-1)],a=r?.computedValue(),l=s?.computedValue()||null;return e.assign({children:o}).enterScope(t).pushChildren(i).exitScope(n).define(a,l)}const lz=function(e={},t=oz){const n=rz.of({context:t.of(e)});return new uD({start:n,reduce(e,n,i,o){if(19===n){const[n,i]=e.children.slice(-2);e=e.assign({value:t.of(n?.computedValue(),i?.computedValue())})}if(89===n&&(e=e.assign({value:t.of(...e.children.map((e=>e?.computedValue())))})),70===n){const[t,n]=e.children.slice(-2);e=e.assign({value:t?.computedValue()})}if(72===n){const[t,...n]=e.children;"get value"===t?.raw&&(e=function(e,t){if(!t.length)return e.assign({value:null});"Name"===t[0].name&&(t=function(e,t){const n={};for(let t=0;t<e.length;t+=2){const[i,o]=e.slice(t,t+2);n[i.value]=o}return t.map((e=>n[e]))}(t,["m","key"]));if(2!==t.length)return e.assign({value:null});const[n,i]=t,o=i?.computedValue(),r=n?.computedValue();if(!r||"object"!=typeof r||"string"!=typeof o)return e.assign({value:null});return e.assign({value:[sz(o),o].reduce(((e,t)=>r.get(t)||e),null)})}(e,n))}const r=ez[n];if(r)return e.enterScope(r);const s=JX[n];if(s){const{children:i,context:o}=e,r=i.slice(0,-1),a=cz(i);let l=null;return 154===n&&(l=t.of(a?.computedValue())),155===n&&(l=t.of(o,a?.computedValue()).set("item",a?.computedValue())),e.assign({children:r}).enterScope(s).pushChild(a).assign({context:l||o})}const a=o.read(o.pos,i.pos);if(tz[n])return e.exitScope(a);if(98===n){const n=e.children.filter((e=>"ContextEntry"!==e.name)),i=n[0],o=cz(n);return az(e,"ContextEntry",a).assign({value:t.of(e.value).set(i?.computedValue(),o?.computedValue())})}if(7===n||27===n)return az(e,"InExpression",a);if(139===n)return e.define("partial",nz.of((e=>cz(e.children)?.computedValue())));if(76===n){const t=cz(e.children).computedValue();return e.define(t,1)}if(145===n||146===n||147===n){const t=e.children.slice(0,-1),n=cz(e.children);return e.assign({children:t}).enterScope("ArithmeticExpression").pushChild(n)}if(148===n)return e.enterScope("ArithmeticExpression");if(9===n||10===n||101===n)return e.token(a);if(80===n)return e.literal(a.replace(/^"|"$/g,""));if(81===n)return e.literal("true"===a);if(79===n)return e.literal(parseFloat(a));if(161===n)return e.literal(null);if(47===n)return e.resolveName();if(8===n||100===n)return e.declareName();if((128===n||37===n)&&e.tokens.length>0)throw new Error("uncleared name");if(128===n){let t=e;for(;t.parent;)t=t.exitScope(a);return t}return e}})}({});function cz(e){return e[e.length-1]}const uz=uP({StringLiteral:RP.string,NumericLiteral:RP.number,BooleanLiteral:RP.bool,"AtLiteral!":RP.special(RP.string),CompareOp:RP.compareOperator,ArithOp:RP.arithmeticOperator,"for if then else some every satisfies between return":RP.controlKeyword,"in instance of and or":RP.operatorKeyword,function:RP.definitionKeyword,as:RP.keyword,"Type/...":RP.typeName,Wildcard:RP.special(RP.variableName),null:RP.null,LineComment:RP.lineComment,BlockComment:RP.blockComment,'VariableName! "?"':RP.variableName,"DateTimeConstructor! SpecialFunctionName!":RP.function(RP.special(RP.variableName)),"List Interval":RP.list,Context:RP.definition(RP.literal),"Name!":RP.definition(RP.variableName),"Key/Name! ContextEntryType/Name!":RP.definition(RP.propertyName),"PathExpression/VariableName!":RP.function(RP.propertyName),"FormalParameter/ParameterName!":RP.function(RP.definition(RP.variableName)),"( )":RP.paren,"[ ]":RP.squareBracket,"{ }":RP.brace,".":RP.derefOperator,", ;":RP.separator,"..":RP.punctuation}),hz={__proto__:null,for:10,in:32,return:36,if:40,then:42,else:44,some:48,every:50,satisfies:56,or:60,and:64,between:72,instance:86,of:89,days:101,time:103,duration:105,years:107,months:109,date:111,list:117,context:123,function:130,null:156,true:330,false:330,"?":170,external:186,not:211},dz=hD.deserialize({version:14,states:"C|O`QYOOO`QYOOO$sQYOOOOQU'#Ce'#CeO$}QYO'#C`O&WQYO'#FQOOQQ'#Ff'#FfO&bQYO'#FfO`QYO'#DVOOQU'#En'#EnO(UQ^O'#D]OOQU'#D^'#D^OOQU'#D]'#D]OOQO'#Fn'#FnO*RQWO'#DvOOQQ'#D}'#D}OOQQ'#EO'#EOOOQQ'#EP'#EPO*WOWO'#ESO*RQWO'#EQOOQQ'#EQ'#EQOOQQ'#Ft'#FtOOQQ'#Fr'#FrOOQQ'#Fy'#FyOOQQ'#EU'#EUO`QYO'#EWOOQQ'#FS'#FSO*]Q^O'#FSO,SQYO'#EXO,ZQWO'#EYOOQP'#F}'#F}O,`QXO'#EaOOQQ'#Fz'#FzOOQQ'#FR'#FRQOQWOOOOQQ'#FT'#FTOOQQ'#F^'#F^O`QYO'#CoOOQQ'#F_'#F_O$}QYO'#CsO,kQYO'#DwOOQQ'#Fs'#FsO,pQYO'#EROOQO'#ER'#ERO`QYO'#EVO`QYO'#EUOOQO'#F{'#F{Q,xQWOOO,}QYO'#DRO-tQWO'#FbOOQO'#DT'#DTO.PQYO'#FfO.WQWOOO.}QYO'#CdO/[QYO'#FVOOQQ'#Cc'#CcO/aQYO'#FUOOQQ'#Cb'#CbO/iQYO,58zO`QYO,59iOOQQ'#Fc'#FcOOQQ'#Fd'#FdOOQQ'#Fe'#FeO`QYO,59qO`QYO,59qO`QYO,59qOOQQ'#Fl'#FlO/nQYO,5:^OOQQ'#Fm'#FmO`QYO,5:`O`QYO,59eO`QYO,59gO`QYO,59iO1jQYO,59iO1qQYO,59rOOQQ,5:i,5:iO1vQYO,59qOOQU-E8l-E8lO3jQYO'#FoOOQQ,5:b,5:bOOQQ,5:n,5:nOOQQ,5:l,5:lO3qQYO,5:rOOQQ,5;n,5;nO3{QYO,5:qO4YQWO,5:sO4_QYO,5:tOOQP'#Ee'#EeO5UQXO'#EdOOQO'#Ec'#EcO5]QWO'#EbO5bQWO'#GOO5jQWO,5:{O5oQYO,59ZO/[QYO'#FaOOQQ'#Cw'#CwO5vQYO'#F`OOQQ'#Cv'#CvO6OQYO,59_O6TQYO,5:cO6YQYO,5:mO3tQYO,5:qO6_QYO,5:pO`QYO'#EwQ,xQWOOO`QYO'#EmO7UQWO,5;|O`QYOOOOQR'#Cf'#CfOOQQ'#Ej'#EjO8OQYO,59OO`QYO,5;qOOQQ'#FY'#FYO$}QYO'#EkO8`QYO,5;pO`QYO1G.fOOQQ'#F]'#F]O9VQYO1G/TO;|QYO1G/]O<WQYO1G/]O<bQYO1G/]OOQQ1G/x1G/xO>UQYO1G/zO>]QYO1G/PO?fQYO1G/RO@oQYO1G/TO`QYO1G/TOOQQ1G/T1G/TOAVQYO1G/^OAtQ^O'#CdOCWQYO'#FqOOQO'#Dz'#DzOCbQWO'#DyOCgQWO'#FpOOQO'#Dx'#DxOOQO'#D{'#D{OCoQWO,5<ZOOQQ1G0^1G0^O`QYO1G0]O`QYO'#EsOCtQWO,5<]OOQQ1G0_1G0_ODPQWO'#E[OD[QWO'#F|OOQO'#EZ'#EZODdQWO1G0`OOQP'#Eu'#EuODiQXO,5;OO`QYO,5:|ODpQXO'#EvODxQWO,5<jOOQQ1G0g1G0gO`QYO1G.uO`QYO,5;{O$}QYO'#ElOEQQYO,5;zO`QYO1G.yOEYQYO1G/}OOQO1G0X1G0XOOQO,5;c,5;cOOQO-E8u-E8uOOQO,5;X,5;XOOQO-E8k-E8kOE_QWOOOOQQ-E8h-E8hOEdQYO'#CmOOQQ1G1]1G1]OOQQ,5;V,5;VOOQQ-E8i-E8iOEqQYO7+$QOOQQ7+%f7+%fO`QYO7+$oOFhQYO,5:rOFuQWO7+$oOFzQYO'#D[OOQQ'#DZ'#DZOHnQYO'#D_OHsQYO'#D_OHxQYO'#D_OH}Q`O'#DgOISQ`O'#DjOIXQ`O'#DnOOQQ7+$x7+$xO`QYO,5:eO$}QYO'#ErOI^QWO,5<[OOQQ1G1u1G1uOJdQYO7+%wOJqQYO,5;_OOQO-E8q-E8qOAVQYO,5:vO$}QYO'#EtOKOQWO,5<hOKWQYO7+%zOOQP-E8s-E8sOK_QYO1G0hOOQO,5;b,5;bOOQO-E8t-E8tOKiQYO7+$aOKpQYO1G1gOOQQ,5;W,5;WOOQQ-E8j-E8jOKzQYO7+$eOOQO7+%i7+%iO`QYO,59XOLqQYO<<HZOOQQ<<HZ<<HZO/nQYO'#EoOMzQYO,59vO! nQYO,59yO! sQYO,59yO! xQYO,59yO! }QYO,5:RO$}QYO,5:UO!!lQbO,5:YO!!sQYO1G0POOQO,5;^,5;^OOQO-E8p-E8pO!!}QYO<<IcOOQQ<<Ic<<IcOOQO1G0b1G0bOOQO,5;`,5;`OOQO-E8r-E8rO!%|QYO'#E^OOQQ<<If<<IfO`QYO<<IfO`QYO<<G{O!&sQYO1G.sOOQQ,5;Z,5;ZOOQQ-E8m-E8mO!&}QYO1G/eOOQQ1G/e1G/eO!'SQbO'#D]O!'eQ`O'#D[O!'pQ`O1G/mO!'uQWO'#DmO!'zQ`O'#FhOOQO'#Dl'#DlO!(SQ`O1G/pOOQO'#Dq'#DqO!(XQ`O'#FjOOQO'#Dp'#DpO!(aQ`O1G/tOOQQAN?QAN?QO!(fQYOAN=gOOQQ7+%P7+%PO!)]Q`O,59vOOQQ7+%X7+%XO! }QYO,5:XO$}QYO'#EpO!)hQ`O,5<SOOQQ7+%[7+%[O! }QYO'#EqO!)pQ`O,5<UO!)xQ`O7+%`OOQO1G/s1G/sOOQO,5;[,5;[OOQO-E8n-E8nOOQO,5;],5;]OOQO-E8o-E8oOAVQYO<<HzOOQQAN>fAN>fO/nQYO'#EoO! }QYO<<HzO!)}Q`O7+%`O!*SQ`O1G/tO!!lQbO,5:YO!*XQ`O'#Dn",stateData:"!*h~O#rOS#sOSPOSQOS~OTsOZVO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$kaO$lbO~OTsO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$kaO$lbO~OZ!TO#]!UO~P#SO#nRO#oRO~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO!i!fO#z!dOv$bX~O#l#tX$s#tX~P%VO$i!mOT$YXZ$YX[$YXd$YXh$YXi$YXr$YXs$YXv$YX!T$YX!U$YX!V$YX!X$YX!c$YX!g$YX!i$YX!p$YX!w$YX#S$YX#n$YX#o$YX$Z$YX$j$YX$k$YX$l$YX~O#nRO#oROZ!PX[!PX]!PX^!PX_!PX`!PXn!PXp!PXr!PXs!PXt!PXv!PX{!PX!i!PX#l!PX#p!PX#z!PX$s!PX$O!PXx!PX#}!PX!g!PXe!PXb!PX#R!PXf!PXl!PX~Ov!pO~O$j`O~O#p!uOZ#vX[#vX]#vX^#vX_#vX`#vXn#vXp#vXr#vXs#vXt#vXv#vX{#vX!i#vX#l#vX#z#vX$s#vX$O#vXx#vX#}#vX!g#vXe#vXb#vX#R#vXf#vXl#vX~O!g$eP~P`Ov!xO~O#m!yO$j`O#R$rP~Op#VO~Op#WOv!uX~O$s#ZO~O#luX$OuX$suXxuX#}uX!guXeuXbuX#RuXfuXluX~P%VO$O#]O#l$UXx$UX~O#l#[X~P&bOv#_O~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O$]WX~O`WXxWX$OWX~P.]O`#dO~O$O#eOb#xX~Ob#hO~O#nRO#oRO$ZZO~OTsOZVO[UOdtOhvOivOr}Os}O!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$kaO$lbO~Ov#rO~P/yO|#tO~O{!lO!i!fO#z!dOZya[ya]ya^ya_ya`yanyapyaryasyatyav$bX#lya$sya$Oyaxya#}ya!gyaeyabya#Ryafyalya~Ox$eP~P`Ox#}O#}$OO~P%VO#}$OO$O$PO!g$eX~P%VO!g$RO~O#nRO#oROx$pP~OZ#`O[#`O]#`O^#`O_#`O#m!yO#z#`O#{#`O~O$]#WX~P4jO$]$YO~O$O$ZO#R$rX~O#R$]O~Oe$^O~P%VO$O$`Ol$SX~Ol$bO~O!W$cO~O!T$dO~O#l!xa$s!xa$O!xax!xa#}!xa!g!xae!xab!xa#R!xaf!xal!xa~P%VO$O#]O#l$Uax$Ua~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O~O`Wa$]WaxWa$OWa~P7aO$O#eOb#xa~OZ!^O[!^O]!_O^!_O_!`O{!lO!i!fO#z!dOv$bX~O`qinqipqirqisqitqi#lqi$sqi$Oqixqi#}qi!gqieqibqi#Rqifqilqi~P8hO_!`O{!lO!i!fO#z!dOZyi[yi`yinyipyiryisyityiv$bX#lyi$syi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O]!_O^!_O~P:`O]yi^yi~P:`O{!lO!i!fO#z!dOZyi[yi]yi^yi_yi`yinyipyiryisyityiv$bX#lyi$syi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O!g$pO~P%VO`!kOp!iOr!]Os!]Ot!jOnmi#lmi$smi$Omixmi#}mi!gmiemibmi#Rmifmilmi~P8hO`!kOr!]Os!]Ot!jOnoipoi#loi$soi$Ooixoi#}oi!goieoiboi#Roifoiloi~P8hO`!kOn!hOp$qOr!]Os!]Ot!jO~P8hO!S$vO!V$wO!X$xO![$yO!_$zO!c${O#nRO#oRO$ZZO~OZ#bX[#bX]#bX^#bX_#bX`#bXn#bXp#bXr#bXs#bXt#bXv#bXx#bX{#bX!i#bX#n#bX#o#bX#p#bX#z#bX$O#bX~P.]O$O$POx$eX~P%VO$]$}O~O$O%OOx$dX~Ox%QO~O$O$PO!g$eax$ea~O$]%UOx#OX$O#OX~O$O%VOx$pX~Ox%XO~O$]#Wa~P4jO#m!yO$j`O~O$O$ZO#R$ra~O$O$`Ol$Sa~O!U%cO~OxrO~O#}%dObaX$OaX~P%VO#lSq$sSq$OSqxSq#}Sq!gSqeSqbSq#RSqfSqlSq~P%VOx#}O#}$OO$OuX~P%VOx%fO~O#z%gOZ!OX[!OX]!OX^!OX_!OX`!OXn!OXp!OXr!OXs!OXt!OXv!OX{!OX!i!OX#l!OX$s!OX$O!OXx!OX#}!OX!g!OXe!OXb!OX#R!OXf!OXl!OX~Op%iO~Op%jO~Op%kO~O!]%lO~O!]%mO~O!]%nO~O$O%OOx$da~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO#z!dOv$bX~Ox%sO!g%sO!i%rO~PIfO!g#ga$O#gax#ga~P%VO$O%VOx$pa~O#P%yO~P`O#R#Ui$O#Ui~P%VOf%zO~P%VOl$Ti$O$Ti~P%VO#lgq$sgq$Ogqxgq#}gq!ggqegqbgq#Rgqfgqlgq~P%VO`qynqypqyrqysqytqy#lqy$sqy$Oqyxqy#}qy!gqyeqybqy#Rqyfqylqy~P8hO#z%gOZ!Oa[!Oa]!Oa^!Oa_!Oa`!Oan!Oap!Oar!Oas!Oat!Oav!Oa{!Oa!i!Oa#l!Oa$s!Oa$O!Oax!Oa#}!Oa!g!Oae!Oab!Oa#R!Oaf!Oal!Oa~O!T&OO~O!W&OO~O!T&PO~O!S$vO!V$wO!X$xO![$yO!_$zO!c&uO#nRO#oRO$ZZO~O!Y$^P~P! }Ox!mi$O!mi~P%VOT$aXZ$aX[$aX]!yy^!yy_!yy`!yyd$aXh$aXi$aXn!yyp!yyr$aXs$aXt!yyv$aX{!yy!T$aX!U$aX!V$aX!X$aX!c$aX!g$aX!i$aX!p$aX!w$aX#S$aX#l!yy#n$aX#o$aX#z!yy$Z$aX$i$aX$j$aX$k$aX$l$aX$s!yy$O!yyx!yy#}!yye!yyb!yy#R!yyf!yyl!yy~O#l#QX$s#QX$O#QXx#QX#}#QX!g#QXe#QXb#QX#R#QXf#QXl#QX~P%VObai$Oai~P%VO!U&_O~O#nRO#oRO!Y!PX#z!PX$O!PX~O#z&pO!Y!OX$O!OX~O!Y&aO~O$]&bO~O$O&cO!Y$[X~O!Y&eO~O$O&fO!Y$^X~O!Y&hO~O#lc!R$sc!R$Oc!Rxc!R#}c!R!gc!Rec!Rbc!R#Rc!Rfc!Rlc!R~P%VO#z&pO!Y!Oa$O!Oa~O$O&cO!Y$[a~O$O&fO!Y$^a~O$_&nO~O$_&qO~O!Y&rO~O!]&tO~O$Z~QP_^$i]#z~",goto:"E|$sPPPP$tP%m%p%v&Y'sPPPPPP'|P$tPPP$tPP(P(SP$tP$tP$tPPP(YP(eP$t$tPP(n)T)`*m)TPPPPPPP)TPP)TP+r+u)TP+{,R$tP$tP$t,Y-R-U-[-RP-d.]-d-d/]0UP$t0}$t1v1v2o2rP2xPP1v3O3U/X3YPP3bP3e3l3r3x4O5Z5e5k5q5w6O6U6[6bPPPPPPPP6h6q8x9q:j:mPP:qPP:w:z;s<l<o<s<x=g>V>vP?oP?rP?v@iA[BTBZB^$tBdBdPPPPC]8xDUD}EQEy!mjOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR![SQ!YSR$m#eS!WS#eS#Qw$`W#w!p!x%O%VT&T%m&c#WXOPQWYilu|}!]!a!b!c!e!g!h!i!j!k#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&Q&b&f&n&p&q&tb!VSw!x#e$`%O%V%m&cU#a!V#b#uR#u!pU#a!V#b#uT$W!z$XR$l#cR#UwQ#SwR%`$`U!RQ#_#rQ#s!kR$g#]QrQQ$i#_R$s#rQ$|#tQ%t%UQ&S%lU&X%n&f&tQ&i&bT&o&n&qc$u#t%U%l%n&b&f&n&q&t!lkOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ#m!eU$t#t%U&nS%|%g&p]&R%l%n&b&f&q&t#V[OPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&b&f&n&p&q&tR&W%mQ&U%mR&j&cQ&[%nR&s&tS&Y%n&tR&l&f!m]OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#|!pQ#y!pR%p%OS#x!p%OT$S!x%V!meOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!leOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!rbT!{o$Z!mcOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mdOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mhOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mpOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$V!xQ$T!xR%u%VQ%x%XR&]%yQ!}oR%[$ZT!|o$ZS!zo$ZT$W!z$XRrQS#b!V#uR$j#bQ#f!YR$n#fQ$a#SR%a$aQ#^!RR$h#^!vYOPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%y%z&nS!oY&Q_&Q%l%n&b&f&p&q&tQ%h$tS%}%h&`R&`&RQ&d&UR&k&dQ&g&YR&m&gQ%P#yR%q%PS$Q!v#vR%T$QQ%W$TR%v%WQ$X!zR%Y$XQ$[!}R%]$[Q#[!PR$f#[QrOQ!PPR$e#ZUTOP#ZW!QQ!k#]#_Q!nWQ!tiQ!vlQ#PuQ#X|Q#Y}Q#i!]Q#j!aQ#k!bQ#l!cQ#n!gQ#o!hQ#p!iQ#q!jQ#v!pQ$k#cQ$o#gQ$r#rQ%R$OQ%S$PQ%Z$YQ%^$^Q%_$_Q%b$bQ%e$qQ%o$}S%w%X%yQ%{%dR&^%z!mqOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mSOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR!ZST!XS#eQ#c!WR$_#QR#g![!muOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mwOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#TwT#Rw$`V!SQ#_#r!X!aT!Q!t!v#P#X#Y#i#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!Z!bT!Q!t!v#P#X#Y#i#j#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!]!cT!Q!t!v#P#X#Y#i#j#k#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!mWOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR&V%mT&Z%n&t!a!eT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!a!gT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!m^OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!q^R!scR#z!pQ!wlR#{!p!mfOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mlOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mmOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$U!x!moOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#Oo",nodeNames:"⚠ LineComment BlockComment Expression ForExpression for InExpressions InExpression Name Identifier Identifier ArithOp ArithOp ArithOp ArithOp ArithOp in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression InstanceOfExpression instance of Type QualifiedName VariableName BacktickIdentifier SpecialType days time duration years months date > ListType list < ContextType context ContextEntryTypes ContextEntryType FunctionType function ArgumentTypes ArgumentType PathExpression ] FilterExpression [ FunctionInvocation SpecialFunctionName NamedParameters NamedParameter ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral DateTimeConstructor AtLiteral ? SimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition FormalParameters FormalParameter external FunctionBody } { Context ContextEntry Key Name Identifier Expressions UnaryTests Wildcard not",maxTerm:173,context:lz,nodeProps:[["group",-17,4,19,23,29,31,33,41,42,68,70,72,85,86,88,89,90,97,"Expr",47,"Expr Expr",-5,78,79,80,81,82,"Expr Literal"],["closedBy",38,")",71,"]",96,"}"],["openedBy",40,"(",69,"[",95,"{"]],propSources:[uz],skippedNodes:[0,1,2],repeatNodeCount:14,tokenData:".Z~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx&fxy&kyz&pz{&u{|'S|}'X}!O'^!O!P'k!P!Q(u!Q![*p![!]+X!]!^+^!^!_+c!_!`$i!`!a+r!b!c+|!}#O,R#P#Q,W#Q#R&}#S#T,]#o#p.P#q#r.U$f$g#i#BY#BZ#i$IS$I_#i$I|$I}$^$I}$JO$^$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~#nY#r~XY#iZ[#ipq#i$f$g#i#BY#BZ#i$IS$I_#i$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~$cO#s~~$fP!_!`$i~$nOr~~$sW$j~OY$nZr$nrs%]s#O$n#O#P%b#P;'S$n;'S;=`&`<%lO$n~%bO$j~~%eRO;'S$n;'S;=`%n;=`O$n~%sX$j~OY$nZr$nrs%]s#O$n#O#P%b#P;'S$n;'S;=`&`;=`<%l$n<%lO$n~&cP;=`<%l$n~&kO#{~~&pOv~~&uOx~~&zP^~z{&}~'SO_~~'XO[~~'^O$O~R'cPZP!`!a'fQ'kO$_Q~'pQ#z~!O!P'v!Q!['{~'{O#}~~(QR$i~!Q!['{!g!h(Z#X#Y(Z~(^R{|(g}!O(g!Q![(m~(jP!Q![(m~(rP$i~!Q![(m~(zQ]~z{)Q!P!Q*X~)TTOz)Qz{)d{;'S)Q;'S;=`*R<%lO)Q~)gVOz)Qz{)d{!P)Q!P!Q)|!Q;'S)Q;'S;=`*R<%lO)Q~*ROQ~~*UP;=`<%l)Q~*^SP~OY*XZ;'S*X;'S;=`*j<%lO*X~*mP;=`<%l*X~*uS$i~!O!P+R!Q![*p!g!h(Z#X#Y(Z~+UP!Q!['{~+^O$]~~+cO$s~R+jP!]QsP!_!`+mP+rOsPR+yP!YQsP!_!`+m~,RO$l~~,WO!i~~,]O!g~~,`WOY,]Z#O,]#O#P,x#P#S,]#S#T-t#T;'S,];'S;=`-y<%lO,]~,{RO;'S,];'S;=`-U;=`O,]~-XXOY,]Z#O,]#O#P,x#P#S,]#S#T-t#T;'S,];'S;=`-y;=`<%l,]<%lO,]~-yO$Z~~-|P;=`<%l,]~.UO#S~~.ZO#R~",tokenizers:[ZX,GX,KX,0,1],topRules:{Expression:[0,3],Expressions:[1,102],UnaryTests:[2,103]},dialects:{camunda:2544},dynamicPrecedences:{31:-1,68:1,72:-1,74:-1},specialized:[{term:122,get:e=>hz[e]||-1}],tokenPrec:2546});class pz{static create(e,t,n,i,o){return new pz(e,t,n,i+(i<<8)+e+(t<<4)|0,o,[],[])}constructor(e,t,n,i,o,r,s){this.type=e,this.value=t,this.from=n,this.hash=i,this.end=o,this.children=r,this.positions=s,this.hashProp=[[y$.contextHash,i]]}addChild(e,t){e.prop(y$.contextHash)!=this.hash&&(e=new E$(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new E$(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new E$(x$.none,e,t,n,this.hashProp)})}}var fz;!function(e){e[e.Document=1]="Document",e[e.CodeBlock=2]="CodeBlock",e[e.FencedCode=3]="FencedCode",e[e.Blockquote=4]="Blockquote",e[e.HorizontalRule=5]="HorizontalRule",e[e.BulletList=6]="BulletList",e[e.OrderedList=7]="OrderedList",e[e.ListItem=8]="ListItem",e[e.ATXHeading1=9]="ATXHeading1",e[e.ATXHeading2=10]="ATXHeading2",e[e.ATXHeading3=11]="ATXHeading3",e[e.ATXHeading4=12]="ATXHeading4",e[e.ATXHeading5=13]="ATXHeading5",e[e.ATXHeading6=14]="ATXHeading6",e[e.SetextHeading1=15]="SetextHeading1",e[e.SetextHeading2=16]="SetextHeading2",e[e.HTMLBlock=17]="HTMLBlock",e[e.LinkReference=18]="LinkReference",e[e.Paragraph=19]="Paragraph",e[e.CommentBlock=20]="CommentBlock",e[e.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",e[e.Escape=22]="Escape",e[e.Entity=23]="Entity",e[e.HardBreak=24]="HardBreak",e[e.Emphasis=25]="Emphasis",e[e.StrongEmphasis=26]="StrongEmphasis",e[e.Link=27]="Link",e[e.Image=28]="Image",e[e.InlineCode=29]="InlineCode",e[e.HTMLTag=30]="HTMLTag",e[e.Comment=31]="Comment",e[e.ProcessingInstruction=32]="ProcessingInstruction",e[e.Autolink=33]="Autolink",e[e.HeaderMark=34]="HeaderMark",e[e.QuoteMark=35]="QuoteMark",e[e.ListMark=36]="ListMark",e[e.LinkMark=37]="LinkMark",e[e.EmphasisMark=38]="EmphasisMark",e[e.CodeMark=39]="CodeMark",e[e.CodeText=40]="CodeText",e[e.CodeInfo=41]="CodeInfo",e[e.LinkTitle=42]="LinkTitle",e[e.LinkLabel=43]="LinkLabel",e[e.URL=44]="URL"}(fz||(fz={}));class gz{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}}class mz{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return _z(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let i=t;i<e;i++)n+=9==this.text.charCodeAt(i)?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=9==this.text.charCodeAt(t)?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e="";for(let t=0;t<this.basePos;t++)e+=" ";return e+this.text.slice(this.basePos)}}function vz(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let i=(e.type==fz.OrderedList?Sz:Ez)(n,t,!1);return i>0&&(e.type!=fz.BulletList||Cz(n,t,!1)<0)&&n.text.charCodeAt(n.pos+i-1)==e.value}const yz={[fz.Blockquote]:(e,t,n)=>62==n.next&&(n.markers.push(tY(fz.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(bz(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0),[fz.ListItem]:(e,t,n)=>!(n.indent<n.baseIndent+e.value&&n.next>-1)&&(n.moveBaseColumn(n.baseIndent+e.value),!0),[fz.OrderedList]:vz,[fz.BulletList]:vz,[fz.Document]:()=>!0};function bz(e){return 32==e||9==e||10==e||13==e}function _z(e,t=0){for(;t<e.length&&bz(e.charCodeAt(t));)t++;return t}function xz(e,t,n){for(;t>n&&bz(e.charCodeAt(t-1));)t--;return t}function Oz(e){if(96!=e.next&&126!=e.next)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(96==e.next)for(let n=t;n<e.text.length;n++)if(96==e.text.charCodeAt(n))return-1;return t}function wz(e){return 62!=e.next?-1:32==e.text.charCodeAt(e.pos+1)?2:1}function Cz(e,t,n){if(42!=e.next&&45!=e.next&&95!=e.next)return-1;let i=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)i++;else if(!bz(n))return-1}return n&&45==e.next&&Pz(e)>-1&&e.depth==t.stack.length||i<3?-1:1}function kz(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function Ez(e,t,n){return 45!=e.next&&43!=e.next&&42!=e.next||e.pos!=e.text.length-1&&!bz(e.text.charCodeAt(e.pos+1))||!(!n||kz(t,fz.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?-1:1}function Sz(e,t,n){let i=e.pos,o=e.next;for(;o>=48&&o<=57;){if(i++,i==e.text.length)return-1;o=e.text.charCodeAt(i)}return i==e.pos||i>e.pos+9||46!=o&&41!=o||i<e.text.length-1&&!bz(e.text.charCodeAt(i+1))||n&&!kz(t,fz.OrderedList)&&(e.skipSpace(i+1)==e.text.length||i>e.pos+1||49!=e.next)?-1:i+1-e.pos}function $z(e){if(35!=e.next)return-1;let t=e.pos+1;for(;t<e.text.length&&35==e.text.charCodeAt(t);)t++;if(t<e.text.length&&32!=e.text.charCodeAt(t))return-1;let n=t-e.pos;return n>6?-1:n}function Pz(e){if(45!=e.next&&61!=e.next||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&bz(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}const Tz=/^[ \t]*$/,Rz=/-->/,Az=/\?>/,Mz=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Rz],[/^\s*<\?/,Az],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Tz],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Tz]];function Dz(e,t,n){if(60!=e.next)return-1;let i=e.text.slice(e.pos);for(let e=0,t=Mz.length-(n?1:0);e<t;e++)if(Mz[e][0].test(i))return e;return-1}function Lz(e,t){let n=e.countIndent(t,e.pos,e.indent),i=e.countIndent(e.skipSpace(t),t,n);return i>=n+5?n+1:i}function Iz(e,t,n){let i=e.length-1;i>=0&&e[i].to==t&&e[i].type==fz.CodeText?e[i].to=n:e.push(tY(fz.CodeText,t,n))}const Qz={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let i=t.findColumn(n),o=e.lineStart+i,r=e.lineStart+t.text.length,s=[],a=[];for(Iz(s,o,r);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){Iz(a,e.lineStart-1,e.lineStart);for(let e of t.markers)a.push(e)}else{if(t.indent<n)break;{if(a.length){for(let e of a)e.type==fz.CodeText?Iz(s,e.from,e.to):s.push(e);a=[]}Iz(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e);r=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<r&&Iz(s,n,r)}}return a.length&&(a=a.filter((e=>e.type!=fz.CodeText)),a.length&&(t.markers=a.concat(t.markers))),e.addNode(e.buffer.writeElements(s,-o).finish(fz.CodeBlock,r-o),o),!0},FencedCode(e,t){let n=Oz(t);if(n<0)return!1;let i=e.lineStart+t.pos,o=t.next,r=n-t.pos,s=t.skipSpace(n),a=xz(t.text,t.text.length,s),l=[tY(fz.CodeMark,i,i+r)];s<a&&l.push(tY(fz.CodeInfo,e.lineStart+s,e.lineStart+a));for(let n=!0;e.nextLine()&&t.depth>=e.stack.length;n=!1){let i=t.pos;if(t.indent-t.baseIndent<4)for(;i<t.text.length&&t.text.charCodeAt(i)==o;)i++;if(i-t.pos>=r&&t.skipSpace(i)==t.text.length){for(let e of t.markers)l.push(e);l.push(tY(fz.CodeMark,e.lineStart+t.pos,e.lineStart+i)),e.nextLine();break}{n||Iz(l,e.lineStart-1,e.lineStart);for(let e of t.markers)l.push(e);let i=e.lineStart+t.basePos,o=e.lineStart+t.text.length;i<o&&Iz(l,i,o)}}return e.addNode(e.buffer.writeElements(l,-i).finish(fz.FencedCode,e.prevLineEnd()-i),i),!0},Blockquote(e,t){let n=wz(t);return!(n<0)&&(e.startContext(fz.Blockquote,t.pos),e.addNode(fz.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(Cz(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(fz.HorizontalRule,n),!0},BulletList(e,t){let n=Ez(t,e,!1);if(n<0)return!1;e.block.type!=fz.BulletList&&e.startContext(fz.BulletList,t.basePos,t.next);let i=Lz(t,t.pos+1);return e.startContext(fz.ListItem,t.basePos,i-t.baseIndent),e.addNode(fz.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(i),null},OrderedList(e,t){let n=Sz(t,e,!1);if(n<0)return!1;e.block.type!=fz.OrderedList&&e.startContext(fz.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let i=Lz(t,t.pos+n);return e.startContext(fz.ListItem,t.basePos,i-t.baseIndent),e.addNode(fz.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(i),null},ATXHeading(e,t){let n=$z(t);if(n<0)return!1;let i=t.pos,o=e.lineStart+i,r=xz(t.text,t.text.length,i),s=r;for(;s>i&&t.text.charCodeAt(s-1)==t.next;)s--;s!=r&&s!=i&&bz(t.text.charCodeAt(s-1))||(s=t.text.length);let a=e.buffer.write(fz.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(i+n+1,s),o+n+1),-o);s<t.text.length&&a.write(fz.HeaderMark,s-i,r-i);let l=a.finish(fz.ATXHeading1-1+n,t.text.length-i);return e.nextLine(),e.addNode(l,o),!0},HTMLBlock(e,t){let n=Dz(t,0,!1);if(n<0)return!1;let i=e.lineStart+t.pos,o=Mz[n][1],r=[],s=o!=Tz;for(;!o.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){s=!1;break}for(let e of t.markers)r.push(e)}s&&e.nextLine();let a=o==Rz?fz.CommentBlock:o==Az?fz.ProcessingInstructionBlock:fz.HTMLBlock,l=e.prevLineEnd();return e.addNode(e.buffer.writeElements(r,-i).finish(a,l-i),i),!0},SetextHeading:void 0};class jz{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(-1==this.stage)return!1;let i=n.content+"\n"+t.scrub(),o=this.advance(i);return o>-1&&o<i.length&&this.complete(e,n,o)}finish(e,t){return(2==this.stage||3==this.stage)&&_z(t.content,this.pos)==t.content.length&&this.complete(e,t,t.content.length)}complete(e,t,n){return e.addLeafElement(t,tY(fz.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(!1===e&&(this.stage=-1),!1)}advance(e){for(;;){if(-1==this.stage)return-1;if(0==this.stage){if(!this.nextStage(pY(e,this.pos,this.start,!0)))return-1;if(58!=e.charCodeAt(this.pos))return this.stage=-1;this.elts.push(tY(fz.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else{if(1!=this.stage){if(2==this.stage){let t=_z(e,this.pos),n=0;if(t>this.pos){let i=dY(e,t,this.start);if(i){let t=Bz(e,i.to-this.start);t>0&&(this.nextStage(i),n=t)}}return n||(n=Bz(e,this.pos)),n>0&&n<e.length?n:-1}return Bz(e,this.pos)}if(!this.nextStage(hY(e,_z(e,this.pos),this.start)))return-1}}}}function Bz(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(10==n)break;if(!bz(n))return-1}return t}class Nz{nextLine(e,t,n){let i=t.depth<e.stack.length?-1:Pz(t),o=t.next;if(i<0)return!1;let r=tY(fz.HeaderMark,e.lineStart+t.pos,e.lineStart+i);return e.nextLine(),e.addLeafElement(n,tY(61==o?fz.SetextHeading1:fz.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),r])),!0}finish(){return!1}}const qz={LinkReference:(e,t)=>91==t.content.charCodeAt(0)?new jz(t):null,SetextHeading:()=>new Nz},Fz=[(e,t)=>$z(t)>=0,(e,t)=>Oz(t)>=0,(e,t)=>wz(t)>=0,(e,t)=>Ez(t,e,!0)>=0,(e,t)=>Sz(t,e,!0)>=0,(e,t)=>Cz(t,e,!0)>=0,(e,t)=>Dz(t,0,!0)>=0],Vz={text:"",end:0};class Xz{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.line=new mz,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=pz.create(fz.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new vY(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(null!=this.stoppedAt&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(0!=n){if(1==n)return null;e.forward();continue e}}break}let t=new gz(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4)for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e;for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+="\n"+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return!!t&&(this.absoluteLineStart+=t,this.lineStart=yY(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0)}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=Vz;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let i=this.ranges[n].from,o=this.lineChunkAt(i);t.end=i+o.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+o,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw new Error("Unhandled block context "+fz[t.type]);if(!n(t,this,e))break;e.forward()}}lineChunkAt(e){let t,n=this.input.chunk(e);if(this.input.lineChunks)t="\n"==n?"":n;else{let e=n.indexOf("\n");t=e<0?n:n.slice(0,e)}return e+t.length>this.to?t.slice(0,this.to-e):t}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=pz.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){"number"==typeof e&&(e=new E$(this.parser.nodeSet.types[e],Zz,Zz,(null!=n?n:this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(gY(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?zz(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let t of e.parsers)if(t.finish(this,e))return;let t=gY(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(fz.Paragraph,e.content.length),e.start)}elt(e,t,n,i){return"string"==typeof e?tY(this.parser.getNodeType(e),t,n,i):new eY(e,t)}get buffer(){return new Kz(this.parser.nodeSet)}}function zz(e,t,n,i,o){let r=e[t].to,s=[],a=[],l=n.from+i;function c(n,o){for(;o?n>=r:n>r;){let o=e[t+1].from-r;i+=o,n+=o,t++,r=e[t].to}}for(let u=n.firstChild;u;u=u.nextSibling){c(u.from+i,!0);let n,h=u.from+i,d=o.get(u.tree);d?n=d:u.to+i>r?(n=zz(e,t,u,i,o),c(u.to+i,!1)):n=u.toTree(),s.push(n),a.push(h-l)}return c(n.to+i,!1),new E$(n.type,s,a,n.to+i-l,n.tree?n.tree.propValues:void 0)}class Yz extends z${constructor(e,t,n,i,o,r,s,a,l){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=i,this.endLeafBlock=o,this.skipContextMarkup=r,this.inlineParsers=s,this.inlineNames=a,this.wrappers=l,this.nodeTypes=Object.create(null);for(let t of e.types)this.nodeTypes[t.name]=t.id}createParse(e,t,n){let i=new Xz(this,e,t,n);for(let o of this.wrappers)i=o(i,e,t,n);return i}configure(e){let t=Hz(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:i}=this,o=this.blockParsers.slice(),r=this.leafBlockParsers.slice(),s=this.blockNames.slice(),a=this.inlineParsers.slice(),l=this.inlineNames.slice(),c=this.endLeafBlock.slice(),u=this.wrappers;if(Wz(t.defineNodes)){i=Object.assign({},i);let e,o=n.types.slice();for(let n of t.defineNodes){let{name:t,block:r,composite:s,style:a}="string"==typeof n?{name:n}:n;if(o.some((e=>e.name==t)))continue;s&&(i[o.length]=(e,t,n)=>s(t,n,e.value));let l=o.length,c=s?["Block","BlockContext"]:r?l>=fz.ATXHeading1&&l<=fz.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;o.push(x$.define({id:l,name:t,props:c&&[[y$.group,c]]})),a&&(e||(e={}),Array.isArray(a)||a instanceof aP?e[t]=a:Object.assign(e,a))}n=new O$(o),e&&(n=n.extend(uP(e)))}if(Wz(t.props)&&(n=n.extend(...t.props)),Wz(t.remove))for(let e of t.remove){let t=this.blockNames.indexOf(e),n=this.inlineNames.indexOf(e);t>-1&&(o[t]=r[t]=void 0),n>-1&&(a[n]=void 0)}if(Wz(t.parseBlock))for(let e of t.parseBlock){let t=s.indexOf(e.name);if(t>-1)o[t]=e.parse,r[t]=e.leaf;else{let t=e.before?Uz(s,e.before):e.after?Uz(s,e.after)+1:s.length-1;o.splice(t,0,e.parse),r.splice(t,0,e.leaf),s.splice(t,0,e.name)}e.endLeaf&&c.push(e.endLeaf)}if(Wz(t.parseInline))for(let e of t.parseInline){let t=l.indexOf(e.name);if(t>-1)a[t]=e.parse;else{let t=e.before?Uz(l,e.before):e.after?Uz(l,e.after)+1:l.length-1;a.splice(t,0,e.parse),l.splice(t,0,e.name)}}return t.wrap&&(u=u.concat(t.wrap)),new Yz(n,o,r,s,c,i,a,l,u)}getNodeType(e){let t=this.nodeTypes[e];if(null==t)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new fY(this,e,t);e:for(let e=t;e<n.end;){let t=n.char(e);for(let i of this.inlineParsers)if(i){let o=i(n,t,e);if(o>=0){e=o;continue e}}e++}return n.resolveMarkers(0)}}function Wz(e){return null!=e&&e.length>0}function Hz(e){if(!Array.isArray(e))return e;if(0==e.length)return null;let t=Hz(e[0]);if(1==e.length)return t;let n=Hz(e.slice(1));if(!n||!t)return t||n;let i=(e,t)=>(e||Zz).concat(t||Zz),o=t.wrap,r=n.wrap;return{props:i(t.props,n.props),defineNodes:i(t.defineNodes,n.defineNodes),parseBlock:i(t.parseBlock,n.parseBlock),parseInline:i(t.parseInline,n.parseInline),remove:i(t.remove,n.remove),wrap:o?r?(e,t,n,i)=>o(r(e,t,n,i),t,n,i):o:r}}function Uz(e,t){let n=e.indexOf(t);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${t}`);return n}let Gz=[x$.none];for(let e,t=1;e=fz[t];t++)Gz[t]=x$.define({id:t,name:e,props:t>=fz.Escape?[]:[[y$.group,t in yz?["Block","BlockContext"]:["Block","LeafBlock"]]],top:"Document"==e});const Zz=[];class Kz{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,i=0){return this.content.push(e,t,n,4+4*i),this}writeElements(e,t=0){for(let n of e)n.writeTo(this,t);return this}finish(e,t){return E$.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}}let Jz=class{constructor(e,t,n,i=Zz){this.type=e,this.from=t,this.to=n,this.children=i}writeTo(e,t){let n=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-n)}toTree(e){return new Kz(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class eY{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return Zz}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}}function tY(e,t,n,i){return new Jz(e,t,n,i)}const nY={resolve:"Emphasis",mark:"EmphasisMark"},iY={resolve:"Emphasis",mark:"EmphasisMark"},oY={},rY={};class sY{constructor(e,t,n,i){this.type=e,this.from=t,this.to=n,this.side=i}}const aY="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let lY=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{lY=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch(gV){}const cY={Escape(e,t,n){if(92!=t||n==e.end-1)return-1;let i=e.char(n+1);for(let t=0;t<32;t++)if(aY.charCodeAt(t)==i)return e.append(tY(fz.Escape,n,n+2));return-1},Entity(e,t,n){if(38!=t)return-1;let i=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(e.slice(n+1,n+31));return i?e.append(tY(fz.Entity,n,n+1+i[0].length)):-1},InlineCode(e,t,n){if(96!=t||n&&96==e.char(n-1))return-1;let i=n+1;for(;i<e.end&&96==e.char(i);)i++;let o=i-n,r=0;for(;i<e.end;i++)if(96==e.char(i)){if(r++,r==o&&96!=e.char(i+1))return e.append(tY(fz.InlineCode,n,i+1,[tY(fz.CodeMark,n,n+o),tY(fz.CodeMark,i+1-o,i+1)]))}else r=0;return-1},HTMLTag(e,t,n){if(60!=t||n==e.end-1)return-1;let i=e.slice(n+1,e.end),o=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(i);if(o)return e.append(tY(fz.Autolink,n,n+1+o[0].length,[tY(fz.LinkMark,n,n+1),tY(fz.URL,n+1,n+o[0].length),tY(fz.LinkMark,n+o[0].length,n+1+o[0].length)]));let r=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(i);if(r)return e.append(tY(fz.Comment,n,n+1+r[0].length));let s=/^\?[^]*?\?>/.exec(i);if(s)return e.append(tY(fz.ProcessingInstruction,n,n+1+s[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(i);return a?e.append(tY(fz.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(e,t,n){if(95!=t&&42!=t)return-1;let i=n+1;for(;e.char(i)==t;)i++;let o=e.slice(n-1,n),r=e.slice(i,i+1),s=lY.test(o),a=lY.test(r),l=/\s|^$/.test(o),c=/\s|^$/.test(r),u=!c&&(!a||l||s),h=!l&&(!s||c||a),d=u&&(42==t||!h||s),p=h&&(42==t||!u||a);return e.append(new sY(95==t?nY:iY,n,i,(d?1:0)|(p?2:0)))},HardBreak(e,t,n){if(92==t&&10==e.char(n+1))return e.append(tY(fz.HardBreak,n,n+2));if(32==t){let t=n+1;for(;32==e.char(t);)t++;if(10==e.char(t)&&t>=n+2)return e.append(tY(fz.HardBreak,n,t+1))}return-1},Link:(e,t,n)=>91==t?e.append(new sY(oY,n,n+1,1)):-1,Image:(e,t,n)=>33==t&&91==e.char(n+1)?e.append(new sY(rY,n,n+2,1)):-1,LinkEnd(e,t,n){if(93!=t)return-1;for(let t=e.parts.length-1;t>=0;t--){let i=e.parts[t];if(i instanceof sY&&(i.type==oY||i.type==rY)){if(!i.side||e.skipSpace(i.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[t]=null,-1;let o=e.takeContent(t),r=e.parts[t]=uY(e,o,i.type==oY?fz.Link:fz.Image,i.from,n+1);if(i.type==oY)for(let n=0;n<t;n++){let t=e.parts[n];t instanceof sY&&t.type==oY&&(t.side=0)}return r.to}}return-1}};function uY(e,t,n,i,o){let{text:r}=e,s=e.char(o),a=o;if(t.unshift(tY(fz.LinkMark,i,i+(n==fz.Image?2:1))),t.push(tY(fz.LinkMark,o-1,o)),40==s){let n,i=e.skipSpace(o+1),s=hY(r,i-e.offset,e.offset);s&&(i=e.skipSpace(s.to),i!=s.to&&(n=dY(r,i-e.offset,e.offset),n&&(i=e.skipSpace(n.to)))),41==e.char(i)&&(t.push(tY(fz.LinkMark,o,o+1)),a=i+1,s&&t.push(s),n&&t.push(n),t.push(tY(fz.LinkMark,i,a)))}else if(91==s){let n=pY(r,o-e.offset,e.offset,!1);n&&(t.push(n),a=n.to)}return tY(n,i,a,t)}function hY(e,t,n){if(60==e.charCodeAt(t)){for(let i=t+1;i<e.length;i++){let o=e.charCodeAt(i);if(62==o)return tY(fz.URL,t+n,i+1+n);if(60==o||10==o)return!1}return null}{let i=0,o=t;for(let t=!1;o<e.length;o++){let n=e.charCodeAt(o);if(bz(n))break;if(t)t=!1;else if(40==n)i++;else if(41==n){if(!i)break;i--}else 92==n&&(t=!0)}return o>t?tY(fz.URL,t+n,o+n):o==e.length&&null}}function dY(e,t,n){let i=e.charCodeAt(t);if(39!=i&&34!=i&&40!=i)return!1;let o=40==i?41:i;for(let i=t+1,r=!1;i<e.length;i++){let s=e.charCodeAt(i);if(r)r=!1;else{if(s==o)return tY(fz.LinkTitle,t+n,i+1+n);92==s&&(r=!0)}}return null}function pY(e,t,n,i){for(let o=!1,r=t+1,s=Math.min(e.length,r+999);r<s;r++){let s=e.charCodeAt(r);if(o)o=!1;else{if(93==s)return!i&&tY(fz.LinkLabel,t+n,r+1+n);if(i&&!bz(s)&&(i=!1),91==s)return!1;92==s&&(o=!0)}}return null}class fY{constructor(e,t,n){this.parser=e,this.text=t,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,i,o){return this.append(new sY(e,t,n,(i?1:0)|(o?2:0)))}addElement(e){return this.append(e)}resolveMarkers(e){for(let t=e;t<this.parts.length;t++){let n=this.parts[t];if(!(n instanceof sY&&n.type.resolve&&2&n.side))continue;let i,o=n.type==nY||n.type==iY,r=n.to-n.from,s=t-1;for(;s>=e;s--){let e=this.parts[s];if(e instanceof sY&&1&e.side&&e.type==n.type&&!(o&&(1&n.side||2&e.side)&&(e.to-e.from+r)%3==0&&((e.to-e.from)%3||r%3))){i=e;break}}if(!i)continue;let a=n.type.resolve,l=[],c=i.from,u=n.to;if(o){let e=Math.min(2,i.to-i.from,r);c=i.to-e,u=n.from+e,a=1==e?"Emphasis":"StrongEmphasis"}i.type.mark&&l.push(this.elt(i.type.mark,c,i.to));for(let e=s+1;e<t;e++)this.parts[e]instanceof Jz&&l.push(this.parts[e]),this.parts[e]=null;n.type.mark&&l.push(this.elt(n.type.mark,n.from,u));let h=this.elt(a,c,u,l);this.parts[s]=o&&i.from!=c?new sY(i.type,i.from,c,i.side):null,(this.parts[t]=o&&n.to!=u?new sY(n.type,u,n.to,n.side):null)?this.parts.splice(t,0,h):this.parts[t]=h}let t=[];for(let n=e;n<this.parts.length;n++){let e=this.parts[n];e instanceof Jz&&t.push(e)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof sY&&n.type==e)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}skipSpace(e){return _z(this.text,e-this.offset)+this.offset}elt(e,t,n,i){return"string"==typeof e?tY(this.parser.getNodeType(e),t,n,i):new eY(e,t)}}function gY(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),i=0;for(let e of t){for(;i<n.length&&n[i].to<e.to;)i++;if(i<n.length&&n[i].from<e.from){let t=n[i];t instanceof Jz&&(n[i]=new Jz(t.type,t.from,t.to,gY(t.children,[e])))}else n.splice(i++,0,e)}return n}const mY=[fz.CodeBlock,fz.ListItem,fz.OrderedList,fz.BulletList];class vY{constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let e=this.fragment.to;for(;e>0&&"\n"!=this.input.read(e-1,e);)e--;this.fragmentEnd=e?e-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let i=e+this.fragment.offset;for(;n.to<=i;)if(!n.parent())return!1;for(;;){if(n.from>=i)return this.fragment.from<=t;if(!n.childAfter(i))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(y$.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),o=e.absoluteLineStart,r=o,s=e.block.children.length,a=r,l=s;for(;;){if(t.to-n>i){if(t.type.isAnonymous&&t.firstChild())continue;break}let o=yY(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,o);else{let n=new E$(e.parser.nodeSet.types[fz.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(n,t.tree),e.addNode(n,o)}if(t.type.is("Block")&&(mY.indexOf(t.type.id)<0?(r=t.to-n,s=e.block.children.length):(r=a,s=l,a=t.to-n,l=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>s;)e.block.children.pop(),e.block.positions.pop();return r-o}}function yY(e,t){let n=e;for(let i=1;i<t.length;i++){let o=t[i-1].to,r=t[i].from;o<e&&(n-=r-o)}return n}const bY=uP({"Blockquote/...":RP.quote,HorizontalRule:RP.contentSeparator,"ATXHeading1/... SetextHeading1/...":RP.heading1,"ATXHeading2/... SetextHeading2/...":RP.heading2,"ATXHeading3/...":RP.heading3,"ATXHeading4/...":RP.heading4,"ATXHeading5/...":RP.heading5,"ATXHeading6/...":RP.heading6,"Comment CommentBlock":RP.comment,Escape:RP.escape,Entity:RP.character,"Emphasis/...":RP.emphasis,"StrongEmphasis/...":RP.strong,"Link/... Image/...":RP.link,"OrderedList/... BulletList/...":RP.list,"BlockQuote/...":RP.quote,"InlineCode CodeText":RP.monospace,"URL Autolink":RP.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":RP.processingInstruction,"CodeInfo LinkLabel":RP.labelName,LinkTitle:RP.string,Paragraph:RP.content}),_Y=new Yz(new O$(Gz).extend(bY),Object.keys(Qz).map((e=>Qz[e])),Object.keys(Qz).map((e=>qz[e])),Object.keys(Qz),Fz,yz,Object.keys(cY).map((e=>cY[e])),Object.keys(cY),[]);RP.strikethrough,RP.processingInstruction;RP.heading,RP.content,RP.processingInstruction;function xY(e,t,n){return(i,o,r)=>{if(o!=e||i.char(r+1)==e)return-1;let s=[i.elt(n,r,r+1)];for(let o=r+1;o<i.end;o++){let a=i.char(o);if(a==e)return i.addElement(i.elt(t,r,o+1,s.concat(i.elt(n,o,o+1))));if(92==a&&s.push(i.elt("Escape",o,2+o++)),bz(a))break}return-1}}function OY(e){const t=[];return e.iterate({enter:e=>{const n=e.node;if(!n.type.isError)return;const i=n.parent,o=wY(n),r={from:n.from,to:n.to,severity:"error",type:"Syntax Error"};if(n.from!==n.to)r.message=`Unrecognized token in <${i.name}>`;else if(o)r.message=`Unrecognized token <${o.name}> in <${i.name}>`,r.to=o.to;else{const e=i.enterUnfinishedNodesBefore(n.to);r.message=`Incomplete <${(e||i).name}>`}t.push(r)}}),t}function wY(e){return e?e.nextSibling||wY(e.parent):null}RP.list,RP.atom,RP.special(RP.content),RP.processingInstruction,xY(94,"Superscript","SuperscriptMark"),RP.special(RP.content),RP.processingInstruction,xY(126,"Subscript","SubscriptMark"),RP.character;var CY={create:e=>({enter(t){if("FilterExpression"!==t.name)return;const n=e.readContent(t.from,t.to);if(/\[\s*0\s*\]$/.test(n)){const{from:i,to:o}=t;e.report({from:i,to:o,message:"First item is accessed via [1]",severity:"warning",type:"first-item",actions:[{name:"fix",apply(t,r=i,s=o){e.updateContent(r,s,n.replace(/\[\s*0\s*\]$/,"[1]"))}}]})}}})};const kY=[CY];function EY(e){const{readContent:t,syntaxTree:n,updateContent:i}=e,o=[],r={readContent:t,report:e=>{o.push(e)},updateContent:i},s=kY.map((e=>e.create(r)));return n.iterate({enter:e=>{for(const t of s)t.enter&&t.enter(e)},leave:e=>{for(const t of s)t.leave&&t.leave(e)}}),o}const SY=()=>e=>{if(0===e.state.doc.length)return[];const t=jP(e.state),n=(i={syntaxTree:t,readContent:(t,n)=>e.state.sliceDoc(t,n),updateContent:(t,n,i)=>e.dispatch({changes:{from:t,to:n,insert:i}})},[...OY(i.syntaxTree),...EY(i)]);var i;return n.map((e=>({...e,source:e.type})))},$Y=vT(pT.define([{tag:RP.strong,fontWeight:"bold"},{tag:RP.emphasis,fontStyle:"italic"}]));var PY=[hS.theme({"& .cm-lintRange":{position:"relative"},"& .cm-lintRange::after":{content:'""',width:"100%",position:"absolute",left:"0px",bottom:"-2px",height:"3px",backgroundRepeat:"repeat-x"},"& .cm-lintRange.cm-lintRange-warning, & .cm-lintRange.cm-lintRange-error":{backgroundImage:"none"},"& .cm-lintPoint::after":{bottom:"-2px"}}),$Y];const TY=e=>`%23${e.slice(1)}`,RY={black:"#1f2b36",darkGrey:"#2f3d58",grey:"#404a5c",midGrey:"#576071",lightGrey:"#c5d1e5",offWhite:"#d9e0f5",snowWhite:"#eaf1ff",white:"#ffffff",mossGreen:"#7ab6aa",iceBlue:"#6cbfd8",waterBlue:"#065aaa",brightBlue:"#0a56b9",deepBlue:"#355472",red:"#9f1c15",orangeBrown:"#b4502f",yellow:"#debd71",lila:"#9a4890",purple:"#5b2c83"},AY={lightBackground:RY.white,darkBackground:RY.snowWhite,selection:RY.snowWhite,tooltipBackground:RY.offWhite,error:RY.red,warning:RY.yellow,invalid:"#b40000"};var MY=[hS.theme({"&":{color:RY.black,backgroundColor:AY.lightBackground},".cm-content":{caretColor:RY.darkGrey},".cm-cursor, .cm-dropCursor":{borderLeftColor:RY.darkGrey},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:AY.selection},".cm-panels":{backgroundColor:AY.darkBackground,color:RY.grey},".cm-panels.cm-panels-top":{borderBottom:`2px solid ${RY.black}`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid ${RY.black}`},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${RY.midGrey}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:RY.offWhite},".cm-activeLine":{backgroundColor:AY.selection},".cm-selectionMatch":{backgroundColor:RY.offWhite},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${RY.grey}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:RY.snowWhite},".cm-gutters":{backgroundColor:"#f3f7fe",color:"#52668d",border:"none",padding:"0 5px"},".cm-activeLineGutter":{backgroundColor:AY.selection},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:AY.tooltipBackground},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:AY.tooltipBackground,borderBottomColor:AY.tooltipBackground},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:AY.darkBackground,color:RY.midGrey}},"& .cm-lintRange.cm-lintRange-warning::after":{backgroundImage:`url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><path d='m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0' stroke='${TY(AY.warning)}' fill='none' stroke-width='1.2'/></svg>")`},"& .cm-lintRange.cm-lintRange-error::after":{backgroundImage:`url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><path d='m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0' stroke='${TY(AY.error)}' fill='none' stroke-width='1.2'/></svg>")`},"& .cm-diagnostic-warning":{border:`1px solid ${AY.warning}`,borderLeft:`5px solid ${AY.warning}`,background:AY.lightBackground},"& .cm-diagnostic-error":{border:`1px solid ${AY.error}`,borderLeft:`5px solid ${AY.error}`,background:AY.lightBackground},"& .cm-diagnostic":{padding:"3px 8px"}},{dark:!1}),vT(pT.define([{tag:[RP.macroName,RP.variableName],color:RY.waterBlue},{tag:[RP.special(RP.bracket)],color:RY.waterBlue,fontWeight:"bold"},{tag:[RP.color,RP.name,RP.definition(RP.name),RP.constant(RP.name),RP.standard(RP.name),RP.propertyName],color:RY.deepBlue},{tag:[RP.definition(RP.variableName),RP.function(RP.variableName),RP.function(RP.propertyName)],color:RY.brightBlue},{tag:[RP.labelName],color:RY.orangeBrown},{tag:[RP.annotation],color:AY.invalid},{tag:[RP.number,RP.changed,RP.annotation,RP.modifier,RP.self,RP.namespace,RP.atom,RP.bool,RP.special(RP.variableName)],color:RY.red},{tag:[RP.typeName,RP.className,RP.attributeName],color:RY.lila},{tag:[RP.operator,RP.operatorKeyword,RP.tagName,RP.keyword],color:RY.purple},{tag:[RP.angleBracket,RP.squareBracket,RP.brace,RP.separator,RP.punctuation],color:RY.midGrey},{tag:[RP.regexp],color:RY.deepBlue},{tag:[RP.quote],color:RY.darkGrey},{tag:[RP.string,RP.character,RP.deleted],color:RY.orangeBrown},{tag:RP.link,color:RY.mossGreen,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[RP.url,RP.escape,RP.special(RP.string)],color:RY.red},{tag:[RP.meta],color:RY.iceBlue},{tag:[RP.comment],color:RY.midGrey,fontStyle:"italic"},{tag:RP.strong,fontWeight:"bold",color:RY.deepBlue},{tag:RP.emphasis,fontStyle:"italic",color:RY.deepBlue},{tag:RP.strikethrough,textDecoration:"line-through"},{tag:RP.heading,fontWeight:"bold",color:RY.midGray},{tag:RP.special(RP.heading1),fontWeight:"bold",color:RY.darkGrey},{tag:[RP.heading1,RP.heading2,RP.heading3,RP.heading4],fontWeight:"bold",color:RY.midGrey},{tag:[RP.heading5,RP.heading6,RP.processingInstruction,RP.inserted],color:RY.grey},{tag:[RP.contentSeparator],color:RY.yellow},{tag:RP.invalid,color:RY.midGrey,borderBottom:`1px dotted ${AY.invalid}`}]))];const DY="#f07178",LY="#fffce1",IY="#ec9e6f",QY="rgba(0, 0, 0, 0.5)",jY="#353a42",BY="#ffcc00",NY="fff890";var qY=[hS.theme({"&":{color:"#ffffff",backgroundColor:"#292d3e"},".cm-content":{caretColor:BY},"&.cm-focused .cm-cursor":{borderLeftColor:BY},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(128, 203, 196, 0.2)"},".cm-panels":{backgroundColor:"#21252b",color:"#ffffff"},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:QY},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{background:"#292d3e",color:"#676e95",border:"none",padding:"0 5px"},".cm-activeLineGutter":{backgroundColor:QY},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:jY},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:jY,borderBottomColor:jY},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:QY,color:"#abb2bf"}},"& .cm-lintRange.cm-lintRange-warning::after":{backgroundImage:`url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><path d='m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0' stroke='${"%23"+NY}' fill='none' stroke-width='1.2'/></svg>")`},"& .cm-lintRange.cm-lintRange-error::after":{backgroundImage:"url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3'><path d='m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0' stroke='red' fill='none' stroke-width='1.2'/></svg>\")"},"& .cm-diagnostic-warning":{borderLeft:`5px solid #${NY}`,background:"#281e16"},"& .cm-diagnostic-error":{borderLeft:"5px solid red",background:"#281616"},"& .cm-diagnostic":{borderRadius:"2px",padding:"3px 8px"}},{dark:!0}),vT(pT.define([{tag:RP.heading1,color:LY},{tag:RP.heading2,color:LY},{tag:RP.heading3,color:LY},{tag:RP.heading4,color:LY},{tag:RP.heading5,color:LY},{tag:RP.heading6,color:LY},{tag:RP.special(RP.bracket),color:IY,fontWeight:"bold"},{tag:RP.keyword,color:"#c792ea"},{tag:RP.operator,color:"#89ddff"},{tag:RP.special(RP.variableName),color:"#eeffff"},{tag:RP.typeName,color:"#f07178"},{tag:RP.atom,color:"#f78c6c"},{tag:RP.number,color:"#ff5370"},{tag:RP.bool,color:"#ff5370"},{tag:RP.definition(RP.variableName),color:"#82aaff"},{tag:RP.string,color:"#c3e88d"},{tag:RP.comment,color:"#7d8799"},{tag:RP.tagName,color:"#ff5370"},{tag:RP.bracket,color:"#a2a1a4"},{tag:RP.meta,color:"#ffcb6b"},{tag:RP.special(RP.string),color:DY},{tag:RP.propertyName,color:IY},{tag:RP.variableName,color:IY},{tag:RP.attributeName,color:DY},{tag:RP.className,color:DY},{tag:RP.invalid,color:"#ffffff"}]))];const FY=[...PY,...MY],VY=[...PY,...qY],XY=123,zY=125,YY=(e,t=0)=>{const n=e.peek(t)===zY,i=e.peek(t+1)===zY;return n&&i||-1===e.peek(t)},WY=new KM(((e,t)=>{let n=0;for(;!YY(e,n);)n++;n>0&&(e.advance(n),e.acceptToken(2))})),HY=(e,t=0)=>{const n=e.peek(t)===XY,i=e.peek(t+1)===XY;return n&&i||-1===e.peek(t)},UY=new KM(((e,t)=>{let n=0;for(;!HY(e,n);)n++;n>0&&(e.advance(n),e.acceptToken(3))})),GY=new KM(((e,t)=>{let n=0;for(;-1!==e.peek(n);)n++;n>0&&(e.advance(n),e.acceptToken(1))})),ZY=uP({ConditionalSpanner:RP.special(RP.bracket),ConditionalSpannerClose:RP.special(RP.bracket),ConditionalSpannerCloseNl:RP.special(RP.bracket),LoopSpanner:RP.special(RP.bracket),LoopSpannerClose:RP.special(RP.bracket),LoopSpannerCloseNl:RP.special(RP.bracket),EmptyInsert:RP.special(RP.bracket),Insert:RP.special(RP.bracket)}),KY=hD.deserialize({version:14,states:"$bOQOaOOOfOXO'#CbOOO`'#Cm'#CmOqOWO'#CcOvOWO'#CfOOO`'#Cp'#CpOOO`'#Ci'#CiO{OaO'#ClO!jOSOOQOOOOOO!oOPO,58{O!tOXO,58|OOO`,58|,58|O!|OQO,58}O#ROQO,59QOOO`-E6g-E6gOOO`1G.g1G.gO#WOPO1G.gOOO`1G.h1G.hO#]OaO1G.iO#qOaO1G.lOOO`7+$R7+$RO$VOPO7+$TO$_OPO7+$WOOO`<<Go<<GoOOO`<<Gr<<Gr",stateData:"$g~ORUO_WObPOeROgSO^`P~OQYO_ZOc[O~OQ]O~OQ^O~ORUObPOeROgSO^`XW`XX`XZ`X[`X~OPXO~Oc`O~OQaOcbO~OfcO~OfdO~OceO~ORUObPOeROgSOW`PX`P~ORUObPOeROgSOZ`P[`P~OWhOXhO~OZiO[iO~O",goto:"!ZePPPPPfflPPlPPrPPz!TPP!TXQOVcdXTOVcdUVOcdR_VQXOQfcRgdXUOVcd",nodeNames:"⚠ Feel FeelBlock SimpleTextBlock Feelers Insert EmptyInsert ConditionalSpanner ConditionalSpannerClose ConditionalSpannerCloseNl LoopSpanner LoopSpannerClose LoopSpannerCloseNl",maxTerm:23,propSources:[ZY],skippedNodes:[0],repeatNodeCount:1,tokenData:"%X~RR!_!`[#o#pa#q#r$r~aO_~~dP#o#pg~lQb~str!P!Q!{~uQ#]#^{#`#a!^~!OP#Y#Z!R~!UPpq!X~!^Oe~~!aP#c#d!d~!gP#c#d!j~!mP#d#e!p~!sPpq!v~!{Og~~#OQ#]#^#U#`#a#u~#XP#Y#Z#[~#_P#q#r#b~#eP#q#r#h~#mPW~YZ#p~#uOX~~#xP#c#d#{~$OP#c#d$R~$UP#d#e$X~$[P#q#r$_~$bP#q#r$e~$jPZ~YZ$m~$rO[~R$uP#q#r$xR%PPcPfQYZ%SQ%XOfQ",tokenizers:[0,1,GY,WY,UY],topRules:{Feelers:[0,4]},tokenPrec:0}),JY={ConditionalSpanner:dT,LoopSpanner:dT};const eW=e=>new HP(function(e=null){const t=KY.configure({wrap:(n=t=>"Feel"==t.name||"FeelBlock"==t.name?{parser:dz}:e&&"SimpleTextBlock"==t.name?{parser:e}:null,(e,t,i,o)=>new Z$(e,n,t,i,o)),props:[hT.add(JY)]});var n;return QP.define({parser:t})}(e),[]);function tW(e){const t=[];return e.iterate({enter:e=>{"EmptyInsert"===e.type.name&&t.push({from:e.from,to:e.to,severity:"warning",message:"this insert is empty and will be ignored",type:"emptyInsert"})}}),t}var nW=AM(function(){const e=SY();return t=>{const n=e(t);if(0===t.state.doc.length)return[];return[...n,...function(e){return[...tW(e)]}(jP(t.state)).map((e=>({...e,source:"feelers linter"})))]}}());function iW({container:e,tooltipContainer:t,hostLanguage:n,hostLanguageParser:i,onChange:o=()=>{},onKeyDown:r=()=>{},onLint:s=()=>{},contentAttributes:a={},readOnly:l=!1,value:c="",enableGutters:u=!1,singleLine:h=!1,darkMode:d=!1}){const p=hS.updateListener.of((e=>{e.docChanged&&o(e.state.doc.toString())})),f=hS.updateListener.of((e=>{const t=e.transactions.flatMap((e=>e.effects)).filter((e=>e.is(xM)));if(!t.length)return;const n=t.flatMap((e=>e.value));s(n)})),g=hS.contentAttributes.of(a),m=hS.domEventHandlers({keydown:r});"string"==typeof t&&(t=document.querySelector(t));const v=t?$S({tooltipSpace:function(){return t.getBoundingClientRect()}}):[],y=eW(i||n&&(e=>"markdown"===e?_Y:null)(n)),b=[$T(),p,g,GR(),uT(),m,bS.of([...mM]),y,nW,f,v,d?VY:FY,...u?[p$()]:[],...h?[SO.transactionFilter.of((e=>e.newDoc.lines>1?[]:e))]:[]];return l&&b.push(hS.editable.of(!1)),h&&c&&(c=c.toString().split("\n")[0]),this._cmEditor=new hS({state:SO.create({doc:c,extensions:b}),parent:e}),this}iW.prototype.setValue=function(e){this._cmEditor.dispatch({changes:{from:0,to:this._cmEditor.state.doc.length,insert:e}})},iW.prototype.focus=function(e){const t=this._cmEditor;if(t.contentDOM.focus(),t.focus(),"number"==typeof e){const n=t.state.doc.length;t.dispatch({selection:{anchor:e<=n?e:n}})}},iW.prototype.getSelection=function(){return this._cmEditor.state.selection};const oW=122,rW=123,sW=4,aW=131,lW=19,cW=140,uW=23,hW=141,dW=41,pW=68,fW=154,gW=70,mW=155,vW=72,yW=156,bW=168,_W=89,xW=90,OW=170,wW=97,CW=172,kW="undefined"!=typeof process&&process.env&&/\bfparse(:dbg)?\b/.test(process.env.LOG),EW="undefined"!=typeof process&&process.env&&/\bfparse:dbg\b/.test(process.env.LOG),SW="undefined"!=typeof process&&process.env&&/\bcontext\b/.test(process.env.LOG),$W=[9,11,12,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],PW=AW("\n\r"),TW="*".charCodeAt(0),RW=AW("'./-+*^");function AW(e){return Array.from(e).map((e=>e.charCodeAt(0)))}function MW(e){return e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}function DW(e,t){return t.concat(e.split(/\n/g).join("\n"+t))}function LW(e,t=0){const n=e.peek(t);return n===TW&&e.peek(t+1)===TW?{offset:2,token:"**"}:(i=n,RW.includes(i)?{offset:1,token:String.fromCharCode(n)}:null);var i}function IW(e,t=0,n=!1){for(let o=!1,r=[],s=0;;s++){const a=e.peek(t+s);if(!(63===(i=a)||i>=65&&i<=90||95===i||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=55296&&i<=56319||i>=56320&&i<=57343||(o||n)&&MW(a)))return r.length?{token:String.fromCharCode(...r),offset:s}:null;o||(o=!0),r.push(a)}var i}function QW(e,t){for(let i=!1,o=0;;o++){let r=e.peek(t+o);if(n=r,!$W.includes(n))return i?{token:" ",offset:o}:null;i||(i=!0)}var n}const jW={[oW]:"identifier",[rW]:"nameIdentifier"},BW=new KM(((e,t)=>{EW&&console.log("%s: T <identifier | nameIdentifier>",e.pos);const n=function(e,t){const n=t.contextKeys(),i=t.tokens;for(let t=0,o=[],r=null;;){const s=i.length+o.length>0,a=o.length>0,l=IW(e,t,s)||s&&LW(e,t)||a&&QW(e,t);if(!l)return r;const{token:c,offset:u}=l;if(t+=u," "===c)continue;o=[...o,c];const h=[...i,...o].join(" ");if(n.some((e=>e===h))){const e=o[0];r={token:e,offset:e.length,term:123}}if(!n.some((e=>e.startsWith(h)))){if(YW.some((e=>e===h))){const e=o[0];r={token:e,offset:e.length,term:122}}if(!YW.some((e=>e.startsWith(h))))return r}}}(e,t.context),i=t.context.tokens,o=n||IW(e,0,i.length>0);o&&(e.advance(o.offset),e.acceptToken(n?n.term:122),kW&&console.log("%s: MATCH <%s> <%s>",e.pos,n?jW[n.term]:"identifier",o.token))}),{contextual:!0}),NW=new KM(((e,t)=>{EW&&console.log("%s: T <propertyIdentifier>",e.pos);const n=IW(e,0,t.context.tokens.length>0);n&&(e.advance(n.offset),e.acceptToken(121),kW&&console.log("%s: MATCH <propertyIdentifier> <%s>",e.pos,n.token))})),qW=new KM(((e,t)=>{let n;EW&&console.log("%s: T <insertSemi>",e.pos);let i=!1;for(n=0;;n++){const t=e.peek(n);if(!$W.includes(t)){PW.includes(t)&&(i=!0);break}}if(i){const t=IW(e,n+1);if(QW(e,n+1)||t&&/^(then|else|return|satisfies)$/.test(t.token))return;kW&&console.log("%s: MATCH <insertSemi>",e.pos),e.acceptToken(124)}})),FW={[yW]:"FunctionInvocation",[mW]:"FilterExpression",[fW]:"PathExpression"},VW={[CW]:"Context",[OW]:"FunctionDefinition",[aW]:"ForExpression",[bW]:"List",[cW]:"IfExpression",[hW]:"QuantifiedExpression"},XW={[wW]:"Context",[xW]:"FunctionDefinition",[sW]:"ForExpression",[_W]:"List",[lW]:"IfExpression",[uW]:"QuantifiedExpression",[pW]:"PathExpression",[vW]:"FunctionInvocation",[gW]:"FilterExpression",[dW]:"ArithmeticExpression"};class zW{constructor(e){this.fn=e}get(e){return this.fn(e)}static of(e){return new zW(e)}}const YW=Object.keys({"date and time":1,date:1,time:1,duration:1});class WW{constructor(e={}){this.value=e}getKeys(){return Object.keys(this.value)}get(e){const t=this.value[e],n=this.constructor;return n.isAtomic(t)?t:n.of(t)}set(e,t){return this.constructor.of({...this.value,[e]:t})}merge(e){const t=this.constructor;return new t(t.__merge(this.value,e))}static isAtomic(e){return!e||e instanceof this||e instanceof zW||"object"!=typeof e}static of(...e){return e.reduce(((e,t)=>e.merge(t)),new this({}))}static __unwrap(e){return e?e instanceof this?e.value:"object"!=typeof e?{}:{...e}:{}}static __merge(e,t){return E(this.__unwrap(t),((e,t,n)=>t instanceof zW?{...e,[n]:t}:(t=this.__unwrap(t),O(e,n)&&(t=this.__merge(this.__unwrap(e[n]),t)),{...e,[n]:t})),this.__unwrap(e))}}class HW{constructor({name:e="Expressions",tokens:t=[],children:n=[],parent:i=null,context:o,value:r,raw:s}){this.name=e,this.tokens=t,this.children=n,this.parent=i,this.context=o,this.value=r,this.raw=s}enterScope(e){const t=this.of({name:e,parent:this});return SW&&console.log("[%s] enter",t.path,t.context),t}exitScope(e){return this.parent?(SW&&console.log("[%s] exit %o\n%s",this.path,this.context,DW(e," ")),this.parent.pushChild(this)):(SW&&console.log("[%s] NO exit %o\n%s",this.path,this.context,DW(e," ")),this)}token(e){return SW&&console.log("[%s] token <%s> + <%s>",this.path,this.tokens.join(" "),e),this.assign({tokens:[...this.tokens,e]})}literal(e){return SW&&console.log("[%s] literal %o",this.path,e),this.pushChild(this.of({name:"Literal",value:e}))}computedValue(){for(let e=this;;e=JW(e.children)){if(!e)return null;if(e.value)return e.value}}contextKeys(){return this.context.getKeys().map(UW)}get path(){return this.parent?.path?.concat(" > ",this.name)||this.name}get(e){const t=[e,e&&UW(e)],n=this.context.getKeys().find((e=>t.includes(UW(e))));if(void 0===n)return;const i=this.context.get(n);return i instanceof zW?i.get(this):i}resolveName(){const e=this.tokens.join(" "),t=this.assign({tokens:[]}),n=this.of({name:"VariableName",parent:t,value:this.get(e),raw:e});return SW&&console.log("[%s] resolve name <%s=%s>",n.path,e,this.get(e)),t.pushChild(n)}pushChild(e){if(!e)return this;const t=this.assign({children:[...this.children,e]});return e.parent=t,t}pushChildren(e){let t=this;for(const n of e)t=t.pushChild(n);return t}declareName(){if(0===this.tokens.length)throw Error("no tokens to declare name");const e=this.tokens.join(" ");return SW&&console.log("[%s] declareName <%s>",this.path,e),this.assign({tokens:[]}).pushChild(this.of({name:"Name",value:e}))}define(e,t){if("string"!=typeof e)return SW&&console.log("[%s] no define <%s=%s>",this.path,e,t),this;SW&&console.log("[%s] define <%s=%s>",this.path,e,t);const n=this.context.set(e,t);return this.assign({context:n})}assign(e={}){return HW.of({...this,...e})}of(e={}){const t={context:this.context,parent:this.parent};return HW.of({...t,...e})}static of(e){const{name:t,tokens:n=[],children:i=[],parent:o=null,context:r,value:s,raw:a}=e;if(!r)throw new Error("must provide <context>");return new HW({name:t,tokens:[...n],children:[...i],context:r,parent:o,value:s,raw:a})}}function UW(e){return e.replace(/\s*([./\-'+]|\*\*?)\s*/g," $1 ").replace(/\s{2,}/g," ").trim()}function GW(e,t,n){const i=e.children.filter((e=>e.name!==t)),o=e.children.filter((e=>e.name===t)),r=i[0],s=i[Math.max(1,i.length-1)],a=r?.computedValue(),l=s?.computedValue()||null;return e.assign({children:o}).enterScope(t).pushChildren(i).exitScope(n).define(a,l)}function ZW(e={},t=WW){const n=HW.of({context:t.of(e)});return new uD({start:n,reduce(e,n,i,o){if(19===n){const[n,i]=e.children.slice(-2);e=e.assign({value:t.of(n?.computedValue(),i?.computedValue())})}if(89===n&&(e=e.assign({value:t.of(...e.children.map((e=>e?.computedValue())))})),70===n){const[t,n]=e.children.slice(-2);e=e.assign({value:t?.computedValue()})}if(72===n){const[t,...n]=e.children;"get value"===t?.raw&&(e=function(e,t){if(!t.length)return e.assign({value:null});"Name"===t[0].name&&(t=function(e,t){const n={};for(let t=0;t<e.length;t+=2){const[i,o]=e.slice(t,t+2);n[i.value]=o}return t.map((e=>n[e]))}(t,["m","key"]));if(2!==t.length)return e.assign({value:null});const[n,i]=t,o=i?.computedValue(),r=n?.computedValue();if(!r||"object"!=typeof r||"string"!=typeof o)return e.assign({value:null});return e.assign({value:[UW(o),o].reduce(((e,t)=>r.get(t)||e),null)})}(e,n))}const r=VW[n];if(r)return e.enterScope(r);const s=FW[n];if(s){const{children:i,context:o}=e,r=i.slice(0,-1),a=JW(i);let l=null;return 154===n&&(l=t.of(a?.computedValue())),155===n&&(l=t.of(o,a?.computedValue()).set("item",a?.computedValue())),e.assign({children:r}).enterScope(s).pushChild(a).assign({context:l||o})}const a=o.read(o.pos,i.pos);if(XW[n])return e.exitScope(a);if(98===n){const n=e.children.filter((e=>"ContextEntry"!==e.name)),i=n[0],o=JW(n);return GW(e,"ContextEntry",a).assign({value:t.of(e.value).set(i?.computedValue(),o?.computedValue())})}if(7===n||27===n)return GW(e,"InExpression",a);if(139===n)return e.define("partial",zW.of((e=>JW(e.children)?.computedValue())));if(76===n){const t=JW(e.children).computedValue();return e.define(t,1)}if(145===n||146===n||147===n){const t=e.children.slice(0,-1),n=JW(e.children);return e.assign({children:t}).enterScope("ArithmeticExpression").pushChild(n)}if(148===n)return e.enterScope("ArithmeticExpression");if(9===n||10===n||101===n)return e.token(a);if(80===n)return e.literal(a.replace(/^"|"$/g,""));if(81===n)return e.literal("true"===a);if(79===n)return e.literal(parseFloat(a));if(161===n)return e.literal(null);if(47===n)return e.resolveName();if(8===n||100===n)return e.declareName();if((128===n||37===n)&&e.tokens.length>0)throw new Error("uncleared name");if(128===n){let t=e;for(;t.parent;)t=t.exitScope(a);return t}return e}})}const KW=ZW({});function JW(e){return e[e.length-1]}const eH=uP({StringLiteral:RP.string,NumericLiteral:RP.number,BooleanLiteral:RP.bool,"AtLiteral!":RP.special(RP.string),CompareOp:RP.compareOperator,ArithOp:RP.arithmeticOperator,"for if then else some every satisfies between return":RP.controlKeyword,"in instance of and or":RP.operatorKeyword,function:RP.definitionKeyword,as:RP.keyword,"Type/...":RP.typeName,Wildcard:RP.special(RP.variableName),null:RP.null,LineComment:RP.lineComment,BlockComment:RP.blockComment,'VariableName! "?"':RP.variableName,"DateTimeConstructor! SpecialFunctionName!":RP.function(RP.special(RP.variableName)),"List Interval":RP.list,Context:RP.definition(RP.literal),"Name!":RP.definition(RP.variableName),"Key/Name! ContextEntryType/Name!":RP.definition(RP.propertyName),"PathExpression/VariableName!":RP.function(RP.propertyName),"FormalParameter/ParameterName!":RP.function(RP.definition(RP.variableName)),"( )":RP.paren,"[ ]":RP.squareBracket,"{ }":RP.brace,".":RP.derefOperator,", ;":RP.separator,"..":RP.punctuation}),tH={__proto__:null,for:10,in:32,return:36,if:40,then:42,else:44,some:48,every:50,satisfies:56,or:60,and:64,between:72,instance:86,of:89,days:101,time:103,duration:105,years:107,months:109,date:111,list:117,context:123,function:130,null:156,true:332,false:332,"?":170,external:186,not:211},nH=hD.deserialize({version:14,states:"C|O`QYOOO`QYOOO$yQYOOOOQU'#Ce'#CeO%TQYO'#C`O&^QYO'#FQOOQQ'#Ff'#FfO&hQYO'#FfO`QYO'#DVOOQU'#En'#EnO(_Q^O'#D]OOQU'#D^'#D^OOQU'#D]'#D]OOQO'#Fn'#FnO*[QWO'#DvOOQQ'#D}'#D}OOQQ'#EO'#EOOOQQ'#EP'#EPO*aOWO'#ESO*[QWO'#EQOOQQ'#EQ'#EQOOQQ'#Ft'#FtOOQQ'#Fr'#FrOOQQ'#Fz'#FzOOQQ'#EU'#EUO`QYO'#EWOOQQ'#FS'#FSO*iQ^O'#FSO,`QYO'#EXO,gQWO'#EYOOQP'#GO'#GOO,lQXO'#EaOOQQ'#F{'#F{OOQQ'#FR'#FRQOQWOOOOQQ'#FT'#FTOOQQ'#F^'#F^O`QYO'#CoOOQQ'#F_'#F_O%TQYO'#CsO,zQYO'#DwOOQQ'#Fs'#FsO-PQYO'#EROOQO'#ER'#ERO`QYO'#EVO`QYO'#EUOOQO'#F|'#F|Q-XQWOOO-^QYO'#DRO.TQWO'#FbOOQO'#DT'#DTO.`QYO'#FfO.gQWOOO/^QYO'#CdO/kQYO'#FVOOQQ'#Cc'#CcO/pQYO'#FUOOQQ'#Cb'#CbO/xQYO,58zO`QYO,59iOOQQ'#Fc'#FcOOQQ'#Fd'#FdOOQQ'#Fe'#FeO`QYO,59qO`QYO,59qO`QYO,59qOOQQ'#Fl'#FlO/}QYO,5:^OOQQ'#Fm'#FmO`QYO,5:`O`QYO,59eO`QYO,59gO`QYO,59iO1|QYO,59iO2TQYO,59rOOQQ,5:i,5:iO2YQYO,59qOOQU-E8l-E8lO3|QYO'#FoOOQQ,5:b,5:bOOQQ,5:n,5:nOOQQ,5:l,5:lO4TQYO,5:rOOQQ,5;n,5;nO4_QYO,5:qO4lQWO,5:sO4qQYO,5:tOOQP'#Ee'#EeO5hQXO'#EdOOQO'#Ec'#EcO5oQWO'#EbO5tQWO'#GPO5|QWO,5:{O6RQYO,59ZO/kQYO'#FaOOQQ'#Cw'#CwO6YQYO'#F`OOQQ'#Cv'#CvO6bQYO,59_O6gQYO,5:cO6lQYO,5:mO4WQYO,5:qO6qQYO,5:pO`QYO'#EwQ-XQWOOO`QYO'#EmO7hQWO,5;|O`QYOOOOQR'#Cf'#CfOOQQ'#Ej'#EjO8bQYO,59OO`QYO,5;qOOQQ'#FY'#FYO%TQYO'#EkO8rQYO,5;pO`QYO1G.fOOQQ'#F]'#F]O9iQYO1G/TO<`QYO1G/]O<jQYO1G/]O<tQYO1G/]OOQQ1G/x1G/xO>hQYO1G/zO>oQYO1G/PO?xQYO1G/ROARQYO1G/TO`QYO1G/TOOQQ1G/T1G/TOAiQYO1G/^OBWQ^O'#CdOCjQYO'#FqOOQO'#Dz'#DzOCtQWO'#DyOCyQWO'#FpOOQO'#Dx'#DxOOQO'#D{'#D{ODRQWO,5<ZOOQQ1G0^1G0^O`QYO1G0]O`QYO'#EsODWQWO,5<]OOQQ1G0_1G0_ODcQWO'#E[ODnQWO'#F}OOQO'#EZ'#EZODvQWO1G0`OOQP'#Eu'#EuOD{QXO,5;OO`QYO,5:|OESQXO'#EvOE_QWO,5<kOOQQ1G0g1G0gO`QYO1G.uO`QYO,5;{O%TQYO'#ElOEgQYO,5;zO`QYO1G.yOEoQYO1G/}OOQO1G0X1G0XOOQO,5;c,5;cOOQO-E8u-E8uOOQO,5;X,5;XOOQO-E8k-E8kOEtQWOOOOQQ-E8h-E8hOEyQYO'#CmOOQQ1G1]1G1]OOQQ,5;V,5;VOOQQ-E8i-E8iOFWQYO7+$QOOQQ7+%f7+%fO`QYO7+$oOF}QYO,5:rOG[QWO7+$oOGaQYO'#D[OOQQ'#DZ'#DZOITQYO'#D_OIYQYO'#D_OI_QYO'#D_OIdQ`O'#DgOIiQ`O'#DjOInQ`O'#DnOOQQ7+$x7+$xO`QYO,5:eO%TQYO'#ErOIsQWO,5<[OOQQ1G1u1G1uOJyQYO7+%wOKWQYO,5;_OOQO-E8q-E8qOAiQYO,5:vO%TQYO'#EtOKeQWO,5<iOKmQYO7+%zOOQP-E8s-E8sOKtQYO1G0hOOQO,5;b,5;bOOQO-E8t-E8tOLOQYO7+$aOLVQYO1G1gOOQQ,5;W,5;WOOQQ-E8j-E8jOLaQYO7+$eOOQO7+%i7+%iO`QYO,59XOMWQYO<<HZOOQQ<<HZ<<HZO/}QYO'#EoONaQYO,59vO!!TQYO,59yO!!YQYO,59yO!!_QYO,59yO!!dQYO,5:RO%TQYO,5:UO!#RQbO,5:YO!#YQYO1G0POOQO,5;^,5;^OOQO-E8p-E8pO!#dQYO<<IcOOQQ<<Ic<<IcOOQO1G0b1G0bOOQO,5;`,5;`OOQO-E8r-E8rO!&fQYO'#E^OOQQ<<If<<IfO`QYO<<IfO`QYO<<G{O!']QYO1G.sOOQQ,5;Z,5;ZOOQQ-E8m-E8mO!'gQYO1G/eOOQQ1G/e1G/eO!'lQbO'#D]O!'}Q`O'#D[O!(YQ`O1G/mO!(_QWO'#DmO!(dQ`O'#FhOOQO'#Dl'#DlO!(lQ`O1G/pOOQO'#Dq'#DqO!(qQ`O'#FjOOQO'#Dp'#DpO!(yQ`O1G/tOOQQAN?QAN?QO!)OQYOAN=gOOQQ7+%P7+%PO!)uQ`O,59vOOQQ7+%X7+%XO!!dQYO,5:XO%TQYO'#EpO!*QQ`O,5<SOOQQ7+%[7+%[O!!dQYO'#EqO!*YQ`O,5<UO!*bQ`O7+%`OOQO1G/s1G/sOOQO,5;[,5;[OOQO-E8n-E8nOOQO,5;],5;]OOQO-E8o-E8oOAiQYO<<HzOOQQAN>fAN>fO/}QYO'#EoO!!dQYO<<HzO!*gQ`O7+%`O!*lQ`O1G/tO!#RQbO,5:YO!*qQ`O'#Dn",stateData:"!+U~O#rOS#sOSPOSQOS~OTsOZVO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$k`O$laO$mbO~OTsO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$k`O$laO$mbO~OZ!TO#]!UO~P#VO#nRO#oRO~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO!i!fO#z!dOv$bX~O#l#tX$t#tX~P%]O$i!mOT$YXZ$YX[$YXd$YXh$YXi$YXr$YXs$YXv$YX!T$YX!U$YX!V$YX!X$YX!c$YX!g$YX!i$YX!p$YX!w$YX#S$YX#n$YX#o$YX$Z$YX$j$YX$k$YX$l$YX$m$YX~O#nRO#oROZ!PX[!PX]!PX^!PX_!PX`!PXn!PXp!PXr!PXs!PXt!PXv!PX{!PX!i!PX#l!PX#p!PX#z!PX$t!PX$O!PXx!PX#}!PX!g!PXe!PXb!PX#R!PXf!PXl!PX~Ov!pO~O$j`O$k`O~O#p!uOZ#vX[#vX]#vX^#vX_#vX`#vXn#vXp#vXr#vXs#vXt#vXv#vX{#vX!i#vX#l#vX#z#vX$t#vX$O#vXx#vX#}#vX!g#vXe#vXb#vX#R#vXf#vXl#vX~O!g$eP~P`Ov!xO~O#m!yO$j`O$k`O#R$sP~Op#VO~Op#WOv!uX~O$t#ZO~O#luX$OuX$tuXxuX#}uX!guXeuXbuX#RuXfuXluX~P%]O$O#]O#l$UXx$UX~O#l#[X~P&hOv#_O~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O$]WX~O`WXxWX$OWX~P.lO`#dO~O$O#eOb#xX~Ob#hO~O#nRO#oRO$ZZO~OTsOZVO[UOdtOhvOivOr}Os}O!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$k`O$laO$mbO~Ov#rO~P0YO|#tO~O{!lO!i!fO#z!dOZya[ya]ya^ya_ya`yanyapyaryasyatyav$bX#lya$tya$Oyaxya#}ya!gyaeyabya#Ryafyalya~Ox$eP~P`Ox#}O#}$OO~P%]O#}$OO$O$PO!g$eX~P%]O!g$RO~O#nRO#oROx$qP~OZ#`O[#`O]#`O^#`O_#`O#m!yO#z#`O#{#`O~O$]#WX~P4|O$]$YO~O$O$ZO#R$sX~O#R$]O~Oe$^O~P%]O$O$`Ol$SX~Ol$bO~O!W$cO~O!T$dO~O#l!xa$t!xa$O!xax!xa#}!xa!g!xae!xab!xa#R!xaf!xal!xa~P%]O$O#]O#l$Uax$Ua~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O~O`Wa$]WaxWa$OWa~P7sO$O#eOb#xa~OZ!^O[!^O]!_O^!_O_!`O{!lO!i!fO#z!dOv$bX~O`qinqipqirqisqitqi#lqi$tqi$Oqixqi#}qi!gqieqibqi#Rqifqilqi~P8zO_!`O{!lO!i!fO#z!dOZyi[yi`yinyipyiryisyityiv$bX#lyi$tyi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O]!_O^!_O~P:rO]yi^yi~P:rO{!lO!i!fO#z!dOZyi[yi]yi^yi_yi`yinyipyiryisyityiv$bX#lyi$tyi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O!g$pO~P%]O`!kOp!iOr!]Os!]Ot!jOnmi#lmi$tmi$Omixmi#}mi!gmiemibmi#Rmifmilmi~P8zO`!kOr!]Os!]Ot!jOnoipoi#loi$toi$Ooixoi#}oi!goieoiboi#Roifoiloi~P8zO`!kOn!hOp$qOr!]Os!]Ot!jO~P8zO!S$vO!V$wO!X$xO![$yO!_$zO!c${O#nRO#oRO$ZZO~OZ#bX[#bX]#bX^#bX_#bX`#bXn#bXp#bXr#bXs#bXt#bXv#bXx#bX{#bX!i#bX#n#bX#o#bX#p#bX#z#bX$O#bX~P.lO$O$POx$eX~P%]O$]$}O~O$O%OOx$dX~Ox%QO~O$O$PO!g$eax$ea~O$]%UOx#OX$O#OX~O$O%VOx$qX~Ox%XO~O$]#Wa~P4|O#m!yO$j`O$k`O~O$O$ZO#R$sa~O$O$`Ol$Sa~O!U%cO~OxrO~O#}%dObaX$OaX~P%]O#lSq$tSq$OSqxSq#}Sq!gSqeSqbSq#RSqfSqlSq~P%]Ox#}O#}$OO$OuX~P%]Ox%fO~O#z%gOZ!OX[!OX]!OX^!OX_!OX`!OXn!OXp!OXr!OXs!OXt!OXv!OX{!OX!i!OX#l!OX$t!OX$O!OXx!OX#}!OX!g!OXe!OXb!OX#R!OXf!OXl!OX~Op%iO~Op%jO~Op%kO~O!]%lO~O!]%mO~O!]%nO~O$O%OOx$da~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO#z!dOv$bX~Ox%sO!g%sO!i%rO~PI{O!g#ga$O#gax#ga~P%]O$O%VOx$qa~O#P%yO~P`O#R#Ui$O#Ui~P%]Of%zO~P%]Ol$Ti$O$Ti~P%]O#lgq$tgq$Ogqxgq#}gq!ggqegqbgq#Rgqfgqlgq~P%]O`qynqypqyrqysqytqy#lqy$tqy$Oqyxqy#}qy!gqyeqybqy#Rqyfqylqy~P8zO#z%gOZ!Oa[!Oa]!Oa^!Oa_!Oa`!Oan!Oap!Oar!Oas!Oat!Oav!Oa{!Oa!i!Oa#l!Oa$t!Oa$O!Oax!Oa#}!Oa!g!Oae!Oab!Oa#R!Oaf!Oal!Oa~O!T&OO~O!W&OO~O!T&PO~O!S$vO!V$wO!X$xO![$yO!_$zO!c&uO#nRO#oRO$ZZO~O!Y$^P~P!!dOx!mi$O!mi~P%]OT$aXZ$aX[$aX]!yy^!yy_!yy`!yyd$aXh$aXi$aXn!yyp!yyr$aXs$aXt!yyv$aX{!yy!T$aX!U$aX!V$aX!X$aX!c$aX!g$aX!i$aX!p$aX!w$aX#S$aX#l!yy#n$aX#o$aX#z!yy$Z$aX$i$aX$j$aX$k$aX$l$aX$m$aX$t!yy$O!yyx!yy#}!yye!yyb!yy#R!yyf!yyl!yy~O#l#QX$t#QX$O#QXx#QX#}#QX!g#QXe#QXb#QX#R#QXf#QXl#QX~P%]Obai$Oai~P%]O!U&_O~O#nRO#oRO!Y!PX#z!PX$O!PX~O#z&pO!Y!OX$O!OX~O!Y&aO~O$]&bO~O$O&cO!Y$[X~O!Y&eO~O$O&fO!Y$^X~O!Y&hO~O#lc!R$tc!R$Oc!Rxc!R#}c!R!gc!Rec!Rbc!R#Rc!Rfc!Rlc!R~P%]O#z&pO!Y!Oa$O!Oa~O$O&cO!Y$[a~O$O&fO!Y$^a~O$_&nO~O$_&qO~O!Y&rO~O!]&tO~O$Z$j~$j$k_^$i#zQP]Q~",goto:"E}$tPPPP$uP%n%q%w&Z'tPPPPPP'}P$uPPP$uPP(Q(TP$uP$uP$uPPP(ZP(fP$u$uPP(o)U)a*n)UPPPPPPP)UPP)UP+s+v)UP+|,S$uP$uP$u,Z-S-V-]-SP-e.^-e-e/^0VP$u1O$u1w1w2p2sP2yPP1w3P3V/Y3ZPP3cP3f3m3s3y4P5[5f5l5r5x6P6V6]6cPPPPPPPP6i6r8y9r:k:nPP:rPP:x:{;t<m<p<t<y=h>W>wP?pP?sP?w@jA]BUB[B_$uBeBePPPPPC^8yDVEOEREz!mjOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR![SQ!YSR$m#eS!WS#eS#Qw$`W#w!p!x%O%VT&T%m&c#WXOPQWYilu|}!]!a!b!c!e!g!h!i!j!k#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&Q&b&f&n&p&q&tb!VSw!x#e$`%O%V%m&cU#a!V#b#uR#u!pU#a!V#b#uT$W!z$XR$l#cR#UwQ#SwR%`$`U!RQ#_#rQ#s!kR$g#]QrQQ$i#_R$s#rQ$|#tQ%t%UQ&S%lU&X%n&f&tQ&i&bT&o&n&qc$u#t%U%l%n&b&f&n&q&t!lkOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ#m!eU$t#t%U&nS%|%g&p]&R%l%n&b&f&q&t#V[OPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&b&f&n&p&q&tR&W%mQ&U%mR&j&cQ&[%nR&s&tS&Y%n&tR&l&f!m]OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#|!pQ#y!pR%p%OS#x!p%OT$S!x%V!meOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!leOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!rbT!{o$Z!mcOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mdOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mhOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mpOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$V!xQ$T!xR%u%VQ%x%XR&]%yQ!}oR%[$ZT!|o$ZS!zo$ZT$W!z$XRrQS#b!V#uR$j#bQ#f!YR$n#fQ$a#SR%a$aQ#^!RR$h#^!vYOPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%y%z&nS!oY&Q_&Q%l%n&b&f&p&q&tQ%h$tS%}%h&`R&`&RQ&d&UR&k&dQ&g&YR&m&gQ%P#yR%q%PS$Q!v#vR%T$QQ%W$TR%v%WQ$X!zR%Y$XQ$[!}R%]$[Q#[!PR$f#[QrOQ!PPR$e#ZUTOP#ZW!QQ!k#]#_Q!nWQ!tiQ!vlQ#PuQ#X|Q#Y}Q#i!]Q#j!aQ#k!bQ#l!cQ#n!gQ#o!hQ#p!iQ#q!jQ#v!pQ$k#cQ$o#gQ$r#rQ%R$OQ%S$PQ%Z$YQ%^$^Q%_$_Q%b$bQ%e$qQ%o$}S%w%X%yQ%{%dR&^%z!mqOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mSOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR!ZST!XS#eQ#c!WR$_#QR#g![!muOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mwOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#TwT#Rw$`V!SQ#_#r!X!aT!Q!t!v#P#X#Y#i#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!Z!bT!Q!t!v#P#X#Y#i#j#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!]!cT!Q!t!v#P#X#Y#i#j#k#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!mWOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR&V%mT&Z%n&t!a!eT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!a!gT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!m^OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!q^R!scR#z!pQ!wlR#{!p!mfOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mlOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mmOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$U!x!moOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#Oo",nodeNames:"⚠ LineComment BlockComment Expression ForExpression for InExpressions InExpression Name Identifier Identifier ArithOp ArithOp ArithOp ArithOp ArithOp in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression InstanceOfExpression instance of Type QualifiedName VariableName BacktickIdentifier SpecialType days time duration years months date > ListType list < ContextType context ContextEntryTypes ContextEntryType FunctionType function ArgumentTypes ArgumentType PathExpression ] FilterExpression [ FunctionInvocation SpecialFunctionName NamedParameters NamedParameter ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral DateTimeConstructor AtLiteral ? SimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition FormalParameters FormalParameter external FunctionBody } { Context ContextEntry Key Name Identifier Expressions UnaryTests Wildcard not",maxTerm:174,context:KW,nodeProps:[["group",-17,4,19,23,29,31,33,41,42,68,70,72,85,86,88,89,90,97,"Expr",47,"Expr Expr",-5,78,79,80,81,82,"Expr Literal"],["closedBy",38,")",71,"]",96,"}"],["openedBy",40,"(",69,"[",95,"{"]],propSources:[eH],skippedNodes:[0,1,2],repeatNodeCount:14,tokenData:"2t~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx*[xy*ayz*fz{*k{|*x|}*}}!O+S!O!P+a!P!Q,k!Q![.f![!].}!]!^/S!^!_/X!_!`$i!`!a/h!b!c/r!}#O/w#P#Q/|#Q#R*s#S#T0R#o#p2j#q#r2o$f$g#i#BY#BZ#i$IS$I_#i$I|$I}$^$I}$JO$^$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~#nY#r~XY#iZ[#ipq#i$f$g#i#BY#BZ#i$IS$I_#i$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~$cO#s~~$fP!_!`$i~$nOr~~$qXOY$nYZ%^Zr$nrs'us#O$n#O#P'|#P;'S$n;'S;=`)c<%lO$n~%aVOr%^rs%vs#O%^#O#P%{#P;'S%^;'S;=`'S<%lO%^~%{O$j~~&OWOr%^rs&hs#O%^#O#P%{#P;'S%^;'S;=`'Y;=`<%l%^<%lO%^~&mV$j~Or%^rs%vs#O%^#O#P%{#P;'S%^;'S;=`'S<%lO%^~'VP;=`<%l%^~']WOr%^rs%vs#O%^#O#P%{#P;'S%^;'S;=`'S;=`<%l%^<%lO%^~'|O$j~$k~~(PYOY$nYZ$nZr$nrs(os#O$n#O#P'|#P;'S$n;'S;=`)i;=`<%l$n<%lO$n~(vX$j~$k~OY$nYZ%^Zr$nrs'us#O$n#O#P'|#P;'S$n;'S;=`)c<%lO$n~)fP;=`<%l$n~)lYOY$nYZ%^Zr$nrs'us#O$n#O#P'|#P;'S$n;'S;=`)c;=`<%l$n<%lO$n~*aO#{~~*fOv~~*kOx~~*pP^~z{*s~*xO_~~*}O[~~+SO$O~R+XPZP!`!a+[Q+aO$_Q~+fQ#z~!O!P+l!Q![+q~+qO#}~~+vR$i~!Q![+q!g!h,P#X#Y,P~,SR{|,]}!O,]!Q![,c~,`P!Q![,c~,hP$i~!Q![,c~,pQ]~z{,v!P!Q-}~,yTOz,vz{-Y{;'S,v;'S;=`-w<%lO,v~-]VOz,vz{-Y{!P,v!P!Q-r!Q;'S,v;'S;=`-w<%lO,v~-wOQ~~-zP;=`<%l,v~.SSP~OY-}Z;'S-};'S;=`.`<%lO-}~.cP;=`<%l-}~.kS$i~!O!P.w!Q![.f!g!h,P#X#Y,P~.zP!Q![+q~/SO$]~~/XO$t~R/`P!]QsP!_!`/cP/hOsPR/oP!YQsP!_!`/c~/wO$m~~/|O!i~~0RO!g~~0UVO#O0R#O#P0k#P#S0R#S#T1r#T;'S0R;'S;=`1w<%lO0R~0nWO#O0R#O#P0k#P#S0R#S#T1W#T;'S0R;'S;=`1};=`<%l0R<%lO0R~1]V$Z~O#O0R#O#P0k#P#S0R#S#T1r#T;'S0R;'S;=`1w<%lO0R~1wO$Z~~1zP;=`<%l0R~2QWO#O0R#O#P0k#P#S0R#S#T1r#T;'S0R;'S;=`1w;=`<%l0R<%lO0R~2oO#S~~2tO#R~",tokenizers:[NW,BW,qW,0,1],topRules:{Expression:[0,3],Expressions:[1,102],UnaryTests:[2,103]},dialects:{camunda:2568},dynamicPrecedences:{31:-1,68:1,72:-1,74:-1},specialized:[{term:122,get:e=>tH[e]||-1}],tokenPrec:2571});function iH(e){const t=[];return e.iterate({enter:e=>{const n=e.node;if(!n.type.isError)return;const i=n.parent,o=oH(n),r={from:n.from,to:n.to,severity:"error",type:"Syntax Error"};if(n.from!==n.to)r.message=`Unrecognized token in <${i.name}>`;else if(o)r.message=`Unrecognized token <${o.name}> in <${i.name}>`,r.to=o.to;else{const e=i.enterUnfinishedNodesBefore(n.to);r.message=`Incomplete <${(e||i).name}>`}t.push(r)}}),t}function oH(e){return e?e.nextSibling||oH(e.parent):null}var rH={create:e=>({enter(t){if("FilterExpression"!==t.name)return;const n=e.readContent(t.from,t.to);if(/\[\s*0\s*\]$/.test(n)){const{from:i,to:o}=t;e.report({from:i,to:o,message:"First item is accessed via [1]",severity:"warning",type:"first-item",actions:[{name:"fix",apply(t,r=i,s=o){e.updateContent(r,s,n.replace(/\[\s*0\s*\]$/,"[1]"))}}]})}}})};const sH=[rH];function aH(e){const{readContent:t,syntaxTree:n,updateContent:i}=e,o=[],r={readContent:t,report:e=>{o.push(e)},updateContent:i},s=sH.map((e=>e.create(r)));return n.iterate({enter:e=>{for(const t of s)t.enter&&t.enter(e)},leave:e=>{for(const t of s)t.leave&&t.leave(e)}}),o}const lH=[XR("function(${params}) ${body}",{label:"function",detail:"definition",type:"keyword"}),XR("for ${var} in ${collection} return ${value}",{label:"for",detail:"expression",type:"keyword"}),XR("every ${var} in ${collection} satisfies ${condition}",{label:"every",detail:"quantified expression",type:"keyword"}),XR("some ${var} in ${collection} satisfies ${condition}",{label:"some",detail:"quantified expression",type:"keyword"}),XR("if ${condition} then ${value} else ${other value}",{label:"if",detail:"block",type:"keyword"}),XR("{ ${key}: ${value} }",{label:"context",detail:"block",type:"keyword"}),XR("null",{label:"null",detail:"literal",type:"keyword"}),XR("true",{label:"true",detail:"literal",type:"keyword"}),XR("false",{label:"false",detail:"literal",type:"keyword"})];function cH(){return cH=Object.assign?Object.assign.bind():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},cH.apply(this,arguments)}function uH(e){const{context:t,after:n,before:i,keyword:o}=e;return function(e,t){const{nodes:n,before:i,after:o,keyword:r}=e;return e=>{const{state:s,pos:a}=e,l=vH(jP(s).resolveInner(a,-1),n);if(!l)return null;const[c]=l;return gH(c,a,[r,i])||function(e,t,n){return mH(e,t,n,1)}(c,a,[r,o])||o&&!gH(c,a,[o])?null:t(e)}}({nodes:t,before:i,after:n,keyword:o},VT([{label:o,type:"keyword",boost:10}]))}const hH=[uH({context:"InExpression",keyword:"in"}),uH({context:"IfExpression",keyword:"then",after:"if",before:"else"}),uH({context:"IfExpression",keyword:"else",after:"then"}),uH({context:"QuantifiedExpression",keyword:"satisfies"}),uH({context:"ForExpression",after:"InExpressions",keyword:"return"})],dH=["StringLiteral","Identifier","LineComment","BlockComment","PathExpression","Context","Key","ParameterName"],pH=["Expr","ContextEntry"];function fH(e){return function(e){const t=[...dH,...pH];return n=>{const{state:i,pos:o}=n,r=vH(jP(i).resolveInner(o,-1),t);if(r){const[e,t]=r;if(dH.includes(t))return null}return e(n)}}(VT(e.map((e=>cH({},e,{type:"text"})))))}function gH(e,t,n){return mH(e,t,n,-1)}function mH(e,t,n,i){let o=e[i>0?"childAfter":"childBefore"](t);for(;o;){if(n.includes(o.name))return o;if(o.type.isError&&o.firstChild&&n.includes(o.firstChild.name))return o.firstChild;o=o[i>0?"nextSibling":"prevSibling"]}return null}function vH(e,t){for(Array.isArray(t)||(t=[t]);e;e=e.parent){const n=e.type,i=t.find((e=>e&&n.is(e)));if(i)return[e,i];if(n.isTop)break}return null}const yH=QP.define({parser:nH.configure({props:[tT.add({Context:aT({closing:"}"}),"List FilterExpression":aT({closing:"]"}),"ParenthesizedExpression FunctionInvocation":cT({except:/^\s*\)/}),"ForExpression QuantifiedExpression IfExpression":cT({except:/^\s*(then|else|return|satisfies)\b/}),FunctionDefinition:cT({except:/^\s*(\(|\))/})}),hT.add({Context:dT,List:dT,ParenthesizedExpression:dT,FunctionDefinition(e){const t=e.getChild(")");return t?{from:t.to,to:e.to}:null}})]}),languageData:{indentOnInput:/^\s*(\)|\}|\]|then|else|return|satisfies)$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}}),bH=yH.configure({top:"UnaryTests"},"FEEL unary tests"),_H=yH.configure({top:"Expression"},"FEEL expression");var xH,OH=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(CH,i)?CH[i]:CH._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},wH=!1;"undefined"!=typeof document&&((xH=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',wH=!xH.getElementsByTagName("link").length,xH=void 0);var CH={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:wH?[1,"X<div>","</div>"]:[0,"",""]};CH.td=CH.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],CH.option=CH.optgroup=[1,'<select multiple="multiple">',"</select>"],CH.thead=CH.tbody=CH.colgroup=CH.caption=CH.tfoot=[1,"<table>","</table>"],CH.polyline=CH.ellipse=CH.polygon=CH.circle=CH.text=CH.line=CH.path=CH.rect=CH.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var kH=OH,EH=[AM((e=>{if(0===e.state.doc.length)return[];const t=jP(e.state),n=(i={syntaxTree:t,readContent:(t,n)=>e.state.sliceDoc(t,n),updateContent:(t,n,i)=>e.dispatch({changes:{from:t,to:n,insert:i}})},[...iH(i.syntaxTree),...aH(i)]);var i;return n.map((e=>({...e,source:e.type})))}))];var SH=[hS.theme({"& .cm-content":{padding:"0px"},"& .cm-line":{padding:"0px"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-completionInfo":{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis"},"&.cm-editor":{height:"100%"},"& .cm-completionInfo > *":{whiteSpace:"normal"},"& .cm-completionInfo ul":{margin:0,paddingLeft:"15px"},"& .cm-completionInfo pre":{marginBottom:0,whiteSpace:"pre-wrap"},"& .cm-completionInfo p":{marginTop:0},"& .cm-completionInfo p:not(:last-of-type)":{marginBottom:0}}),hS.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),vT(pT.define([{tag:RP.variableName,class:"variableName"},{tag:RP.name,class:"variableName"},{tag:RP.number,class:"number"},{tag:RP.string,class:"string"},{tag:RP.bool,class:"bool"},{tag:RP.function(RP.variableName),class:"function"},{tag:RP.function(RP.special(RP.variableName)),class:"function"},{tag:RP.controlKeyword,class:"control"},{tag:RP.operatorKeyword,class:"control"}]))];function $H(e){return e&&e.from===e.to}function PH(e){return!!e&&("PathExpression"===e.name||PH(e.parent))}function TH({variables:e}){return t=>{const n=jP(t.state).resolve(t.pos,-1);if(!PH(n))return;const i=function(e){for(;e;){if("PathExpression"===e.name)return e;e=e.parent}}(n),o=n===i?t.pos:n.from,r=RH(i,t);let s=e;for(var a=0;a<r.length-1;a++){var l=s.find((e=>e.name===r[a].name));if(!l)return null;if("optional"!==l.isList&&!!l.isList!==r[a].isList)return;s=l.entries}if(!s)return;s=s.map((e=>({label:e.name,type:"variable",info:e.info,detail:e.detail})));return{from:o,options:s}}}function RH(e,t){let n=[];for(let i=e.firstChild;i;i=i.nextSibling)"PathExpression"===i.name?n.push(...RH(i,t)):"FilterExpression"===i.name?n.push(...AH(i,t)):n.push({name:MH(i,t),isList:!1});return n}function AH(e,t){const n=e.firstChild;if("PathExpression"===n.name){const e=RH(n,t);return e[e.length-1].isList=!0,e}return[{name:MH(n,t),isList:!0}]}function MH(e,t){return t.state.sliceDoc(e.from,e.to)}function DH({variables:e=[],builtins:t=[]}){const n=function(e,t){return[].concat(e.map((e=>LH(e))),t.map((e=>LH(e))))}(e,t);return n.length?e=>{const{pos:t,state:i}=e,o=jP(i).resolve(t,-1);return function(e,t){const n=e.nextSibling;return $H(e)||n&&n.from===t&&$H(n)}(o,t)?e.explicit?{from:t,options:n}:null:!function(e){return e&&e.parent&&"VariableName"===e.parent.name}(o)||PH(o)?null:{from:o.from,options:n}}:e=>null}function LH(e,t){return"function"===e.type?function(e,t){const{name:n,info:i,detail:o,params:r=[]}=e,s=r.map((({name:e,type:t},n)=>({name:e||`param ${n+1}`,type:t}))),a=`${n}(${s.map((e=>"${"+e.name+"}")).join(", ")})`,l=s.map((({name:e,type:t})=>t?`${e}: ${t}`:e)).join(", "),c=`${n}(${l})`;return XR(a,{label:c,type:"function",info:i,detail:o,boost:t})}(e,t):{label:e.name,type:"variable",info:e.info,detail:e.detail,boost:t}}function IH({variables:e=[],builtins:t=[]}){return[TH({variables:e}),DH({variables:e,builtins:t}),lH,...hH]}function QH(e){return function(e={}){const t="unaryTests"===e.dialect?bH:_H,n=e.parserDialect,i=ZW(e.context),o=t.configure({contextTracker:i,dialect:n}),r=e.completions||[fH(lH),hH].flat();return new HP(o,[...r.map((e=>o.data.of({autocomplete:e})))])}(e)}const jH=Bx.define(),BH=Bx.define(),NH=Bx.define(),qH=Bx.define();function FH({dialect:e="expression",parserDialect:t,variables:n=[],builtins:i=[],completions:o=IH({builtins:i,variables:n})}){const r=function(e){return e.slice().reverse().reduce(((e,t)=>(e[t.name]=()=>{},e)),{})}([...n,...i]);return[NH.of(e),jH.of(i),BH.of(n),qH.of(t),QH({dialect:e,parserDialect:t,context:r,completions:o})]}const VH=DL.map((e=>({...e,info:()=>kH(e.info)}))),XH=new eO,zH=new eO;function YH({extensions:e=[],dialect:t="expression",parserDialect:n,container:i,contentAttributes:o={},tooltipContainer:r,onChange:s=()=>{},onKeyDown:a=()=>{},onLint:l=()=>{},placeholder:c="",readOnly:u=!1,value:h="",builtins:d=VH,variables:p=[]}){const f=hS.updateListener.of((e=>{e.docChanged&&s(e.state.doc.toString())})),g=hS.updateListener.of((e=>{const t=e.transactions.flatMap((e=>e.effects)).filter((e=>e.is(xM)));if(!t.length)return;const n=t.flatMap((e=>e.value));l(n)})),m=hS.domEventHandlers({keydown:a});"string"==typeof r&&(r=document.querySelector(r));const v=r?$S({tooltipSpace:function(){return r.getBoundingClientRect()}}):[],y=[lA(),XH.of(FH({dialect:t,builtins:d,variables:p,parserDialect:n})),$T(),uT(),GR(),hS.contentAttributes.of(o),f,m,bS.of([...mM]),EH,g,v,zH.of(kS(c)),SH,...e];return u&&y.push(hS.editable.of(!1)),this._cmEditor=new hS({state:SO.create({doc:h,extensions:y}),parent:i}),this}YH.prototype.setValue=function(e){this._cmEditor.dispatch({changes:{from:0,to:this._cmEditor.state.doc.length,insert:e}})},YH.prototype.focus=function(e){const t=this._cmEditor;if(t.contentDOM.focus(),t.focus(),"number"==typeof e){const n=t.state.doc.length;t.dispatch({selection:{anchor:e<=n?e:n}})}},YH.prototype.getSelection=function(){return this._cmEditor.state.selection},YH.prototype.setVariables=function(e){const t={builtins:(n=this._cmEditor.state).facet(jH)[0],variables:n.facet(BH)[0],dialect:n.facet(NH)[0],parserDialect:n.facet(qH)[0]};var n;this._cmEditor.dispatch({effects:[XH.reconfigure(FH({...t,variables:e}))]})},YH.prototype.setPlaceholder=function(e){this._cmEditor.dispatch({effects:zH.reconfigure(kS(e))})};
/*!
* tabbable 6.2.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
var WH=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],HH=WH.join(","),UH="undefined"==typeof Element,GH=UH?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ZH=!UH&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},KH=function e(t,n){var i;void 0===n&&(n=!0);var o=null==t||null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},JH=function(e,t,n){if(KH(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(HH));return t&&GH.call(e,HH)&&i.unshift(e),i=i.filter(n)},eU=function e(t,n,i){for(var o=[],r=Array.from(t);r.length;){var s=r.shift();if(!KH(s,!1))if("SLOT"===s.tagName){var a=s.assignedElements(),l=e(a.length?a:s.children,!0,i);i.flatten?o.push.apply(o,l):o.push({scopeParent:s,candidates:l})}else{GH.call(s,HH)&&i.filter(s)&&(n||!t.includes(s))&&o.push(s);var c=s.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(s),u=!KH(c,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(s));if(c&&u){var h=e(!0===c?s.children:c.children,!0,i);i.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else r.unshift.apply(r,s.children)}}return o},tU=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},nU=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!tU(e)?0:e.tabIndex},iU=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},oU=function(e){return"INPUT"===e.tagName},rU=function(e){return function(e){return oU(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ZH(e),i=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=i(window.CSS.escape(e.name));else try{t=i(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},sU=function(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return 0===n&&0===i},aU=function(e,t){var n=t.displayCheck,i=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=GH.call(e,"details>summary:first-of-type")?e.parentElement:e;if(GH.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return sU(e)}else{if("function"==typeof i){for(var r=e;e;){var s=e.parentElement,a=ZH(e);if(s&&!s.shadowRoot&&!0===i(s))return sU(e);e=e.assignedSlot?e.assignedSlot:s||a===e.ownerDocument?s:a.host}e=r}if(function(e){var t,n,i,o,r=e&&ZH(e),s=null===(t=r)||void 0===t?void 0:t.host,a=!1;if(r&&r!==e)for(a=!!(null!==(n=s)&&void 0!==n&&null!==(i=n.ownerDocument)&&void 0!==i&&i.contains(s)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&s;){var l,c,u;a=!(null===(c=s=null===(l=r=ZH(s))||void 0===l?void 0:l.host)||void 0===c||null===(u=c.ownerDocument)||void 0===u||!u.contains(s))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},lU=function(e,t){return!(t.disabled||KH(t)||function(e){return oU(e)&&"hidden"===e.type}(t)||aU(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var i=t.children.item(n);if("LEGEND"===i.tagName)return!!GH.call(t,"fieldset[disabled] *")||!i.contains(e)}return!0}t=t.parentElement}return!1}(t))},cU=function(e,t){return!(rU(t)||nU(t)<0||!lU(e,t))},uU=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},hU=function e(t){var n=[],i=[];return t.forEach((function(t,o){var r=!!t.scopeParent,s=r?t.scopeParent:t,a=function(e,t){var n=nU(e);return n<0&&t&&!tU(e)?0:n}(s,r),l=r?e(t.candidates):s;0===a?r?n.push.apply(n,l):n.push(s):i.push({documentOrder:o,tabIndex:a,item:t,isScope:r,content:l})})),i.sort(iU).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},dU=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==GH.call(e,HH)&&cU(t,e)},pU=WH.concat("iframe").join(","),fU=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==GH.call(e,pU)&&lU(t,e)};
/*!
* focus-trap 7.5.2
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/
function gU(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 mU(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gU(Object(n),!0).forEach((function(t){vU(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gU(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vU(e,t,n){return(t=function(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)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var yU=function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var i=e.indexOf(t);-1===i||e.splice(i,1),e.push(t)},bU=function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()},_U=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},xU=function(e){return _U(e)&&!e.shiftKey},OU=function(e){return _U(e)&&e.shiftKey},wU=function(e){return setTimeout(e,0)},CU=function(e,t){var n=-1;return e.every((function(e,i){return!t(e)||(n=i,!1)})),n},kU=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"==typeof e?e.apply(void 0,n):e},EU=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},SU=[],$U=function(e,t){var n,i=(null==t?void 0:t.document)||document,o=(null==t?void 0:t.trapStack)||SU,r=mU({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:xU,isKeyBackward:OU},t),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},a=function(e,t,n){return e&&void 0!==e[t]?e[t]:r[n||t]},l=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return s.containerGroups.findIndex((function(t){var i=t.container,o=t.tabbableNodes;return i.contains(e)||(null==n?void 0:n.includes(i))||o.find((function(t){return t===e}))}))},c=function(e){var t=r[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),s=1;s<n;s++)o[s-1]=arguments[s];t=t.apply(void 0,o)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var a=t;if("string"==typeof t&&!(a=i.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return a},u=function(){var e=c("initialFocus");if(!1===e)return!1;if(void 0===e||!fU(e,r.tabbableOptions))if(l(i.activeElement)>=0)e=i.activeElement;else{var t=s.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},h=function(){if(s.containerGroups=s.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?eU([e],t.includeContainer,{filter:cU.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:uU}):JH(e,t.includeContainer,cU.bind(null,t)),hU(n)}(e,r.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?eU([e],t.includeContainer,{filter:lU.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):JH(e,t.includeContainer,lU.bind(null,t))}(e,r.tabbableOptions),i=t.length>0?t[0]:void 0,o=t.length>0?t[t.length-1]:void 0,s=n.find((function(e){return dU(e)})),a=n.slice().reverse().find((function(e){return dU(e)})),l=!!t.find((function(e){return nU(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:l,firstTabbableNode:i,lastTabbableNode:o,firstDomTabbableNode:s,lastDomTabbableNode:a,nextTabbableNode:function(e){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=t.indexOf(e);return o<0?i?n.slice(n.indexOf(e)+1).find((function(e){return dU(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return dU(e)})):t[o+(i?1:-1)]}}})),s.tabbableGroups=s.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find((function(e){return e.posTabIndexesFound}))&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},d=function e(t){!1!==t&&t!==i.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!r.preventScroll}),s.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(u()))},p=function(e){var t=c("setReturnFocus",e);return t||!1!==t&&e},f=function(e){var t=e.target,n=e.event,i=e.isBackward,o=void 0!==i&&i;t=t||EU(n),h();var a=null;if(s.tabbableGroups.length>0){var u=l(t,n),d=u>=0?s.containerGroups[u]:void 0;if(u<0)a=o?s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:s.tabbableGroups[0].firstTabbableNode;else if(o){var p=CU(s.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(p<0&&(d.container===t||fU(t,r.tabbableOptions)&&!dU(t,r.tabbableOptions)&&!d.nextTabbableNode(t,!1))&&(p=u),p>=0){var f=0===p?s.tabbableGroups.length-1:p-1,g=s.tabbableGroups[f];a=nU(t)>=0?g.lastTabbableNode:g.lastDomTabbableNode}else _U(n)||(a=d.nextTabbableNode(t,!1))}else{var m=CU(s.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(m<0&&(d.container===t||fU(t,r.tabbableOptions)&&!dU(t,r.tabbableOptions)&&!d.nextTabbableNode(t))&&(m=u),m>=0){var v=m===s.tabbableGroups.length-1?0:m+1,y=s.tabbableGroups[v];a=nU(t)>=0?y.firstTabbableNode:y.firstDomTabbableNode}else _U(n)||(a=d.nextTabbableNode(t))}}else a=c("fallbackFocus");return a},g=function(e){var t=EU(e);l(t,e)>=0||(kU(r.clickOutsideDeactivates,e)?n.deactivate({returnFocus:r.returnFocusOnDeactivate}):kU(r.allowOutsideClick,e)||e.preventDefault())},m=function(e){var t=EU(e),n=l(t,e)>=0;if(n||t instanceof Document)n&&(s.mostRecentlyFocusedNode=t);else{var i;e.stopImmediatePropagation();var o=!0;if(s.mostRecentlyFocusedNode)if(nU(s.mostRecentlyFocusedNode)>0){var a=l(s.mostRecentlyFocusedNode),c=s.containerGroups[a].tabbableNodes;if(c.length>0){var h=c.findIndex((function(e){return e===s.mostRecentlyFocusedNode}));h>=0&&(r.isKeyForward(s.recentNavEvent)?h+1<c.length&&(i=c[h+1],o=!1):h-1>=0&&(i=c[h-1],o=!1))}}else s.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return nU(e)>0}))}))||(o=!1);else o=!1;o&&(i=f({target:s.mostRecentlyFocusedNode,isBackward:r.isKeyBackward(s.recentNavEvent)})),d(i||(s.mostRecentlyFocusedNode||u()))}s.recentNavEvent=void 0},v=function(e){if(function(e){return"Escape"===(null==e?void 0:e.key)||"Esc"===(null==e?void 0:e.key)||27===(null==e?void 0:e.keyCode)}(e)&&!1!==kU(r.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();(r.isKeyForward(e)||r.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s.recentNavEvent=e;var n=f({event:e,isBackward:t});n&&(_U(e)&&e.preventDefault(),d(n))}(e,r.isKeyBackward(e))},y=function(e){var t=EU(e);l(t,e)>=0||kU(r.clickOutsideDeactivates,e)||kU(r.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},b=function(){if(s.active)return yU(o,n),s.delayInitialFocusTimer=r.delayInitialFocus?wU((function(){d(u())})):d(u()),i.addEventListener("focusin",m,!0),i.addEventListener("mousedown",g,{capture:!0,passive:!1}),i.addEventListener("touchstart",g,{capture:!0,passive:!1}),i.addEventListener("click",y,{capture:!0,passive:!1}),i.addEventListener("keydown",v,{capture:!0,passive:!1}),n},_=function(){if(s.active)return i.removeEventListener("focusin",m,!0),i.removeEventListener("mousedown",g,!0),i.removeEventListener("touchstart",g,!0),i.removeEventListener("click",y,!0),i.removeEventListener("keydown",v,!0),n},x="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){var t=e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===s.mostRecentlyFocusedNode}))}));t&&d(u())})):void 0,O=function(){x&&(x.disconnect(),s.active&&!s.paused&&s.containers.map((function(e){x.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return s.active},get paused(){return s.paused},activate:function(e){if(s.active)return this;var t=a(e,"onActivate"),n=a(e,"onPostActivate"),o=a(e,"checkCanFocusTrap");o||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=i.activeElement,null==t||t();var r=function(){o&&h(),b(),O(),null==n||n()};return o?(o(s.containers.concat()).then(r,r),this):(r(),this)},deactivate:function(e){if(!s.active)return this;var t=mU({onDeactivate:r.onDeactivate,onPostDeactivate:r.onPostDeactivate,checkCanReturnFocus:r.checkCanReturnFocus},e);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,_(),s.active=!1,s.paused=!1,O(),bU(o,n);var i=a(t,"onDeactivate"),l=a(t,"onPostDeactivate"),c=a(t,"checkCanReturnFocus"),u=a(t,"returnFocus","returnFocusOnDeactivate");null==i||i();var h=function(){wU((function(){u&&d(p(s.nodeFocusedBeforeActivation)),null==l||l()}))};return u&&c?(c(p(s.nodeFocusedBeforeActivation)).then(h,h),this):(h(),this)},pause:function(e){if(s.paused||!s.active)return this;var t=a(e,"onPause"),n=a(e,"onPostPause");return s.paused=!0,null==t||t(),_(),O(),null==n||n(),this},unpause:function(e){if(!s.paused||!s.active)return this;var t=a(e,"onUnpause"),n=a(e,"onPostUnpause");return s.paused=!1,null==t||t(),h(),b(),O(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return s.containers=t.map((function(e){return"string"==typeof e?i.querySelector(e):e})),s.active&&h(),O(),this}},n.updateContainerElements(e),n},PU=function(e){return oX("svg",{...e,children:oX("path",{fillRule:"evenodd",d:"m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8Z"})})};PU.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16"};var TU=function(e){return oX("svg",{...e,children:[oX("path",{fill:"#fff",style:{mixBlendMode:"multiply"},d:"M0 0h16v16H0z"}),oX("path",{fill:"#fff",style:{mixBlendMode:"multiply"},d:"M0 0h16v16H0z"}),oX("path",{d:"M7 3H5v2h2V3zm4 0H9v2h2V3zM7 7H5v2h2V7zm4 0H9v2h2V7zm-4 4H5v2h2v-2zm4 0H9v2h2v-2z",fill:"#161616"})]})};TU.defaultProps={width:"16",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var RU=function(e){return oX("svg",{...e,children:oX("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274ZM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2Z",fill:"currentcolor"})})};RU.defaultProps={width:"16",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var AU=function(e){return oX("svg",{...e,children:[oX("path",{d:"M16 2a14 14 0 1 0 14 14A14 14 0 0 0 16 2Zm0 26a12 12 0 1 1 12-12 12 12 0 0 1-12 12Z"}),oX("circle",{cx:"16",cy:"23.5",r:"1.5"}),oX("path",{d:"M17 8h-1.5a4.49 4.49 0 0 0-4.5 4.5v.5h2v-.5a2.5 2.5 0 0 1 2.5-2.5H17a2.5 2.5 0 0 1 0 5h-2v4.5h2V17a4.5 4.5 0 0 0 0-9Z"}),oX("path",{style:{fill:"none"},d:"M0 0h32v32H0z"})]})};AU.defaultProps={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"};var MU=function(e){return oX("svg",{...e,children:[oX("path",{fill:"currentColor",d:"M28 4H10a2.006 2.006 0 0 0-2 2v14a2.006 2.006 0 0 0 2 2h18a2.006 2.006 0 0 0 2-2V6a2.006 2.006 0 0 0-2-2Zm0 16H10V6h18Z"}),oX("path",{fill:"currentColor",d:"M18 26H4V16h2v-2H4a2.006 2.006 0 0 0-2 2v10a2.006 2.006 0 0 0 2 2h14a2.006 2.006 0 0 0 2-2v-2h-2Z"})]})};function DU(e){const{element:t,headerProvider:n}=e,{getElementIcon:i,getDocumentationRef:o,getElementLabel:r,getTypeLabel:s}=n,a=r(t),l=s(t),c=o&&o(t),u=i(t);return oX("div",{class:"bio-properties-panel-header",children:[oX("div",{class:"bio-properties-panel-header-icon",children:u&&oX(u,{width:"32",height:"32",viewBox:"0 0 32 32"})}),oX("div",{class:"bio-properties-panel-header-labels",children:[oX("div",{title:l,class:"bio-properties-panel-header-type",children:l}),a?oX("div",{title:a,class:"bio-properties-panel-header-label",children:a}):null]}),oX("div",{class:"bio-properties-panel-header-actions",children:c?oX("a",{rel:"noopener",class:"bio-properties-panel-header-link",href:c,title:"Open documentation",target:"_blank",children:oX(RU,{})}):null})]})}MU.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32"};const LU=KF({description:{},getDescriptionForId:()=>{}}),IU=KF({errors:{}}),QU=KF({eventBus:null}),jU=KF({layout:{},setLayout:()=>{},getLayoutForKey:()=>{},setLayoutForKey:()=>{}}),BU=KF({tooltip:{},getTooltipForId:()=>{}});function NU(e){const{forId:t,element:n}=e,i=function(e,t){const{getTooltipForId:n}=yV(BU);return n(e,t)}(t,n),o=e.value||i;return o?oX(qU,{...e,value:o,forId:XU(t)}):e.children}function qU(e){const{forId:t,value:n,parent:i,direction:o="right",position:r}=e,[s,a]=dV(!1),[l,c]=dV(!1);let u=null;const h=gV(null),d=gV(null),p=async e=>{const t=()=>a(!0);s||u||(e instanceof MouseEvent?u=setTimeout(t,200):(t(),c(!0)))},f=()=>{a(!1),c(!1)};pV((()=>{const{current:e}=h;if(!e)return;const t=e=>{const t=document.activeElement===h.current||document.activeElement.closest(".bio-properties-panel-tooltip");!s||(({x:e,y:t})=>{const n=d.current,i=h.current;return n&&(FU(e,t,i.getBoundingClientRect())||FU(e,t,n.getBoundingClientRect()))})({x:e.x,y:e.y})||t&&l||f()},n=e=>{const{relatedTarget:t}=e;s&&!h.current.matches(":hover")&&t&&!t.closest(".bio-properties-panel-tooltip")&&f()};return document.addEventListener("wheel",t),document.addEventListener("focusout",n),document.addEventListener("mousemove",t),()=>{document.removeEventListener("wheel",t),document.removeEventListener("mousemove",t),document.removeEventListener("focusout",n)}}),[h.current,s,l]);const g=()=>oX("div",{class:`bio-properties-panel-tooltip ${o}`,role:"tooltip",id:"bio-properties-panel-tooltip","aria-labelledby":t,style:r||VU(h.current),ref:d,onClick:e=>e.stopPropagation(),children:[oX("div",{class:"bio-properties-panel-tooltip-content",children:n}),oX("div",{class:"bio-properties-panel-tooltip-arrow"})]});return oX("div",{class:"bio-properties-panel-tooltip-wrapper",tabIndex:"0",ref:h,onMouseEnter:p,onMouseLeave:()=>{clearTimeout(u),u=null},onFocus:p,onKeyDown:e=>{"Escape"===e.code&&f()},children:[e.children,s?i?FV(g(),i.current):g():null]})}function FU(e,t,n){const{top:i,right:o,bottom:r,left:s}=n;return e>=s&&e<=o&&t>=i&&t<=r}function VU(e){const t=e.getBoundingClientRect();return`right: ${`calc(100% - ${t.x}px)`}; top: ${t.top-10+"px"};`}function XU(e){return`bio-properties-panel-${e}`}function zU(e){const{errors:t}=yV(IU);return t[e]}function YU(e,t,n){const i=yV(QU);n||({eventBus:n}=i);const o=gV(!1);n&&!o.current&&n.on(e,t),pV((()=>(n&&o.current&&n.on(e,t),o.current=!0,()=>{n&&n.off(e,t)})),[t,e,n])}function WU(e){const{onShow:t}=yV(jU),n=gV(),i=gV(!1),o=vV((n=>{n.id===e&&(t(),i.current||(i.current=!0))}),[e]);return pV((()=>{i.current&&n.current&&(_(n.current.focus)&&n.current.focus(),_(n.current.select)&&n.current.select(),i.current=!1)})),YU("propertiesPanel.showEntry",o),n}function HU(e){const t=gV(e);return t.current=e,vV(((...e)=>t.current(...e)),[])}function UU(e){const{element:t,entries:n=[],id:i,label:o,shouldOpen:r=!1}=e,s=gV(null),[a,l]=function(e,t){const{getLayoutForKey:n,setLayoutForKey:i}=yV(jU);return[n(e,t),vV((t=>{i(e,t)}),[i])]}(["groups",i,"open"],r),c=vV((()=>l(!0)),[l]),[u,h]=dV(!1),[d,p]=dV(!1);pV((()=>{const e=requestAnimationFrame((()=>{const e=n.find((e=>{const{id:t,isEdited:n}=e,i=fX(`[data-entry-id="${t}"]`);if(!_(n)||!i)return!1;return n(fX(".bio-properties-panel-input",i))}));h(e)}));return()=>cancelAnimationFrame(e)}),[n,h]);const f=function(){const{errors:e}=yV(IU);return e}(),g=n.some((e=>f[e.id]));!function(e,t,n){const[i,o]=dV(fX(t)),r=vV((()=>{const e=fX(t);e!==i&&o(e)}),[t,i]);pV((()=>{r()}),[r]),YU("propertiesPanel.attach",r),YU("propertiesPanel.detach",r),pV((()=>{const t=IntersectionObserver;if(!t)return;if(!e.current||!i)return;const o=new t((e=>{0!==i.scrollHeight&&e.forEach((e=>{e.intersectionRatio<1?n(!0):1===e.intersectionRatio&&n(!1)}))}),{root:i,rootMargin:"0px 0px 999999% 0px",threshold:[1]});return o.observe(e.current),()=>{o.unobserve(e.current)}}),[e.current,i,n])}(s,"div.bio-properties-panel-scroll-container",p);const m={...yV(jU),onShow:c};return oX("div",{class:"bio-properties-panel-group","data-group-id":"group-"+i,ref:s,children:[oX("div",{class:cX("bio-properties-panel-group-header",u?"":"empty",a?"open":"",d&&a?"sticky":""),onClick:()=>l(!a),children:[oX("div",{title:e.tooltip?null:o,"data-title":o,class:"bio-properties-panel-group-header-title",children:oX(NU,{value:e.tooltip,forId:"group-"+i,element:t,parent:s,children:o})}),oX("div",{class:"bio-properties-panel-group-header-buttons",children:[oX(GU,{edited:u,hasErrors:g}),oX("button",{type:"button",title:"Toggle section",class:"bio-properties-panel-group-header-button bio-properties-panel-arrow",children:oX(PU,{class:a?"bio-properties-panel-arrow-down":"bio-properties-panel-arrow-right"})})]})]}),oX("div",{class:cX("bio-properties-panel-group-entries",a?"open":""),children:oX(jU.Provider,{value:m,children:n.map((e=>{const{component:n,id:i}=e;return PF(n,{...e,element:t,key:i})}))})})]})}function GU(e){const{edited:t,hasErrors:n}=e;return n?oX("div",{title:"Section contains an error",class:"bio-properties-panel-dot bio-properties-panel-dot--error"}):t?oX("div",{title:"Section contains data",class:"bio-properties-panel-dot"}):null}function ZU(e){const{text:t,icon:n}=e;return oX("div",{class:"bio-properties-panel open",children:oX("section",{class:"bio-properties-panel-placeholder",children:[n&&oX(n,{class:"bio-properties-panel-placeholder-icon"}),oX("p",{class:"bio-properties-panel-placeholder-text",children:t})]})})}function KU(e){const{element:t,forId:n,value:i}=e,o=function(e,t){const{getDescriptionForId:n}=yV(LU);return n(e,t)}(n,t),r=i||o;if(r)return oX("div",{class:"bio-properties-panel-description",children:r})}const JU=()=>{},eG=RV(((e,t)=>{const{onInput:n,disabled:i,tooltipContainer:o,enableGutters:r,value:s,onLint:a=JU,onPopupOpen:l=JU,popupOpen:c,contentAttributes:u={},hostLanguage:h=null,singleLine:d=!1}=e,p=gV(),[f,g]=dV(),[m,v]=dV(s||"");!function(e,t){const[n,i]=dV(void 0);t.current=mV((()=>({focus:t=>{e?e.focus(t):(void 0===t&&(t=1/0),i(t))}})),[e]),pV((()=>{void 0!==n&&e&&(e.focus(n),i(!1))}),[e,n])}(f,t);const y=HU((e=>{n(e),v(e)}));pV((()=>{let e;return e=new iW({container:p.current,onChange:y,value:m,onLint:a,contentAttributes:u,tooltipContainer:o,enableGutters:r,hostLanguage:h,singleLine:d}),g(e),()=>{a([]),p.current.innerHTML="",g(null)}}),[]),pV((()=>{f&&s!==m&&(f.setValue(s),v(s))}),[s]);return oX("div",{class:cX("bio-properties-panel-feelers-editor-container",c?"popupOpen":null),children:[oX("div",{class:"bio-properties-panel-feelers-editor__open-popup-placeholder",children:"Opened in editor"}),oX("div",{name:e.name,class:cX("bio-properties-panel-feelers-editor bio-properties-panel-input",m?"edited":null,i?"disabled":null),ref:p,onClick:()=>{t.current.focus()}}),oX("button",{type:"button",title:"Open pop-up editor",class:"bio-properties-panel-open-feel-popup",onClick:()=>l("feelers"),children:oX(RU,{})})]})})),tG=()=>{},nG=RV(((e,t)=>{const{contentAttributes:n,enableGutters:i,value:o,onInput:r,onFeelToggle:s=tG,onLint:a=tG,onPopupOpen:l=tG,popupOpen:c,disabled:u,tooltipContainer:h,variables:d}=e,p=gV(),[f,g]=dV(),[m,v]=dV(o||"");!function(e,t){const[n,i]=dV(void 0);t.current=mV((()=>({focus:t=>{e?e.focus(t):(void 0===t&&(t=1/0),i(t))}})),[e]),pV((()=>{void 0!==n&&e&&(e.focus(n),i(!1))}),[e,n])}(f,t);const y=HU((e=>{r(e),v(e)}));pV((()=>{let e;return e=new YH({container:p.current,onChange:y,onKeyDown:t=>{if("Backspace"!==t.key||!e)return;const n=e.getSelection(),i=n.ranges[n.mainIndex];0===i.from&&0===i.to&&s()},onLint:a,tooltipContainer:h,value:m,variables:d,extensions:[...i?[p$()]:[],hS.lineWrapping],contentAttributes:n}),g(e),()=>{a([]),p.current.innerHTML="",g(null)}}),[]),pV((()=>{f&&o!==m&&(f.setValue(o),v(o))}),[o]),pV((()=>{f&&f.setVariables(d)}),[d]);return oX("div",{class:cX("bio-properties-panel-feel-editor-container",u?"disabled":null,c?"popupOpen":null),children:[oX("div",{class:"bio-properties-panel-feel-editor__open-popup-placeholder",children:"Opened in editor"}),oX("div",{name:e.name,class:cX("bio-properties-panel-input",m?"edited":null),ref:p,onClick:()=>{t.current.focus()}}),oX("button",{type:"button",title:"Open pop-up editor",class:"bio-properties-panel-open-feel-popup",onClick:()=>l(),children:oX(MU,{})})]})})),iG=KF({open:()=>{},close:()=>{},source:null});function oG(e,t){let n,i,o;function r(t){const r={x:t.clientX-i,y:t.clientY-o};return e.call(n,t,r)}function s(){document.removeEventListener("dragover",r,!0),document.removeEventListener("dragenter",rG,!0),document.removeEventListener("dragend",s),document.removeEventListener("drop",rG)}return function(e){n=this,i=e.clientX,o=e.clientY,e.dataTransfer&&e.dataTransfer.setDragImage(t||pX('<canvas width="0" height="0" />'),0,0),document.addEventListener("dragover",r,!0),document.addEventListener("dragenter",rG,!0),document.addEventListener("dragend",s),document.addEventListener("drop",rG)}}function rG(e){e.preventDefault(),e.stopPropagation()}const sG=()=>{};const aG=RV((function(e,t){const{container:n,className:i,delayInitialFocus:o,position:r,width:s,height:a,onClose:l,onPostActivate:c=sG,onPostDeactivate:u=sG,returnFocus:h=!0,closeOnEscape:d=!0,title:p}=e,f=gV(null),g=gV(null),m=t||g,v=mV((()=>function(e){if("string"==typeof e)return fX(e);return e}(n)),[n]),y=()=>{f.current&&f.current.activate()};let b={};return r&&(b={...b,top:r.top+"px",left:r.left+"px"}),s&&(b.width=s+"px"),a&&(b.height=a+"px"),pV((()=>(m.current&&m.current.addEventListener("focusin",y),()=>{m.current.removeEventListener("focusin",y)})),[m]),pV((()=>(m.current&&(f.current=$U(m.current,{clickOutsideDeactivates:!0,delayInitialFocus:o,fallbackFocus:m.current,onPostActivate:c,onPostDeactivate:u,returnFocusOnDeactivate:h}),f.current.activate()),()=>f.current&&f.current.deactivate())),[m]),YU("propertiesPanel.detach",l),FV(oX("div",{"aria-label":p,tabIndex:-1,ref:m,onKeyDown:e=>{e.stopPropagation(),d&&"Escape"===e.key&&l()},role:"dialog",class:cX("bio-properties-panel-popup",i),style:b,children:e.children}),v||document.body)}));function lG(e){return e.closest(".bio-properties-panel-popup")}aG.Title=function(e){const{children:t,className:n,draggable:i,emit:o=()=>{},title:r,...s}=e,a=gV({startPosition:null,newPosition:null}),l=gV(),c=gV(),u=(e,t)=>{!function(e){e.preventDefault(),e.stopPropagation()}(e);const{x:n,y:i}=t,r={x:a.current.startPosition.x+n,y:a.current.startPosition.y+i},s=lG(c.current);s.style.top=r.y+"px",s.style.left=r.x+"px",o("dragover",{newPosition:r,delta:t})};return oX("div",{class:cX("bio-properties-panel-popup__header",i&&"draggable",n),ref:c,draggable:i,onDragStart:e=>{oG(u,l.current)(e),e.stopPropagation();const t=lG(c.current).getBoundingClientRect();a.current.startPosition={x:t.left,y:t.top},o("dragstart")},onDragEnd:()=>{a.current.newPosition=null,o("dragend")},...s,children:[i&&oX(RF,{children:[oX("div",{ref:l,class:"bio-properties-panel-popup__drag-preview"}),oX("div",{class:"bio-properties-panel-popup__drag-handle",children:oX(TU,{})})]}),oX("div",{class:"bio-properties-panel-popup__title",children:r}),t]})},aG.Body=function(e){const{children:t,className:n,...i}=e;return oX("div",{class:cX("bio-properties-panel-popup__body",n),...i,children:t})},aG.Footer=function(e){const{children:t,className:n,...i}=e;return oX("div",{class:cX("bio-properties-panel-popup__footer",n),...i,children:e.children})};function cG(e){const{element:t,eventBus:n={fire(){},on(){},off(){}},popupContainer:i}=e,o=function(e){const t=gV();return pV((()=>{t.current=e})),t.current}(t),[r,s]=dV({}),[a,l]=dV(!1),[c,u]=dV(null),[h,d]=dV(null),p=(e,t)=>{n.fire("feelPopup."+e,t)},f=vV((()=>!!a),[a]);!function(e,t){const n=gV(!1);pV((()=>{if(n.current)return e();n.current=!0}),t)}((()=>{a||p("closed")}),[a]);const g=(e,t,n)=>{u(e),s(t),l(!0),d(n),p("open")},m=(e={})=>{const{id:t}=e;t&&t!==c||(l(!1),u(null))},v={open:g,close:m,source:c};return pV((()=>{t&&o&&t!==o&&m()}),[t]),pV((()=>{const e=()=>f();return n.on("feelPopup._close",m),n.on("feelPopup._open",(e=>{const{entryId:t,popupConfig:n,sourceElement:i}=e;g(t,n,i)})),n.on("feelPopup._isOpen",e),()=>{n.off("feelPopup._close",m),n.off("feelPopup._open",g),n.off("feelPopup._isOpen",e)}}),[n,f]),oX(iG.Provider,{value:v,children:[a&&oX(uG,{onClose:m,container:i,sourceElement:h,emit:p,...r}),e.children]})}function uG(e){const{container:t,id:n,hostLanguage:i,onInput:o,onClose:r,position:s,singleLine:a,sourceElement:l,title:c,tooltipContainer:u,type:h,value:d,variables:p,emit:f}=e,g=gV(),m=gV(),v=gV(!1);return pV((()=>(f("opened",{domNode:m.current}),()=>f("close",{domNode:m.current}))),[]),pV((()=>{g.current&&g.current.focus()}),[g]),oX(aG,{container:t,className:"bio-properties-panel-feel-popup",emit:f,position:s,title:c,onClose:r,returnFocus:!1,closeOnEscape:!1,delayInitialFocus:!1,onPostDeactivate:()=>{l&&l.focus()},height:250,width:700,ref:m,children:[oX(aG.Title,{title:c,emit:f,draggable:!0,children:["feel"===h&&oX("a",{href:"https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/",target:"_blank",class:"bio-properties-panel-feel-popup__title-link",children:["Learn FEEL expressions",oX(AU,{})]}),"feelers"===h&&oX("a",{href:"https://docs.camunda.io/docs/components/modeler/forms/configuration/forms-config-templating-syntax/",target:"_blank",class:"bio-properties-panel-feel-popup__title-link",children:["Learn templating",oX(AU,{})]})]}),oX(aG.Body,{children:oX("div",{onKeyDownCapture:e=>{"Escape"===e.key&&(v.current=e.target.closest(".cm-editor").querySelector(".cm-tooltip-autocomplete"))},onKeyDown:e=>{"Escape"===e.key&&(v.current||(r(),v.current=!1))},class:"bio-properties-panel-feel-popup__body",children:["feel"===h&&oX(nG,{enableGutters:!0,id:hG(n),name:n,onInput:o,value:d,variables:p,ref:g,tooltipContainer:u}),"feelers"===h&&oX(eG,{id:hG(n),contentAttributes:{"aria-label":c},enableGutters:!0,hostLanguage:i,name:n,onInput:o,value:d,ref:g,singleLine:a,tooltipContainer:u})]})}),oX(aG.Footer,{children:oX("button",{type:"button",onClick:()=>r(),title:"Close pop-up editor",class:"bio-properties-panel-feel-popup__close-btn",children:"Close"})})]})}function hG(e){return`bio-properties-panel-${e}`}function dG(e){const{id:t,label:n,onInput:i,value:o,switcherLabel:r,inline:s,onFocus:a,onBlur:l,inputRef:c,tooltip:u}=e,[h,d]=dV(o);return pV((()=>{o!==h&&d(o)}),[o]),oX("div",{class:cX("bio-properties-panel-toggle-switch",{inline:s}),children:[oX("label",{class:"bio-properties-panel-label",for:pG(t),children:oX(NU,{value:u,forId:t,element:e.element,children:n})}),oX("div",{class:"bio-properties-panel-field-wrapper",children:[oX("label",{class:"bio-properties-panel-toggle-switch__switcher",children:[oX("input",{ref:c,id:pG(t),class:"bio-properties-panel-input",type:"checkbox",onFocus:a,onBlur:l,name:t,onInput:e=>{(async()=>{i(!o)})(),d(e.target.value)},checked:!!h}),oX("span",{class:"bio-properties-panel-toggle-switch__slider"})]}),r&&oX("p",{class:"bio-properties-panel-toggle-switch__label",children:r})]})]})}function pG(e){return`bio-properties-panel-${e}`}function fG(e){const{debounce:t,disabled:n,displayLabel:i=!0,id:o,inputRef:r,label:s,max:a,min:l,onInput:c,step:u,value:h="",onFocus:d,onBlur:p}=e,[f,g]=dV(h),m=mV((()=>t((e=>{e.validity.valid&&c(e.value?parseFloat(e.value):void 0)}))),[c,t]);return pV((()=>{h!==f&&g(h)}),[h]),oX("div",{class:"bio-properties-panel-numberfield",children:[i&&oX("label",{for:gG(o),class:"bio-properties-panel-label",children:s}),oX("input",{id:gG(o),ref:r,type:"number",name:o,spellCheck:"false",autoComplete:"off",disabled:n,class:"bio-properties-panel-input",max:a,min:l,onInput:e=>{m(e.target),g(e.target.value)},onFocus:d,onBlur:p,step:u,value:f})]})}function gG(e){return`bio-properties-panel-${e}`}function mG(e){return`bio-properties-panel-${e}`}RV(((e,t)=>{const{id:n,disabled:i,onInput:o,value:r,onFocus:s,onBlur:a}=e,l=gV();return t.current={focus:e=>{const t=l.current;t&&(t.focus(),"number"==typeof e&&(e>r.length&&(e=r.length),t.setSelectionRange(e,e)))}},oX("input",{id:mG(n),type:"text",ref:l,name:n,spellCheck:"false",autoComplete:"off",disabled:i,class:"bio-properties-panel-input",onInput:e=>o(e.target.value),onFocus:s,onBlur:a,value:r||""})})),RV(((e,t)=>{const{id:n,debounce:i,disabled:o,onInput:r,value:s,min:a,max:l,step:c,onFocus:u,onBlur:h}=e,d=gV();return t.current={focus:e=>{const t=d.current;t&&(t.focus(),"number"==typeof e&&e!==1/0&&(e>s.length&&(e=s.length),t.setSelectionRange(e,e)))}},oX(fG,{id:n,debounce:i,disabled:o,displayLabel:!1,inputRef:d,max:l,min:a,onInput:r,step:c,value:s,onFocus:u,onBlur:h})})),RV(((e,t)=>{const{id:n,disabled:i,onInput:o,value:r,onFocus:s,onBlur:a}=e,l=gV();return t.current={focus:()=>{const e=l.current;e&&(e.focus(),e.setSelectionRange(0,0))}},oX("textarea",{id:mG(n),type:"text",ref:l,name:n,spellCheck:"false",autoComplete:"off",disabled:i,class:"bio-properties-panel-input",onInput:e=>o(e.target.value),onFocus:s,onBlur:a,value:r||"","data-gramm":"false"})})),RV(((e,t)=>{const{id:n,onInput:i,value:o,onFocus:r,onBlur:s,switcherLabel:a}=e,l=gV();return t.current={focus:()=>{const e=l.current;e&&e.focus()}},oX(dG,{id:n,value:o,inputRef:l,onInput:i,onFocus:r,onBlur:s,switcherLabel:a})})),RV(((e,t)=>{const{id:n,disabled:i,onInput:o,value:r,onFocus:s,onBlur:a}=e,l=gV();return t.current={focus:()=>{const e=l.current;e&&e.focus()}},oX("input",{ref:l,id:mG(n),name:n,onFocus:s,onBlur:a,type:"checkbox",class:"bio-properties-panel-input",onChange:({target:e})=>{o(e.checked)},checked:r,disabled:i})}));const vG={},yG={},bG={};function _G(e){const{element:t,headerProvider:n,placeholderProvider:i,groups:o,layoutConfig:r,layoutChanged:s,descriptionConfig:a,descriptionLoaded:l,tooltipConfig:c,tooltipLoaded:u,feelPopupContainer:h,eventBus:d}=e,[p,g]=dV(xG(r));!function(e,t){const n=gV(!1);fV((()=>{if(n.current)return e();n.current=!0}),t)}((()=>{const e=xG(r);g(e)}),[r]),pV((()=>{"function"==typeof s&&s(p)}),[p,s]);const y={layout:p,setLayout:g,getLayoutForKey:(e,t)=>function(e,t,n){let i=e;return k(t,(function(e){if(m(i))return i=void 0,!1;i=i[e]})),f(i)?n:i}(p,e,t),setLayoutForKey:(e,t)=>{const n=F({},p);V(n,e,t),g(n)}},b=mV((()=>function(e={}){return{...yG,...e}}(a)),[a]);pV((()=>{"function"==typeof l&&l(b)}),[b,l]);const _={description:b,getDescriptionForId:(e,t)=>b[e]&&b[e](t)},x=mV((()=>function(e={}){return{...bG,...e}}(c)),[c]);pV((()=>{"function"==typeof u&&u(x)}),[x,u]);const O={tooltip:x,getTooltipForId:(e,t)=>x[e]&&x[e](t)},[w,C]=dV({});YU("propertiesPanel.setErrors",(({errors:e})=>C(e)),d);const E={errors:w},S={eventBus:d},$={element:t};return i&&!t?oX(ZU,{...i.getEmpty()}):i&&v(t)?oX(ZU,{...i.getMultiple()}):oX(jU.Provider,{value:$,children:oX(IU.Provider,{value:E,children:oX(LU.Provider,{value:_,children:oX(BU.Provider,{value:O,children:oX(jU.Provider,{value:y,children:oX(QU.Provider,{value:S,children:oX(cG,{element:t,eventBus:d,popupContainer:h,children:oX("div",{class:"bio-properties-panel",children:[oX(DU,{element:t,headerProvider:n}),oX("div",{class:"bio-properties-panel-scroll-container",children:o.map((e=>{const{component:n=UU,id:i}=e;return PF(n,{...e,key:i,element:t})}))})]})})})})})})})})}function xG(e={},t=vG){return{...t,...e}}function OG(e){e.style.height="auto",e.style.height=`${e.scrollHeight+2}px`}function wG(e){const{id:t,label:n,debounce:i,onInput:o,value:r="",disabled:s,monospace:a,onFocus:l,onBlur:c,autoResize:u,rows:h=(u?1:2),tooltip:d}=e,[p,f]=dV(r),g=WU(t),m=mV((()=>i((e=>o(e.value.length?e.value:void 0)))),[o,i]);return fV((()=>{u&&OG(g.current)}),[]),pV((()=>{r!==p&&f(r)}),[r]),oX("div",{class:"bio-properties-panel-textarea",children:[oX("label",{for:EG(t),class:"bio-properties-panel-label",children:oX(NU,{value:d,forId:t,element:e.element,children:n})}),oX("textarea",{ref:g,id:EG(t),name:t,spellCheck:"false",class:cX("bio-properties-panel-input",a?"bio-properties-panel-input-monospace":"",u?"auto-resize":""),onInput:e=>{m(e.target),u&&OG(e.target),f(e.target.value)},onFocus:l,onBlur:c,rows:h,value:p,disabled:s,"data-gramm":"false"})]})}function CG(e){const{element:t,id:n,description:i,debounce:o,label:r,getValue:s,setValue:a,rows:l,monospace:c,disabled:u,validate:h,onFocus:d,onBlur:p,autoResize:f,tooltip:g}=e,m=zU(n),[v,y]=dV(null);let b=s(t);pV((()=>{if(_(h)){const e=h(b)||null;y(e)}}),[b,h]);const x=m||v;return oX("div",{class:cX("bio-properties-panel-entry",x?"has-error":""),"data-entry-id":n,children:[oX(wG,{id:n,label:r,value:b,onInput:e=>{let t=null;_(h)&&(t=h(e)||null),a(e,t),y(t)},onFocus:d,onBlur:p,rows:l,debounce:o,monospace:c,disabled:u,autoResize:f,tooltip:g,element:t},t),x&&oX("div",{class:"bio-properties-panel-error",children:x}),oX(KU,{forId:n,element:t,value:i})]})}function kG(e){return e&&!!e.value}function EG(e){return`bio-properties-panel-${e}`}function SG(e){const{debounce:t,disabled:n=!1,id:i,label:o,onInput:r,onFocus:s,onBlur:a,value:l="",tooltip:c}=e,[u,h]=dV(l||""),d=WU(i),p=mV((()=>t((e=>r(e.value.length?e.value:void 0)))),[r,t]);return pV((()=>{l!==u&&h(l)}),[l]),oX("div",{class:"bio-properties-panel-textfield",children:[oX("label",{for:PG(i),class:"bio-properties-panel-label",children:oX(NU,{value:c,forId:i,element:e.element,children:o})}),oX("input",{ref:d,id:PG(i),type:"text",name:i,spellCheck:"false",autoComplete:"off",disabled:n,class:"bio-properties-panel-input",onInput:e=>{p(e.target),h(e.target.value)},onFocus:s,onBlur:a,value:u})]})}function $G(e){return e&&!!e.value}function PG(e){return`bio-properties-panel-${e}`}function TG(e){return function(t){return!1!==e?N(t,b(e)?e:300):t}}TG.$inject=["config.debounceInput"];var RG={debounceInput:["factory",TG]};class AG{constructor(e){this._eventBus=e}isOpen(){return this._eventBus.fire("feelPopup._isOpen")}open(e,t,n){return this._eventBus.fire("feelPopup._open",{entryId:e,popupConfig:t,sourceElement:n})}close(){return this._eventBus.fire("feelPopup._close")}}AG.$inject=["eventBus"];var MG={feelPopup:["type",AG]};function DG(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 LG,IG,QG,jG={};function BG(){LG=window.addEventListener?"addEventListener":"attachEvent",IG=window.removeEventListener?"removeEventListener":"detachEvent",QG="addEventListener"!==LG?"on":""}var NG,qG=DG({__proto__:null,bind:jG.bind=function(e,t,n,i){return LG||BG(),e[LG](QG+t,n,i||!1),n},unbind:jG.unbind=function(e,t,n,i){return IG||BG(),e[IG](QG+t,n,i||!1),n},default:jG},[jG]),FG=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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var o=Object.prototype.hasOwnProperty.call(XG,i)?XG[i]:XG._default,r=o[0],s=o[1],a=o[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;r--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},VG=!1;"undefined"!=typeof document&&((NG=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',VG=!NG.getElementsByTagName("link").length,NG=void 0);var XG={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:VG?[1,"X<div>","</div>"]:[0,"",""]};XG.td=XG.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],XG.option=XG.optgroup=[1,'<select multiple="multiple">',"</select>"],XG.thead=XG.tbody=XG.colgroup=XG.caption=XG.tfoot=[1,"<table>","</table>"],XG.polyline=XG.ellipse=XG.polygon=XG.circle=XG.text=XG.line=XG.path=XG.rect=XG.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var zG=FG;const YG=KF({selectedElement:null,injector:null,getService:()=>null});function WG(e,t){var n=HG(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function HG(e){return e&&e.businessObject||e}function UG(e){var t=e.businessObject,n=function(e){return WG(e,"dmn:Decision")||WG(e,"dmn:BusinessKnowledgeModel")||WG(e,"dmn:InputData")||WG(e,"dmn:KnowledgeSource")?"name":WG(e,"dmn:TextAnnotation")?"text":void 0}(t);if(n)return t[n]||""}var GG;function ZG(){return ZG=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ZG.apply(null,arguments)}var KG;function JG(){return JG=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},JG.apply(null,arguments)}var eZ;function tZ(){return tZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},tZ.apply(null,arguments)}var nZ;function iZ(){return iZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},iZ.apply(null,arguments)}var oZ;function rZ(){return rZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},rZ.apply(null,arguments)}var sZ,aZ=function(e){return PF("svg",rZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),oZ||(oZ=PF("path",{d:"M3.563 0A3.554 3.554 0 0 0 .01 3.552L0 28.446A3.554 3.554 0 0 0 3.555 32h24.882a3.554 3.554 0 0 0 3.554-3.552L32 3.554A3.554 3.554 0 0 0 28.445 0H3.563ZM14 14l15 .016V20l-15-.016V14Zm0-11 15 .022V11l-15-.022V3Zm-3 16.992L3 20v-5.992L11 14v5.992Zm0-9.003L3 11V3.01L11 3v7.99ZM3 23.008 11 23v5.992L3 29v-5.992Zm11 5.984V23l15 .016V29l-15-.008Z"})))};function lZ(){return lZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},lZ.apply(null,arguments)}var cZ;function uZ(){return uZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},uZ.apply(null,arguments)}var hZ;function dZ(){return dZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},dZ.apply(null,arguments)}var pZ;function fZ(){return fZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},fZ.apply(null,arguments)}var gZ;function mZ(){return mZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},mZ.apply(null,arguments)}var vZ={Association:function(e){return PF("svg",ZG({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),GG||(GG=PF("path",{fill:"none",stroke:"#000",strokeDasharray:"3.3,6",strokeLinecap:"square",strokeWidth:2,d:"m1.5 30.5 29-29"})))},AuthorityRequirement:function(e){return PF("svg",JG({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),KG||(KG=PF("path",{fillRule:"evenodd",d:"m6.364 24.235 1.414 1.414-6.364 6.364L0 30.598l6.364-6.363Zm8-8 1.414 1.414-6.364 6.364L8 22.598l6.364-6.363Zm8-8 1.414 1.414-6.364 6.364L16 14.598l6.364-6.363ZM28 0a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"})))},BusinessKnowledgeModel:function(e){return PF("svg",tZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),eZ||(eZ=PF("path",{d:"M6.258 8 0 15.358l.001.325.028 8.259h25.977L32 16.518V8H6.258Zm.812 1.756h23.174v6.142l-5.077 6.288H1.779L1.759 16l5.31-6.245Z"})))},Decision:function(e){return PF("svg",iZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),nZ||(nZ=PF("path",{fillRule:"evenodd",d:"M0 6v20.711h32V6H0Zm1.697 1.697h28.606v17.317H1.697V7.697Z"})))},DecisionTable:aZ,Definitions:aZ,DRD:aZ,InformationRequirement:function(e){return PF("svg",lZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),sZ||(sZ=PF("path",{d:"M32 .06S20.33 6.015 14.403 8.8c1.27 1.16 2.451 2.41 3.676 3.615L0 30.734 1.325 32l18.08-18.32c1.227 1.223 2.448 2.453 3.676 3.676C26.247 11.121 32 .06 32 .06Z"})))},InputData:function(e){return PF("svg",uZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),cZ||(cZ=PF("path",{d:"M6.384 8c-1.825 0-3.458.945-4.587 2.382C.667 11.82 0 13.756 0 15.88c0 2.125.667 4.062 1.797 5.499 1.13 1.437 2.762 2.382 4.587 2.382h19.232c1.825 0 3.458-.945 4.587-2.382C31.333 19.942 32 18.005 32 15.88c0-2.124-.667-4.06-1.797-5.498C29.073 8.945 27.441 8 25.616 8H6.384Zm0 1.763h19.232c1.223 0 2.342.616 3.201 1.709.86 1.093 1.42 2.656 1.42 4.408 0 1.753-.56 3.316-1.42 4.409-.86 1.093-1.978 1.708-3.2 1.708H6.383c-1.223 0-2.342-.615-3.201-1.708-.86-1.093-1.42-2.656-1.42-4.409 0-1.752.56-3.315 1.42-4.408.86-1.093 1.978-1.709 3.2-1.709Z"})))},KnowledgeRequirement:function(e){return PF("svg",dZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),hZ||(hZ=PF("path",{fillRule:"evenodd",d:"m6.364 24.235 1.414 1.414-6.364 6.364L0 30.598l6.364-6.363Zm8-8 1.414 1.414-6.364 6.364L8 22.598l6.364-6.363Zm8-8 1.414 1.414-6.364 6.364L16 14.598l6.364-6.363ZM32 12.06h-2V3.426l-4.586 4.587L24 6.598l4.537-4.538H20v-2h12v12Z"})))},KnowledgeSource:function(e){return PF("svg",fZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),pZ||(pZ=PF("path",{d:"M0 5V23.376l.348.23c4.812 3.182 8.946 2.865 12.41 1.63 3.464-1.235 6.366-3.239 8.999-3.589l.02-.003.021-.003c3.576-.675 5.681.439 9.126 1.88l1.076.45V5.064L0 5Zm1.553 1.557 28.894.059v15.016c-2.89-1.22-5.358-2.187-8.918-1.521-3.199.433-6.1 2.523-9.293 3.662C9.12 24.884 5.83 25.23 1.553 22.535V6.557Z"})))},TextAnnotation:function(e){return PF("svg",mZ({xmlns:"http://www.w3.org/2000/svg",width:32,height:32},e),gZ||(gZ=PF("path",{d:"M22.087 0v31.647H32v-1.788h-8.125V1.788H32V0h-9.913Zm-2.924 13.999-2.737 2.167 2.167 2.738 2.738-2.167-2.168-2.738Zm-5.475 4.335L10.95 20.5l2.168 2.738 2.737-2.168-2.167-2.737Zm-5.475 4.335-2.738 2.167 2.168 2.738 2.737-2.168-2.167-2.737Zm-5.476 4.335L0 29.17l2.167 2.738 2.738-2.168-2.168-2.737Z"})))}};function yZ(e){const{type:t}=e;return t.split(":")[1]}const bZ={getElementLabel:e=>WG(e,"dmn:Definitions")?HG(e).get("name"):UG(e),getElementIcon:e=>{const t=yZ(e);return vZ[t]},getTypeLabel:e=>yZ(e).replace(/(\B[A-Z])/g," $1").replace(/(\bNon Interrupting)/g,"($1)")};const _Z={getEmpty:()=>({text:"Select an element to edit its properties.",icon:null}),getMultiple:()=>({text:"Multiple elements are selected. Select a single element to edit its properties.",icon:null})};function xZ(e){const{element:t,injector:n,getProviders:i,layoutConfig:o,descriptionConfig:r,tooltipConfig:s}=e,a=n.get("canvas"),l=n.get("elementRegistry"),c=n.get("eventBus"),[u,h]=dV({selectedElement:t}),d=u.selectedElement,p=e=>{if(!e)return;let t=e;t&&"label"===t.type&&(t=t.labelTarget),h({...u,selectedElement:t}),c.fire("propertiesPanel.updated",{element:t})};pV((()=>{const e=e=>{const{newSelection:t=[]}=e;if(t.length>1)return p(t);const n=t[0],i=a.getRootElement();(function(e){return e&&e.isImplicit})(i)||p(n||i)};return c.on("selection.changed",e),()=>{c.off("selection.changed",e)}}),[]),pV((()=>{const e=e=>{const t=function(e,t){return w(e,(e=>e===t))}(e.elements,d);t&&function(e,t){return e&&t.get(e.id)}(t,l)&&p(t)};return c.on("elements.changed",e),()=>{c.off("elements.changed",e)}}),[d]),pV((()=>{const e=()=>{const e=a.getRootElement();p(e)};return c.on("import.done",e),()=>{c.off("import.done",e)}}),[]),pV((()=>{const e=()=>{p(d)};return c.on("propertiesPanel.providersChanged",e),()=>{c.off("propertiesPanel.providersChanged",e)}}),[d]);const f={selectedElement:d,injector:n,getService:(e,t)=>n.get(e,t)},g=i(d),m=mV((()=>E(g,(function(e,t){if(v(d))return[];return t.getGroups(d)(e)}),[])),[g,d]);return oX(YG.Provider,{value:f,children:oX(_G,{element:d,headerProvider:bZ,placeholderProvider:_Z,groups:m,layoutConfig:o,layoutChanged:e=>{c.fire("propertiesPanel.layoutChanged",{layout:e})},descriptionConfig:r,descriptionLoaded:e=>{c.fire("propertiesPanel.descriptionLoaded",{description:e})},tooltipConfig:s,tooltipLoaded:e=>{c.fire("propertiesPanel.tooltipLoaded",{tooltip:e})},eventBus:c})})}class OZ{constructor(e,t,n,i){const{parent:o,layout:r,description:s,tooltip:a}=e||{};this._eventBus=n,this._injector=t,this._layoutConfig=r,this._descriptionConfig=s,this._tooltipConfig=a,this._container=zG('<div style="height: 100%" tabindex="-1" class="bio-properties-panel-container"></div>');var l=t.get("commandStack",!1);l&&function(e,t,n){function i(e){e.preventDefault(),e.stopPropagation()}function o(e){return bl(e)?(n.undo(),i(e)):_l(e)?(n.redo(),i(e)):void 0}t.on("keyboard.bind",(function(){qG.bind(e,"keydown",o)})),t.on("keyboard.unbind",(function(){qG.unbind(e,"keydown",o)}))}(this._container,n,l),n.on("diagram.destroy",(()=>{this.detach()})),n.on("import.done",(e=>{const{element:t}=e;o&&this.attachTo(o),this._render(t)})),n.on("detach",(e=>{this.detach()})),i.on("detach",(()=>{this.detach()}))}attachTo(e){if(!e)throw new Error("container required");var t,n;e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(t=e,e=(n=n||document).querySelector(t)),this.detach(),e.appendChild(this._container),this._eventBus.fire("propertiesPanel.attach")}detach(){const e=this._container.parentNode;e&&(e.removeChild(this._container),this._eventBus.fire("propertiesPanel.detach"))}registerProvider(e,t){t||(t=e,e=1e3),"function"==typeof t.getGroups?(this._eventBus.on("propertiesPanel.getProviders",e,(function(e){e.providers.push(t)})),this._eventBus.fire("propertiesPanel.providersChanged")):console.error("Properties provider does not implement #getGroups(element) API")}_getProviders(){const e=this._eventBus.createEvent({type:"propertiesPanel.getProviders",providers:[]});return this._eventBus.fire(e),e.providers}_render(e){const t=this._injector.get("canvas");e||(e=t.getRootElement()),function(e){return e&&e.isImplicit}(e)||(ZF(oX(xZ,{element:e,injector:this._injector,getProviders:this._getProviders.bind(this),layoutConfig:this._layoutConfig,descriptionConfig:this._descriptionConfig,tooltipConfig:this._tooltipConfig}),this._container),this._eventBus.fire("propertiesPanel.rendered"))}_destroy(){this._container&&(ZF(null,this._container),this._eventBus.fire("propertiesPanel.destroyed"))}}OZ.$inject=["config.propertiesPanel","injector","eventBus","_parent"];class wZ{constructor(e){this._commandStack=e}preExecute(e){const t=this._commandStack;k(e,(function(e){t.execute(e.cmd,e.context)}))}}wZ.$inject=["commandStack"];const CZ={"properties-panel.multi-command-executor":wZ};function kZ(e,t){e.on("diagram.init",(function(){k(CZ,(function(e,n){t.registerHandler(n,e)}))}))}kZ.$inject=["eventBus","commandStack"];var EZ={__depends__:[{__init__:[kZ]},RG,MG],__init__:["propertiesPanel"],propertiesPanel:["type",OZ]};function SZ(e,t){const{getService:n}=yV(YG);return n(e,t)}function $Z(e){const{element:t}=e;if(!WG(t,"dmn:DMNElement"))return[];const n=[{id:"description",component:PZ,element:t,isEdited:kG}];return WG(t,"dmn:Decision")?n.concat([{id:"question",component:TZ,element:t,isEdited:kG},{id:"allowedAnswers",component:RZ,element:t,isEdited:kG}]):n}function PZ(e){const{element:t,id:n}=e,i=SZ("modeling"),o=SZ("debounceInput"),r=SZ("translate");return CG({element:t,id:n,label:r("Description"),debounce:o,getValue:e=>HG(e).get("description"),setValue:e=>{i.updateProperties(t,{description:e})}})}function TZ(e){const{element:t,id:n}=e,i=SZ("modeling"),o=SZ("debounceInput"),r=SZ("translate");return CG({element:t,id:n,label:r("Question"),debounce:o,getValue:e=>HG(e).get("question"),setValue:e=>{i.updateProperties(t,{question:e})}})}function RZ(e){const{element:t,id:n}=e,i=SZ("modeling"),o=SZ("debounceInput"),r=SZ("translate");return CG({element:t,id:n,label:r("Allowed answers"),debounce:o,getValue:e=>HG(e).get("allowedAnswers"),setValue:e=>{i.updateProperties(t,{allowedAnswers:e})}})}const AZ=/\s/,MZ=/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i,DZ=/^[a-z_][\w-.]*$/i;function LZ(e,t,n){const i=e.$model.ids.assigned(t);return t?i&&i!==e?n("ID must be unique."):function(e,t){if(n=e,AZ.test(n))return t("ID must not contain spaces.");var n;if(!DZ.test(e))return MZ.test(e)?t("ID must not contain prefix."):t("ID must be a valid QName.")}(t,n):n("ID must not be empty.")}function IZ(e){const{element:t}=e;return[{id:"id",component:QZ,element:t,isEdited:$G}]}function QZ(e){const{element:t,id:n}=e,i=SZ("modeling"),o=SZ("debounceInput"),r=SZ("translate"),s=vV((e=>HG(e).id),[t]),a=vV((e=>LZ(HG(t),e,r)),[t,r]);return function(e){const{element:t,id:n,description:i,debounce:o,disabled:r,label:s,getValue:a,setValue:l,validate:c,onFocus:u,onBlur:h,tooltip:d}=e,p=zU(n),[f,g]=dV(null);let m=a(t);pV((()=>{if(_(c)){const e=c(m)||null;g(e)}}),[m,c]);const v=p||f;return oX("div",{class:cX("bio-properties-panel-entry",v?"has-error":""),"data-entry-id":n,children:[oX(SG,{debounce:o,disabled:r,id:n,label:s,onInput:e=>{let t=null;_(c)&&(t=c(e)||null),l(e,t),g(t)},onFocus:u,onBlur:h,value:m,tooltip:d,element:t},t),v&&oX("div",{class:"bio-properties-panel-error",children:v}),oX(KU,{forId:n,element:t,value:i})]})}({element:t,id:n,label:r("ID"),getValue:s,setValue:(e,n)=>{n||i.updateProperties(t,{id:e})},debounce:o,validate:a})}function jZ(e){const{element:t}=e;return function(e,t){return $(t,(function(t){return WG(e,t)}))}(t,["dmn:DRGElement","dmn:Definitions","dmn:TextAnnotation"])?[{id:"name",component:BZ,element:t,isEdited:kG}]:[]}function BZ(e){const{element:t,id:n}=e,i=SZ("modeling"),o=SZ("debounceInput"),r=SZ("translate");let s={element:t,id:n,label:r("Name"),debounce:o,getValue:e=>HG(e).get("name"),setValue:e=>{i.updateProperties(t,{name:e})},autoResize:!0};return WG(t,"dmn:TextAnnotation")&&(s={...s,getValue:e=>HG(e).get("text"),setValue:e=>{i.updateProperties(t,{text:e})}}),CG(s)}class NZ{constructor(e){e.registerProvider(this)}getGroups(e){return t=>[...t,...qZ(e)]}}function qZ(e){return[FZ(e),VZ(e)].filter((e=>null!==e))}function FZ(e){return{id:"general",label:"General",entries:[...jZ({element:e}),...IZ({element:e})],component:UU}}function VZ(e){const t=[...$Z({element:e})];return t.length?{id:"documentation",label:"Documentation",entries:t,component:UU}:null}NZ.$inject=["propertiesPanel"];var XZ={__init__:["dmnPropertiesProvider"],dmnPropertiesProvider:["type",NZ]},zZ=function(){return i((function e(t){n(this,e),t.registerProvider(this)}),[{key:"getVariables",value:function(e,t){return e.map((function(e){return l(l({},e),{},{name:YZ(e)})}))}}])}();function YZ(e){var t=e.origin;return t&&Dt(t,"dmn:Decision")?t.get("id"):e.name}zZ.$inject=["variableResolver"];var WZ={__init__:["camundaVariableProvider"],camundaVariableProvider:["type",zZ]},HZ=["boxedExpression","common","decisionTable","drd","literalExpression"],UZ=function(e){function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,o);var i=e.boxedExpression,r=void 0===i?{}:i,s=e.common,a=void 0===s?{}:s,c=e.decisionTable,u=void 0===c?{}:c,h=e.drd,d=void 0===h?{}:h,p=e.literalExpression,f=void 0===p?{}:p,g=function(e,t){if(null==e)return{};var n,i,o=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,HZ),m=d.disableAdjustOrigin||a.disableAdjustOrigin,v=d.disableGrid||a.disableGrid;return t(this,o,[l(l({},g),{},{common:l(l({},a),{},{feelLanguageContext:l({parserDialect:"camunda"},null==a?void 0:a.feelLanguageContext)}),boxedExpression:GZ(r,[WZ]),decisionTable:GZ(u,[WZ]),drd:GZ(d,[m?aF:OF,v?{}:hF,EZ,XZ]),literalExpression:GZ(f,[WZ])})])}return function(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)}(o,e),i(o)}(nF);function GZ(e,t){var n=e.additionalModules||[];return l(l({},e),{},{additionalModules:[].concat(u(t),u(n))})}return UZ}));