UNPKG

@netgrif/petriflow

Version:

Javascript / Typescript library of Petriflow objects

1 lines 82.4 kB
var t,e,i,s,r,o,n,a,l,c,h,d,p,u,g,m,_,f,v,y,E,x;!function(t){t.NUMBER="number",t.TEXT="text",t.ENUMERATION="enumeration",t.ENUMERATION_MAP="enumeration_map",t.MULTICHOICE="multichoice",t.MULTICHOICE_MAP="multichoice_map",t.BOOLEAN="boolean",t.DATE="date",t.DATETIME="dateTime",t.FILE="file",t.FILE_LIST="fileList",t.USER="user",t.USER_LIST="userList",t.BUTTON="button",t.TASK_REF="taskRef",t.CASE_REF="caseRef",t.FILTER="filter",t.I18N="i18n"}(t||(t={}));class T{constructor(t,e){this._value=t,this._name=e}get name(){return this._name}set name(t){this._name=t}get value(){return this._value}set value(t){this._value=t}clone(){const t=new T(this.value);return t.name=this.name,t}isEmpty(){return!this._name&&!this._value}}class A extends T{constructor(t,e,i=!1){super(t,e),this._dynamic=i}get dynamic(){return this._dynamic}set dynamic(t){this._dynamic=t}clone(){return new A(this.value,this.name,this._dynamic)}}class R{constructor(t){this._id=t}get id(){return this._id}set id(t){this._id=t}compare(t){return this.id.localeCompare(t.id)}}class w extends R{constructor(t,e,i,s){super(t),this._x=e,this._y=i,this._label=s}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get label(){return this._label}set label(t){this._label=t}}class U extends w{constructor(t,e,i,s){super(s,t,e,new T("")),this._static=i,this._marking=0}get static(){return this._static}set static(t){this._static=t}get marking(){return this._marking}set marking(t){this._marking=t}clone(){var t;const e=new U(this.x,this.y,this.static,this.id);return e.label=null===(t=this.label)||void 0===t?void 0:t.clone(),e._marking=this._marking,e}}class N{constructor(){this._events=new Map}get events(){return this._events}getEvents(){return Array.from(this._events.values())}getEvent(t){return this._events.get(t)}addEvent(t){if(this._events.has(t.type))throw new Error(`Duplicate event of type ${t.type}`);this._events.set(t.type,t)}removeEvent(t){this._events.delete(t)}mergeEvent(t){if(this._events.has(t.type)){const e=this._events.get(t.type);if(!e)return;e.preActions.push(...t.preActions),e.postActions.push(...t.postActions)}else this._events.set(t.type,t)}}class I extends N{constructor(t){super(),this._id=t,this._title=new T(""),this._global=!1}get id(){return this._id}set id(t){this._id=t}get title(){return this._title}set title(t){this._title=t}get global(){return this._global}set global(t){this._global=t}clone(){var t;const e=new I(this._id);return e._title=null===(t=this._title)||void 0===t?void 0:t.clone(),e._global=this._global,this.getEvents().forEach((t=>e.addEvent(t.clone()))),e}compare(t){return this.id.localeCompare(t.id)}}I.ANONYMOUS="anonymous",I.DEFAULT="default";class b{constructor(){this._id="new_model",this._version="",this._lastChanged=Date.now(),this._initials="NEW",this._title=new T("New Model"),this._icon="device_hub",this._defaultRole=!0,this._anonymousRole=!0,this._transitionRole=!1,this._caseName=new A(""),this._transitions=new Map,this._places=new Map,this._arcs=new Map,this._data=new Map,this._transactions=new Map,this._roles=new Map,this._functions=new Array,this._roleRefs=new Map,this._userRefs=new Map,this._i18ns=new Map,this._processEvents=new Map,this._caseEvents=new Map,this._mappings=new Map,this._tags=new Map}get id(){return this._id}set id(t){this._id=t}get version(){return this._version}set version(t){this._version=t}get lastChanged(){return this._lastChanged}set lastChanged(t){this._lastChanged=t}get initials(){return this._initials}set initials(t){this._initials=t}get title(){return this._title}set title(t){this._title=t}get icon(){return this._icon}set icon(t){this._icon=t}get defaultRole(){return this._defaultRole}set defaultRole(t){this._defaultRole=t}get anonymousRole(){return this._anonymousRole}set anonymousRole(t){this._anonymousRole=t}get transitionRole(){return this._transitionRole}set transitionRole(t){this._transitionRole=t}get caseName(){return this._caseName}set caseName(t){this._caseName=t}getRoleRefs(){return Array.from(this._roleRefs.values())}getRoleRef(t){return this._roleRefs.get(t)}addRoleRef(t){if(!this._roles.has(t.id)&&t.id!==I.DEFAULT&&t.id!==I.ANONYMOUS)throw new Error(`Referenced role with id ${t.id} does not exist`);if(this._roleRefs.has(t.id))throw new Error(`Duplicate role ref with id ${t.id}`);this._roleRefs.set(t.id,t)}removeRoleRef(t){this._roleRefs.delete(t)}getUserRefs(){return Array.from(this._userRefs.values())}getUserRef(t){return this._userRefs.get(t)}addUserRef(e){var i;if(!this._data.has(e.id))throw new Error(`Referenced user field with id ${e.id} does not exist`);if((null===(i=this._data.get(e.id))||void 0===i?void 0:i.type)!==t.USER_LIST)throw new Error(`Referenced field with id ${e.id} is not user field`);if(this._userRefs.has(e.id))throw new Error(`Duplicate user ref with id ${e.id}`);this._userRefs.set(e.id,e)}removeUserRef(t){this._userRefs.delete(t)}getProcessEvents(){return Array.from(this._processEvents.values())}getProcessEvent(t){return this._processEvents.get(t)}addProcessEvent(t){if(this._processEvents.has(t.type))throw new Error(`Duplicate process event of type ${t.type}`);this._processEvents.set(t.type,t)}removeProcessEvent(t){this._processEvents.delete(t)}getCaseEvents(){return Array.from(this._caseEvents.values())}getCaseEvent(t){return this._caseEvents.get(t)}addCaseEvent(t){if(this._caseEvents.has(t.type))throw new Error(`Duplicate case event of type ${t.type}`);this._caseEvents.set(t.type,t)}removeCaseEvent(t){this._caseEvents.delete(t)}getTransactions(){return Array.from(this._transactions.values())}getTransaction(t){return this._transactions.get(t)}addTransaction(t){if(this._transactions.has(t.id))throw new Error(`Duplicate transaction with id ${t.id}`);this._transactions.set(t.id,t)}removeTransaction(t){this._transactions.delete(t)}getRoles(){return Array.from(this._roles.values())}getRole(t){return this._roles.get(t)}addRole(t){if(this._roles.has(t.id))throw new Error(`Duplicate role with id ${t.id}`);this._roles.set(t.id,t)}removeRole(t){this._roles.delete(t)}get functions(){return this._functions}set functions(t){this._functions=t}addFunction(t){this._functions.push(t)}getDataSet(){return Array.from(this._data.values())}getData(t){return this._data.get(t)}addData(t){if(this._data.has(t.id))throw new Error(`Duplicate data variable with id ${t.id}`);this._data.set(t.id,t)}removeData(t){this._data.delete(t)}getMappings(){return Array.from(this._mappings.values())}getMapping(t){return this._mappings.get(t)}addMapping(t){if(this._mappings.has(t.id))throw new Error(`Duplicate mapping with id ${t.id}`);this._mappings.set(t.id,t)}removeMapping(t){this._mappings.delete(t)}getI18ns(){return Array.from(this._i18ns.values())}getI18n(t){return this._i18ns.get(t)}addI18n(t){if(this._i18ns.has(t.locale))throw new Error(`Duplicate i18n with locale ${t.locale}`);this._i18ns.set(t.locale,t)}removeI18n(t){this._i18ns.delete(t)}getTransitions(){return Array.from(this._transitions.values())}getTransition(t){return this._transitions.get(t)}addTransition(t){if(this._transitions.has(t.id))throw new Error(`Duplicate transition with id ${t.id}`);this._transitions.set(t.id,t)}removeTransition(t){this._transitions.delete(t)}getPlaces(){return Array.from(this._places.values())}getPlace(t){return this._places.get(t)}addPlace(t){if(this._places.has(t.id))throw new Error(`Duplicate place with id ${t.id}`);this._places.set(t.id,t)}removePlace(t){this._places.delete(t)}getArcs(){return Array.from(this._arcs.values())}getArc(t){return this._arcs.get(t)}addArc(t){if(this._arcs.has(t.id))throw new Error(`Duplicate arc with id ${t.id}`);this._arcs.set(t.id,t)}removeArc(t){this._arcs.delete(t)}get tags(){return this._tags}set tags(t){this._tags=t}clone(){var t,e;const i=new b;return i._id=this._id,i._version=this._version,i._lastChanged=this._lastChanged,i._initials=this._initials,i._title=null===(t=this._title)||void 0===t?void 0:t.clone(),i._icon=this._icon,i._defaultRole=this._defaultRole,i._anonymousRole=this._anonymousRole,i._transitionRole=this._transitionRole,i._caseName=null===(e=this._caseName)||void 0===e?void 0:e.clone(),this._processEvents.forEach((t=>i.addProcessEvent(t.clone()))),this._caseEvents.forEach((t=>i.addCaseEvent(t.clone()))),this._transactions.forEach((t=>i.addTransaction(t.clone()))),this._roles.forEach((t=>i.addRole(t.clone()))),this._functions.forEach((t=>i.addFunction(t.clone()))),this._data.forEach((t=>i.addData(t.clone()))),this._mappings.forEach((t=>i.addMapping(t.clone()))),this._i18ns.forEach((t=>i.addI18n(t.clone()))),this._transitions.forEach((t=>i.addTransition(t.clone()))),this._places.forEach((t=>i.addPlace(t.clone()))),this._arcs.forEach((t=>{const e=t.clone();e.source instanceof U?(e.source=i.getPlace(e.source.id),e.destination=i.getTransition(e.destination.id)):(e.source=i.getTransition(e.source.id),e.destination=i.getPlace(e.destination.id)),i.addArc(e)})),this._roleRefs.forEach((t=>i.addRoleRef(t.clone()))),this._userRefs.forEach((t=>i.addUserRef(t.clone()))),this._tags.forEach(((t,e)=>i.tags.set(e,t))),i}}class C extends R{constructor(t,e){super(t),this._definition=e}get definition(){return this._definition}set definition(t){this._definition=t}clone(){return new C(this.id,this._definition)}}!function(t){t.PRE="pre",t.POST="post"}(e||(e={}));class V extends R{constructor(t,e){super(e),this._type=t,this._preActions=[],this._postActions=[],this._message=new T("")}get type(){return this._type}set type(t){this._type=t}get preActions(){return this._preActions}get postActions(){return this._postActions}get message(){return this._message}set message(t){this._message=t}addAction(t,i){if(!t)throw new Error("Action is undefined");if(!i)throw new Error("Event phase is undefined");i===e.PRE?this._preActions.push(t):this._postActions.push(t)}isEmpty(){return 0===this.preActions.length&&0===this.postActions.length&&this.message.isEmpty()}}class S extends V{constructor(t,e){super(t,e)}clone(){const t=new S(this.type,this.id);return this.preActions.forEach((e=>t.preActions.push(e))),this.postActions.forEach((e=>t.postActions.push(e))),t}}!function(t){t.CREATE="create",t.DELETE="delete"}(i||(i={}));class D{get create(){return this._create}set create(t){this._create=t}get delete(){return this._delete}set delete(t){this._delete=t}get view(){return this._view}set view(t){this._view=t}clone(){const t=new D;return t.create=this.create,t.delete=this.delete,t.view=this.view,t}}!function(t){t.NAMESPACE="namespace",t.PROCESS="process"}(s||(s={}));class L extends R{constructor(t,e){super(t),this._transitionRef=e,this._roleRef=[],this._dataRef=[],this._dataGroup=[],this._trigger=[]}get transitionRef(){return this._transitionRef}set transitionRef(t){this._transitionRef=t}get roleRef(){return this._roleRef}set roleRef(t){this._roleRef=t}get dataRef(){return this._dataRef}set dataRef(t){this._dataRef=t}get dataGroup(){return this._dataGroup}set dataGroup(t){this._dataGroup=t}get trigger(){return this._trigger}set trigger(t){this._trigger=t}clone(){const t=new L(this.id,this._transitionRef);return t._roleRef=this._roleRef.map((t=>t.clone())),t._dataRef=this._dataRef.map((t=>t.clone())),t._dataGroup=this._dataGroup.map((t=>t.clone())),t._trigger=this._trigger.map((t=>t.clone())),t}}class k{constructor(t,e){this._id=t,this._logic=e}get id(){return this._id}set id(t){this._id=t}get logic(){return this._logic}set logic(t){this._logic=t}compare(t){return this.id.localeCompare(t.id)}}class P{constructor(t,e,i=""){this._name=t,this._scope=e,this._definition=i}get name(){return this._name}set name(t){this._name=t}get scope(){return this._scope}set scope(t){this._scope=t}get definition(){return this._definition}set definition(t){this._definition=t}clone(){return new P(this.name,this.scope,this.definition)}compare(t){return this.name.localeCompare(t.name)}}class M extends V{constructor(t,e){super(t,e)}clone(){const t=new M(this.type,this.id);return this.preActions.forEach((e=>t.preActions.push(e.clone()))),this.postActions.forEach((e=>t.postActions.push(e.clone()))),t}}!function(t){t.UPLOAD="upload"}(r||(r={}));class B extends k{constructor(t){super(t,new D)}clone(){var t;const e=new B(this.id);return e.logic=null===(t=this.logic)||void 0===t?void 0:t.clone(),e}}class O extends R{constructor(t,e){super(t),this._title=e}get title(){return this._title}set title(t){this._title=t}clone(){var t;return new O(this.id,null===(t=this._title)||void 0===t?void 0:t.clone())}}!function(t){t.REGULAR_PT="regular_pt",t.REGULAR_TP="regular_tp",t.READ="read",t.RESET="reset",t.INHIBITOR="inhibitor"}(o||(o={})),function(t){t.REGULAR="regular",t.READ="read",t.RESET="reset",t.INHIBITOR="inhibitor"}(n||(n={}));class F extends R{constructor(t,e,i){super(i),this._source=t,this._destination=e,this._multiplicity=1,this._breakpoints=[]}get source(){return this._source}set source(t){this._source=t}get destination(){return this._destination}set destination(t){this._destination=t}get multiplicity(){return this._multiplicity}set multiplicity(t){this._multiplicity=t}get reference(){return this._reference}set reference(t){this._reference=t}get breakpoints(){return this._breakpoints}set breakpoints(t){this._breakpoints=t}cloneAttributes(t){var e;t._multiplicity=this._multiplicity,t._reference=this._reference,t._breakpoints=null===(e=this._breakpoints)||void 0===e?void 0:e.map((t=>t.clone()))}}F.arcTypeMapping=new Map([[o.REGULAR_TP,n.REGULAR],[o.REGULAR_PT,n.REGULAR],[o.READ,n.READ],[o.RESET,n.RESET],[o.INHIBITOR,n.INHIBITOR]]);class G{constructor(t,e){this._x=t,this._y=e}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}clone(){return new G(this.x,this.y)}}class $ extends F{assertCanFire(){if(!this.canFire())throw new Error(`Firing precondition of arc ${this.id} is not fulfilled`)}}class H extends ${consume(){return this.assertCanFire(),0}canFire(){return this.source.marking<this.multiplicity}get type(){return o.INHIBITOR}clone(){const t=new H(this.source,this.destination,this.id);return super.cloneAttributes(t),t}}class X extends ${consume(){return this.assertCanFire(),0}canFire(){return this.source.marking>=this.multiplicity}get type(){return o.READ}clone(){const t=new X(this.source,this.destination,this.id);return super.cloneAttributes(t),t}}class W extends ${consume(){return this.assertCanFire(),this.source.marking-=this.multiplicity,this.multiplicity}canFire(){return this.source.marking>=this.multiplicity}get type(){return o.REGULAR_PT}clone(){const t=new W(this.source,this.destination,this.id);return super.cloneAttributes(t),t}}class q extends F{}class Y extends q{produce(){this.destination.marking+=this.multiplicity}get type(){return o.REGULAR_TP}clone(){const t=new Y(this.source,this.destination,this.id);return super.cloneAttributes(t),t}}class z extends ${consume(){const t=this.source.marking;return this.source.marking=0,t}canFire(){return!0}get type(){return o.RESET}clone(){const t=new z(this.source,this.destination,this.id);return super.cloneAttributes(t),t}}class Q{constructor(t){this._name=t,this._properties=new Array,this._icons=new Array}get name(){return this._name}set name(t){this._name=t}get properties(){return this._properties}set properties(t){this._properties=t}get icons(){return this._icons}set icons(t){this._icons=t}clone(){const t=new Q(this._name);return t.properties=this.properties.map((t=>t.clone())),t.icons=this.icons.map((t=>t.clone())),t}}class j extends V{constructor(t,e){super(t,e)}clone(){const t=new j(this.type,this.id);return this.preActions.forEach((e=>t.preActions.push(e))),this.postActions.forEach((e=>t.postActions.push(e))),t}}!function(t){t.SET="set",t.GET="get"}(a||(a={}));class K extends N{addAction(t,i,s){var r;this.events.has(i)||this.addEvent(new j(i,"")),s||(s=i===a.GET?e.PRE:e.POST),null===(r=this.events.get(i))||void 0===r||r.addAction(t,s)}}class J extends K{constructor(t,e){super(),this._id=t,this._title=new T(""),this._placeholder=new T(""),this._desc=new T(""),this._type=e,this._options=new Array,this._validations=[],this._inits=[],this._immediate=!1,this._actionRef=[],this._allowedNets=[]}get id(){return this._id}set id(t){this._id=t}get title(){return this._title}set title(t){this._title=t}get placeholder(){return this._placeholder}set placeholder(t){this._placeholder=t}get desc(){return this._desc}set desc(t){this._desc=t}get options(){return this._options}set options(t){this._options=t}get optionsInit(){return this._optionsInit}set optionsInit(t){this._optionsInit=t}get validations(){return this._validations}set validations(t){this._validations=t}get init(){return this._init}set init(t){this._init=t}get inits(){return this._inits}set inits(t){this._inits=t}get component(){return this._component}set component(t){this._component=t}get type(){return this._type}set type(t){this._type=t}get immediate(){return this._immediate}set immediate(t){this._immediate=t}get encryption(){return this._encryption}set encryption(t){this._encryption=t}get remote(){return this._remote}set remote(t){this._remote=t}get actionRef(){return this._actionRef}set actionRef(t){this._actionRef=t}get length(){return this._length}set length(t){this._length=t}get allowedNets(){return this._allowedNets}set allowedNets(t){this._allowedNets=t}clone(){var t,e,i,s,r,o,n,a,l;const c=new J(this._id,this._type);return c._title=null===(t=this._title)||void 0===t?void 0:t.clone(),c._placeholder=null===(e=this._placeholder)||void 0===e?void 0:e.clone(),c._desc=null===(i=this._desc)||void 0===i?void 0:i.clone(),c._options=null===(s=this._options)||void 0===s?void 0:s.map((t=>t.clone())),c._optionsInit=null===(r=this._optionsInit)||void 0===r?void 0:r.clone(),c._validations=null===(o=this._validations)||void 0===o?void 0:o.map((t=>t.clone())),c._init=null===(n=this._init)||void 0===n?void 0:n.clone(),c._inits=null===(a=this._inits)||void 0===a?void 0:a.map((t=>t.clone())),c._component=null===(l=this._component)||void 0===l?void 0:l.clone(),c._immediate=this._immediate,c._encryption=this._encryption,c._remote=this._remote,c._actionRef=[...this._actionRef],c._length=this._length,c._allowedNets=[...this._allowedNets],this.getEvents().forEach((t=>c.addEvent(t.clone()))),c}compare(t){return this.id.localeCompare(t.id)}}class Z{constructor(t,e=!1){this._dynamic=e,this._expression=t}get dynamic(){return this._dynamic}set dynamic(t){this._dynamic=t}get expression(){return this._expression}set expression(t){this._expression=t}clone(){return new Z(this._expression,this._dynamic)}}!function(t){t.MATERIAL="material",t.SVG="svg"}(l||(l={}));class tt{constructor(t,e,i=l.MATERIAL){this._key=t,this._icon=e,this._type=i}get key(){return this._key}set key(t){this._key=t}get icon(){return this._icon}set icon(t){this._icon=t}get type(){return this._type}set type(t){this._type=t}clone(){return new tt(this._key,this._icon,this._type)}}class et{constructor(t="",e=new T("")){this._key=t,this._value=e}get key(){return this._key}set key(t){this._key=t}get value(){return this._value}set value(t){this._value=t}static of(t,e){const i=new et;return i._key=t,i._value=e,i}clone(){var t;const e=new et;return e._key=this._key,e._value=null===(t=this._value)||void 0===t?void 0:t.clone(),e}}class it{constructor(t,e){this._key=t,this._value=e}get key(){return this._key}set key(t){this._key=t}get value(){return this._value}set value(t){this._value=t}clone(){return new it(this._key,this._value)}}class st{constructor(){this._message=new T("")}get expression(){return this._expression}set expression(t){this._expression=t}get message(){return this._message}set message(t){this._message=t}clone(){var t,e;const i=new st;return i.expression=null===(t=this._expression)||void 0===t?void 0:t.clone(),i.message=null===(e=this._message)||void 0===e?void 0:e.clone(),i}}class rt{constructor(t){this._locale=t,this._i18ns=new Map}get locale(){return this._locale}set locale(t){this._locale=t}getI18ns(){return Array.from(this._i18ns.values())}getI18n(t){return this._i18ns.get(t)}addI18n(t){if(t&&t.name){if(this._i18ns.has(t.name))throw new Error(`Duplicate translation with name ${t.name}`);this._i18ns.set(t.name,t)}}removeI18n(t){this._i18ns.delete(t)}clone(){const t=new rt(this._locale);return this._i18ns.forEach((e=>t.addI18n(e.clone()))),t}}class ot extends V{constructor(t,e){super(t,e),this._title=new T("")}get title(){return this._title}set title(t){this._title=t}clone(){var t,e;const i=new ot(this.type,this.id);return i.message=null===(t=this.message)||void 0===t?void 0:t.clone(),i._title=null===(e=this._title)||void 0===e?void 0:e.clone(),this.preActions.forEach((t=>i.preActions.push(t.clone()))),this.postActions.forEach((t=>i.postActions.push(t.clone()))),i}isEmpty(){return super.isEmpty()&&this._title.isEmpty()}}!function(t){t.ASSIGN="assign",t.CANCEL="cancel"}(c||(c={})),function(t){t.TOP="top",t.CENTER="center",t.BOTTOM="bottom"}(h||(h={})),function(t){t.LEGACY="legacy",t.STANDARD="standard",t.FILL="fill",t.OUTLINE="outline"}(d||(d={})),function(t){t.MANUAL="manual",t.AUTO="auto"}(p||(p={}));class nt{get cancel(){return this._cancel}set cancel(t){this._cancel=t}get reassign(){return this._reassign}set reassign(t){this._reassign=t}clone(){const t=new nt;return t.cancel=this.cancel,t.reassign=this.reassign,t}}!function(t){t.UP="up",t.NONE="none"}(u||(u={})),function(t){t.MANUAL="manual",t.AUTO_EMPTY_REQUIRED="auto_empty_required"}(g||(g={}));class at{get rows(){return this._rows}set rows(t){this._rows=t}get cols(){return this._cols}set cols(t){this._cols=t}get offset(){return this._offset}set offset(t){this._offset=t}get alignment(){return this._alignment}set alignment(t){this._alignment=t}}!function(t){t.MATERIAL="material",t.NETGRIF="netgrif"}(m||(m={}));class lt extends at{constructor(t=0,e=0,i=m.MATERIAL,s=d.OUTLINE){super(),this._x=t,this._y=e,this._template=i,this._appearance=s}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get template(){return this._template}set template(t){this._template=t}get appearance(){return this._appearance}set appearance(t){this._appearance=t}clone(){const t=new lt;return t._x=this._x,t._y=this._y,t._template=this._template,t._appearance=this._appearance,t.rows=this.rows,t.cols=this.cols,t.offset=this.offset,t.alignment=this.alignment,t}}!function(t){t.REQUIRED="required",t.IMMEDIATE="immediate",t.OPTIONAL="optional",t.VISIBLE="visible",t.EDITABLE="editable",t.HIDDEN="hidden",t.FORBIDDEN="forbidden"}(_||(_={}));class ct{constructor(){this._behavior=_.EDITABLE,this._required=!1,this._immediate=!1,this._actionRefs=[]}get behavior(){return this._behavior}set behavior(t){this._behavior=t}get required(){return this._required}set required(t){this._required=t}get immediate(){return this._immediate}set immediate(t){this._immediate=t}get actionRefs(){return this._actionRefs}set actionRefs(t){this._actionRefs=t}clone(){const t=new ct;return t.behavior=this.behavior,t.required=this.required,t.immediate=this.immediate,this.actionRefs.forEach((e=>t.actionRefs.push(e))),t}}class ht extends K{constructor(t){super(),this._id=t,this._logic=new ct,this._layout=new lt}get id(){return this._id}set id(t){this._id=t}get logic(){return this._logic}set logic(t){this._logic=t}get layout(){return this._layout}set layout(t){this._layout=t}get component(){return this._component}set component(t){this._component=t}clone(){var t,e,i;const s=new ht(this._id);return s._logic=null===(t=this._logic)||void 0===t?void 0:t.clone(),s._layout=null===(e=this._layout)||void 0===e?void 0:e.clone(),s._component=null===(i=this._component)||void 0===i?void 0:i.clone(),this.getEvents().forEach((t=>s.addEvent(t.clone()))),s}}class dt{constructor(t){this._id=t,this._stretch=!1,this._dataRefs=new Map}get id(){return this._id}set id(t){this._id=t}get cols(){return this._cols}set cols(t){this._cols=t}get rows(){return this._rows}set rows(t){this._rows=t}get title(){return this._title}set title(t){this._title=t}get layout(){return this._layout}set layout(t){this._layout=t}get alignment(){return this._alignment}set alignment(t){this._alignment=t}get stretch(){return this._stretch}set stretch(t){this._stretch=t}get hideEmptyRows(){return this._hideEmptyRows}set hideEmptyRows(t){this._hideEmptyRows=t}get compactDirection(){return this._compactDirection}set compactDirection(t){this._compactDirection=t}getDataRefs(){return Array.from(this._dataRefs.values())}getDataRef(t){return this._dataRefs.get(t)}addDataRef(t){if(this._dataRefs.has(t.id))throw new Error(`Duplicate data field with id ${t.id}`);this._dataRefs.set(t.id,t)}removeDataRef(t){this._dataRefs.delete(t)}clone(){var t;const e=new dt(this._id);return e._cols=this._cols,e._rows=this._rows,e._title=null===(t=this._title)||void 0===t?void 0:t.clone(),e._layout=this._layout,e._alignment=this._alignment,e._stretch=this._stretch,e._hideEmptyRows=this._hideEmptyRows,e._compactDirection=this._compactDirection,this._dataRefs.forEach((t=>{e.addDataRef(t.clone())})),e}}!function(t){t.MANUAL="manual",t.AUTO_NO_DATA="auto_no_data"}(f||(f={})),function(t){t.ALL="all",t.COMPACTED="compacted",t.NONE="none"}(v||(v={})),function(t){t.FLOW="flow",t.GRID="grid",t.LEGACY="legacy"}(y||(y={}));class pt{get perform(){return this._perform}set perform(t){this._perform=t}get delegate(){return this._delegate}set delegate(t){this._delegate=t}get cancel(){return this._cancel}set cancel(t){this._cancel=t}get assign(){return this._assign}set assign(t){this._assign=t}get view(){return this._view}set view(t){this._view=t}clone(){const t=new pt;return t.perform=this._perform,t.delegate=this._delegate,t.cancel=this._cancel,t.assign=this._assign,t.view=this._view,t}}class ut extends k{constructor(t){super(t,new pt)}clone(){var t;const e=new ut(this.id);return e.logic=null===(t=this.logic)||void 0===t?void 0:t.clone(),e}}class gt extends N{constructor(){super()}}class mt extends w{constructor(t,e,i){super(i,t,e,new T("")),this._assignPolicy=p.MANUAL,this._dataFocusPolicy=g.MANUAL,this._finishPolicy=f.MANUAL,this._triggers=[],this._roleRefs=[],this._userRefs=[],this._dataGroups=[],this._eventSource=new gt,this._tags=new Map}get layout(){return this._layout}set layout(t){this._layout=t}get icon(){return this._icon}set icon(t){this._icon=t}get priority(){return this._priority}set priority(t){this._priority=t}get assignPolicy(){return this._assignPolicy}set assignPolicy(t){this._assignPolicy=t}get finishPolicy(){return this._finishPolicy}set finishPolicy(t){this._finishPolicy=t}get dataFocusPolicy(){return this._dataFocusPolicy}set dataFocusPolicy(t){this._dataFocusPolicy=t}get triggers(){return this._triggers}set triggers(t){this._triggers=t}get transactionRef(){return this._transactionRef}set transactionRef(t){this._transactionRef=t}get roleRefs(){return this._roleRefs}set roleRefs(t){this._roleRefs=t}get userRefs(){return this._userRefs}set userRefs(t){this._userRefs=t}get dataGroups(){return this._dataGroups}set dataGroups(t){this._dataGroups=t}get assignedUser(){return this._assignedUser}set assignedUser(t){this._assignedUser=t}get eventSource(){return this._eventSource}set eventSource(t){this._eventSource=t}get tags(){return this._tags}set tags(t){this._tags=t}clone(){var t,e,i;const s=new mt(this.x,this.y,this.id);return s.label=null===(t=this.label)||void 0===t?void 0:t.clone(),s._layout=null===(e=this._layout)||void 0===e?void 0:e.clone(),s._icon=this._icon,s._priority=this._priority,s._assignPolicy=this._assignPolicy,s._finishPolicy=this._finishPolicy,s._dataFocusPolicy=this._dataFocusPolicy,s._triggers=this._triggers.map((t=>t.clone())),s._transactionRef=this._transactionRef,s._roleRefs=this._roleRefs.map((t=>t.clone())),s._userRefs=this._userRefs.map((t=>t.clone())),s._dataGroups=this._dataGroups.map((t=>t.clone())),s._assignedUser=null===(i=this._assignedUser)||void 0===i?void 0:i.clone(),this.eventSource.getEvents().forEach((t=>s.eventSource.addEvent(t.clone()))),this.tags.forEach(((t,e)=>s.tags.set(e,t))),s}}class _t extends V{constructor(t,e){super(t,e),this._title=new T("")}get title(){return this._title}set title(t){this._title=t}clone(){var t,e;const i=new _t(this.type,this.id);return i.message=null===(t=this.message)||void 0===t?void 0:t.clone(),i._title=null===(e=this._title)||void 0===e?void 0:e.clone(),this.preActions.forEach((t=>i.preActions.push(t.clone()))),this.postActions.forEach((t=>i.postActions.push(t.clone()))),i}isEmpty(){return super.isEmpty()&&this._title.isEmpty()}}!function(t){t.ASSIGN="assign",t.FINISH="finish",t.CANCEL="cancel",t.DELEGATE="delegate"}(E||(E={}));class ft extends at{get type(){return this._type}set type(t){this._type=t}get hideEmptyRows(){return this._hideEmptyRows}set hideEmptyRows(t){this._hideEmptyRows=t}get compactDirection(){return this._compactDirection}set compactDirection(t){this._compactDirection=t}empty(){return void 0===this.cols&&void 0===this.rows&&void 0===this.offset&&void 0===this.alignment&&void 0===this._type}clone(){const t=new ft;return t.rows=this.rows,t.cols=this.cols,t.offset=this.offset,t.alignment=this.alignment,t.hideEmptyRows=this.hideEmptyRows,t.compactDirection=this.compactDirection,t.type=this._type,t}}!function(t){t.AUTO="auto",t.USER="user",t.TIME="time"}(x||(x={}));class vt{constructor(t=x.AUTO){this._type=t}get type(){return this._type}set type(t){this._type=t}get delay(){return this._delay}set delay(t){this._delay=t}get exact(){return this._exact}set exact(t){this._exact=t}clone(){const t=new vt;return t._type=this._type,t._delay=this._delay,this._exact&&(t._exact=new Date(this._exact.valueOf())),t}}class yt{constructor(){this.eventIdCounter=0,this.actionIdCounter=0}tagValue(t,e){var i,s,r,o;if(!t||0===t.getElementsByTagName(e).length||0===t.getElementsByTagName(e)[0].childNodes.length)return"";const n="#document"===t.nodeName?"document":t.nodeName,a=Array.from(t.getElementsByTagName(e)).filter((t=>{var e;return(null===(e=null==t?void 0:t.parentNode)||void 0===e?void 0:e.nodeName)===n}));return void 0===a||0===a.length||0===(null===(i=a[0])||void 0===i?void 0:i.childNodes.length)?"":null!==(o=null===(r=null===(s=a[0])||void 0===s?void 0:s.childNodes[0])||void 0===r?void 0:r.nodeValue)&&void 0!==o?o:""}parseI18n(t,e){const i=new T(this.tagValue(t,e));if(""!==i.value){const s=t.getElementsByTagName(e)[0].getAttribute("name");i.name=null===s?void 0:s}return i}parseI18nWithDynamic(t,e){const i=new A(this.removeExcessiveIndents(this.tagValue(t,e)));if(""!==i.value){const s=t.getElementsByTagName(e)[0].getAttribute("name");i.name=null===s?void 0:s,i.dynamic="true"===t.getElementsByTagName(e)[0].getAttribute("dynamic")}return i}tagAttribute(t,e){var i;if(!t)return"";let s;for(let r=0;r<t.attributes.length;r++)if((null===(i=t.attributes.item(r))||void 0===i?void 0:i.name)===e){s=t.attributes.item(r);break}return s?s.value:""}parseAction(t){var e;const i=null!==(e=t.getAttribute("id"))&&void 0!==e?e:"action_"+this.getNextActionId(),s=this.parseDefinition(t);return new C(i,s.trim())}parseFunction(t){const e=this.tagAttribute(t,"name"),i=this.tagAttribute(t,"scope"),s=this.parseDefinition(t);return new P(e,i,s)}parseDefinition(t){let e="";for(const i of Array.from(t.childNodes))if("#comment"===i.nodeName){if(!i.nodeValue||i.nodeValue.includes("@formatter"))continue;e+="\x3c!--"+i.nodeValue+"--\x3e"}else e+=i.nodeValue;return this.removeExcessiveIndents(e)}removeExcessiveIndents(t){const e=t.split("\n").filter((t=>0!==t.trim().length));let i=Math.min(...e.map((t=>t.length-t.trimStart().length)));return!isNaN(i)&&isFinite(i)||(i=0),e.map((t=>t.substring(i))).join("\n")}parseEncryption(t){const e=this.tagValue(t,"encryption");if(!e||"true"!==e)return;const i=t.getElementsByTagName("encryption")[0].getAttribute("algorithm");return"string"==typeof i&&""!==i?i:e}parseViewAndComponent(t){const e=t.getElementsByTagName("component")[0];if(!(null==e?void 0:e.children)||0===e.children.length){const e=t.getElementsByTagName("view")[0];if(!(null==e?void 0:e.children)||0===e.children.length)return;return new Q(e.children[0].nodeName)}return this.parseComponent(t)}parseComponent(t){const e=t.getElementsByTagName("component")[0];if(!(null==e?void 0:e.children)||0===e.children.length)return;const i=new Q(this.tagValue(e,"name")),s=e.getElementsByTagName("properties")[0];if((null==s?void 0:s.children)&&s.children.length>0){for(const t of Array.from(s.getElementsByTagName("property")))i.properties.push(this.parseProperty(t));const t=s.getElementsByTagName("option_icons").item(0);if((null==t?void 0:t.children)&&t.children.length>0)for(const e of Array.from(t.getElementsByTagName("icon"))){const t=this.tagAttribute(e,"key");let s=this.tagAttribute(e,"type");""===s&&(s=l.MATERIAL);const r=e.innerHTML;i.icons.push(new tt(t,r,s))}}else for(const t of Array.from(e.getElementsByTagName("property")))i.properties.push(this.parseProperty(t));return i}parseProperty(t){const e=this.tagAttribute(t,"key"),i=t.innerHTML;return new it(e,i)}resolveLogic(t,e){e.logic.delegate=this.resolveLogicValue(this.tagValue(t,"delegate")),e.logic.perform=this.resolveLogicValue(this.tagValue(t,"perform"));const i=this.resolveLogicValue(this.tagValue(t,"assigned"));e.logic.assign=void 0!==i?i:this.resolveLogicValue(this.tagValue(t,"assign")),e.logic.cancel=this.resolveLogicValue(this.tagValue(t,"cancel")),e.logic.view=this.resolveLogicValue(this.tagValue(t,"view"))}resolveLogicValue(t){return void 0!==t&&""!==t?"true"===t:void 0}resolveCaseLogic(t,e){e.logic.create=this.resolveLogicValue(this.tagValue(t,"create")),e.logic.delete=this.resolveLogicValue(this.tagValue(t,"delete")),e.logic.view=this.resolveLogicValue(this.tagValue(t,"view"))}checkVariability(t,e,i){if(!i)return;let s=t.getPlace(i);s?this.attachReference(e,s):(s=t.getData(i),s&&this.attachReference(e,s))}attachReference(t,e){var i;let s;if(s=e instanceof U?e.marking:(null===(i=e.init)||void 0===i?void 0:i.value)&&yt.isInitValueNumber(e.init)?parseInt(e.init.value.trim()):0,isNaN(s))throw new Error("Not a number. Cannot change the value of arc weight.");if(s<0)throw new Error("A negative number. Cannot change the value of arc weight.");!isNaN(s)&&s>=0&&(t.multiplicity=s,t.reference=e.id)}static isInitValueNumber(t){return!!t&&!!t.value&&this.initValueNumberTest(t)}static initValueNumberTest(t){return!(!t||!t.value)&&/^[1-9]\d*(\.0+)?$/.test(t.value.trim())}parseTrigger(t){const e=new vt;return e.type=this.tagAttribute(t,"type"),e.type===x.TIME&&(e.delay=""===this.tagValue(t,"delay")?void 0:this.tagValue(t,"delay"),e.exact=""===this.tagValue(t,"exact")?void 0:new Date(this.tagValue(t,"exact"))),e}parseRoleRef(t){const e=t.getElementsByTagName("logic")[0],i=new ut(this.tagValue(t,"id"));return this.resolveLogic(e,i),i}parseDataRef(t,e){const i=new ht(this.tagValue(t,"id"));for(const e of Array.from(t.getElementsByTagName("event"))){const t=new j(this.tagAttribute(e,"type"),"");this.parseEvent(e,t),i.mergeEvent(t)}const s=t.getElementsByTagName("logic")[0];if(s){const t=Array.from(s.getElementsByTagName("action"));if(t.length>0)for(const e of t){const t=this.parseAction(e),s=e.getAttribute("trigger");i.addAction(t,s)}for(const t of Array.from(s.getElementsByTagName("behavior")))t.childNodes[0].nodeValue===_.REQUIRED?i.logic.required=!0:t.childNodes[0].nodeValue===_.IMMEDIATE?i.logic.immediate=!0:t.childNodes[0].nodeValue!==_.OPTIONAL&&(i.logic.behavior=t.childNodes[0].nodeValue)}i.component=this.parseComponent(t);const r=t.getElementsByTagName("layout");return 0!==r.length?i.layout=this.parseDataLayout(r.item(0)):(i.layout=new lt,i.layout.x=0,i.layout.y=e,i.layout.rows=1,i.layout.cols=2),i}parseDataLayout(t){var e,i,s,r;const o=new lt;return t?(o.x=null!==(e=this.parseNumberValue(t,"x"))&&void 0!==e?e:0,o.y=null!==(i=this.parseNumberValue(t,"y"))&&void 0!==i?i:0,o.rows=null!==(s=this.parseNumberValue(t,"rows"))&&void 0!==s?s:0,o.cols=null!==(r=this.parseNumberValue(t,"cols"))&&void 0!==r?r:0,o.template=this.tagValue(t,"template"),o.appearance=this.tagValue(t,"appearance"),o.offset=this.parseNumberValue(t,"offset"),o.alignment=this.tagValue(t,"alignment"),o):o}parseDataGroup(t){const e=new dt(this.tagValue(t,"id"));if(e.alignment=this.tagValue(t,"alignment"),e.layout=this.tagValue(t,"layout"),e.layout&&e.layout!==y.LEGACY){const i=this.parseNumberValue(t,"cols");i&&i>0&&(e.cols=i);const s=this.parseNumberValue(t,"rows");(s&&s>0||0===s)&&(e.rows=s)}e.stretch="true"===this.tagValue(t,"stretch"),e.hideEmptyRows=this.tagValue(t,"hideEmptyRows"),e.compactDirection=this.tagValue(t,"compactDirection"),e.title=this.parseI18n(t,"title");const i=Array.from(t.getElementsByTagName("dataRef"));for(let t=0;t<i.length;t++){const s=i[t];e.addDataRef(this.parseDataRef(s,t))}return e}parsePlaceStatic(t){let e=!1;return this.checkLengthAndNodes(t,"isStatic")&&(e="true"===t.getElementsByTagName("isStatic")[0].childNodes[0].nodeValue),this.checkLengthAndNodes(t,"static")&&(e="true"===t.getElementsByTagName("static")[0].childNodes[0].nodeValue),e}parseArcType(t){let e=n.REGULAR;return this.checkLengthAndNodes(t,"type")&&(e=t.getElementsByTagName("type")[0].childNodes[0].nodeValue),e}parseEvent(t,e){e.id=this.tagValue(t,"id"),""===e.id&&(e.id=e.type+"_event_"+this.getNextEventId());for(const i of Array.from(t.getElementsByTagName("actions"))){const t=this.tagAttribute(i,"phase"),s=Array.from(i.getElementsByTagName("action"));if(s.length>0)for(const i of s){const s=this.parseAction(i);e.addAction(s,t)}}}resolveInits(t){var e;const i=[];if(this.checkLengthAndNodes(t,"inits"))for(const s of Array.from(null===(e=t.getElementsByTagName("inits")[0])||void 0===e?void 0:e.getElementsByTagName("init"))){const t=this.resolveInitValue(s);t&&i.push(t)}return i}resolveInit(t){var e;let i;for(const s of Array.from(t.getElementsByTagName("init")))(null===(e=s.parentElement)||void 0===e?void 0:e.tagName)&&"data"===s.parentElement.tagName&&(i=s);return this.resolveInitValue(i)}resolveInitValue(t){var e;if(!t)return;const i=this.tagAttribute(t,"dynamic"),s=this.tagAttribute(t,"name"),r=this.removeExcessiveIndents(null!==(e=t.textContent)&&void 0!==e?e:"");return new A(r,s,""===i?void 0:"true"===i)}checkLengthAndNodes(t,e){return t.getElementsByTagName(e).length>0&&0!==t.getElementsByTagName(e)[0].childNodes.length}resolveFormat(t,e){var i,s,r,o;if(this.checkLengthAndNodes(t,"format")){void 0===e.component&&(e.component=new Q("currency"));const n=null===(s=null===(i=t.getElementsByTagName("format"))||void 0===i?void 0:i.item(0))||void 0===s?void 0:s.getElementsByTagName("currency").item(0);if(!n)return;e.component.properties.push(new it("locale",this.tagValue(n,"locale"))),e.component.properties.push(new it("code",""!==this.tagValue(n,"code")?this.tagValue(n,"code"):"EUR")),e.component.properties.push(new it("fractionSize",null!==(o=null===(r=void 0!==this.parseNumberValue(n,"fractionSize")?this.parseNumberValue(n,"fractionSize"):2)||void 0===r?void 0:r.toString())&&void 0!==o?o:""))}}parseNumberValue(t,e){if(!t)return;const i=parseInt(this.tagValue(t,e),10);return isNaN(i)?void 0:i}parseExpression(t,e){const i=this.removeExcessiveIndents(this.tagValue(t,e));let s;if(t.getElementsByTagName(e).length>0&&(s=this.tagAttribute(t.getElementsByTagName(e).item(0),"dynamic")),""!==i||"true"===s)return new Z(i,""===s?void 0:"true"===s)}getNextEventId(){return this.eventIdCounter++}getNextActionId(){return this.actionIdCounter++}resetEventId(){this.eventIdCounter=0}resetActionId(){this.actionIdCounter=0}resetIds(){this.resetEventId(),this.resetActionId()}parseTags(t){const e=new Map,i=t.getElementsByTagName("tags")[0];if((null==i?void 0:i.children)&&i.children.length>0)for(const i of Array.from(t.getElementsByTagName("tag")))this.parseTag(e,i);return e}parseTag(t,e){const i=this.tagAttribute(e,"key"),s=e.innerHTML;t.set(i,s)}}class Et{constructor(t=new b){this._model=t,this._errors=[],this._warnings=[],this._info=[]}get model(){return this._model}set model(t){this._model=t}get errors(){return this._errors}addError(t,e){this._errors.push(t),console.log(e)}get warnings(){return this._warnings}addWarning(t){this._warnings.push(t)}get info(){return this._info}addInfo(t){this._info.push(t)}}class xt{constructor(t=new yt){this.importUtils=t}parseXml(t){let e=new Document;if(window.DOMParser){e=(new DOMParser).parseFromString(t,"text/xml")}return e}parseFromXml(t){var e,i,s;const r=this.parseXml(t),o=r.getElementsByTagName("parsererror");let n=new Et;if(0!==o.length){let t,r=null===(i=null===(e=o.item(0))||void 0===e?void 0:e.textContent)||void 0===i?void 0:i.match(xt.PARSE_ERROR_LINE_EXTRACTION_REGEX);return r=r||null,t=r&&0!==r.length?`XML parsing error at line ${r[1]} column ${r[2]}`:null===(s=o.item(0))||void 0===s?void 0:s.textContent,n.errors.push(t||""),n}return n=this.importFromXml(r,n),this.importUtils.resetIds(),n}importFromXml(t,e){return e.model=new b,this.importModel(e,t),this.importRoles(e,t),this.importFunctions(e,t),this.importEvents(e,t),this.importData(e,t),this.importTransitions(e,t),this.importTransactions(e,t),this.importProcessRefs(e,t),this.importPlaces(e,t),this.importArcs(e,t),this.importI18n(e,t),this.importMapping(e,t),this.checkI18ns(e),e}importModel(t,e){try{t.model.id=this.importUtils.tagValue(e,"id"),t.model.version=this.importUtils.tagValue(e,"version"),t.model.initials=this.importUtils.tagValue(e,"initials"),t.model.icon=this.importUtils.tagValue(e,"icon"),t.model.defaultRole=""===this.importUtils.tagValue(e,"defaultRole")?xt.DEFAULT_ROLE_DEFAULT_VALUE:"true"===this.importUtils.tagValue(e,"defaultRole"),t.model.anonymousRole=""===this.importUtils.tagValue(e,"anonymousRole")?xt.ANONYMOUS_ROLE_DEFAULT_VALUE:"true"===this.importUtils.tagValue(e,"anonymousRole"),t.model.transitionRole=""===this.importUtils.tagValue(e,"transitionRole")?xt.TRANSITION_ROLE_DEFAULT_VALUE:"true"===this.importUtils.tagValue(e,"transitionRole"),t.model.title=this.importUtils.parseI18n(e,"title"),t.model.caseName=this.importUtils.parseI18nWithDynamic(e,"caseName"),t.model.tags=this.importUtils.parseTags(e)}catch(e){t.addError("Error happened during the importing model properties: "+e.toString(),e)}}importRoles(t,e){for(const i of Array.from(e.getElementsByTagName("role")))try{const e=new I(this.importUtils.tagValue(i,"id"));this.parseRole(t.model,i,e)}catch(e){t.addError("Error happened during the importing role ["+this.importUtils.tagValue(i,"id")+"]: "+e.toString(),e)}}parseRole(t,e,i){let s=this.importUtils.parseI18n(e,"title");void 0!==s.value&&""!==s.value||(s=this.importUtils.parseI18n(e,"name")),i.title=s,i.global="true"===this.importUtils.tagValue(e,"global");for(const t of Array.from(e.getElementsByTagName("event"))){const e=new ot(this.importUtils.tagAttribute(t,"type"),"");e.message=this.importUtils.parseI18n(t,"message"),e.title=this.importUtils.parseI18n(t,"title"),this.importUtils.parseEvent(t,e),i.mergeEvent(e)}t.addRole(i)}importFunctions(t,e){for(const i of Array.from(e.getElementsByTagName("function")))try{t.model.addFunction(this.importUtils.parseFunction(i))}catch(e){t.addError("An error has occurred during the function import: "+e.toString(),e)}}importEvents(t,e){for(const i of Array.from(e.getElementsByTagName("processEvents")))for(const e of Array.from(i.getElementsByTagName("event")))try{const i=new M(this.importUtils.tagAttribute(e,"type"),"");this.importUtils.parseEvent(e,i),t.model.addProcessEvent(i)}catch(e){t.addError("Error happened during the importing process event: "+e.toString(),e)}for(const i of Array.from(e.getElementsByTagName("caseEvents")))for(const e of Array.from(i.getElementsByTagName("event")))try{const i=new S(this.importUtils.tagAttribute(e,"type"),"");this.importUtils.parseEvent(e,i),t.model.addCaseEvent(i)}catch(e){t.addError("Error happened during the importing case event: "+e.toString(),e)}}importData(t,e){for(const i of Array.from(e.getElementsByTagName("data")))try{const e=this.importUtils.tagValue(i,"id"),s=this.importUtils.tagAttribute(i,"type"),r=new J(e,s);this.parseData(t,i,r)}catch(e){t.addError("Error happened during the importing data ["+this.importUtils.tagValue(i,"id")+"]: "+e.toString(),e)}}parseData(e,i,s){var r,o,n,a,l,c,h;const d=e.model;s.title=this.importUtils.parseI18n(i,"title"),s.placeholder=this.importUtils.parseI18n(i,"placeholder"),s.desc=this.importUtils.parseI18n(i,"desc"),s.immediate="true"===this.importUtils.tagAttribute(i,"immediate"),s.encryption=this.importUtils.parseEncryption(i),s.init=this.importUtils.resolveInit(i),s.inits=this.importUtils.resolveInits(i),s.length=this.importUtils.parseNumberValue(i,"length"),s.component=this.importUtils.parseViewAndComponent(i),this.importUtils.resolveFormat(i,s),i.getElementsByTagName("remote").length>0&&(s.remote=!0);const p=Array.from(i.getElementsByTagName("values"));if(1===p.length&&"area"===p[0].innerHTML&&s.type===t.TEXT)s.component||(s.component=new Q("area"),e.addInfo(`Tag <values>area</values> of field ${s.id} changed to component`));else if(p.length>0){for(const t of p)if(void 0!==t.childNodes[0]){const e=new et,i=t.childNodes[0].nodeValue?t.childNodes[0].nodeValue:"",r=t.getAttribute("name");e.value=new A(i),e.value.name=r||void 0,e.key=i,s.options.push(e)}e.addInfo(`Values of field ${s.id} changed to options`)}if(i.getElementsByTagName("options").length>0){for(const t of Array.from(null===(r=i.getElementsByTagName("options")[0])||void 0===r?void 0:r.getElementsByTagName("option"))){const e=null!==(o=t.getAttribute("key"))&&void 0!==o?o:"",i=new T(t.innerHTML);i.name=null!==(n=t.getAttribute("name"))&&void 0!==n?n:"",s.options.push(et.of(e,i))}s.optionsInit=this.importUtils.parseExpression(i.getElementsByTagName("options")[0],"init")}const u=this.importUtils.tagValue(i,"valid");if(""!==u){const t=new st;t.expression=new Z(u,"true"===(null===(l=null===(a=i.getElementsByTagName("valid"))||void 0===a?void 0:a.item(0))||void 0===l?void 0:l.getAttribute("dynamic"))),s.validations.push(t),e.addInfo(`Tags <valid> of field ${s.id} changed to validations`)}if(i.getElementsByTagName("validations").length>0)for(const t of Array.from(null===(c=i.getElementsByTagName("validations")[0])||void 0===c?void 0:c.children)){const e=new st;e.expression=new Z(this.importUtils.tagValue(t,"expression"),"true"===t.getAttribute("dynamic")),e.message=this.importUtils.parseI18n(t,"message"),s.validations.push(e)}for(const t of Array.from(i.getElementsByTagName("actionRef")))s.actionRef.push(this.importUtils.tagValue(t,"id"));for(const t of Array.from(i.getElementsByTagName("event"))){const e=new j(this.importUtils.tagAttribute(t,"type"),"");this.importUtils.parseEvent(t,e),s.mergeEvent(e)}const g=Array.from(i.getElementsByTagName("action"));if(g.length>0){let t=0;for(const e of g){const i=e.getAttribute("trigger");if(!i)continue;const r=this.importUtils.parseAction(e);s.addAction(r,i),t+=1}t>0&&e.addInfo(`${t} action${t>1?"s":""} of data variable ${s.id} converted into event actions`)}if(i.getElementsByTagName("allowedNets").length>0)for(const t of Array.from(null===(h=i.getElementsByTagName("allowedNets")[0])||void 0===h?void 0:h.children))s.allowedNets.push(t.innerHTML);d.addData(s)}importTransitions(t,e){var i,s;for(const r of Array.from(e.getElementsByTagName("transition"))){const e=this.importUtils.tagValue(r,"id");try{const o=null!==(i=this.importUtils.parseNumberValue(r,"x"))&&void 0!==i?i:0,n=null!==(s=this.importUtils.parseNumberValue(r,"y"))&&void 0!==s?s:0,a=new mt(o,n,e);this.parseTransition(t,r,a)}catch(i){t.addError("Importing transition ["+e+"]: "+i.toString(),i)}}}parseTransition(t,e,i){t.model.addTransition(i),this.importTransitionMetadata(e,i,t),this.importTransitionLayout(e,i,t),this.importTransitionRoleRefs(e,i,t),this.importTransitionUserRefs(e,i,t),this.importTransitionDataGroups(e,i,t),this.importTransitionTriggers(e,i,t),this.importTransitionEvents(e,i,t),this.importAssignedUser(e,i,t),this.importTransactionRef(e,i,t),i.tags=this.importUtils.parseTags(e)}importTransitionRoleRefs(t,e,i){try{for(const i of Array.from(t.getElementsByTagName("roleRef")))e.roleRefs.push(this.importUtils.parseRoleRef(i))}catch(t){i.addError("Importing transition role refs failed",t)}}importTransitionUserRefs(t,e,i){try{const i=Array.from(t.getElementsByTagName("usersRef")).concat(Array.from(t.getElementsByTagName("userRef")));for(const t of i){const i=t.getElementsByTagName("logic")[0],s=new ut(this.importUtils.tagValue(t,"id"));this.importUtils.resolveLogic(i,s),e.userRefs.push(s)}}catch(t){i.addError("Importing transition user refs failed",t)}}importTransitionTriggers(t,e,i){try{for(const i of Array.from(t.getElementsByTagName("trigger")))e.triggers.push(this.importUtils.parseTrigger(i))}catch(t){i.addError("Importing transition triggers failed",t)}}importTransitionDataGroups(t,e,i){var s;try{for(const s of Array.from(t.getElementsByTagName("dataGroup"))){const t=this.importUtils.tagValue(s,"id");try{e.dataGroups.push(this.importUtils.parseDataGroup(s))}catch(e){i.addError(`Importing data group '${t}' failed`,e)}}const r=Array.from(t.getElementsByTagName("dataRef"));if(0===e.dataGroups.length&&r.length>0){const t=new dt("NewDataGroup");t.stretch=!0;for(let e=0;e<r.length;e++){const i=r[e];"transition"===(null===(s=null==i?void 0:i.parentElement)||void 0===s?void 0:s.tagName)&&t.addDataRef(this.importUtils.parseDataRef(i,e))}e.dataGroups.push(t),i.addInfo(`Data references of transition '${e.id}' wrapped with new data group`)}}catch(t){i.addError("Importing transition data groups failed",t)}}importTransitionLayout(t,e,i){var s,r,o,n;try{const i=t.getElementsByTagName("layout");if(0!==i.length&&(null===(s=i.item(0))||void 0===s?void 0:s.parentNode)&&(null===(o=null===(r=i.item(0))||void 0===r?void 0:r.parentNode)||void 0===o?void 0:o.isSameNode(t))){if(e.layout||(e.layout=new ft),e.layout.type=this.importUtils.tagAttribute(i.item(0),"type"),e.layout.type){if(e.layout.type!==y.LEGACY){const t=this.importUtils.parseNumberValue(i.item(0),"cols");t&&t>0&&(e.layout.cols=t);const s=this.importUtils.parseNumberValue(i.item(0),"rows");(s&&s>0||0===s)&&(e.layout.rows=s)}}else e.layout.type=y.LEGACY;e.layout.offset=null!==(n=this.importUtils.parseNumberValue(i.item(0),"offset"))&&v