camunda-dmn-js
Version:
Embeddable Camunda modeling distributions based on dmn-js
1 lines • 1.18 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,a()?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,d(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,n){return(t=d(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(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&&u(e,t)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(a=function(){return!!e})()}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function h(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 d(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 p=Object.prototype.toString,f=Object.prototype.hasOwnProperty;function g(e){return void 0===e}function m(e){return void 0!==e}function v(e){return null==e}function y(e){return"[object Array]"===p.call(e)}function b(e){return"[object Object]"===p.call(e)}function _(e){return"[object Number]"===p.call(e)}function x(e){const t=p.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function w(e){return"[object String]"===p.call(e)}function k(e,t){return!v(e)&&f.call(e,t)}function C(e,t){const n=N(t);let i;return S(e,(function(e,t){if(n(e,t))return i=e,!1})),i}function O(e,t){const n=N(t);let i=y(e)?-1:void 0;return S(e,(function(e,t){if(n(e,t))return i=t,!1})),i}function E(e,t){const n=N(t);let i=[];return S(e,(function(e,t){n(e,t)&&i.push(e)})),i}function S(e,t){let n,i;if(g(e))return;const o=y(e)?F:q;for(let r in e)if(k(e,r)&&(n=e[r],i=t(n,o(r)),!1===i))return n}function P(e,t,n){return S(e,(function(e,i){n=t(n,e,i)})),n}function T(e,t){return!!P(e,(function(e,n,i){return e&&t(n,i)}),!0)}function R(e,t){return!!C(e,t)}function A(e,t){let n=[];return S(e,(function(e,i){n.push(t(e,i))})),n}function M(e){return e&&Object.keys(e)||[]}function D(e){return A(e,(e=>e))}function $(e,t,n={}){return t=j(t),S(e,(function(e){let i=t(e)||"_",o=n[i];o||(o=n[i]=[]),o.push(e)})),n}function L(e,...t){e=j(e);let n={};return S(t,(t=>$(t,e,n))),A(n,(function(e,t){return e[0]}))}function B(e,t){t=j(t);let n=[];return S(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)})),A(n,(e=>e.v))}function I(e){return function(t){return T(e,(function(e,n){return t[n]===e}))}}function j(e){return x(e)?e:t=>t[e]}function N(e){return x(e)?e:t=>t===e}function q(e){return e}function F(e){return Number(e)}function V(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 z(e,t){return e.bind(t)}function H(e,...t){return Object.assign(e,...t)}function W(e,t,n){let i=e;return S(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];m(r)&&v(s)&&(s=i[e]=isNaN(+r)?{}:[]),g(r)?g(n)?delete i[e]:i[e]=n:i=s})),e}function Q(e,t){let n={},i=Object(e);return S(t,(function(t){t in i&&(n[t]=e[t])})),n}function U(e,t){let n={};return S(Object(e),(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}var X="__fn",G=Array.prototype.slice;function K(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Y(){}function Z(){}function J(e,t){this.model=e,this.properties=t}K.prototype.on=function(e,t,n,i){if(e=y(e)?e:[e],x(t)&&(i=n,n=t,t=1e3),!_(t))throw new Error("priority must be a number");var o=n;i&&((o=z(n,i))[X]=n[X]||n);var r=this;e.forEach((function(e){r._addListener(e,{priority:t,callback:o,next:null})}))},K.prototype.once=function(e,t,n,i){var o=this;if(x(t)&&(i=n,n=t,t=1e3),!_(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[X]=n,this.on(e,t,r)},K.prototype.off=function(e,t){e=y(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},K.prototype.createEvent=function(e){var t=new Y;return t.init(e),t},K.prototype.fire=function(e,t){var n,i,o,r;if(r=G.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 Y?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}},K.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},K.prototype._destroy=function(){this._listeners={}},K.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},K.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},K.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)},K.prototype._getListeners=function(e){return this._listeners[e]},K.prototype._setListeners=function(e,t){this._listeners[e]=t},K.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[X]!==t||(i?i.next=n:this._setListeners(e,n)),i=r,r=n;else this._setListeners(e,null)},Y.prototype.stopPropagation=function(){this.cancelBubble=!0},Y.prototype.preventDefault=function(){this.defaultPrevented=!0},Y.prototype.init=function(e){H(this,e||{})},Z.prototype.get=function(e){return this.$model.properties.get(this,e)},Z.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},J.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Z.prototype);S(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}),S(e,z((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 ee={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},te={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 ne(e,t){var n=te[e];return n?n(t):t}function ie(e){return!!ee[e]}function oe(e){return!!te[e]}function re(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 se(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function ae(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,S(e,z(this.registerPackage,this))}function le(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function ce(e){this.model=e}function ue(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function he(e){return e.replace(/^:/,"")}function de(e,t={}){this.properties=new ce(this),this.factory=new J(this,this.properties),this.registry=new ae(e,this.properties),this.typeCache={},this.config=t}se.prototype.build=function(){return Q(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},se.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)},se.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},se.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=re(o[0],i),s=re(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},se.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},se.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},se.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},se.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},se.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},se.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")},se.prototype.hasProperty=function(e){return this.propertiesByName[e]},se.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(S(e.properties,z((function(n){n=H({},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)},ae.prototype.getPackage=function(e){return this.packageMap[e]},ae.prototype.getPackages=function(){return this.packages},ae.prototype.registerPackage=function(e){e=H({},e);var t=this.packageMap;le(t,e,"prefix"),le(t,e,"uri"),S(e.types,z((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},ae.prototype.registerType=function(e,t){var n=re((e=H({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:H(e.meta||{})})).name,t.prefix),i=n.name,o={};S(e.properties,z((function(e){var t=re(e.name,n.prefix),i=t.name;ie(e.type)||(e.type=re(e.type,t.prefix).name),H(e,{ns:t,name:i}),o[i]=e}),this)),H(e,{ns:n,name:i,propertiesByName:o}),S(e.extends,z((function(e){var t=re(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},ae.prototype.mapTypes=function(e,t,n){var i=ie(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(n,i){var r=re(n,ie(n)?"":e.prefix);o.mapTypes(r,t,i)}function s(e){return r(e,!0)}if(!i)throw new Error("unknown type <"+e.name+">");S(i.superClass,n?s:function(e){return r(e,!1)}),t(i,!n),S(i.traits,s)},ae.prototype.getEffectiveDescriptor=function(e){var t=re(e),n=new se(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},ae.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},ce.prototype.set=function(e,t,n){if(!w(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[he(t)]:i?o in e?e[o]=n:ue(e,i,n):e.$attrs[he(t)]=n},ce.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[he(t)];var i=n.name;return!e[i]&&n.isMany&&ue(e,n,[]),e[i]},ce.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;delete(n=H({},n,{get:function(){return i}})).value}Object.defineProperty(e,t,n)},ce.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},ce.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},ce.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},de.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},de.prototype.getType=function(e){var t=this.typeCache,n=w(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},de.prototype.createAny=function(e,t,n){var i=re(e),o={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){W(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}),S(n,(function(e,t){b(e)&&void 0!==e.value?o[e.name]=e.value:o[t]=e})),o},de.prototype.getPackage=function(e){return this.registry.getPackage(e)},de.prototype.getPackages=function(){return this.registry.getPackages()},de.prototype.getElementDescriptor=function(e){return e.$descriptor},de.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},de.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},de.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var pe=String.fromCharCode,fe=Object.prototype.hasOwnProperty,ge=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,me={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function ve(e,t,n,i){return i?fe.call(me,i)?me[i]:"&"+i+";":pe(t||parseInt(n,16))}function ye(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(ge,ve):e}Object.keys(me).forEach((function(e){me[e.toUpperCase()]=me[e]}));var be="non-whitespace outside of root node";function _e(e){return new Error(e)}function xe(e){return"missing namespace for prefix <"+e+">"}function we(e){return{get:e,enumerable:!0}}function ke(e){var t,n={};for(t in e)n[t]=e[t];return n}function Ce(e){return e+"$uri"}function Oe(){return{line:0,column:0}}function Ee(e){throw e}function Se(e){if(!this)return new Se(e);var t,n,i,o,r,s,a,l,c,u=e&&e.proxy,h=Ee,d=Oe,p=!1,f=!1,g=null,m=!1;function v(e){e instanceof Error||(e=_e(e)),g=e,h(e,d)}function y(e){r&&(e instanceof Error||(e=_e(e)),r(e,d))}this.on=function(e,c){if("function"!=typeof c)throw _e("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 _e("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw _e("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 _e("required args <xml=string>");return g=null,function(e){var r,h,g,b,_,x,w,k,C,O,E,S=f?[]:null,P=f?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Ce(n)]=t;return i}(c):null,T=[],R=0,A=!1,M=!1,D=0,$=0,L="",B=0;function I(){if(null!==E)return E;var e,t,n,i,o,r,s,a,l,u,h,d=f&&P.xmlns,g=f&&p?[]:null,m=B,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=ye(r),t=Ce(o),!(s=c[e])){if("xmlns"===o||t in P&&P[t]!==e)do{s="ns"+R++}while(void 0!==P[s]);else s=o;c[e]=s}P[o]!==s&&(i||(P=ke(P),i=!0),P[o]=s,"xmlns"===o&&(P[Ce(s)]=e,d=s),P[t]=e),_[a]=r;continue}g.push(a,r)}else-1!==(u=a.indexOf(":"))?(n=P[a.substring(0,u)])?_[a=d===n?a.substr(u+1):n+a.substr(u)]=r:y(xe(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=P[a.substring(0,u)])){y(xe(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>=s&&(t=i.exec(e))&&!((a=t[0].length+t.index)>D);)o+=1,s=a;return-1==D?(r=a,n=e.substring($)):0===$?n=e.substring($,D):(r=D-s,n=-1==$?e.substring(D):e.substring(D,$+1)),{data:n,line:o,column:r}}d=j,u&&(O=Object.create({},{name:we((function(){return k})),originalName:we((function(){return C})),attrs:we(I),ns:we((function(){return P}))}));for(;-1!==$;){if(-1===(D=60===e.charCodeAt($)?$:e.indexOf("<",$)))return T.length?v("unexpected end of file"):0===$?v("missing start tag"):void($<e.length&&e.substring($).trim()&&y(be));if($!==D)if(T.length){if(t&&(t(e.substring($,D),ye,d),m))return}else if(e.substring($,D).trim()&&(y(be),m))return;if(33===(_=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===($=e.indexOf("]]>",D)))return v("unclosed cdata");if(o&&(o(e.substring(D+9,$),d),m))return;$+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===($=e.indexOf("--\x3e",D)))return v("unclosed comment");if(s&&(s(e.substring(D+4,$),ye,d),m))return;$+=3;continue}}if(63!==_){for(h=D+1;;h++){if(x=e.charCodeAt(h),isNaN(x))return $=-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){$=h;break}}if(33!==_){if(E={},47===_){if(A=!1,M=!0,!T.length)return v("missing open tag");if(h=k=T.pop(),b=D+2+h.length,e.substring(D+2,b)!==h)return v("closing tag mismatch");for(;b<$;b++)if(!(32===(_=e.charCodeAt(b))||_>8&&_<14))return v("close tag")}else{if(47===e.charCodeAt($-1)?(h=k=e.substring(D+1,$-1),A=!0,M=!0):(h=k=e.substring(D+1,$),A=!0,M=!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){k=h.substring(0,b),E=null;break}return v("invalid nodeName")}M||T.push(k)}if(f){if(r=P,A&&(M||S.push(r),null===E&&(p=-1!==h.indexOf("xmlns",b))&&(B=b,L=h,I(),p=!1)),C=k,-1!==(_=k.indexOf(":"))){if(!(w=P[k.substring(0,_)]))return v("missing namespace on <"+C+">");k=k.substr(_+1)}else w=P.xmlns;w&&(k=w+":"+k)}if(A&&(B=b,L=h,n&&(u?n(O,ye,M,d):n(k,I,ye,M,d),m)))return;if(M){if(i&&(i(u?O:k,ye,A,d),m))return;f&&(P=A?r:S.pop())}$+=1}else{if(l&&(l(e.substring(D,$+1),ye,d),m))return;$+=1}}else{if(-1===($=e.indexOf("?>",D)))return v("unclosed question");if(a&&(a(e.substring(D,$+2),d),m))return;$+=2}}}(e),d=Oe,m=!1,g},this.stop=function(){m=!0}}function Pe(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Te={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Re="property";function Ae(e){return e.xml&&e.xml.serialize}function Me(e,t){return Pe(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function De(e){return new Error(e)}function $e(e){return e.$descriptor}function Le(e){H(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw De("expected element");var t,n=this.elementsById,i=$e(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 De("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Be(){}function Ie(){}function je(){}function Ne(e,t){this.property=e,this.context=t}function qe(e,t){this.element=t,this.propertyDesc=e}function Fe(){}function Ve(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function ze(e,t,n){Ve.call(this,e,t,n)}function He(e,t,n){this.model=e,this.context=n}function We(e){e instanceof de&&(e={model:e}),H(this,{lax:!1},e)}Be.prototype.handleEnd=function(){},Be.prototype.handleText=function(){},Be.prototype.handleNode=function(){},Ie.prototype=Object.create(Be.prototype),Ie.prototype.handleNode=function(){return this},je.prototype=Object.create(Be.prototype),je.prototype.handleText=function(e){this.body=(this.body||"")+e},Ne.prototype=Object.create(je.prototype),Ne.prototype.handleNode=function(e){if(this.element)throw De("expected no sub nodes");return this.element=this.createReference(e),this},Ne.prototype.handleEnd=function(){this.element.id=this.body},Ne.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},qe.prototype=Object.create(je.prototype),qe.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ne(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Fe.prototype=Object.create(je.prototype),Fe.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},Ve.prototype=Object.create(Fe.prototype),Ve.prototype.addReference=function(e){this.context.addReference(e)},Ve.prototype.handleText=function(e){if(!$e(this.element).bodyProperty)throw De("unexpected body text <"+e+">");je.prototype.handleText.call(this,e)},Ve.prototype.handleEnd=function(){var e=this.body,t=this.element,n=$e(t).bodyProperty;n&&void 0!==e&&(e=ne(n.type,e),t.set(n.name,e))},Ve.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,o=$e(i),r=this.context,s=new i({}),a=this.model;return S(n,(function(e,n){var i=o.propertiesByName[n];i&&i.isReference?i.isMany?S(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=ne(i.type,e):"xmlns"===n?n=":"+n:(t=re(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},Ve.prototype.getPropertyForNode=function(e){var t=re(e.name),n=this.type,i=this.model,o=$e(n),r=t.name,s=o.propertiesByName[r];if(s&&!s.isAttr){const t=function(e){const t=Ae(e);return t!==Re&&(t||null)}(s);if(t){const n=e.attributes[t];if(n){const t=function(e,t,n){const i=re(e,t.xmlns),o=re(`${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 H({},s,{effectiveType:$e(i.getType(t)).name})}}return s}var a=i.getPackage(t.prefix);if(a){const e=Me(t,a),n=i.getType(e);if(s=C(o.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),s)return H({},s,{effectiveType:$e(n).name})}else if(s=C(o.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),s)return s;throw De("unrecognized element <"+t.name+">")},Ve.prototype.toString=function(){return"ElementDescriptor["+$e(this.type).name+"]"},Ve.prototype.valueHandler=function(e,t){return new qe(e,t)},Ve.prototype.referenceHandler=function(e){return new Ne(e,this.context)},Ve.prototype.handler=function(e){return"Element"===e?new He(this.model,e,this.context):new Ve(this.model,e,this.context)},Ve.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,oe(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?(H(r,{element:i}),this.context.addReference(r)):r.$parent=i),o},ze.prototype=Object.create(Ve.prototype),ze.prototype.createElement=function(e){var t=e.name,n=re(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),s=r&&Me(n,r)||t;if(!o.hasType(s))throw De("unexpected element <"+e.originalName+">");return Ve.prototype.createElement.call(this,e)},He.prototype=Object.create(Fe.prototype),He.prototype.createElement=function(e){var t=e.name,n=re(t).prefix,i=e.ns[n+"$uri"],o=e.attributes;return this.model.createAny(t,i,o)},He.prototype.handleChild=function(e){var t=new He(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},He.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},We.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ve?(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 Le(H({},t,{rootHandler:i})),a=new Se({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 De(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(Te).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 Ie)}}({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=$e(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=De("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})}))},We.prototype.handler=function(e){return new ze(this.model,e)};var Qe=/<|>|'|"|&|\n\r|\n/g,Ue=/<|>|&/g;function Xe(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}function Ge(e,t){return Pe(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}function Ke(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Ye(e){return w(e)?e:(e.prefix?e.prefix+":":"")+e.localName}Xe.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Xe.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Xe.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Xe.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)},Xe.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Xe.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Xe.prototype.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},Xe.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Xe.prototype.getUsed=function(e){return[].concat(this.wellknown,this.custom).filter((e=>{var t=this.getNSKey(e);return this.used[t]}))};var Ze={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Je={"<":"lt",">":"gt","&":"amp"};function et(e,t,n){return(e=w(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function tt(e){this.tagName=e}function nt(){}function it(e){this.tagName=e}function ot(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function rt(e,t,n){ot.call(this,e,t),this.serialization=n}function st(){this.value="",this.write=function(e){this.value+=e}}function at(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 lt(e){return e=H({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new st,o=new at(i,e.format);e.preamble&&o.append('<?xml version="1.0" encoding="UTF-8"?>\n');var r=new ot,s=t.$model;if(r.getNamespaces().mapDefaultPrefixes(function(e){const t=e.config&&e.config.nsMap||{},n={};for(const e in Te)n[e]=Te[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 ct(e,t){de.call(this,e,t)}tt.prototype.build=function(e){return this.element=e,this},tt.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},nt.prototype.serializeValue=nt.prototype.serializeTo=function(e){e.append(this.escape?et(this.value,Ue,Je):this.value)},nt.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Ue)&&(this.escape=!0),this},Ke(it,nt),it.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},ot.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 E(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!k(e,n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)}))}(e),this.parseAttributes(E(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return E(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},ot.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?H({localName:t.ns.localName},e):H({localName:Ge(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},ot.prototype.nsPropertyTagName=function(e){return function(e,t){return H({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},ot.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},ot.prototype.nsAttributeName=function(e){var t;if(t=w(e)?re(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}:H({localName:t.localName},n)},ot.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})))},ot.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push((new nt).build({type:"String"},t));var n=e.$children;n&&S(n,(e=>{this.body.push(new ot(this).build(e))}))},ot.prototype.parseNsAttribute=function(e,t,n){var i,o=e.$model,r=re(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)}},ot.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return S(n,(function(n,o){var r=t.parseNsAttribute(e,o,n);r&&i.push(r)})),i},ot.prototype.parseGenericAttributes=function(e,t){var n=this;S(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)}}))},ot.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;S(e,(function(e){var o=i.get(e.name),r=e.isReference;if(e.isMany||(o=[o]),e.isBody)n.push((new nt).build(e,o[0]));else if(oe(e.type))S(o,(function(i){n.push(new it(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(r)S(o,(function(i){n.push(new tt(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var s=Ae(e);S(o,(function(i){var o;o=s?s===Re?new ot(t,e):new rt(t,e,s):new ot(t),n.push(o.build(i))}))}}))},ot.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new Xe(t):n=t),n},ot.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},ot.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},ot.prototype.parseAttributes=function(e){var t=this,n=this.element;S(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var o=[];S(i,(function(e){o.push(e.id)})),i=o.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},ot.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Ye(e)},ot.prototype.addAttribute=function(e,t){var n=this.attrs;w(t)&&(t=et(t,Qe,Ze));var i=O(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)},ot.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)),S(t,(function(t){e.append(" ").append(Ye(t.name)).append('="').append(t.value).append('"')}))},ot.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==nt;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),S(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Ke(rt,ot),rt.prototype.parseNsAttributes=function(e){var t=ot.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},rt.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},ct.prototype=Object.create(de.prototype),ct.prototype.fromXML=function(e,t,n){w(t)||(n=t,t="dmn:Definitions");var i=new We(H({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},ct.prototype.toXML=function(e,t){var n=new lt(t);return new Promise((function(t,i){try{return t({xml:n.toXML(e)})}catch(e){return i(e)}}))};var ut={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"}]},{nam