aspnetzero-workflow-designer 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3381 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.WorkflowDesigner={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};typeof window==`object`&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),typeof window<`u`&&(function(e){e.forEach(e=>{Object.prototype.hasOwnProperty.call(e,`append`)||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value(...e){let t=document.createDocumentFragment();e.forEach(e=>{let n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))}),this.appendChild(t)}})})})([Element.prototype,Document.prototype,DocumentFragment.prototype]);var r=class{get disposed(){return this._disposed===!0}dispose(){this._disposed=!0}};(function(e){function t(){return(e,t,n)=>{let r=n.value,i=e.__proto__;n.value=function(...e){this.disposed||(r.call(this,...e),i.dispose.call(this))}}}e.dispose=t})(r||={});var i=class{constructor(){this.isDisposed=!1,this.items=new Set}get disposed(){return this.isDisposed}dispose(){this.isDisposed||(this.isDisposed=!0,this.items.forEach(e=>{e.dispose()}),this.items.clear())}contains(e){return this.items.has(e)}add(e){this.items.add(e)}remove(e){this.items.delete(e)}clear(){this.items.clear()}};(function(e){function t(t){let n=new e;return t.forEach(e=>{n.add(e)}),n}e.from=t})(i||={});var a=typeof global==`object`&&global&&global.Object===Object&&global,o=typeof self==`object`&&self&&self.Object===Object&&self,s=a||o||Function(`return this`)(),c=s.Symbol,l=Object.prototype,u=l.hasOwnProperty,d=l.toString,f=c?c.toStringTag:void 0;function p(e){var t=u.call(e,f),n=e[f];try{e[f]=void 0;var r=!0}catch{}var i=d.call(e);return r&&(t?e[f]=n:delete e[f]),i}var m=Object.prototype.toString;function h(e){return m.call(e)}var g=`[object Null]`,_=`[object Undefined]`,v=c?c.toStringTag:void 0;function y(e){return e==null?e===void 0?_:g:v&&v in Object(e)?p(e):h(e)}function b(e){return typeof e==`object`&&!!e}var x=`[object Symbol]`;function S(e){return typeof e==`symbol`||b(e)&&y(e)==x}function C(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var w=Array.isArray,T=1/0,E=c?c.prototype:void 0,D=E?E.toString:void 0;function ee(e){if(typeof e==`string`)return e;if(w(e))return C(e,ee)+``;if(S(e))return D?D.call(e):``;var t=e+``;return t==`0`&&1/e==-T?`-0`:t}var te=/\s/;function ne(e){for(var t=e.length;t--&&te.test(e.charAt(t)););return t}var re=/^\s+/;function ie(e){return e&&e.slice(0,ne(e)+1).replace(re,``)}function O(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var ae=NaN,oe=/^[-+]0x[0-9a-f]+$/i,se=/^0b[01]+$/i,ce=/^0o[0-7]+$/i,le=parseInt;function ue(e){if(typeof e==`number`)return e;if(S(e))return ae;if(O(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=O(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=ie(e);var n=se.test(e);return n||ce.test(e)?le(e.slice(2),n?2:8):oe.test(e)?ae:+e}function de(e){return e}var fe=`[object AsyncFunction]`,pe=`[object Function]`,me=`[object GeneratorFunction]`,he=`[object Proxy]`;function ge(e){if(!O(e))return!1;var t=y(e);return t==pe||t==me||t==fe||t==he}var _e=s[`__core-js_shared__`],ve=function(){var e=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function ye(e){return!!ve&&ve in e}var be=Function.prototype.toString;function xe(e){if(e!=null){try{return be.call(e)}catch{}try{return e+``}catch{}}return``}var Se=/[\\^$.*+?()[\]{}|]/g,Ce=/^\[object .+?Constructor\]$/,we=Function.prototype,Te=Object.prototype,Ee=we.toString,De=Te.hasOwnProperty,Oe=RegExp(`^`+Ee.call(De).replace(Se,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function ke(e){return!O(e)||ye(e)?!1:(ge(e)?Oe:Ce).test(xe(e))}function Ae(e,t){return e?.[t]}function je(e,t){var n=Ae(e,t);return ke(n)?n:void 0}var Me=je(s,`WeakMap`),Ne=Object.create,Pe=function(){function e(){}return function(t){if(!O(t))return{};if(Ne)return Ne(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Fe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Ie(){}function Le(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var Re=800,ze=16,Be=Date.now;function Ve(e){var t=0,n=0;return function(){var r=Be(),i=ze-(r-n);if(n=r,i>0){if(++t>=Re)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function He(e){return function(){return e}}var Ue=function(){try{var e=je(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),We=Ve(Ue?function(e,t){return Ue(e,`toString`,{configurable:!0,enumerable:!1,value:He(t),writable:!0})}:de);function Ge(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function Ke(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function qe(e){return e!==e}function Je(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Ye(e,t,n){return t===t?Je(e,t,n):Ke(e,qe,n)}function Xe(e,t){return!!(e!=null&&e.length)&&Ye(e,t,0)>-1}var Ze=9007199254740991,Qe=/^(?:0|[1-9]\d*)$/;function $e(e,t){var n=typeof e;return t??=Ze,!!t&&(n==`number`||n!=`symbol`&&Qe.test(e))&&e>-1&&e%1==0&&e<t}function et(e,t,n){t==`__proto__`&&Ue?Ue(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function tt(e,t){return e===t||e!==e&&t!==t}var nt=Object.prototype.hasOwnProperty;function rt(e,t,n){var r=e[t];(!(nt.call(e,t)&&tt(r,n))||n===void 0&&!(t in e))&&et(e,t,n)}function it(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?et(n,s,c):rt(n,s,c)}return n}var at=Math.max;function ot(e,t,n){return t=at(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=at(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),Fe(e,this,s)}}function st(e,t){return We(ot(e,t,de),e+``)}var ct=9007199254740991;function lt(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=ct}function ut(e){return e!=null&&lt(e.length)&&!ge(e)}function dt(e,t,n){if(!O(n))return!1;var r=typeof t;return(r==`number`?ut(n)&&$e(t,n.length):r==`string`&&t in n)?tt(n[t],e):!1}function ft(e){return st(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&dt(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var pt=Object.prototype;function mt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||pt)}function ht(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var gt=`[object Arguments]`;function _t(e){return b(e)&&y(e)==gt}var vt=Object.prototype,yt=vt.hasOwnProperty,bt=vt.propertyIsEnumerable,xt=_t(function(){return arguments}())?_t:function(e){return b(e)&&yt.call(e,`callee`)&&!bt.call(e,`callee`)};function St(){return!1}var Ct=typeof e==`object`&&e&&!e.nodeType&&e,wt=Ct&&typeof module==`object`&&module&&!module.nodeType&&module,Tt=wt&&wt.exports===Ct?s.Buffer:void 0,Et=(Tt?Tt.isBuffer:void 0)||St,Dt=`[object Arguments]`,Ot=`[object Array]`,kt=`[object Boolean]`,At=`[object Date]`,jt=`[object Error]`,Mt=`[object Function]`,Nt=`[object Map]`,Pt=`[object Number]`,Ft=`[object Object]`,It=`[object RegExp]`,Lt=`[object Set]`,Rt=`[object String]`,zt=`[object WeakMap]`,Bt=`[object ArrayBuffer]`,Vt=`[object DataView]`,Ht=`[object Float32Array]`,Ut=`[object Float64Array]`,Wt=`[object Int8Array]`,Gt=`[object Int16Array]`,Kt=`[object Int32Array]`,qt=`[object Uint8Array]`,Jt=`[object Uint8ClampedArray]`,Yt=`[object Uint16Array]`,Xt=`[object Uint32Array]`,k={};k[Ht]=k[Ut]=k[Wt]=k[Gt]=k[Kt]=k[qt]=k[Jt]=k[Yt]=k[Xt]=!0,k[Dt]=k[Ot]=k[Bt]=k[kt]=k[Vt]=k[At]=k[jt]=k[Mt]=k[Nt]=k[Pt]=k[Ft]=k[It]=k[Lt]=k[Rt]=k[zt]=!1;function Zt(e){return b(e)&&lt(e.length)&&!!k[y(e)]}function Qt(e){return function(t){return e(t)}}var $t=typeof e==`object`&&e&&!e.nodeType&&e,en=$t&&typeof module==`object`&&module&&!module.nodeType&&module,tn=en&&en.exports===$t&&a.process,nn=function(){try{return en&&en.require&&en.require(`util`).types||tn&&tn.binding&&tn.binding(`util`)}catch{}}(),rn=nn&&nn.isTypedArray,an=rn?Qt(rn):Zt,on=Object.prototype.hasOwnProperty;function sn(e,t){var n=w(e),r=!n&&xt(e),i=!n&&!r&&Et(e),a=!n&&!r&&!i&&an(e),o=n||r||i||a,s=o?ht(e.length,String):[],c=s.length;for(var l in e)(t||on.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||$e(l,c)))&&s.push(l);return s}function cn(e,t){return function(n){return e(t(n))}}var ln=cn(Object.keys,Object),un=Object.prototype.hasOwnProperty;function dn(e){if(!mt(e))return ln(e);var t=[];for(var n in Object(e))un.call(e,n)&&n!=`constructor`&&t.push(n);return t}function fn(e){return ut(e)?sn(e):dn(e)}function pn(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var mn=Object.prototype.hasOwnProperty;function hn(e){if(!O(e))return pn(e);var t=mt(e),n=[];for(var r in e)(r!=`constructor`||!t&&mn.call(e,r))&&n.push(r);return n}function gn(e){return ut(e)?sn(e,!0):hn(e)}var _n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vn=/^\w*$/;function yn(e,t){if(w(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||S(e)?!0:vn.test(e)||!_n.test(e)||t!=null&&e in Object(t)}var bn=je(Object,`create`);function xn(){this.__data__=bn?bn(null):{},this.size=0}function Sn(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var Cn=`__lodash_hash_undefined__`,wn=Object.prototype.hasOwnProperty;function Tn(e){var t=this.__data__;if(bn){var n=t[e];return n===Cn?void 0:n}return wn.call(t,e)?t[e]:void 0}var En=Object.prototype.hasOwnProperty;function Dn(e){var t=this.__data__;return bn?t[e]!==void 0:En.call(t,e)}var On=`__lodash_hash_undefined__`;function kn(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=bn&&t===void 0?On:t,this}function An(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}An.prototype.clear=xn,An.prototype.delete=Sn,An.prototype.get=Tn,An.prototype.has=Dn,An.prototype.set=kn;function jn(){this.__data__=[],this.size=0}function Mn(e,t){for(var n=e.length;n--;)if(tt(e[n][0],t))return n;return-1}var Nn=Array.prototype.splice;function Pn(e){var t=this.__data__,n=Mn(t,e);return n<0?!1:(n==t.length-1?t.pop():Nn.call(t,n,1),--this.size,!0)}function Fn(e){var t=this.__data__,n=Mn(t,e);return n<0?void 0:t[n][1]}function In(e){return Mn(this.__data__,e)>-1}function Ln(e,t){var n=this.__data__,r=Mn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Rn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Rn.prototype.clear=jn,Rn.prototype.delete=Pn,Rn.prototype.get=Fn,Rn.prototype.has=In,Rn.prototype.set=Ln;var zn=je(s,`Map`);function Bn(){this.size=0,this.__data__={hash:new An,map:new(zn||Rn),string:new An}}function Vn(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Hn(e,t){var n=e.__data__;return Vn(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Un(e){var t=Hn(this,e).delete(e);return this.size-=+!!t,t}function Wn(e){return Hn(this,e).get(e)}function Gn(e){return Hn(this,e).has(e)}function Kn(e,t){var n=Hn(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function qn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}qn.prototype.clear=Bn,qn.prototype.delete=Un,qn.prototype.get=Wn,qn.prototype.has=Gn,qn.prototype.set=Kn;var Jn=`Expected a function`;function Yn(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Jn);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Yn.Cache||qn),n}Yn.Cache=qn;var Xn=500;function Zn(e){var t=Yn(e,function(e){return n.size===Xn&&n.clear(),e}),n=t.cache;return t}var Qn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$n=/\\(\\)?/g,er=Zn(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(Qn,function(e,n,r,i){t.push(r?i.replace($n,`$1`):n||e)}),t});function tr(e){return e==null?``:ee(e)}function nr(e,t){return w(e)?e:yn(e,t)?[e]:er(tr(e))}var rr=1/0;function ir(e){if(typeof e==`string`||S(e))return e;var t=e+``;return t==`0`&&1/e==-rr?`-0`:t}function ar(e,t){t=nr(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[ir(t[n++])];return n&&n==r?e:void 0}function or(e,t,n){var r=e==null?void 0:ar(e,t);return r===void 0?n:r}function sr(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var cr=c?c.isConcatSpreadable:void 0;function lr(e){return w(e)||xt(e)||!!(cr&&e&&e[cr])}function ur(e,t,n,r,i){var a=-1,o=e.length;for(n||=lr,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?ur(s,t-1,n,r,i):sr(i,s):r||(i[i.length]=s)}return i}var dr=cn(Object.getPrototypeOf,Object),fr=`[object Object]`,pr=Function.prototype,mr=Object.prototype,hr=pr.toString,gr=mr.hasOwnProperty,_r=hr.call(Object);function vr(e){if(!b(e)||y(e)!=fr)return!1;var t=dr(e);if(t===null)return!0;var n=gr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&hr.call(n)==_r}function yr(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function br(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:yr(e,t,n)}var xr=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function Sr(e){return xr.test(e)}function Cr(e){return e.split(``)}var wr=`\\ud800-\\udfff`,Tr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Er=`\\ufe0e\\ufe0f`,Dr=`[`+wr+`]`,Or=`[`+Tr+`]`,kr=`\\ud83c[\\udffb-\\udfff]`,Ar=`(?:`+Or+`|`+kr+`)`,jr=`[^`+wr+`]`,Mr=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Nr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Pr=`\\u200d`,Fr=Ar+`?`,Ir=`[`+Er+`]?`,Lr=`(?:`+Pr+`(?:`+[jr,Mr,Nr].join(`|`)+`)`+Ir+Fr+`)*`,Rr=Ir+Fr+Lr,zr=`(?:`+[jr+Or+`?`,Or,Mr,Nr,Dr].join(`|`)+`)`,Br=RegExp(kr+`(?=`+kr+`)|`+zr+Rr,`g`);function Vr(e){return e.match(Br)||[]}function Hr(e){return Sr(e)?Vr(e):Cr(e)}function Ur(e){return function(t){t=tr(t);var n=Sr(t)?Hr(t):void 0,r=n?n[0]:t.charAt(0),i=n?br(n,1).join(``):t.slice(1);return r[e]()+i}}var Wr=Ur(`toUpperCase`);function Gr(e){return Wr(tr(e).toLowerCase())}function Kr(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function qr(e){return function(t){return e?.[t]}}var Jr=qr({À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,Ç:`C`,ç:`c`,Ð:`D`,ð:`d`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,è:`e`,é:`e`,ê:`e`,ë:`e`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,ì:`i`,í:`i`,î:`i`,ï:`i`,Ñ:`N`,ñ:`n`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,ù:`u`,ú:`u`,û:`u`,ü:`u`,Ý:`Y`,ý:`y`,ÿ:`y`,Æ:`Ae`,æ:`ae`,Þ:`Th`,þ:`th`,ß:`ss`,Ā:`A`,Ă:`A`,Ą:`A`,ā:`a`,ă:`a`,ą:`a`,Ć:`C`,Ĉ:`C`,Ċ:`C`,Č:`C`,ć:`c`,ĉ:`c`,ċ:`c`,č:`c`,Ď:`D`,Đ:`D`,ď:`d`,đ:`d`,Ē:`E`,Ĕ:`E`,Ė:`E`,Ę:`E`,Ě:`E`,ē:`e`,ĕ:`e`,ė:`e`,ę:`e`,ě:`e`,Ĝ:`G`,Ğ:`G`,Ġ:`G`,Ģ:`G`,ĝ:`g`,ğ:`g`,ġ:`g`,ģ:`g`,Ĥ:`H`,Ħ:`H`,ĥ:`h`,ħ:`h`,Ĩ:`I`,Ī:`I`,Ĭ:`I`,Į:`I`,İ:`I`,ĩ:`i`,ī:`i`,ĭ:`i`,į:`i`,ı:`i`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,ĸ:`k`,Ĺ:`L`,Ļ:`L`,Ľ:`L`,Ŀ:`L`,Ł:`L`,ĺ:`l`,ļ:`l`,ľ:`l`,ŀ:`l`,ł:`l`,Ń:`N`,Ņ:`N`,Ň:`N`,Ŋ:`N`,ń:`n`,ņ:`n`,ň:`n`,ŋ:`n`,Ō:`O`,Ŏ:`O`,Ő:`O`,ō:`o`,ŏ:`o`,ő:`o`,Ŕ:`R`,Ŗ:`R`,Ř:`R`,ŕ:`r`,ŗ:`r`,ř:`r`,Ś:`S`,Ŝ:`S`,Ş:`S`,Š:`S`,ś:`s`,ŝ:`s`,ş:`s`,š:`s`,Ţ:`T`,Ť:`T`,Ŧ:`T`,ţ:`t`,ť:`t`,ŧ:`t`,Ũ:`U`,Ū:`U`,Ŭ:`U`,Ů:`U`,Ű:`U`,Ų:`U`,ũ:`u`,ū:`u`,ŭ:`u`,ů:`u`,ű:`u`,ų:`u`,Ŵ:`W`,ŵ:`w`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Ź:`Z`,Ż:`Z`,Ž:`Z`,ź:`z`,ż:`z`,ž:`z`,IJ:`IJ`,ij:`ij`,Œ:`Oe`,œ:`oe`,ʼn:`'n`,ſ:`s`}),Yr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xr=RegExp(`[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]`,`g`);function Zr(e){return e=tr(e),e&&e.replace(Yr,Jr).replace(Xr,``)}var Qr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function $r(e){return e.match(Qr)||[]}var ei=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function ti(e){return ei.test(e)}var ni=`\\ud800-\\udfff`,ri=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,ii=`\\u2700-\\u27bf`,ai=`a-z\\xdf-\\xf6\\xf8-\\xff`,oi=`\\xac\\xb1\\xd7\\xf7`,si=`\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf`,ci=`\\u2000-\\u206f`,li=` \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000`,ui=`A-Z\\xc0-\\xd6\\xd8-\\xde`,di=`\\ufe0e\\ufe0f`,fi=oi+si+ci+li,pi=`['’]`,mi=`[`+fi+`]`,hi=`[`+ri+`]`,gi=`\\d+`,_i=`[`+ii+`]`,vi=`[`+ai+`]`,yi=`[^`+ni+fi+gi+ii+ai+ui+`]`,bi=`(?:`+hi+`|\\ud83c[\\udffb-\\udfff])`,xi=`[^`+ni+`]`,Si=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Ci=`[\\ud800-\\udbff][\\udc00-\\udfff]`,wi=`[`+ui+`]`,Ti=`\\u200d`,Ei=`(?:`+vi+`|`+yi+`)`,Di=`(?:`+wi+`|`+yi+`)`,Oi=`(?:`+pi+`(?:d|ll|m|re|s|t|ve))?`,ki=`(?:`+pi+`(?:D|LL|M|RE|S|T|VE))?`,Ai=bi+`?`,ji=`[`+di+`]?`,Mi=`(?:`+Ti+`(?:`+[xi,Si,Ci].join(`|`)+`)`+ji+Ai+`)*`,Ni=`\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])`,Pi=`\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])`,Fi=ji+Ai+Mi,Ii=`(?:`+[_i,Si,Ci].join(`|`)+`)`+Fi,Li=RegExp([wi+`?`+vi+`+`+Oi+`(?=`+[mi,wi,`$`].join(`|`)+`)`,Di+`+`+ki+`(?=`+[mi,wi+Ei,`$`].join(`|`)+`)`,wi+`?`+Ei+`+`+Oi,wi+`+`+ki,Pi,Ni,gi,Ii].join(`|`),`g`);function Ri(e){return e.match(Li)||[]}function zi(e,t,n){return e=tr(e),t=n?void 0:t,t===void 0?ti(e)?Ri(e):$r(e):e.match(t)||[]}var Bi=RegExp(`['’]`,`g`);function Vi(e){return function(t){return Kr(zi(Zr(t).replace(Bi,``)),e,``)}}var Hi=Vi(function(e,t,n){return t=t.toLowerCase(),e+(n?Gr(t):t)});function Ui(e,t,n){return e===e&&(n!==void 0&&(e=e<=n?e:n),t!==void 0&&(e=e>=t?e:t)),e}function Wi(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=ue(n),n=n===n?n:0),t!==void 0&&(t=ue(t),t=t===t?t:0),Ui(ue(e),t,n)}function Gi(){this.__data__=new Rn,this.size=0}function Ki(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function qi(e){return this.__data__.get(e)}function Ji(e){return this.__data__.has(e)}var Yi=200;function Xi(e,t){var n=this.__data__;if(n instanceof Rn){var r=n.__data__;if(!zn||r.length<Yi-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this}function Zi(e){var t=this.__data__=new Rn(e);this.size=t.size}Zi.prototype.clear=Gi,Zi.prototype.delete=Ki,Zi.prototype.get=qi,Zi.prototype.has=Ji,Zi.prototype.set=Xi;function Qi(e,t){return e&&it(t,fn(t),e)}function $i(e,t){return e&&it(t,gn(t),e)}var ea=typeof e==`object`&&e&&!e.nodeType&&e,ta=ea&&typeof module==`object`&&module&&!module.nodeType&&module,na=ta&&ta.exports===ea?s.Buffer:void 0,ra=na?na.allocUnsafe:void 0;function ia(e,t){if(t)return e.slice();var n=e.length,r=ra?ra(n):new e.constructor(n);return e.copy(r),r}function aa(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function oa(){return[]}var sa=Object.prototype.propertyIsEnumerable,ca=Object.getOwnPropertySymbols,la=ca?function(e){return e==null?[]:(e=Object(e),aa(ca(e),function(t){return sa.call(e,t)}))}:oa;function ua(e,t){return it(e,la(e),t)}var da=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)sr(t,la(e)),e=dr(e);return t}:oa;function fa(e,t){return it(e,da(e),t)}function pa(e,t,n){var r=t(e);return w(e)?r:sr(r,n(e))}function ma(e){return pa(e,fn,la)}function ha(e){return pa(e,gn,da)}var ga=je(s,`DataView`),_a=je(s,`Promise`),va=je(s,`Set`),ya=`[object Map]`,ba=`[object Object]`,xa=`[object Promise]`,Sa=`[object Set]`,Ca=`[object WeakMap]`,wa=`[object DataView]`,Ta=xe(ga),Ea=xe(zn),Da=xe(_a),Oa=xe(va),ka=xe(Me),Aa=y;(ga&&Aa(new ga(new ArrayBuffer(1)))!=wa||zn&&Aa(new zn)!=ya||_a&&Aa(_a.resolve())!=xa||va&&Aa(new va)!=Sa||Me&&Aa(new Me)!=Ca)&&(Aa=function(e){var t=y(e),n=t==ba?e.constructor:void 0,r=n?xe(n):``;if(r)switch(r){case Ta:return wa;case Ea:return ya;case Da:return xa;case Oa:return Sa;case ka:return Ca}return t});var ja=Aa,Ma=Object.prototype.hasOwnProperty;function Na(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Ma.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var Pa=s.Uint8Array;function Fa(e){var t=new e.constructor(e.byteLength);return new Pa(t).set(new Pa(e)),t}function Ia(e,t){var n=t?Fa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var La=/\w*$/;function Ra(e){var t=new e.constructor(e.source,La.exec(e));return t.lastIndex=e.lastIndex,t}var za=c?c.prototype:void 0,Ba=za?za.valueOf:void 0;function Va(e){return Ba?Object(Ba.call(e)):{}}function Ha(e,t){var n=t?Fa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Ua=`[object Boolean]`,Wa=`[object Date]`,Ga=`[object Map]`,Ka=`[object Number]`,qa=`[object RegExp]`,Ja=`[object Set]`,Ya=`[object String]`,Xa=`[object Symbol]`,Za=`[object ArrayBuffer]`,Qa=`[object DataView]`,$a=`[object Float32Array]`,eo=`[object Float64Array]`,to=`[object Int8Array]`,no=`[object Int16Array]`,ro=`[object Int32Array]`,io=`[object Uint8Array]`,ao=`[object Uint8ClampedArray]`,oo=`[object Uint16Array]`,so=`[object Uint32Array]`;function co(e,t,n){var r=e.constructor;switch(t){case Za:return Fa(e);case Ua:case Wa:return new r(+e);case Qa:return Ia(e,n);case $a:case eo:case to:case no:case ro:case io:case ao:case oo:case so:return Ha(e,n);case Ga:return new r;case Ka:case Ya:return new r(e);case qa:return Ra(e);case Ja:return new r;case Xa:return Va(e)}}function lo(e){return typeof e.constructor==`function`&&!mt(e)?Pe(dr(e)):{}}var uo=`[object Map]`;function fo(e){return b(e)&&ja(e)==uo}var po=nn&&nn.isMap,mo=po?Qt(po):fo,ho=`[object Set]`;function go(e){return b(e)&&ja(e)==ho}var _o=nn&&nn.isSet,vo=_o?Qt(_o):go,yo=1,bo=2,xo=4,So=`[object Arguments]`,Co=`[object Array]`,wo=`[object Boolean]`,To=`[object Date]`,Eo=`[object Error]`,Do=`[object Function]`,Oo=`[object GeneratorFunction]`,ko=`[object Map]`,Ao=`[object Number]`,jo=`[object Object]`,Mo=`[object RegExp]`,No=`[object Set]`,Po=`[object String]`,Fo=`[object Symbol]`,Io=`[object WeakMap]`,Lo=`[object ArrayBuffer]`,Ro=`[object DataView]`,zo=`[object Float32Array]`,Bo=`[object Float64Array]`,Vo=`[object Int8Array]`,Ho=`[object Int16Array]`,Uo=`[object Int32Array]`,Wo=`[object Uint8Array]`,Go=`[object Uint8ClampedArray]`,Ko=`[object Uint16Array]`,qo=`[object Uint32Array]`,A={};A[So]=A[Co]=A[Lo]=A[Ro]=A[wo]=A[To]=A[zo]=A[Bo]=A[Vo]=A[Ho]=A[Uo]=A[ko]=A[Ao]=A[jo]=A[Mo]=A[No]=A[Po]=A[Fo]=A[Wo]=A[Go]=A[Ko]=A[qo]=!0,A[Eo]=A[Do]=A[Io]=!1;function Jo(e,t,n,r,i,a){var o,s=t&yo,c=t&bo,l=t&xo;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!O(e))return e;var u=w(e);if(u){if(o=Na(e),!s)return Le(e,o)}else{var d=ja(e),f=d==Do||d==Oo;if(Et(e))return ia(e,s);if(d==jo||d==So||f&&!i){if(o=c||f?{}:lo(e),!s)return c?fa(e,$i(o,e)):ua(e,Qi(o,e))}else{if(!A[d])return i?e:{};o=co(e,d,s)}}a||=new Zi;var p=a.get(e);if(p)return p;a.set(e,o),vo(e)?e.forEach(function(r){o.add(Jo(r,t,n,r,e,a))}):mo(e)&&e.forEach(function(r,i){o.set(i,Jo(r,t,n,i,e,a))});var m=u?void 0:(l?c?ha:ma:c?gn:fn)(e);return Ge(m||e,function(r,i){m&&(i=r,r=e[i]),rt(o,i,Jo(r,t,n,i,e,a))}),o}var Yo=4;function Xo(e){return Jo(e,Yo)}var Zo=1,Qo=4;function j(e){return Jo(e,Zo|Qo)}var $o=`__lodash_hash_undefined__`;function es(e){return this.__data__.set(e,$o),this}function ts(e){return this.__data__.has(e)}function ns(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}ns.prototype.add=ns.prototype.push=es,ns.prototype.has=ts;function rs(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function is(e,t){return e.has(t)}var as=1,os=2;function ss(e,t,n,r,i,a){var o=n&as,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&os?new ns:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!rs(t,function(e,t){if(!is(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}function cs(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function ls(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var us=1,ds=2,fs=`[object Boolean]`,ps=`[object Date]`,ms=`[object Error]`,hs=`[object Map]`,gs=`[object Number]`,_s=`[object RegExp]`,vs=`[object Set]`,ys=`[object String]`,bs=`[object Symbol]`,xs=`[object ArrayBuffer]`,Ss=`[object DataView]`,Cs=c?c.prototype:void 0,ws=Cs?Cs.valueOf:void 0;function Ts(e,t,n,r,i,a,o){switch(n){case Ss:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case xs:return!(e.byteLength!=t.byteLength||!a(new Pa(e),new Pa(t)));case fs:case ps:case gs:return tt(+e,+t);case ms:return e.name==t.name&&e.message==t.message;case _s:case ys:return e==t+``;case hs:var s=cs;case vs:var c=r&us;if(s||=ls,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=ds,o.set(e,t);var u=ss(s(e),s(t),r,i,a,o);return o.delete(e),u;case bs:if(ws)return ws.call(e)==ws.call(t)}return!1}var Es=1,Ds=Object.prototype.hasOwnProperty;function Os(e,t,n,r,i,a){var o=n&Es,s=ma(e),c=s.length;if(c!=ma(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Ds.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var ks=1,As=`[object Arguments]`,js=`[object Array]`,Ms=`[object Object]`,Ns=Object.prototype.hasOwnProperty;function Ps(e,t,n,r,i,a){var o=w(e),s=w(t),c=o?js:ja(e),l=s?js:ja(t);c=c==As?Ms:c,l=l==As?Ms:l;var u=c==Ms,d=l==Ms,f=c==l;if(f&&Et(e)){if(!Et(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new Zi,o||an(e)?ss(e,t,n,r,i,a):Ts(e,t,c,n,r,i,a);if(!(n&ks)){var p=u&&Ns.call(e,`__wrapped__`),m=d&&Ns.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new Zi,i(h,g,n,r,a)}}return f?(a||=new Zi,Os(e,t,n,r,i,a)):!1}function Fs(e,t,n,r,i){return e===t?!0:e==null||t==null||!b(e)&&!b(t)?e!==e&&t!==t:Ps(e,t,n,r,Fs,i)}var Is=1,Ls=2;function Rs(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new Zi;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?Fs(u,l,Is|Ls,r,d):f))return!1}}return!0}function zs(e){return e===e&&!O(e)}function Bs(e){for(var t=fn(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,zs(i)]}return t}function Vs(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}function Hs(e){var t=Bs(e);return t.length==1&&t[0][2]?Vs(t[0][0],t[0][1]):function(n){return n===e||Rs(n,e,t)}}function Us(e,t){return e!=null&&t in Object(e)}function Ws(e,t,n){t=nr(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=ir(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&lt(i)&&$e(o,i)&&(w(e)||xt(e)))}function Gs(e,t){return e!=null&&Ws(e,t,Us)}var Ks=1,qs=2;function Js(e,t){return yn(e)&&zs(t)?Vs(ir(e),t):function(n){var r=or(n,e);return r===void 0&&r===t?Gs(n,e):Fs(t,r,Ks|qs)}}function Ys(e){return function(t){return t?.[e]}}function Xs(e){return function(t){return ar(t,e)}}function Zs(e){return yn(e)?Ys(ir(e)):Xs(e)}function Qs(e){return typeof e==`function`?e:e==null?de:typeof e==`object`?w(e)?Js(e[0],e[1]):Hs(e):Zs(e)}function $s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function ec(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var tc=ec();function nc(e,t){return e&&tc(e,t,fn)}function rc(e,t){return function(n,r){if(n==null)return n;if(!ut(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var ic=rc(nc);function ac(e,t,n,r){return ic(e,function(e,i,a){t(r,e,n(e),a)}),r}function oc(e,t){return function(n,r){var i=w(n)?$s:ac,a=t?t():{};return i(n,e,Qs(r,2),a)}}var sc=function(){return s.Date.now()},cc=`Expected a function`,lc=Math.max,uc=Math.min;function dc(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(cc);t=ue(t)||0,O(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?lc(ue(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?uc(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=sc();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(sc())}function x(){var e=sc(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}var fc=Object.prototype,pc=fc.hasOwnProperty,mc=st(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&dt(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=gn(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||tt(u,fc[l])&&!pc.call(e,l))&&(e[l]=a[l])}return e});function hc(e,t,n){(n!==void 0&&!tt(e[t],n)||n===void 0&&!(t in e))&&et(e,t,n)}function gc(e){return b(e)&&ut(e)}function _c(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function vc(e){return it(e,gn(e))}function yc(e,t,n,r,i,a,o){var s=_c(e,n),c=_c(t,n),l=o.get(c);if(l)hc(e,n,l);else{var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=w(c),p=!f&&Et(c),m=!f&&!p&&an(c);u=c,f||p||m?w(s)?u=s:gc(s)?u=Le(s):p?(d=!1,u=ia(c,!0)):m?(d=!1,u=Ha(c,!0)):u=[]:vr(c)||xt(c)?(u=s,xt(s)?u=vc(s):(!O(s)||ge(s))&&(u=lo(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),hc(e,n,u)}}function bc(e,t,n,r,i){e!==t&&tc(t,function(a,o){if(i||=new Zi,O(a))yc(e,t,o,n,bc,r,i);else{var s=r?r(_c(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),hc(e,o,s)}},gn)}function xc(e,t,n,r,i,a){return O(e)&&O(t)&&(a.set(t,e),bc(e,t,void 0,xc,a),a.delete(t)),e}var Sc=ft(function(e,t,n,r){bc(e,t,n,r)}),Cc=st(function(e){return e.push(void 0,xc),Fe(Sc,void 0,e)});function wc(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var Tc=200;function Ec(e,t,n,r){var i=-1,a=Xe,o=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=C(t,Qt(n))),r?(a=wc,o=!1):t.length>=Tc&&(a=is,o=!1,t=new ns(t));outer:for(;++i<s;){var u=e[i],d=n==null?u:n(u);if(u=r||u!==0?u:0,o&&d===d){for(var f=l;f--;)if(t[f]===d)continue outer;c.push(u)}else a(t,d,r)||c.push(u)}return c}var Dc=st(function(e,t){return gc(e)?Ec(e,ur(t,1,gc,!0)):[]});function Oc(e,t){var n=-1,r=ut(e)?Array(e.length):[];return ic(e,function(e,i,a){r[++n]=t(e,i,a)}),r}var kc=Object.prototype.hasOwnProperty,Ac=oc(function(e,t,n){kc.call(e,n)?e[n].push(t):et(e,n,[t])});function jc(e,t){return e>t}var Mc=Object.prototype.hasOwnProperty;function Nc(e,t){return e!=null&&Mc.call(e,t)}function Pc(e,t){return e!=null&&Ws(e,t,Nc)}var Fc=`[object Map]`,Ic=`[object Set]`,Lc=Object.prototype.hasOwnProperty;function Rc(e){if(e==null)return!0;if(ut(e)&&(w(e)||typeof e==`string`||typeof e.splice==`function`||Et(e)||an(e)||xt(e)))return!e.length;var t=ja(e);if(t==Fc||t==Ic)return!e.size;if(mt(e))return!dn(e).length;for(var n in e)if(Lc.call(e,n))return!1;return!0}function zc(e,t){return Fs(e,t)}var Bc=`[object Number]`;function Vc(e){return typeof e==`number`||b(e)&&y(e)==Bc}var Hc=Ur(`toLowerCase`);function Uc(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!S(o):n(o,s)))var s=o,c=a}return c}function Wc(e){return e&&e.length?Uc(e,de,jc):void 0}var Gc=ft(function(e,t,n){bc(e,t,n)});function Kc(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function qc(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=S(e),o=t!==void 0,s=t===null,c=t===t,l=S(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function Jc(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=qc(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Yc(e,t,n){t=t.length?C(t,function(e){return w(e)?function(t){return ar(t,e.length===1?e[0]:e)}:e}):[de];var r=-1;return t=C(t,Qt(Qs)),Kc(Oc(e,function(e,n,i){return{criteria:C(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Jc(e,t,n)})}var Xc=st(function(e,t){if(e==null)return[];var n=t.length;return n>1&&dt(e,t[0],t[1])?t=[]:n>2&&dt(t[0],t[1],t[2])&&(t=[t[0]]),Yc(e,ur(t,1),[])}),Zc=4294967294,Qc=Math.floor,$c=Math.min;function el(e,t,n,r){var i=0,a=e==null?0:e.length;if(a===0)return 0;t=n(t);for(var o=t!==t,s=t===null,c=S(t),l=t===void 0;i<a;){var u=Qc((i+a)/2),d=n(e[u]),f=d!==void 0,p=d===null,m=d===d,h=S(d);if(o)var g=r||m;else g=l?m&&(r||f):s?m&&f&&(r||!p):c?m&&f&&!p&&(r||!h):p||h?!1:r?d<=t:d<t;g?i=u+1:a=u}return $c(a,Zc)}var tl=2147483647;function nl(e,t,n){var r=0,i=e==null?r:e.length;if(typeof t==`number`&&t===t&&i<=tl){for(;r<i;){var a=r+i>>>1,o=e[a];o!==null&&!S(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return el(e,t,de,n)}function rl(e,t){return nl(e,t)}function il(e,t,n){return el(e,t,Qs(n,2))}var al=Vi(function(e,t,n){return e+(n?` `:``)+Wr(t)}),ol=`Expected a function`;function sl(e,t,n){var r=!0,i=!0;if(typeof e!=`function`)throw TypeError(ol);return O(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),dc(e,t,{leading:r,maxWait:t,trailing:i})}var cl=va&&1/ls(new va([,-0]))[1]==1/0?function(e){return new va(e)}:Ie,ll=200;function ul(e,t,n){var r=-1,i=Xe,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=wc;else if(a>=ll){var l=t?null:cl(e);if(l)return ls(l);o=!1,i=is,c=new ns}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var dl=st(function(e){return ul(ur(e,1,gc,!0))});function fl(e){return e&&e.length?ul(e):[]}function pl(e,t,n){if(n)switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2]);case 4:return e.call(t,n[0],n[1],n[2],n[3]);case 5:return e.call(t,n[0],n[1],n[2],n[3],n[4]);case 6:return e.call(t,n[0],n[1],n[2],n[3],n[4],n[5]);default:return e.apply(t,n)}return e.call(t)}function M(e,t,...n){return pl(e,t,n)}function ml(e){return typeof e==`object`&&e.then&&typeof e.then==`function`}function hl(e){return e!=null&&(e instanceof Promise||ml(e))}function gl(...e){let t=[];if(e.forEach(e=>{Array.isArray(e)?t.push(...e):t.push(e)}),t.some(e=>hl(e))){let e=t.map(e=>hl(e)?e:Promise.resolve(e!==!1));return Promise.all(e).then(e=>e.reduce((e,t)=>t!==!1&&e,!0))}return t.every(e=>e!==!1)}function _l(e,t){let n=[];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1],o=pl(i,a,Array.isArray(t)?t:[t]);n.push(o)}return gl(n)}var vl=class{constructor(){this.listeners={}}on(e,t,n){return t==null||(this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t,n)),this}once(e,t,n){let r=(...i)=>(this.off(e,r),_l([t,n],i));return this.on(e,r,this)}off(e,t,n){if(!(e||t||n))return this.listeners={},this;let r=this.listeners;return(e?[e]:Object.keys(r)).forEach(e=>{let i=r[e];if(i){if(!(t||n))delete r[e];else for(let e=i.length-2;e>=0;e-=2)t&&i[e]!==t||n&&i[e+1]!==n||i.splice(e,2)}}),this}trigger(e,...t){let n=!0;if(e!==`*`){let r=this.listeners[e];r!=null&&(n=_l([...r],t))}let r=this.listeners[`*`];return r==null?n:gl([n,_l([...r],[e,...t])])}emit(e,...t){return this.trigger(e,...t)}};function yl(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!==`constructor`&&Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})}var bl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])};function xl(e,t){bl(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Sl=class{},Cl=/^\s*class\s+/.test(`${Sl}`)||/^\s*class\s*\{/.test(`${class{}}`);function wl(e,t){let n;return Cl?n=class extends t{}:(n=function(){return t.apply(this,arguments)},xl(n,t)),Object.defineProperty(n,"name",{value:e}),n}function Tl(e){return e===`__proto__`}function El(e,t,n=`/`){let r,i=Array.isArray(t)?t:t.split(n);if(i.length)for(r=e;i.length;){let e=i.shift();if(Object(r)===r&&e&&e in r)r=r[e];else return}return r}function Dl(e,t,n,r=`/`){let i=Array.isArray(t)?t:t.split(r),a=i.pop();if(a&&!Tl(a)){let t=e;i.forEach(e=>{Tl(e)||(t[e]??(t[e]={}),t=t[e])}),t[a]=n}return e}function Ol(e,t,n=`/`){let r=Array.isArray(t)?t.slice():t.split(n),i=r.pop();if(i){if(r.length>0){let t=El(e,r);t&&delete t[i]}else delete e[i]}return e}var kl=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Al=class extends vl{dispose(){this.off()}};kl([r.dispose()],Al.prototype,`dispose`,null),(function(e){e.dispose=r.dispose})(Al||={}),yl(Al,r);var jl=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Ml=jl(e=>e.replace(/\B([A-Z])/g,`-$1`).toLowerCase()),Nl=jl(e=>al(Hi(e)).replace(/ /g,``));function Pl(e){let t=2166136261,n=!1,r=e;for(let e=0,i=r.length;e<i;e+=1){let i=r.charCodeAt(e);i>127&&!n&&(r=unescape(encodeURIComponent(r)),i=r.charCodeAt(e),n=!0),t^=i,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function Fl(){let e=``;for(let t=0;t<36;t+=1){let n=`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`[t],r=Math.random()*16|0,i=n===`x`?r:n===`y`?r&3|8:n;e+=i.toString(16)}return e}function Il(e,t,n){let r=Math.min(2,Math.floor(e.length*.34)),i=Math.floor(e.length*.4)+1,a,o=!1,s=e.toLowerCase();for(let c of t){let t=n(c);if(t!==void 0&&Math.abs(t.length-s.length)<=r){let n=t.toLowerCase();if(n===s){if(t===e)continue;return c}if(o||t.length<3)continue;let r=Ll(s,n,i-1);if(r===void 0)continue;r<3?(o=!0,a=c):(i=r,a=c)}}return a}function Ll(e,t,n){let r=Array(t.length+1),i=Array(t.length+1),a=n+1;for(let e=0;e<=t.length;e+=1)r[e]=e;for(let o=1;o<=e.length;o+=1){let s=e.charCodeAt(o-1),c=o>n?o-n:1,l=t.length>n+o?n+o:t.length;i[0]=o;let u=o;for(let e=1;e<c;e+=1)i[e]=a;for(let e=c;e<=l;e+=1){let n=s===t.charCodeAt(e-1)?r[e-1]:Math.min(r[e]+1,i[e-1]+1,r[e-1]+2);i[e]=n,u=Math.min(u,n)}for(let e=l+1;e<=t.length;e+=1)i[e]=a;if(u>n)return;let d=r;r=i,i=d}let o=r[t.length];return o>n?void 0:o}function Rl(e){return typeof e==`string`&&e.slice(-1)===`%`}function zl(e,t){if(e==null)return 0;let n;if(typeof e==`string`){if(n=parseFloat(e),Rl(e)&&(n/=100,Number.isFinite(n)))return n*t}else n=e;return Number.isFinite(n)?n>0&&n<1?n*t:n:0}function Bl(e){if(typeof e==`object`){let t=0,n=0,r=0,i=0;return e.vertical!=null&&Number.isFinite(e.vertical)&&(n=i=e.vertical),e.horizontal!=null&&Number.isFinite(e.horizontal)&&(r=t=e.horizontal),e.left!=null&&Number.isFinite(e.left)&&(t=e.left),e.top!=null&&Number.isFinite(e.top)&&(n=e.top),e.right!=null&&Number.isFinite(e.right)&&(r=e.right),e.bottom!=null&&Number.isFinite(e.bottom)&&(i=e.bottom),{top:n,right:r,bottom:i,left:t}}let t=0;return e!=null&&Number.isFinite(e)&&(t=e),{top:t,right:t,bottom:t,left:t}}var Vl=!1,Hl=!1,Ul=!1,Wl=!1,Gl=!1,Kl=!1,ql=!1,Jl=!1,Yl=!1,Xl=!1,Zl=!1,Ql=!1,$l=!1,eu=!1,tu=!1,nu=!1;if(typeof navigator==`object`){let e=navigator.userAgent;Vl=e.indexOf(`Macintosh`)>=0,Hl=!!e.match(/(iPad|iPhone|iPod)/g),Ul=e.indexOf(`Windows`)>=0,Wl=e.indexOf(`MSIE`)>=0,Gl=!!e.match(/Trident\/7\./),Kl=!!e.match(/Edge\//),ql=e.indexOf(`Mozilla/`)>=0&&e.indexOf(`MSIE`)<0&&e.indexOf(`Edge/`)<0,Yl=e.indexOf(`Chrome/`)>=0&&e.indexOf(`Edge/`)<0,Xl=e.indexOf(`Opera/`)>=0||e.indexOf(`OPR/`)>=0,Zl=e.indexOf(`Firefox/`)>=0,Ql=e.indexOf(`AppleWebKit/`)>=0&&e.indexOf(`Chrome/`)<0&&e.indexOf(`Edge/`)<0,typeof document==`object`&&(nu=!document.createElementNS||`${document.createElementNS(`http://www.w3.org/2000/svg`,`foreignObject`)}`!=`[object SVGForeignObjectElement]`||e.indexOf(`Opera/`)>=0)}if(typeof window==`object`&&(Jl=window.chrome!=null&&window.chrome.app!=null&&window.chrome.app.runtime!=null,eu=window.PointerEvent!=null&&!Vl),typeof document==`object`){$l=`ontouchstart`in document.documentElement;try{let e=Object.defineProperty({},"passive",{get(){tu=!0}}),t=document.createElement(`div`);t.addEventListener&&t.addEventListener(`click`,()=>{},e)}catch{}}var ru;(function(e){e.IS_MAC=Vl,e.IS_IOS=Hl,e.IS_WINDOWS=Ul,e.IS_IE=Wl,e.IS_IE11=Gl,e.IS_EDGE=Kl,e.IS_NETSCAPE=ql,e.IS_CHROME_APP=Jl,e.IS_CHROME=Yl,e.IS_OPERA=Xl,e.IS_FIREFOX=Zl,e.IS_SAFARI=Ql,e.SUPPORT_TOUCH=$l,e.SUPPORT_POINTER=eu,e.SUPPORT_PASSIVE=tu,e.NO_FOREIGNOBJECT=nu,e.SUPPORT_FOREIGNOBJECT=!e.NO_FOREIGNOBJECT})(ru||={}),(function(e){function t(){let e=window.module;return e!=null&&e.hot!=null&&e.hot.status!=null?e.hot.status():`unkonwn`}e.getHMRStatus=t;function n(){return t()===`apply`}e.isApplyingHMR=n;let r={select:`input`,change:`input`,submit:`form`,reset:`form`,error:`img`,load:`img`,abort:`img`};function i(e){let t=document.createElement(r[e]||`div`),n=`on${e}`,i=n in t;return i||=(t.setAttribute(n,`return;`),typeof t[n]==`function`),i}e.isEventSupported=i})(ru||={});var iu=/[\t\r\n\f]/g,au=/\S+/g,ou=e=>` ${e} `;function su(e){return e&&e.getAttribute&&e.getAttribute(`class`)||``}function cu(e,t){if(e==null||t==null)return!1;let n=ou(su(e)),r=ou(t);return e.nodeType===1&&n.replace(iu,` `).includes(r)}function N(e,t){if(e!=null&&t!=null){if(typeof t==`function`)return N(e,t(su(e)));if(typeof t==`string`&&e.nodeType===1){let n=t.match(au)||[],r=ou(su(e)).replace(iu,` `),i=n.reduce((e,t)=>e.indexOf(ou(t))<0?`${e}${t} `:e,r);i=i.trim(),r!==i&&e.setAttribute(`class`,i)}}}function lu(e,t){if(e!=null){if(typeof t==`function`)return lu(e,t(su(e)));if((!t||typeof t==`string`)&&e.nodeType===1){let n=(t||``).match(au)||[],r=ou(su(e)).replace(iu,` `),i=n.reduce((e,t)=>{let n=ou(t);return e.indexOf(n)>-1?e.replace(n,` `):e},r);i=t?i.trim():``,r!==i&&e.setAttribute(`class`,i)}}}function uu(e,t,n){if(e!=null&&t!=null){if(n!=null&&typeof t==`string`)n?N(e,t):lu(e,t);else{if(typeof t==`function`)return uu(e,t(su(e),n),n);typeof t==`string`&&(t.match(au)||[]).forEach(t=>{cu(e,t)?lu(e,t):N(e,t)})}}}var du=0;function fu(){return du+=1,`v${du}`}function pu(e){return(e.id==null||e.id===``)&&(e.id=fu()),e.id}function mu(e){return e!=null&&typeof e.getScreenCTM==`function`&&e instanceof SVGElement}var hu={svg:`http://www.w3.org/2000/svg`,xmlns:`http://www.w3.org/2000/xmlns/`,xml:`http://www.w3.org/XML/1998/namespace`,xlink:`http://www.w3.org/1999/xlink`,xhtml:`http://www.w3.org/1999/xhtml`};function gu(e,t=document){return t.createElement(e)}function _u(e,t=hu.xhtml,n=document){return n.createElementNS(t,e)}function vu(e,t=document){return _u(e,hu.svg,t)}function yu(e){if(e){let{documentElement:t}=bu(`<svg xmlns="${hu.svg}" xmlns:xlink="${hu.xlink}" version="1.1">${e}</svg>`,{async:!1});return t}let t=document.createElementNS(hu.svg,`svg`);return t.setAttributeNS(hu.xmlns,`xmlns:xlink`,hu.xlink),t.setAttribute(`version`,`1.1`),t}function bu(e,t={}){let n;try{let r=new DOMParser;if(t.async!=null){let e=r;e.async=t.async}n=r.parseFromString(e,t.mimeType||`text/xml`)}catch{n=void 0}if(!n||n.getElementsByTagName(`parsererror`).length)throw Error(`Invalid XML: ${e}`);return n}function xu(e,t=!0){let n=e.nodeName;return t?n.toLowerCase():n.toUpperCase()}function Su(e){let t=0,n=e.previousSibling;for(;n;)n.nodeType===1&&(t+=1),n=n.previousSibling;return t}function Cu(e,t){return e.querySelectorAll(t)}function wu(e,t){return e.querySelector(t)}function Tu(e,t,n){let r=e.ownerSVGElement,i=e.parentNode;for(;i&&i!==n&&i!==r;){if(cu(i,t))return i;i=i.parentNode}return null}function Eu(e,t){let n=t&&t.parentNode;return e===n||!!(n&&n.nodeType===1&&e.compareDocumentPosition(n)&16)}function Du(e){e&&(Array.isArray(e)?e:[e]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}function Ou(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function ku(e,t){(Array.isArray(t)?t:[t]).forEach(t=>{t!=null&&e.appendChild(t)})}function Au(e,t){let n=e.firstChild;return n?ju(n,t):ku(e,t)}function ju(e,t){let n=e.parentNode;n&&(Array.isArray(t)?t:[t]).forEach(t=>{t!=null&&n.insertBefore(t,e)})}function Mu(e,t){t?.appendChild(e)}function Nu(e){return!!e&&e.nodeType===1}function Pu(e){try{return e instanceof HTMLElement}catch{return typeof e==`object`&&e.nodeType===1&&typeof e.style==`object`&&typeof e.ownerDocument==`object`}}function Fu(e,t){let n=[],r=e.firstChild;for(;r;r=r.nextSibling)r.nodeType===1&&(!t||cu(r,t))&&n.push(r);return n}var Iu=[`viewBox`,`attributeName`,`attributeType`,`repeatCount`,`textLength`,`lengthAdjust`,`gradientUnits`];function Lu(e,t){return e.getAttribute(t)}function Ru(e,t){let n=Vu(t);n.ns?e.hasAttributeNS(n.ns,n.local)&&e.removeAttributeNS(n.ns,n.local):e.hasAttribute(t)&&e.removeAttribute(t)}function zu(e,t,n){if(n==null)return Ru(e,t);let r=Vu(t);r.ns&&typeof n==`string`?e.setAttributeNS(r.ns,t,n):t===`id`?e.id=`${n}`:e.setAttribute(t,`${n}`)}function Bu(e,t){Object.keys(t).forEach(n=>{zu(e,n,t[n])})}function P(e,t,n){if(t==null){let t=e.attributes,n={};for(let e=0;e<t.length;e+=1)n[t[e].name]=t[e].value;return n}if(typeof t==`string`&&n===void 0)return e.getAttribute(t);typeof t==`object`?Bu(e,t):zu(e,t,n)}function Vu(e){if(e.indexOf(`:`)!==-1){let t=e.split(`:`);return{ns:hu[t[0]],local:t[1]}}return{ns:null,local:e}}function Hu(e){let t={};return Object.keys(e).forEach(n=>{let r=Iu.includes(n)?n:Ml(n);t[r]=e[n]}),t}function Uu(e){let t={};return e.split(`;`).forEach(e=>{let n=e.trim();if(n){let e=n.split(`=`);e.length&&(t[e[0].trim()]=e[1]?e[1].trim():``)}}),t}function Wu(e,t){return Object.keys(t).forEach(n=>{if(n===`class`)e[n]=e[n]?`${e[n]} ${t[n]}`:t[n];else if(n===`style`){let r=typeof e[n]==`object`,i=typeof t[n]==`object`,a,o;r&&i?(a=e[n],o=t[n]):r?(a=e[n],o=Uu(t[n])):i?(a=Uu(e[n]),o=t[n]):(a=Uu(e[n]),o=Uu(t[n])),e[n]=Wu(a,o)}else e[n]=t[n]}),e}function Gu(e,t,n={}){let r=n.offset||0,i=[],a=[],o,s,c=null;for(let l=0;l<e.length;l+=1){o=a[l]=e[l];for(let i=0,s=t.length;i<s;i+=1){let s=t[i],c=s.start+r,u=s.end+r;l>=c&&l<u&&(typeof o==`string`?o=a[l]={t:e[l],attrs:s.attrs}:o.attrs=Wu(Wu({},o.attrs),s.attrs),n.includeAnnotationIndices&&(o.annotations??(o.annotations=[]),o.annotations.push(i)))}s=a[l-1],s?O(o)&&O(s)?(c=c,JSON.stringify(o.attrs)===JSON.stringify(s.attrs)?c.t+=o.t:(i.push(c),c=o)):O(o)||O(s)?(c=c,i.push(c),c=o):c=(c||``)+o:c=o}return c!=null&&i.push(c),i}function Ku(e){return e.replace(/ /g,`\xA0`)}var qu;(function(e){function t(e){return e.substr(0,5)===`data:`}e.isDataUrl=t;function n(e,n){if(!e||t(e)){setTimeout(()=>n(null,e));return}let r=()=>{n(Error(`Failed to load image: ${e}`))},i=window.FileReader?e=>{if(e.status===200){let t=new FileReader;t.onload=e=>{let t=e.target.result;n(null,t)},t.onerror=r,t.readAsDataURL(e.response)}else r()}:t=>{let i=e=>{let t=32768,n=[];for(let r=0;r<e.length;r+=t)n.push(String.fromCharCode.apply(null,e.subarray(r,r+t)));return n.join(``)};if(t.status===200){let r=e.split(`.`).pop()||`png`;r===`svg`&&(r=`svg+xml`);let a=`data:image/${r};base64,`,o=new Uint8Array(t.response);n(null,a+btoa(i(o)))}else r()},a=new XMLHttpRequest;a.responseType=window.FileReader?`blob`:`arraybuffer`,a.open(`GET`,e,!0),a.addEventListener(`error`,r),a.addEventListener(`load`,()=>i(a)),a.send()}e.imageToDataUri=n;function r(e){let t=e.replace(/\s/g,``);t=decodeURIComponent(t);let n=t.indexOf(`,`),r=t.slice(0,n),i=r.split(`:`)[1].split(`;`)[0],a=t.slice(n+1),o;o=r.indexOf(`base64`)>=0?atob(a):unescape(encodeURIComponent(a));let s=new Uint8Array(o.length);for(let e=0;e<o.length;e+=1)s[e]=o.charCodeAt(e);return new Blob([s],{type:i})}e.dataUriToBlob=r;function i(e,t){let n=window.navigator.msSaveBlob;if(n)n(e,t);else{let n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}}e.downloadBlob=i;function a(e,t){i(r(e),t)}e.downloadDataUri=a;function o(e){let t=e.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return t&&t[2]?t[2].replace(/\s+/,` `).split(` `):null}function s(e){let t=parseFloat(e);return Number.isNaN(t)?null:t}function c(e,t={}){let n=null,r=t=>(n??=o(e),n==null?null:s(n[t])),i=t=>{let n=e.match(t);return n&&n[2]?s(n[2]):null},a=t.width;if(a??=i(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i),a??=r(2),a==null)throw Error(`Can not parse width from svg string`);let c=t.height;if(c??=i(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i),c??=r(3),c==null)throw Error(`Can not parse height from svg string`);return`data:image/svg+xml,${encodeURIComponent(e).replace(/'/g,`%27`).replace(/"/g,`%22`)}`}e.svgToDataUrl=c})(qu||={});var Ju,Yu={px(e){return e},mm(e){return Ju*e},cm(e){return Ju*e*10},in(e){return Ju*e*25.4},pt(e){return Ju*(25.4*e/72)},pc(e){return Ju*(25.4*e/6)}},Xu;(function(e){function t(e,t,n){let r=document.createElement(`div`),i=r.style;i.display=`inline-block`,i.position=`absolute`,i.left=`-15000px`,i.top=`-15000px`,i.width=e+(n||`px`),i.height=t+(n||`px`),document.body.appendChild(r);let a=r.getBoundingClientRect(),o={width:a.width||0,height:a.height||0};return document.body.removeChild(r),o}e.measure=t;function n(e,n){Ju??=t(`1`,`1`,`mm`).width;let r=n?Yu[n]:null;return r?r(e):e}e.toPx=n})(Xu||={});var Zu=/-(.)/g;function Qu(e){return e.replace(Zu,(e,t)=>t.toUpperCase())}var $u={},ed=[`webkit`,`ms`,`moz`,`o`],td=typeof document<`u`?document.createElement(`div`).style:{};function nd(e){for(let t=0;t<ed.length;t+=1){let n=ed[t]+e;if(n in td)return n}return null}function rd(e){let t=Qu(e);if($u[t]==null){let e=t.charAt(0).toUpperCase()+t.slice(1);$u[t]=t in td?t:nd(e)}return $u[t]}function id(e,t){let n=e.ownerDocument&&e.ownerDocument.defaultView&&e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):window.getComputedStyle(e,null);return n&&t?n.getPropertyValue(t)||n[t]:n}(function(){if(typeof document>`u`)return function(){};let e=document;return e.selection?function(){e.selection.empty()}:window.getSelection?function(){let e=window.getSelection();e&&(e.empty?e.empty():e.removeAllRanges&&e.removeAllRanges())}:function(){}})();var ad={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function od(e){return/^--/.test(e)}function sd(e,t,n){let r=window.getComputedStyle(e,null);return n?r.getPropertyValue(t)||void 0:r[t]||e.style[t]}function cd(e,t){return parseInt(sd(e,t),10)||0}function ld(e,t){return!ad[e]&&typeof t==`number`?`${t}px`:t}function ud(e,t,n){if(typeof t==`string`){let r=od(t);if(r||(t=rd(t)),n===void 0)return sd(e,t,r);r||(n=ld(t,n));let i=e.style;r?i.setProperty(t,n):i[t]=n}else for(let n in t)ud(e,n,t[n])}var dd=new WeakMap;function fd(e,t){let n=Hi(t),r=dd.get(e);if(r)return r[n]}function pd(e,t,n){let r=Hi(t),i=dd.get(e);i?i[r]=n:dd.set(e,{[r]:n})}function md(e,t,n){if(!t){let t={};return Object.keys(dd).forEach(n=>{t[n]=fd(e,n)}),t}if(typeof t==`string`){if(n===void 0)return fd(e,t);pd(e,t,n)}else for(let n in t)md(e,n,t[n])}var F=class e{get[Symbol.toStringTag](){return e.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(e){this.node.id=e}constructor(t,n,r){if(!t)throw TypeError(`Invalid element to create vector`);let i;if(e.isVector(t))i=t.node;else if(typeof t==`string`){if(t.toLowerCase()===`svg`)i=yu();else if(t[0]===`<`){let e=yu(t);i=document.importNode(e.firstChild,!0)}else i=document.createElementNS(hu.svg,t)}else i=t;this.node=i,n&&this.setAttributes(n),r&&this.append(r)}transform(e,t){return e==null?Qd(this.node):(Qd(this.node,e,t),this)}translate(e,t=0,n={}){return e==null?$d(this.node):($d(this.node,e,t,n),this)}rotate(e,t,n,r={}){return e==null?ef(this.node):(ef(this.node,e,t,n,r),this)}scale(e,t){return e==null?tf(this.node):(tf(this.node,e,t),this)}getTransformToElement(t){let n=e.toNode(t);return nf(this.node,n)}removeAttribute(e){return Ru(this.node,e),this}getAttribute(e){return Lu(this.node,e)}setAttribute(e,t){return zu(this.node,e,t),this}setAttributes(e){return Bu(this.node,e),this}attr(e,t){return e==null?P(this.node):typeof e==`string`&&t===void 0?P(this.node,e):(typeof e==`object`?P(this.node,e):P(this.node,e,t),this)}svg(){return this.node instanceof SVGSVGElement?this:e.create(this.node.ownerSVGElement)}defs(){let t=this.svg()||this,n=t.node.getElementsByTagName(`defs`)[0];return n?e.create(n):e.create(`defs`).appendTo(t)}text(e,t={}){return bd(this.node,e,t),this}tagName(){return xu(this.node)}clone(){return e.create(this.node.cloneNode(!0))}remove(){return Du(this.node),this}empty(){return Ou(this.node),this}append(t){return ku(this.node,e.toNodes(t)),this}appendTo(t){return Mu(this.node,e.isVector(t)?t.node:t),this}prepend(t){return Au(this.node,e.toNodes(t)),this}before(t){return ju(this.node,e.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(e.toNode(t),this.node),e.create(t)}first(){return this.node.firstChild?e.create(this.node.firstChild):null}last(){return this.node.lastChild?e.create(this.node.lastChild):null}get(t){let n=this.node.childNodes[t];return n?e.create(n):null}indexOf(t){return Array.prototype.slice.call(this.node.childNodes).indexOf(e.toNode(t))}find(t){let n=[],r=Cu(this.node,t);if(r)for(let t=0,i=r.length;t<i;t+=1)n.push(e.create(r[t]));return n}findOne(t){let n=wu(this.node,t);return n?e.create(n):null}findParentByClass(t,n){let r=Tu(this.node,t,n);return r?e.create(r):null}matches(e){let t=this.node;this.node.matches;let n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector||null;return n&&n.call(t,e)}contains(t){return Eu(this.node,e.isVector(t)?t.node:t)}wrap(t){let n=e.create(t);return this.node.parentNode?.insertBefore(n.node,this.node),n.append(this)}parent(t){let n=this;if(n.node.parentNode==null)return null;if(n=e.create(n.node.parentNode),t==null)return n;do if(typeof t==`string`?n.matches(t):n instanceof t)return n;while(n=e.create(n.node.parentNode));return n}children(){let t=this.node.childNodes,n=[];for(let r=0;r<t.length;r+=1)t[r].nodeType===1&&n.push(e.create(t[r]));return n}eachChild(e,t){let n=this.children();for(let r=0,i=n.length;r<i;r+=1)e.call(n[r],n[r],r,n),t&&n[r].eachChild(e,t);return this}index(){return Su(this.node)}hasClass(e){return cu(this.node,e)}addClass(e){return N(this.node,e),this}removeClass(e){return lu(this.node,e),this}toggleClass(e,t){return uu(this.node,e,t),this}toLocalPoint(e,t){return af(this.node,e,t)}sample(e=1){return this.node instanceof SVGPathElement?Ed(this.node,e):[]}toPath(){return e.create(Id(this.node))}toPathData(){return Ld(this.node)}};(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return(n==null||n===e.toStringTag)&&r.node instanceof SVGElement&&typeof r.sample==`function`&&typeof r.toPath==`function`}e.isVector=t;function n(t,n,r){return new e(t,n,r)}e.create=n;function r(e){if(e[0]===`<`){let t=yu(e),r=[];for(let e=0,i=t.childNodes.length;e<i;e+=1){let i=t.childNodes[e];r.push(n(document.importNode(i,!0)))}return r}return[n(e)]}e.createVectors=r;function i(e){return t(e)?e.node:e}e.toNode=i;function a(e){return Array.isArray(e)?e.map(e=>i(e)):[i(e)]}e.toNodes=a})(F||={});function hd(e,t){let n=F.create(t),r=F.create(`textPath`),i=e.d;if(i&&e[`xlink:href`]===void 0){let e=F.create(`path`).attr(`d`,i).appendTo(n.defs());r.attr(`xlink:href`,`#${e.id}`)}return typeof e==`object`&&r.attr(e),r.node}function gd(e,t,n){let r=n.eol,i=n.baseSize,a=n.lineHeight,o=0,s,c={},l=t.length-1;for(let a=0;a<=l;a+=1){let c=t[a],u=null;if(typeof c==`object`){let e=c.attrs,t=F.create(`tspan`,e);s=t.node;let d=c.t;r&&a===l&&(d+=r),s.textContent=d;let f=e.class;f&&t.addClass(f),n.includeAnnotationIndices&&t.attr(`annotations`,c.annotations.join(`,`)),u=parseFloat(e[`font-size`]),u===void 0&&(u=i),u&&u>o&&(o=u)}else r&&a===l&&(c+=r),s=document.createTextNode(c||` `),i&&i>o&&(o=i);e.appendChild(s)}return o&&(c.maxFontSize=o),a?c.lineHeight=a:o&&(c.lineHeight=o*1.2),c}var _d=/em$/;function vd(e,t){let n=parseFloat(e);return _d.test(e)?n*t:n}function yd(e,t,n,r){if(!Array.isArray(t))return 0;let i=t.length;if(!i)return 0;let a=t[0],o=vd(a.maxFontSize,n)||n,s=0,c=vd(r,n);for(let e=1;e<i;e+=1){a=t[e];let r=vd(a.lineHeight,n)||c;s+=r}let l=vd(a.maxFontSize,n)||n,u;switch(e){case`middle`:u=o/2-.15*l-s/2;break;case`bottom`:u=-(.25*l)-s;break;default:u=.8*o}return u}function bd(e,t,n={}){t=Ku(t);let r=n.eol,i=n.textPath,a=n.textVerticalAnchor,o=a===`middle`||a===`bottom`||a===`top`,s=n.x;s===void 0&&(s=e.getAttribute(`x`)||0);let c=n.includeAnnotationIndices,l=n.annotations;l&&!Array.isArray(l)&&(l=[l]);let u=n.lineHeight,d=u===`auto`,f=d?`1.5em`:u||`1em`,p=!0,m=e.childNodes;if(m.length===1){let e=m[0];e&&e.tagName.toUpperCase()===`TITLE`&&(p=!1)}p&&Ou(e),P(e,{"xml:space":`preserve`,display:t||n.displayEmpty?null:`none`});let h=P(e,`font-size`),g=parseFloat(h);g||(g=16,(o||l)&&!h&&P(e,`font-size`,`${g}`));let _;i?(typeof i==`string`&&(i={d:i}),_=hd(i,e)):_=document.createDocumentFragment();let v,y=0,b,x=t.split(`
2
+ `),S=[],C=x.length-1;for(let e=0;e<=C;e+=1){v=f;let t=`v-line`,n=vu(`tspan`),a,o=x[e];if(o){if(l){a=gd(n,Gu(o,l,{offset:-y,includeAnnotationIndices:c}),{eol:e!==C&&r,baseSize:g,lineHeight:d?null:f,includeAnnotationIndices:c});let t=a.lineHeight;t&&d&&e!==0&&(v=t),e===0&&(b=a.maxFontSize*.8)}else r&&e!==C&&(o+=r),n.textContent=o}else{n.textContent=`-`,t+=` v-empty-line`;let e=n.style;e.fillOpacity=0,e.strokeOpacity=0,l&&(a={})}a&&S.push(a),e>0&&n.setAttribute(`dy`,v),(e>0||i)&&n.setAttribute(`x`,s),n.className.baseVal=t,_.appendChild(n),y+=o.length+1}if(o){if(l)v=yd(a,S,g,f);else if(a===`top`)v=`0.8em`;else{let e;switch(C>0?(e=parseFloat(f)||1,e*=C,_d.test(f)||(e/=g)):e=0,a){case`middle`:v=`${.3-e/2}em`;break;case`bottom`:v=`${-e-.3}em`}}}else a===0?v=`0em`:a?v=a:(v=0,e.getAttribute(`y`)??e.setAttribute(`y`,`${b||`0.8em`}`));_.firstChild.setAttribute(`dy`,v),e.appendChild(_)}function xd(e,t={}){let n=document.createElement(`canvas`).getContext(`2d`);if(!e)return{width:0};let r=[],i=t[`font-size`]?`${parseFloat(t[`font-size`])}px`:`14px`;return r.push(t[`font-style`]||`normal`),r.push(t[`font-variant`]||`normal`),r.push(t[`font-weight`]||400),r.push(i),r.push(t[`font-family`]||`sans-serif`),n.font=r.join(` `),n.measureText(e)}function Sd(e,t,n,r={}){if(t>=n)return[e,``];let i=e.length,a={},o=Math.round(t/n*i-1);for(o<0&&(o=0);o>=0&&o<i;){let n=e.slice(0,o),i=a[n]||xd(n,r).width,s=e.slice(0,o+1),c=a[s]||xd(s,r).width;if(a[n]=i,a[s]=c,i>t)--o;else if(c<=t)o+=1;else break}return[e.slice(0,o),e.slice(o)]}function Cd(e,t,n={},r={}){let i=t.width,a=t.height,o=r.eol||`
3
+ `,s=n.fontSize||14,c=n.lineHeight?parseFloat(n.lineHeight):Math.ceil(s*1.4),l=Math.floor(a/c);if(e.indexOf(o)>-1){let i=Fl(),a=[];return e.split(o).map(e=>{let o=Cd(e,Object.assign(Object.assign({},t),{height:2**53-1}),n,Object.assign(Object.assign({},r),{eol:i}));o&&a.push(...o.split(i))}),a.slice(0,l).join(o)}let{width:u}=xd(e,n);if(u<i)return e;let d=[],f=e,p=u,m=r.ellipsis,h=0;m&&(typeof m!=`string`&&(m=`…`),h=xd(m,n).width);for(let e=0;e<l;e+=1)if(p>i){if(e===l-1){let[e]=Sd(f,i-h,p,n);d.push(m?`${e}${m}`:e)}else{let[e,t]=Sd(f,i,p,n);d.push(e),f=t,p=xd(f,n).width}}else{d.push(f);break}return d.join(o)}var wd=.551784;function Td(e,t,n=NaN){let r=e.getAttribute(t);if(r==null)return n;let i=parseFloat(r);return Number.isNaN(i)?n:i}function Ed(e,t=1){let n=e.getTotalLength(),r=[],i=0,a;for(;i<n;)a=e.getPointAtLength(i),r.push({distance:i,x:a.x,y:a.y}),i+=t;return r}function Dd(e){return[`M`,Td(e,`x1`),Td(e,`y1`),`L`,Td(e,`x2`),Td(e,`y2`)].join(` `)}function Od(e){let t=jd(e);return t.length===0?null:`${Ad(t)} Z`}function kd(e){let t=jd(e);return t.length===0?null:Ad(t)}function Ad(e){return`M ${e.map(e=>`${e.x} ${e.y}`).join(` L`)}`}function jd(e){let t=[],n=e.points;if(n)for(let e=0,r=n.numberOfItems;e<r;e+=1)t.push(n.getItem(e));return t}function Md(e){let t=Td(e,`cx`,0),n=Td(e,`cy`,0),r=Td(e,`r`),i=r*wd;return[`M`,t,n-r,`C`,t+i,n-r,t+r,n-i,t+r,n,`C`,t+r,n+i,t+i,n+r,t,n+r,`C`,t-i,n+r,t-r,n+i,t-r,n,`C`,t-r,n-i,t-i,n-r,t,n-r,`Z`].join(` `)}function Nd(e){let t=Td(e,`cx`,0),n=Td(e,`cy`,0),r=Td(e,`rx`),i=Td(e,`ry`)||r,a=r*wd,o=i*wd;return[`M`,t,n-i,`C`,t+a,n-i,t+r,n-o,t+r,n,`C`,t+r,n+o,t+a,n+i,t,n+i,`C`,t-a,n+i,t-r,n+o,t-r,n,`C`,t-r,n-o,t-a,n-i,t,n-i,`Z`].join(` `)}function Pd(e){return Fd({x:Td(e,`x`,0),y:Td(e,`y`,0),width:Td(e,`width`,0),height:Td(e,`height`,0),rx:Td(e,`rx`,0),ry:Td(e,`ry`,0)})}function Fd(e){let t,n=e.x,r=e.y,i=e.width,a=e.height,o=Math.min(e.rx||e[`top-rx`]||0,i/2),s=Math.min(e.rx||e[`bottom-rx`]||0,i/2),c=Math.min(e.ry||e[`top-ry`]||0,a/2),l=Math.min(e.ry||e[`bottom-ry`]||0,a/2);return t=o||s||c||l?[`M`,n,r+c,`v`,a-c-l,`a`,s,l,0,0,0,s,l,`h`,i-2*s,`a`,s,l,0,0,0,s,-l,`v`,-(a-l-c),`a`,o,c,0,0,0,-o,-c,`h`,-(i-2*o),`a`,o,c,0,0,0,-o,c,`Z`]:[`M`,n,r,`H`,n+i,`V`,r+a,`H`,n,`V`,r,`Z`],t.join(` `)}function Id(e){let t=vu(`path`);P(t,P(e));let n=Ld(e);return n&&t.setAttribute(`d`,n),t}function Ld(e){let t=e.tagName.toLowerCase();switch(t){case`path`:return e.getAttribute(`d`);case`line`:return Dd(e);case`polygon`:return Od(e);case`polyline`:return kd(e);case`ellipse`:return Nd(e);case`circle`:return Md(e);case`rect`:return Pd(e)}throw Error(`"${t}" cannot be converted to svg path element.`)}var Rd=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,zd=/[ ,]+/,Bd=/^(\w+)\((.*)\)/;function Vd(e,t){let n=vu(`svg`).createSVGPoint();return n.x=e,n.y=t,n}function Hd(e){let t=vu(`svg`).createSVGMatrix();if(e!=null){let n=e,r=t;for(let e in n)r[e]=n[e]}return t}function Ud(e){let t=vu(`svg`);return e==null?t.createSVGTransform():(e instanceof DOMMatrix||(e=Hd(e)),t.createSVGTransformFromMatrix(e))}function Wd(e){let t=Hd(),n=e!=null&&e.match(Rd);if(!n)return t;for(let e=0,r=n.length;e<r;e+=1){let r=n[e].match(Bd);if(r){let e,n,i,a,o,s=Hd(),c=r[2].split(zd);switch(r[1].toLowerCase()){case`scale`:e=parseFloat(c[0]),n=c[1]===void 0?e:parseFloat(c[1]),s=s.scaleNonUniform(e,n);break;case`translate`:i=parseFloat(c[0]),a=parseFloat(c[1]),s=s.translate(i,a);break;case`rotate`:o=parseFloat(c[0]),i=parseFloat(c[1])||0,a=parseFloat(c[2])||0,s=i!==0||a!==0?s.translate(i,a).rotate(o).translate(-i,-a):s.rotate(o);break;case`skewx`:o=parseFloat(c[0]),s=s.skewX(o);break;case`skewy`:o=parseFloat(c[0]),s=s.skewY(o);break;case`matrix`:s.a=parseFloat(c[0]),s.b=parseFloat(c[1]),s.c=parseFloat(c[2]),s.d=parseFloat(c[3]),s.e=parseFloat(c[4]),s.f=parseFloat(c[5]);break;default:continue}t=t.multiply(s)}}return t}function Gd(e){let t=e||{};return`matrix(${t.a==null?1:t.a},${t.b==null?0:t.b},${t.c==null?0:t.c},${t.d==null?1:t.d},${t.e==null?0:t.e},${t.f==null?0:t.f})`}function Kd(e){let t,n,r;if(e){let i=zd;if(e.trim().indexOf(`matrix`)>=0){let i=Jd(Wd(e));t=[i.translateX,i.translateY],n=[i.rotation],r=[i.scaleX,i.scaleY];let a=[];(t[0]!==0||t[1]!==0)&&a.push(`translate(${t.join(`,`)})`),(r[0]!==1||r[1]!==1)&&a.push(`scale(${r.join(`,`)})`),n[0]!==0&&a.push(`rotate(${n[0]})`),e=a.join(` `)}else{let a=e.match(/translate\((.*?)\)/);a&&(t=a[1].split(i));let o=e.match(/rotate\((.*?)\)/);o&&(n=o[1].split(i));let s=e.match(/scale\((.*?)\)/);s&&(r=s[1].split(i))}}let i=r&&r[0]?parseFloat(r[0]):1;return{raw:e||``,translation:{tx:t&&t[0]?parseInt(t[0],10):0,ty:t&&t[1]?parseInt(t[1],10):0},rotation:{angle:n&&n[0]?parseInt(n[0],10):0,cx:n&&n[1]?parseInt(n[1],10):void 0,cy:n&&n[2]?parseInt(n[2],10):void 0},scale:{sx:i,sy:r&&r[1]?parseFloat(r[1]):i}}}function qd(e,t){return{x:t.x*e.a+t.y*e.c+0,y:t.x*e.b+t.y*e.d+0}}function Jd(e){let t=qd(e,{x:0,y:1}),n=qd(e,{x:1,y:0}),r=180/Math.PI*Math.atan2(t.y,t.x)-90;return{skewX:r,skewY:180/Math.PI*Math.atan2(n.y,n.x),translateX:e.e,translateY:e.f,scaleX:Math.sqrt(e.a*e.a+e.b*e.b),scaleY:Math.sqrt(e.c*e.c+e.d*e.d),rotation:r}}function Yd(e){let t,n,r,i;return e?(t=e.a==null?1:e.a,i=e.d==null?1:e.d,n=e.b,r=e.c):t=i=1,{sx:n?Math.sqrt(t*t+n*n):t,sy:r?Math.sqrt(r*r+i*i):i}}function Xd(e){let t={x:0,y:1};e&&(t=qd(e,t));let n=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:n%360+(n<0?360:0)}}function Zd(e){return{tx:e&&e.e||0,ty:e&&e.f||0}}function Qd(e,t,n={}){if(t==null)return Wd(P(e,`transform`));if(n.absolute){e.setAttribute(`transform`,Gd(t));return}let r=e.transform,i=Ud(t);r.baseVal.appendItem(i)}function $d(e,t,n=0,r={}){let i=P(e,`transform`),a=Kd(i);if(t==null)return a.translation;i=a.raw,i=i.replace(/translate\([^)]*\)/g,``).trim();let o=`translate(${r.absolute?t:a.translation.tx+t},${r.absolute?n:a.translation.ty+n})`;e.setAttribute(`transform`,`${o} ${i}`.trim())}function ef(e,t,n,r,i={}){let a=P(e,`transform`),o=Kd(a);if(t==null)return o.rotation;a=o.raw,a=a.replace(/rotate\([^)]*\)/g,``).trim(),t%=360;let s=`rotate(${i.absolute?t:o.rotation.angle+t}${n!=null&&r!=null?`,${n},${r}`:``})`;e.setAttribute(`transform`,`${a} ${s}`.trim())}function tf(e,t,n){let r=P(e,`transform`),i=Kd(r);if(t==null)return i.scale;n??=t,r=i.raw,r=r.replace(/scale\([^)]*\)/g,``).trim();let a=`scale(${t},${n})`;e.setAttribute(`transform`,`${r} ${a}`.trim())}function nf(e,t){if(mu(t)&&mu(e)){let n=t.getScreenCTM(),r=e.getScreenCTM();if(n&&r)return n.inverse().multiply(r)}return Hd()}function rf(e,t){let n=Hd();if(mu(t)&&mu(e)){let r=e,i=[];for(;r&&r!==t;){let e=Wd(r.getAttribute(`transform`)||null);i.push(e),r=r.parentNode}i.reverse().forEach(e=>{n=n.multiply(e)})}return n}function af(e,t,n){let r=e instanceof SVGSVGElement?e:e.ownerSVGElement,i=r.createSVGPoint();i.x=t,i.y=n;try{let t=r.getScreenCTM(),n=i.matrixTransform(t.inverse()),a=nf(e,r).inverse();return n.matrixTransform(a)}catch{return i}}var of;(function(e){let t={};function n(e){return t[e]||{}}e.get=n;function r(e,n){t[e]=n}e.register=r;function i(e){delete t[e]}e.unregister=i})(of||={});var sf;(function(e){let t=new WeakMap;function n(e){return t.has(e)||t.set(e,{events:Object.create(null)}),t.get(e)}e.ensure=n;function r(e){return t.get(e)}e.get=r;function i(e){return t.delete(e)}e.remove=i})(sf||={});var I;(function(e){e.returnTrue=()=>!0,e.returnFalse=()=>!1;function t(e){e.stopPropagation()}e.stopPropagationCallback=t;function n(e,t,n){e.addEventListener!=null&&e.addEventListener(t,n)}e.addEventListener=n;function r(e,t,n){e.removeEventListener!=null&&e.removeEventListener(t,n)}e.removeEventListener=r})(I||={}),(function(e){let t=/[^\x20\t\r\n\f]+/g,n=/^([^.]*)(?:\.(.+)|)/;function r(e){return(e||``).match(t)||[``]}e.splitType=r;function i(e){let t=n.exec(e)||[];return{originType:t[1]?t[1].trim():t[1],namespaces:t[2]?t[2].split(`.`).map(e=>e.trim()).sort():[]}}e.normalizeType=i;function a(e){return e.nodeType===1||e.nodeType===9||!+e.nodeType}e.isValidTarget=a;function o(e,t){if(t){let n=e;return n.querySelector!=null&&n.querySelector(t)!=null}return!0}e.isValidSelector=o})(I||={}),(function(e){let t=0,n=new WeakMap;function r(e){return n.has(e)||(n.set(e,t),t+=1),n.get(e)}e.ensureHandlerId=r;function i(e){return n.get(e)}e.getHandlerId=i;function a(e){return n.delete(e)}e.removeHandlerId=a;function o(e,t){return n.set(e,t)}e.setHandlerId=o})(I||={}),(function(e){function t(e,t){let n=[],r=sf.get(e),i=r&&r.events&&r.events[t.type],a=i&&i.handlers||[],o=i?i.delegateCount:0;if(o>0&&!(t.type===`click`&&typeof t.button==`number`&&t.button>=1)){for(let r=t.target;r!==e;r=r.parentNode||e)if(r.nodeType===1&&(t.type!==`click`||r.disabled!==!0)){let t=[],i={};for(let n=0;n<o;n+=1){let o=a[n],s=o.selector;if(s!=null&&i[s]==null){let t=e,n=[];t.querySelectorAll(s).forEach(e=>{n.push(e)}),i[s]=n.includes(r)}i[s]&&t.push(o)}t.length&&n.push({elem:r,handlers:t})}}return o<a.length&&n.push({elem:e,handlers:a.slice(o)}),n}e.getHandlerQueue=t})(I||={}),(function(e){function t(e){return e!=null&&e===e.window}e.isWindow=t})(I||={}),(function(e){function t(e,t){let n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16))}e.contains=t})(I||={});var cf=class{constructor(e,t){this.isDefaultPrevented=I.returnFalse,this.isPropagationStopped=I.returnFalse,this.isImmediatePropagationStopped=I.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{let e=this.originalEvent;this.isDefaultPrevented=I.returnTrue,e&&!this.isSimulated&&e.preventDefault()},this.stopPropagation=()=>{let e=this.originalEvent;this.isPropagationStopped=I.returnTrue,e&&!this.isSimulated&&e.stopPropagation()},this.stopImmediatePropagation=()=>{let e=this.originalEvent;this.isImmediatePropagationStopped=I.returnTrue,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()},typeof e==`string`?this.type=e:e.type&&(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?I.returnTrue:I.returnFalse,this.target=e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget,this.timeStamp=e.timeStamp),t&&Object.assign(this,t),this.timeStamp||=Date.now()}};(function(e){function t(t){return t instanceof e?t:new e(t)}e.create=t})(cf||={}),(function(e){function t(t,n){Object.defineProperty(e.prototype,t,{enumerable:!0,configurable:!0,get:typeof n==`function`?function(){if(this.originalEvent)return n(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})}e.addProperty=t})(cf||={}),(function(e){let t={bubbles:!0,cancelable:!0,eventPhase:!0,detail:!0,view:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pageX:!0,pageY:!0,screenX:!0,screenY:!0,toElement:!0,pointerId:!0,pointerType:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,touches:!0,changedTouches:!0,targetTouches:!0,which:!0,altKey:!0,ctrlKey:!0,metaKey:!0,shiftKey:!0};Object.keys(t).forEach(n=>e.addProperty(n,t[n]))})(cf||={});var lf;(function(e){of.register(`load`,{noBubble:!0})})(lf||={}),(function(e){of.register(`beforeunload`,{postDispatch(e,t){t.result!==void 0&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}})})(lf||={}),(function(e){of.register(`mouseenter`,{delegateType:`mouseover`,bindType:`mouseover`,handle(e,t){let n,r=t.relatedTarget,i=t.handleObj;return(!r||r!==e&&!I.contains(e,r))&&(t.type=i.originType,n=i.handler.call(e,t),t.type=`mouseover`),n}}),of.register(`mouseleave`,{delegateType:`mouseout`,bindType:`mouseout`,handle(e,t){let n,r=t.relatedTarget,i=t.handleObj;return(!r||r!==e&&!I.contains(e,r))&&(t.type=i.originType,n=i.handler.call(e,t),t.type=`mouseout`),n}})})(lf||={});var uf=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},df;(function(e){let t;function n(e,n,r,a,o){if(!I.isValidTarget(e))return;let s;if(typeof r!=`function`){let{handler:e,selector:t}=r,n=uf(r,[`handler`,`selector`]);r=e,o=t,s=n}let c=sf.ensure(e),l=c.handler;l??=c.handler=function(n,...r){return t===n.type?void 0:i(e,n,...r)};let u=I.ensureHandlerId(r);I.splitType(n).forEach(t=>{let{originType:n,namespaces:i}=I.normalizeType(t);if(!n)return;let d=n,f=of.get(d);d=(o?f.delegateType:f.bindType)||d,f=of.get(d);let p=Object.assign({type:d,originType:n,data:a,selector:o,guid:u,handler:r,namespace:i.join(`.`)},s),m=c.events,h=m[d];h||(h=m[d]={handlers:[],delegateCount:0},f.setup&&f.setup(e,a,i,l)!==!1||I.addEventListener(e,d,l)),f.add&&(I.removeHandlerId(p.handler),f.add(e,p),I.setHandlerId(p.handler,u)),o?(h.handlers.splice(h.delegateCount,0,p),h.delegateCount+=1):h.handlers.push(p)})}e.on=n;function r(e,t,n,i,a){let o=sf.get(e);if(!o)return;let s=o.events;s&&(I.splitType(t).forEach(t=>{let{originType:c,namespaces:l}=I.normalizeType(t);if(!c){Object.keys(s).forEach(a=>{r(e,a+t,n,i,!0)});return}let u=c,d=of.get(u);u=(i?d.delegateType:d.bindType)||u;let f=s[u];if(!f)return;let p=l.length>0?RegExp(`(^|\\.)${l.join(`\\.(?:.*\\.|)`)}(\\.|$)`):null,m=f.handlers.length;for(let t=f.handlers.length-1;t>=0;--t){let r=f.handlers[t];(a||c===r.originType)&&(!n||I.getHandlerId(n)===r.guid)&&(p==null||r.namespace&&p.test(r.namespace))&&(i==null||i===r.selector||i===`**`&&r.selector)&&(f.handlers.splice(t,1),r.selector&&--f.delegateCount,d.remove&&d.remove(e,r))}m&&f.handlers.length===0&&(d.teardown&&d.teardown(e,l,o.handler)!==!1||I.removeEventListener(e,u,o.handler),delete s[u])}),Object.keys(s).length===0&&sf.remove(e))}e.off=r;function i(e,t,...n){let r=cf.create(t);r.delegateTarget=e;let i=of.get(r.type);if(i.preDispatch&&i.preDispatch(e,r)===!1)return;let a=I.getHandlerQueue(e,r);for(let e=0,t=a.length;e<t&&!r.isPropagationStopped();e+=1){let t=a[e];r.currentTarget=t.elem;for(let e=0,i=t.handlers.length;e<i&&!r.isImmediatePropagationStopped();e+=1){let i=t.handlers[e];if(r.rnamespace==null||i.namespace&&r.rnamespace.test(i.namespace)){r.handleObj=i,r.data=i.data;let e=of.get(i.originType).handle,a=e?e(t.elem,r,...n):i.handler.call(t.elem,r,...n);a!==void 0&&(r.result=a,a===!1&&(r.preventDefault(),r.stopPropagation()))}}}return i.postDispatch&&i.postDispatch(e,r),r.result}e.dispatch=i;function a(e,n,r,i){let a=e,o=typeof e==`string`?e:e.type,s=typeof e==`string`||a.namespace==null?[]:a.namespace.split(`.`),c=r;if(c.nodeType===3||c.nodeType===8)return;o.indexOf(`.`)>-1&&(s=o.split(`.`),o=s.shift(),s.sort());let l=o.indexOf(`:`)<0&&`on${o}`;a=e instanceof cf?e:new cf(o,typeof e==`object`?e:null),a.namespace=s.join(`.`),a.rnamespace=a.namespace?RegExp(`(^|\\.)${s.join(`\\.(?:.*\\.|)`)}(\\.|$)`):null,a.result=void 0,a.target||(a.target=c);let u=[a];Array.isArray(n)?u.push(...n):u.push(n);let d=of.get(o);if(!i&&d.trigger&&d.trigger(c,a,n)===!1)return;let f,p=[c];if(!i&&!d.noBubble&&!I.isWindow(c)){f=d.delegateType||o;let e=c,t=c.parentNode;for(;t!=null;)p.push(t),e=t,t=t.parentNode;let n=c.ownerDocument||document;if(e===n){let t=e.defaultView||e.parentWindow||window;p.push(t)}}let m=c;for(let e=0,t=p.length;e<t&&!a.isPropagationStopped();e+=1){let t=p[e];m=t,a.type=e>1?f:d.bindType||o;let n=sf.get(t);n&&n.events[a.type]&&n.handler&&n.handler.call(t,...u);let r=l&&t[l]||null;r&&I.isValidTarget(t)&&(a.result=r.call(t,...u),a.result===!1&&a.preventDefault())}if(a.type=o,!i&&!a.isDefaultPrevented()){let e=d.preventDefault;if((e==null||e(p.pop(),a,n)===!1)&&I.isValidTarget(c)&&l&&typeof c[o]==`function`&&!I.isWindow(c)){let e=c[l];e&&(c[l]=null),t=o,a.isPropagationStopped()&&m.addEventListener(o,I.stopPropagationCallback),c[o](),a.isPropagationStopped()&&m.removeEventListener(o,I.stopPropagationCallback),t=void 0,e&&(c[l]=e)}}return a.result}e.trigger=a})(df||={});var ff;(function(e){function t(e,t,n,r,i){return pf.on(e,t,n,r,i),e}e.on=t;function n(e,t,n,r,i){return pf.on(e,t,n,r,i,!0),e}e.once=n;function r(e,t,n,r){return pf.off(e,t,n,r),e}e.off=r;function i(e,t,n,r){return df.trigger(t,n,e,r),e}e.trigger=i})(ff||={});var pf;(function(e){function t(n,r,i,a,o,s){if(typeof r==`object`)typeof i!=`string`&&(a||=i,i=void 0),Object.keys(r).forEach(e=>t(n,e,i,a,r[e],s));else{if(a==null&&o==null?(o=i,a=i=void 0):o??(typeof i==`string`?(o=a,a=void 0):(o=a,a=i,i=void 0)),o===!1)o=I.returnFalse;else if(!o)return;if(s){let t=o;o=function(r,...i){return e.off(n,r),t.call(this,r,...i)},I.setHandlerId(o,I.ensureHandlerId(t))}df.on(n,r,o,a,i)}}e.on=t;function n(e,t,r,i){let a=t;if(a&&a.preventDefault!=null&&a.handleObj!=null){let e=a.handleObj;n(a.delegateTarget,e.namespace?`${e.originType}.${e.namespace}`:e.originType,e.selector,e.handler)}else if(typeof t==`object`){let i=t;Object.keys(i).forEach(t=>n(e,t,r,i[t]))}else(r===!1||typeof r==`function`)&&(i=r,r=void 0),i===!1&&(i=I.returnFalse),df.off(e,t,i,r)}e.off=n})(pf||={});var mf=class{constructor(e,t,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=ru.isEventSupported(`wheel`)?`wheel`:`mousewheel`,this.target=e,this.onWheelCallback=t,this.onWheelGuard=n,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(e){if(this.onWheelGuard!=null&&!this.onWheelGuard(e))return;this.deltaX+=e.deltaX,this.deltaY+=e.deltaY,e.preventDefault();let t;(this.deltaX!==0||this.deltaY!==0)&&(e.stopPropagation(),t=!0),t===!0&&this.animationFrameId===0&&(this.animationFrameId=requestAnimationFrame(()=>{this.didWheel(e)}))}didWheel(e){this.animationFrameId=0,this.onWheelCallback(e,this.deltaX,this.deltaY),this.deltaX=0,this.deltaY=0}};function hf(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView;return{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}}function gf(e){return e.getBoundingClientRect().width}function _f(e){return e.getBoundingClientRect().height}function vf(e){let t=sd(e,`position`)===`fixed`,n;if(t){let t=e.getBoundingClientRect();n={left:t.left,top:t.top}}else n=hf(e);if(!t){let t=e.ownerDocument,r=e.offsetParent||t.documentElement;for(;(r===t.body||r===t.documentElement)&&sd(r,`position`)===`static`;)r=r.parentNode;if(r!==e&&Nu(r)){let e=hf(r);n.top-=e.top+cd(r,`borderTopWidth`),n.left-=e.left+cd(r,`borderLeftWidth`)}}return{top:n.top-cd(e,`marginTop`),left:n.left-cd(e,`marginLeft`)}}function yf(e,t=60){let n=null;return(...r)=>{n&&clearTimeout(n),n=window.setTimeout(()=>{e.apply(this,r)},t)}}function bf(e){let t=null,n=[],r=()=>{if(getComputedStyle(e).position===`static`){let t=e.style;t.position=`relative`}let t=document.createElement(`object`);return t.onload=()=>{t.contentDocument.defaultView.addEventListener(`resize`,i),i()},t.style.display=`block`,t.style.position=`absolute`,t.style.top=`0`,t.style.left=`0`,t.style.height=`100%`,t.style.width=`100%`,t.style.overflow=`hidden`,t.style.pointerEvents=`none`,t.style.zIndex=`-1`,t.style.opacity=`0`,t.setAttribute(`tabindex`,`-1`),t.type=`text/html`,e.appendChild(t),t.data=`about:blank`,t},i=yf(()=>{n.forEach(t=>t(e))}),a=e=>{t||=r(),n.indexOf(e)===-1&&n.push(e)},o=()=>{t&&t.parentNode&&(t.contentDocument&&t.contentDocument.defaultView.removeEventListener(`resize`,i),t.parentNode.removeChild(t),t=null,n=[])};return{element:e,bind:a,destroy:o,unbind:e=>{let r=n.indexOf(e);r!==-1&&n.splice(r,1),n.length===0&&t&&o()}}}function xf(e){let t=null,n=[],r=yf(()=>{n.forEach(t=>{t(e)})}),i=()=>{let t=new ResizeObserver(r);return t.observe(e),r(),t},a=e=>{t||=i(),n.indexOf(e)===-1&&n.push(e)},o=()=>{t&&=(t.disconnect(),n=[],null)};return{element:e,bind:a,destroy:o,unbind:e=>{let r=n.indexOf(e);r!==-1&&n.splice(r,1),n.length===0&&t&&o()}}}var Sf=typeof ResizeObserver<`u`?xf:bf,Cf;(function(e){let t=new WeakMap;function n(e){let n=t.get(e);return n||(n=Sf(e),t.set(e,n),n)}function r(e){e.destroy(),t.delete(e.element)}e.bind=(e,t)=>{let r=n(e);return r.bind(t),()=>r.unbind(t)},e.clear=e=>{r(n(e))}})(Cf||={});var wf=class e{constructor(t={}){this.comparator=t.comparator||e.defaultComparator,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return this.data.length===0}insert(e,t,n){let r={priority:e,value:t},i=this.data.length;return n&&(r.id=n,this.index[n]=i),this.data.push(r),this.bubbleUp(i),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(e,t){let n=this.index[e];if(n===void 0)throw Error(`Node with id '${e}' was not found in the heap.`);let r=this.data,i=r[n].priority,a=this.comparator(t,i);a<0?(r[n].priority=t,this.bubbleUp(n)):a>0&&(r[n].priority=t,this.bubbleDown(n))}remove(){let e=this.data,t=e[0],n=e.pop();return t.id&&delete this.index[t.id],e.length>0&&(e[0]=n,n.id&&(this.index[n.id]=0),this.bubbleDown(0)),t?t.value:null}heapify(){for(let e=0;e<this.data.length;e+=1)this.bubbleUp(e)}bubbleUp(e){let t=this.data,n,r,i=e;for(;i>0&&(r=i-1>>>1,this.comparator(t[i].priority,t[r].priority)<0);){n=t[r],t[r]=t[i];let e=t[i].id;e!=null&&(this.index[e]=r),t[i]=n,e=t[i].id,e!=null&&(this.index[e]=i),i=r}}bubbleDown(e){let t=this.data,n=t.length-1,r=e;for(;;){let e=(r<<1)+1,i=e+1,a=r;if(e<=n&&this.comparator(t[e].priority,t[a].priority)<0&&(a=e),i<=n&&this.comparator(t[i].priority,t[a].priority)<0&&(a=i),a!==r){let e=t[a];t[a]=t[r];let n=t[r].id;n!=null&&(this.index[n]=a),t[r]=e,n=t[r].id,n!=null&&(this.index[n]=r),r=a}else break}}};(function(e){e.defaultComparator=(e,t)=>e-t})(wf||={});var Tf;(function(e){function t(e,t,n=(e,t)=>1){let r={},i={},a={},o=new wf;for(r[t]=0,Object.keys(e).forEach(e=>{e!==t&&(r[e]=1/0),o.insert(r[e],e,e)});!o.isEmpty();){let t=o.remove();a[t]=!0;let s=e[t]||[];for(let e=0;e<s.length;e+=1){let c=s[e];if(!a[c]){let e=r[t]+n(t,c);e<r[c]&&(r[c]=e,i[c]=t,o.updatePriority(c,e))}}}return i}e.run=t})(Tf||={});var Ef=class e{constructor(t,n,r,i){if(t==null)return this.set(255,255,255,1);if(typeof t==`number`)return this.set(t,n,r,i);if(typeof t==`string`)return e.fromString(t)||this;if(Array.isArray(t))return this.set(t);this.set(t.r,t.g,t.b,t.a==null?1:t.a)}blend(e,t,n){this.set(e.r+(t.r-e.r)*n,e.g+(t.g-e.g)*n,e.b+(t.b-e.b)*n,e.a+(t.a-e.a)*n)}lighten(t){let n=e.lighten(this.toArray(),t);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}darken(e){this.lighten(-e)}set(e,t,n,r){let i=Array.isArray(e)?e[0]:e,a=Array.isArray(e)?e[1]:t,o=Array.isArray(e)?e[2]:n,s=Array.isArray(e)?e[3]:r;return this.r=Math.round(Wi(i,0,255)),this.g=Math.round(Wi(a,0,255)),this.b=Math.round(Wi(o,0,255)),this.a=s==null?1:Wi(s,0,1),this}toHex(){return`#${[`r`,`g`,`b`].map(e=>{let t=this[e].toString(16);return t.length<2?`0${t}`:t}).join(``)}`}toRGBA(){return this.toArray()}toHSLA(){return e.rgba2hsla(this.r,this.g,this.b,this.a)}toCSS(e){let t=`${this.r},${this.g},${this.b},`;return e?`rgb(${t})`:`rgba(${t},${this.a})`}toGrey(){return e.makeGrey(Math.round((this.r+this.g+this.b)/3),this.a)}toArray(){return[this.r,this.g,this.b,this.a]}toString(){return this.toCSS()}};(function(e){function t(t){return new e(t)}e.fromArray=t;function n(t){return new e([...m(t),1])}e.fromHex=n;function r(t){let n=t.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);return n?new e(n[1].split(/\s*,\s*/).map(e=>parseInt(e,10))):null}e.fromRGBA=r;function i(e,t,n){n<0&&++n,n>1&&--n;let r=6*n;return r<1?e+(t-e)*r:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}function a(t){let n=t.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(n){let t=n[2].split(/\s*,\s*/);return new e(l((parseFloat(t[0])%360+360)%360/360,parseFloat(t[1])/100,parseFloat(t[2])/100,t[3]==null?1:parseInt(t[3],10)))}return null}e.fromHSLA=a;function o(t){if(t.startsWith(`#`))return n(t);if(t.startsWith(`rgb`))return r(t);let i=e.named[t];return i?n(i):a(t)}e.fromString=o;function s(t,n){return e.fromArray([t,t,t,n])}e.makeGrey=s;function c(e,t,n,r){let i=Array.isArray(e)?e[0]:e,a=Array.isArray(e)?e[1]:t,o=Array.isArray(e)?e[2]:n,s=Array.isArray(e)?e[3]:r,c=Math.max(i,a,o),l=Math.min(i,a,o),u=(c+l)/2,d=0,f=0;if(l!==c){let e=c-l;switch(f=u>.5?e/(2-c-l):e/(c+l),c){case i:d=(a-o)/e+(a<o?6:0);break;case a:d=(o-i)/e+2;break;case o:d=(i-a)/e+4}d/=6}return[d,f,u,s??1]}e.rgba2hsla=c;function l(e,t,n,r){let a=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,s=Array.isArray(e)?e[2]:n,c=Array.isArray(e)?e[3]:r,l=s<=.5?s*(o+1):s+o-s*o,u=2*s-l;return[i(u,l,a+1/3)*256,i(u,l,a)*256,i(u,l,a-1/3)*256,c??1]}e.hsla2rgba=l;function u(t){return new e(Math.round(Math.random()*256),Math.round(Math.random()*256),Math.round(Math.random()*256),t?void 0:parseFloat(Math.random().toFixed(2)))}e.random=u;function d(){let e=`#`;for(let t=0;t<6;t+=1)e+=`0123456789ABCDEF`[Math.floor(Math.random()*16)];return e}e.randomHex=d;function f(e){return u(e).toString()}e.randomRGBA=f;function p(e,t){if(typeof e==`string`){let n=e[0]===`#`,[r,i,a]=m(e);return t?r*.299+i*.587+a*.114>186?`#000000`:`#ffffff`:`${n?`#`:``}${h(255-r,255-i,255-a)}`}let n=e[0],r=e[1],i=e[2],a=e[3];return t?n*.299+r*.587+i*.114>186?[0,0,0,a]:[255,255,255,a]:[255-n,255-r,255-i,a]}e.invert=p;function m(e){let t=e.indexOf(`#`)===0?e:`#${e}`,n=Number(`0x${t.substr(1)}`);if(t.length!==4&&t.length!==7||Number.isNaN(n))throw Error(`Invalid hex color.`);let r=t.length===4?4:8,i=(1<<r)-1,a=[`b`,`g`,`r`].map(()=>{let e=n&i;return n>>=r,r===4?17*e:e});return[a[2],a[1],a[0]]}function h(e,t,n){let r=e=>e.length<2?`0${e}`:e;return`${r(e.toString(16))}${r(t.toString(16))}${r(n.toString(16))}`}function g(e,t){return v(e,t)}e.lighten=g;function _(e,t){return v(e,-t)}e.darken=_;function v(e,t){if(typeof e==`string`){let n=e[0]===`#`,r=parseInt(n?e.substr(1):e,16),i=Wi((r>>16)+t,0,255),a=Wi((r>>8&255)+t,0,255),o=Wi((r&255)+t,0,255);return`${n?`#`:``}${(o|a<<8|i<<16).toString(16)}`}let n=m(v(h(e[0],e[1],e[2]),t));return[n[0],n[1],n[2],e[3]]}})(Ef||={}),(function(e){e.named={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,burntsienna:`#ea7e5d`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`}})(Ef||={});var Df=class{constructor(){this.clear()}clear(){this.map=new WeakMap,this.arr=[]}has(e){return this.map.has(e)}get(e){return this.map.get(e)}set(e,t){this.map.set(e,t),this.arr.push(e)}delete(e){let t=this.arr.indexOf(e);t>=0&&this.arr.splice(t,1);let n=this.map.get(e);return this.map.delete(e),n}each(e){this.arr.forEach(t=>{e(this.map.get(t),t)})}dispose(){this.clear()}},Of;(function(e){function t(e){let t=[],n=[];return Array.isArray(e)?t.push(...e):e.split(`|`).forEach(e=>{e.indexOf(`&`)===-1?t.push(e):n.push(...e.split(`&`))}),{or:t,and:n}}e.parse=t;function n(e,n){if(e!=null&&n!=null){let r=t(e),i=t(n),a=r.or.sort(),o=i.or.sort(),s=r.and.sort(),c=i.and.sort(),l=(e,t)=>e.length===t.length&&(e.length===0||e.every((e,n)=>e===t[n]));return l(a,o)&&l(s,c)}return e==null&&n==null}e.equals=n;function r(e,n,r){if(n==null||Array.isArray(n)&&n.length===0)return!r||e.altKey!==!0&&e.ctrlKey!==!0&&e.metaKey!==!0&&e.shiftKey!==!0;let{or:i,and:a}=t(n),o=t=>e[`${t.toLowerCase()}Key`]===!0;return i.some(e=>o(e))&&a.every(e=>o(e))}e.isMatch=r})(Of||={});var kf;(function(e){e.linear=e=>e,e.quad=e=>e*e,e.cubic=e=>e*e*e,e.inout=e=>{if(e<=0)return 0;if(e>=1)return 1;let t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)},e.exponential=e=>2**(10*(e-1)),e.bounce=(e=>{for(let t=0,n=1;;t+=n,n/=2)if(e>=(7-4*t)/11){let r=(11-6*t-11*e)/4;return-r*r+n*n}})})(kf||={}),(function(e){e.decorators={reverse(e){return t=>1-e(1-t)},reflect(e){return t=>.5*(t<.5?e(2*t):2-e(2-2*t))},clamp(e,t=0,n=1){return r=>{let i=e(r);return i<t?t:i>n?n:i}},back(e=1.70158){return t=>t*t*((e+1)*t-e)},elastic(e=1.5){return t=>2**(10*(t-1))*Math.cos(20*Math.PI*e/3*t)}}})(kf||={}),(function(e){function t(e){return-1*Math.cos(Math.PI/2*e)+1}e.easeInSine=t;function n(e){return Math.sin(Math.PI/2*e)}e.easeOutSine=n;function r(e){return-.5*(Math.cos(Math.PI*e)-1)}e.easeInOutSine=r;function i(e){return e*e}e.easeInQuad=i;function a(e){return e*(2-e)}e.easeOutQuad=a;function o(e){return e<.5?2*e*e:-1+(4-2*e)*e}e.easeInOutQuad=o;function s(e){return e*e*e}e.easeInCubic=s;function c(e){let t=e-1;return t*t*t+1}e.easeOutCubic=c;function l(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1}e.easeInOutCubic=l;function u(e){return e*e*e*e}e.easeInQuart=u;function d(e){let t=e-1;return 1-t*t*t*t}e.easeOutQuart=d;function f(e){let t=e-1;return e<.5?8*e*e*e*e:1-8*t*t*t*t}e.easeInOutQuart=f;function p(e){return e*e*e*e*e}e.easeInQuint=p;function m(e){let t=e-1;return 1+t*t*t*t*t}e.easeOutQuint=m;function h(e){let t=e-1;return e<.5?16*e*e*e*e*e:1+16*t*t*t*t*t}e.easeInOutQuint=h;function g(e){return e===0?0:2**(10*(e-1))}e.easeInExpo=g;function _(e){return e===1?1:-(2**(-10*e))+1}e.easeOutExpo=_;function v(e){if(e===0||e===1)return e;let t=e*2,n=t-1;return t<1?.5*2**(10*n):.5*(-(2**(-10*n))+2)}e.easeInOutExpo=v;function y(e){let t=e/1;return-1*(Math.sqrt(1-t*e)-1)}e.easeInCirc=y;function b(e){let t=e-1;return Math.sqrt(1-t*t)}e.easeOutCirc=b;function x(e){let t=e*2,n=t-2;return t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-n*n)+1)}e.easeInOutCirc=x;function S(e,t=1.70158){return e*e*((t+1)*e-t)}e.easeInBack=S;function C(e,t=1.70158){let n=e/1-1;return n*n*((t+1)*n+t)+1}e.easeOutBack=C;function w(e,t=1.70158){let n=e*2,r=n-2,i=t*1.525;return n<1?.5*n*n*((i+1)*n-i):.5*(r*r*((i+1)*r+i)+2)}e.easeInOutBack=w;function T(e,t=.7){if(e===0||e===1)return e;let n=e/1-1,r=1-t,i=r/(2*Math.PI)*Math.asin(1);return-(2**(10*n)*Math.sin((n-i)*(2*Math.PI)/r))}e.easeInElastic=T;function E(e,t=.7){let n=1-t,r=e*2;if(e===0||e===1)return e;let i=n/(2*Math.PI)*Math.asin(1);return 2**(-10*r)*Math.sin((r-i)*(2*Math.PI)/n)+1}e.easeOutElastic=E;function D(e,t=.65){let n=1-t;if(e===0||e===1)return e;let r=e*2,i=r-1,a=n/(2*Math.PI)*Math.asin(1);return r<1?-.5*(2**(10*i)*Math.sin((i-a)*(2*Math.PI)/n)):2**(-10*i)*Math.sin((i-a)*(2*Math.PI)/n)*.5+1}e.easeInOutElastic=D;function ee(e){let t=e/1;if(t<1/2.75)return 7.5625*t*t;if(t<2/2.75){let e=t-1.5/2.75;return 7.5625*e*e+.75}if(t<2.5/2.75){let e=t-2.25/2.75;return 7.5625*e*e+.9375}{let e=t-2.625/2.75;return 7.5625*e*e+.984375}}e.easeOutBounce=ee;function te(e){return 1-ee(1-e)}e.easeInBounce=te;function ne(e){return e<.5?te(e*2)*.5:ee(e*2-1)*.5+.5}e.easeInOutBounce=ne})(kf||={});var Af;(function(e){e.number=(e,t)=>{let n=t-e;return t=>e+n*t},e.object=(e,t)=>{let n=Object.keys(e);return r=>{let i={};for(let a=n.length-1;a!==-1;--a){let o=n[a];i[o]=e[o]+(t[o]-e[o])*r}return i}},e.unit=(e,t)=>{let n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,r=n.exec(e),i=n.exec(t),a=i?i[1]:``,o=r?+r[1]:0,s=i?+i[1]:0,c=a.indexOf(`.`),l=c>0?a[1].length-c-1:0,u=s-o,d=r?r[2]:``;return e=>(o+u*e).toFixed(l)+d},e.color=(e,t)=>{let n=parseInt(e.slice(1),16),r=parseInt(t.slice(1),16),i=n&255,a=(r&255)-i,o=n&65280,s=(r&65280)-o,c=n&16711680,l=(r&16711680)-c;return e=>{let t=i+a*e&255,n=o+s*e&65280,r=c+l*e&16711680;return`#${(1<<24|t|n|r).toString(16).slice(1)}`}}})(Af||={});var jf=[];function Mf(e,t){let n=jf.find(t=>t.name===e);if(!(n&&(n.loadTimes+=1,n.loadTimes>1))&&!ru.isApplyingHMR()){let n=document.createElement(`style`);n.setAttribute(`type`,`text/css`),n.textContent=t;let r=document.querySelector(`head`);r&&r.insertBefore(n,r.firstChild),jf.push({name:e,loadTimes:1,styleElement:n})}}function Nf(e){let t=jf.findIndex(t=>t.name===e);if(t>-1){let e=jf[t];if(--e.loadTimes,e.loadTimes>0)return;let n=e.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,jf.splice(t,1)}}var L;(function(e){function t(e){return 180*e/Math.PI%360}e.toDeg=t,e.toRad=function(e,t=!1){return(t?e:e%360)*Math.PI/180};function n(e){return e%360+(e<0?360:0)}e.normalize=n})(L||={});var R;(function(e){function t(e,t=0){return Number.isInteger(e)?e:+e.toFixed(t)}e.round=t;function n(e,t){let n,r;if(t==null?(r=e??1,n=0):(r=t,n=e??0),r<n){let e=n;n=r,r=e}return Math.floor(Math.random()*(r-n+1)+n)}e.random=n;function r(e,t,n){return Number.isNaN(e)?NaN:Number.isNaN(t)||Number.isNaN(n)?0:t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}e.clamp=r;function i(e,t){return t*Math.round(e/t)}e.snapToGrid=i;function a(e,t){return t!=null&&e!=null&&t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height}e.containsPoint=a;function o(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}e.squaredLength=o})(R||={});var Pf=class{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}},z=class e extends Pf{constructor(e,t){super(),this.x=e??0,this.y=t??0}round(e=0){return this.x=R.round(this.x,e),this.y=R.round(this.y,e),this}add(t,n){let r=e.create(t,n);return this.x+=r.x,this.y+=r.y,this}update(t,n){let r=e.create(t,n);return this.x=r.x,this.y=r.y,this}translate(t,n){let r=e.create(t,n);return this.x+=r.x,this.y+=r.y,this}rotate(t,n){let r=e.rotate(this,t,n);return this.x=r.x,this.y=r.y,this}scale(t,n,r=new e){let i=e.create(r);return this.x=i.x+t*(this.x-i.x),this.y=i.y+n*(this.y-i.y),this}closest(t){if(t.length===1)return e.create(t[0]);let n=null,r=1/0;return t.forEach(e=>{let t=this.squaredDistance(e);t<r&&(n=e,r=t)}),n?e.create(n):null}distance(e){return Math.sqrt(this.squaredDistance(e))}squaredDistance(t){let n=e.create(t),r=this.x-n.x,i=this.y-n.y;return r*r+i*i}manhattanDistance(t){let n=e.create(t);return Math.abs(n.x-this.x)+Math.abs(n.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(t=new e){let n=e.create(t),r=-(n.y-this.y),i=n.x-this.x,a=Math.atan2(r,i);return a<0&&(a=2*Math.PI+a),180*a/Math.PI}angleBetween(e,t){if(this.equals(e)||this.equals(t))return NaN;let n=this.theta(t)-this.theta(e);return n<0&&(n+=360),n}vectorAngle(t){return new e(0,0).angleBetween(this,t)}toPolar(t){return this.update(e.toPolar(this,t)),this}changeInAngle(t,n,r=new e){return this.clone().translate(-t,-n).theta(r)-this.theta(r)}adhereToRect(e){return R.containsPoint(e,this)||(this.x=Math.min(Math.max(this.x,e.x),e.x+e.width),this.y=Math.min(Math.max(this.y,e.y),e.y+e.height)),this}bearing(t){let n=e.create(t),r=L.toRad(this.y),i=L.toRad(n.y),a=this.x,o=n.x,s=L.toRad(o-a),c=Math.sin(s)*Math.cos(i),l=Math.cos(r)*Math.sin(i)-Math.sin(r)*Math.cos(i)*Math.cos(s),u=L.toDeg(Math.atan2(c,l)),d=[`NE`,`E`,`SE`,`S`,`SW`,`W`,`NW`,`N`],f=u-22.5;return f<0&&(f+=360),f=parseInt(f/45,10),d[f]}cross(t,n){if(t!=null&&n!=null){let r=e.create(t),i=e.create(n);return(i.x-this.x)*(r.y-this.y)-(i.y-this.y)*(r.x-this.x)}return NaN}dot(t){let n=e.create(t);return this.x*n.x+this.y*n.y}diff(t,n){if(typeof t==`number`)return new e(this.x-t,this.y-n);let r=e.create(t);return new e(this.x-r.x,this.y-r.y)}lerp(t,n){let r=e.create(t);return new e((1-n)*this.x+n*r.x,(1-n)*this.y+n*r.y)}normalize(e=1){let t=e/this.magnitude();return this.scale(t,t)}move(t,n){let r=e.create(t),i=L.toRad(r.theta(this));return this.translate(Math.cos(i)*n,-Math.sin(i)*n)}reflection(t){return e.create(t).move(this,this.distance(t))}snapToGrid(e,t){return this.x=R.snapToGrid(this.x,e),this.y=R.snapToGrid(this.y,t??e),this}equals(t){let n=e.create(t);return n!=null&&n.x===this.x&&n.y===this.y}clone(){return e.clone(this)}toJSON(){return e.toJSON(this)}serialize(){return`${this.x} ${this.y}`}};(function(e){function t(t){return t!=null&&t instanceof e}e.isPoint=t})(z||={}),(function(e){function t(e){return typeof e==`object`&&!!e&&typeof e.x==`number`&&typeof e.y==`number`}e.isPointLike=t;function n(e){return e!=null&&Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}e.isPointData=n})(z||={}),(function(e){function t(t,r){return t==null||typeof t==`number`?new e(t,r):n(t)}e.create=t;function n(t){return e.isPoint(t)?new e(t.x,t.y):Array.isArray(t)?new e(t[0],t[1]):new e(t.x,t.y)}e.clone=n;function r(t){return e.isPoint(t)?{x:t.x,y:t.y}:Array.isArray(t)?{x:t[0],y:t[1]}:{x:t.x,y:t.y}}e.toJSON=r;function i(t,r,i=new e){let a=Math.abs(t*Math.cos(r)),o=Math.abs(t*Math.sin(r)),s=n(i),c=L.normalize(L.toDeg(r));return c<90?o=-o:c<180?(a=-a,o=-o):c<270&&(a=-a),new e(s.x+a,s.y+o)}e.fromPolar=i;function a(t,r=new e){let i=n(t),a=n(r),o=i.x-a.x,s=i.y-a.y;return new e(Math.sqrt(o*o+s*s),L.toRad(a.theta(i)))}e.toPolar=a;function o(e,t){return e===t||e!=null&&t!=null&&e.x===t.x&&e.y===t.y}e.equals=o;function s(e,t){if(e==null&&t!=null||e!=null&&t==null||e!=null&&t!=null&&e.length!==t.length)return!1;if(e!=null&&t!=null){for(let n=0,r=e.length;n<r;n+=1)if(!o(e[n],t[n]))return!1}return!0}e.equalPoints=s;function c(t,n,r,i){return new e(R.random(t,n),R.random(r,i))}e.random=c;function l(e,t,n){let r=L.toRad(L.normalize(-t));return u(e,Math.cos(r),Math.sin(r),n)}e.rotate=l;function u(t,r,i,a=new e){let o=n(t),s=n(a),c=o.x-s.x,l=o.y-s.y,u=c*r-l*i,d=l*r+c*i;return new e(u+s.x,d+s.y)}e.rotateEx=u})(z||={});var B=class e extends Pf{get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get origin(){return new z(this.x,this.y)}get topLeft(){return new z(this.x,this.y)}get topCenter(){return new z(this.x+this.width/2,this.y)}get topRight(){return new z(this.x+this.width,this.y)}get center(){return new z(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new z(this.x,this.y+this.height)}get bottomCenter(){return new z(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new z(this.x+this.width,this.y+this.height)}get corner(){return new z(this.x+this.width,this.y+this.height)}get rightMiddle(){return new z(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new z(this.x,this.y+this.height/2)}get topLine(){return new V(this.topLeft,this.topRight)}get rightLine(){return new V(this.topRight,this.bottomRight)}get bottomLine(){return new V(this.bottomLeft,this.bottomRight)}get leftLine(){return new V(this.topLeft,this.bottomLeft)}constructor(e,t,n,r){super(),this.x=e??0,this.y=t??0,this.width=n??0,this.height=r??0}getOrigin(){return this.origin}getTopLeft(){return this.topLeft}getTopCenter(){return this.topCenter}getTopRight(){return this.topRight}getCenter(){return this.center}getCenterX(){return this.x+this.width/2}getCenterY(){return this.y+this.height/2}getBottomLeft(){return this.bottomLeft}getBottomCenter(){return this.bottomCenter}getBottomRight(){return this.bottomRight}getCorner(){return this.corner}getRightMiddle(){return this.rightMiddle}getLeftMiddle(){return this.leftMiddle}getTopLine(){return this.topLine}getRightLine(){return this.rightLine}getBottomLine(){return this.bottomLine}getLeftLine(){return this.leftLine}bbox(t){if(!t)return this.clone();let n=L.toRad(t),r=Math.abs(Math.sin(n)),i=Math.abs(Math.cos(n)),a=this.width*i+this.height*r,o=this.width*r+this.height*i;return new e(this.x+(this.width-a)/2,this.y+(this.height-o)/2,a,o)}round(e=0){return this.x=R.round(this.x,e),this.y=R.round(this.y,e),this.width=R.round(this.width,e),this.height=R.round(this.height,e),this}add(t,n,r,i){let a=e.create(t,n,r,i),o=Math.min(this.x,a.x),s=Math.min(this.y,a.y),c=Math.max(this.x+this.width,a.x+a.width),l=Math.max(this.y+this.height,a.y+a.height);return this.x=o,this.y=s,this.width=c-o,this.height=l-s,this}update(t,n,r,i){let a=e.create(t,n,r,i);return this.x=a.x,this.y=a.y,this.width=a.width,this.height=a.height,this}inflate(e,t){let n=e,r=t??e;return this.x-=n,this.y-=r,this.width+=2*n,this.height+=2*r,this}snapToGrid(e,t){let n=this.origin.snapToGrid(e,t),r=this.corner.snapToGrid(e,t);return this.x=n.x,this.y=n.y,this.width=r.x-n.x,this.height=r.y-n.y,this}translate(e,t){let n=z.create(e,t);return this.x+=n.x,this.y+=n.y,this}scale(e,t,n=new z){let r=this.origin.scale(e,t,n);return this.x=r.x,this.y=r.y,this.width*=e,this.height*=t,this}rotate(t,n=this.getCenter()){if(t!==0){let r=L.toRad(t),i=Math.cos(r),a=Math.sin(r),o=this.getOrigin(),s=this.getTopRight(),c=this.getBottomRight(),l=this.getBottomLeft();o=z.rotateEx(o,i,a,n),s=z.rotateEx(s,i,a,n),c=z.rotateEx(c,i,a,n),l=z.rotateEx(l,i,a,n);let u=new e(o.x,o.y,0,0);u.add(s.x,s.y,0,0),u.add(c.x,c.y,0,0),u.add(l.x,l.y,0,0),this.update(u)}return this}rotate90(){let e=(this.width-this.height)/2;this.x+=e,this.y-=e;let t=this.width;return this.width=this.height,this.height=t,this}moveAndExpand(t){let n=e.clone(t);return this.x+=n.x||0,this.y+=n.y||0,this.width+=n.width||0,this.height+=n.height||0,this}getMaxScaleToFit(t,n=this.center){let r=e.clone(t),i=n.x,a=n.y,o=1/0,s=1/0,c=1/0,l=1/0,u=1/0,d=1/0,f=1/0,p=1/0,m=r.topLeft;m.x<i&&(o=(this.x-i)/(m.x-i)),m.y<a&&(u=(this.y-a)/(m.y-a));let h=r.bottomRight;h.x>i&&(s=(this.x+this.width-i)/(h.x-i)),h.y>a&&(d=(this.y+this.height-a)/(h.y-a));let g=r.topRight;g.x>i&&(c=(this.x+this.width-i)/(g.x-i)),g.y<a&&(f=(this.y-a)/(g.y-a));let _=r.bottomLeft;return _.x<i&&(l=(this.x-i)/(_.x-i)),_.y>a&&(p=(this.y+this.height-a)/(_.y-a)),{sx:Math.min(o,s,c,l),sy:Math.min(u,d,f,p)}}getMaxUniformScaleToFit(e,t=this.center){let n=this.getMaxScaleToFit(e,t);return Math.min(n.sx,n.sy)}containsPoint(e,t){return R.containsPoint(this,z.create(e,t))}containsRect(t,n,r,i){let a=e.create(t,n,r,i),o=this.x,s=this.y,c=this.width,l=this.height,u=a.x,d=a.y,f=a.width,p=a.height;return c===0||l===0||f===0||p===0?!1:u>=o&&d>=s&&u+f<=o+c&&d+p<=s+l}intersectsWithLine(e){let t=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],r=[];return t.forEach(t=>{let i=e.intersectsWithLine(t);i!==null&&r.indexOf(i.toString())<0&&(n.push(i),r.push(i.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(e,t){let n=z.clone(e),r=this.center,i=null;t!=null&&t!==0&&n.rotate(t,r);let a=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],o=new V(r,n);for(let e=a.length-1;e>=0;--e){let t=a[e].intersectsWithLine(o);if(t!==null){i=t;break}}return i&&t!=null&&t!==0&&i.rotate(-t,r),i}intersectsWithRect(t,n,r,i){let a=e.create(t,n,r,i);if(!this.isIntersectWithRect(a))return null;let o=this.origin,s=this.corner,c=a.origin,l=a.corner,u=Math.max(o.x,c.x),d=Math.max(o.y,c.y);return new e(u,d,Math.min(s.x,l.x)-u,Math.min(s.y,l.y)-d)}isIntersectWithRect(t,n,r,i){let a=e.create(t,n,r,i),o=this.origin,s=this.corner,c=a.origin,l=a.corner;return!(l.x<=o.x||l.y<=o.y||c.x>=s.x||c.y>=s.y)}normalize(){let e=this.x,t=this.y,n=this.width,r=this.height;return this.width<0&&(e=this.x+this.width,n=-this.width),this.height<0&&(t=this.y+this.height,r=-this.height),this.x=e,this.y=t,this.width=n,this.height=r,this}union(t){let n=e.clone(t),r=this.origin,i=this.corner,a=n.origin,o=n.corner,s=Math.min(r.x,a.x),c=Math.min(r.y,a.y),l=Math.max(i.x,o.x),u=Math.max(i.y,o.y);return new e(s,c,l-s,u-c)}getNearestSideToPoint(e){let t=z.clone(e),n=t.x-this.x,r=this.x+this.width-t.x,i=t.y-this.y,a=this.y+this.height-t.y,o=n,s=`left`;return r<o&&(o=r,s=`right`),i<o&&(o=i,s=`top`),a<o&&(s=`bottom`),s}getNearestPointToPoint(e){let t=z.clone(e);if(this.containsPoint(t)){let e=this.getNearestSideToPoint(t);if(e===`left`)return new z(this.x,t.y);if(e===`top`)return new z(t.x,this.y);if(e===`right`)return new z(this.x+this.width,t.y);if(e===`bottom`)return new z(t.x,this.y+this.height)}return t.adhereToRect(this)}equals(e){return e!=null&&e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}clone(){return new e(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}};(function(e){function t(t){return t!=null&&t instanceof e}e.isRectangle=t})(B||={}),(function(e){function t(e){return typeof e==`object`&&!!e&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.width==`number`&&typeof e.height==`number`}e.isRectangleLike=t})(B||={}),(function(e){function t(t,r,i,a){return t==null||typeof t==`number`?new e(t,r,i,a):n(t)}e.create=t;function n(t){return e.isRectangle(t)?t.clone():Array.isArray(t)?new e(t[0],t[1],t[2],t[3]):new e(t.x,t.y,t.width,t.height)}e.clone=n;function r(t){return new e(t.x-t.a,t.y-t.b,2*t.a,2*t.b)}e.fromEllipse=r;function i(t){return new e(0,0,t.width,t.height)}e.fromSize=i;function a(t,n){return new e(t.x,t.y,n.width,n.height)}e.fromPositionAndSize=a})(B||={});var V=class e extends Pf{get center(){return new z((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(e,t,n,r){super(),typeof e==`number`&&typeof t==`number`?(this.start=new z(e,t),this.end=new z(n,r)):(this.start=z.create(e),this.end=z.create(t))}getCenter(){return this.center}round(e=0){return this.start.round(e),this.end.round(e),this}translate(e,t){return typeof e==`number`?(this.start.translate(e,t),this.end.translate(e,t)):(this.start.translate(e),this.end.translate(e)),this}rotate(e,t){return this.start.rotate(e,t),this.end.rotate(e,t),this}scale(e,t,n){return this.start.scale(e,t,n),this.end.scale(e,t,n),this}length(){return Math.sqrt(this.squaredLength())}squaredLength(){let e=this.start.x-this.end.x,t=this.start.y-this.end.y;return e*e+t*t}setLength(e){let t=this.length();if(!t)return this;let n=e/t;return this.scale(n,n,this.start)}parallel(e){let t=this.clone();if(!t.isDifferentiable())return t;let{start:n,end:r}=t,i=n.clone().rotate(270,r),a=r.clone().rotate(90,n);return n.move(a,e),r.move(i,e),t}vector(){return new z(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){let e=new z(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,e)}bbox(){let e=Math.min(this.start.x,this.end.x),t=Math.min(this.start.y,this.end.y),n=Math.max(this.start.x,this.end.x),r=Math.max(this.start.y,this.end.y);return new B(e,t,n-e,r-t)}bearing(){return this.start.bearing(this.end)}closestPoint(e){return this.pointAt(this.closestPointNormalizedLength(e))}closestPointLength(e){return this.closestPointNormalizedLength(e)*this.length()}closestPointTangent(e){return this.tangentAt(this.closestPointNormalizedLength(e))}closestPointNormalizedLength(t){let n=this.vector().dot(new e(this.start,t).vector()),r=Math.min(1,Math.max(0,n/this.squaredLength()));return Number.isNaN(r)?0:r}pointAt(e){let t=this.start,n=this.end;return e<=0?t.clone():e>=1?n.clone():t.lerp(n,e)}pointAtLength(e){let t=this.start,n=this.end,r=!0;e<0&&(r=!1,e=-e);let i=this.length();if(e>=i)return r?n.clone():t.clone();let a=(r?e:i-e)/i;return this.pointAt(a)}divideAt(t){let n=this.pointAt(t);return[new e(this.start,n),new e(n,this.end)]}divideAtLength(t){let n=this.pointAtLength(t);return[new e(this.start,n),new e(n,this.end)]}containsPoint(t){let n=this.start,r=this.end;if(n.cross(t,r)!==0)return!1;let i=this.length();return!(new e(n,t).length()>i||new e(t,r).length()>i)}intersect(e,t){let n=e.intersectsWithLine(this,t);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(e){let t=new z(this.end.x-this.start.x,this.end.y-this.start.y),n=new z(e.end.x-e.start.x,e.end.y-e.start.y),r=t.x*n.y-t.y*n.x,i=new z(e.start.x-this.start.x,e.start.y-this.start.y),a=i.x*n.y-i.y*n.x,o=i.x*t.y-i.y*t.x;if(r===0||a*r<0||o*r<0)return null;if(r>0){if(a>r||o>r)return null}else if(a<r||o<r)return null;return new z(this.start.x+a*t.x/r,this.start.y+a*t.y/r)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(e){let t=z.clone(e),n=this.start,r=this.end;return((r.x-n.x)*(t.y-n.y)-(r.y-n.y)*(t.x-n.x))/this.length()}pointSquaredDistance(e,t){let n=z.create(e,t);return this.closestPoint(n).squaredDistance(n)}pointDistance(e,t){let n=z.create(e,t);return this.closestPoint(n).distance(n)}tangentAt(t){if(!this.isDifferentiable())return null;let n=this.start,r=this.end,i=this.pointAt(t),a=new e(n,r);return a.translate(i.x-n.x,i.y-n.y),a}tangentAtLength(t){if(!this.isDifferentiable())return null;let n=this.start,r=this.end,i=this.pointAtLength(t),a=new e(n,r);return a.translate(i.x-n.x,i.y-n.y),a}relativeCcw(e,t){let n=z.create(e,t),r=n.x-this.start.x,i=n.y-this.start.y,a=this.end.x-this.start.x,o=this.end.y-this.start.y,s=r*o-i*a;return s===0&&(s=r*a+i*o,s>0&&(r-=a,i-=o,s=r*a+i*o,s<0&&(s=0))),s<0?-1:+(s>0)}equals(e){return e!=null&&this.start.x===e.start.x&&this.start.y===e.start.y&&this.end.x===e.end.x&&this.end.y===e.end.y}clone(){return new e(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(` `)}};(function(e){function t(t){return t!=null&&t instanceof e}e.isLine=t})(V||={});var Ff=class e extends Pf{get center(){return new z(this.x,this.y)}constructor(e,t,n,r){super(),this.x=e??0,this.y=t??0,this.a=n??0,this.b=r??0}bbox(){return B.fromEllipse(this)}getCenter(){return this.center}inflate(e,t){let n=e,r=t??e;return this.a+=2*n,this.b+=2*r,this}normalizedDistance(e,t){let n=z.create(e,t),r=n.x-this.x,i=n.y-this.y,a=this.a,o=this.b;return r*r/(a*a)+i*i/(o*o)}containsPoint(e,t){return this.normalizedDistance(e,t)<=1}intersectsWithLine(e){let t=[],n=this.a,r=this.b,i=e.start,a=e.end,o=e.vector(),s=i.diff(new z(this.x,this.y)),c=new z(o.x/(n*n),o.y/(r*r)),l=new z(s.x/(n*n),s.y/(r*r)),u=o.dot(c),d=o.dot(l),f=s.dot(l)-1,p=d*d-u*f;if(p<0)return null;if(p>0){let e=Math.sqrt(p),n=(-d-e)/u,r=(-d+e)/u;if((n<0||n>1)&&(r<0||r>1))return null;n>=0&&n<=1&&t.push(i.lerp(a,n)),r>=0&&r<=1&&t.push(i.lerp(a,r))}else{let e=-d/u;if(e>=0&&e<=1)t.push(i.lerp(a,e));else return null}return t}intersectsWithLineFromCenterToPoint(e,t=0){let n=z.clone(e);t&&n.rotate(t,this.getCenter());let r=n.x-this.x,i=n.y-this.y,a;if(r===0)return a=this.bbox().getNearestPointToPoint(n),t?a.rotate(-t,this.getCenter()):a;let o=i/r,s=o*o,c=this.a*this.a,l=this.b*this.b,u=Math.sqrt(1/(1/c+s/l));u=r<0?-u:u;let d=o*u;return a=new z(this.x+u,this.y+d),t?a.rotate(-t,this.getCenter()):a}tangentTheta(e){let t=z.clone(e),n=t.x,r=t.y,i=this.a,a=this.b,o=this.bbox().center,s=o.x,c=o.y,l=n>o.x+i/2,u=n<o.x-i/2,d,f;return l||u?(f=n>o.x?r-30:r+30,d=i*i/(n-s)-i*i*(r-c)*(f-c)/(a*a*(n-s))+s):(d=r>o.y?n+30:n-30,f=a*a/(r-c)-a*a*(n-s)*(d-s)/(i*i*(r-c))+c),new z(d,f).theta(t)}scale(e,t){return this.a*=e,this.b*=t,this}rotate(t,n){let r=B.fromEllipse(this);r.rotate(t,n);let i=e.fromRect(r);return this.a=i.a,this.b=i.b,this.x=i.x,this.y=i.y,this}translate(e,t){let n=z.create(e,t);return this.x+=n.x,this.y+=n.y,this}equals(e){return e!=null&&e.x===this.x&&e.y===this.y&&e.a===this.a&&e.b===this.b}clone(){return new e(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}};(function(e){function t(t){return t!=null&&t instanceof e}e.isEllipse=t})(Ff||={}),(function(e){function t(t,r,i,a){return t==null||typeof t==`number`?new e(t,r,i,a):n(t)}e.create=t;function n(t){return e.isEllipse(t)?t.clone():Array.isArray(t)?new e(t[0],t[1],t[2],t[3]):new e(t.x,t.y,t.a,t.b)}e.parse=n;function r(t){let n=t.center;return new e(n.x,n.y,t.width/2,t.height/2)}e.fromRect=r})(Ff||={});var If=RegExp(`^[\\s\\dLMCZz,.]*$`);function Lf(e){return typeof e==`string`&&If.test(e)}function Rf(e,t){return(e%t+t)%t}function zf(e,t,n,r,i){let a=[],o=e[e.length-1],s=t!=null&&t>0,c=t||0;if(r&&s){e=e.slice();let t=e[0],n=new z(o.x+(t.x-o.x)/2,o.y+(t.y-o.y)/2);e.splice(0,0,n)}let l=e[0],u=1;for(n?a.push(`M`,l.x,l.y):a.push(`L`,l.x,l.y);u<(r?e.length:e.length-1);){let t=e[Rf(u,e.length)],n=l.x-t.x,r=l.y-t.y;if(s&&(n!==0||r!==0)&&(i==null||i.indexOf(u-1)<0)){let i=Math.sqrt(n*n+r*r),o=n*Math.min(c,i/2)/i,s=r*Math.min(c,i/2)/i,l=t.x+o,d=t.y+s;a.push(`L`,l,d);let f=e[Rf(u+1,e.length)];for(;u<e.length-2&&Math.round(f.x-t.x)===0&&Math.round(f.y-t.y)===0;)f=e[Rf(u+2,e.length)],u+=1;n=f.x-t.x,r=f.y-t.y,i=Math.max(1,Math.sqrt(n*n+r*r));let p=n*Math.min(c,i/2)/i,m=r*Math.min(c,i/2)/i,h=t.x+p,g=t.y+m;a.push(`Q`,t.x,t.y,h,g),t=new z(h,g)}else a.push(`L`,t.x,t.y);l=t,u+=1}return r?a.push(`Z`):a.push(`L`,o.x,o.y),a.map(e=>typeof e==`string`?e:+e.toFixed(3)).join(` `)}function Bf(e,t={}){let n=[];return e&&e.length&&e.forEach(e=>{Array.isArray(e)?n.push({x:e[0],y:e[1]}):n.push({x:e.x,y:e.y})}),zf(n,t.round,t.initialMove==null||t.initialMove,t.close,t.exclude)}function Vf(e,t,n,r,i=0,a=0,o=0,s,c){if(n===0||r===0)return[];s-=e,c-=t,n=Math.abs(n),r=Math.abs(r);let l=-s/2,u=-c/2,d=Math.cos(i*Math.PI/180),f=Math.sin(i*Math.PI/180),p=d*l+f*u,m=-1*f*l+d*u,h=p*p,g=m*m,_=n*n,v=r*r,y=h/_+g/v,b;if(y>1)n=Math.sqrt(y)*n,r=Math.sqrt(y)*r,b=0;else{let e=1;a===o&&(e=-1),b=e*Math.sqrt((_*v-_*g-v*h)/(_*g+v*h))}let x=b*n*m/r,S=-1*b*r*p/n,C=d*x-f*S+s/2,w=f*x+d*S+c/2,T=Math.atan2((m-S)/r,(p-x)/n)-Math.atan2(0,1),E=T>=0?T:2*Math.PI+T;T=Math.atan2((-m-S)/r,(-p-x)/n)-Math.atan2((m-S)/r,(p-x)/n);let D=T>=0?T:2*Math.PI+T;o===0&&D>0?D-=2*Math.PI:o!==0&&D<0&&(D+=2*Math.PI);let ee=D*2/Math.PI,te=Math.ceil(ee<0?-1*ee:ee),ne=D/te,re=8/3*Math.sin(ne/4)*Math.sin(ne/4)/Math.sin(ne/2),ie=d*n,O=d*r,ae=f*n,oe=f*r,se=Math.cos(E),ce=Math.sin(E),le=-re*(ie*ce+oe*se),ue=-re*(ae*ce-O*se),de=0,fe=0,pe=[];for(let n=0;n<te;n+=1){E+=ne,se=Math.cos(E),ce=Math.sin(E),de=ie*se-oe*ce+C,fe=ae*se+O*ce+w;let r=-re*(ie*ce+oe*se),i=-re*(ae*ce-O*se),a=n*6;pe[a]=Number(le+e),pe[a+1]=Number(ue+t),pe[a+2]=Number(de-r+e),pe[a+3]=Number(fe-i+t),pe[a+4]=Number(de+e),pe[a+5]=Number(fe+t),le=de+r,ue=fe+i}return pe.map(e=>+e.toFixed(2))}function Hf(e,t,n,r,i=0,a=0,o=0,s,c){let l=[],u=Vf(e,t,n,r,i,a,o,s,c);if(u!=null)for(let e=0,t=u.length;e<t;e+=6)l.push(`C`,u[e],u[e+1],u[e+2],u[e+3],u[e+4],u[e+5]);return l.join(` `)}var Uf=class e extends Pf{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(t){if(super(),t!=null){if(typeof t==`string`)return e.parse(t);this.points=t.map(e=>z.create(e))}else this.points=[]}scale(e,t,n=new z){return this.points.forEach(r=>r.scale(e,t,n)),this}rotate(e,t){return this.points.forEach(n=>n.rotate(e,t)),this}translate(e,t){let n=z.create(e,t);return this.points.forEach(e=>e.translate(n.x,n.y)),this}round(e=0){return this.points.forEach(t=>t.round(e)),this}bbox(){if(this.points.length===0)return new B;let e=1/0,t=-1/0,n=1/0,r=-1/0,i=this.points;for(let a=0,o=i.length;a<o;a+=1){let o=i[a],s=o.x,c=o.y;s<e&&(e=s),s>t&&(t=s),c<n&&(n=c),c>r&&(r=c)}return new B(e,n,t-e,r-n)}closestPoint(e){let t=this.closestPointLength(e);return this.pointAtLength(t)}closestPointLength(e){let t=this.points,n=t.length;if(n===0||n===1)return 0;let r=0,i=0,a=1/0;for(let o=0,s=n-1;o<s;o+=1){let n=new V(t[o],t[o+1]),s=n.length(),c=n.closestPointNormalizedLength(e),l=n.pointAt(c).squaredDistance(e);l<a&&(a=l,i=r+c*s),r+=s}return i}closestPointNormalizedLength(e){let t=this.length();return t===0?0:this.closestPointLength(e)/t}closestPointTangent(e){let t=this.closestPointLength(e);return this.tangentAtLength(t)}containsPoint(e){if(this.points.length===0)return!1;let t=z.clone(e),n=t.x,r=t.y,i=this.points,a=i.length,o=a-1,s=0;for(let c=0;c<a;c+=1){let a=i[o],l=i[c];if(t.equals(a))return!0;let u=new V(a,l);if(u.containsPoint(e))return!0;if(r<=a.y&&r>l.y||r>a.y&&r<=l.y){let t=a.x-n>l.x-n?a.x-n:l.x-n;if(t>=0){let i=new z(n+t,r),a=new V(e,i);u.intersectsWithLine(a)&&(s+=1)}}o=c}return s%2==1}intersectsWithLine(e){let t=[];for(let n=0,r=this.points.length-1;n<r;n+=1){let r=this.points[n],i=this.points[n+1],a=e.intersectsWithLine(new V(r,i));a&&t.push(a)}return t.length>0?t:null}isDifferentiable(){for(let e=0,t=this.points.length-1;e<t;e+=1){let t=this.points[e],n=this.points[e+1];if(new V(t,n).isDifferentiable())return!0}return!1}length(){let e=0;for(let t=0,n=this.points.length-1;t<n;t+=1){let n=this.points[t],r=this.points[t+1];e+=n.distance(r)}return e}pointAt(e){let t=this.points,n=t.length;if(n===0)return null;if(n===1||e<=0)return t[0].clone();if(e>=1)return t[n-1].clone();let r=this.length()*e;return this.pointAtLength(r)}pointAtLength(e){let t=this.points,n=t.length;if(n===0)return null;if(n===1)return t[0].clone();let r=!0;e<0&&(r=!1,e=-e);let i=0;for(let a=0,o=n-1;a<o;a+=1){let n=r?a:o-1-a,s=t[n],c=t[n+1],l=new V(s,c),u=s.distance(c);if(e<=i+u)return l.pointAtLength((r?1:-1)*(e-i));i+=u}return(r?t[n-1]:t[0]).clone()}tangentAt(e){let t=this.points.length;if(t===0||t===1)return null;e<0&&(e=0),e>1&&(e=1);let n=this.length()*e;return this.tangentAtLength(n)}tangentAtLength(e){let t=this.points,n=t.length;if(n===0||n===1)return null;let r=!0;e<0&&(r=!1,e=-e);let i,a=0;for(let o=0,s=n-1;o<s;o+=1){let n=r?o:s-1-o,c=t[n],l=t[n+1],u=new V(c,l),d=c.distance(l);if(u.isDifferentiable()){if(e<=a+d)return u.tangentAtLength((r?1:-1)*(e-a));i=u}a+=d}if(i){let e=+!!r;return i.tangentAt(e)}return null}simplify(e={}){let t=this.points;if(t.length<3)return this;let n=e.threshold||0,r=0;for(;t[r+2];){let e=r,i=r+1,a=r+2,o=t[e],s=t[i],c=t[a];new V(o,c).closestPoint(s).distance(s)<=n?t.splice(i,1):r+=1}return this}toHull(){let t=this.points,n=t.length;if(n===0)return new e;let r=t[0];for(let e=1;e<n;e+=1)(t[e].y<r.y||t[e].y===r.y&&t[e].x>r.x)&&(r=t[e]);let i=[];for(let e=0;e<n;e+=1){let n=r.theta(t[e]);n===0&&(n=360),i.push([t[e],e,n])}if(i.sort((e,t)=>{let n=e[2]-t[2];return n===0&&(n=t[1]-e[1]),n}),i.length>2){let e=i[i.length-1];i.unshift(e)}let a={},o=[],s=e=>`${e[0].toString()}@${e[1]}`;for(;i.length!==0;){let e=i.pop(),t=e[0];if(a[s(e)])continue;let n=!1;for(;!n;)if(o.length<2)o.push(e),n=!0;else{let r=o.pop(),c=r[0],l=o.pop(),u=l[0],d=u.cross(c,t);if(d<0)o.push(l),o.push(r),o.push(e),n=!0;else if(d===0){let e=1e-10,n=c.angleBetween(u,t);Math.abs(n-180)<e||c.equals(t)||u.equals(c)?(a[s(r)]=c,o.push(l)):Math.abs((n+1)%360-1)<e&&(o.push(l),i.push(r))}else a[s(r)]=c,o.push(l)}}o.length>2&&o.pop();let c,l=-1;for(let e=0,t=o.length;e<t;e+=1){let t=o[e][1];(c===void 0||t<c)&&(c=t,l=e)}let u=[];if(l>0){let e=o.slice(l),t=o.slice(0,l);u=e.concat(t)}else u=o;let d=[];for(let e=0,t=u.length;e<t;e+=1)d.push(u[e][0]);return new e(d)}equals(e){return e==null||e.points.length!==this.points.length?!1:e.points.every((e,t)=>e.equals(this.points[t]))}clone(){return new e(this.points.map(e=>e.clone()))}toJSON(){return this.points.map(e=>e.toJSON())}serialize(){return this.points.map(e=>`${e.serialize()}`).join(` `)}};(function(e){function t(t){return t!=null&&t instanceof e}e.isPolyline=t})(Uf||={}),(function(e){function t(t){let n=t.trim();if(n===``)return new e;let r=[],i=n.split(/\s*,\s*|\s+/);for(let e=0,t=i.length;e<t;e+=2)r.push({x:+i[e],y:+i[e+1]});return new e(r)}e.parse=t})(Uf||={});var Wf=class e extends Pf{constructor(e,t,n,r){super(),this.PRECISION=3,this.start=z.create(e),this.controlPoint1=z.create(t),this.controlPoint2=z.create(n),this.end=z.create(r)}bbox(){let e=this.start,t=this.controlPoint1,n=this.controlPoint2,r=this.end,i=e.x,a=e.y,o=t.x,s=t.y,c=n.x,l=n.y,u=r.x,d=r.y,f=[],p=[],m=[[],[]],h,g,_,v,y,b,x,S;for(let e=0;e<2;e+=1)if(e===0?(g=6*i-12*o+6*c,h=-3*i+9*o-9*c+3*u,_=3*o-3*i):(g=6*a-12*s+6*l,h=-3*a+9*s-9*l+3*d,_=3*s-3*a),Math.abs(h)<1e-12){if(Math.abs(g)<1e-12)continue;v=-_/g,v>0&&v<1&&p.push(v)}else x=g*g-4*_*h,S=Math.sqrt(x),!(x<0)&&(y=(-g+S)/(2*h),y>0&&y<1&&p.push(y),b=(-g-S)/(2*h),b>0&&b<1&&p.push(b));let C,w,T,E=p.length,D=E;for(;E;)--E,v=p[E],T=1-v,C=T*T*T*i+3*T*T*v*o+3*T*v*v*c+v*v*v*u,m[0][E]=C,w=T*T*T*a+3*T*T*v*s+3*T*v*v*l+v*v*v*d,m[1][E]=w,f[E]={X:C,Y:w};p[D]=0,p[D+1]=1,f[D]={X:i,Y:a},f[D+1]={X:u,Y:d},m[0][D]=i,m[1][D]=a,m[0][D+1]=u,m[1][D+1]=d,p.length=D+2,m[0].length=D+2,m[1].length=D+2,f.length=D+2;let ee=Math.min.apply(null,m[0]),te=Math.min.apply(null,m[1]),ne=Math.max.apply(null,m[0]),re=Math.max.apply(null,m[1]);return new B(ee,te,ne-ee,re-te)}closestPoint(e,t={}){return this.pointAtT(this.closestPointT(e,t))}closestPointLength(e,t={}){let n=this.getOptions(t);return this.lengthAtT(this.closestPointT(e,n),n)}closestPointNormalizedLength(e,t={}){let n=this.getOptions(t),r=this.closestPointLength(e,n);if(!r)return 0;let i=this.length(n);return i===0?0:r/i}closestPointT(e,t={}){let n=this.getPrecision(t),r=this.getDivisions(t),i=10**-n,a=null,o=0,s=0,c=0,l=0,u=0,d=null,f=r.length,p=f>0?1/f:0;for(r.forEach((t,n)=>{let r=t.start.distance(e),i=t.end.distance(e),f=r+i;(d==null||f<d)&&(a=t,o=n*p,s=(n+1)*p,c=r,l=i,d=f,u=t.endpointDistance())});;){let t=c?Math.abs(c-l)/c:0,n=l==null?0:Math.abs(c-l)/l,r=t<i||n<i,d=!c||c<u*i,f=!l||l<u*i;if(r||d||f)return c<=l?o:s;let m=a.divide(.5);p/=2;let h=m[0].start.distance(e),g=m[0].end.distance(e),_=h+g,v=m[1].start.distance(e),y=m[1].end.distance(e);_<=v+y?(a=m[0],s-=p,c=h,l=g):(a=m[1],o+=p,c=v,l=y)}}closestPointTangent(e,t={}){return this.tangentAtT(this.closestPointT(e,t))}containsPoint(e,t={}){return this.toPolyline(t).containsPoint(e)}divideAt(e,t={}){if(e<=0)return this.divideAtT(0);if(e>=1)return this.divideAtT(1);let n=this.tAt(e,t);return this.divideAtT(n)}divideAtLength(e,t={}){let n=this.tAtLength(e,t);return this.divideAtT(n)}divide(e){return this.divideAtT(e)}divideAtT(t){let n=this.start,r=this.controlPoint1,i=this.controlPoint2,a=this.end;if(t<=0)return[new e(n,n,n,n),new e(n,r,i,a)];if(t>=1)return[new e(n,r,i,a),new e(a,a,a,a)];let o=this.getSkeletonPoints(t),s=o.startControlPoint1,c=o.startControlPoint2,l=o.divider,u=o.dividerControlPoint1,d=o.dividerControlPoint2;return[new e(n,s,c,l),new e(l,u,d,a)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(e){let t=this.start,n=this.controlPoint1,r=this.controlPoint2,i=this.end;if(e<=0)return{startControlPoint1:t.clone(),startControlPoint2:t.clone(),divider:t.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:r.clone()};if(e>=1)return{startControlPoint1:n.clone(),startControlPoint2:r.clone(),divider:i.clone(),dividerControlPoint1:i.clone(),dividerControlPoint2:i.clone()};let a=new V(t,n).pointAt(e),o=new V(n,r).pointAt(e),s=new V(r,i).pointAt(e),c=new V(a,o).pointAt(e),l=new V(o,s).pointAt(e);return{startControlPoint1:a,startControlPoint2:c,divider:new V(c,l).pointAt(e),dividerControlPoint1:l,dividerControlPoint2:s}}getSubdivisions(t={}){let n=this.getPrecision(t),r=[new e(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(n===0)return r;let i=this.endpointDistance(),a=10**-n,o=0;for(;;){o+=1;let e=[];r.forEach(t=>{let n=t.divide(.5);e.push(n[0],n[1])});let t=e.reduce((e,t)=>e+t.endpointDistance(),0),n=t===0?0:(t-i)/t;if(o>1&&n<a)return e;r=e,i=t}}length(e={}){return this.getDivisions(e).reduce((e,t)=>e+t.endpointDistance(),0)}lengthAtT(e,t={}){if(e<=0)return 0;let n=t.precision===void 0?this.PRECISION:t.precision;return this.divide(e)[0].length({precision:n})}pointAt(e,t={}){if(e<=0)return this.start.clone();if(e>=1)return this.end.clone();let n=this.tAt(e,t);return this.pointAtT(n)}pointAtLength(e,t={}){let n=this.tAtLength(e,t);return this.pointAtT(n)}pointAtT(e){return e<=0?this.start.clone():e>=1?this.end.clone():this.getSkeletonPoints(e).divider}isDifferentiable(){let e=this.start,t=this.controlPoint1,n=this.controlPoint2,r=this.end;return!(e.equals(t)&&t.equals(n)&&n.equals(r))}tangentAt(e,t={}){if(!this.isDifferentiable())return null;e<0?e=0:e>1&&(e=1);let n=this.tAt(e,t);return this.tangentAtT(n)}tangentAtLength(e,t={}){if(!this.isDifferentiable())return null;let n=this.tAtLength(e,t);return this.tangentAtT(n)}tangentAtT(e){if(!this.isDifferentiable())return null;e<0&&(e=0),e>1&&(e=1);let t=this.getSkeletonPoints(e),n=t.startControlPoint2,r=t.dividerControlPoint1,i=t.divider,a=new V(n,r);return a.translate(i.x-n.x,i.y-n.y),a}getPrecision(e={}){return e.precision==null?this.PRECISION:e.precision}getDivisions(e={}){if(e.subdivisions!=null)return e.subdivisions;let t=this.getPrecision(e);return this.getSubdivisions({precision:t})}getOptions(e={}){return{precision:this.getPrecision(e),subdivisions:this.getDivisions(e)}}tAt(e,t={}){if(e<=0)return 0;if(e>=1)return 1;let n=this.getOptions(t),r=this.length(n)*e;return this.tAtLength(r,n)}tAtLength(e,t={}){let n=!0;e<0&&(n=!1,e=-e);let r=this.getPrecision(t),i=this.getDivisions(t),a={precision:r,subdivisions:i},o=null,s,c,l=0,u=0,d=0,f=i.length,p=f>0?1/f:0;for(let t=0;t<f;t+=1){let r=n?t:f-1-t,a=i[t],m=a.endpointDistance();if(e<=d+m){o=a,s=r*p,c=(r+1)*p,l=n?e-d:m+d-e,u=n?m+d-e:e-d;break}d+=m}if(o==null)return+!!n;let m=this.length(a),h=10**-r;for(;;){let e;if(e=m===0?0:l/m,e<h)return s;if(e=m===0?0:u/m,e<h)return c;let t,n,r=o.divide(.5);p/=2;let i=r[0].endpointDistance(),a=r[1].endpointDistance();l<=i?(o=r[0],c-=p,t=l,n=i-t):(o=r[1],s+=p,t=l-i,n=a-t),l=t,u=n}}toPoints(e={}){let t=this.getDivisions(e),n=[t[0].start.clone()];return t.forEach(e=>n.push(e.end.clone())),n}toPolyline(e={}){return new Uf(this.toPoints(e))}scale(e,t,n){return this.start.scale(e,t,n),this.controlPoint1.scale(e,t,n),this.controlPoint2.scale(e,t,n),this.end.scale(e,t,n),this}rotate(e,t){return this.start.rotate(e,t),this.controlPoint1.rotate(e,t),this.controlPoint2.rotate(e,t),this.end.rotate(e,t),this}translate(e,t){return typeof e==`number`?(this.start.translate(e,t),this.controlPoint1.translate(e,t),this.controlPoint2.translate(e,t),this.end.translate(e,t)):(this.start.translate(e),this.controlPoint1.translate(e),this.controlPoint2.translate(e),this.end.translate(e)),this}equals(e){return e!=null&&this.start.equals(e.start)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)&&this.end.equals(e.end)}clone(){return new e(this.start,this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.controlPoint1.serialize(),this.controlPoint2.serialize(),this.end.serialize()].join(` `)}};(function(e){function t(t){return t!=null&&t instanceof e}e.isCurve=t})(Wf||={}),(function(e){function t(e){let t=e.length,n=[],r=[],i=2;n[0]=e[0]/i;for(let a=1;a<t;a+=1)r[a]=1/i,i=(a<t-1?4:3.5)-r[a],n[a]=(e[a]-n[a-1])/i;for(let e=1;e<t;e+=1)n[t-e-1]-=r[t-e]*n[t-e];return n}function n(e){let n=e.map(e=>z.clone(e)),r=[],i=[],a=n.length-1;if(a===1)return r[0]=new z((2*n[0].x+n[1].x)/3,(2*n[0].y+n[1].y)/3),i[0]=new z(2*r[0].x-n[0].x,2*r[0].y-n[0].y),[r,i];let o=[];for(let e=1;e<a-1;e+=1)o[e]=4*n[e].x+2*n[e+1].x;o[0]=n[0].x+2*n[1].x,o[a-1]=(8*n[a-1].x+n[a].x)/2;let s=t(o);for(let e=1;e<a-1;e+=1)o[e]=4*n[e].y+2*n[e+1].y;o[0]=n[0].y+2*n[1].y,o[a-1]=(8*n[a-1].y+n[a].y)/2;let c=t(o);for(let e=0;e<a;e+=1)r.push(new z(s[e],c[e])),e<a-1?i.push(new z(2*n[e+1].x-s[e+1],2*n[e+1].y-c[e+1])):i.push(new z((n[a].x+s[a-1])/2,(n[a].y+c[a-1])/2));return[r,i]}function r(t){if(t==null||Array.isArray(t)&&t.length<2)throw Error(`At least 2 points are required`);let r=n(t),i=[];for(let n=0,a=r[0].length;n<a;n+=1){let a=new z(r[0][n].x,r[0][n].y),o=new z(r[1][n].x,r[1][n].y);i.push(new e(t[n],a,o,t[n+1]))}return i}e.throughPoints=r})(Wf||={});var Gf=class extends Pf{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(this.previousSegment==null)throw Error(`Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)`);return this.previousSegment.end}closestPointT(e,t){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(e);throw Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.")}lengthAtT(e,t){if(e<=0)return 0;let n=this.length();return e>=1?n:n*e}divideAtT(e){if(this.divideAt)return this.divideAt(e);throw Error("Neither `divideAtT` nor `divideAt` method is implemented.")}pointAtT(e){if(this.pointAt)return this.pointAt(e);throw Error("Neither `pointAtT` nor `pointAt` method is implemented.")}tangentAtT(e){if(this.tangentAt)return this.tangentAt(e);throw Error("Neither `tangentAtT` nor `tangentAt` method is implemented.")}},Kf=class e extends Gf{constructor(e,t){super(),this.endPoint=V.isLine(e)?e.end.clone().round(2):z.create(e,t).round(2)}get type(){return`L`}get line(){return new V(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(e){return this.line.closestPoint(e)}closestPointLength(e){return this.line.closestPointLength(e)}closestPointNormalizedLength(e){return this.line.closestPointNormalizedLength(e)}closestPointTangent(e){return this.line.closestPointTangent(e)}length(){return this.line.length()}divideAt(t){let n=this.line.divideAt(t);return[new e(n[0]),new e(n[1])]}divideAtLength(t){let n=this.line.divideAtLength(t);return[new e(n[0]),new e(n[1])]}getSubdivisions(){return[]}pointAt(e){return this.line.pointAt(e)}pointAtLength(e){return this.line.pointAtLength(e)}tangentAt(e){return this.line.tangentAt(e)}tangentAtLength(e){return this.line.tangentAtLength(e)}isDifferentiable(){return this.previousSegment!=null&&!this.start.equals(this.end)}clone(){return new e(this.end)}scale(e,t,n){return this.end.scale(e,t,n),this}rotate(e,t){return this.end.rotate(e,t),this}translate(e,t){return typeof e==`number`?this.end.translate(e,t):this.end.translate(e),this}equals(e){return this.type===e.type&&this.start.equals(e.start)&&this.end.equals(e.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){let e=this.end;return`${this.type} ${e.x} ${e.y}`}};(function(e){function t(...t){let n=t.length,r=t[0];if(V.isLine(r))return new e(r);if(z.isPointLike(r))return n===1?new e(r):t.map(t=>new e(t));if(n===2)return new e(+t[0],+t[1]);let i=[];for(let r=0;r<n;r+=2){let n=+t[r],a=+t[r+1];i.push(new e(n,a))}return i}e.create=t})(Kf||={});var qf=class e extends Gf{get end(){if(!this.subpathStartSegment)throw Error(`Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)`);return this.subpathStartSegment.end}get type(){return`Z`}get line(){return new V(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(e){return this.line.closestPoint(e)}closestPointLength(e){return this.line.closestPointLength(e)}closestPointNormalizedLength(e){return this.line.closestPointNormalizedLength(e)}closestPointTangent(e){return this.line.closestPointTangent(e)}length(){return this.line.length()}divideAt(e){let t=this.line.divideAt(e);return[t[1].isDifferentiable()?new Kf(t[0]):this.clone(),new Kf(t[1])]}divideAtLength(e){let t=this.line.divideAtLength(e);return[t[1].isDifferentiable()?new Kf(t[0]):this.clone(),new Kf(t[1])]}getSubdivisions(){return[]}pointAt(e){return this.line.pointAt(e)}pointAtLength(e){return this.line.pointAtLength(e)}tangentAt(e){return this.line.tangentAt(e)}tangentAtLength(e){return this.line.tangentAtLength(e)}isDifferentiable(){return!this.previousSegment||!this.subpathStartSegment?!1:!this.start.equals(this.end)}scale(){return this}rotate(){return this}translate(){return this}equals(e){return this.type===e.type&&this.start.equals(e.start)&&this.end.equals(e.end)}clone(){return new e}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}};(function(e){function t(){return new e}e.create=t})(qf||={});var Jf=class e extends Gf{constructor(e,t){super(),this.isVisible=!1,this.isSubpathStart=!0,this.endPoint=V.isLine(e)||Wf.isCurve(e)?e.end.clone().round(2):z.create(e,t).round(2)}get start(){throw Error(`Illegal access. Moveto segments should not need a start property.`)}get type(){return`M`}bbox(){return null}closestPoint(){return this.end.clone()}closestPointLength(){return 0}closestPointNormalizedLength(){return 0}closestPointT(){return 1}closestPointTangent(){return null}length(){return 0}lengthAtT(){return 0}divideAt(){return[this.clone(),this.clone()]}divideAtLength(){return[this.clone(),this.clone()]}getSubdivisions(){return[]}pointAt(){return this.end.clone()}pointAtLength(){return this.end.clone()}pointAtT(){return this.end.clone()}tangentAt(){return null}tangentAtLength(){return null}tangentAtT(){return null}isDifferentiable(){return!1}scale(e,t,n){return this.end.scale(e,t,n),this}rotate(e,t){return this.end.rotate(e,t),this}translate(e,t){return typeof e==`number`?this.end.translate(e,t):this.end.translate(e),this}clone(){return new e(this.end)}equals(e){return this.type===e.type&&this.end.equals(e.end)}toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){let e=this.end;return`${this.type} ${e.x} ${e.y}`}};(function(e){function t(...t){let n=t.length,r=t[0];if(V.isLine(r)||Wf.isCurve(r))return new e(r);if(z.isPointLike(r)){if(n===1)return new e(r);let i=[];for(let r=0;r<n;r+=1)r===0?i.push(new e(t[r])):i.push(new Kf(t[r]));return i}if(n===2)return new e(+t[0],+t[1]);let i=[];for(let r=0;r<n;r+=2){let n=+t[r],a=+t[r+1];r===0?i.push(new e(n,a)):i.push(new Kf(n,a))}return i}e.create=t})(Jf||={});var Yf=class e extends Gf{constructor(e,t,n,r,i,a){super(),Wf.isCurve(e)?(this.controlPoint1=e.controlPoint1.clone().round(2),this.controlPoint2=e.controlPoint2.clone().round(2),this.endPoint=e.end.clone().round(2)):typeof e==`number`?(this.controlPoint1=new z(e,t).round(2),this.controlPoint2=new z(n,r).round(2),this.endPoint=new z(i,a).round(2)):(this.controlPoint1=z.create(e).round(2),this.controlPoint2=z.create(t).round(2),this.endPoint=z.create(n).round(2))}get type(){return`C`}get curve(){return new Wf(this.start,this.controlPoint1,this.controlPoint2,this.end)}bbox(){return this.curve.bbox()}closestPoint(e){return this.curve.closestPoint(e)}closestPointLength(e){return this.curve.closestPointLength(e)}closestPointNormalizedLength(e){return this.curve.closestPointNormalizedLength(e)}closestPointTangent(e){return this.curve.closestPointTangent(e)}length(){return this.curve.length()}divideAt(t,n={}){let r=this.curve.divideAt(t,n);return[new e(r[0]),new e(r[1])]}divideAtLength(t,n={}){let r=this.curve.divideAtLength(t,n);return[new e(r[0]),new e(r[1])]}divideAtT(t){let n=this.curve.divideAtT(t);return[new e(n[0]),new e(n[1])]}getSubdivisions(){return[]}pointAt(e){return this.curve.pointAt(e)}pointAtLength(e){return this.curve.pointAtLength(e)}tangentAt(e){return this.curve.tangentAt(e)}tangentAtLength(e){return this.curve.tangentAtLength(e)}isDifferentiable(){if(!this.previousSegment)return!1;let e=this.start,t=this.controlPoint1,n=this.controlPoint2,r=this.end;return!(e.equals(t)&&t.equals(n)&&n.equals(r))}scale(e,t,n){return this.controlPoint1.scale(e,t,n),this.controlPoint2.scale(e,t,n),this.end.scale(e,t,n),this}rotate(e,t){return this.controlPoint1.rotate(e,t),this.controlPoint2.rotate(e,t),this.end.rotate(e,t),this}translate(e,t){return typeof e==`number`?(this.controlPoint1.translate(e,t),this.controlPoint2.translate(e,t),this.end.translate(e,t)):(this.controlPoint1.translate(e),this.controlPoint2.translate(e),this.end.translate(e)),this}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)}clone(){return new e(this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){let e=this.controlPoint1,t=this.controlPoint2,n=this.end;return[this.type,e.x,e.y,t.x,t.y,n.x,n.y].join(` `)}};(function(e){function t(...t){let n=t.length,r=t[0];if(Wf.isCurve(r))return new e(r);if(z.isPointLike(r)){if(n===3)return new e(t[0],t[1],t[2]);let r=[];for(let i=0;i<n;i+=3)r.push(new e(t[i],t[i+1],t[i+2]));return r}if(n===6)return new e(t[0],t[1],t[2],t[3],t[4],t[5]);let i=[];for(let r=0;r<n;r+=6)i.push(new e(t[r],t[r+1],t[r+2],t[r+3],t[r+4],t[r+5]));return i}e.create=t})(Yf||={});function Xf(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function Zf(e,t,n,r,i,a){let o=1/3,s=2/3;return[o*e+s*n,o*t+s*r,o*i+s*n,o*a+s*r,i,a]}function Qf(e,t,n,r,i,a,o,s,c,l){let u=Math.PI*120/180,d=Math.PI/180*(+i||0),f=[],p,m,h,g,_;if(l)m=l[0],h=l[1],g=l[2],_=l[3];else{p=Xf(e,t,-d),e=p.x,t=p.y,p=Xf(s,c,-d),s=p.x,c=p.y;let i=(e-s)/2,l=(t-c)/2,u=i*i/(n*n)+l*l/(r*r);u>1&&(u=Math.sqrt(u),n=u*n,r=u*r);let f=n*n,v=r*r,y=(a===o?-1:1)*Math.sqrt(Math.abs((f*v-f*l*l-v*i*i)/(f*l*l+v*i*i)));g=y*n*l/r+(e+s)/2,_=y*-r*i/n+(t+c)/2,m=Math.asin((t-_)/r),h=Math.asin((c-_)/r),m=e<g?Math.PI-m:m,h=s<g?Math.PI-h:h,m<0&&(m=Math.PI*2+m),h<0&&(h=Math.PI*2+h),o&&m>h&&(m-=Math.PI*2),!o&&h>m&&(h-=Math.PI*2)}let v=h-m;if(Math.abs(v)>u){let e=h,t=s,a=c;h=m+u*(o&&h>m?1:-1),s=g+n*Math.cos(h),c=_+r*Math.sin(h),f=Qf(s,c,n,r,i,0,o,t,a,[h,e,g,_])}v=h-m;let y=Math.cos(m),b=Math.sin(m),x=Math.cos(h),S=Math.sin(h),C=Math.tan(v/4),w=4/3*(n*C),T=4/3*(r*C),E=[e,t],D=[e+w*b,t-T*y],ee=[s+w*S,c-T*x],te=[s,c];if(D[0]=2*E[0]-D[0],D[1]=2*E[1]-D[1],l)return[D,ee,te].concat(f);{f=[D,ee,te].concat(f).join().split(`,`);let e=[],t=f.length;for(let n=0;n<t;n+=1)e[n]=n%2?Xf(+f[n-1],+f[n],d).y:Xf(+f[n],+f[n+1],d).x;return e}}function $f(e){if(!e)return null;let t=`
4
+ \v\f\r \xA0 ᠎              \u2028\u2029`,n=RegExp(`([a-z])[${t},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${t}]*,?[${t}]*)+)`,`ig`),r=RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${t}]*,?[${t}]*`,`ig`),i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},a=[];return e.replace(n,(e,t,n)=>{let o=[],s=t.toLowerCase();n.replace(r,(e,t)=>(t&&o.push(+t),e)),s===`m`&&o.length>2&&(a.push([t,...o.splice(0,2)]),s=`l`,t=t===`m`?`l`:`L`);let c=i[s];for(;o.length>=c&&(a.push([t,...o.splice(0,c)]),c););return e}),a}function ep(e){let t=$f(e);if(!t||!t.length)return[[`M`,0,0]];let n=0,r=0,i=0,a=0,o=[];for(let e=0,s=t.length;e<s;e+=1){let s=[];o.push(s);let c=t[e],l=c[0];if(l!==l.toUpperCase())switch(s[0]=l.toUpperCase(),s[0]){case`A`:s[1]=c[1],s[2]=c[2],s[3]=c[3],s[4]=c[4],s[5]=c[5],s[6]=+c[6]+n,s[7]=+c[7]+r;break;case`V`:s[1]=+c[1]+r;break;case`H`:s[1]=+c[1]+n;break;case`M`:i=+c[1]+n,a=+c[2]+r;for(let e=1,t=c.length;e<t;e+=1)s[e]=+c[e]+(e%2?n:r);break;default:for(let e=1,t=c.length;e<t;e+=1)s[e]=+c[e]+(e%2?n:r)}else for(let e=0,t=c.length;e<t;e+=1)s[e]=c[e];switch(s[0]){case`Z`:n=+i,r=+a;break;case`H`:n=s[1];break;case`V`:r=s[1];break;case`M`:i=s[s.length-2],a=s[s.length-1],n=s[s.length-2],r=s[s.length-1];break;default:n=s[s.length-2],r=s[s.length-1]}}return o}function tp(e){let t=ep(e),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function r(e,t,n){let r,i;if(!e)return[`C`,t.x,t.y,t.x,t.y,t.x,t.y];switch(e[0]in{T:1,Q:1}||(t.qx=null,t.qy=null),e[0]){case`M`:t.X=e[1],t.Y=e[2];break;case`A`:return parseFloat(e[1])===0||parseFloat(e[2])===0?[`L`,e[6],e[7]]:[`C`].concat(Qf.apply(0,[t.x,t.y].concat(e.slice(1))));case`S`:return n===`C`||n===`S`?(r=t.x*2-t.bx,i=t.y*2-t.by):(r=t.x,i=t.y),[`C`,r,i].concat(e.slice(1));case`T`:return n===`Q`||n===`T`?(t.qx=t.x*2-t.qx,t.qy=t.y*2-t.qy):(t.qx=t.x,t.qy=t.y),[`C`].concat(Zf(t.x,t.y,t.qx,t.qy,e[1],e[2]));case`Q`:return t.qx=e[1],t.qy=e[2],[`C`].concat(Zf(t.x,t.y,e[1],e[2],e[3],e[4]));case`H`:return[`L`].concat(e[1],t.y);case`V`:return[`L`].concat(t.x,e[1])}return e}function i(e,n){if(e[n].length>7){e[n].shift();let r=e[n];for(;r.length;)a[n]=`A`,n+=1,e.splice(n,0,[`C`].concat(r.splice(0,6)));e.splice(n,1),s=t.length}}let a=[],o=``,s=t.length;for(let e=0;e<s;e+=1){let s=``;t[e]&&(s=t[e][0]),s!==`C`&&(a[e]=s,e>0&&(o=a[e-1])),t[e]=r(t[e],n,o),a[e]!==`A`&&s===`C`&&(a[e]=`C`),i(t,e);let c=t[e],l=c.length;n.x=c[l-2],n.y=c[l-1],n.bx=parseFloat(c[l-4])||n.x,n.by=parseFloat(c[l-3])||n.y}return t[0][0]&&t[0][0]===`M`||t.unshift([`M`,0,0]),t}function np(e){return tp(e).map(e=>e.map(e=>typeof e==`string`?e:R.round(e,2))).join(`,`).split(`,`).join(` `)}var H=class e extends Pf{constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t)){if(V.isLine(t[0])||Wf.isCurve(t[0])){let n=null;t.forEach((t,r)=>{r===0&&this.appendSegment(e.createSegment(`M`,t.start)),n!=null&&!n.end.equals(t.start)&&this.appendSegment(e.createSegment(`M`,t.start)),V.isLine(t)?this.appendSegment(e.createSegment(`L`,t.end)):Wf.isCurve(t)&&this.appendSegment(e.createSegment(`C`,t.controlPoint1,t.controlPoint2,t.end)),n=t})}else t.forEach(e=>{e.isSegment&&this.appendSegment(e)})}else t!=null&&(V.isLine(t)?(this.appendSegment(e.createSegment(`M`,t.start)),this.appendSegment(e.createSegment(`L`,t.end))):Wf.isCurve(t)?(this.appendSegment(e.createSegment(`M`,t.start)),this.appendSegment(e.createSegment(`C`,t.controlPoint1,t.controlPoint2,t.end))):Uf.isPolyline(t)?t.points&&t.points.length&&t.points.forEach((t,n)=>{let r=n===0?e.createSegment(`M`,t):e.createSegment(`L`,t);this.appendSegment(r)}):t.isSegment&&this.appendSegment(t))}get start(){let e=this.segments,t=e.length;if(t===0)return null;for(let n=0;n<t;n+=1){let t=e[n];if(t.isVisible)return t.start}return e[t-1].end}get end(){let e=this.segments,t=e.length;if(t===0)return null;for(let n=t-1;n>=0;--n){let t=e[n];if(t.isVisible)return t.end}return e[t-1].end}moveTo(...e){return this.appendSegment(Jf.create.call(null,...e))}lineTo(...e){return this.appendSegment(Kf.create.call(null,...e))}curveTo(...e){return this.appendSegment(Yf.create.call(null,...e))}arcTo(e,t,n,r,i,a,o){let s=this.end||new z,c=typeof a==`number`?Vf(s.x,s.y,e,t,n,r,i,a,o):Vf(s.x,s.y,e,t,n,r,i,a.x,a.y);if(c!=null)for(let e=0,t=c.length;e<t;e+=6)this.curveTo(c[e],c[e+1],c[e+2],c[e+3],c[e+4],c[e+5]);return this}quadTo(t,n,r,i){let a=this.end||new z,o=[`M`,a.x,a.y];if(typeof t==`number`)o.push(`Q`,t,n,r,i);else{let e=n;o.push(`Q`,t.x,t.y,e.x,e.y)}let s=e.parse(o.join(` `));return this.appendSegment(s.segments.slice(1)),this}close(){return this.appendSegment(qf.create())}drawPoints(t,n={}){let r=Bf(t,n),i=e.parse(r);i&&i.segments&&this.appendSegment(i.segments)}bbox(){let e=this.segments,t=e.length;if(t===0)return null;let n;for(let r=0;r<t;r+=1){let t=e[r];if(t.isVisible){let e=t.bbox();e!=null&&(n=n?n.union(e):e)}}if(n!=null)return n;let r=e[t-1];return new B(r.end.x,r.end.y,0,0)}appendSegment(e){let t=this.segments.length,n=t===0?null:this.segments[t-1],r;if(Array.isArray(e))for(let t=0,i=e.length;t<i;t+=1){let i=e[t];r=this.prepareSegment(i,n,null),this.segments.push(r),n=r}else e!=null&&e.isSegment&&(r=this.prepareSegment(e,n,null),this.segments.push(r));return this}insertSegment(e,t){let n=this.segments.length;if(e<0&&(e=n+e+1),e>n||e<0)throw Error(`Index out of range.`);let r,i=null,a=null;if(n!==0&&(e>=1?(i=this.segments[e-1],a=i.nextSegment):(i=null,a=this.segments[0])),!Array.isArray(t))r=this.prepareSegment(t,i,a),this.segments.splice(e,0,r);else for(let n=0,o=t.length;n<o;n+=1){let o=t[n];r=this.prepareSegment(o,i,a),this.segments.splice(e+n,0,r),i=r}return this}removeSegment(e){let t=this.fixIndex(e),n=this.segments.splice(t,1)[0],r=n.previousSegment,i=n.nextSegment;return r&&(r.nextSegment=i),i&&(i.previousSegment=r),n.isSubpathStart&&i&&this.updateSubpathStartSegment(i),n}replaceSegment(e,t){let n=this.fixIndex(e),r,i=this.segments[n],a=i.previousSegment,o=i.nextSegment,s=i.isSubpathStart;if(!Array.isArray(t))r=this.prepareSegment(t,a,o),this.segments.splice(n,1,r),s&&r.isSubpathStart&&(s=!1);else{this.segments.splice(e,1);for(let n=0,i=t.length;n<i;n+=1){let i=t[n];r=this.prepareSegment(i,a,o),this.segments.splice(e+n,0,r),a=r,s&&r.isSubpathStart&&(s=!1)}}s&&o&&this.updateSubpathStartSegment(o)}getSegment(e){let t=this.fixIndex(e);return this.segments[t]}fixIndex(e){let t=this.segments.length;if(t===0)throw Error(`Path has no segments.`);let n=e;for(;n<0;)n=t+n;if(n>=t||n<0)throw Error(`Index out of range.`);return n}segmentAt(e,t={}){let n=this.segmentIndexAt(e,t);return n?this.getSegment(n):null}segmentAtLength(e,t={}){let n=this.segmentIndexAtLength(e,t);return n?this.getSegment(n):null}segmentIndexAt(e,t={}){if(this.segments.length===0)return null;let n=R.clamp(e,0,1),r=this.getOptions(t),i=this.length(r)*n;return this.segmentIndexAtLength(i,r)}segmentIndexAtLength(e,t={}){let n=this.segments.length;if(n===0)return null;let r=!0;e<0&&(r=!1,e=-e);let i=this.getPrecision(t),a=this.getSubdivisions(t),o=0,s=null;for(let t=0;t<n;t+=1){let c=r?t:n-1-t,l=this.segments[c],u=a[c],d=l.length({precision:i,subdivisions:u});if(l.isVisible){if(e<=o+d)return c;s=c}o+=d}return s}getSegmentSubdivisions(e={}){let t=this.getPrecision(e),n=[];for(let e=0,r=this.segments.length;e<r;e+=1){let r=this.segments[e].getSubdivisions({precision:t});n.push(r)}return n}updateSubpathStartSegment(e){let t=e.previousSegment,n=e;for(;n&&!n.isSubpathStart;)t==null?n.subpathStartSegment=null:n.subpathStartSegment=t.subpathStartSegment,t=n,n=n.nextSegment}prepareSegment(e,t,n){e.previousSegment=t,e.nextSegment=n,t!=null&&(t.nextSegment=e),n!=null&&(n.previousSegment=e);let r=e;return e.isSubpathStart&&(e.subpathStartSegment=e,r=n),r!=null&&this.updateSubpathStartSegment(r),e}closestPoint(e,t={}){let n=this.closestPointT(e,t);return n?this.pointAtT(n):null}closestPointLength(e,t={}){let n=this.getOptions(t),r=this.closestPointT(e,n);return r?this.lengthAtT(r,n):0}closestPointNormalizedLength(e,t={}){let n=this.getOptions(t),r=this.closestPointLength(e,n);if(r===0)return 0;let i=this.length(n);return i===0?0:r/i}closestPointT(e,t={}){if(this.segments.length===0)return null;let n=this.getPrecision(t),r=this.getSubdivisions(t),i,a=1/0;for(let t=0,o=this.segments.length;t<o;t+=1){let o=this.segments[t],s=r[t];if(o.isVisible){let r=o.closestPointT(e,{precision:n,subdivisions:s}),c=o.pointAtT(r),l=R.squaredLength(c,e);l<a&&(i={segmentIndex:t,value:r},a=l)}}return i||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(e,t={}){if(this.segments.length===0)return null;let n=this.getPrecision(t),r=this.getSubdivisions(t),i,a=1/0;for(let t=0,o=this.segments.length;t<o;t+=1){let o=this.segments[t],s=r[t];if(o.isDifferentiable()){let t=o.closestPointT(e,{precision:n,subdivisions:s}),r=o.pointAtT(t),c=R.squaredLength(r,e);c<a&&(i=o.tangentAtT(t),a=c)}}return i||null}containsPoint(e,t={}){let n=this.toPolylines(t);if(!n)return!1;let r=0;for(let t=0,i=n.length;t<i;t+=1)n[t].containsPoint(e)&&(r+=1);return r%2==1}pointAt(e,t={}){if(this.segments.length===0)return null;if(e<=0)return this.start.clone();if(e>=1)return this.end.clone();let n=this.getOptions(t),r=this.length(n)*e;return this.pointAtLength(r,n)}pointAtLength(e,t={}){if(this.segments.length===0)return null;if(e===0)return this.start.clone();let n=!0;e<0&&(n=!1,e=-e);let r=this.getPrecision(t),i=this.getSubdivisions(t),a,o=0;for(let t=0,s=this.segments.length;t<s;t+=1){let c=n?t:s-1-t,l=this.segments[c],u=i[c],d=l.length({precision:r,subdivisions:u});if(l.isVisible){if(e<=o+d)return l.pointAtLength((n?1:-1)*(e-o),{precision:r,subdivisions:u});a=l}o+=d}return a?n?a.end:a.start:this.segments[this.segments.length-1].end.clone()}pointAtT(e){let t=this.segments,n=t.length;if(n===0)return null;let r=e.segmentIndex;if(r<0)return t[0].pointAtT(0);if(r>=n)return t[n-1].pointAtT(1);let i=R.clamp(e.value,0,1);return t[r].pointAtT(i)}divideAt(e,t={}){if(this.segments.length===0)return null;let n=R.clamp(e,0,1),r=this.getOptions(t),i=this.length(r)*n;return this.divideAtLength(i,r)}divideAtLength(t,n={}){if(this.segments.length===0)return null;let r=!0;t<0&&(r=!1,t=-t);let i=this.getPrecision(n),a=this.getSubdivisions(n),o=0,s,c,l,u,d;for(let e=0,n=this.segments.length;e<n;e+=1){let d=r?e:n-1-e,f=this.getSegment(d),p={precision:i,subdivisions:a[d]},m=f.length(p);if(f.isDifferentiable()&&(l=f,u=d,t<=o+m)){c=d,s=f.divideAtLength((r?1:-1)*(t-o),p);break}o+=m}if(!l)return null;s||=(c=u,d=+!!r,l.divideAtT(d));let f=this.clone(),p=c;f.replaceSegment(p,s);let m=p,h=p+1,g=p+2;s[0].isDifferentiable()||(f.removeSegment(m),--h,--g);let _=f.getSegment(h).start;f.insertSegment(h,e.createSegment(`M`,_)),g+=1,s[1].isDifferentiable()||(f.removeSegment(g-1),--g);let v=g-m-1;for(let t=g,n=f.segments.length;t<n;t+=1){let n=this.getSegment(t-v),r=f.getSegment(t);if(r.type===`Z`&&!n.subpathStartSegment.end.equals(r.subpathStartSegment.end)){let r=e.createSegment(`L`,n.end);f.replaceSegment(t,r)}}return[new e(f.segments.slice(0,h)),new e(f.segments.slice(h))]}intersectsWithLine(e,t={}){let n=this.toPolylines(t);if(n==null)return null;let r=null;for(let t=0,i=n.length;t<i;t+=1){let i=n[t],a=e.intersect(i);a&&(r??=[],Array.isArray(a)?r.push(...a):r.push(a))}return r}isDifferentiable(){for(let e=0,t=this.segments.length;e<t;e+=1)if(this.segments[e].isDifferentiable())return!0;return!1}isValid(){let e=this.segments;return e.length===0||e[0].type===`M`}length(e={}){if(this.segments.length===0)return 0;let t=this.getSubdivisions(e),n=0;for(let e=0,r=this.segments.length;e<r;e+=1){let r=this.segments[e],i=t[e];n+=r.length({subdivisions:i})}return n}lengthAtT(e,t={}){let n=this.segments.length;if(n===0)return 0;let r=e.segmentIndex;if(r<0)return 0;let i=R.clamp(e.value,0,1);r>=n&&(r=n-1,i=1);let a=this.getPrecision(t),o=this.getSubdivisions(t),s=0;for(let e=0;e<r;e+=1){let t=this.segments[e],n=o[e];s+=t.length({precision:a,subdivisions:n})}let c=this.segments[r],l=o[r];return s+=c.lengthAtT(i,{precision:a,subdivisions:l}),s}tangentAt(e,t={}){if(this.segments.length===0)return null;let n=R.clamp(e,0,1),r=this.getOptions(t),i=this.length(r)*n;return this.tangentAtLength(i,r)}tangentAtLength(e,t={}){if(this.segments.length===0)return null;let n=!0;e<0&&(n=!1,e=-e);let r=this.getPrecision(t),i=this.getSubdivisions(t),a,o=0;for(let t=0,s=this.segments.length;t<s;t+=1){let c=n?t:s-1-t,l=this.segments[c],u=i[c],d=l.length({precision:r,subdivisions:u});if(l.isDifferentiable()){if(e<=o+d)return l.tangentAtLength((n?1:-1)*(e-o),{precision:r,subdivisions:u});a=l}o+=d}if(a){let e=+!!n;return a.tangentAtT(e)}return null}tangentAtT(e){let t=this.segments.length;if(t===0)return null;let n=e.segmentIndex;if(n<0)return this.segments[0].tangentAtT(0);if(n>=t)return this.segments[t-1].tangentAtT(1);let r=R.clamp(e.value,0,1);return this.segments[n].tangentAtT(r)}getPrecision(e={}){return e.precision==null?this.PRECISION:e.precision}getSubdivisions(e={}){if(e.segmentSubdivisions==null){let t=this.getPrecision(e);return this.getSegmentSubdivisions({precision:t})}return e.segmentSubdivisions}getOptions(e={}){return{precision:this.getPrecision(e),segmentSubdivisions:this.getSubdivisions(e)}}toPoints(e={}){let t=this.segments,n=t.length;if(n===0)return null;let r=this.getSubdivisions(e),i=[],a=[];for(let e=0;e<n;e+=1){let n=t[e];if(n.isVisible){let t=r[e];t.length>0?t.forEach(e=>a.push(e.start)):a.push(n.start)}else a.length>0&&(a.push(t[e-1].end),i.push(a),a=[])}return a.length>0&&(a.push(this.end),i.push(a)),i}toPolylines(e={}){let t=this.toPoints(e);return t?t.map(e=>new Uf(e)):null}scale(e,t,n){return this.segments.forEach(r=>r.scale(e,t,n)),this}rotate(e,t){return this.segments.forEach(n=>n.rotate(e,t)),this}translate(e,t){return typeof e==`number`?this.segments.forEach(n=>n.translate(e,t)):this.segments.forEach(t=>t.translate(e)),this}clone(){let t=new e;return this.segments.forEach(e=>t.appendSegment(e.clone())),t}equals(e){if(e==null)return!1;let t=this.segments,n=e.segments,r=t.length;if(n.length!==r)return!1;for(let e=0;e<r;e+=1){let r=t[e],i=n[e];if(r.type!==i.type||!r.equals(i))return!1}return!0}toJSON(){return this.segments.map(e=>e.toJSON())}serialize(){if(!this.isValid())throw Error(`Invalid path segments.`);return this.segments.map(e=>e.serialize()).join(` `)}toString(){return this.serialize()}};(function(e){function t(t){return t!=null&&t instanceof e}e.isPath=t})(H||={}),(function(e){function t(t){if(!t)return new e;let r=new e,i=e.normalize(t).match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g);if(i!=null)for(let e=0,t=i.length;e<t;e+=1){let t=i[e].match(/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g);if(t!=null){let e=t[0],i=t.slice(1).map(e=>+e),a=n.call(null,e,...i);r.appendSegment(a)}}return r}e.parse=t;function n(e,...t){if(e===`M`)return Jf.create.call(null,...t);if(e===`L`)return Kf.create.call(null,...t);if(e===`C`)return Yf.create.call(null,...t);if(e===`z`||e===`Z`)return qf.create();throw Error(`Invalid path segment type "${e}"`)}e.createSegment=n})(H||={}),(function(e){e.normalize=np,e.isValid=Lf,e.drawArc=Hf,e.drawPoints=Bf,e.arcToCurves=Vf})(H||={});var rp=class{constructor(e){this.options=Object.assign({},e),this.data=this.options.data||{},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this)}get names(){return Object.keys(this.data)}register(e,t,n=!1){if(typeof e==`object`){Object.entries(e).forEach(([e,n])=>{this.register(e,n,t)});return}this.exist(e)&&!n&&!ru.isApplyingHMR()&&this.onDuplicated(e);let r=this.options.process,i=r?M(r,this,e,t):t;return this.data[e]=i,i}unregister(e){let t=e?this.data[e]:null;return delete this.data[e],t}get(e){return e?this.data[e]:null}exist(e){return e?this.data[e]!=null:!1}onDuplicated(e){try{throw this.options.onConflict&&M(this.options.onConflict,this,e),Error(`${Wr(this.options.type)} with name '${e}' already registered.`)}catch(e){throw e}}onNotFound(e,t){throw Error(this.getSpellingSuggestion(e,t))}getSpellingSuggestion(e,t){let n=this.getSpellingSuggestionForName(e);return`${Wr(t?`${t} ${Hc(this.options.type)}`:this.options.type)} with name '${e}' does not exist.${n?` Did you mean '${n}'?`:``}`}getSpellingSuggestionForName(e){return Il(e,Object.keys(this.data),e=>e)}};(function(e){function t(t){return new e(t)}e.create=t})(rp||={});var ip={color:`#aaaaaa`,thickness:1,markup:`rect`,update(e,t){let n=t.thickness*t.sx,r=t.thickness*t.sy;P(e,{width:n,height:r,rx:n,ry:r,fill:t.color})}},ap={color:`#aaaaaa`,thickness:1,markup:`rect`,update(e,t){let n=t.sx<=1?t.thickness*t.sx:t.thickness;P(e,{width:n,height:n,rx:n,ry:n,fill:t.color})}},op={color:`rgba(224,224,224,1)`,thickness:1,markup:`path`,update(e,t){let n,r=t.width,i=t.height,a=t.thickness;n=r-a>=0&&i-a>=0?[`M`,r,0,`H0 M0 0 V0`,i].join(` `):`M 0 0 0 0`,P(e,{d:n,stroke:t.color,"stroke-width":t.thickness})}},sp=[{color:`rgba(224,224,224,1)`,thickness:1,markup:`path`,update(e,t){let n,r=t.width,i=t.height,a=t.thickness;n=r-a>=0&&i-a>=0?[`M`,r,0,`H0 M0 0 V0`,i].join(` `):`M 0 0 0 0`,P(e,{d:n,stroke:t.color,"stroke-width":t.thickness})}},{color:`rgba(224,224,224,0.2)`,thickness:3,factor:4,markup:`path`,update(e,t){let n,r=t.factor||1,i=t.width*r,a=t.height*r,o=t.thickness;n=i-o>=0&&a-o>=0?[`M`,i,0,`H0 M0 0 V0`,a].join(` `):`M 0 0 0 0`,t.width=i,t.height=a,P(e,{d:n,stroke:t.color,"stroke-width":t.thickness})}}],cp=n({dot:()=>ip,doubleMesh:()=>sp,fixedDot:()=>ap,mesh:()=>op}),lp=class{constructor(){this.patterns={},this.root=F.create(yu(),{width:`100%`,height:`100%`},[vu(`defs`)]).node}add(e,t){let n=this.root.childNodes[0];n&&n.appendChild(t),this.patterns[e]=t,F.create(`rect`,{width:`100%`,height:`100%`,fill:`url(#${e})`}).appendTo(this.root)}get(e){return this.patterns[e]}has(e){return this.patterns[e]!=null}};(function(e){e.presets=cp,e.registry=rp.create({type:`grid`}),e.registry.register(e.presets,!0)})(lp||={});var up=function(e){let t=document.createElement(`canvas`),n=e.width,r=e.height;t.width=n*2,t.height=r;let i=t.getContext(`2d`);return i.drawImage(e,0,0,n,r),i.translate(2*n,0),i.scale(-1,1),i.drawImage(e,0,0,n,r),t},dp=function(e){let t=document.createElement(`canvas`),n=e.width,r=e.height;t.width=n,t.height=r*2;let i=t.getContext(`2d`);return i.drawImage(e,0,0,n,r),i.translate(0,2*r),i.scale(1,-1),i.drawImage(e,0,0,n,r),t},fp=function(e){let t=document.createElement(`canvas`),n=e.width,r=e.height;t.width=2*n,t.height=2*r;let i=t.getContext(`2d`);return i.drawImage(e,0,0,n,r),i.setTransform(-1,0,0,-1,t.width,t.height),i.drawImage(e,0,0,n,r),i.setTransform(-1,0,0,1,t.width,0),i.drawImage(e,0,0,n,r),i.setTransform(1,0,0,-1,0,t.height),i.drawImage(e,0,0,n,r),t},pp=function(e,t){let n=e.width,r=e.height,i=document.createElement(`canvas`);i.width=n*3,i.height=r*3;let a=i.getContext(`2d`),o=t.angle==null?-20:-t.angle,s=L.toRad(o),c=i.width/4,l=i.height/4;for(let t=0;t<4;t+=1)for(let i=0;i<4;i+=1)(t+i)%2>0&&(a.setTransform(1,0,0,1,(2*t-1)*c,(2*i-1)*l),a.rotate(s),a.drawImage(e,-n/2,-r/2,n,r));return i},mp=n({flipX:()=>up,flipXY:()=>fp,flipY:()=>dp,watermark:()=>pp}),hp;(function(e){e.presets=Object.assign({},mp),e.presets[`flip-x`]=up,e.presets[`flip-y`]=dp,e.presets[`flip-xy`]=fp,e.registry=rp.create({type:`background pattern`}),e.registry.register(e.presets,!0)})(hp||={});function gp(e,t){return e??t}function _p(e,t){return e!=null&&Number.isFinite(e)?e:t}function vp(e={}){let t=gp(e.color,`blue`),n=_p(e.width,1),r=_p(e.margin,2),i=_p(e.opacity,1),a=r;return`
5
+ <filter>
6
+ <feFlood flood-color="${t}" flood-opacity="${i}" result="colored"/>
7
+ <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${r+n}" />
8
+ <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${a}" />
9
+ <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>
10
+ <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>
11
+ <feMerge>
12
+ <feMergeNode in="outline"/>
13
+ <feMergeNode in="SourceGraphic"/>
14
+ </feMerge>
15
+ </filter>
16
+ `.trim()}function yp(e={}){let t=gp(e.color,`red`),n=_p(e.blur,0),r=_p(e.width,1);return`
17
+ <filter>
18
+ <feFlood flood-color="${t}" flood-opacity="${_p(e.opacity,1)}" result="colored"/>
19
+ <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${r}"/>
20
+ <feComposite result="composed" in="colored" in2="morphed" operator="in"/>
21
+ <feGaussianBlur result="blured" in="composed" stdDeviation="${n}"/>
22
+ <feBlend in="SourceGraphic" in2="blured" mode="normal"/>
23
+ </filter>
24
+ `.trim()}function bp(e={}){let t=_p(e.x,2);return`
25
+ <filter>
26
+ <feGaussianBlur stdDeviation="${e.y!=null&&Number.isFinite(e.y)?[t,e.y]:t}"/>
27
+ </filter>
28
+ `.trim()}function xp(e={}){let t=_p(e.dx,0),n=_p(e.dy,0),r=gp(e.color,`black`),i=_p(e.blur,4),a=_p(e.opacity,1);return`SVGFEDropShadowElement`in window?`<filter>
29
+ <feDropShadow stdDeviation="${i}" dx="${t}" dy="${n}" flood-color="${r}" flood-opacity="${a}" />
30
+ </filter>`.trim():`<filter>
31
+ <feGaussianBlur in="SourceAlpha" stdDeviation="${i}" />
32
+ <feOffset dx="${t}" dy="${n}" result="offsetblur" />
33
+ <feFlood flood-color="${r}" />
34
+ <feComposite in2="offsetblur" operator="in" />
35
+ <feComponentTransfer>
36
+ <feFuncA type="linear" slope="${a}" />
37
+ </feComponentTransfer>
38
+ <feMerge>
39
+ <feMergeNode/>
40
+ <feMergeNode in="SourceGraphic"/>
41
+ </feMerge>
42
+ </filter>`.trim()}function Sp(e={}){let t=_p(e.amount,1),n=.2126+.7874*(1-t),r=.7152-.7152*(1-t);return`
43
+ <filter>
44
+ <feColorMatrix type="matrix" values="${n} ${r} ${.0722-.0722*(1-t)} 0 0 ${.2126-.2126*(1-t)} ${.7152+.2848*(1-t)} ${.0722-.0722*(1-t)} 0 0 ${.2126-.2126*(1-t)} ${r} ${.0722+.9278*(1-t)} 0 0 0 0 0 1 0"/>
45
+ </filter>
46
+ `.trim()}function Cp(e={}){let t=_p(e.amount,1);return`
47
+ <filter>
48
+ <feColorMatrix type="matrix" values="${.393+.607*(1-t)} ${.769-.769*(1-t)} ${.189-.189*(1-t)} 0 0 ${.349-.349*(1-t)} ${.686+.314*(1-t)} ${.168-.168*(1-t)} 0 0 ${.272-.272*(1-t)} ${.534-.534*(1-t)} ${.131+.869*(1-t)} 0 0 0 0 0 1 0"/>
49
+ </filter>
50
+ `.trim()}function wp(e={}){return`
51
+ <filter>
52
+ <feColorMatrix type="saturate" values="${1-_p(e.amount,1)}"/>
53
+ </filter>
54
+ `.trim()}function Tp(e={}){return`
55
+ <filter>
56
+ <feColorMatrix type="hueRotate" values="${_p(e.angle,0)}"/>
57
+ </filter>
58
+ `.trim()}function Ep(e={}){let t=_p(e.amount,1),n=1-t;return`
59
+ <filter>
60
+ <feComponentTransfer>
61
+ <feFuncR type="table" tableValues="${t} ${n}"/>
62
+ <feFuncG type="table" tableValues="${t} ${n}"/>
63
+ <feFuncB type="table" tableValues="${t} ${n}"/>
64
+ </feComponentTransfer>
65
+ </filter>
66
+ `.trim()}function Dp(e={}){let t=_p(e.amount,1);return`
67
+ <filter>
68
+ <feComponentTransfer>
69
+ <feFuncR type="linear" slope="${t}"/>
70
+ <feFuncG type="linear" slope="${t}"/>
71
+ <feFuncB type="linear" slope="${t}"/>
72
+ </feComponentTransfer>
73
+ </filter>
74
+ `.trim()}function Op(e={}){let t=_p(e.amount,1),n=.5-t/2;return`
75
+ <filter>
76
+ <feComponentTransfer>
77
+ <feFuncR type="linear" slope="${t}" intercept="${n}"/>
78
+ <feFuncG type="linear" slope="${t}" intercept="${n}"/>
79
+ <feFuncB type="linear" slope="${t}" intercept="${n}"/>
80
+ </feComponentTransfer>
81
+ </filter>
82
+ `.trim()}var kp=n({blur:()=>bp,brightness:()=>Dp,contrast:()=>Op,dropShadow:()=>xp,grayScale:()=>Sp,highlight:()=>yp,hueRotate:()=>Tp,invert:()=>Ep,outline:()=>vp,saturate:()=>wp,sepia:()=>Cp}),Ap;(function(e){e.presets=kp,e.registry=rp.create({type:`filter`}),e.registry.register(e.presets,!0)})(Ap||={});var jp={xlinkHref:`xlink:href`,xlinkShow:`xlink:show`,xlinkRole:`xlink:role`,xlinkType:`xlink:type`,xlinkArcrole:`xlink:arcrole`,xlinkTitle:`xlink:title`,xlinkActuate:`xlink:actuate`,xmlSpace:`xml:space`,xmlBase:`xml:base`,xmlLang:`xml:lang`,preserveAspectRatio:`preserveAspectRatio`,requiredExtension:`requiredExtension`,requiredFeatures:`requiredFeatures`,systemLanguage:`systemLanguage`,externalResourcesRequired:`externalResourceRequired`},Mp={},Np={position:nm(`x`,`width`,`origin`)},Pp={position:nm(`y`,`height`,`origin`)},Fp={position:nm(`x`,`width`,`corner`)},Ip={position:nm(`y`,`height`,`corner`)},Lp={set:rm(`width`,`width`)},Rp={set:rm(`height`,`height`)},zp={set:rm(`rx`,`width`)},Bp={set:rm(`ry`,`height`)},Vp={set:(e=>{let t=rm(e,`width`),n=rm(e,`height`);return function(e,r){let i=r.refBBox;return M(i.height>i.width?t:n,this,e,r)}})(`r`)},Hp={set(e,{refBBox:t}){let n=parseFloat(e),r=Rl(e);r&&(n/=100);let i=Math.sqrt(t.height*t.height+t.width*t.width),a;return Number.isFinite(n)&&(a=r||n>=0&&n<=1?n*i:Math.max(n+i,0)),{r:a}}},Up={set:rm(`cx`,`width`)},Wp={set:rm(`cy`,`height`)},Gp={set:am({resetOffset:!0})},Kp={set:am({resetOffset:!1})},qp={set:om({resetOffset:!0})},Jp={set:om({resetOffset:!1})},Yp=Vp,Xp=Gp,Zp=qp,Qp=Np,$p=Pp,em=Lp,tm=Rp;function nm(e,t,n){return(r,{refBBox:i})=>{if(r==null)return null;let a=parseFloat(r),o=Rl(r);o&&(a/=100);let s;if(Number.isFinite(a)){let r=i[n];s=o||a>0&&a<1?r[e]+i[t]*a:r[e]+a}let c=new z;return c[e]=s||0,c}}function rm(e,t){return function(n,{refBBox:r}){let i=parseFloat(n),a=Rl(n);a&&(i/=100);let o={};return Number.isFinite(i)&&(o[e]=a||i>=0&&i<=1?i*r[t]:Math.max(i+r[t],0)),o}}function im(e,t){let n=`x6-shape`,r=t&&t.resetOffset;return function(t,{elem:i,refBBox:a}){let o=md(i,n);if(!o||o.value!==t){let r=e(t);o={value:t,shape:r,shapeBBox:r.bbox()},md(i,n,o)}let s=o.shape.clone(),c=o.shapeBBox.clone(),l=c.getOrigin(),u=a.getOrigin();c.x=u.x,c.y=u.y;let d=a.getMaxScaleToFit(c,u),f=c.width===0||a.width===0?1:d.sx,p=c.height===0||a.height===0?1:d.sy;return s.scale(f,p,l),r&&s.translate(-l.x,-l.y),s}}function am(e){function t(e){return H.parse(e)}let n=im(t,e);return(e,t)=>({d:n(e,t).serialize()})}function om(e){let t=im(e=>new Uf(e),e);return(e,n)=>({points:t(e,n).serialize()})}var sm={qualify:vr,set(e,{view:t}){return`url(#${t.graph.defineGradient(e)})`}},cm={qualify:vr,set(e,{view:t}){let n=t.cell,r=Object.assign({},e);if(n.isEdge()&&r.type===`linearGradient`){let e=t,i=e.sourcePoint,a=e.targetPoint;r.id=`gradient-${r.type}-${n.id}`,r.attrs=Object.assign(Object.assign({},r.attrs),{x1:i.x,y1:i.y,x2:a.x,y2:a.y,gradientUnits:`userSpaceOnUse`}),t.graph.defs.remove(r.id)}return`url(#${t.graph.defineGradient(r)})`}},lm={qualify(e,{attrs:t}){return t.textWrap==null||!vr(t.textWrap)},set(e,{view:t,elem:n,attrs:r}){let i=`x6-text`,a=md(n,i),o=e=>{try{return JSON.parse(e)}catch{return e}},s={x:r.x,eol:r.eol,annotations:o(r.annotations),textPath:o(r[`text-path`]||r.textPath),textVerticalAnchor:r[`text-vertical-anchor`]||r.textVerticalAnchor,displayEmpty:(r[`display-empty`]||r.displayEmpty)===`true`,lineHeight:r[`line-height`]||r.lineHeight},c=r[`font-size`]||r.fontSize,l=JSON.stringify([e,s]);if(c&&n.setAttribute(`font-size`,c),a==null||a!==l){let r=s.textPath;if(typeof r==`object`&&r){let e=r.selector;if(typeof e==`string`){let n=t.find(e)[0];n instanceof SVGPathElement&&(pu(n),s.textPath=Object.assign({"xlink:href":`#${n.id}`},r))}}bd(n,`${e}`,s),md(n,i,l)}}},um={qualify:vr,set(e,{view:t,elem:n,attrs:r,refBBox:i}){let a=e,o=a.width||0;Rl(o)?i.width*=parseFloat(o)/100:o<=0?i.width+=o:i.width=o;let s=a.height||0;Rl(s)?i.height*=parseFloat(s)/100:s<=0?i.height+=s:i.height=s;let c,l=a.text;l??=r.text||n?.textContent,c=l==null?``:Cd(`${l}`,i,{"font-weight":r[`font-weight`]||r.fontWeight,"font-size":r[`font-size`]||r.fontSize,"font-family":r[`font-family`]||r.fontFamily,lineHeight:r.lineHeight},{ellipsis:a.ellipsis}),M(lm.set,this,c,{view:t,elem:n,attrs:r,refBBox:i,cell:t.cell})}},dm=(e,{attrs:t})=>t.text!==void 0,fm={qualify:dm},pm={qualify:dm},mm={qualify:dm},hm={qualify:dm},gm={qualify:dm},_m={qualify:dm},vm={qualify(e,{elem:t}){return t instanceof SVGElement},set(e,{elem:t}){let n=`x6-title`,r=`${e}`,i=md(t,n);if(i==null||i!==r){md(t,n,r);let e=t.firstChild;if(e&&e.tagName.toUpperCase()===`TITLE`){let t=e;t.textContent=r}else{let n=document.createElementNS(t.namespaceURI,`title`);n.textContent=r,t.insertBefore(n,e)}}}},ym={offset:Sm(`x`,`width`,`right`)},bm={offset:Sm(`y`,`height`,`bottom`)},xm={offset(e,{refBBox:t}){return e?{x:-t.x,y:-t.y}:{x:0,y:0}}};function Sm(e,t,n){return(r,{refBBox:i})=>{let a=new z,o;return o=r===`middle`?i[t]/2:r===n?i[t]:typeof r==`number`&&Number.isFinite(r)?r>-1&&r<1?-i[t]*r:-r:Rl(r)?i[t]*parseFloat(r)/100:0,a[e]=-(i[e]+o),a}}var Cm={qualify:vr,set(e,{elem:t}){ud(t,e)}},wm={set(e,{elem:t}){t.innerHTML=`${e}`}},Tm={qualify:vr,set(e,{view:t}){return`url(#${t.graph.defineFilter(e)})`}},Em={set(e){return typeof e==`object`&&e&&e.id?e.id:e}};function Dm(e,t,n){let r,i;typeof t==`object`?(r=t.x,i=t.y):(r=t,i=n);let a=H.parse(e),o=a.bbox();if(o){let e=-o.height/2-o.y,t=-o.width/2-o.x;typeof r==`number`&&(t-=r),typeof i==`number`&&(e-=i),a.translate(t,e)}return a.serialize()}var Om=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},km=e=>{var{size:t,width:n,height:r,offset:i,open:a}=e,o=Om(e,[`size`,`width`,`height`,`offset`,`open`]);return jm({size:t,width:n,height:r,offset:i},a===!0,!0,void 0,o)},Am=e=>{var{size:t,width:n,height:r,offset:i,factor:a}=e,o=Om(e,[`size`,`width`,`height`,`offset`,`factor`]);return jm({size:t,width:n,height:r,offset:i},!1,!1,a,o)};function jm(e,t,n,r=3/4,i={}){let a=e.size||10,o=e.width||a,s=e.height||a,c=new H,l={};if(t)c.moveTo(o,0).lineTo(0,s/2).lineTo(o,s),l.fill=`none`;else{if(c.moveTo(0,s/2),c.lineTo(o,0),!n){let e=Wi(r,0,1);c.lineTo(o*e,s/2)}c.lineTo(o,s),c.close()}return Object.assign(Object.assign(Object.assign({},l),i),{tagName:`path`,d:Dm(c.serialize(),{x:e.offset==null?-o/2:e.offset})})}var Mm=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Nm=e=>{var{size:t,width:n,height:r,offset:i}=e,a=Mm(e,[`size`,`width`,`height`,`offset`]);let o=t||10,s=n||o,c=r||o,l=new H;return l.moveTo(0,c/2).lineTo(s/2,0).lineTo(s,c/2).lineTo(s/2,c).close(),Object.assign(Object.assign({},a),{tagName:`path`,d:Dm(l.serialize(),i??-s/2)})},Pm=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Fm=e=>{var{d:t,offsetX:n,offsetY:r}=e,i=Pm(e,[`d`,`offsetX`,`offsetY`]);return Object.assign(Object.assign({},i),{tagName:`path`,d:Dm(t,n,r)})},Im=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Lm=e=>{var{size:t,width:n,height:r,offset:i}=e,a=Im(e,[`size`,`width`,`height`,`offset`]);let o=t||10,s=n||o,c=r||o,l=new H;return l.moveTo(0,0).lineTo(s,c).moveTo(0,c).lineTo(s,0),Object.assign(Object.assign({},a),{tagName:`path`,fill:`none`,d:Dm(l.serialize(),i||-s/2)})},Rm=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},zm=e=>{var{width:t,height:n,offset:r,open:i,flip:a}=e,o=Rm(e,[`width`,`height`,`offset`,`open`,`flip`]);let s=n||6,c=t||10,l=i===!0,u=a===!0,d=Object.assign(Object.assign({},o),{tagName:`path`});u&&(s=-s);let f=new H;return f.moveTo(0,s).lineTo(c,0),l?d.fill=`none`:(f.lineTo(c,s),f.close()),d.d=Dm(f.serialize(),{x:r||-c/2,y:s/2}),d},Bm=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Vm=e=>{var{r:t}=e,n=Bm(e,[`r`]);let r=t||5;return Object.assign(Object.assign({cx:r},n),{tagName:`circle`,r})},Hm=e=>{var{r:t}=e,n=Bm(e,[`r`]);let r=t||5,i=new H;return i.moveTo(r,0).lineTo(r,r*2),i.moveTo(0,r).lineTo(r*2,r),{children:[Object.assign(Object.assign({},Vm({r})),{fill:`none`}),Object.assign(Object.assign({},n),{tagName:`path`,d:Dm(i.serialize(),-r)})]}},Um=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Wm=e=>{var{rx:t,ry:n}=e,r=Um(e,[`rx`,`ry`]);let i=t||5,a=n||5;return Object.assign(Object.assign({cx:i},r),{tagName:`ellipse`,rx:i,ry:a})},Gm=n({async:()=>zm,block:()=>km,circle:()=>Vm,circlePlus:()=>Hm,classic:()=>Am,cross:()=>Lm,diamond:()=>Nm,ellipse:()=>Wm,path:()=>Fm}),Km;(function(e){e.presets=Gm,e.registry=rp.create({type:`marker`}),e.registry.register(e.presets,!0)})(Km||={}),(function(e){e.normalize=Dm})(Km||={});var qm=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function Jm(e){return typeof e==`string`||vr(e)}var Ym={qualify:Jm,set(e,{view:t,attrs:n}){return Qm(`marker-start`,e,t,n)}},Xm={qualify:Jm,set(e,{view:t,attrs:n}){return Qm(`marker-end`,e,t,n,{transform:`rotate(180)`})}},Zm={qualify:Jm,set(e,{view:t,attrs:n}){return Qm(`marker-mid`,e,t,n)}};function Qm(e,t,n,r,i={}){let a=typeof t==`string`?{name:t}:t,{name:o,args:s}=a,c=qm(a,[`name`,`args`]),l=c;if(o&&typeof o==`string`){let e=Km.registry.get(o);if(e)l=e(Object.assign(Object.assign({},c),s));else return Km.registry.onNotFound(o)}let u=Object.assign(Object.assign(Object.assign({},$m(r,e)),i),l);return{[e]:`url(#${n.graph.defineMarker(u)})`}}function $m(e,t){let n={},r=e.stroke;typeof r==`string`&&(n.stroke=r,n.fill=r);let i=e.strokeOpacity;if(i??=e[`stroke-opacity`],i??=e.opacity,i!=null&&(n[`stroke-opacity`]=i,n[`fill-opacity`]=i),t!==`marker-mid`){let r=parseFloat(e.strokeWidth||e[`stroke-width`]);if(Number.isFinite(r)&&r>1){let e=Math.ceil(r/2);n.refX=t===`marker-start`?e:-e}}return n}var eh=(e,{view:t})=>t.cell.isEdge(),th={qualify:eh,set(e,t){let n=t.view,r=e.reverse||!1,i=e.stubs||0,a;if(Number.isFinite(i)&&i!==0){if(r){let e,t,r=n.getConnectionLength()||0;i<0?(e=(r+i)/2,t=-i):(e=i,t=r-i*2),a=((n.getConnection()?.divideAtLength(e)?.[1])?.divideAtLength(t)?.[0])?.serialize()}else{let e;e=i<0?((n.getConnectionLength()||0)+i)/2:i;let t=n.getConnection();if(t){let n=t.divideAtLength(e),r=t.divideAtLength(-e);n&&r&&(a=`${n[0].serialize()} ${r[1].serialize()}`)}}}return{d:a||n.getConnectionPathData()}}},nh={qualify:eh,set:ch(`getTangentAtLength`,{rotate:!0})},rh={qualify:eh,set:ch(`getTangentAtLength`,{rotate:!1})},ih={qualify:eh,set:ch(`getTangentAtRatio`,{rotate:!0})},ah={qualify:eh,set:ch(`getTangentAtRatio`,{rotate:!1})},oh=nh,sh=ih;function ch(e,t){let n={x:1,y:0};return(r,i)=>{let a,o,s=i.view,c=s[e](Number(r));return c?(o=t.rotate?c.vector().vectorAngle(n):0,a=c.start):(a=s.path.start,o=0),o===0?{transform:`translate(${a.x},${a.y}')`}:{transform:`translate(${a.x},${a.y}') rotate(${o})`}}}var lh=n({annotations:()=>hm,atConnectionLength:()=>oh,atConnectionLengthIgnoreGradient:()=>rh,atConnectionLengthKeepGradient:()=>nh,atConnectionRatio:()=>sh,atConnectionRatioIgnoreGradient:()=>ah,atConnectionRatioKeepGradient:()=>ih,connection:()=>th,displayEmpty:()=>_m,eol:()=>gm,fill:()=>sm,filter:()=>Tm,html:()=>wm,lineHeight:()=>fm,port:()=>Em,ref:()=>Mp,refCx:()=>Up,refCy:()=>Wp,refD:()=>Xp,refDKeepOffset:()=>Kp,refDResetOffset:()=>Gp,refDx:()=>Fp,refDy:()=>Ip,refHeight:()=>Rp,refHeight2:()=>tm,refPoints:()=>Zp,refPointsKeepOffset:()=>Jp,refPointsResetOffset:()=>qp,refR:()=>Yp,refRCircumscribed:()=>Hp,refRInscribed:()=>Vp,refRx:()=>zp,refRy:()=>Bp,refWidth:()=>Lp,refWidth2:()=>em,refX:()=>Np,refX2:()=>Qp,refY:()=>Pp,refY2:()=>$p,resetOffset:()=>xm,sourceMarker:()=>Ym,stroke:()=>cm,style:()=>Cm,targetMarker:()=>Xm,text:()=>lm,textPath:()=>mm,textVerticalAnchor:()=>pm,textWrap:()=>um,title:()=>vm,vertexMarker:()=>Zm,xAlign:()=>ym,yAlign:()=>bm}),uh;(function(e){function t(e,t,n){return!(e==null||typeof e!=`string`&&typeof e.qualify==`function`&&!M(e.qualify,this,t,n))}e.isValidDefinition=t})(uh||={}),(function(e){e.presets=Object.assign(Object.assign({},jp),lh),e.registry=rp.create({type:`attribute definition`}),e.registry.register(e.presets,!0)})(uh||={});var dh={prefixCls:`x6`,autoInsertCSS:!0,useCSSSelector:!0,prefix(e){return`${dh.prefixCls}-${e}`}},fh=dh.prefix(`highlighted`),ph={highlight(e,t,n){N(t,n&&n.className||fh)},unhighlight(e,t,n){lu(t,n&&n.className||fh)}},mh=dh.prefix(`highlight-opacity`),hh={highlight(e,t){N(t,mh)},unhighlight(e,t){lu(t,mh)}},U;(function(e){e.normalizeMarker=Dm;function t(e,t){let n=Vd(e.x,e.y).matrixTransform(t);return new z(n.x,n.y)}e.transformPoint=t;function n(e,n){return new V(t(e.start,n),t(e.end,n))}e.transformLine=n;function r(e,n){let r=e instanceof Uf?e.points:e;return Array.isArray(r)||(r=[]),new Uf(r.map(e=>t(e,n)))}e.transformPolyline=r;function i(e,t){let n=vu(`svg`).createSVGPoint();n.x=e.x,n.y=e.y;let r=n.matrixTransform(t);n.x=e.x+e.width,n.y=e.y;let i=n.matrixTransform(t);n.x=e.x+e.width,n.y=e.y+e.height;let a=n.matrixTransform(t);n.x=e.x,n.y=e.y+e.height;let o=n.matrixTransform(t),s=Math.min(r.x,i.x,a.x,o.x),c=Math.max(r.x,i.x,a.x,o.x),l=Math.min(r.y,i.y,a.y,o.y),u=Math.max(r.y,i.y,a.y,o.y);return new B(s,l,c-s,u-l)}e.transformRectangle=i;function a(e,t,n){let r,a=e.ownerSVGElement;if(!a)return new B(0,0,0,0);try{r=e.getBBox()}catch{r={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}if(t)return B.create(r);let o=nf(e,n||a);return i(r,o)}e.bbox=a;function o(e,t={}){let n;if(!e.ownerSVGElement||!mu(e)){if(Pu(e)){let{left:t,top:n,width:r,height:i}=s(e);return new B(t,n,r,i)}return new B(0,0,0,0)}let r=t.target;if(!t.recursive){try{n=e.getBBox()}catch{n={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}if(!r)return B.create(n);let t=nf(e,r);return i(n,t)}{let t=e.childNodes,i=t.length;if(i===0)return o(e,{target:r});r||=e;for(let e=0;e<i;e+=1){let i=t[e],a;a=i.childNodes.length===0?o(i,{target:r}):o(i,{target:r,recursive:!0}),n=n?n.union(a):a}return n}}e.getBBox=o;function s(e){let t=0,n=0,r=0,i=0;if(e){let a=e;for(;a;)t+=a.offsetLeft,n+=a.offsetTop,a=a.offsetParent,a&&(t+=parseInt(id(a,`borderLeft`),10),n+=parseInt(id(a,`borderTop`),10));r=e.offsetWidth,i=e.offsetHeight}return{left:t,top:n,width:r,height:i}}e.getBoundingOffsetRect=s;function c(e){let t=t=>{let n=e.getAttribute(t),r=n?parseFloat(n):0;return Number.isNaN(r)?0:r};switch(e instanceof SVGElement&&e.nodeName.toLowerCase()){case`rect`:return new B(t(`x`),t(`y`),t(`width`),t(`height`));case`circle`:return new Ff(t(`cx`),t(`cy`),t(`r`),t(`r`));case`ellipse`:return new Ff(t(`cx`),t(`cy`),t(`rx`),t(`ry`));case`polyline`:{let t=jd(e);return new Uf(t)}case`polygon`:{let t=jd(e);return t.length>1&&t.push(t[0]),new Uf(t)}case`path`:{let t=e.getAttribute(`d`);return H.isValid(t)||(t=H.normalize(t)),H.parse(t)}case`line`:return new V(t(`x1`),t(`y1`),t(`x2`),t(`y2`))}return o(e)}e.toGeometryShape=c;function l(e,t,n,r){let i=z.create(t),a=z.create(n);r||=e instanceof SVGSVGElement?e:e.ownerSVGElement;let s=tf(e);e.setAttribute(`transform`,``);let c=o(e,{target:r}).scale(s.sx,s.sy),l=Ud();l.setTranslate(-c.x-c.width/2,-c.y-c.height/2);let u=Ud(),d=i.angleBetween(a,i.clone().translate(1,0));d&&u.setRotate(d,0,0);let f=Ud(),p=i.clone().move(a,c.width/2);f.setTranslate(2*i.x-p.x,2*i.y-p.y);let m=nf(e,r),h=Ud();h.setMatrix(f.matrix.multiply(u.matrix.multiply(l.matrix.multiply(m.scale(s.sx,s.sy))))),e.setAttribute(`transform`,Gd(h.matrix))}e.translateAndAutoOrient=l;function u(e){if(e==null)return null;let t=e;do{let e=t.tagName;if(typeof e!=`string`)return null;if(e=e.toUpperCase(),cu(t,`x6-port`))t=t.nextElementSibling;else if(e===`G`)t=t.firstElementChild;else if(e===`TITLE`)t=t.nextElementSibling;else break}while(t);return t}e.findShapeNode=u;function d(e){let t=u(e);if(!mu(t)){if(Pu(e)){let{left:t,top:n,width:r,height:i}=s(e);return new B(t,n,r,i)}return new B(0,0,0,0)}return c(t).bbox()||B.create()}e.getBBoxV2=d})(U||={});var gh={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:`#FEB663`}},_h={highlight(e,t,n){let r=vh.getHighlighterId(t,n);if(vh.hasCache(r))return;n=Cc({},n,gh);let i=F.create(t),a,o;try{a=i.toPathData()}catch{o=U.bbox(i.node,!0),a=Fd(Object.assign(Object.assign({},n),o))}let s=vu(`path`);if(P(s,Object.assign({d:a,"pointer-events":`none`,"vector-effect":`non-scaling-stroke`,fill:`none`},n.attrs?Hu(n.attrs):null)),e.isEdgeElement(t))P(s,`d`,e.getConnectionPathData());else{let t=i.getTransformToElement(e.container),r=n.padding;if(r){o??=U.bbox(i.node,!0);let e=o.x+o.width/2,n=o.y+o.height/2;o=U.transformRectangle(o,t);let a=Math.max(o.width,1),s=Math.max(o.height,1),c=(a+r)/a,l=(s+r)/s,u=Hd({a:c,b:0,c:0,d:l,e:e-c*e,f:n-l*n});t=t.multiply(u)}Qd(s,t)}N(s,dh.prefix(`highlight-stroke`));let c=e.cell,l=()=>vh.removeHighlighter(r);c.on(`removed`,l),c.model&&c.model.on(`reseted`,l),e.container.appendChild(s),vh.setCache(r,s)},unhighlight(e,t,n){vh.removeHighlighter(vh.getHighlighterId(t,n))}},vh;(function(e){function t(e,t){return pu(e),e.id+JSON.stringify(t)}e.getHighlighterId=t;let n={};function r(e,t){n[e]=t}e.setCache=r;function i(e){return n[e]!=null}e.hasCache=i;function a(e){let t=n[e];t&&(Du(t),delete n[e])}e.removeHighlighter=a})(vh||={});var yh=n({className:()=>ph,opacity:()=>hh,stroke:()=>_h}),bh;(function(e){function t(e,t){if(typeof t.highlight!=`function`)throw Error(`Highlighter '${e}' is missing required \`highlight()\` method`);if(typeof t.unhighlight!=`function`)throw Error(`Highlighter '${e}' is missing required \`unhighlight()\` method`)}e.check=t})(bh||={}),(function(e){e.presets=yh,e.registry=rp.create({type:`highlighter`}),e.registry.register(e.presets,!0)})(bh||={});function xh(e,t={}){return new z(zl(t.x,e.width),zl(t.y,e.height))}function Sh(e,t,n){return Object.assign({angle:t,position:e.toJSON()},n)}var Ch=(e,t)=>e.map(({x:e,y:n,angle:r})=>Sh(xh(t,{x:e,y:n}),r||0)),wh=(e,t,n)=>{let r=n.start||0,i=n.step||20;return Eh(e,t,r,(e,t)=>(e+.5-t/2)*i)},Th=(e,t,n)=>{let r=n.start||0,i=n.step||360/e.length;return Eh(e,t,r,e=>e*i)};function Eh(e,t,n,r){let i=t.getCenter(),a=t.getTopCenter(),o=t.width/t.height,s=Ff.fromRect(t),c=e.length;return e.map((e,t)=>{let l=n+r(t,c),u=a.clone().rotate(-l,i).scale(o,1,i),d=e.compensateRotate?-s.tangentTheta(u):0;return(e.dx||e.dy)&&u.translate(e.dx||0,e.dy||0),e.dr&&u.move(i,e.dr),Sh(u.round(),d,e)})}var Dh=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Oh=(e,t,n)=>Nh(e,xh(t,n.start||t.getOrigin()),xh(t,n.end||t.getCorner()),n),kh=(e,t,n)=>Nh(e,t.getTopLeft(),t.getBottomLeft(),n),Ah=(e,t,n)=>Nh(e,t.getTopRight(),t.getBottomRight(),n),jh=(e,t,n)=>Nh(e,t.getTopLeft(),t.getTopRight(),n),Mh=(e,t,n)=>Nh(e,t.getBottomLeft(),t.getBottomRight(),n);function Nh(e,t,n,r){let i=new V(t,n),a=e.length;return e.map((e,t)=>{var{strict:n}=e,o=Dh(e,[`strict`]);let s=n||r.strict?(t+1)/(a+1):(t+.5)/a,c=i.pointAt(s);return(o.dx||o.dy)&&c.translate(o.dx||0,o.dy||0),Sh(c.round(),0,o)})}var Ph=n({absolute:()=>Ch,bottom:()=>Mh,ellipse:()=>wh,ellipseSpread:()=>Th,left:()=>kh,line:()=>Oh,right:()=>Ah,top:()=>jh}),Fh;(function(e){e.presets=Ph,e.registry=rp.create({type:`port layout`}),e.registry.register(e.presets,!0)})(Fh||={});var Ih={position:{x:0,y:0},angle:0,attrs:{".":{y:`0`,"text-anchor":`start`}}};function Lh(e,t){let{x:n,y:r,angle:i,attrs:a}=t||{};return Cc({},{angle:i,attrs:a,position:{x:n,y:r}},e,Ih)}var Rh=(e,t,n)=>Lh({position:t.getTopLeft()},n),zh=(e,t,n)=>Lh({position:{x:-15,y:0},attrs:{".":{y:`.3em`,"text-anchor":`end`}}},n),Bh=(e,t,n)=>Lh({position:{x:15,y:0},attrs:{".":{y:`.3em`,"text-anchor":`start`}}},n),Vh=(e,t,n)=>Lh({position:{x:0,y:-15},attrs:{".":{"text-anchor":`middle`}}},n),Hh=(e,t,n)=>Lh({position:{x:0,y:15},attrs:{".":{y:`.6em`,"text-anchor":`middle`}}},n),Uh=(e,t,n)=>qh(e,t,!1,n),Wh=(e,t,n)=>qh(e,t,!0,n),Gh=(e,t,n)=>Jh(e,t,!1,n),Kh=(e,t,n)=>Jh(e,t,!0,n);function qh(e,t,n,r){let i=r.offset==null?15:r.offset,a=t.getCenter().theta(e),o=Yh(t),s,c,l,u,d=0;return a<o[1]||a>o[2]?(s=`.3em`,c=i,l=0,u=`start`):a<o[0]?(s=`0`,c=0,l=-i,n?(d=-90,u=`start`):u=`middle`):a<o[3]?(s=`.3em`,c=-i,l=0,u=`end`):(s=`.6em`,c=0,l=i,n?(d=90,u=`start`):u=`middle`),Lh({position:{x:Math.round(c),y:Math.round(l)},angle:d,attrs:{".":{y:s,"text-anchor":u}}},r)}function Jh(e,t,n,r){let i=r.offset==null?15:r.offset,a=t.getCenter().theta(e),o=Yh(t),s,c,l,u,d=0;return a<o[1]||a>o[2]?(s=`.3em`,c=-i,l=0,u=`end`):a<o[0]?(s=`.6em`,c=0,l=i,n?(d=90,u=`start`):u=`middle`):a<o[3]?(s=`.3em`,c=i,l=0,u=`start`):(s=`0em`,c=0,l=-i,n?(d=-90,u=`start`):u=`middle`),Lh({position:{x:Math.round(c),y:Math.round(l)},angle:d,attrs:{".":{y:s,"text-anchor":u}}},r)}function Yh(e){let t=e.getCenter(),n=t.theta(e.getTopLeft()),r=t.theta(e.getBottomLeft()),i=t.theta(e.getBottomRight());return[n,t.theta(e.getTopRight()),i,r]}var Xh=(e,t,n)=>Qh(e.diff(t.getCenter()),!1,n),Zh=(e,t,n)=>Qh(e.diff(t.getCenter()),!0,n);function Qh(e,t,n){let r=n.offset==null?20:n.offset,i=new z(0,0),a=-e.theta(i),o=e.clone().move(i,r).diff(e).round(),s=`.3em`,c,l=a;return(a+90)%180==0?(c=t?`end`:`middle`,!t&&a===-270&&(s=`0em`)):a>-270&&a<-90?(c=`start`,l=a-180):c=`end`,Lh({position:o.round().toJSON(),angle:t?l:0,attrs:{".":{y:s,"text-anchor":c}}},n)}var $h=n({bottom:()=>Hh,inside:()=>Gh,insideOriented:()=>Kh,left:()=>zh,manual:()=>Rh,outside:()=>Uh,outsideOriented:()=>Wh,radial:()=>Xh,radialOriented:()=>Zh,right:()=>Bh,top:()=>Vh}),eg;(function(e){e.presets=$h,e.registry=rp.create({type:`port label layout`}),e.registry.register(e.presets,!0)})(eg||={});var tg=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},W=class e extends Al{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=ng.uniqueId(),e.views[this.cid]=this}confirmUpdate(e,t){return 0}empty(e=this.container){return Ou(e),this}unmount(e=this.container){return Du(e),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),delete e.views[this.cid],this.disposeContainer&&this.unmount(t)):this.unmount(t),this}onRemove(){}setClass(e,t=this.container){t.classList.value=Array.isArray(e)?e.join(` `):e}addClass(e,t=this.container){return N(t,Array.isArray(e)?e.join(` `):e),this}removeClass(e,t=this.container){return lu(t,Array.isArray(e)?e.join(` `):e),this}setStyle(e,t=this.container){return ud(t,e),this}setAttrs(e,t=this.container){return e!=null&&t!=null&&P(t,e),this}findAttr(e,t=this.container){let n=t;for(;n&&n.nodeType===1;){let t=n.getAttribute(e);if(t!=null)return t;if(n===this.container)return null;n=n.parentNode}return null}find(t,n=this.container,r=this.selectors){return e.find(t,n,r).elems}findOne(e,t=this.container,n=this.selectors){let r=this.find(e,t,n);return r.length>0?r[0]:null}findByAttr(e,t=this.container){let n=t;for(;n&&n.getAttribute;){let t=n.getAttribute(e);if((t!=null||n===this.container)&&t!==`false`)return n;n=n.parentNode}return null}getSelector(e,t){let n;if(e===this.container)return typeof t==`string`&&(n=`> ${t}`),n;if(e){let r=Su(e)+1;n=`${e.tagName.toLowerCase()}:nth-child(${r})`,t&&(n+=` > ${t}`),n=this.getSelector(e.parentNode,n)}return n}prefixClassName(e){return dh.prefix(e)}delegateEvents(e,t){if(e==null)return this;t||this.undelegateEvents();let n=/^(\S+)\s*(.*)$/;return Object.keys(e).forEach(t=>{let r=t.match(n);if(r==null)return;let i=this.getEventHandler(e[t]);typeof i==`function`&&this.delegateEvent(r[1],r[2],i)}),this}undelegateEvents(){return ff.off(this.container,this.getEventNamespace()),this}delegateDocumentEvents(e,t){return this.addEventListeners(document,e,t),this}undelegateDocumentEvents(){return this.removeEventListeners(document),this}delegateEvent(e,t,n){return ff.on(this.container,e+this.getEventNamespace(),t,n),this}undelegateEvent(e,t,n){let r=e+this.getEventNamespace();return t==null?ff.off(this.container,r):typeof t==`string`?ff.off(this.container,r,t,n):ff.off(this.container,r,t),this}addEventListeners(e,t,n){if(t==null)return this;let r=this.getEventNamespace();return Object.keys(t).forEach(i=>{let a=this.getEventHandler(t[i]);typeof a==`function`&&ff.on(e,i+r,n,a)}),this}removeEventListeners(e){return e!=null&&ff.off(e,this.getEventNamespace()),this}getEventNamespace(){return`.${dh.prefixCls}-event-${this.cid}`}getEventHandler(e){let t;if(typeof e==`string`){let n=this[e];typeof n==`function`&&(t=(...e)=>n.call(this,...e))}else t=(...t)=>e.call(this,...t);return t}getEventTarget(e,t={}){let{target:n,type:r,clientX:i=0,clientY:a=0}=e;return t.fromPoint||r===`touchmove`||r===`touchend`?document.elementFromPoint(i,a):n}stopPropagation(e){return this.setEventData(e,{propagationStopped:!0}),this}isPropagationStopped(e){return this.getEventData(e).propagationStopped===!0}getEventData(e){return this.eventData(e)}setEventData(e,t){return this.eventData(e,t)}eventData(e,t){if(e==null)throw TypeError(`Event object required`);let n=e.data,r=`__${this.cid}__`;return t==null?n==null?{}:n[r]||{}:(n??=e.data={},n[r]==null?n[r]=Object.assign({},t):n[r]=Object.assign(Object.assign({},n[r]),t),n[r])}normalizeEvent(t){return e.normalizeEvent(t)}dispose(){this.remove()}};tg([W.dispose()],W.prototype,`dispose`,null),(function(e){function t(e,t){return t?vu(e||`g`):_u(e||`div`)}e.createElement=t;function n(e,t,n){if(!e||e===`.`)return{elems:[t]};if(n){let t=n[e];if(t)return{elems:Array.isArray(t)?t:[t]}}if(dh.useCSSSelector){let n=e.includes(`>`)?`:scope ${e}`:e;return{isCSSSelector:!0,elems:Array.prototype.slice.call(t.querySelectorAll(n))}}return{elems:[]}}e.find=n;function r(e){let t=e,n=e.originalEvent,r=n&&n.changedTouches&&n.changedTouches[0];if(r){for(let t in e)r[t]===void 0&&(r[t]=e[t]);t=r}return t}e.normalizeEvent=r})(W||={}),(function(e){e.views={};function t(t){return e.views[t]||null}e.getView=t})(W||={});var ng;(function(e){let t=0;function n(){let e=`v${t}`;return t+=1,e}e.uniqueId=n})(ng||={});var rg=class{constructor(e){this.view=e,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Df,this.pathCache={}}get(e){return this.elemCache.has(e)||this.elemCache.set(e,{}),this.elemCache.get(e)}getData(e){let t=this.get(e);return t.data||={},t.data}getMatrix(e){let t=this.get(e);if(t.matrix==null){let n=this.view.container;t.matrix=rf(e,n)}return Hd(t.matrix)}getShape(e){let t=this.get(e);return t.shape??=U.toGeometryShape(e),t.shape.clone()}getBoundingRect(e){let t=this.get(e);return t.boundingRect??=U.getBBoxV2(e),t.boundingRect.clone()}},G;(function(e){function t(e){return e!=null&&!n(e)}e.isJSONMarkup=t;function n(e){return e!=null&&typeof e==`string`}e.isStringMarkup=n;function r(e){return e==null||n(e)?e:j(e)}e.clone=r;function i(e){return`${e}`.trim().replace(/[\r|\n]/g,` `).replace(/>\s+</g,`><`)}e.sanitize=i;function a(e,t={ns:hu.svg}){let n=document.createDocumentFragment(),r={},i={},a=[{markup:Array.isArray(e)?e:[e],parent:n,ns:t.ns}];for(;a.length>0;){let e=a.pop(),t=e.ns||hu.svg,n=e.markup,o=e.parent;n.forEach(e=>{let n=e.tagName;if(!n)throw TypeError(`Invalid tagName`);e.ns&&(t=e.ns);let s=t?_u(n,t):gu(n),c=e.attrs;c&&P(s,Hu(c));let l=e.style;l&&ud(s,l);let u=e.className;u!=null&&s.setAttribute(`class`,Array.isArray(u)?u.join(` `):u),e.textContent&&(s.textContent=e.textContent);let d=e.selector;if(d!=null){if(i[d])throw TypeError(`Selector must be unique`);i[d]=s}if(e.groupSelector){let t=e.groupSelector;Array.isArray(t)||(t=[t]),t.forEach(e=>{r[e]||(r[e]=[]),r[e].push(s)})}o.appendChild(s);let f=e.children;Array.isArray(f)&&a.push({ns:t,markup:f,parent:s})})}return Object.keys(r).forEach(e=>{if(i[e])throw Error(`Ambiguous group selector`);i[e]=r[e]}),{fragment:n,selectors:i,groups:r}}e.parseJSONMarkup=a;function o(e){return e instanceof SVGElement?vu(`g`):gu(`div`)}function s(e){if(n(e)){let t=F.createVectors(e),n=t.length;if(n===1)return{elem:t[0].node};if(n>1){let e=o(t[0].node);return t.forEach(t=>{e.appendChild(t.node)}),{elem:e}}return{}}let t=a(e),r=t.fragment,i=null;return r.childNodes.length>1?(i=o(r.firstChild),i.appendChild(r)):i=r.firstChild,{elem:i,selectors:t.selectors}}e.renderMarkup=s;function c(e){let t=F.createVectors(e),n=document.createDocumentFragment();for(let e=0,r=t.length;e<r;e+=1){let r=t[e].node;n.appendChild(r)}return{fragment:n,selectors:{}}}e.parseLabelStringMarkup=c})(G||={}),(function(e){function t(e,n,r){if(e!=null){let i,a=e.tagName.toLowerCase();if(e===n)return i=typeof r==`string`?`> ${a} > ${r}`:`> ${a}`,i;let o=e.parentNode;return i=o&&o.childNodes.length>1?`${a}:nth-child(${Su(e)+1})`:a,r&&(i+=` > ${r}`),t(e.parentNode,n,i)}return r}e.getSelector=t})(G||={}),(function(e){function t(){return`g`}e.getPortContainerMarkup=t;function n(){return{tagName:`circle`,selector:`circle`,attrs:{r:10,fill:`#FFFFFF`,stroke:`#000000`}}}e.getPortMarkup=n;function r(){return{tagName:`text`,selector:`text`,attrs:{fill:`#000000`}}}e.getPortLabelMarkup=r})(G||={}),(function(e){function t(){return[{tagName:`path`,selector:`wrap`,groupSelector:`lines`,attrs:{fill:`none`,cursor:`pointer`,stroke:`transparent`,strokeLinecap:`round`}},{tagName:`path`,selector:`line`,groupSelector:`lines`,attrs:{fill:`none`,pointerEvents:`none`}}]}e.getEdgeMarkup=t})(G||={}),(function(e){function t(e=!1){return{tagName:`foreignObject`,selector:`fo`,children:[{ns:hu.xhtml,tagName:`body`,selector:`foBody`,attrs:{xmlns:hu.xhtml},style:{width:`100%`,height:`100%`,background:`transparent`},children:e?[]:[{tagName:`div`,selector:`foContent`,style:{width:`100%`,height:`100%`}}]}]}}e.getForeignObjectMarkup=t})(G||={});var ig=class{constructor(e){this.view=e}get cell(){return this.view.cell}getDefinition(e){return this.cell.getAttrDefinition(e)}processAttrs(e,t){let n,r,i,a,o=[];return Object.keys(t).forEach(r=>{let i=t[r],a=this.getDefinition(r),s=M(uh.isValidDefinition,this.view,a,i,{elem:e,attrs:t,cell:this.cell,view:this.view});if(a&&s)typeof a==`string`?(n??={},n[a]=i):i!==null&&o.push({name:r,definition:a});else{n??={};let e=Iu.includes(r)?r:Ml(r);n[e]=i}}),o.forEach(({name:e,definition:n})=>{let o=t[e];typeof n.set==`function`&&(r??={},r[e]=o),typeof n.offset==`function`&&(i??={},i[e]=o),typeof n.position==`function`&&(a??={},a[e]=o)}),{raw:t,normal:n,set:r,offset:i,position:a}}mergeProcessedAttrs(e,t){e.set=Object.assign(Object.assign({},e.set),t.set),e.position=Object.assign(Object.assign({},e.position),t.position),e.offset=Object.assign(Object.assign({},e.offset),t.offset);let n=e.normal&&e.normal.transform;n!=null&&t.normal&&(t.normal.transform=n),e.normal=t.normal}findAttrs(e,t,n,r){let i=[],a=new Df;return Object.keys(e).forEach(o=>{let s=e[o];if(!vr(s))return;let{isCSSSelector:c,elems:l}=W.find(o,t,r);n[o]=l;for(let e=0,t=l.length;e<t;e+=1){let n=l[e],u=r&&r[o]===n,d=a.get(n);if(d){d.array||(i.push(n),d.array=!0,d.attrs=[d.attrs],d.priority=[d.priority]);let e=d.attrs,r=d.priority;if(u)e.unshift(s),r.unshift(-1);else{let n=rl(r,c?-1:t);e.splice(n,0,s),r.splice(n,0,t)}}else a.set(n,{elem:n,attrs:s,priority:u?-1:t,array:!1})}}),i.forEach(e=>{let t=a.get(e);t.attrs=t.attrs.reduceRight((e,t)=>Gc(e,t),{})}),a}updateRelativeAttrs(e,t,n){let r=t.raw||{},i=t.normal||{},a=t.set,o=t.position,s=t.offset,c=()=>({elem:e,cell:this.cell,view:this.view,attrs:r,refBBox:n.clone()});if(a!=null&&Object.keys(a).forEach(e=>{let t=a[e],n=this.getDefinition(e);if(n!=null){let r=M(n.set,this.view,t,c());typeof r==`object`?i=Object.assign(Object.assign({},i),r):r!=null&&(i[e]=r)}}),e instanceof HTMLElement){this.view.setAttrs(i,e);return}let l=i.transform,u=Wd(l?`${l}`:null),d=new z(u.e,u.f);l&&(delete i.transform,u.e=0,u.f=0);let f=!1;o!=null&&Object.keys(o).forEach(e=>{let t=o[e],n=this.getDefinition(e);if(n!=null){let e=M(n.position,this.view,t,c());e!=null&&(f=!0,d.translate(z.create(e)))}}),this.view.setAttrs(i,e);let p=!1;if(s!=null){let t=this.view.getBoundingRectOfElement(e);if(t.width>0&&t.height>0){let n=U.transformRectangle(t,u);Object.keys(s).forEach(t=>{let i=s[t],a=this.getDefinition(t);if(a!=null){let t=M(a.offset,this.view,i,{elem:e,cell:this.cell,view:this.view,attrs:r,refBBox:n});t!=null&&(p=!0,d.translate(z.create(t)))}})}}(l!=null||f||p)&&(d.round(1),u.e=Number.isFinite(d.x)?d.x:0,u.f=Number.isFinite(d.y)?d.y:0,e.setAttribute(`transform`,Gd(u)))}update(e,t,n){let r={},i=this.findAttrs(n.attrs||t,e,r,n.selectors),a=n.attrs?this.findAttrs(t,e,r,n.selectors):i,o=[];i.each(t=>{let i=t.elem,s=t.attrs,c=this.processAttrs(i,s);if(c.set==null&&c.position==null&&c.offset==null)this.view.setAttrs(c.normal,i);else{let t=a.get(i),l=t?t.attrs:null,u=l&&s.ref==null?l.ref:s.ref,d;if(u){if(d=(r[u]||this.view.find(u,e,n.selectors))[0],!d)throw Error(`"${u}" reference does not exist.`)}else d=null;let f={node:i,refNode:d,attributes:l,processedAttributes:c},p=o.findIndex(e=>e.refNode===i);p>-1?o.splice(p,0,f):o.push(f)}});let s=new Df,c;o.forEach(t=>{let r=t.node,i=t.refNode,a,o=i!=null&&n.rotatableNode!=null&&Eu(n.rotatableNode,i);if(i&&(a=s.get(i)),!a){let t=o?n.rotatableNode:e;a=i?U.getBBox(i,{target:t}):n.rootBBox,i&&s.set(i,a)}let l;n.attrs&&t.attributes?(l=this.processAttrs(r,t.attributes),this.mergeProcessedAttrs(l,t.processedAttributes)):l=t.processedAttributes;let u=a;o&&n.rotatableNode!=null&&!n.rotatableNode.contains(r)&&(c||=Wd(P(n.rotatableNode,`transform`)),u=U.transformRectangle(a,c)),this.updateRelativeAttrs(r,l,u)})}},ag=class{get cell(){return this.view.cell}constructor(e,t,n=[]){this.view=e;let r={},i={},a=0;Object.keys(t).forEach(e=>{let n=t[e];Array.isArray(n)||(n=[n]),n.forEach(t=>{let n=r[t];n||=(a+=1,r[t]=1<<a),i[e]|=n})});let o=n;if(Array.isArray(o)||(o=[o]),o.forEach(e=>{r[e]||(a+=1,r[e]=1<<a)}),a>25)throw Error(`Maximum number of flags exceeded.`);this.flags=r,this.attrs=i,this.bootstrap=n}getFlag(e){let t=this.flags;return t==null?0:Array.isArray(e)?e.reduce((e,n)=>e|t[n],0):t[e]|0}hasAction(e,t){return e&this.getFlag(t)}removeAction(e,t){return e^e&this.getFlag(t)}getBootstrapFlag(){return this.getFlag(this.bootstrap)}getChangedFlag(){let e=0;return this.attrs&&Object.keys(this.attrs).forEach(t=>{this.cell.hasChanged(t)&&(e|=this.attrs[t])}),e}},og=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},sg=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},cg=class e extends W{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){let t=(e,t)=>t==null?Array.isArray(e)?[...e]:[e]:fl([...Array.isArray(e)?e:[e],...Array.isArray(t)?t:[t]]),n=j(this.getDefaults()),{bootstrap:r,actions:i,events:a,documentEvents:o}=e,s=sg(e,[`bootstrap`,`actions`,`events`,`documentEvents`]);return r&&(n.bootstrap=t(n.bootstrap,r)),i&&Object.entries(i).forEach(([e,r])=>{let i=n.actions[e];r&&i?n.actions[e]=t(i,r):r&&(n.actions[e]=t(r))}),a&&(n.events=Object.assign(Object.assign({},n.events),a)),e.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),o)),Gc(n,s)}get[Symbol.toStringTag](){return e.toStringTag}constructor(e,t={}){super(),this.cell=e,this.options=this.ensureOptions(t),this.graph=this.options.graph,this.attr=new ig(this),this.flag=new ag(this,this.options.actions,this.options.bootstrap),this.cache=new rg(this),this.setContainer(this.ensureContainer()),this.setup(),this.init()}init(){}onRemove(){this.removeTools()}get priority(){return this.options.priority}get rootSelector(){return this.options.rootSelector}getConstructor(){return this.constructor}ensureOptions(e){return this.getConstructor().getOptions(e)}getContainerTagName(){return this.options.isSvgElement?`g`:`div`}getContainerStyle(){}getContainerAttrs(){return{"data-cell-id":this.cell.id,"data-shape":this.cell.shape}}getContainerClassName(){return this.prefixClassName(`cell`)}ensureContainer(){return W.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(e){if(this.container!==e){this.undelegateEvents(),this.container=e,this.options.events!=null&&this.delegateEvents(this.options.events);let t=this.getContainerAttrs();t!=null&&this.setAttrs(t,e);let n=this.getContainerStyle();n!=null&&this.setStyle(n,e);let r=this.getContainerClassName();r!=null&&this.addClass(r,e)}return this}isNodeView(){return!1}isEdgeView(){return!1}render(){return this}confirmUpdate(e,t={}){return 0}getBootstrapFlag(){return this.flag.getBootstrapFlag()}getFlag(e){return this.flag.getFlag(e)}hasAction(e,t){return this.flag.hasAction(e,t)}removeAction(e,t){return this.flag.removeAction(e,t)}handleAction(e,t,n,r){if(this.hasAction(e,t)){n();let i=[t];return r&&(typeof r==`string`?i.push(r):i.push(...r)),this.removeAction(e,i)}return e}setup(){this.cell.on(`changed`,this.onCellChanged,this)}onCellChanged({options:e}){this.onAttrsChange(e)}onAttrsChange(e){let t=this.flag.getChangedFlag();!e.updated&&t&&(e.dirty&&this.hasAction(t,`update`)&&(t|=this.getFlag(`render`)),e.toolId&&(e.async=!1),this.graph!=null&&this.graph.renderer.requestViewUpdate(this,t,e))}parseJSONMarkup(e,t){let n=G.parseJSONMarkup(e),r=n.selectors,i=this.rootSelector;if(t&&i){if(r[i])throw Error(`Invalid root selector`);r[i]=t}return n}can(e){let t=this.graph.options.interacting;if(typeof t==`function`&&(t=M(t,this.graph,this)),typeof t==`object`){let n=t[e];return typeof n==`function`&&(n=M(n,this.graph,this)),n!==!1}return typeof t==`boolean`&&t}cleanCache(){return this.cache.clean(),this}getCache(e){return this.cache.get(e)}getDataOfElement(e){return this.cache.getData(e)}getMatrixOfElement(e){return this.cache.getMatrix(e)}getShapeOfElement(e){return this.cache.getShape(e)}getBoundingRectOfElement(e){return this.cache.getBoundingRect(e)}getBBoxOfElement(e){let t=this.getBoundingRectOfElement(e),n=this.getMatrixOfElement(e),r=this.getRootRotatedMatrix(),i=this.getRootTranslatedMatrix();return U.transformRectangle(t,i.multiply(r).multiply(n))}getUnrotatedBBoxOfElement(e){let t=this.getBoundingRectOfElement(e),n=this.getMatrixOfElement(e),r=this.getRootTranslatedMatrix();return U.transformRectangle(t,r.multiply(n))}getBBox(e={}){let t;if(e.useCellGeometry){let e=this.cell,n=e.isNode()?e.getAngle():0;t=e.getBBox().bbox(n)}else t=this.getBBoxOfElement(this.container);return this.graph.coord.localToGraphRect(t)}getRootTranslatedMatrix(){let e=this.cell,t=e.isNode()?e.getPosition():{x:0,y:0};return Hd().translate(t.x,t.y)}getRootRotatedMatrix(){let e=Hd(),t=this.cell,n=t.isNode()?t.getAngle():0;if(n){let r=t.getBBox(),i=r.width/2,a=r.height/2;e=e.translate(i,a).rotate(n).translate(-i,-a)}return e}findMagnet(e=this.container){return this.findByAttr(`magnet`,e)}updateAttrs(e,t,n={}){n.rootBBox??=new B,n.selectors??=this.selectors,this.attr.update(e,t,n)}isEdgeElement(e){return this.cell.isEdge()&&(e==null||e===this.container)}prepareHighlight(e,t={}){let n=e||this.container;return t.partial=n===this.container,n}highlight(e,t={}){let n=this.prepareHighlight(e,t);return this.notify(`cell:highlight`,{magnet:n,options:t,view:this,cell:this.cell}),this.isEdgeView()?this.notify(`edge:highlight`,{magnet:n,options:t,view:this,edge:this.cell,cell:this.cell}):this.isNodeView()&&this.notify(`node:highlight`,{magnet:n,options:t,view:this,node:this.cell,cell:this.cell}),this}unhighlight(e,t={}){let n=this.prepareHighlight(e,t);return this.notify(`cell:unhighlight`,{magnet:n,options:t,view:this,cell:this.cell}),this.isNodeView()?this.notify(`node:unhighlight`,{magnet:n,options:t,view:this,node:this.cell,cell:this.cell}):this.isEdgeView()&&this.notify(`edge:unhighlight`,{magnet:n,options:t,view:this,edge:this.cell,cell:this.cell}),this}notifyUnhighlight(e,t){}getEdgeTerminal(e,t,n,r,i){let a=this.cell,o=this.findAttr(`port`,e),s=e.getAttribute(`data-selector`),c={cell:a.id};return s!=null&&(c.magnet=s),o==null?s==null&&this.container!==e&&(c.selector=this.getSelector(e)):(c.port=o,a.isNode()&&!a.hasPort(o)&&s==null&&(c.selector=this.getSelector(e))),c}getMagnetFromEdgeTerminal(e){let t=this.cell,n=this.container,r=e.port,i=e.magnet,a;return r!=null&&t.isNode()&&t.hasPort(r)?a=this.findPortElem(r,i)||n:(i||=e.selector,!i&&r!=null&&(i=`[port="${r}"]`),a=this.findOne(i,n,this.selectors)),a}hasTools(e){let t=this.tools;return t==null?!1:e==null||t.name===e}addTools(e){if(this.removeTools(),e){if(!this.can(`toolsAddable`))return this;let t=lg.isToolsView(e)?e:new lg(e);this.tools=t,t.config({view:this}),t.mount()}return this}updateTools(e={}){return this.tools&&this.tools.update(e),this}removeTools(){return this.tools&&=(this.tools.remove(),null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){let e=this.cell.getTools();return this.addTools(e),this}notify(e,t){return this.trigger(e,t),this.graph.trigger(e,t),this}getEventArgs(e,t,n){let r=this,i=r.cell;return t==null||n==null?{e,view:r,cell:i}:{e,x:t,y:n,view:r,cell:i}}onClick(e,t,n){this.notify(`cell:click`,this.getEventArgs(e,t,n))}onDblClick(e,t,n){this.notify(`cell:dblclick`,this.getEventArgs(e,t,n))}onContextMenu(e,t,n){this.notify(`cell:contextmenu`,this.getEventArgs(e,t,n))}onMouseDown(e,t,n){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch(`mouse`)),this.notify(`cell:mousedown`,this.getEventArgs(e,t,n))}onMouseUp(e,t,n){this.notify(`cell:mouseup`,this.getEventArgs(e,t,n)),this.cachedModelForMouseEvent&&=(this.cachedModelForMouseEvent.stopBatch(`mouse`,{cell:this.cell}),null)}onMouseMove(e,t,n){this.notify(`cell:mousemove`,this.getEventArgs(e,t,n))}onMouseOver(e){this.notify(`cell:mouseover`,this.getEventArgs(e))}onMouseOut(e){this.notify(`cell:mouseout`,this.getEventArgs(e))}onMouseEnter(e){this.notify(`cell:mouseenter`,this.getEventArgs(e))}onMouseLeave(e){this.notify(`cell:mouseleave`,this.getEventArgs(e))}onMouseWheel(e,t,n,r){this.notify(`cell:mousewheel`,Object.assign({delta:r},this.getEventArgs(e,t,n)))}onCustomEvent(e,t,n,r){this.notify(`cell:customevent`,Object.assign({name:t},this.getEventArgs(e,n,r))),this.notify(t,Object.assign({},this.getEventArgs(e,n,r)))}onMagnetMouseDown(e,t,n,r){}onMagnetDblClick(e,t,n,r){}onMagnetContextMenu(e,t,n,r){}onLabelMouseDown(e,t,n){}checkMouseleave(e){let t=this.getEventTarget(e,{fromPoint:!0}),n=this.graph.findViewByElem(t);n!==this&&(this.onMouseLeave(e),n&&n.onMouseEnter(e))}dispose(){this.cell.off(`changed`,this.onCellChanged,this)}};cg.defaults={isSvgElement:!0,rootSelector:`root`,priority:0,bootstrap:[],actions:{}},og([cg.dispose()],cg.prototype,`dispose`,null),(function(e){e.Flag=ag,e.Attr=ig})(cg||={}),(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||typeof r.isNodeView!=`function`||typeof r.isEdgeView!=`function`||typeof r.confirmUpdate!=`function`)}e.isCellView=t})(cg||={}),(function(e){function t(e){return function(t){t.config({priority:e})}}e.priority=t;function n(e){return function(t){t.config({bootstrap:e})}}e.bootstrap=n})(cg||={}),(function(e){e.registry=rp.create({type:`view`})})(cg||={});var lg=class e extends W{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super(),this.svgContainer=this.createContainer(!0,e),this.htmlContainer=this.createContainer(!1,e),this.config(e)}createContainer(e,t){let n=e?W.createElement(`g`,!0):W.createElement(`div`,!1);return N(n,this.prefixClassName(`cell-tools`)),t.className&&N(n,t.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!cg.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(N(this.svgContainer,this.prefixClassName(`edge-tools`)),N(this.htmlContainer,this.prefixClassName(`edge-tools`))):this.cell.isNode()&&(N(this.svgContainer,this.prefixClassName(`node-tools`)),N(this.htmlContainer,this.prefixClassName(`node-tools`))),this.svgContainer.setAttribute(`data-cell-id`,this.cell.id),this.htmlContainer.setAttribute(`data-cell-id`,this.cell.id),this.name&&(this.svgContainer.setAttribute(`data-tools-name`,this.name),this.htmlContainer.setAttribute(`data-tools-name`,this.name));let n=this.options.items;if(!Array.isArray(n))return this;this.tools=[];let r=[];n.forEach(t=>{e.ToolItem.isToolItem(t)?t.name===`vertices`?r.unshift(t):r.push(t):(typeof t==`object`?t.name:t)===`vertices`?r.unshift(t):r.push(t)});for(let t=0;t<r.length;t+=1){let n=r[t],i;if(e.ToolItem.isToolItem(n))i=n;else{let e=typeof n==`object`?n.name:n,t=typeof n==`object`&&n.args||{};if(e){if(this.cell.isNode()){let n=Fg.registry.get(e);if(n)i=new n(t);else return Fg.registry.onNotFound(e)}else if(this.cell.isEdge()){let n=Ig.registry.get(e);if(n)i=new n(t);else return Ig.registry.onNotFound(e)}}}i&&(i.config(this.cellView,this),i.render(),(i.options.isSVGElement===!1?this.htmlContainer:this.svgContainer).appendChild(i.container),this.tools.push(i))}return this}update(e={}){let t=this.tools;return t&&t.forEach(t=>{e.toolId!==t.cid&&t.isVisible()&&t.update()}),this}focus(e){let t=this.tools;return t&&t.forEach(t=>{e===t?t.show():t.hide()}),this}blur(e){let t=this.tools;return t&&t.forEach(t=>{t!==e&&!t.isVisible()&&(t.show(),t.update())}),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){let e=this.tools;return e&&(e.forEach(e=>e.remove()),this.tools=null),Du(this.svgContainer),Du(this.htmlContainer),super.remove()}mount(){let e=this.tools,t=this.cellView;if(t&&e){let n=e.some(e=>e.options.isSVGElement!==!1),r=e.some(e=>e.options.isSVGElement===!1);n&&(this.options.local?t.container:t.graph.view.decorator).appendChild(this.svgContainer),r&&this.graph.container.appendChild(this.htmlContainer)}return this}};(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||r.graph==null||r.cell==null||typeof r.config!=`function`||typeof r.update!=`function`||typeof r.focus!=`function`||typeof r.blur!=`function`||typeof r.show!=`function`||typeof r.hide!=`function`)}e.isToolsView=t})(lg||={}),(function(e){class t extends W{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){return Gc(j(this.getDefaults()),e)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return t.toStringTag}constructor(e={}){super(),this.visible=!0,this.options=this.getOptions(e),this.container=W.createElement(this.options.tagName||`g`,this.options.isSVGElement!==!1),N(this.container,this.prefixClassName(`cell-tool`)),typeof this.options.className==`string`&&N(this.container,this.options.className),this.init()}init(){}getOptions(e){return this.constructor.getOptions(e)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(e,t){return this.cellView=e,this.parent=t,this.stamp(this.container),this.cell.isEdge()?N(this.container,this.prefixClassName(`edge-tool`)):this.cell.isNode()&&N(this.container,this.prefixClassName(`node-tool`)),this.name&&this.container.setAttribute(`data-tool-name`,this.name),this.delegateEvents(),this}render(){this.empty();let e=this.options.markup;if(e){let t=G.parseJSONMarkup(e);this.container.appendChild(t.fragment),this.childNodes=t.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(e){e&&e.setAttribute(`data-cell-id`,this.cellView.cell.id)}show(){return this.container.style.display=``,this.visible=!0,this}hide(){return this.container.style.display=`none`,this.visible=!1,this}isVisible(){return this.visible}focus(){let e=this.options.focusOpacity;return e!=null&&Number.isFinite(e)&&(this.container.style.opacity=`${e}`),this.parent.focus(this),this}blur(){return this.container.style.opacity=``,this.parent.blur(this),this}guard(e){return this.graph==null||this.cellView==null||this.graph.view.guard(e,this.cellView)}}t.defaults={isSVGElement:!0,tagName:`g`},e.ToolItem=t,(function(e){let t=0;function n(e){return e?Nl(e):(t+=1,`CustomTool${t}`)}function r(e){let t=wl(n(e.name),this);return t.config(e),t}e.define=r})(t=e.ToolItem||={}),(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||r.graph==null||r.cell==null||typeof r.config!=`function`||typeof r.update!=`function`||typeof r.focus!=`function`||typeof r.blur!=`function`||typeof r.show!=`function`||typeof r.hide!=`function`||typeof r.isVisible!=`function`)}e.isToolItem=t})(t=e.ToolItem||={})})(lg||={});var ug=e=>e;function dg(e,t){return t===0?`0%`:`${Math.round(e/t*100)}%`}function fg(e){return(t,n,r,i)=>n.isEdgeElement(r)?mg(e,t,n,r,i):pg(e,t,n,r,i)}function pg(e,t,n,r,i){let a=n.cell,o=a.getAngle(),s=n.getUnrotatedBBoxOfElement(r),c=a.getBBox().getCenter(),l=z.create(i).rotate(o,c),u=l.x-s.x,d=l.y-s.y;return e&&(u=dg(u,s.width),d=dg(d,s.height)),t.anchor={name:`topLeft`,args:{dx:u,dy:d,rotate:!0}},t}function mg(e,t,n,r,i){let a=n.getConnection();if(!a)return t;let o=a.closestPointLength(i);return t.anchor=e?{name:`ratio`,args:{ratio:o/a.length()}}:{name:`length`,args:{length:o}},t}var hg=fg(!0),gg=fg(!1),_g=n({noop:()=>ug,pinAbsolute:()=>gg,pinRelative:()=>hg}),vg;(function(e){e.presets=_g,e.registry=rp.create({type:`connection strategy`}),e.registry.register(e.presets,!0)})(vg||={});function yg(e,t,n,r){return M(vg.presets.pinRelative,this.graph,{},t,n,e,this.cell,r,{}).anchor}function bg(e,t){return t?e.cell.getBBox():e.cell.isEdge()?e.getConnection().bbox():e.getUnrotatedBBoxOfElement(e.container)}var xg=class extends lg.ToolItem{onRender(){N(this.container,this.prefixClassName(`cell-tool-button`)),this.update()}update(){return this.updatePosition(),this}updatePosition(){let e=this.cellView.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();Qd(this.container,e,{absolute:!0})}getNodeMatrix(){let e=this.cellView,t=this.options,{x:n=0,y:r=0}=t,{offset:i,useCellGeometry:a,rotate:o}=t,s=bg(e,a),c=e.cell.getAngle();o||(s=s.bbox(c));let l=0,u=0;typeof i==`number`?(l=i,u=i):typeof i==`object`&&(l=i.x,u=i.y),n=zl(n,s.width),r=zl(r,s.height);let d=Hd().translate(s.x+s.width/2,s.y+s.height/2);return o&&(d=d.rotate(c)),d=d.translate(n+l-s.width/2,r+u-s.height/2),d}getEdgeMatrix(){let e=this.cellView,{offset:t=0,distance:n=0,rotate:r}=this.options,i,a,o,s=zl(n,1);i=s>=0&&s<=1?e.getTangentAtRatio(s):e.getTangentAtLength(s),i?(a=i.start,o=i.vector().vectorAngle(new z(1,0))||0):(a=e.getConnection().start,o=0);let c=Hd().translate(a.x,a.y).rotate(o);return c=typeof t==`object`?c.translate(t.x||0,t.y||0):c.translate(0,t),r||(c=c.rotate(-o)),c}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();let t=this.options.onClick;typeof t==`function`&&M(t,this.cellView,{e,view:this.cellView,cell:this.cellView.cell,btn:this})}};(function(e){e.config({name:`button`,useCellGeometry:!0,events:{mousedown:`onMouseDown`,touchstart:`onMouseDown`}})})(xg||={}),(function(e){e.Remove=e.define({name:`button-remove`,markup:[{tagName:`circle`,selector:`button`,attrs:{r:7,fill:`#FF1D00`,cursor:`pointer`}},{tagName:`path`,selector:`icon`,attrs:{d:`M -3 -3 3 3 M -3 3 3 -3`,fill:`none`,stroke:`#FFFFFF`,"stroke-width":2,"pointer-events":`none`}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:e,btn:t}){t.parent.remove(),e.cell.remove({ui:!0,toolId:t.cid})}})})(xg||={});var Sg=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Cg=class extends lg.ToolItem{onRender(){if(N(this.container,this.prefixClassName(`cell-tool-boundary`)),this.options.attrs){let e=this.options.attrs,{class:t}=e,n=Sg(e,[`class`]);P(this.container,Hu(n)),t&&N(this.container,t)}this.update()}update(){let e=this.cellView,t=this.options,{useCellGeometry:n,rotate:r}=t,i=Bl(t.padding),a=bg(e,n).moveAndExpand({x:-i.left,y:-i.top,width:i.left+i.right,height:i.top+i.bottom}),o=e.cell;if(o.isNode()){let e=o.getAngle();if(e){if(r){let t=o.getBBox().getCenter();ef(this.container,e,t.x,t.y,{absolute:!0})}else a=a.bbox(e)}}return P(this.container,a.toJSON()),this}};(function(e){e.config({name:`boundary`,tagName:`rect`,padding:10,useCellGeometry:!0,attrs:{fill:`none`,stroke:`#333`,"stroke-width":.5,"stroke-dasharray":`5, 5`,"pointer-events":`none`}})})(Cg||={});var wg=class extends lg.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName(`edge-tool-vertices`)),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){return this.vertices.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){let e=this.handles;this.handles=[],e&&e.forEach(e=>{this.stopHandleListening(e),e.remove()})}renderHandles(){let e=this.vertices;for(let t=0,n=e.length;t<n;t+=1){let n=e[t],r=this.options.createHandle,i=this.options.processHandle,a=r({index:t,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});i&&i(a),a.updatePosition(n.x,n.y),this.stamp(a.container),this.container.appendChild(a.container),this.handles.push(a),this.startHandleListening(a)}}updateHandles(){let e=this.vertices;for(let t=0,n=e.length;t<n;t+=1){let n=e[t],r=this.handles[t];r&&r.updatePosition(n.x,n.y)}}updatePath(){let e=this.childNodes.connection;e&&e.setAttribute(`d`,this.cellView.getConnectionPathData())}startHandleListening(e){let t=this.cellView;t.can(`vertexMovable`)&&(e.on(`change`,this.onHandleChange,this),e.on(`changing`,this.onHandleChanging,this),e.on(`changed`,this.onHandleChanged,this)),t.can(`vertexDeletable`)&&e.on(`remove`,this.onHandleRemove,this)}stopHandleListening(e){let t=this.cellView;t.can(`vertexMovable`)&&(e.off(`change`,this.onHandleChange,this),e.off(`changing`,this.onHandleChanging,this),e.off(`changed`,this.onHandleChanged,this)),t.can(`vertexDeletable`)&&e.off(`remove`,this.onHandleRemove,this)}getNeighborPoints(e){let t=this.cellView,n=this.vertices,r=e>0?n[e-1]:t.sourceAnchor,i=e<n.length-1?n[e+1]:t.targetAnchor;return{prev:z.create(r),next:z.create(i)}}getMouseEventArgs(e){let t=this.normalizeEvent(e),{x:n,y:r}=this.graph.snapToGrid(t.clientX,t.clientY);return{e:t,x:n,y:r}}onHandleChange({e}){this.focus();let t=this.cellView;if(t.cell.startBatch(`move-vertex`,{ui:!0,toolId:this.cid}),!this.options.stopPropagation){let{e:n,x:r,y:i}=this.getMouseEventArgs(e);this.eventData(n,{start:{x:r,y:i}}),t.notifyMouseDown(n,r,i)}}onHandleChanging({handle:e,e:t}){let n=this.cellView,r=e.options.index,{e:i,x:a,y:o}=this.getMouseEventArgs(t),s={x:a,y:o};this.snapVertex(s,r),n.cell.setVertexAt(r,s,{ui:!0,toolId:this.cid}),e.updatePosition(s.x,s.y),this.options.stopPropagation||n.notifyMouseMove(i,a,o)}stopBatch(e){this.cell.stopBatch(`move-vertex`,{ui:!0,toolId:this.cid}),e&&this.cell.stopBatch(`add-vertex`,{ui:!0,toolId:this.cid})}onHandleChanged({e}){let t=this.options,n=this.cellView;if(t.addable&&this.updatePath(),!t.removeRedundancies){this.stopBatch(this.eventData(e).vertexAdded);return}n.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(e).vertexAdded);let{e:r,x:i,y:a}=this.getMouseEventArgs(e);if(!this.options.stopPropagation){n.notifyMouseUp(r,i,a);let{start:e}=this.eventData(r);if(e){let{x:t,y:o}=e;t===i&&o===a&&n.onClick(r,i,a)}}n.checkMouseleave(r),t.onChanged&&t.onChanged({edge:n.cell,edgeView:n})}snapVertex(e,t){let n=this.options.snapRadius||0;if(n>0){let r=this.getNeighborPoints(t),i=r.prev,a=r.next;Math.abs(e.x-i.x)<n?e.x=i.x:Math.abs(e.x-a.x)<n&&(e.x=a.x),Math.abs(e.y-i.y)<n?e.y=r.prev.y:Math.abs(e.y-a.y)<n&&(e.y=a.y)}}onHandleRemove({handle:e,e:t}){if(this.options.removable){let n=e.options.index,r=this.cellView;r.cell.removeVertexAt(n,{ui:!0}),this.options.addable&&this.updatePath(),r.checkMouseleave(this.normalizeEvent(t))}}allowAddVertex(e){let t=this.guard(e),n=this.options.addable&&this.cellView.can(`vertexAddable`),r=!this.options.modifiers||Of.isMatch(e,this.options.modifiers);return!t&&n&&r}onPathMouseDown(e){let t=this.cellView;if(!this.allowAddVertex(e))return;e.stopPropagation(),e.preventDefault();let n=this.normalizeEvent(e),r=this.graph.snapToGrid(n.clientX,n.clientY).toJSON();t.cell.startBatch(`add-vertex`,{ui:!0,toolId:this.cid});let i=t.getVertexIndex(r.x,r.y);this.snapVertex(r,i),t.cell.insertVertex(r,i,{ui:!0,toolId:this.cid}),this.render();let a=this.handles[i];this.eventData(n,{vertexAdded:!0}),a.onMouseDown(n)}onRemove(){this.resetHandles()}};(function(e){class t extends W{get graph(){return this.options.graph}constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:`onMouseDown`,touchstart:`onMouseDown`,dblclick:`onDoubleClick`})}render(){this.container=W.createElement(`circle`,!0);let t=this.options.attrs;if(typeof t==`function`){let n=e.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),t(this)))}else this.setAttrs(t);this.addClass(this.prefixClassName(`edge-tool-vertex`))}updatePosition(e,t){this.setAttrs({cx:e,cy:t})}onMouseDown(e){this.options.guard(e)||(e.stopPropagation(),e.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:`onMouseMove`,touchmove:`onMouseMove`,mouseup:`onMouseUp`,touchend:`onMouseUp`,touchcancel:`onMouseUp`},e.data),this.emit(`change`,{e,handle:this}))}onMouseMove(e){this.emit(`changing`,{e,handle:this})}onMouseUp(e){this.emit(`changed`,{e,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(e){this.emit(`remove`,{e,handle:this})}}e.Handle=t})(wg||={}),(function(e){let t=dh.prefix(`edge-tool-vertex-path`);e.config({name:`vertices`,snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:`#333`,stroke:`#fff`,cursor:`move`,"stroke-width":2},createHandle:t=>new e.Handle(t),markup:[{tagName:`path`,selector:`connection`,className:t,attrs:{fill:`none`,stroke:`transparent`,"stroke-width":10,cursor:`pointer`}}],events:{[`mousedown .${t}`]:`onPathMouseDown`,[`touchstart .${t}`]:`onPathMouseDown`}})})(wg||={});var Tg=class extends lg.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){N(this.container,this.prefixClassName(`edge-tool-segments`)),this.resetHandles();let e=this.cellView,t=[...this.vertices];t.unshift(e.sourcePoint),t.push(e.targetPoint);for(let e=0,n=t.length;e<n-1;e+=1){let n=t[e],r=t[e+1],i=this.renderHandle(n,r,e);this.stamp(i.container),this.handles.push(i)}return this}renderHandle(e,t,n){let r=this.options.createHandle({index:n,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(r),this.updateHandle(r,e,t),this.container.appendChild(r.container),this.startHandleListening(r),r}startHandleListening(e){e.on(`change`,this.onHandleChange,this),e.on(`changing`,this.onHandleChanging,this),e.on(`changed`,this.onHandleChanged,this)}stopHandleListening(e){e.off(`change`,this.onHandleChange,this),e.off(`changing`,this.onHandleChanging,this),e.off(`changed`,this.onHandleChanged,this)}resetHandles(){let e=this.handles;this.handles=[],e&&e.forEach(e=>{this.stopHandleListening(e),e.remove()})}shiftHandleIndexes(e){let t=this.handles;for(let n=0,r=t.length;n<r;n+=1)t[n].options.index+=e}resetAnchor(e,t){let n=this.cellView.cell,r={ui:!0,toolId:this.cid};t?n.prop([e,`anchor`],t,r):n.removeProp([e,`anchor`],r)}snapHandle(e,t,n){let r=e.options.axis,i=e.options.index,a=this.cellView.cell.getVertices(),o=a[i-2]||n.sourceAnchor,s=a[i+1]||n.targetAnchor,c=this.options.snapRadius;return Math.abs(t[r]-o[r])<c?t[r]=o[r]:Math.abs(t[r]-s[r])<c&&(t[r]=s[r]),t}onHandleChanging({handle:e,e:t}){let n=this.graph,r=this.options,i=this.cellView,a=r.anchor,o=e.options.axis,s=e.options.index-1,c=this.getEventData(t),l=this.normalizeEvent(t),u=n.snapToGrid(l.clientX,l.clientY),d=this.snapHandle(e,u.clone(),c),f=j(this.vertices),p=f[s],m=f[s+1],h=i.sourceView,g=i.sourceBBox,_=!1,v=!1;if(p?s===0?g.containsPoint(p)?(f.shift(),this.shiftHandleIndexes(-1),_=!0):(p[o]=d[o],v=!0):p[o]=d[o]:(p=i.sourceAnchor.toJSON(),p[o]=d[o],g.containsPoint(p)?_=!0:(f.unshift(p),this.shiftHandleIndexes(1),v=!0)),typeof a==`function`&&h){if(_){let e=c.sourceAnchor.clone();e[o]=d[o];let t=M(a,i,e,h,i.sourceMagnet||h.container,`source`,i,this);this.resetAnchor(`source`,t)}v&&this.resetAnchor(`source`,c.sourceAnchorDef)}let y=i.targetView,b=i.targetBBox,x=!1,S=!1;if(m?s===f.length-2?b.containsPoint(m)?(f.pop(),x=!0):(m[o]=d[o],S=!0):m[o]=d[o]:(m=i.targetAnchor.toJSON(),m[o]=d[o],b.containsPoint(m)?x=!0:(f.push(m),S=!0)),typeof a==`function`&&y){if(x){let e=c.targetAnchor.clone();e[o]=d[o];let t=M(a,i,e,y,i.targetMagnet||y.container,`target`,i,this);this.resetAnchor(`target`,t)}S&&this.resetAnchor(`target`,c.targetAnchorDef)}z.equalPoints(f,this.vertices)||this.cellView.cell.setVertices(f,{ui:!0,toolId:this.cid}),this.updateHandle(e,p,m,0),r.stopPropagation||i.notifyMouseMove(l,u.x,u.y)}onHandleChange({handle:e,e:t}){let n=this.options,r=this.handles,i=this.cellView,a=e.options.index;if(Array.isArray(r)){for(let e=0,t=r.length;e<t;e+=1)e!==a&&r[e].hide();if(this.focus(),this.setEventData(t,{sourceAnchor:i.sourceAnchor.clone(),targetAnchor:i.targetAnchor.clone(),sourceAnchorDef:j(this.cell.prop([`source`,`anchor`])),targetAnchorDef:j(this.cell.prop([`target`,`anchor`]))}),this.cell.startBatch(`move-segment`,{ui:!0,toolId:this.cid}),!n.stopPropagation){let e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY);i.notifyMouseDown(e,n.x,n.y)}}}onHandleChanged({e}){let t=this.options,n=this.cellView;t.removeRedundancies&&n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});let r=this.normalizeEvent(e),i=this.graph.snapToGrid(r.clientX,r.clientY);this.render(),this.blur(),this.cell.stopBatch(`move-segment`,{ui:!0,toolId:this.cid}),t.stopPropagation||n.notifyMouseUp(r,i.x,i.y),n.checkMouseleave(r),t.onChanged&&t.onChanged({edge:n.cell,edgeView:n})}updateHandle(e,t,n,r=0){let i=this.options.precision||0,a=Math.abs(t.x-n.x)<i,o=Math.abs(t.y-n.y)<i;if(a||o){let i=new V(t,n);if(i.length()<this.options.threshold)e.hide();else{let t=i.getCenter(),n=a?`x`:`y`;t[n]+=r||0;let o=i.vector().vectorAngle(new z(1,0));e.updatePosition(t.x,t.y,o,this.cellView),e.show(),e.options.axis=n}}else e.hide()}onRemove(){this.resetHandles()}};(function(e){class t extends W{constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:`onMouseDown`,touchstart:`onMouseDown`})}render(){this.container=W.createElement(`rect`,!0);let t=this.options.attrs;if(typeof t==`function`){let n=e.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),t(this)))}else this.setAttrs(t);this.addClass(this.prefixClassName(`edge-tool-segment`))}updatePosition(e,t,n,r){let i=r.getClosestPoint(new z(e,t))||new z(e,t),a=Hd().translate(i.x,i.y);if(i.equals({x:e,y:t}))a=a.rotate(n);else{let n=new V(e,t,i.x,i.y).vector().vectorAngle(new z(1,0));n!==0&&(n+=90),a=a.rotate(n)}this.setAttrs({transform:Gd(a),cursor:n%180==0?`row-resize`:`col-resize`})}onMouseDown(e){this.options.guard(e)||(this.trigger(`change`,{e,handle:this}),e.stopPropagation(),e.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:`onMouseMove`,touchmove:`onMouseMove`,mouseup:`onMouseUp`,touchend:`onMouseUp`,touchcancel:`onMouseUp`},e.data))}onMouseMove(e){this.emit(`changing`,{e,handle:this})}onMouseUp(e){this.emit(`changed`,{e,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=``}hide(){this.container.style.display=`none`}}e.Handle=t})(Tg||={}),(function(e){e.config({name:`segments`,precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:`#333`,stroke:`#fff`,"stroke-width":2},createHandle:t=>new e.Handle(t),anchor:yg})})(Tg||={});var Eg=class extends lg.ToolItem{get type(){return this.options.type}onRender(){N(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){let e=this.type;return this.cellView.getTerminalView(e)?(this.updateAnchor(),this.updateArea(),this.container.style.display=``):this.container.style.display=`none`,this}updateAnchor(){let e=this.childNodes;if(!e)return;let t=e.anchor;if(!t)return;let n=this.type,r=this.cellView,i=this.options,a=r.getTerminalAnchor(n),o=r.cell.prop([n,`anchor`]);t.setAttribute(`transform`,`translate(${a.x}, ${a.y})`);let s=o?i.customAnchorAttrs:i.defaultAnchorAttrs;s&&Object.keys(s).forEach(e=>{t.setAttribute(e,s[e])})}updateArea(){let e=this.childNodes;if(!e)return;let t=e.area;if(!t)return;let n=this.type,r=this.cellView,i=r.getTerminalView(n);if(i){let e=i.cell,a=r.getTerminalMagnet(n),o=this.options.areaPadding||0;Number.isFinite(o)||(o=0);let s,c,l;i.isEdgeElement(a)?(s=i.getBBox(),c=0,l=s.getCenter()):(s=i.getUnrotatedBBoxOfElement(a),c=e.getAngle(),l=s.getCenter(),c&&l.rotate(-c,e.getBBox().getCenter())),s.inflate(o),P(t,{x:-s.width/2,y:-s.height/2,width:s.width,height:s.height,transform:`translate(${l.x}, ${l.y}) rotate(${c})`})}}toggleArea(e){if(this.childNodes){let t=this.childNodes.area;t&&(t.style.display=e?``:`none`)}}onMouseDown(e){this.guard(e)||(e.stopPropagation(),e.preventDefault(),this.graph.view.undelegateEvents(),this.options.documentEvents&&this.delegateDocumentEvents(this.options.documentEvents),this.focus(),this.toggleArea(this.options.restrictArea),this.cell.startBatch(`move-anchor`,{ui:!0,toolId:this.cid}))}resetAnchor(e){let t=this.type,n=this.cell;e?n.prop([t,`anchor`],e,{rewrite:!0,ui:!0,toolId:this.cid}):n.removeProp([t,`anchor`],{ui:!0,toolId:this.cid})}onMouseMove(e){let t=this.type,n=this.cellView,r=n.getTerminalView(t);if(r==null)return;let i=this.normalizeEvent(e),a=r.cell,o=n.getTerminalMagnet(t),s=this.graph.coord.clientToLocalPoint(i.clientX,i.clientY),c=this.options.snap;if(typeof c==`function`){let e=M(c,n,s,r,o,t,n,this);s=z.create(e)}if(this.options.restrictArea){if(r.isEdgeElement(o)){let e=r.getClosestPoint(s);e&&(s=e)}else{let e=r.getUnrotatedBBoxOfElement(o),t=a.getAngle(),n=a.getBBox().getCenter(),i=s.clone().rotate(t,n);e.containsPoint(i)||(s=e.getNearestPointToPoint(i).rotate(-t,n))}}let l,u=this.options.anchor;typeof u==`function`&&(l=M(u,n,s,r,o,t,n,this)),this.resetAnchor(l),this.update()}onMouseUp(e){this.graph.view.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);let t=this.cellView;this.options.removeRedundancies&&t.removeRedundantLinearVertices({ui:!0,toolId:this.cid}),this.cell.stopBatch(`move-anchor`,{ui:!0,toolId:this.cid})}onDblClick(){let e=this.options.resetAnchor;e&&this.resetAnchor(e===!0?void 0:e),this.update()}};(function(e){e.config({tagName:`g`,markup:[{tagName:`circle`,selector:`anchor`,attrs:{cursor:`pointer`}},{tagName:`rect`,selector:`area`,attrs:{"pointer-events":`none`,fill:`none`,stroke:`#33334F`,"stroke-dasharray":`2,4`,rx:5,ry:5}}],events:{mousedown:`onMouseDown`,touchstart:`onMouseDown`,dblclick:`onDblClick`},documentEvents:{mousemove:`onMouseMove`,touchmove:`onMouseMove`,mouseup:`onMouseUp`,touchend:`onMouseUp`,touchcancel:`onMouseUp`},customAnchorAttrs:{"stroke-width":4,stroke:`#33334F`,fill:`#FFFFFF`,r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:`#FFFFFF`,fill:`#33334F`,r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:yg,snap(e,t,n,r,i,a){let o=a.options.snapRadius||0,s=r===`source`,c=s?0:-1,l=this.cell.getVertexAt(c)||this.getTerminalAnchor(s?`target`:`source`);return l&&(Math.abs(l.x-e.x)<o&&(e.x=l.x),Math.abs(l.y-e.y)<o&&(e.y=l.y)),e}})})(Eg||={});var Dg=Eg.define({name:`source-anchor`,type:`source`}),Og=Eg.define({name:`target-anchor`,type:`target`}),kg=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Ag=class extends lg.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){let e=this.options.attrs,{class:t}=e,n=kg(e,[`class`]);this.setAttrs(n,this.container),t&&N(this.container,t)}}onRender(){N(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){let e=this.ratio,t=this.cellView,n=t.getTangentAtRatio(e),r=n?n.start:t.getPointAtRatio(e),i=n&&n.vector().vectorAngle(new z(1,0))||0;if(!r)return this;let a=Hd().translate(r.x,r.y).rotate(i);return Qd(this.container,a,{absolute:!0}),this}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();let t=this.cellView;if(t.can(`arrowheadMovable`)){t.cell.startBatch(`move-arrowhead`,{ui:!0,toolId:this.cid});let n=this.graph.snapToGrid(e.clientX,e.clientY),r=t.prepareArrowheadDragging(this.type,{x:n.x,y:n.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(e,r),this.delegateDocumentEvents(this.options.documentEvents,e.data),t.graph.view.undelegateEvents(),this.container.style.pointerEvents=`none`}this.focus()}onMouseMove(e){let t=this.normalizeEvent(e),n=this.graph.snapToGrid(t.clientX,t.clientY);this.cellView.onMouseMove(t,n.x,n.y),this.update()}onMouseUp(e){this.undelegateDocumentEvents();let t=this.normalizeEvent(e),n=this.cellView,r=this.graph.snapToGrid(t.clientX,t.clientY);n.onMouseUp(t,r.x,r.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents=``,n.cell.stopBatch(`move-arrowhead`,{ui:!0,toolId:this.cid})}};(function(e){e.config({tagName:`path`,isSVGElement:!0,events:{mousedown:`onMouseDown`,touchstart:`onMouseDown`},documentEvents:{mousemove:`onMouseMove`,touchmove:`onMouseMove`,mouseup:`onMouseUp`,touchend:`onMouseUp`,touchcancel:`onMouseUp`}})})(Ag||={});var jg=Ag.define({name:`source-arrowhead`,type:`source`,ratio:0,attrs:{d:`M 10 -8 -10 0 10 8 Z`,fill:`#333`,stroke:`#fff`,"stroke-width":2,cursor:`move`}}),Mg=Ag.define({name:`target-arrowhead`,type:`target`,ratio:1,attrs:{d:`M -10 -8 10 0 -10 8 Z`,fill:`#333`,stroke:`#fff`,"stroke-width":2,cursor:`move`}}),Ng=class extends lg.ToolItem{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){let e=this.cellView;e&&e.on(`cell:dblclick`,this.dblClick)}createElement(){let e=[this.prefixClassName(`${this.cell.isEdge()?`edge`:`node`}-tool-editor`),this.prefixClassName(`cell-tool-editor`)];this.editor=lg.createElement(`div`,!1),this.addClass(e,this.editor),this.editor.contentEditable=`true`,this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&=(this.container.removeChild(this.editor),null)}updateEditor(){let{cell:e,editor:t}=this;if(!t)return;let{style:n}=t;e.isNode()?this.updateNodeEditorTransform():e.isEdge()&&this.updateEdgeEditorTransform();let{attrs:r}=this.options;return n.fontSize=`${r.fontSize}px`,n.fontFamily=r.fontFamily,n.color=r.color,n.backgroundColor=r.backgroundColor,t.innerText=this.getCellText()||``,this.setCellText(``),this}updateNodeEditorTransform(){let{graph:e,cell:t,editor:n}=this;if(!n)return;let r=z.create(),i=20,a=``,{x:o,y:s}=this.options,{width:c,height:l}=this.options;if(o!==void 0&&s!==void 0){let e=t.getBBox();o=zl(o,e.width),s=zl(s,e.height),r=e.topLeft.translate(o,s),i=e.width-o*2}else{let e=t.getBBox();r=e.center,i=e.width-4,a=`translate(-50%, -50%)`}let u=e.scale(),{style:d}=n;r=e.localToGraph(r),d.left=`${r.x}px`,d.top=`${r.y}px`,d.transform=`scale(${u.sx}, ${u.sy}) ${a}`,d.minWidth=`${i}px`,typeof c==`number`&&(d.width=`${c}px`),typeof l==`number`&&(d.height=`${l}px`)}updateEdgeEditorTransform(){if(!this.event)return;let{graph:e,editor:t}=this;if(!t)return;let n=z.create(),r=20,{style:i}=t,a=this.event.target,o=a.parentElement;if(o&&cu(o,this.prefixClassName(`edge-label`))){let e=o.getAttribute(`data-index`)||`0`;this.labelIndex=parseInt(e,10);let{translation:t}=Kd(o.getAttribute(`transform`));n=new z(t.tx,t.ty),r=U.getBBox(a).width}else{if(!this.options.labelAddable)return this;n=e.clientToLocal(z.create(this.event.clientX,this.event.clientY));let t=this.cellView.path.closestPointLength(n);this.distance=t,this.labelIndex=-1}n=e.localToGraph(n);let s=e.scale();i.left=`${n.x}px`,i.top=`${n.y}px`,i.minWidth=`${r}px`,i.transform=`scale(${s.sx}, ${s.sy}) translate(-50%, -50%)`}onDocumentMouseUp(e){if(this.editor&&e.target!==this.editor){let e=this.editor.innerText.replace(/\n$/,``)||``;this.setCellText(e===``?null:e),this.removeElement()}}onCellDblClick({e}){this.editor||(e.stopPropagation(),this.removeElement(),this.event=e,this.createElement(),this.updateEditor(),this.autoFocus(),this.delegateDocumentEvents(this.options.documentEvents))}onMouseDown(e){e.stopPropagation()}autoFocus(){setTimeout(()=>{this.editor&&(this.editor.focus(),this.selectText())})}selectText(){if(window.getSelection&&this.editor){let e=document.createRange(),t=window.getSelection();e.selectNodeContents(this.editor),t.removeAllRanges(),t.addRange(e)}}getCellText(){let{getText:e}=this.options;if(typeof e==`function`)return M(e,this.cellView,{cell:this.cell,index:this.labelIndex});if(typeof e==`string`){if(this.cell.isNode())return this.cell.attr(e);if(this.cell.isEdge()&&this.labelIndex!==-1)return this.cell.prop(`labels/${this.labelIndex}/attrs/${e}`)}}setCellText(e){let t=this.options.setText;if(typeof t==`function`)M(t,this.cellView,{cell:this.cell,value:e,index:this.labelIndex,distance:this.distance});else if(typeof t==`string`){if(this.cell.isNode()){e!==null&&this.cell.attr(t,e);return}if(this.cell.isEdge()){let n=this.cell;if(this.labelIndex===-1){if(e){let r={position:{distance:this.distance},attrs:{}};Dl(r,`attrs/${t}`,e),n.appendLabel(r)}}else e===null?typeof this.labelIndex==`number`&&n.removeLabelAt(this.labelIndex):n.prop(`labels/${this.labelIndex}/attrs/${t}`,e)}}}onRemove(){let e=this.cellView;e&&e.off(`cell:dblclick`,this.dblClick),this.removeElement()}};(function(e){e.config({tagName:`div`,isSVGElement:!1,events:{mousedown:`onMouseDown`,touchstart:`onMouseDown`},documentEvents:{mouseup:`onDocumentMouseUp`,touchend:`onDocumentMouseUp`,touchcancel:`onDocumentMouseUp`}})})(Ng||={}),(function(e){e.NodeEditor=e.define({attrs:{fontSize:14,fontFamily:`Arial, helvetica, sans-serif`,color:`#000`,backgroundColor:`#fff`},getText:`text/text`,setText:`text/text`}),e.EdgeEditor=e.define({attrs:{fontSize:14,fontFamily:`Arial, helvetica, sans-serif`,color:`#000`,backgroundColor:`#fff`},labelAddable:!0,getText:`label/text`,setText:`label/text`})})(Ng||={});var Pg=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Fg;(function(e){e.presets={boundary:Cg,button:xg,"button-remove":xg.Remove,"node-editor":Ng.NodeEditor},e.registry=rp.create({type:`node tool`,process(e,t){if(typeof t==`function`)return t;let n=lg.ToolItem,{inherit:r}=t,i=Pg(t,[`inherit`]);if(r){let e=this.get(r);e==null?this.onNotFound(r,`inherited`):n=e}return i.name??=e,n.define.call(n,i)}}),e.registry.register(e.presets,!0)})(Fg||={});var Ig;(function(e){e.presets={boundary:Cg,vertices:wg,segments:Tg,button:xg,"button-remove":xg.Remove,"source-anchor":Dg,"target-anchor":Og,"source-arrowhead":jg,"target-arrowhead":Mg,"edge-editor":Ng.EdgeEditor},e.registry=rp.create({type:`edge tool`,process(e,t){if(typeof t==`function`)return t;let n=lg.ToolItem,{inherit:r}=t,i=Pg(t,[`inherit`]);if(r){let e=this.get(r);e==null?this.onNotFound(r,`inherited`):n=e}return i.name??=e,n.define.call(n,i)}}),e.registry.register(e.presets,!0)})(Ig||={});var Lg=Kg(`center`),Rg=Kg(`topCenter`),zg=Kg(`bottomCenter`),Bg=Kg(`leftMiddle`),Vg=Kg(`rightMiddle`),Hg=Kg(`topLeft`),Ug=Kg(`topRight`),Wg=Kg(`bottomLeft`),Gg=Kg(`bottomRight`);function Kg(e){return function(t,n,r,i={}){let a;a=t.cell.visible?i.rotate?t.getUnrotatedBBoxOfElement(n):t.getBBoxOfElement(n):t.cell.getBBox();let o=a[e];o.x+=zl(i.dx,a.width),o.y+=zl(i.dy,a.height);let s=t.cell;return i.rotate?o.rotate(-s.getAngle(),s.getBBox().getCenter()):o}}function qg(e){return function(t,n,r,i){if(r instanceof Element){let a=this.graph.findViewByElem(r),o;return o=a?a.isEdgeElement(r)?Jg(a,i.fixedAt==null?`50%`:i.fixedAt):a.getBBoxOfElement(r).getCenter():new z,e.call(this,t,n,o,i)}return e.apply(this,arguments)}}function Jg(e,t){let n=Rl(t),r=typeof t==`string`?parseFloat(t):t;return n?e.getPointAtRatio(r/100):e.getPointAtLength(r)}var Yg=qg(function(e,t,n,r){let i=L.normalize(e.cell.getAngle()),a=e.cell.visible?e.getBBoxOfElement(t):e.cell.getBBox(),o=a.getCenter(),s=a.getTopLeft(),c=a.getBottomRight(),l=r.padding;if(Number.isFinite(l)||(l=0),s.y+l<=n.y&&n.y<=c.y-l){let e=n.y-o.y;o.x+=i===0||i===180?0:e*1/Math.tan(L.toRad(i)),o.y+=e}else if(s.x+l<=n.x&&n.x<=c.x-l){let e=n.x-o.x;o.y+=i===90||i===270?0:e*Math.tan(L.toRad(i)),o.x+=e}return o}),Xg=function(e,t,n,r,i){let a=e.cell.getConnectionPoint(this.cell,i);return(r.dx||r.dy)&&a.translate(r.dx||0,r.dy||0),a},Zg=qg(function(e,t,n,r){let i,a=0,o,s=e.cell;r.rotate?(i=e.getUnrotatedBBoxOfElement(t),o=s.getBBox().getCenter(),a=s.getAngle()):i=s.visible?e.getBBoxOfElement(t):e.cell.getBBox();let c=r.padding;c!=null&&Number.isFinite(c)&&i.inflate(c),r.rotate&&n.rotate(a,o);let l=i.getNearestSideToPoint(n),u;switch(l){case`left`:u=i.getLeftMiddle();break;case`right`:u=i.getRightMiddle();break;case`top`:u=i.getTopCenter();break;case`bottom`:u=i.getBottomCenter()}let d=r.direction;return d===`H`?(l===`top`||l===`bottom`)&&(u=n.x<=i.x+i.width?i.getLeftMiddle():i.getRightMiddle()):d===`V`&&(u=n.y<=i.y+i.height?i.getTopCenter():i.getBottomCenter()),r.rotate?u.rotate(-a,o):u}),Qg=n({bottom:()=>zg,bottomLeft:()=>Wg,bottomRight:()=>Gg,center:()=>Lg,left:()=>Bg,midSide:()=>Zg,nodeCenter:()=>Xg,orth:()=>Yg,right:()=>Vg,top:()=>Rg,topLeft:()=>Hg,topRight:()=>Ug}),$g;(function(e){e.presets=Qg,e.registry=rp.create({type:`node endpoint`}),e.registry.register(e.presets,!0)})($g||={});var e_=function(e,t,n,r){let i=r.ratio==null?.5:r.ratio;return i>1&&(i/=100),e.getPointAtRatio(i)},t_=function(e,t,n,r){let i=r.length==null?20:r.length;return e.getPointAtLength(i)},n_=function(e,t,n,r){return e.getClosestPoint(n)??new z},r_=qg(n_),i_=qg(function(e,t,n,r){let i=1e6,a=e.getConnection(),o=e.getConnectionSubdivisions(),s=new V(n.clone().translate(0,i),n.clone().translate(0,-1e6)),c=new V(n.clone().translate(i,0),n.clone().translate(-1e6,0)),l=s.intersect(a,{segmentSubdivisions:o}),u=c.intersect(a,{segmentSubdivisions:o}),d=[];return l&&d.push(...l),u&&d.push(...u),d.length>0?n.closest(d):r.fallbackAt==null?M(n_,this,e,t,n,r):Jg(e,r.fallbackAt)}),a_=n({closest:()=>r_,length:()=>t_,orth:()=>i_,ratio:()=>e_}),o_;(function(e){e.presets=a_,e.registry=rp.create({type:`edge endpoint`}),e.registry.register(e.presets,!0)})(o_||={});function s_(e,t,n){let r;if(typeof n==`object`){if(Number.isFinite(n.y)){let{start:r,end:i}=new V(t,e).parallel(n.y);t=r,e=i}r=n.x}else r=n;if(r==null||!Number.isFinite(r))return e;let i=e.distance(t);return r===0&&i>0?e:e.move(t,-Math.min(r,i-1))}function c_(e){let t=e.getAttribute(`stroke-width`);return t===null?0:parseFloat(t)||0}function l_(e){if(e==null)return null;let t=e;do{let e=t.tagName;if(typeof e!=`string`)return null;if(e=e.toUpperCase(),e===`G`)t=t.firstElementChild;else if(e===`TITLE`)t=t.nextElementSibling;else break}while(t);return t}var u_=function(e,t,n,r){let i=t.getBBoxOfElement(n);r.stroked&&i.inflate(c_(n)/2);let a=e.intersect(i);return s_(a&&a.length?e.start.closest(a):e.end,e.start,r.offset)},d_=function(e,t,n,r,i){let a=t.cell,o=a.isNode()?a.getAngle():0;if(o===0)return M(u_,this,e,t,n,r,i);let s=t.getUnrotatedBBoxOfElement(n);r.stroked&&s.inflate(c_(n)/2);let c=s.getCenter(),l=e.clone().rotate(o,c),u=l.setLength(1e6).intersect(s);return s_(u&&u.length?l.start.closest(u).rotate(-o,c):e.end,e.start,r.offset)},f_=function(e,t,n,r){let i,a,o=e.end,s=r.selector;if(i=typeof s==`string`?t.findOne(s):Array.isArray(s)?El(n,s):l_(n),!mu(i)){if(i===n||!mu(n))return o;i=n}let c=t.getShapeOfElement(i),l=t.getMatrixOfElement(i),u=t.getRootTranslatedMatrix(),d=t.getRootRotatedMatrix(),f=u.multiply(d).multiply(l),p=f.inverse(),m=U.transformLine(e,p),h=m.start.clone(),g=t.getDataOfElement(i);if(r.insideout===!1){g.shapeBBox??=c.bbox();let e=g.shapeBBox;if(e!=null&&e.containsPoint(h))return o}r.extrapolate===!0&&m.setLength(1e6);let _;if(H.isPath(c)){let e=r.precision||2;g.segmentSubdivisions??=c.getSegmentSubdivisions({precision:e}),_={precision:e,segmentSubdivisions:g.segmentSubdivisions},a=m.intersect(c,_)}else a=m.intersect(c);a?Array.isArray(a)&&(a=h.closest(a)):r.sticky===!0&&(a=B.isRectangle(c)?c.getNearestPointToPoint(h):Ff.isEllipse(c)?c.intersectsWithLineFromCenterToPoint(h):c.closestPoint(h,_));let v=a?U.transformPoint(a,f):o,y=r.offset||0;return r.stroked!==!1&&(typeof y==`object`?(y=Object.assign({},y),y.x??(y.x=0),y.x+=c_(i)/2):y+=c_(i)/2),s_(v,e.start,y)};function p_(e,t,n=0){let{start:r,end:i}=e,a,o,s,c;switch(t){case`left`:c=`x`,a=i,o=r,s=-1;break;case`right`:c=`x`,a=r,o=i,s=1;break;case`top`:c=`y`,a=i,o=r,s=-1;break;case`bottom`:c=`y`,a=r,o=i,s=1;break;default:return}r[c]<i[c]?a[c]=o[c]:o[c]=a[c],Number.isFinite(n)&&(a[c]+=s*n,o[c]+=s*n)}var m_=function(e,t,n,r){let{alignOffset:i,align:a}=r;return a&&p_(e,a,i),s_(e.end,e.start,r.offset)},h_=n({anchor:()=>m_,bbox:()=>u_,boundary:()=>f_,rect:()=>d_}),g_;(function(e){e.presets=h_,e.registry=rp.create({type:`connection point`}),e.registry.register(e.presets,!0)})(g_||={});var __=function(e){return[...e]},v_=function(e,t,n){let r=t.side||`bottom`,i=Bl(t.padding||40),a=n.sourceBBox,o=n.targetBBox,s=a.getCenter(),c=o.getCenter(),l,u,d;switch(r){case`top`:d=-1,l=`y`,u=`height`;break;case`left`:d=-1,l=`x`,u=`width`;break;case`right`:d=1,l=`x`,u=`width`;break;default:d=1,l=`y`,u=`height`}return s[l]+=d*(a[u]/2+i[r]),c[l]+=d*(o[u]/2+i[r]),d*(s[l]-c[l])>0?c[l]=s[l]:s[l]=c[l],[s.toJSON(),...e,c.toJSON()]};function y_(e){return new B(e.x,e.y,0,0)}function b_(e={}){let t=Bl(e.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function x_(e,t={}){return e.sourceBBox.clone().moveAndExpand(b_(t))}function S_(e,t={}){return e.targetBBox.clone().moveAndExpand(b_(t))}function C_(e,t={}){return e.sourceAnchor?e.sourceAnchor:x_(e,t).getCenter()}function w_(e,t={}){return e.targetAnchor?e.targetAnchor:S_(e,t).getCenter()}var T_=function(e,t,n){let r=x_(n,t),i=S_(n,t),a=C_(n,t),o=w_(n,t);r=r.union(y_(a)),i=i.union(y_(o));let s=e.map(e=>z.create(e));s.unshift(a),s.push(o);let c=null,l=[];for(let e=0,n=s.length-1;e<n;e+=1){let a=null,o=s[e],u=s[e+1],d=E_.getBearing(o,u)!=null;if(e===0)e+1===n?r.intersectsWithRect(i.clone().inflate(1))?a=E_.insideNode(o,u,r,i):d||(a=E_.nodeToNode(o,u,r,i)):r.containsPoint(u)?a=E_.insideNode(o,u,r,y_(u).moveAndExpand(b_(t))):d||(a=E_.nodeToVertex(o,u,r));else if(e+1===n){let e=d&&E_.getBearing(u,o)===c;i.containsPoint(o)||e?a=E_.insideNode(o,u,y_(o).moveAndExpand(b_(t)),i,c):d||(a=E_.vertexToNode(o,u,i,c))}else d||(a=E_.vertexToVertex(o,u,c));a?(l.push(...a.points),c=a.direction):c=E_.getBearing(o,u),e+1<n&&l.push(u)}return l},E_;(function(e){let t={N:`S`,S:`N`,E:`W`,W:`E`},n={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function r(e,t,n){let r=new z(e.x,t.y);return n.containsPoint(r)&&(r=new z(t.x,e.y)),r}function i(e,t){return e[t===`W`||t===`E`?`width`:`height`]}e.getBBoxSize=i;function a(e,t){return e.x===t.x?e.y>t.y?`N`:`S`:e.y===t.y?e.x>t.x?`W`:`E`:null}e.getBearing=a;function o(e,n,r){let i=new z(e.x,n.y),o=new z(n.x,e.y),s=a(e,i),c=a(e,o),l=r?t[r]:null,u=s===r||s!==l&&(c===l||c!==r)?i:o;return{points:[u],direction:a(u,n)}}e.vertexToVertex=o;function s(e,t,n){let i=r(e,t,n);return{points:[i],direction:a(i,t)}}e.nodeToVertex=s;function c(e,t,n,o){let s=[new z(e.x,t.y),new z(t.x,e.y)],c=s.filter(e=>!n.containsPoint(e)),l=c.filter(t=>a(t,e)!==o),u;if(l.length>0)return u=l.filter(t=>a(e,t)===o).pop(),u||=l[0],{points:[u],direction:a(u,t)};{u=Dc(s,c)[0];let l=z.create(t).move(u,-i(n,o)/2);return{points:[r(l,e,n),l],direction:a(l,t)}}}e.vertexToNode=c;function l(e,t,n,r){let c=s(t,e,r),l=c.points[0];if(n.containsPoint(l)){c=s(e,t,n);let u=c.points[0];if(r.containsPoint(u)){let d=z.create(e).move(u,-i(n,a(e,u))/2),f=z.create(t).move(l,-i(r,a(t,l))/2),p=new V(d,f).getCenter(),m=s(e,p,n),h=o(p,t,m.direction);c.points=[m.points[0],h.points[0]],c.direction=h.direction}}return c}e.nodeToNode=l;function u(e,t,i,o,s){let c=i.union(o).inflate(1),l=c.getCenter(),u=l.distance(t)>l.distance(e),d=u?t:e,f=u?e:t,p,m,h;s?(p=z.fromPolar(c.width+c.height,n[s],d),p=c.getNearestPointToPoint(p).move(p,-1)):p=c.getNearestPointToPoint(d).move(d,1),m=r(p,f,c);let g;p.round().equals(m.round())?(m=z.fromPolar(c.width+c.height,L.toRad(p.theta(d))+Math.PI/2,f),m=c.getNearestPointToPoint(m).move(f,1).round(),h=r(p,m,c),g=u?[m,h,p]:[p,h,m]):g=u?[m,p]:[p,m];let _=a(u?p:m,t);return{points:g,direction:_}}e.insideNode=u})(E_||={});var D_={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:[`top`,`right`,`bottom`,`left`],endDirections:[`top`,`right`,`bottom`,`left`],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost(){return O_(this.step,this)},directions(){let e=O_(this.step,this),t=O_(this.cost,this);return[{cost:t,offsetX:e,offsetY:0},{cost:t,offsetX:-e,offsetY:0},{cost:t,offsetX:0,offsetY:e},{cost:t,offsetX:0,offsetY:-e}]},penalties(){let e=O_(this.step,this);return{0:0,45:e/2,90:e/2}},paddingBox(){let e=O_(this.step,this);return{x:-e,y:-e,width:2*e,height:2*e}},fallbackRouter:T_,draggingRouter:null,snapToGrid:!0};function O_(e,t){return typeof e==`function`?e.call(t):e}function k_(e){let t=Object.keys(e).reduce((t,n)=>{let r=t;return r[n]=n===`fallbackRouter`||n===`draggingRouter`||n===`fallbackRoute`?e[n]:O_(e[n],e),t},{});if(t.padding){let e=Bl(t.padding);t.paddingBox={x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}return t.directions.forEach(e=>{let t=new z(0,0),n=new z(e.offsetX,e.offsetY);e.angle=L.normalize(t.theta(n))}),t}var A_=1,j_=2,M_=class{constructor(){this.items=[],this.hash={},this.values={}}add(e,t){this.hash[e]?this.items.splice(this.items.indexOf(e),1):this.hash[e]=A_,this.values[e]=t;let n=il(this.items,e,e=>this.values[e]);this.items.splice(n,0,e)}pop(){let e=this.items.shift();return e&&(this.hash[e]=j_),e}isOpen(e){return this.hash[e]===A_}isClose(e){return this.hash[e]===j_}isEmpty(){return this.items.length===0}},N_=class{constructor(e){this.options=e,this.mapGridSize=100,this.map={}}build(e,t){let n=this.options,r=n.excludeTerminals.reduce((n,r)=>{let i=t[r];if(i){let t=e.getCell(i.cell);t&&n.push(t)}return n},[]),i=[],a=e.getCell(t.getSourceCellId());a&&(i=dl(i,a.getAncestors().map(e=>e.id)));let o=e.getCell(t.getTargetCellId());o&&(i=dl(i,o.getAncestors().map(e=>e.id)));let s=this.mapGridSize;return e.getNodes().reduce((e,t)=>{let a=r.some(e=>e.id===t.id),o=t.shape?n.excludeShapes.includes(t.shape):!1,c=n.excludeNodes.some(e=>typeof e==`string`?t.id===e:e===t),l=i.includes(t.id),u=o||a||c||l;if(t.isVisible()&&!u){let r=t.getBBox().moveAndExpand(n.paddingBox),i=r.getOrigin().snapToGrid(s),a=r.getCorner().snapToGrid(s);for(let t=i.x;t<=a.x;t+=s)for(let n=i.y;n<=a.y;n+=s){let i=new z(t,n).toString();e[i]??(e[i]=[]),e[i].push(r)}}return e},this.map),this}isAccessible(e){let t=e.clone().snapToGrid(this.mapGridSize).toString(),n=this.map[t];return!n||n.every(t=>!t.containsPoint(e))}};function P_(e,t){let n=e.sourceBBox.clone();return t&&t.paddingBox?n.moveAndExpand(t.paddingBox):n}function F_(e,t){let n=e.targetBBox.clone();return t&&t.paddingBox?n.moveAndExpand(t.paddingBox):n}function I_(e,t){return e.sourceAnchor?e.sourceAnchor:P_(e,t).getCenter()}function L_(e,t){return e.targetAnchor?e.targetAnchor:F_(e,t).getCenter()}function R_(e,t,n,r,i){let a=360/n,o=e.theta(z_(e,t,r,i)),s=L.normalize(o+a/2);return a*Math.floor(s/a)}function z_(e,t,n,r){let i=r.step,a=t.x-e.x,o=t.y-e.y,s=a/n.x,c=o/n.y,l=s*i,u=c*i;return new z(e.x+l,e.y+u)}function B_(e,t){let n=Math.abs(e-t);return n>180?360-n:n}function V_(e,t){let n=t.step;return t.directions.forEach(t=>{t.gridOffsetX=t.offsetX/n*e.x,t.gridOffsetY=t.offsetY/n*e.y}),t.directions}function H_(e,t,n){return{source:t.clone(),x:U_(n.x-t.x,e),y:U_(n.y-t.y,e)}}function U_(e,t){if(!e)return t;let n=Math.abs(e),r=Math.round(n/t);return r?t+(n-r*t)/r:n}function W_(e,t){let n=t.source,r=R.snapToGrid(e.x-n.x,t.x)+n.x,i=R.snapToGrid(e.y-n.y,t.y)+n.y;return new z(r,i)}function G_(e,t){return e.round(t)}function K_(e,t,n){return G_(W_(e.clone(),t),n)}function q_(e){return e.toString()}function J_(e){return new z(e.x===0?0:Math.abs(e.x)/e.x,e.y===0?0:Math.abs(e.y)/e.y)}function Y_(e,t){let n=1/0;for(let r=0,i=t.length;r<i;r+=1){let i=e.manhattanDistance(t[r]);i<n&&(n=i)}return n}function X_(e,t,n,r,i){let a=i.precision,o=i.directionMap,s=e.diff(t.getCenter()),c=Object.keys(o).reduce((i,c)=>{if(n.includes(c)){let n=o[c],l=new z(e.x+n.x*(Math.abs(s.x)+t.width),e.y+n.y*(Math.abs(s.y)+t.height)),u=new V(e,l).intersect(t)||[],d,f=null;for(let t=0;t<u.length;t+=1){let n=u[t],r=e.squaredDistance(n);(d==null||r>d)&&(d=r,f=n)}if(f){let e=K_(f,r,a);t.containsPoint(e)&&(e=K_(e.translate(n.x*r.x,n.y*r.y),r,a)),i.push(e)}}return i},[]);return t.containsPoint(e)||c.push(K_(e,r,a)),c}function Z_(e,t,n,r,i){let a=[],o=J_(i.diff(n)),s=q_(n),c=e[s],l;for(;c;){l=t[s];let n=J_(l.diff(c));n.equals(o)||(a.unshift(l),o=n),s=q_(c),c=e[s]}let u=t[s];return J_(u.diff(r)).equals(o)||a.unshift(u),a}function Q_(e,t,n,r,i){let a=i.precision,o,s;o=B.isRectangle(t)?G_(I_(e,i).clone(),a):G_(t.clone(),a),s=B.isRectangle(n)?G_(L_(e,i).clone(),a):G_(n.clone(),a);let c=H_(i.step,o,s),l=o,u=s,d,f;if(d=B.isRectangle(t)?X_(l,t,i.startDirections,c,i):[l],f=B.isRectangle(n)?X_(s,n,i.endDirections,c,i):[u],d=d.filter(e=>r.isAccessible(e)),f=f.filter(e=>r.isAccessible(e)),d.length>0&&f.length>0){let e=new M_,t={},n={},o={};for(let n=0,r=d.length;n<r;n+=1){let r=d[n],i=q_(r);e.add(i,Y_(r,f)),t[i]=r,o[i]=0}let s=i.previousDirectionAngle,p=s===void 0,m,h,g=V_(c,i),_=g.length,v=f.reduce((e,t)=>{let n=q_(t);return e.push(n),e},[]),y=z.equalPoints(d,f),b=i.maxLoopCount;for(;!e.isEmpty()&&b>0;){let d=e.pop(),x=t[d],S=n[d],C=o[d],w=x.equals(l),T=S==null,E;if(E=T?p?w?null:R_(l,x,_,c,i):s:R_(S,x,_,c,i),!(T&&y)&&v.indexOf(d)>=0)return i.previousDirectionAngle=E,Z_(n,t,x,l,u);for(let s=0;s<_;s+=1){m=g[s];let l=m.angle;if(h=B_(E,l),!(p&&w)&&h>i.maxDirectionChange)continue;let d=K_(x.clone().translate(m.gridOffsetX||0,m.gridOffsetY||0),c,a),y=q_(d);if(e.isClose(y)||!r.isAccessible(d)||v.indexOf(y)>=0&&!d.equals(u)&&B_(l,R_(d,u,_,c,i))>i.maxDirectionChange)continue;let b=m.cost,S=w?0:i.penalties[h],T=C+b+S;(!e.isOpen(y)||T<o[y])&&(t[y]=d,n[y]=x,o[y]=T,e.add(y,T+Y_(d,f)))}--b}}return i.fallbackRoute?M(i.fallbackRoute,this,l,u,i):null}function $_(e,t=10){if(e.length<=1)return e;for(let n=0,r=e.length;n<r-1;n+=1){let r=e[n],i=e[n+1];if(r.x===i.x){let e=t*Math.round(r.x/t);r.x!==e&&(r.x=e,i.x=e)}else if(r.y===i.y){let e=t*Math.round(r.y/t);r.y!==e&&(r.y=e,i.y=e)}}return e}var ev=function(e,t,n){let r=k_(t),i=P_(n,r),a=F_(n,r),o=I_(n,r),s=new N_(r).build(n.graph.model,n.cell),c=e.map(e=>z.create(e)),l=[],u=o,d,f;for(let t=0,p=c.length;t<=p;t+=1){let p=null;if(d=f||i,f=c[t],f==null){f=a;let e=n.cell;if((e.getSourceCellId()==null||e.getTargetCellId()==null)&&typeof r.draggingRouter==`function`){let e=d===i?o:d,t=f.getOrigin();p=M(r.draggingRouter,n,e,t,r)}}if(p??=Q_(n,d,f,s,r),p===null)return console.warn(`Unable to execute manhattan algorithm, use orth instead`),M(r.fallbackRouter,this,e,r,n);let m=p[0];m&&m.equals(u)&&p.shift(),u=p[p.length-1]||u,l.push(...p)}return r.snapToGrid?$_(l,n.graph.grid.getGridSize()):l},tv=function(e,t,n){return M(ev,this,e,Object.assign(Object.assign({},D_),t),n)},nv={maxDirectionChange:45,directions(){let e=O_(this.step,this),t=O_(this.cost,this),n=Math.ceil(Math.sqrt(e*e<<1));return[{cost:t,offsetX:e,offsetY:0},{cost:n,offsetX:e,offsetY:e},{cost:t,offsetX:0,offsetY:e},{cost:n,offsetX:-e,offsetY:e},{cost:t,offsetX:-e,offsetY:0},{cost:n,offsetX:-e,offsetY:-e},{cost:t,offsetX:0,offsetY:-e},{cost:n,offsetX:e,offsetY:-e}]},fallbackRoute(e,t,n){let r=e.theta(t),i=[],a={x:t.x,y:e.y},o={x:e.x,y:t.y};if(r%180>90){let e=a;a=o,o=e}let s=r%90<45?a:o,c=new V(e,s),l=90*Math.ceil(r/90),u=z.fromPolar(c.squaredLength(),L.toRad(l+135),s),d=new V(t,u),f=c.intersectsWithLine(d),p=f||t,m=f?p:e,h=360/n.directions.length,g=m.theta(t),_=L.normalize(g+h/2);return n.previousDirectionAngle=h*Math.floor(_/h),p&&i.push(p.round()),i.push(t),i}},rv=function(e,t,n){return M(tv,this,e,Object.assign(Object.assign({},nv),t),n)},iv=function(e,t,n){let r=t.offset||32,i=t.min==null?16:t.min,a=0,o=t.direction,s=n.sourceBBox,c=n.targetBBox,l=s.getCenter(),u=c.getCenter();if(typeof r==`number`&&(a=r),o==null){let e=c.left-s.right,t=c.top-s.bottom;e>=0&&t>=0?o=e>=t?`L`:`T`:e<=0&&t>=0?(e=s.left-c.right,o=e>=0&&e>=t?`R`:`T`):e>=0&&t<=0?(t=s.top-c.bottom,o=t>=0?e>=t?`L`:`B`:`L`):(e=s.left-c.right,t=s.top-c.bottom,o=e>=0&&t>=0?e>=t?`R`:`B`:e<=0&&t>=0?`B`:e>=0&&t<=0||Math.abs(e)>Math.abs(t)?`R`:`B`)}o===`H`?o=u.x-l.x>=0?`L`:`R`:o===`V`&&(o=u.y-l.y>=0?`T`:`B`),r===`center`&&(o===`L`?a=(c.left-s.right)/2:o===`R`?a=(s.left-c.right)/2:o===`T`?a=(c.top-s.bottom)/2:o===`B`&&(a=(s.top-c.bottom)/2));let d,f,p,m=o===`L`||o===`R`;if(m){if(u.y===l.y)return[...e];p=o===`L`?1:-1,d=`x`,f=`width`}else{if(u.x===l.x)return[...e];p=o===`T`?1:-1,d=`y`,f=`height`}let h=l.clone(),g=u.clone();if(h[d]+=p*(s[f]/2+a),g[d]-=p*(c[f]/2+a),m){let e=h.x,t=g.x,n=s.width/2+i,r=c.width/2+i;u.x>l.x?t<=e&&(h.x=Math.max(t,l.x+n),g.x=Math.min(e,u.x-r)):t>=e&&(h.x=Math.min(t,l.x-n),g.x=Math.max(e,u.x+r))}else{let e=h.y,t=g.y,n=s.height/2+i,r=c.height/2+i;u.y>l.y?t<=e&&(h.y=Math.max(t,l.y+n),g.y=Math.min(e,u.y-r)):t>=e&&(h.y=Math.min(t,l.y-n),g.y=Math.max(e,u.y+r))}return[h.toJSON(),...e,g.toJSON()]};function av(e,t){if(t!=null&&t!==!1){let n=typeof t==`boolean`?0:t;if(n>0){let t=z.create(e[1]).move(e[2],n),r=z.create(e[1]).move(e[0],n);return[t.toJSON(),...e,r.toJSON()]}{let t=e[1];return[Object.assign({},t),...e,Object.assign({},t)]}}return e}var ov=function(e,t,n){let r=t.width||50,i=(t.height||80)/2,a=t.angle||`auto`,o=n.sourceAnchor,s=n.targetAnchor,c=n.sourceBBox,l=n.targetBBox;if(o.equals(s)){let e=e=>{let t=L.toRad(e),n=Math.sin(t),a=Math.cos(t),s=new z(o.x+a*r,o.y+n*r),c=new z(s.x-a*i,s.y-n*i),l=c.clone().rotate(-90,s),u=c.clone().rotate(90,s);return[l.toJSON(),s.toJSON(),u.toJSON()]},n=e=>{let t=o.clone().move(e,-1),n=new V(t,e);return!c.containsPoint(e)&&!c.intersectsWithLine(n)},s=[0,90,180,270,45,135,225,315];if(typeof a==`number`)return av(e(a),t.merge);let l=c.getCenter();if(l.equals(o))return av(e(0),t.merge);let u=l.angleBetween(o,l.clone().translate(1,0)),d=e(u);if(n(d[1]))return av(d,t.merge);for(let r=1,i=s.length;r<i;r+=1)if(d=e(u+s[r]),n(d[1]))return av(d,t.merge);return av(d,t.merge)}{let e=new V(o,s),a=e.parallel(-r),u=a.getCenter(),d=a.start.clone().move(a.end,i),f=a.end.clone().move(a.start,i),p=e.parallel(-1),m=new V(p.start,u),h=new V(p.end,u);if((c.containsPoint(u)||l.containsPoint(u)||c.intersectsWithLine(m)||c.intersectsWithLine(h)||l.intersectsWithLine(m)||l.intersectsWithLine(h))&&(a=e.parallel(r),u=a.getCenter(),d=a.start.clone().move(a.end,i),f=a.end.clone().move(a.start,i)),t.merge){let e=new V(o,s),t=new V(u,e.center).setLength(2**53-1),r=c.intersectsWithLine(t),i=l.intersectsWithLine(t),a=r?Array.isArray(r)?r:[r]:[];i&&(Array.isArray(i)?a.push(...i):a.push(i));let d=e.center.closest(a);d?(n.sourceAnchor=d.clone(),n.targetAnchor=d.clone()):(n.sourceAnchor=e.center.clone(),n.targetAnchor=e.center.clone())}return av([d.toJSON(),u.toJSON(),f.toJSON()],t.merge)}},sv=n({er:()=>iv,loop:()=>ov,manhattan:()=>tv,metro:()=>rv,normal:()=>__,oneSide:()=>v_,orth:()=>T_}),cv;(function(e){e.presets=sv,e.registry=rp.create({type:`router`}),e.registry.register(e.presets,!0)})(cv||={});var lv=function(e,t,n,r={}){let i=[e,...n,t],a=new Uf(i),o=new H(a);return r.raw?o:o.serialize()},uv=function(e,t,n,r={}){let i=n.length===3?0:1,a=z.create(n[0+i]),o=z.create(n[2+i]),s=z.create(n[1+i]);if(!z.equals(e,t)){let n=new z((e.x+t.x)/2,(e.y+t.y)/2),r=n.angleBetween(z.create(e).rotate(90,n),s);r>1&&(a.rotate(180-r,n),o.rotate(180-r,n),s.rotate(180-r,n))}let c=`
83
+ M ${e.x} ${e.y}
84
+ Q ${a.x} ${a.y} ${s.x} ${s.y}
85
+ Q ${o.x} ${o.y} ${t.x} ${t.y}
86
+ `;return r.raw?H.parse(c):c},dv=function(e,t,n,r={}){let i=new H;i.appendSegment(H.createSegment(`M`,e));let a=1/3,o=2/3,s=r.radius||10,c,l;for(let r=0,u=n.length;r<u;r+=1){let u=z.create(n[r]),d=n[r-1]||e,f=n[r+1]||t;c=l||u.distance(d)/2,l=u.distance(f)/2;let p=-Math.min(s,c),m=-Math.min(s,l),h=u.clone().move(d,p).round(),g=u.clone().move(f,m).round(),_=new z(a*h.x+o*u.x,o*u.y+a*h.y),v=new z(a*g.x+o*u.x,o*u.y+a*g.y);i.appendSegment(H.createSegment(`L`,h)),i.appendSegment(H.createSegment(`C`,_,v,g))}return i.appendSegment(H.createSegment(`L`,t)),r.raw?i:i.serialize()},fv=function(e,t,n,r={}){let i,a=r.direction;if(n&&n.length!==0){let r=[e,...n,t],a=Wf.throughPoints(r);i=new H(a)}else if(i=new H,i.appendSegment(H.createSegment(`M`,e)),a||=Math.abs(e.x-t.x)>=Math.abs(e.y-t.y)?`H`:`V`,a===`H`){let n=(e.x+t.x)/2;i.appendSegment(H.createSegment(`C`,n,e.y,n,t.y,t.x,t.y))}else{let n=(e.y+t.y)/2;i.appendSegment(H.createSegment(`C`,e.x,n,t.x,n,t.x,t.y))}return r.raw?i:i.serialize()},pv=1,mv=1/3,hv=2/3;function gv(e){let t=e.graph._jumpOverUpdateList;if(t??(t=e.graph._jumpOverUpdateList=[],e.graph.on(`cell:mouseup`,()=>{let t=e.graph._jumpOverUpdateList;setTimeout(()=>{for(let e=0;e<t.length;e+=1)t[e].update()})}),e.graph.on(`model:reseted`,()=>{t=e.graph._jumpOverUpdateList=[]})),t.indexOf(e)<0){t.push(e);let n=()=>t.splice(t.indexOf(e),1);e.cell.once(`change:connector`,n),e.cell.once(`removed`,n)}}function _v(e,t,n=[]){let r=[e,...n,t],i=[];return r.forEach((e,t)=>{let n=r[t+1];n!=null&&i.push(new V(e,n))}),i}function vv(e,t){let n=[];return t.forEach(t=>{let r=e.intersectsWithLine(t);if(r){let{x:e,y:i}=r,{start:a,end:o}=t,s=Math.round(a.x)===Math.round(e)&&Math.round(a.y)===Math.round(i),c=Math.round(o.x)===Math.round(e)&&Math.round(o.y)===Math.round(i);if(s||c)return;n.push(r)}}),n}function yv(e,t){return new V(e,t).squaredLength()}function bv(e,t,n){return t.reduce((r,i,a)=>{if(wv.includes(i))return r;let o=r.pop()||e,s=z.create(i).move(o.start,-n),c=z.create(i).move(o.start,+n),l=t[a+1];if(l!=null){let e=c.distance(l);e<=n&&(c=l.move(o.start,e),wv.push(l))}else if(s.distance(o.end)<n*2+pv)return r.push(o),r;if(c.distance(o.start)<n*2+pv)return r.push(o),r;let u=new V(s,c);return Cv.push(u),r.push(new V(o.start,s),u,new V(c,o.end)),r},[])}function xv(e,t,n,r){let i=new H,a;return a=H.createSegment(`M`,e[0].start),i.appendSegment(a),e.forEach((o,s)=>{if(Cv.includes(o)){let e,r,s,c;if(n===`arc`){e=-90,r=o.start.diff(o.end),(r.x<0||r.x===0&&r.y<0)&&(e+=180);let t=o.getCenter(),n=new V(t,o.end).rotate(e,t),l;l=new V(o.start,t),s=l.pointAt(2/3).rotate(e,o.start),c=n.pointAt(1/3).rotate(-e,n.end),a=H.createSegment(`C`,s,c,n.end),i.appendSegment(a),l=new V(t,o.end),s=n.pointAt(1/3).rotate(e,n.end),c=l.pointAt(1/3).rotate(-e,o.end),a=H.createSegment(`C`,s,c,o.end),i.appendSegment(a)}else if(n===`gap`)a=H.createSegment(`M`,o.end),i.appendSegment(a);else if(n===`cubic`){e=o.start.theta(o.end);let n=t*.6,l=t*1.35;r=o.start.diff(o.end),(r.x<0||r.x===0&&r.y<0)&&(l*=-1),s=new z(o.start.x+n,o.start.y+l).rotate(e,o.start),c=new z(o.end.x-n,o.end.y+l).rotate(e,o.end),a=H.createSegment(`C`,s,c,o.end),i.appendSegment(a)}}else{let t=e[s+1];r===0||!t||Cv.includes(t)?(a=H.createSegment(`L`,o.end),i.appendSegment(a)):Sv(r,i,o.end,o.start,t.end)}}),i}function Sv(e,t,n,r,i){let a=n.distance(r)/2,o=n.distance(i)/2,s=-Math.min(e,a),c=-Math.min(e,o),l=n.clone().move(r,s).round(),u=n.clone().move(i,c).round(),d=new z(mv*l.x+hv*n.x,hv*n.y+mv*l.y),f=new z(mv*u.x+hv*n.x,hv*n.y+mv*u.y),p;p=H.createSegment(`L`,l),t.appendSegment(p),p=H.createSegment(`C`,d,f,u),t.appendSegment(p)}var Cv,wv,Tv=function(e,t,n,r={}){Cv=[],wv=[],gv(this);let i=r.size||5,a=r.type||`arc`,o=r.radius||0,s=r.ignoreConnectors||[`smooth`],c=this.graph,l=c.model.getEdges();if(l.length===1)return xv(_v(e,t,n),i,a,o);let u=this.cell,d=l.indexOf(u),f=c.options.connecting.connector||{},p=l.filter((e,t)=>{let n=e.getConnector()||f;return s.includes(n.name)?!1:t>d?n.name!==`jumpover`:!0}),m=p.map(e=>c.findViewByCell(e)),h=_v(e,t,n),g=m.map(e=>e==null?[]:e===this?h:_v(e.sourcePoint,e.targetPoint,e.routePoints)),_=[];h.forEach(e=>{let t=p.reduce((t,n,r)=>{if(n!==u){let n=vv(e,g[r]);t.push(...n)}return t},[]).sort((t,n)=>yv(e.start,t)-yv(e.start,n));t.length>0?_.push(...bv(e,t,i)):_.push(e)});let v=xv(_,i,a,o);return Cv=[],wv=[],r.raw?v:v.serialize()},Ev=n({jumpover:()=>Tv,loop:()=>uv,normal:()=>lv,rounded:()=>dv,smooth:()=>fv}),Dv;(function(e){e.presets=Ev,e.registry=rp.create({type:`connector`}),e.registry.register(e.presets,!0)})(Dv||={});var Ov=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},kv=class extends Al{constructor(e={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(j(e)),this.changed={}}mutate(e,t={}){let n=t.unset===!0,r=t.silent===!0,i=[],a=this.changing;this.changing=!0,a||(this.previous=j(this.data),this.changed={});let o=this.data,s=this.previous,c=this.changed;if(Object.keys(e).forEach(t=>{let r=t,a=e[r];zc(o[r],a)||i.push(r),zc(s[r],a)?delete c[r]:c[r]=a,n?delete o[r]:o[r]=a}),!r&&i.length>0&&(this.pending=!0,this.pendingOptions=t,i.forEach(e=>{this.emit(`change:*`,{key:e,options:t,store:this,current:o[e],previous:s[e]})})),a)return this;if(!r)for(;this.pending;)this.pending=!1,this.emit(`changed`,{current:o,previous:s,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(e,t){return e==null?this.data:this.data[e]??t}getPrevious(e){if(this.previous)return this.previous[e]??void 0}set(e,t,n){return e!=null&&(typeof e==`object`?this.mutate(e,t):this.mutate({[e]:t},n)),this}remove(e,t){let n={},r;if(typeof e==`string`)n[e]=void 0,r=t;else if(Array.isArray(e))e.forEach(e=>n[e]=void 0),r=t;else{for(let e in this.data)n[e]=void 0;r=e}return this.mutate(n,Object.assign(Object.assign({},r),{unset:!0})),this}getByPath(e){return El(this.data,e,`/`)}setByPath(e,t,n={}){let r=Array.isArray(e)?[...e]:e.split(`/`),i=Array.isArray(e)?e.join(`/`):e,a=r[0],o=r.length;if(n.propertyPath=i,n.propertyValue=t,n.propertyPathArray=r,o===1)this.set(a,t,n);else{let i={},s=i,c=a;for(let e=1;e<o;e+=1){let t=r[e],n=Number.isFinite(Number(t));s=s[c]=n?[]:{},c=t}Dl(i,r,t,`/`);let l=j(this.data);n.rewrite&&Ol(l,e,`/`);let u=Gc(l,i);this.set(a,u[a],n)}return this}removeByPath(e,t){let n=Array.isArray(e)?e:e.split(`/`),r=n[0];if(n.length===1)this.remove(r,t);else{let e=n.slice(1),i=j(this.get(r));i&&Ol(i,e),this.set(r,i,t)}return this}hasChanged(e){return e==null?Object.keys(this.changed).length>0:e in this.changed}getChanges(e){if(e==null)return this.hasChanged()?j(this.changed):null;let t=this.changing?this.previous:this.data,n={},r;for(let i in e){let a=e[i];zc(t[i],a)||(n[i]=a,r=!0)}return r?j(n):null}toJSON(){return j(this.data)}clone(){let e=this.constructor;return new e(this.data)}dispose(){this.off(),this.data={},this.previous={},this.changed={},this.pending=!1,this.changing=!1,this.pendingOptions=null,this.trigger(`disposed`,{store:this})}};Ov([Al.dispose()],kv.prototype,`dispose`,null);var Av=class e{constructor(e){this.cell=e,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(t,n,r={},i=`/`){let a=this.cell.getPropByPath(t),o=mc(r,e.defaultOptions),s=this.getTiming(o.timing),c=this.getInterp(o.interp,a,n),l=0,u=Array.isArray(t)?t.join(i):t,d=Array.isArray(t)?t:t.split(i),f=()=>{let e=new Date().getTime();l===0&&(l=e);let t=(e-l)/o.duration;t<1?this.ids[u]=requestAnimationFrame(f):t=1;let n=c(s(t));this.cell.setPropByPath(d,n),r.progress&&r.progress(Object.assign({progress:t,currentValue:n},this.getArgs(u))),t===1&&(this.cell.notify(`transition:complete`,this.getArgs(u)),r.complete&&r.complete(this.getArgs(u)),this.cell.notify(`transition:finish`,this.getArgs(u)),r.finish&&r.finish(this.getArgs(u)),this.clean(u))};return setTimeout(()=>{this.stop(t,void 0,i),this.cache[u]={startValue:a,targetValue:n,options:o},this.ids[u]=requestAnimationFrame(f),this.cell.notify(`transition:start`,this.getArgs(u)),r.start&&r.start(this.getArgs(u))},r.delay),this.stop.bind(this,t,i,r)}stop(e,t={},n=`/`){let r=Array.isArray(e)?e:e.split(n);return Object.keys(this.ids).filter(e=>zc(r,e.split(n).slice(0,r.length))).forEach(e=>{cancelAnimationFrame(this.ids[e]);let n=this.cache[e],r=this.getArgs(e),i=Object.assign(Object.assign({},n.options),t),a=i.jumpedToEnd;a&&n.targetValue!=null&&(this.cell.setPropByPath(e,n.targetValue),this.cell.notify(`transition:end`,Object.assign({},r)),this.cell.notify(`transition:complete`,Object.assign({},r)),i.complete&&i.complete(Object.assign({},r)));let o=Object.assign({jumpedToEnd:a},r);this.cell.notify(`transition:stop`,Object.assign({},o)),i.stop&&i.stop(Object.assign({},o)),this.cell.notify(`transition:finish`,Object.assign({},r)),i.finish&&i.finish(Object.assign({},r)),this.clean(e)}),this}clean(e){delete this.ids[e],delete this.cache[e]}getTiming(e){return typeof e==`string`?kf[e]:e}getInterp(e,t,n){return e?e(t,n):typeof n==`number`?Af.number(t,n):typeof n==`string`?n[0]===`#`?Af.color(t,n):Af.unit(t,n):Af.object(t,n)}getArgs(e){let t=this.cache[e];return{path:e,startValue:t.startValue,targetValue:t.targetValue,cell:this.cell}}};(function(e){e.defaultOptions={delay:10,duration:100,timing:`linear`}})(Av||={});var jv=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Mv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},K=class e extends Al{static config(e){let{markup:t,propHooks:n,attrHooks:r}=e,i=Mv(e,[`markup`,`propHooks`,`attrHooks`]);t!=null&&(this.markup=t),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):typeof n==`function`?this.propHooks.push(n):Object.values(n).forEach(e=>{typeof e==`function`&&this.propHooks.push(e)})),r&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),r)),this.defaults=Gc({},this.defaults,i)}static getMarkup(){return this.markup}static getDefaults(e){return e?this.defaults:j(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(e,t){return this.propHooks.reduce((t,n)=>n?M(n,e,t):t,t)}get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super();let t=this.constructor.getDefaults(!0),n=Gc({},this.preprocess(t),this.preprocess(e));this.id=n.id||Fl(),this.store=new kv(n),this.animation=new Av(this),this.setup(),this.init(),this.postprocess(e)}init(){}get model(){return this._model}set model(e){this._model!==e&&(this._model=e)}preprocess(e,t){let n=e.id,r=this.constructor.applyPropHooks(this,e);return n==null&&t!==!0&&(r.id=Fl()),r}postprocess(e){}setup(){this.store.on(`change:*`,e=>{let{key:t,current:n,previous:r,options:i}=e;this.notify(`change:*`,{key:t,options:i,current:n,previous:r,cell:this}),this.notify(`change:${t}`,{options:i,current:n,previous:r,cell:this});let a=t;(a===`source`||a===`target`)&&this.notify(`change:terminal`,{type:a,current:n,previous:r,options:i,cell:this})}),this.store.on(`changed`,({options:e})=>this.notify(`changed`,{options:e,cell:this}))}notify(e,t){this.trigger(e,t);let n=this.model;return n&&(n.notify(`cell:${e}`,t),this.isNode()?n.notify(`node:${e}`,Object.assign(Object.assign({},t),{node:this})):this.isEdge()&&n.notify(`edge:${e}`,Object.assign(Object.assign({},t),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(e){return this.store===e.store}get view(){return this.store.get(`view`)}get shape(){return this.store.get(`shape`,``)}getProp(e,t){return e==null?this.store.get():this.store.get(e,t)}setProp(e,t,n){if(typeof e==`string`)this.store.set(e,t,n);else{let n=this.preprocess(e,!0);this.store.set(Gc({},this.getProp(),n),t),this.postprocess(e)}return this}removeProp(e,t){return typeof e==`string`||Array.isArray(e)?this.store.removeByPath(e,t):this.store.remove(t),this}hasChanged(e){return e==null?this.store.hasChanged():this.store.hasChanged(e)}getPropByPath(e){return this.store.getByPath(e)}setPropByPath(e,t,n={}){return this.model&&(e===`children`?this._children=t?t.map(e=>this.model.getCell(e)).filter(e=>e!=null):null:e===`parent`&&(this._parent=t?this.model.getCell(t):null)),this.store.setByPath(e,t,n),this}removePropByPath(e,t={}){let n=Array.isArray(e)?e:e.split(`/`);return n[0]===`attrs`&&(t.dirty=!0),this.store.removeByPath(n,t),this}prop(e,t,n){return e==null?this.getProp():typeof e==`string`||Array.isArray(e)?arguments.length===1?this.getPropByPath(e):t==null?this.removePropByPath(e,n||{}):this.setPropByPath(e,t,n||{}):this.setProp(e,t||{})}previous(e){return this.store.getPrevious(e)}get zIndex(){return this.getZIndex()}set zIndex(e){e==null?this.removeZIndex():this.setZIndex(e)}getZIndex(){return this.store.get(`zIndex`)}setZIndex(e,t={}){return this.store.set(`zIndex`,e,t),this}removeZIndex(e={}){return this.store.remove(`zIndex`,e),this}toFront(e={}){let t=this.model;if(t){let n=t.getMaxZIndex(),r;e.deep?(r=this.getDescendants({deep:!0,breadthFirst:!0}),r.unshift(this)):r=[this],n=n-r.length+1;let i=t.total(),a=t.indexOf(this)!==i-r.length;a||=r.some((e,t)=>e.getZIndex()!==n+t),a&&this.batchUpdate(`to-front`,()=>{n+=r.length,r.forEach((t,r)=>{t.setZIndex(n+r,e)})})}return this}toBack(e={}){let t=this.model;if(t){let n=t.getMinZIndex(),r;e.deep?(r=this.getDescendants({deep:!0,breadthFirst:!0}),r.unshift(this)):r=[this];let i=t.indexOf(this)!==0;i||=r.some((e,t)=>e.getZIndex()!==n+t),i&&this.batchUpdate(`to-back`,()=>{n-=r.length,r.forEach((t,r)=>{t.setZIndex(n+r,e)})})}return this}get markup(){return this.getMarkup()}set markup(e){e==null?this.removeMarkup():this.setMarkup(e)}getMarkup(){let e=this.store.get(`markup`);return e??=this.constructor.getMarkup(),e}setMarkup(e,t={}){return this.store.set(`markup`,e,t),this}removeMarkup(e={}){return this.store.remove(`markup`,e),this}get attrs(){return this.getAttrs()}set attrs(e){e==null?this.removeAttrs():this.setAttrs(e)}getAttrs(){let e=this.store.get(`attrs`);return e?Object.assign({},e):{}}setAttrs(e,t={}){if(e==null)this.removeAttrs(t);else{let n=e=>this.store.set(`attrs`,e,t);if(t.overwrite===!0)n(e);else{let r=this.getAttrs();t.deep===!1?n(Object.assign(Object.assign({},r),e)):n(Gc({},r,e))}}return this}replaceAttrs(e,t={}){return this.setAttrs(e,Object.assign(Object.assign({},t),{overwrite:!0}))}updateAttrs(e,t={}){return this.setAttrs(e,Object.assign(Object.assign({},t),{deep:!1}))}removeAttrs(e={}){return this.store.remove(`attrs`,e),this}getAttrDefinition(e){if(!e)return null;let t=this.constructor.getAttrHooks()||{},n=t[e]||uh.registry.get(e);if(!n){let r=Hi(e);n=t[r]||uh.registry.get(r)}return n||null}getAttrByPath(e){return e==null||e===``?this.getAttrs():this.getPropByPath(this.prefixAttrPath(e))}setAttrByPath(e,t,n={}){return this.setPropByPath(this.prefixAttrPath(e),t,n),this}removeAttrByPath(e,t={}){return this.removePropByPath(this.prefixAttrPath(e),t),this}prefixAttrPath(e){return Array.isArray(e)?[`attrs`].concat(e):`attrs/${e}`}attr(e,t,n){return e==null?this.getAttrByPath():typeof e==`string`||Array.isArray(e)?arguments.length===1?this.getAttrByPath(e):t==null?this.removeAttrByPath(e,n||{}):this.setAttrByPath(e,t,n||{}):this.setAttrs(e,t||{})}get visible(){return this.isVisible()}set visible(e){this.setVisible(e)}setVisible(e,t={}){return this.store.set(`visible`,e,t),this}isVisible(){return this.store.get(`visible`)!==!1}show(e={}){return this.isVisible()||this.setVisible(!0,e),this}hide(e={}){return this.isVisible()&&this.setVisible(!1,e),this}toggleVisible(e,t={}){let n=typeof e==`boolean`?e:!this.isVisible(),r=typeof e==`boolean`?t:e;return n?this.show(r):this.hide(r),this}get data(){return this.getData()}set data(e){this.setData(e)}getData(){return this.store.get(`data`)}setData(e,t={}){if(e==null)this.removeData(t);else{let n=e=>this.store.set(`data`,e,t);if(t.overwrite===!0)n(e);else{let r=this.getData();t.deep===!1?n(typeof e==`object`?Object.assign(Object.assign({},r),e):e):n(Gc({},r,e))}}return this}replaceData(e,t={}){return this.setData(e,Object.assign(Object.assign({},t),{overwrite:!0}))}updateData(e,t={}){return this.setData(e,Object.assign(Object.assign({},t),{deep:!1}))}removeData(e={}){return this.store.remove(`data`,e),this}get parent(){return this.getParent()}get children(){return this.getChildren()}getParentId(){return this.store.get(`parent`)}getParent(){let e=this.getParentId();if(e&&this.model){let t=this.model.getCell(e);return this._parent=t,t}return null}getChildren(){let e=this.store.get(`children`);if(e&&e.length&&this.model){let t=e.map(e=>this.model?.getCell(e)).filter(e=>e!=null);return this._children=t,[...t]}return null}hasParent(){return this.parent!=null}isParentOf(e){return e!=null&&e.getParent()===this}isChildOf(e){return e!=null&&this.getParent()===e}eachChild(e,t){return this.children&&this.children.forEach(e,t),this}filterChild(e,t){return this.children?this.children.filter(e,t):[]}getChildCount(){return this.children==null?0:this.children.length}getChildIndex(e){return this.children==null?-1:this.children.indexOf(e)}getChildAt(e){return this.children!=null&&e>=0?this.children[e]:null}getAncestors(e={}){let t=[],n=this.getParent();for(;n;)t.push(n),n=e.deep===!1?null:n.getParent();return t}getDescendants(e={}){if(e.deep!==!1){if(e.breadthFirst){let e=[],t=this.getChildren()||[];for(;t.length>0;){let n=t.shift(),r=n.getChildren();e.push(n),r&&t.push(...r)}return e}{let t=this.getChildren()||[];return t.forEach(n=>{t.push(...n.getDescendants(e))}),t}}return this.getChildren()||[]}isDescendantOf(e,t={}){if(e==null)return!1;if(t.deep!==!1){let t=this.getParent();for(;t;){if(t===e)return!0;t=t.getParent()}return!1}return this.isChildOf(e)}isAncestorOf(e,t={}){return e!=null&&e.isDescendantOf(this,t)}contains(e){return this.isAncestorOf(e)}getCommonAncestor(...t){return e.getCommonAncestor(this,...t)}setParent(e,t={}){return this._parent=e,e?this.store.set(`parent`,e.id,t):this.store.remove(`parent`,t),this}setChildren(e,t={}){return this._children=e,e==null?this.store.remove(`children`,t):this.store.set(`children`,e.map(e=>e.id),t),this}unembed(e,t={}){let n=this.children;if(n!=null&&e!=null){let r=this.getChildIndex(e);r!==-1&&(n.splice(r,1),e.setParent(null,t),this.setChildren(n,t))}return this}embed(e,t={}){return e.addTo(this,t),this}addTo(t,n={}){return e.isCell(t)?t.addChild(this,n):t.addCell(this,n),this}insertTo(e,t,n={}){return e.insertChild(this,t,n),this}addChild(e,t={}){return this.insertChild(e,void 0,t)}insertChild(e,t,n={}){if(e!=null&&e!==this){let r=e.getParent(),i=this!==r,a=t;if(a??(a=this.getChildCount(),i||--a),r){let t=r.getChildren();if(t){let i=t.indexOf(e);i>=0&&(e.setParent(null,n),t.splice(i,1),r.setChildren(t,n))}}let o=this.children;if(o==null?(o=[],o.push(e)):o.splice(a,0,e),e.setParent(this,n),this.setChildren(o,n),i&&this.model){let e=this.model.getIncomingEdges(this),t=this.model.getOutgoingEdges(this);e&&e.forEach(e=>e.updateParent(n)),t&&t.forEach(e=>e.updateParent(n))}this.model&&this.model.addCell(e,n)}return this}removeFromParent(e={}){let t=this.getParent();if(t!=null){let n=t.getChildIndex(this);t.removeChildAt(n,e)}return this}removeChild(e,t={}){let n=this.getChildIndex(e);return this.removeChildAt(n,t)}removeChildAt(e,t={}){let n=this.getChildAt(e);return this.children!=null&&n!=null&&(this.unembed(n,t),n.remove(t)),n}remove(e={}){return this.batchUpdate(`remove`,()=>{let t=this.getParent();t&&t.removeChild(this,e),e.deep!==!1&&this.eachChild(t=>t.remove(e)),this.model&&this.model.removeCell(this,e)}),this}transition(e,t,n={},r=`/`){return this.animation.start(e,t,n,r)}stopTransition(e,t,n=`/`){return this.animation.stop(e,t,n),this}getTransitions(){return this.animation.get()}translate(e,t,n){return this}scale(e,t,n,r){return this}addTools(e,t,n){let r=Array.isArray(e)?e:[e],i=typeof t==`string`?t:null,a=typeof t==`object`?t:typeof n==`object`?n:{};if(a.reset)return this.setTools({name:i,items:r,local:a.local},a);let o=j(this.getTools());if(o==null||i==null||o.name===i)return o??={},o.items||(o.items=[]),o.name=i,o.items=[...o.items,...r],this.setTools(Object.assign({},o),a)}setTools(t,n={}){return t==null?this.removeTools():this.store.set(`tools`,e.normalizeTools(t),n),this}getTools(){return this.store.get(`tools`)}removeTools(e={}){return this.store.remove(`tools`,e),this}hasTools(e){let t=this.getTools();return t==null?!1:e==null||t.name===e}hasTool(e){let t=this.getTools();return t!=null&&t.items.some(t=>typeof t==`string`?t===e:t.name===e)}removeTool(e,t={}){let n=j(this.getTools());if(n){let r=!1,i=n.items.slice(),a=e=>{i.splice(e,1),r=!0};if(typeof e==`number`)a(e);else for(let t=i.length-1;t>=0;--t){let n=i[t];(typeof n==`string`?n===e:n.name===e)&&a(t)}r&&(n.items=i,this.setTools(n,t))}return this}getBBox(e){return new B}getConnectionPoint(e,t){return new z}toJSON(e={}){let t=Object.assign({},this.store.get()),n=Object.prototype.toString,r=this.isNode()?`node`:this.isEdge()?`edge`:`cell`;if(!t.shape){let e=this.constructor;throw Error(`Unable to serialize ${r} missing "shape" prop, check the ${r} "${e.name||n.call(e)}"`)}let i=this.constructor,a=e.diff===!0,o=t.attrs||{},s=i.getDefaults(!0),c=a?this.preprocess(s,!0):s,l=c.attrs||{},u={};Object.entries(t).forEach(([e,i])=>{if(i!=null&&!Array.isArray(i)&&typeof i==`object`&&!vr(i))throw Error(`Can only serialize ${r} with plain-object props, but got a "${n.call(i)}" type of key "${e}" on ${r} "${this.id}"`);if(e!==`attrs`&&e!==`shape`&&a){let n=c[e];zc(i,n)&&delete t[e]}}),Object.keys(o).forEach(e=>{let t=o[e],n=l[e];Object.keys(t).forEach(r=>{let i=t[r],a=n?n[r]:null;typeof i==`object`&&i&&!Array.isArray(i)?Object.keys(i).forEach(t=>{let o=i[t];if(n==null||a==null||!O(a)||!zc(a[t],o)){u[e]??(u[e]={}),u[e][r]??(u[e][r]={});let n=u[e][r];n[t]=o}}):n!=null&&zc(a,i)||(u[e]??(u[e]={}),u[e][r]=i)})});let d=Object.assign(Object.assign({},t),{attrs:Rc(u)?void 0:u});d.attrs??delete d.attrs;let f=d;return f.angle===0&&delete f.angle,j(f)}clone(t={}){if(!t.deep){let e=Object.assign({},this.store.get());t.keepId||delete e.id,delete e.parent,delete e.children;let n=this.constructor;return new n(e)}return e.deepClone(this)[this.id]}findView(e){return e.findViewByCell(this)}startBatch(e,t={},n=this.model){return this.notify(`batch:start`,{name:e,data:t,cell:this}),n&&n.startBatch(e,Object.assign(Object.assign({},t),{cell:this})),this}stopBatch(e,t={},n=this.model){return n&&n.stopBatch(e,Object.assign(Object.assign({},t),{cell:this})),this.notify(`batch:stop`,{name:e,data:t,cell:this}),this}batchUpdate(e,t,n){let r=this.model;this.startBatch(e,n,r);let i=t();return this.stopBatch(e,n,r),i}dispose(){this.removeFromParent(),this.store.dispose()}};K.defaults={},K.attrHooks={},K.propHooks=[],jv([Al.dispose()],K.prototype,`dispose`,null),(function(e){function t(e){return typeof e==`string`?{items:[e]}:Array.isArray(e)?{items:e}:e.items?e:{items:[e]}}e.normalizeTools=t})(K||={}),(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||typeof r.isNode!=`function`||typeof r.isEdge!=`function`||typeof r.prop!=`function`||typeof r.attr!=`function`)}e.isCell=t})(K||={}),(function(e){function t(...e){let t=e.filter(e=>e!=null).map(e=>e.getAncestors()).sort((e,t)=>e.length-t.length);return t.shift().find(e=>t.every(t=>t.includes(e)))||null}e.getCommonAncestor=t;function n(e,t={}){let n=null;for(let r=0,i=e.length;r<i;r+=1){let i=e[r],a=i.getBBox(t);if(a){if(i.isNode()){let e=i.getAngle();e!=null&&e!==0&&(a=a.bbox(e))}n=n==null?a:n.union(a)}}return n}e.getCellsBBox=n;function r(t){let n=[t,...t.getDescendants({deep:!0})];return e.cloneCells(n)}e.deepClone=r;function i(e){let t=fl(e),n=t.reduce((e,t)=>(e[t.id]=t.clone(),e),{});return t.forEach(e=>{let t=n[e.id];if(t.isEdge()){let e=t.getSourceCellId(),r=t.getTargetCellId();e&&n[e]&&t.setSource(Object.assign(Object.assign({},t.getSource()),{cell:n[e].id})),r&&n[r]&&t.setTarget(Object.assign(Object.assign({},t.getTarget()),{cell:n[r].id}))}let r=e.getParent();r&&n[r.id]&&t.setParent(n[r.id]);let i=e.getChildren();if(i&&i.length){let e=i.reduce((e,t)=>(n[t.id]&&e.push(n[t.id]),e),[]);e.length>0&&t.setChildren(e)}}),n}e.cloneCells=i})(K||={}),(function(e){e.config({propHooks(t){var{tools:n}=t,r=Mv(t,[`tools`]);return n&&(r.tools=e.normalizeTools(n)),r}})})(K||={});var Nv;(function(e){let t,n;function r(e,r){return r?t!=null&&t.exist(e):n!=null&&n.exist(e)}e.exist=r;function i(e){t=e}e.setEdgeRegistry=i;function a(e){n=e}e.setNodeRegistry=a})(Nv||={});var Pv=class{constructor(e){this.ports=[],this.groups={},this.init(j(e))}getPorts(){return this.ports}getGroup(e){return e==null?null:this.groups[e]}getPortsByGroup(e){return this.ports.filter(t=>t.group===e||t.group==null&&e==null)}getPortsLayoutByGroup(e,t){let n=this.getPortsByGroup(e),r=e?this.getGroup(e):null,i=r?r.position:null,a=i?i.name:null,o;if(a!=null){let e=Fh.registry.get(a);if(e==null)return Fh.registry.onNotFound(a);o=e}else o=Fh.presets.left;let s=n.map(e=>e&&e.position&&e.position.args||{}),c=i&&i.args||{};return o(s,t,c).map((e,r)=>{let i=n[r];return{portLayout:e,portId:i.id,portSize:i.size,portAttrs:i.attrs,labelSize:i.label.size,labelLayout:this.getPortLabelLayout(i,z.create(e.position),t)}})}init(e){let{groups:t,items:n}=e;t!=null&&Object.keys(t).forEach(e=>{this.groups[e]=this.parseGroup(t[e])}),Array.isArray(n)&&n.forEach(e=>{this.ports.push(this.parsePort(e))})}parseGroup(e){return Object.assign(Object.assign({},e),{label:this.getLabel(e,!0),position:this.getPortPosition(e.position,!0)})}parsePort(e){let t=Object.assign({},e),n=this.getGroup(e.group)||{};return t.markup=t.markup||n.markup,t.attrs=Gc({},n.attrs,t.attrs),t.position=this.createPosition(n,t),t.label=Gc({},n.label,this.getLabel(t)),t.zIndex=this.getZIndex(n,t),t.size=Object.assign(Object.assign({},n.size),t.size),t}getZIndex(e,t){return typeof t.zIndex==`number`?t.zIndex:typeof e.zIndex==`number`||e.zIndex===`auto`?e.zIndex:`auto`}createPosition(e,t){return Gc({name:`left`,args:{}},e.position,{args:t.args})}getPortPosition(e,t=!1){if(e==null){if(t)return{name:`left`,args:{}}}else{if(typeof e==`string`)return{name:e,args:{}};if(Array.isArray(e))return{name:`absolute`,args:{x:e[0],y:e[1]}};if(typeof e==`object`)return e}return{args:{}}}getPortLabelPosition(e,t=!1){if(e==null){if(t)return{name:`left`,args:{}}}else{if(typeof e==`string`)return{name:e,args:{}};if(typeof e==`object`)return e}return{args:{}}}getLabel(e,t=!1){let n=e.label||{};return n.position=this.getPortLabelPosition(n.position,t),n}getPortLabelLayout(e,t,n){let r=e.label.position.name||`left`,i=e.label.position.args||{},a=eg.registry.get(r)||eg.presets.left;return a?a(t,n,i):null}},Fv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Iv=class e extends K{get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super(e),this.initPorts()}preprocess(e,t){let{x:n,y:r,width:i,height:a}=e,o=Fv(e,[`x`,`y`,`width`,`height`]);if(n!=null||r!=null){let e=o.position;o.position=Object.assign(Object.assign({},e),{x:n??(e?e.x:0),y:r??(e?e.y:0)})}if(i!=null||a!=null){let e=o.size;o.size=Object.assign(Object.assign({},e),{width:i??(e?e.width:0),height:a??(e?e.height:0)})}return super.preprocess(o,t)}isNode(){return!0}size(e,t,n){return e===void 0?this.getSize():typeof e==`number`?this.setSize(e,t,n):this.setSize(e,t)}getSize(){let e=this.store.get(`size`);return e?Object.assign({},e):{width:1,height:1}}setSize(e,t,n){return typeof e==`object`?this.resize(e.width,e.height,t):this.resize(e,t,n),this}resize(e,t,n={}){this.startBatch(`resize`,n);let r=n.direction;if(r){let i=this.getSize();switch(r){case`left`:case`right`:t=i.height;break;case`top`:case`bottom`:e=i.width}let a={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[r],o=L.normalize(this.getAngle()||0);n.absolute&&(a+=Math.floor((o+45)/90),a%=4);let s=this.getBBox(),c;c=a===0?s.getBottomLeft():a===1?s.getCorner():a===2?s.getTopRight():s.getOrigin();let l=c.clone().rotate(-o,s.getCenter()),u=Math.sqrt(e*e+t*t)/2,d=a*Math.PI/2;d+=Math.atan(a%2==0?t/e:e/t),d-=L.toRad(o);let f=z.fromPolar(u,d,l).clone().translate(e/-2,t/-2);this.store.set(`size`,{width:e,height:t},n),this.setPosition(f.x,f.y,n)}else this.store.set(`size`,{width:e,height:t},n);return this.stopBatch(`resize`,n),this}scale(e,t,n,r={}){let i=this.getBBox().scale(e,t,n??void 0);return this.startBatch(`scale`,r),this.setPosition(i.x,i.y,r),this.resize(i.width,i.height,r),this.stopBatch(`scale`),this}position(e,t,n){return typeof e==`number`?this.setPosition(e,t,n):this.getPosition(e)}getPosition(e={}){if(e.relative){let e=this.getParent();if(e!=null&&e.isNode()){let t=this.getPosition(),n=e.getPosition();return{x:t.x-n.x,y:t.y-n.y}}}let t=this.store.get(`position`);return t?Object.assign({},t):{x:0,y:0}}setPosition(e,t,n={}){let r,i,a;if(typeof e==`object`?(r=e.x,i=e.y,a=t||{}):(r=e,i=t,a=n||{}),a.relative){let e=this.getParent();if(e!=null&&e.isNode()){let t=e.getPosition();r+=t.x,i+=t.y}}if(a.deep){let e=this.getPosition();this.translate(r-e.x,i-e.y,a)}else this.store.set(`position`,{x:r,y:i},a);return this}translate(e=0,t=0,n={}){if(e===0&&t===0)return this;n.translateBy=n.translateBy||this.id;let r=this.getPosition();if(n.restrict!=null&&n.translateBy===this.id){let i=this.getBBox({deep:!0}),a=n.restrict,o=r.x-i.x,s=r.y-i.y,c=Math.max(a.x+o,Math.min(a.x+a.width+o-i.width,r.x+e)),l=Math.max(a.y+s,Math.min(a.y+a.height+s-i.height,r.y+t));e=c-r.x,t=l-r.y}let i={x:r.x+e,y:r.y+t};return n.tx=e,n.ty=t,n.transition?(typeof n.transition!=`object`&&(n.transition={}),this.transition(`position`,i,Object.assign(Object.assign({},n.transition),{interp:Af.object})),this.eachChild(r=>{n.exclude?.includes(r)||r.translate(e,t,n)})):(this.startBatch(`translate`,n),this.store.set(`position`,i,n),this.eachChild(r=>{n.exclude?.includes(r)||r.translate(e,t,n)}),this.stopBatch(`translate`,n)),this}angle(e,t){return e==null?this.getAngle():this.rotate(e,t)}getAngle(){return this.store.get(`angle`,0)}rotate(e,t={}){let n=this.getAngle();if(t.center){let r=this.getSize(),i=this.getPosition(),a=this.getBBox().getCenter();a.rotate(n-e,t.center);let o=a.x-r.width/2-i.x,s=a.y-r.height/2-i.y;this.startBatch(`rotate`,{angle:e,options:t}),this.setPosition(i.x+o,i.y+s,t),this.rotate(e,Object.assign(Object.assign({},t),{center:null})),this.stopBatch(`rotate`)}else this.store.set(`angle`,t.absolute?e:(n+e)%360,t);return this}getBBox(e={}){if(e.deep){let e=this.getDescendants({deep:!0,breadthFirst:!0});return e.push(this),K.getCellsBBox(e)}return B.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(e,t){let n=this.getBBox(),r=n.getCenter(),i=e.getTerminal(t);if(i==null)return r;let a=i.port;if(!a||!this.hasPort(a))return r;let o=this.getPort(a);if(!o||!o.group)return r;let s=this.getPortsPosition(o.group)[a].position,c=z.create(s).translate(n.getOrigin()),l=this.getAngle();return l&&c.rotate(-l,r),c}fit(e={}){let t=(this.getChildren()||[]).filter(e=>e.isNode());if(t.length===0)return this;this.startBatch(`fit-embeds`,e),e.deep&&t.forEach(t=>t.fit(e));let{x:n,y:r,width:i,height:a}=K.getCellsBBox(t),o=Bl(e.padding);return n-=o.left,r-=o.top,i+=o.left+o.right,a+=o.bottom+o.top,this.store.set({position:{x:n,y:r},size:{width:i,height:a}},e),this.stopBatch(`fit-embeds`),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(e){this.setPortContainerMarkup(e)}getDefaultPortContainerMarkup(){return this.store.get(`defaultPortContainerMarkup`)||G.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get(`portContainerMarkup`)||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(e,t={}){return this.store.set(`portContainerMarkup`,G.clone(e),t),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(e){this.setPortMarkup(e)}getDefaultPortMarkup(){return this.store.get(`defaultPortMarkup`)||G.getPortMarkup()}getPortMarkup(){return this.store.get(`portMarkup`)||this.getDefaultPortMarkup()}setPortMarkup(e,t={}){return this.store.set(`portMarkup`,G.clone(e),t),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(e){this.setPortLabelMarkup(e)}getDefaultPortLabelMarkup(){return this.store.get(`defaultPortLabelMarkup`)||G.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get(`portLabelMarkup`)||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(e,t={}){return this.store.set(`portLabelMarkup`,G.clone(e),t),this}get ports(){let e=this.store.get(`ports`,{items:[]});return e.items??=[],e}getPorts(){return j(this.ports.items)}getPortsByGroup(e){return this.getPorts().filter(t=>t.group===e)}getPort(e){return j(this.ports.items.find(t=>t.id&&t.id===e))}getPortAt(e){return this.ports.items[e]||null}hasPorts(){return this.ports.items.length>0}hasPort(e){return this.getPortIndex(e)!==-1}getPortIndex(e){let t=typeof e==`string`?e:e.id;return t==null?-1:this.ports.items.findIndex(e=>e.id===t)}getPortsPosition(e){let t=this.getSize();return this.port.getPortsLayoutByGroup(e,new B(0,0,t.width,t.height)).reduce((e,t)=>{let n=t.portLayout;return e[t.portId]={position:Object.assign({},n.position),angle:n.angle||0},e},{})}getPortProp(e,t){return this.getPropByPath(this.prefixPortPath(e,t))}setPortProp(e,t,n,r){if(typeof t==`string`||Array.isArray(t)){let i=this.prefixPortPath(e,t),a=n;return this.setPropByPath(i,a,r)}let i=this.prefixPortPath(e),a=t;return this.setPropByPath(i,a,n)}removePortProp(e,t,n){return typeof t==`string`||Array.isArray(t)?this.removePropByPath(this.prefixPortPath(e,t),n):this.removePropByPath(this.prefixPortPath(e),t)}portProp(e,t,n,r){return t==null?this.getPortProp(e):typeof t==`string`||Array.isArray(t)?arguments.length===2?this.getPortProp(e,t):n==null?this.removePortProp(e,t,r):this.setPortProp(e,t,n,r):this.setPortProp(e,t,n)}prefixPortPath(e,t){let n=this.getPortIndex(e);if(n===-1)throw Error(`Unable to find port with id: "${e}"`);return t==null||t===``?[`ports`,`items`,`${n}`]:Array.isArray(t)?[`ports`,`items`,`${n}`,...t]:`ports/items/${n}/${t}`}addPort(e,t){let n=[...this.ports.items];return n.push(e),this.setPropByPath(`ports/items`,n,t),this}addPorts(e,t){return this.setPropByPath(`ports/items`,[...this.ports.items,...e],t),this}insertPort(e,t,n){let r=[...this.ports.items];return r.splice(e,0,t),this.setPropByPath(`ports/items`,r,n),this}removePort(e,t={}){return this.removePortAt(this.getPortIndex(e),t)}removePortAt(e,t={}){if(e>=0){let n=[...this.ports.items];n.splice(e,1),t.rewrite=!0,this.setPropByPath(`ports/items`,n,t)}return this}removePorts(e,t){let n;if(Array.isArray(e)){if(n=t||{},e.length){n.rewrite=!0;let t=[...this.ports.items].filter(t=>!e.some(e=>{let n=typeof e==`string`?e:e.id;return t.id===n}));this.setPropByPath(`ports/items`,t,n)}}else n=e||{},n.rewrite=!0,this.setPropByPath(`ports/items`,[],n);return this}getParsedPorts(){return this.port.getPorts()}getParsedGroups(){return this.port.groups}getPortsLayoutByGroup(e,t){return this.port.getPortsLayoutByGroup(e,t)}initPorts(){this.updatePortData(),this.on(`change:ports`,()=>{this.processRemovedPort(),this.updatePortData()})}processRemovedPort(){let e=this.ports,t={};e.items.forEach(e=>{e.id&&(t[e.id]=!0)});let n={};(this.store.getPrevious(`ports`)||{items:[]}).items.forEach(e=>{e.id&&!t[e.id]&&(n[e.id]=!0)});let r=this.model;r&&!Rc(n)&&(r.getConnectedEdges(this,{incoming:!0}).forEach(e=>{let t=e.getTargetPortId();t&&n[t]&&e.remove()}),r.getConnectedEdges(this,{outgoing:!0}).forEach(e=>{let t=e.getSourcePortId();t&&n[t]&&e.remove()}))}validatePorts(){let e={},t=[];return this.ports.items.forEach(n=>{typeof n!=`object`&&t.push(`Invalid port ${n}.`),n.id??=this.generatePortId(),e[n.id]&&t.push(`Duplicitied port id.`),e[n.id]=!0}),t}generatePortId(){return Fl()}updatePortData(){let e=this.validatePorts();if(e.length>0)throw this.store.set(`ports`,this.store.getPrevious(`ports`)),Error(e.join(` `));let t=this.port?this.port.getPorts():null;this.port=new Pv(this.ports);let n=this.port.getPorts(),r=t?n.filter(e=>t.find(t=>t.id===e.id)?null:e):[...n],i=t?t.filter(e=>n.find(t=>t.id===e.id)?null:e):[];r.length>0&&this.notify(`ports:added`,{added:r,cell:this,node:this}),i.length>0&&this.notify(`ports:removed`,{removed:i,cell:this,node:this})}};Iv.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||typeof r.isNode!=`function`||typeof r.isEdge!=`function`||typeof r.prop!=`function`||typeof r.attr!=`function`||typeof r.size!=`function`||typeof r.position!=`function`)}e.isNode=t})(Iv||={}),(function(e){e.config({propHooks(e){var{ports:t}=e,n=Fv(e,[`ports`]);return t&&(n.ports=Array.isArray(t)?{items:t}:t),n}})})(Iv||={}),(function(e){e.registry=rp.create({type:`node`,process(t,n){if(Nv.exist(t,!0))throw Error(`Node with name '${t}' was registered by anthor Edge`);if(typeof n==`function`)return n.config({shape:t}),n;let r=e,{inherit:i}=n,a=Fv(n,[`inherit`]);if(i){if(typeof i==`string`){let e=this.get(i);e==null?this.onNotFound(i,`inherited`):r=e}else r=i}a.constructorName??=t;let o=r.define.call(r,a);return o.config({shape:t}),o}}),Nv.setNodeRegistry(e.registry)})(Iv||={}),(function(e){let t=0;function n(e){return e?Nl(e):(t+=1,`CustomNode${t}`)}function r(t){let{constructorName:r,overwrite:i}=t,a=Fv(t,[`constructorName`,`overwrite`]),o=wl(n(r||a.shape),this);return o.config(a),a.shape&&e.registry.register(a.shape,o,i),o}e.define=r;function i(t){let n=t.shape||`rect`,r=e.registry.get(n);return r?new r(t):e.registry.onNotFound(n)}e.create=i})(Iv||={});var Lv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Rv=class e extends K{get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super(e)}preprocess(e,t){let{source:n,sourceCell:r,sourcePort:i,sourcePoint:a,target:o,targetCell:s,targetPort:c,targetPoint:l}=e,u=Lv(e,[`source`,`sourceCell`,`sourcePort`,`sourcePoint`,`target`,`targetCell`,`targetPort`,`targetPoint`]),d=e=>typeof e==`string`||typeof e==`number`;if(n!=null){if(K.isCell(n))u.source={cell:n.id};else if(d(n))u.source={cell:n};else if(z.isPoint(n))u.source=n.toJSON();else if(Array.isArray(n))u.source={x:n[0],y:n[1]};else{let e=n.cell;u.source=K.isCell(e)?Object.assign(Object.assign({},n),{cell:e.id}):n}}if(r!=null||i!=null){let e=u.source;if(r!=null){let t=d(r)?r:r.id;e?e.cell=t:e=u.source={cell:t}}i!=null&&e&&(e.port=i)}else a!=null&&(u.source=z.create(a).toJSON());if(o!=null){if(K.isCell(o))u.target={cell:o.id};else if(d(o))u.target={cell:o};else if(z.isPoint(o))u.target=o.toJSON();else if(Array.isArray(o))u.target={x:o[0],y:o[1]};else{let e=o.cell;u.target=K.isCell(e)?Object.assign(Object.assign({},o),{cell:e.id}):o}}if(s!=null||c!=null){let e=u.target;if(s!=null){let t=d(s)?s:s.id;e?e.cell=t:e=u.target={cell:t}}c!=null&&e&&(e.port=c)}else l!=null&&(u.target=z.create(l).toJSON());return super.preprocess(u,t)}setup(){super.setup(),this.on(`change:labels`,e=>this.onLabelsChanged(e)),this.on(`change:vertices`,e=>this.onVertexsChanged(e))}isEdge(){return!0}disconnect(e={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},e),this}get source(){return this.getSource()}set source(e){this.setSource(e)}getSource(){return this.getTerminal(`source`)}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(e,t,n={}){return this.setTerminal(`source`,e,t,n)}get target(){return this.getTarget()}set target(e){this.setTarget(e)}getTarget(){return this.getTerminal(`target`)}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(e,t,n={}){return this.setTerminal(`target`,e,t,n)}getTerminal(e){return Object.assign({},this.store.get(e))}setTerminal(e,t,n,r={}){if(K.isCell(t))return this.store.set(e,Gc({},n,{cell:t.id}),r),this;let i=t;return z.isPoint(t)||i.x!=null&&i.y!=null?(this.store.set(e,Gc({},n,{x:i.x,y:i.y}),r),this):(this.store.set(e,j(t),r),this)}getSourcePoint(){return this.getTerminalPoint(`source`)}getTargetPoint(){return this.getTerminalPoint(`target`)}getTerminalPoint(e){let t=this[e];if(z.isPointLike(t))return z.create(t);let n=this.getTerminalCell(e);return n?n.getConnectionPoint(this,e):new z}getSourceCell(){return this.getTerminalCell(`source`)}getTargetCell(){return this.getTerminalCell(`target`)}getTerminalCell(e){if(this.model){let t=e===`source`?this.getSourceCellId():this.getTargetCellId();if(t)return this.model.getCell(t)}return null}getSourceNode(){return this.getTerminalNode(`source`)}getTargetNode(){return this.getTerminalNode(`target`)}getTerminalNode(e){let t=this,n={};for(;t&&t.isEdge();){if(n[t.id])return null;n[t.id]=!0,t=t.getTerminalCell(e)}return t&&t.isNode()?t:null}get router(){return this.getRouter()}set router(e){e==null?this.removeRouter():this.setRouter(e)}getRouter(){return this.store.get(`router`)}setRouter(e,t,n){return typeof e==`object`?this.store.set(`router`,e,t):this.store.set(`router`,{name:e,args:t},n),this}removeRouter(e={}){return this.store.remove(`router`,e),this}get connector(){return this.getConnector()}set connector(e){e==null?this.removeConnector():this.setConnector(e)}getConnector(){return this.store.get(`connector`)}setConnector(e,t,n){return typeof e==`object`?this.store.set(`connector`,e,t):this.store.set(`connector`,{name:e,args:t},n),this}removeConnector(e={}){return this.store.remove(`connector`,e)}getDefaultLabel(){let e=this.constructor;return j(this.store.get(`defaultLabel`)||e.defaultLabel||{})}get labels(){return this.getLabels()}set labels(e){this.setLabels(e)}getLabels(){return[...this.store.get(`labels`,[])].map(e=>this.parseLabel(e))}setLabels(e,t={}){return this.store.set(`labels`,Array.isArray(e)?e:[e],t),this}insertLabel(e,t,n={}){let r=this.getLabels(),i=r.length,a=t!=null&&Number.isFinite(t)?t:i;return a<0&&(a=i+a+1),r.splice(a,0,this.parseLabel(e)),this.setLabels(r,n)}appendLabel(e,t={}){return this.insertLabel(e,-1,t)}getLabelAt(e){let t=this.getLabels();return e!=null&&Number.isFinite(e)?this.parseLabel(t[e]):null}setLabelAt(e,t,n={}){if(e!=null&&Number.isFinite(e)){let r=this.getLabels();r[e]=this.parseLabel(t),this.setLabels(r,n)}return this}removeLabelAt(e,t={}){let n=this.getLabels(),r=e!=null&&Number.isFinite(e)?e:-1,i=n.splice(r,1);return this.setLabels(n,t),i.length?i[0]:null}parseLabel(e){return typeof e==`string`?this.constructor.parseStringLabel(e):e}onLabelsChanged({previous:e,current:t}){let n=e&&t?t.filter(t=>e.find(e=>t===e||zc(t,e))?null:t):t?[...t]:[],r=e&&t?e.filter(e=>t.find(t=>e===t||zc(e,t))?null:e):e?[...e]:[];n.length>0&&this.notify(`labels:added`,{added:n,cell:this,edge:this}),r.length>0&&this.notify(`labels:removed`,{removed:r,cell:this,edge:this})}get vertices(){return this.getVertices()}set vertices(e){this.setVertices(e)}getVertices(){return[...this.store.get(`vertices`,[])]}setVertices(e,t={}){let n=Array.isArray(e)?e:[e];return this.store.set(`vertices`,n.map(e=>z.toJSON(e)),t),this}insertVertex(e,t,n={}){let r=this.getVertices(),i=r.length,a=t!=null&&Number.isFinite(t)?t:i;return a<0&&(a=i+a+1),r.splice(a,0,z.toJSON(e)),this.setVertices(r,n)}appendVertex(e,t={}){return this.insertVertex(e,-1,t)}getVertexAt(e){return e!=null&&Number.isFinite(e)?this.getVertices()[e]:null}setVertexAt(e,t,n={}){if(e!=null&&Number.isFinite(e)){let r=this.getVertices();r[e]=t,this.setVertices(r,n)}return this}removeVertexAt(e,t={}){let n=this.getVertices(),r=e!=null&&Number.isFinite(e)?e:-1;return n.splice(r,1),this.setVertices(n,t)}onVertexsChanged({previous:e,current:t}){let n=e&&t?t.filter(t=>e.find(e=>z.equals(t,e))?null:t):t?[...t]:[],r=e&&t?e.filter(e=>t.find(t=>z.equals(e,t))?null:e):e?[...e]:[];n.length>0&&this.notify(`vertexs:added`,{added:n,cell:this,edge:this}),r.length>0&&this.notify(`vertexs:removed`,{removed:r,cell:this,edge:this})}getDefaultMarkup(){return this.store.get(`defaultMarkup`)||G.getEdgeMarkup()}getMarkup(){return super.getMarkup()||this.getDefaultMarkup()}translate(e,t,n={}){return n.translateBy=n.translateBy||this.id,n.tx=e,n.ty=t,this.applyToPoints(n=>({x:(n.x||0)+e,y:(n.y||0)+t}),n)}scale(e,t,n,r={}){return this.applyToPoints(r=>z.create(r).scale(e,t,n).toJSON(),r)}applyToPoints(e,t={}){let n={},r=this.getSource(),i=this.getTarget();z.isPointLike(r)&&(n.source=e(r)),z.isPointLike(i)&&(n.target=e(i));let a=this.getVertices();return a.length>0&&(n.vertices=a.map(e)),this.store.set(n,t),this}getBBox(){return this.getPolyline().bbox()}getConnectionPoint(){return this.getPolyline().pointAt(.5)}getPolyline(){let e=[this.getSourcePoint(),...this.getVertices().map(e=>z.create(e)),this.getTargetPoint()];return new Uf(e)}updateParent(e){let t=null,n=this.getSourceCell(),r=this.getTargetCell(),i=this.getParent();return n&&r&&(t=n===r||n.isDescendantOf(r)?r:r.isDescendantOf(n)?n:K.getCommonAncestor(n,r)),i&&t&&t.id!==i.id&&i.unembed(this,e),t&&(!i||i.id!==t.id)&&t.embed(this,e),t}hasLoop(e={}){let t=this.getSource(),n=this.getTarget(),r=t.cell,i=n.cell;if(!r||!i)return!1;let a=r===i;if(!a&&e.deep&&this._model){let t=this.getSourceCell(),n=this.getTargetCell();t&&n&&(a=t.isAncestorOf(n,e)||n.isAncestorOf(t,e))}return a}getFragmentAncestor(){let e=[this,this.getSourceNode(),this.getTargetNode()].filter(e=>e!=null);return this.getCommonAncestor(...e)}isFragmentDescendantOf(e){let t=this.getFragmentAncestor();return!!t&&(t.id===e.id||t.isDescendantOf(e))}};Rv.defaults={},(function(e){function t(e,t){let n=e,r=t;return n.cell===r.cell?n.port===r.port||n.port==null&&r.port==null:!1}e.equalTerminals=t})(Rv||={}),(function(e){e.defaultLabel={markup:[{tagName:`rect`,selector:`body`},{tagName:`text`,selector:`label`}],attrs:{text:{fill:`#000`,fontSize:14,textAnchor:`middle`,textVerticalAnchor:`middle`,pointerEvents:`none`},rect:{ref:`label`,fill:`#fff`,rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}};function t(e){return{attrs:{label:{text:e}}}}e.parseStringLabel=t})(Rv||={}),(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||typeof r.isNode!=`function`||typeof r.isEdge!=`function`||typeof r.prop!=`function`||typeof r.attr!=`function`||typeof r.disconnect!=`function`||typeof r.getSource!=`function`||typeof r.getTarget!=`function`)}e.isEdge=t})(Rv||={}),(function(e){e.registry=rp.create({type:`edge`,process(t,n){if(Nv.exist(t,!1))throw Error(`Edge with name '${t}' was registered by anthor Node`);if(typeof n==`function`)return n.config({shape:t}),n;let r=e,{inherit:i=`edge`}=n,a=Lv(n,[`inherit`]);if(typeof i==`string`){let e=this.get(i||`edge`);e==null&&i?this.onNotFound(i,`inherited`):r=e}else r=i;a.constructorName??=t;let o=r.define.call(r,a);return o.config({shape:t}),o}}),Nv.setEdgeRegistry(e.registry)})(Rv||={}),(function(e){let t=0;function n(e){return e?Nl(e):(t+=1,`CustomEdge${t}`)}function r(t){let{constructorName:r,overwrite:i}=t,a=Lv(t,[`constructorName`,`overwrite`]),o=wl(n(r||a.shape),this);return o.config(a),a.shape&&e.registry.register(a.shape,o,i),o}e.define=r;function i(t){let n=t.shape||`edge`,r=e.registry.get(n);return r?new r(t):e.registry.onNotFound(n)}e.create=i})(Rv||={}),(function(e){let t=`basic.edge`;e.config({shape:t,propHooks(t){let{label:n,vertices:r}=t,i=Lv(t,[`label`,`vertices`]);if(n){i.labels??=[];let t=typeof n==`string`?e.parseStringLabel(n):n;i.labels.push(t)}return r&&Array.isArray(r)&&(i.vertices=r.map(e=>z.create(e).toJSON())),i}}),e.registry.register(t,e)})(Rv||={});var zv=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Bv=class extends Al{constructor(e,t={}){super(),this.length=0,this.comparator=t.comparator||`zIndex`,this.clean(),e&&this.reset(e,{silent:!0})}toJSON(){return this.cells.map(e=>e.toJSON())}add(e,t,n){let r,i;typeof t==`number`?(r=t,i=Object.assign({merge:!1},n)):(r=this.length,i=Object.assign({merge:!1},t)),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);let a=Array.isArray(e)?e:[e],o=this.comparator&&typeof t!=`number`&&i.sort!==!1,s=this.comparator||null,c=!1,l=[],u=[];return a.forEach(e=>{let t=this.get(e);t?i.merge&&!e.isSameStore(t)&&(t.setProp(e.getProp(),n),u.push(t),o&&!c&&(c=s==null||typeof s==`function`?t.hasChanged():typeof s==`string`?t.hasChanged(s):s.some(e=>t.hasChanged(e)))):(l.push(e),this.reference(e))}),l.length&&(o&&(c=!0),this.cells.splice(r,0,...l),this.length=this.cells.length),c&&this.sort({silent:!0}),i.silent||(l.forEach((e,t)=>{let n={cell:e,index:r+t,options:i};this.trigger(`added`,n),i.dryrun||e.notify(`added`,Object.assign({},n))}),c&&this.trigger(`sorted`),(l.length||u.length)&&this.trigger(`updated`,{added:l,merged:u,removed:[],options:i})),this}remove(e,t={}){let n=Array.isArray(e)?e:[e],r=this.removeCells(n,t);return!t.silent&&r.length>0&&this.trigger(`updated`,{options:t,removed:r,added:[],merged:[]}),Array.isArray(e)?r:r[0]}removeCells(e,t){let n=[];for(let r=0;r<e.length;r+=1){let i=this.get(e[r]);if(i==null)continue;let a=this.cells.indexOf(i);this.cells.splice(a,1),--this.length,delete this.map[i.id],n.push(i),this.unreference(i),t.dryrun||i.remove(),t.silent||(this.trigger(`removed`,{cell:i,index:a,options:t}),t.dryrun||i.notify(`removed`,{cell:i,index:a,options:t}))}return n}reset(e,t={}){let n=this.cells.slice();if(n.forEach(e=>this.unreference(e)),this.clean(),this.add(e,Object.assign({silent:!0},t)),!t.silent){let e=this.cells.slice();this.trigger(`reseted`,{options:t,previous:n,current:e});let r=[],i=[];e.forEach(e=>{n.some(t=>t.id===e.id)||r.push(e)}),n.forEach(t=>{e.some(e=>e.id===t.id)||i.push(t)}),this.trigger(`updated`,{options:t,added:r,removed:i,merged:[]})}return this}push(e,t){return this.add(e,this.length,t)}pop(e){let t=this.at(this.length-1);return this.remove(t,e)}unshift(e,t){return this.add(e,0,t)}shift(e){let t=this.at(0);return this.remove(t,e)}get(e){if(e==null)return null;let t=typeof e==`string`||typeof e==`number`?e:e.id;return this.map[t]||null}has(e){return this.get(e)!=null}at(e){return e<0&&(e+=this.length),this.cells[e]||null}first(){return this.at(0)}last(){return this.at(-1)}indexOf(e){return this.cells.indexOf(e)}toArray(){return this.cells.slice()}sort(e={}){return this.comparator!=null&&(this.cells=Xc(this.cells,this.comparator),e.silent||this.trigger(`sorted`)),this}clone(){let e=this.constructor;return new e(this.cells.slice(),{comparator:this.comparator})}reference(e){this.map[e.id]=e,e.on(`*`,this.notifyCellEvent,this)}unreference(e){e.off(`*`,this.notifyCellEvent,this),delete this.map[e.id]}notifyCellEvent(e,t){let n=t.cell;this.trigger(`cell:${e}`,t),n&&(n.isNode()?this.trigger(`node:${e}`,Object.assign(Object.assign({},t),{node:n})):n.isEdge()&&this.trigger(`edge:${e}`,Object.assign(Object.assign({},t),{edge:n})))}clean(){this.length=0,this.cells=[],this.map={}}dispose(){this.reset([])}};zv([Bv.dispose()],Bv.prototype,`dispose`,null);var Vv=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Hv=class e extends Al{get[Symbol.toStringTag](){return e.toStringTag}constructor(e=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new Bv(e),this.setup()}notify(e,t){this.trigger(e,t);let n=this.graph;return n&&(e===`sorted`||e===`reseted`||e===`updated`?n.trigger(`model:${e}`,t):n.trigger(e,t)),this}setup(){let e=this.collection;e.on(`sorted`,()=>this.notify(`sorted`,null)),e.on(`updated`,e=>this.notify(`updated`,e)),e.on(`cell:change:zIndex`,()=>this.sortOnChangeZ()),e.on(`added`,({cell:e})=>{this.onCellAdded(e)}),e.on(`removed`,e=>{let t=e.cell;this.onCellRemoved(t,e.options),this.notify(`cell:removed`,e),t.isNode()?this.notify(`node:removed`,Object.assign(Object.assign({},e),{node:t})):t.isEdge()&&this.notify(`edge:removed`,Object.assign(Object.assign({},e),{edge:t}))}),e.on(`reseted`,e=>{this.onReset(e.current),this.notify(`reseted`,e)}),e.on(`edge:change:source`,({edge:e})=>this.onEdgeTerminalChanged(e,`source`)),e.on(`edge:change:target`,({edge:e})=>{this.onEdgeTerminalChanged(e,`target`)})}sortOnChangeZ(){this.collection.sort()}onCellAdded(e){let t=e.id;e.isEdge()?(e.updateParent(),this.edges[t]=!0,this.onEdgeTerminalChanged(e,`source`),this.onEdgeTerminalChanged(e,`target`)):this.nodes[t]=!0}onCellRemoved(e,t){let n=e.id;if(e.isEdge()){delete this.edges[n];let t=e.getSource(),r=e.getTarget();if(t&&t.cell){let e=this.outgoings[t.cell],r=e?e.indexOf(n):-1;r>=0&&(e.splice(r,1),e.length===0&&delete this.outgoings[t.cell])}if(r&&r.cell){let e=this.incomings[r.cell],t=e?e.indexOf(n):-1;t>=0&&(e.splice(t,1),e.length===0&&delete this.incomings[r.cell])}}else delete this.nodes[n];t.clear||(t.disconnectEdges?this.disconnectConnectedEdges(e,t):this.removeConnectedEdges(e,t)),e.model===this&&(e.model=null)}onReset(e){this.nodes={},this.edges={},this.outgoings={},this.incomings={},e.forEach(e=>this.onCellAdded(e))}onEdgeTerminalChanged(e,t){let n=t===`source`?this.outgoings:this.incomings,r=e.previous(t);if(r&&r.cell){let t=K.isCell(r.cell)?r.cell.id:r.cell,i=n[t],a=i?i.indexOf(e.id):-1;a>=0&&(i.splice(a,1),i.length===0&&delete n[t])}let i=e.getTerminal(t);if(i&&i.cell){let t=K.isCell(i.cell)?i.cell.id:i.cell,r=n[t]||[];r.indexOf(e.id)===-1&&r.push(e.id),n[t]=r}}prepareCell(e,t){return e.model||t&&t.dryrun||(e.model=this),e.zIndex??e.setZIndex(this.getMaxZIndex()+1,{silent:!0}),e}resetCells(e,t={}){return e.map(e=>this.prepareCell(e,Object.assign(Object.assign({},t),{dryrun:!0}))),this.collection.reset(e,t),e.map(e=>this.prepareCell(e,{options:t})),this}clear(e={}){let t=this.getCells();if(t.length===0)return this;let n=Object.assign(Object.assign({},e),{clear:!0});return this.batchUpdate(`clear`,()=>{let e=t.sort((e,t)=>(e.isEdge()?1:2)-(t.isEdge()?1:2));for(;e.length>0;){let t=e.shift();t&&t.remove(n)}},n),this}addNode(e,t={}){let n=Iv.isNode(e)?e:this.createNode(e);return this.addCell(n,t),n}updateNode(e,t={}){let n=this.createNode(e),r=n.getProp();return n.dispose(),this.updateCell(r,t)}createNode(e){return Iv.create(e)}addEdge(e,t={}){let n=Rv.isEdge(e)?e:this.createEdge(e);return this.addCell(n,t),n}createEdge(e){return Rv.create(e)}updateEdge(e,t={}){let n=this.createEdge(e),r=n.getProp();return n.dispose(),this.updateCell(r,t)}addCell(e,t={}){return Array.isArray(e)?this.addCells(e,t):(!this.collection.has(e)&&!this.addings.has(e)&&(this.addings.set(e,!0),this.collection.add(this.prepareCell(e,t),t),e.eachChild(e=>this.addCell(e,t)),this.addings.delete(e)),this)}addCells(e,t={}){let n=e.length;if(n===0)return this;let r=Object.assign(Object.assign({},t),{position:n-1,maxPosition:n-1});return this.startBatch(`add`,Object.assign(Object.assign({},r),{cells:e})),e.forEach(e=>{this.addCell(e,r),--r.position}),this.stopBatch(`add`,Object.assign(Object.assign({},r),{cells:e})),this}updateCell(e,t={}){let n=e.id&&this.getCell(e.id);return n?this.batchUpdate(`update`,()=>(Object.entries(e).forEach(([e,r])=>n.setProp(e,r,t)),!0),e):!1}removeCell(e,t={}){let n=typeof e==`string`?this.getCell(e):e;return n&&this.has(n)?this.collection.remove(n,t):null}updateCellId(e,t){if(e.id===t)return;this.startBatch(`update`,{id:t}),e.prop(`id`,t);let n=e.clone({keepId:!0});return this.addCell(n),this.getConnectedEdges(e).forEach(n=>{let r=n.getSourceCell(),i=n.getTargetCell();r===e&&n.setSource(Object.assign(Object.assign({},n.getSource()),{cell:t})),i===e&&n.setTarget(Object.assign(Object.assign({},n.getTarget()),{cell:t}))}),this.removeCell(e),this.stopBatch(`update`,{id:t}),n}removeCells(e,t={}){return e.length?this.batchUpdate(`remove`,()=>e.map(e=>this.removeCell(e,t))):[]}removeConnectedEdges(e,t={}){let n=this.getConnectedEdges(e);return n.forEach(e=>{e.remove(t)}),n}disconnectConnectedEdges(e,t={}){let n=typeof e==`string`?e:e.id;this.getConnectedEdges(e).forEach(e=>{let r=e.getSourceCellId(),i=e.getTargetCellId();r===n&&e.setSource({x:0,y:0},t),i===n&&e.setTarget({x:0,y:0},t)})}has(e){return this.collection.has(e)}total(){return this.collection.length}indexOf(e){return this.collection.indexOf(e)}getCell(e){return this.collection.get(e)}getCells(){return this.collection.toArray()}getFirstCell(){return this.collection.first()}getLastCell(){return this.collection.last()}getMinZIndex(){let e=this.collection.first();return e&&e.getZIndex()||0}getMaxZIndex(){let e=this.collection.last();return e&&e.getZIndex()||0}getCellsFromCache(e){return e?Object.keys(e).map(e=>this.getCell(e)).filter(e=>e!=null):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(e){let t=typeof e==`string`?e:e.id,n=this.outgoings[t];return n?n.map(e=>this.getCell(e)).filter(e=>e&&e.isEdge()):null}getIncomingEdges(e){let t=typeof e==`string`?e:e.id,n=this.incomings[t];return n?n.map(e=>this.getCell(e)).filter(e=>e&&e.isEdge()):null}getConnectedEdges(e,t={}){let n=[],r=typeof e==`string`?this.getCell(e):e;if(r==null)return n;let i={},a=t.indirect,o=t.incoming,s=t.outgoing;o==null&&s==null&&(o=s=!0);let c=(e,t)=>{if((t?this.getOutgoingEdges(e):this.getIncomingEdges(e))?.forEach(e=>{i[e.id]||(n.push(e),i[e.id]=!0,a&&(o&&c(e,!1),s&&c(e,!0)))}),a&&e.isEdge()){let r=t?e.getTargetCell():e.getSourceCell();r&&r.isEdge()&&(i[r.id]||(n.push(r),c(r,t)))}};if(s&&c(r,!0),o&&c(r,!1),t.deep){let e=r.getDescendants({deep:!0}),a={};e.forEach(e=>{e.isNode()&&(a[e.id]=!0)});let c=(e,r)=>{(r?this.getOutgoingEdges(e.id):this.getIncomingEdges(e.id))?.forEach(e=>{if(!i[e.id]){let r=e.getSourceCell(),o=e.getTargetCell();if(!t.enclosed&&r&&a[r.id]&&o&&a[o.id])return;n.push(e),i[e.id]=!0}})};e.forEach(e=>{e.isEdge()||(s&&c(e,!0),o&&c(e,!1))})}return n}isBoundary(e,t){let n=typeof e==`string`?this.getCell(e):e,r=t?this.getIncomingEdges(n):this.getOutgoingEdges(n);return r==null||r.length===0}getBoundaryNodes(e){let t=[];return Object.keys(this.nodes).forEach(n=>{if(this.isBoundary(n,e)){let e=this.getCell(n);e&&t.push(e)}}),t}getRoots(){return this.getBoundaryNodes(!0)}getLeafs(){return this.getBoundaryNodes(!1)}isRoot(e){return this.isBoundary(e,!0)}isLeaf(e){return this.isBoundary(e,!1)}getNeighbors(e,t={}){let n=t.incoming,r=t.outgoing;n==null&&r==null&&(n=r=!0);let i=this.getConnectedEdges(e,t).reduce((i,a)=>{let o=a.hasLoop(t),s=a.getSourceCell(),c=a.getTargetCell();return n&&s&&s.isNode()&&!i[s.id]&&(!o&&(s===e||t.deep&&s.isDescendantOf(e))||(i[s.id]=s)),r&&c&&c.isNode()&&!i[c.id]&&(!o&&(c===e||t.deep&&c.isDescendantOf(e))||(i[c.id]=c)),i},{});if(e.isEdge()){if(n){let t=e.getSourceCell();t&&t.isNode()&&!i[t.id]&&(i[t.id]=t)}if(r){let t=e.getTargetCell();t&&t.isNode()&&!i[t.id]&&(i[t.id]=t)}}return Object.keys(i).map(e=>i[e])}isNeighbor(e,t,n={}){let r=n.incoming,i=n.outgoing;return r==null&&i==null&&(r=i=!0),this.getConnectedEdges(e,n).some(e=>{let n=e.getSourceCell(),a=e.getTargetCell();return!!(r&&n&&n.id===t.id||i&&a&&a.id===t.id)})}getSuccessors(e,t={}){let n=[];return this.search(e,(r,i)=>{r!==e&&this.matchDistance(i,t.distance)&&n.push(r)},Object.assign(Object.assign({},t),{outgoing:!0})),n}isSuccessor(e,t,n={}){let r=!1;return this.search(e,(i,a)=>{if(i===t&&i!==e&&this.matchDistance(a,n.distance))return r=!0,!1},Object.assign(Object.assign({},n),{outgoing:!0})),r}getPredecessors(e,t={}){let n=[];return this.search(e,(r,i)=>{r!==e&&this.matchDistance(i,t.distance)&&n.push(r)},Object.assign(Object.assign({},t),{incoming:!0})),n}isPredecessor(e,t,n={}){let r=!1;return this.search(e,(i,a)=>{if(i===t&&i!==e&&this.matchDistance(a,n.distance))return r=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),r}matchDistance(e,t){return t==null?!0:typeof t==`function`?t(e):Array.isArray(t)&&t.includes(e)?!0:e===t}getCommonAncestor(...e){let t=[];return e.forEach(e=>{e&&(Array.isArray(e)?t.push(...e):t.push(e))}),K.getCommonAncestor(...t)}getSubGraph(e,t={}){let n=[],r={},i=[],a=[],o=e=>{r[e.id]||(n.push(e),r[e.id]=e,e.isEdge()&&a.push(e),e.isNode()&&i.push(e))};return e.forEach(e=>{o(e),t.deep&&e.getDescendants({deep:!0}).forEach(e=>o(e))}),a.forEach(e=>{let t=e.getSourceCell(),a=e.getTargetCell();t&&!r[t.id]&&(n.push(t),r[t.id]=t,t.isNode()&&i.push(t)),a&&!r[a.id]&&(n.push(a),r[a.id]=a,a.isNode()&&i.push(a))}),i.forEach(e=>{this.getConnectedEdges(e,t).forEach(e=>{let t=e.getSourceCell(),i=e.getTargetCell();!r[e.id]&&t&&r[t.id]&&i&&r[i.id]&&(n.push(e),r[e.id]=e)})}),n}cloneSubGraph(e,t={}){let n=this.getSubGraph(e,t);return this.cloneCells(n)}cloneCells(e){return K.cloneCells(e)}getNodesFromPoint(e,t){let n=typeof e==`number`?{x:e,y:t||0}:e;return this.getNodes().filter(e=>e.getBBox().containsPoint(n))}getNodesInArea(e,t,n,r,i){let a=typeof e==`number`?new B(e,t,n,r):B.create(e),o=typeof e==`number`?i:t,s=o&&o.strict;return this.getNodes().filter(e=>{let t=e.getBBox();return s?a.containsRect(t):a.isIntersectWithRect(t)})}getEdgesInArea(e,t,n,r,i){let a=typeof e==`number`?new B(e,t,n,r):B.create(e),o=typeof e==`number`?i:t,s=o&&o.strict;return this.getEdges().filter(e=>{let t=e.getBBox();return t.width===0?t.inflate(1,0):t.height===0&&t.inflate(0,1),s?a.containsRect(t):a.isIntersectWithRect(t)})}getNodesUnderNode(e,t={}){let n=e.getBBox();return(t.by==null||t.by===`bbox`?this.getNodesInArea(n):this.getNodesFromPoint(n[t.by])).filter(t=>e.id!==t.id&&!t.isDescendantOf(e))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(e,t={}){return K.getCellsBBox(e,t)}search(e,t,n={}){n.breadthFirst?this.breadthFirstSearch(e,t,n):this.depthFirstSearch(e,t,n)}breadthFirstSearch(e,t,n={}){let r=[],i={},a={};for(r.push(e),a[e.id]=0;r.length>0;){let e=r.shift();e==null||i[e.id]||(i[e.id]=!0,M(t,this,e,a[e.id])!==!1&&this.getNeighbors(e,n).forEach(t=>{a[t.id]=a[e.id]+1,r.push(t)}))}}depthFirstSearch(e,t,n={}){let r=[],i={},a={};for(r.push(e),a[e.id]=0;r.length>0;){let e=r.pop();if(e==null||i[e.id]||(i[e.id]=!0,M(t,this,e,a[e.id])===!1))continue;let o=this.getNeighbors(e,n),s=r.length;o.forEach(t=>{a[t.id]=a[e.id]+1,r.splice(s,0,t)})}}getShortestPath(e,t,n={}){let r={};this.getEdges().forEach(e=>{let t=e.getSourceCellId(),i=e.getTargetCellId();t&&i&&(r[t]||(r[t]=[]),r[i]||(r[i]=[]),r[t].push(i),n.directed||r[i].push(t))});let i=typeof e==`string`?e:e.id,a=Tf.run(r,i,n.weight),o=[],s=typeof t==`string`?t:t.id;for(a[s]&&o.push(s);s=a[s];)o.unshift(s);return o}translate(e,t,n){return this.getCells().filter(e=>!e.hasParent()).forEach(r=>r.translate(e,t,n)),this}resize(e,t,n){return this.resizeCells(e,t,this.getCells(),n)}resizeCells(e,t,n,r={}){let i=this.getCellsBBox(n);if(i){let a=Math.max(e/i.width,0),o=Math.max(t/i.height,0),s=i.getOrigin();n.forEach(e=>e.scale(a,o,s,r))}return this}toJSON(t={}){return e.toJSON(this.getCells(),t)}parseJSON(t){return e.fromJSON(t)}fromJSON(e,t={}){let n=this.parseJSON(e);return this.resetCells(n,t),this}startBatch(e,t={}){return this.batches[e]=(this.batches[e]||0)+1,this.notify(`batch:start`,{name:e,data:t}),this}stopBatch(e,t={}){return this.batches[e]=(this.batches[e]||0)-1,this.notify(`batch:stop`,{name:e,data:t}),this}batchUpdate(e,t,n={}){this.startBatch(e,n);let r=t();return this.stopBatch(e,n),r}hasActiveBatch(e=Object.keys(this.batches)){return(Array.isArray(e)?e:[e]).some(e=>this.batches[e]>0)}dispose(){this.collection.dispose()}};Vv([Hv.dispose()],Hv.prototype,`dispose`,null),(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||typeof r.addNode!=`function`||typeof r.addEdge!=`function`||r.collection==null)}e.isModel=t})(Hv||={}),(function(e){function t(e,t={}){return{cells:e.map(e=>e.toJSON(t))}}e.toJSON=t;function n(e){let t=[];return Array.isArray(e)?t.push(...e):(e.cells&&t.push(...e.cells),e.nodes&&e.nodes.forEach(e=>{e.shape??=`rect`,t.push(e)}),e.edges&&e.edges.forEach(e=>{e.shape??=`edge`,t.push(e)})),t.map(e=>{let t=e.shape;if(t){if(Iv.registry.exist(t))return Iv.create(e);if(Rv.registry.exist(t))return Rv.create(e)}throw Error("The `shape` should be specified when creating a node/edge instance")})}e.fromJSON=n})(Hv||={});var Uv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Wv=class extends Iv{get label(){return this.getLabel()}set label(e){this.setLabel(e)}getLabel(){return this.getAttrByPath(`text/text`)}setLabel(e,t){return e==null?this.removeLabel():this.setAttrByPath(`text/text`,e,t),this}removeLabel(){return this.removeAttrByPath(`text/text`),this}};(function(e){e.bodyAttr={fill:`#ffffff`,stroke:`#333333`,strokeWidth:2},e.labelAttr={fontSize:14,fill:`#000000`,refX:.5,refY:.5,textAnchor:`middle`,textVerticalAnchor:`middle`,fontFamily:`Arial, helvetica, sans-serif`},e.config({attrs:{text:Object.assign({},e.labelAttr)},propHooks(e){let{label:t}=e,n=Uv(e,[`label`]);return t&&Dl(n,`attrs/text/text`,t),n},visible:!0})})(Wv||={});var Gv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function Kv(e,t=`body`){return[{tagName:e,selector:t},{tagName:`text`,selector:`label`}]}function qv(e=`xlink:href`){return t=>{let{imageUrl:n,imageWidth:r,imageHeight:i}=t,a=Gv(t,[`imageUrl`,`imageWidth`,`imageHeight`]);if(n!=null||r!=null||i!=null){let t=()=>{if(a.attrs){let t=a.attrs.image;n!=null&&(t[e]=n),r!=null&&(t.width=r),i!=null&&(t.height=i),a.attrs.image=t}};a.attrs?(a.attrs.image??(a.attrs.image={}),t()):(a.attrs={image:{}},t())}return a}}function Jv(e,t,n={}){let r={constructorName:e,markup:Kv(e,n.selector),attrs:{[e]:Object.assign({},Wv.bodyAttr)}};return(n.parent||Wv).define(Gc(r,t,{shape:e}))}Jv(`rect`,{attrs:{body:{refWidth:`100%`,refHeight:`100%`}}});var Yv=Rv.define({shape:`edge`,markup:[{tagName:`path`,selector:`wrap`,groupSelector:`lines`,attrs:{fill:`none`,cursor:`pointer`,stroke:`transparent`,strokeLinecap:`round`}},{tagName:`path`,selector:`line`,groupSelector:`lines`,attrs:{fill:`none`,pointerEvents:`none`}}],attrs:{lines:{connection:!0,strokeLinejoin:`round`},wrap:{strokeWidth:10},line:{stroke:`#333`,strokeWidth:2,targetMarker:`classic`}}});Jv(`ellipse`,{attrs:{body:{refCx:`50%`,refCy:`50%`,refRx:`50%`,refRy:`50%`}}});var Xv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Zv=class e extends Wv{get points(){return this.getPoints()}set points(e){this.setPoints(e)}getPoints(){return this.getAttrByPath(`body/refPoints`)}setPoints(t,n){return t==null?this.removePoints():this.setAttrByPath(`body/refPoints`,e.pointsToString(t),n),this}removePoints(){return this.removeAttrByPath(`body/refPoints`),this}};(function(e){function t(e){return typeof e==`string`?e:e.map(e=>Array.isArray(e)?e.join(`,`):z.isPointLike(e)?`${e.x}, ${e.y}`:``).join(` `)}e.pointsToString=t,e.config({propHooks(e){let{points:n}=e,r=Xv(e,[`points`]);if(n){let e=t(n);e&&Dl(r,`attrs/body/refPoints`,e)}return r}})})(Zv||={}),Jv(`polygon`,{},{parent:Zv}),Jv(`polyline`,{},{parent:Zv});var Qv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};Wv.define({shape:`path`,markup:[{tagName:`rect`,selector:`bg`},{tagName:`path`,selector:`body`},{tagName:`text`,selector:`label`}],attrs:{bg:{refWidth:`100%`,refHeight:`100%`,fill:`none`,stroke:`none`,pointerEvents:`all`},body:{fill:`none`,stroke:`#000`,strokeWidth:2}},propHooks(e){let{path:t}=e,n=Qv(e,[`path`]);return t&&Dl(n,`attrs/body/refD`,t),n}});var $v=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};Wv.define({shape:`text-block`,markup:[{tagName:`rect`,selector:`body`},ru.SUPPORT_FOREIGNOBJECT?{tagName:`foreignObject`,selector:`foreignObject`,children:[{tagName:`div`,ns:hu.xhtml,selector:`label`,style:{width:`100%`,height:`100%`,position:`static`,backgroundColor:`transparent`,textAlign:`center`,margin:0,padding:`0px 5px`,boxSizing:`border-box`,display:`flex`,alignItems:`center`,justifyContent:`center`}}]}:{tagName:`text`,selector:`label`,attrs:{textAnchor:`middle`}}],attrs:{body:Object.assign(Object.assign({},Wv.bodyAttr),{refWidth:`100%`,refHeight:`100%`}),foreignObject:{refWidth:`100%`,refHeight:`100%`},label:{style:{fontSize:14}}},propHooks(e){let{text:t}=e,n=$v(e,[`text`]);return t&&Dl(n,`attrs/label/text`,t),n},attrHooks:{text:{set(e,{cell:t,view:n,refBBox:r,elem:i,attrs:a}){if(i instanceof HTMLElement)i.textContent=e;else{let o=a.style||{},s={text:e,width:-5,height:`100%`},c=Object.assign({textVerticalAnchor:`middle`},o),l=uh.presets.textWrap;return M(l.set,this,s,{cell:t,view:n,elem:i,refBBox:r,attrs:c}),{fill:o.color||null}}},position(e,{refBBox:t,elem:n}){if(n instanceof SVGElement)return t.getCenter()}}}}),Jv(`image`,{attrs:{image:{refWidth:`100%`,refHeight:`100%`}},propHooks:qv()},{selector:`image`}),Jv(`circle`,{attrs:{body:{refCx:`50%`,refCy:`50%`,refR:`50%`}}});var ey=class e extends cg{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return e.toStringTag}getContainerClassName(){let e=[super.getContainerClassName(),this.prefixClassName(`node`)];return this.can(`nodeMovable`)||e.push(this.prefixClassName(`node-immovable`)),e.join(` `)}updateClassName(e){let t=e.target;if(t.hasAttribute(`magnet`)){let e=this.prefixClassName(`port-unconnectable`);this.can(`magnetConnectable`)?lu(t,e):N(t,e)}else{let e=this.prefixClassName(`node-immovable`);this.can(`nodeMovable`)?this.removeClass(e):this.addClass(e)}}isNodeView(){return!0}confirmUpdate(e,t={}){let n=e;return this.hasAction(n,`ports`)&&(this.removePorts(),this.cleanPortsCache()),this.hasAction(n,`render`)?(this.render(),n=this.removeAction(n,[`render`,`update`,`resize`,`translate`,`rotate`,`ports`,`tools`])):(n=this.handleAction(n,`resize`,()=>this.resize(),`update`),n=this.handleAction(n,`update`,()=>this.update(),dh.useCSSSelector?`ports`:null),n=this.handleAction(n,`translate`,()=>this.translate()),n=this.handleAction(n,`rotate`,()=>this.rotate()),n=this.handleAction(n,`ports`,()=>this.renderPorts()),n=this.handleAction(n,`tools`,()=>{this.getFlag(`tools`)===e?this.renderTools():this.updateTools(t)})),n}update(e){this.cleanCache(),dh.useCSSSelector&&this.removePorts();let t=this.cell,n=t.getSize(),r=t.getAttrs();this.updateAttrs(this.container,r,{attrs:e===r?null:e,rootBBox:new B(0,0,n.width,n.height),selectors:this.selectors}),dh.useCSSSelector&&this.renderPorts()}renderMarkup(){let e=this.cell.markup;if(e){if(typeof e==`string`)throw TypeError(`Not support string markup.`);return this.renderJSONMarkup(e)}throw TypeError(`Invalid node markup.`)}renderJSONMarkup(e){let t=this.parseJSONMarkup(e,this.container);this.selectors=t.selectors,this.container.appendChild(t.fragment)}render(){return this.empty(),this.renderMarkup(),this.resize(),this.updateTransform(),dh.useCSSSelector||this.renderPorts(),this.renderTools(),this}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){let e=this.cell.getPosition();return`translate(${e.x},${e.y})`}getRotationString(){let e=this.cell.getAngle();if(e){let t=this.cell.getSize();return`rotate(${e},${t.width/2},${t.height/2})`}}updateTransform(){let e=this.getTranslationString(),t=this.getRotationString();t&&(e+=` ${t}`),this.container.setAttribute(`transform`,e)}findPortElem(e,t){let n=e?this.portsCache[e]:null;if(!n)return null;let r=n.portContentElement,i=n.portContentSelectors||{};return this.findOne(t,r,i)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(e=>{Du(e.portElement)})}renderPorts(){let e=this.container,t=[];e.childNodes.forEach(e=>{t.push(e)});let n=Ac(this.cell.getParsedPorts(),`zIndex`),r=`auto`;n[r]&&n[r].forEach(n=>{let r=this.getPortElement(n);e.append(r),t.push(r)}),Object.keys(n).forEach(e=>{if(e!==r){let r=parseInt(e,10);this.appendPorts(n[e],r,t)}}),this.updatePorts()}appendPorts(e,t,n){let r=e.map(e=>this.getPortElement(e));n[t]||t<0?ju(n[Math.max(t,0)],r):ku(this.container,r)}getPortElement(e){let t=this.portsCache[e.id];return t?t.portElement:this.createPortElement(e)}createPortElement(e){let t=G.renderMarkup(this.cell.getPortContainerMarkup()),n=t.elem;if(n==null)throw Error(`Invalid port container markup.`);t=G.renderMarkup(this.getPortMarkup(e));let r=t.elem,i=t.selectors;if(r==null)throw Error(`Invalid port markup.`);this.setAttrs({port:e.id,"port-group":e.group},r);let a=`x6-port`;e.group&&(a+=` x6-port-${e.group}`),N(n,a),N(n,`x6-port`),N(r,`x6-port-body`),n.appendChild(r);let o=i,s,c;if(this.existPortLabel(e)){if(t=G.renderMarkup(this.getPortLabelMarkup(e.label)),s=t.elem,c=t.selectors,s==null)throw Error(`Invalid port label markup.`);if(i&&c){for(let e in c)if(i[e]&&e!==this.rootSelector)throw Error(`Selectors within port must be unique.`);o=Object.assign(Object.assign({},i),c)}N(s,`x6-port-label`),n.appendChild(s)}return this.portsCache[e.id]={portElement:n,portSelectors:o,portLabelElement:s,portLabelSelectors:c,portContentElement:r,portContentSelectors:i},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:e,node:this.cell,container:n,selectors:o,labelContainer:s,labelSelectors:c,contentContainer:r,contentSelectors:i}),n}updatePorts(){let e=this.cell.getParsedGroups(),t=Object.keys(e);t.length===0?this.updatePortGroup():t.forEach(e=>this.updatePortGroup(e))}updatePortGroup(e){let t=B.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(e,t);for(let e=0,t=n.length;e<t;e+=1){let t=n[e],r=t.portId,i=this.portsCache[r]||{},a=t.portLayout;if(this.applyPortTransform(i.portElement,a),t.portAttrs!=null){let e={selectors:i.portSelectors||{}};t.portSize&&(e.rootBBox=B.fromSize(t.portSize)),this.updateAttrs(i.portElement,t.portAttrs,e)}let o=t.labelLayout;if(o&&i.portLabelElement&&(this.applyPortTransform(i.portLabelElement,o,-(a.angle||0)),o.attrs)){let e={selectors:i.portLabelSelectors||{}};t.labelSize&&(e.rootBBox=B.fromSize(t.labelSize)),this.updateAttrs(i.portLabelElement,o.attrs,e)}}}applyPortTransform(e,t,n=0){let r=t.angle,i=t.position;Qd(e,Hd().rotate(n).translate(i.x||0,i.y||0).rotate(r||0),{absolute:!0})}getPortMarkup(e){return e.markup||this.cell.portMarkup}getPortLabelMarkup(e){return e.markup||this.cell.portLabelMarkup}existPortLabel(e){return e.attrs&&e.attrs.text}getEventArgs(e,t,n){let r=this,i=r.cell,a=i;return t==null||n==null?{e,view:r,node:i,cell:a}:{e,x:t,y:n,view:r,node:i,cell:a}}getPortEventArgs(e,t,n){let r=this,i=r.cell,a=i;return n?{e,x:n.x,y:n.y,view:r,node:i,cell:a,port:t}:{e,view:r,node:i,cell:a,port:t}}notifyMouseDown(e,t,n){super.onMouseDown(e,t,n),this.notify(`node:mousedown`,this.getEventArgs(e,t,n))}notifyMouseMove(e,t,n){super.onMouseMove(e,t,n),this.notify(`node:mousemove`,this.getEventArgs(e,t,n))}notifyMouseUp(e,t,n){super.onMouseUp(e,t,n),this.notify(`node:mouseup`,this.getEventArgs(e,t,n))}notifyPortEvent(e,t,n){let r=this.findAttr(`port`,t.target);if(r){let i=t.type;e===`node:port:mouseenter`?t.type=`mouseenter`:e===`node:port:mouseleave`&&(t.type=`mouseleave`),this.notify(e,this.getPortEventArgs(t,r,n)),t.type=i}}onClick(e,t,n){super.onClick(e,t,n),this.notify(`node:click`,this.getEventArgs(e,t,n)),this.notifyPortEvent(`node:port:click`,e,{x:t,y:n})}onDblClick(e,t,n){super.onDblClick(e,t,n),this.notify(`node:dblclick`,this.getEventArgs(e,t,n)),this.notifyPortEvent(`node:port:dblclick`,e,{x:t,y:n})}onContextMenu(e,t,n){super.onContextMenu(e,t,n),this.notify(`node:contextmenu`,this.getEventArgs(e,t,n)),this.notifyPortEvent(`node:port:contextmenu`,e,{x:t,y:n})}onMouseDown(e,t,n){this.isPropagationStopped(e)||(this.notifyMouseDown(e,t,n),this.notifyPortEvent(`node:port:mousedown`,e,{x:t,y:n}),this.startNodeDragging(e,t,n))}onMouseMove(e,t,n){let r=this.getEventData(e),i=r.action;if(i===`magnet`)this.dragMagnet(e,t,n);else{if(i===`move`){let i=r.targetView||this;i.dragNode(e,t,n),i.notify(`node:moving`,{e,x:t,y:n,view:i,cell:i.cell,node:i.cell})}this.notifyMouseMove(e,t,n),this.notifyPortEvent(`node:port:mousemove`,e,{x:t,y:n})}this.setEventData(e,r)}onMouseUp(e,t,n){let r=this.getEventData(e),i=r.action;i===`magnet`?this.stopMagnetDragging(e,t,n):(this.notifyMouseUp(e,t,n),this.notifyPortEvent(`node:port:mouseup`,e,{x:t,y:n}),i===`move`&&(r.targetView||this).stopNodeDragging(e,t,n));let a=r.targetMagnet;a&&this.onMagnetClick(e,a,t,n),this.checkMouseleave(e)}onMouseOver(e){super.onMouseOver(e),this.notify(`node:mouseover`,this.getEventArgs(e)),this.notifyPortEvent(`node:port:mouseenter`,e),this.notifyPortEvent(`node:port:mouseover`,e)}onMouseOut(e){super.onMouseOut(e),this.notify(`node:mouseout`,this.getEventArgs(e)),this.notifyPortEvent(`node:port:mouseleave`,e),this.notifyPortEvent(`node:port:mouseout`,e)}onMouseEnter(e){this.updateClassName(e),super.onMouseEnter(e),this.notify(`node:mouseenter`,this.getEventArgs(e))}onMouseLeave(e){super.onMouseLeave(e),this.notify(`node:mouseleave`,this.getEventArgs(e))}onMouseWheel(e,t,n,r){super.onMouseWheel(e,t,n,r),this.notify(`node:mousewheel`,Object.assign({delta:r},this.getEventArgs(e,t,n)))}onMagnetClick(e,t,n,r){let i=this.graph;i.view.getMouseMovedCount(e)>i.options.clickThreshold||this.notify(`node:magnet:click`,Object.assign({magnet:t},this.getEventArgs(e,n,r)))}onMagnetDblClick(e,t,n,r){this.notify(`node:magnet:dblclick`,Object.assign({magnet:t},this.getEventArgs(e,n,r)))}onMagnetContextMenu(e,t,n,r){this.notify(`node:magnet:contextmenu`,Object.assign({magnet:t},this.getEventArgs(e,n,r)))}onMagnetMouseDown(e,t,n,r){this.startMagnetDragging(e,n,r)}onCustomEvent(e,t,n,r){this.notify(`node:customevent`,Object.assign({name:t},this.getEventArgs(e,n,r))),super.onCustomEvent(e,t,n,r)}prepareEmbedding(e){let t=this.graph,n=this.getEventData(e).cell||this.cell,r=t.findViewByCell(n),i=t.snapToGrid(e.clientX,e.clientY);this.notify(`node:embed`,{e,node:n,view:r,cell:n,x:i.x,y:i.y,currentParent:n.getParent()})}processEmbedding(e,t){let n=t.cell||this.cell,r=t.graph||this.graph,i=r.options.embedding,a=i.findParent,o=typeof a==`function`?M(a,r,{view:this,node:this.cell}).filter(e=>K.isCell(e)&&this.cell.id!==e.id&&!e.isDescendantOf(this.cell)):r.model.getNodesUnderNode(n,{by:a});if(i.frontOnly&&o.length>0){let e=Ac(o,`zIndex`),t=Wc(Object.keys(e).map(e=>parseInt(e,10)));t&&(o=e[t])}o=o.filter(e=>e.visible);let s=null,c=t.candidateEmbedView,l=i.validate;for(let e=o.length-1;e>=0;--e){let t=o[e];if(c&&c.cell.id===t.id){s=c;break}{let e=t.findView(r);if(l&&M(l,r,{child:this.cell,parent:e.cell,childView:this,parentView:e})){s=e;break}}}this.clearEmbedding(t),s&&s.highlight(null,{type:`embedding`}),t.candidateEmbedView=s;let u=r.snapToGrid(e.clientX,e.clientY);this.notify(`node:embedding`,{e,cell:n,node:n,view:r.findViewByCell(n),x:u.x,y:u.y,currentParent:n.getParent(),candidateParent:s?s.cell:null})}clearEmbedding(e){let t=e.candidateEmbedView;t&&(t.unhighlight(null,{type:`embedding`}),e.candidateEmbedView=null)}finalizeEmbedding(e,t){this.graph.startBatch(`embedding`);let n=t.cell||this.cell,r=t.graph||this.graph,i=r.findViewByCell(n),a=n.getParent(),o=t.candidateEmbedView;if(o?(o.unhighlight(null,{type:`embedding`}),t.candidateEmbedView=null,(a==null||a.id!==o.cell.id)&&o.cell.insertChild(n,void 0,{ui:!0})):a&&a.unembed(n,{ui:!0}),r.model.getConnectedEdges(n,{deep:!0}).forEach(e=>{e.updateParent({ui:!0})}),i&&o){let t=r.snapToGrid(e.clientX,e.clientY);i.notify(`node:embedded`,{e,cell:n,x:t.x,y:t.y,node:n,view:r.findViewByCell(n),previousParent:a,currentParent:n.getParent()})}this.graph.stopBatch(`embedding`)}getDelegatedView(){let e=this.cell,t=this;for(;t&&!e.isEdge();){if(!e.hasParent()||t.can(`stopDelegateOnDragging`))return t;e=e.getParent(),t=this.graph.findViewByCell(e)}return null}validateMagnet(e,t,n){if(t.getAttribute(`magnet`)!==`passive`){let r=this.graph.options.connecting.validateMagnet;return!r||M(r,this.graph,{e:n,magnet:t,view:e,cell:e.cell})}return!1}startMagnetDragging(e,t,n){if(!this.can(`magnetConnectable`))return;e.stopPropagation();let r=e.currentTarget,i=this.graph;this.setEventData(e,{targetMagnet:r}),this.validateMagnet(this,r,e)?(i.options.magnetThreshold<=0&&this.startConnectting(e,r,t,n),this.setEventData(e,{action:`magnet`}),this.stopPropagation(e)):this.onMouseDown(e,t,n),i.view.delegateDragEvents(e,this)}startConnectting(e,t,n,r){this.graph.model.startBatch(`add-edge`);let i=this.createEdgeFromMagnet(t,n,r);i.setEventData(e,i.prepareArrowheadDragging(`target`,{x:n,y:r,isNewEdge:!0,fallbackAction:`remove`})),this.setEventData(e,{edgeView:i}),i.notifyMouseDown(e,n,r)}getDefaultEdge(e,t){let n,r=this.graph.options.connecting.createEdge;return r&&(n=M(r,this.graph,{sourceMagnet:t,sourceView:e,sourceCell:e.cell})),n}createEdgeFromMagnet(e,t,n){let r=this.graph,i=r.model,a=this.getDefaultEdge(this,e);return a.setSource(Object.assign(Object.assign({},a.getSource()),this.getEdgeTerminal(e,t,n,a,`source`))),a.setTarget(Object.assign(Object.assign({},a.getTarget()),{x:t,y:n})),a.addTo(i,{async:!1,ui:!0}),a.findView(r)}dragMagnet(e,t,n){let r=this.getEventData(e),i=r.edgeView;if(i)i.onMouseMove(e,t,n),this.autoScrollGraph(e.clientX,e.clientY);else{let i=this.graph,a=i.options.magnetThreshold,o=this.getEventTarget(e),s=r.targetMagnet;if(a===`onleave`){if(s===o||s.contains(o))return}else if(i.view.getMouseMovedCount(e)<=a)return;this.startConnectting(e,s,t,n)}}stopMagnetDragging(e,t,n){let r=this.eventData(e).edgeView;r&&(r.onMouseUp(e,t,n),this.graph.model.stopBatch(`add-edge`))}notifyUnhandledMouseDown(e,t,n){this.notify(`node:unhandled:mousedown`,{e,x:t,y:n,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(e,t,n,r,i){let a=[i],o=this.graph.getPlugin(`selection`);if(o&&o.isSelectionMovable()){let e=o.getSelectedCells();e.includes(i)&&(a=e.filter(e=>e.isNode()))}a.forEach(i=>{this.notify(e,{e:t,x:n,y:r,cell:i,node:i,view:i.findView(this.graph)})})}getRestrictArea(e){let t=this.graph.options.translating.restrict,n=typeof t==`function`?M(t,this.graph,e):t;return typeof n==`number`?this.graph.transform.getGraphArea().inflate(n):n===!0?this.graph.transform.getGraphArea():n||null}startNodeDragging(e,t,n){let r=this.getDelegatedView();if(r==null||!r.can(`nodeMovable`))return this.notifyUnhandledMouseDown(e,t,n);this.setEventData(e,{targetView:r,action:`move`});let i=z.create(r.cell.getPosition());r.setEventData(e,{moving:!1,offset:i.diff(t,n),restrict:this.getRestrictArea(r)})}dragNode(e,t,n){let r=this.cell,i=this.graph,a=i.getGridSize(),o=this.getEventData(e),s=o.offset,c=o.restrict;o.moving||(o.moving=!0,this.addClass(`node-moving`),this.notifyNodeMove(`node:move`,e,t,n,this.cell)),this.autoScrollGraph(e.clientX,e.clientY);let l=R.snapToGrid(t+s.x,a),u=R.snapToGrid(n+s.y,a);r.setPosition(l,u,{restrict:c,deep:!0,ui:!0}),i.options.embedding.enabled&&(o.embedding||=(this.prepareEmbedding(e),!0),this.processEmbedding(e,o))}autoOffsetNode(){let e=this.cell,t=this.graph,n=Object.assign({id:e.id},e.getPosition()),r=t.getNodes().map(e=>{let t=e.getPosition();return{id:e.id,x:t.x,y:t.y}}).filter(e=>e.id!==n.id),i=[[1,1],[1,-1],[-1,1],[-1,-1]],a=t.getGridSize(),o=e=>r.some(t=>t.x===e.x&&t.y===e.y);for(;o(n);){let r=!1;for(let t=0;t<i.length;t+=1){let s=i[t];if(!o({x:n.x+s[0]*a,y:n.y+s[1]*a})){e.translate(s[0]*a,s[1]*a),r=!0;break}}if(r)break;a+=t.getGridSize()}}stopNodeDragging(e,t,n){let r=this.getEventData(e),i=this.graph;r.embedding&&this.finalizeEmbedding(e,r),r.moving&&(i.options.translating.autoOffset&&this.autoOffsetNode(),this.removeClass(`node-moving`),this.notifyNodeMove(`node:moved`,e,t,n,this.cell)),r.moving=!1,r.embedding=!1}autoScrollGraph(e,t){let n=this.graph.getPlugin(`scroller`);n&&n.autoScroll(e,t)}};(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||typeof r.isNodeView!=`function`||typeof r.isEdgeView!=`function`||typeof r.confirmUpdate!=`function`||typeof r.update!=`function`||typeof r.findPortElem!=`function`||typeof r.resize!=`function`||typeof r.rotate!=`function`||typeof r.translate!=`function`)}e.isNodeView=t})(ey||={}),ey.config({isSvgElement:!0,priority:0,bootstrap:[`render`],actions:{view:[`render`],markup:[`render`],attrs:[`update`],size:[`resize`,`ports`,`tools`],angle:[`rotate`,`tools`],position:[`translate`,`tools`],ports:[`ports`],tools:[`tools`]}}),ey.registry.register(`node`,ey,!0);var ty=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},ny=class e extends cg{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return e.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName(`edge`)].join(` `)}get sourceBBox(){let e=this.sourceView;if(!e){let e=this.cell.getSource();return new B(e.x,e.y)}let t=this.sourceMagnet;return e.isEdgeElement(t)?new B(this.sourceAnchor.x,this.sourceAnchor.y):e.getBBoxOfElement(t||e.container)}get targetBBox(){let e=this.targetView;if(!e){let e=this.cell.getTarget();return new B(e.x,e.y)}let t=this.targetMagnet;return e.isEdgeElement(t)?new B(this.targetAnchor.x,this.targetAnchor.y):e.getBBoxOfElement(t||e.container)}isEdgeView(){return!0}confirmUpdate(e,t={}){let n=e;if(this.hasAction(n,`source`)){if(!this.updateTerminalProperties(`source`))return n;n=this.removeAction(n,`source`)}if(this.hasAction(n,`target`)){if(!this.updateTerminalProperties(`target`))return n;n=this.removeAction(n,`target`)}return this.hasAction(n,`render`)?(this.render(),n=this.removeAction(n,[`render`,`update`,`labels`,`tools`]),n):(n=this.handleAction(n,`update`,()=>this.update(t)),n=this.handleAction(n,`labels`,()=>this.onLabelsChange(t)),n=this.handleAction(n,`tools`,()=>this.renderTools()),n)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this}renderMarkup(){let e=this.cell.markup;if(e){if(typeof e==`string`)throw TypeError(`Not support string markup.`);return this.renderJSONMarkup(e)}throw TypeError(`Invalid edge markup.`)}renderJSONMarkup(e){let t=this.parseJSONMarkup(e,this.container);this.selectors=t.selectors,this.container.append(t.fragment)}customizeLabels(){if(this.labelContainer){let e=this.cell,t=e.labels;for(let n=0,r=t.length;n<r;n+=1){let r=t[n],i=this.labelCache[n],a=this.labelSelectors[n],o=this.graph.options.onEdgeLabelRendered;if(o){let t=o({edge:e,label:r,container:i,selectors:a});t&&(this.labelDestroyFn[n]=t)}}}}destroyCustomizeLabels(){let e=this.cell.labels;if(this.labelCache&&this.labelSelectors&&this.labelDestroyFn)for(let t=0,n=e.length;t<n;t+=1){let n=this.labelDestroyFn[t],r=this.labelCache[t],i=this.labelSelectors[t];n&&r&&i&&n({edge:this.cell,label:e[t],container:r,selectors:i})}this.labelDestroyFn={}}renderLabels(){let e=this.cell,t=e.getLabels(),n=t.length,r=this.labelContainer;if(this.labelCache={},this.labelSelectors={},n<=0)return r&&r.parentNode&&r.parentNode.removeChild(r),this;r?this.empty(r):(r=vu(`g`),this.addClass(this.prefixClassName(`edge-labels`),r),this.labelContainer=r);for(let n=0,i=t.length;n<i;n+=1){let i=t[n],a=this.normalizeLabelMarkup(this.parseLabelMarkup(i.markup)),o,s;if(a)o=a.node,s=a.selectors;else{let t=e.getDefaultLabel(),n=this.normalizeLabelMarkup(this.parseLabelMarkup(t.markup));o=n.node,s=n.selectors}o.setAttribute(`data-index`,`${n}`),r.appendChild(o);let c=this.rootSelector;if(s[c])throw Error(`Ambiguous label root selector.`);s[c]=o,this.labelCache[n]=o,this.labelSelectors[n]=s}return r.parentNode??this.container.appendChild(r),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(e={}){this.destroyCustomizeLabels(),this.shouldRerenderLabels(e)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(e={}){let t=this.cell.previous(`labels`);if(t==null)return!0;if(`propertyPathArray`in e&&`propertyValue`in e){let n=e.propertyPathArray||[],r=n.length;if(r>1&&t[n[1]]){if(r===2)return typeof e.propertyValue==`object`&&Pc(e.propertyValue,`markup`);if(n[2]!==`markup`)return!1}}return!0}parseLabelMarkup(e){return e?typeof e==`string`?this.parseLabelStringMarkup(e):this.parseJSONMarkup(e):null}parseLabelStringMarkup(e){let t=F.createVectors(e),n=document.createDocumentFragment();for(let e=0,r=t.length;e<r;e+=1){let r=t[e].node;n.appendChild(r)}return{fragment:n,selectors:{}}}normalizeLabelMarkup(e){if(e==null)return;let t=e.fragment;if(!(t instanceof DocumentFragment)||!t.hasChildNodes())throw Error(`Invalid label markup.`);let n,r=t.childNodes;return n=r.length>1||r[0].nodeName.toUpperCase()!==`G`?F.create(`g`).append(t):F.create(r[0]),n.addClass(this.prefixClassName(`edge-label`)),{node:n.node,selectors:e.selectors}}updateLabels(){if(this.labelContainer){let e=this.cell,t=e.labels,n=this.can(`edgeLabelMovable`),r=e.getDefaultLabel();for(let e=0,i=t.length;e<i;e+=1){let i=this.labelCache[e],a=this.labelSelectors[e];i.setAttribute(`cursor`,n?`move`:`default`);let o=t[e],s=Gc({},r.attrs,o.attrs);this.updateAttrs(i,s,{selectors:a,rootBBox:o.size?B.fromSize(o.size):void 0})}}}renderTools(){let e=this.cell.getTools();return this.addTools(e),this}update(e={}){this.cleanCache(),this.updateConnection(e);let t=this.cell.getAttrs(),{text:n}=t,r=ty(t,[`text`]);return r!=null&&this.updateAttrs(this.container,r,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(e),this}removeRedundantLinearVertices(e={}){let t=this.cell,n=t.getVertices(),r=[this.sourceAnchor,...n,this.targetAnchor],i=r.length,a=new Uf(r);a.simplify({threshold:.01});let o=a.points.map(e=>e.toJSON()),s=o.length;return i===s?0:(t.setVertices(o.slice(1,s-1),e),i-s)}getTerminalView(e){switch(e){case`source`:return this.sourceView||null;case`target`:return this.targetView||null;default:throw Error(`Unknown terminal type '${e}'`)}}getTerminalAnchor(e){switch(e){case`source`:return z.create(this.sourceAnchor);case`target`:return z.create(this.targetAnchor);default:throw Error(`Unknown terminal type '${e}'`)}}getTerminalConnectionPoint(e){switch(e){case`source`:return z.create(this.sourcePoint);case`target`:return z.create(this.targetPoint);default:throw Error(`Unknown terminal type '${e}'`)}}getTerminalMagnet(e,t={}){switch(e){case`source`:{if(t.raw)return this.sourceMagnet;let e=this.sourceView;return e?this.sourceMagnet||e.container:null}case`target`:{if(t.raw)return this.targetMagnet;let e=this.targetView;return e?this.targetMagnet||e.container:null}default:throw Error(`Unknown terminal type '${e}'`)}}updateConnection(e={}){let t=this.cell;if(e.translateBy&&t.isFragmentDescendantOf(e.translateBy)){let t=e.tx||0,n=e.ty||0;this.routePoints=new Uf(this.routePoints).translate(t,n).points,this.translateConnectionPoints(t,n),this.path.translate(t,n)}else{let e=t.getVertices(),n=this.findAnchors(e);this.sourceAnchor=n.source,this.targetAnchor=n.target,this.routePoints=this.findRoutePoints(e);let r=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=r.source,this.targetPoint=r.target;let i=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,i.source||this.sourcePoint,i.target||this.targetPoint)}this.cleanCache()}findAnchors(e){let t=this.cell,n=t.source,r=t.target,i=e[0],a=e[e.length-1];return r.priority&&!n.priority?this.findAnchorsOrdered(`target`,a,`source`,i):this.findAnchorsOrdered(`source`,i,`target`,a)}findAnchorsOrdered(e,t,n,r){let i,a,o=this.cell,s=o[e],c=o[n],l=this.getTerminalView(e),u=this.getTerminalView(n),d=this.getTerminalMagnet(e),f=this.getTerminalMagnet(n);if(l){let n;n=t?z.create(t):u?f:z.create(c),i=this.getAnchor(s.anchor,l,d,n,e)}else i=z.create(s);if(u){let e=z.create(r||i);a=this.getAnchor(c.anchor,u,f,e,n)}else a=z.isPointLike(c)?z.create(c):new z;return{[e]:i,[n]:a}}getAnchor(e,t,n,r,i){let a=t.isEdgeElement(n),o=this.graph.options.connecting,s=typeof e==`string`?{name:e}:e;if(!s){let e=a?(i===`source`?o.sourceEdgeAnchor:o.targetEdgeAnchor)||o.edgeAnchor:(i===`source`?o.sourceAnchor:o.targetAnchor)||o.anchor;s=typeof e==`string`?{name:e}:e}if(!s)throw Error(`Anchor should be specified.`);let c,l=s.name;if(a){let e=o_.registry.get(l);if(typeof e!=`function`)return o_.registry.onNotFound(l);c=M(e,this,t,n,r,s.args||{},i)}else{let e=$g.registry.get(l);if(typeof e!=`function`)return $g.registry.onNotFound(l);c=M(e,this,t,n,r,s.args||{},i)}return c?c.round(this.POINT_ROUNDING):new z}findRoutePoints(e=[]){let t=this.graph.options.connecting.router||cv.presets.normal,n=this.cell.getRouter()||t,r;if(typeof n==`function`)r=M(n,this,e,{},this);else{let t=typeof n==`string`?n:n.name,i=typeof n==`string`?{}:n.args||{},a=t?cv.registry.get(t):cv.presets.normal;if(typeof a!=`function`)return cv.registry.onNotFound(t);r=M(a,this,e,i,this)}return r==null?e.map(e=>z.create(e)):r.map(e=>z.create(e))}findConnectionPoints(e,t,n){let r=this.cell,i=this.graph.options.connecting,a=r.getSource(),o=r.getTarget(),s=this.sourceView,c=this.targetView,l=e[0],u=e[e.length-1],d;if(s&&!s.isEdgeElement(this.sourceMagnet)){let e=this.sourceMagnet||s.container,r=new V(l||n,t),o=a.connectionPoint||i.sourceConnectionPoint||i.connectionPoint;d=this.getConnectionPoint(o,s,e,r,`source`)}else d=t;let f;if(c&&!c.isEdgeElement(this.targetMagnet)){let e=this.targetMagnet||c.container,r=o.connectionPoint||i.targetConnectionPoint||i.connectionPoint,a=new V(u||t,n);f=this.getConnectionPoint(r,c,e,a,`target`)}else f=n;return{source:d,target:f}}getConnectionPoint(e,t,n,r,i){let a=r.end;if(e==null)return a;let o=typeof e==`string`?e:e.name,s=typeof e==`string`?{}:e.args,c=g_.registry.get(o);if(typeof c!=`function`)return g_.registry.onNotFound(o);let l=M(c,this,r,t,n,s||{},i);return l?l.round(this.POINT_ROUNDING):a}findMarkerPoints(e,t,n){let r=e=>{let t=this.cell.getAttrs(),n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=t[n[r]];if(i[`${e}Marker`]||i[`${e}-marker`]){let e=i.strokeWidth||i[`stroke-width`];if(e)return parseFloat(e);break}}return null},i=e[0],a=e[e.length-1],o,s,c=r(`source`);c&&(o=t.clone().move(i||n,-c));let l=r(`target`);return l&&(s=n.clone().move(a||t,-l)),this.sourceMarkerPoint=o||t.clone(),this.targetMarkerPoint=s||n.clone(),{source:o,target:s}}findPath(e,t,n){let r=this.cell.getConnector()||this.graph.options.connecting.connector,i,a,o;if(typeof r==`string`?i=r:(i=r.name,a=r.args),i){let e=Dv.registry.get(i);if(typeof e!=`function`)return Dv.registry.onNotFound(i);o=e}else o=Dv.presets.normal;let s=M(o,this,t,n,e,Object.assign(Object.assign({},a),{raw:!0}),this);return typeof s==`string`?H.parse(s):s}translateConnectionPoints(e,t){this.sourcePoint.translate(e,t),this.targetPoint.translate(e,t),this.sourceAnchor.translate(e,t),this.targetAnchor.translate(e,t),this.sourceMarkerPoint.translate(e,t),this.targetMarkerPoint.translate(e,t)}updateLabelPositions(){if(this.labelContainer==null||!this.path)return this;let e=this.cell,t=e.getLabels();if(t.length===0)return this;let n=e.getDefaultLabel(),r=this.normalizeLabelPosition(n.position);for(let e=0,n=t.length;e<n;e+=1){let n=t[e],i=this.labelCache[e];if(!i)continue;let a=Gc({},r,this.normalizeLabelPosition(n.position)),o=this.getLabelTransformationMatrix(a);i.setAttribute(`transform`,Gd(o))}return this}updateTerminalProperties(e){let t=this.cell,n=this.graph,r=t[e],i=r&&r.cell,a=`${e}View`;if(!i)return this[a]=null,this.updateTerminalMagnet(e),!0;let o=n.getCellById(i);if(!o)throw Error(`Edge's ${e} node with id "${i}" not exists`);let s=o.findView(n);return s?(this[a]=s,this.updateTerminalMagnet(e),!0):!1}updateTerminalMagnet(e){let t=`${e}Magnet`,n=this.getTerminalView(e);if(n){let r=n.getMagnetFromEdgeTerminal(this.cell[e]);r===n.container&&(r=null),this[t]=r}else this[t]=null}getLabelPositionAngle(e){let t=this.cell.getLabelAt(e);return t&&t.position&&typeof t.position==`object`&&t.position.angle||0}getLabelPositionArgs(e){let t=this.cell.getLabelAt(e);if(t&&t.position&&typeof t.position==`object`)return t.position.options}getDefaultLabelPositionArgs(){let e=this.cell.getDefaultLabel();if(e&&e.position&&typeof e.position==`object`)return e.position.options}mergeLabelPositionArgs(e,t){return e===null?null:e===void 0?t===null?null:t:Gc({},t,e)}getConnection(){return this.path==null?null:this.path.clone()}getConnectionPathData(){if(this.path==null)return``;let e=this.cache.pathCache;return Pc(e,`data`)||(e.data=this.path.serialize()),e.data||``}getConnectionSubdivisions(){if(this.path==null)return null;let e=this.cache.pathCache;return Pc(e,`segmentSubdivisions`)||(e.segmentSubdivisions=this.path.getSegmentSubdivisions()),e.segmentSubdivisions}getConnectionLength(){if(this.path==null)return 0;let e=this.cache.pathCache;return Pc(e,`length`)||(e.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),e.length}getPointAtLength(e){return this.path==null?null:this.path.pointAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(e){return this.path==null?null:(Rl(e)&&(e=parseFloat(e)/100),this.path.pointAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(e){return this.path==null?null:this.path.tangentAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(e){return this.path==null?null:this.path.tangentAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(e){return this.path==null?null:this.path.closestPoint(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(e){return this.path==null?null:this.path.closestPointLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(e){return this.path==null?null:this.path.closestPointNormalizedLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(e,t,n,r){let i={distance:0},a=0,o;typeof n==`number`?(a=n,o=r):o=n,o!=null&&(i.options=o);let s=o&&o.absoluteOffset,c=!(o&&o.absoluteDistance),l=o&&o.absoluteDistance&&o.reverseDistance,u=this.path,d={segmentSubdivisions:this.getConnectionSubdivisions()},f=new z(e,t),p=u.closestPointT(f,d),m=this.getConnectionLength()||0,h=u.lengthAtT(p,d);c&&(h=m>0?h/m:0),l&&(h=-1*(m-h)||1),i.distance=h;let g;s||(g=u.tangentAtT(p));let _;if(g)_=g.pointOffset(f);else{let e=u.pointAtT(p),t=f.diff(e);_={x:t.x,y:t.y}}return i.offset=_,i.angle=a,i}normalizeLabelPosition(e){return typeof e==`number`?{distance:e}:e}getLabelTransformationMatrix(e){let t=this.normalizeLabelPosition(e),n=t.options||{},r=t.angle||0,i=t.distance,a=i>0&&i<=1,o=0,s={x:0,y:0},c=t.offset;c&&(typeof c==`number`?o=c:(c.x!=null&&(s.x=c.x),c.y!=null&&(s.y=c.y)));let l=s.x!==0||s.y!==0||o===0,u=n.keepGradient,d=n.ensureLegibility,f=this.path,p={segmentSubdivisions:this.getConnectionSubdivisions()},m=a?i*this.getConnectionLength():i,h=f.tangentAtLength(m,p),g,_=r;if(h){if(l)g=h.start,g.translate(s);else{let e=h.clone();e.rotate(-90,h.start),e.setLength(o),g=e.end}u&&(_=h.angle()+r,d&&(_=L.normalize((_+90)%180-90)))}else g=f.start,l&&g.translate(s);return Hd().translate(g.x,g.y).rotate(_)}getVertexIndex(e,t){let n=this.cell.getVertices(),r=this.getClosestPointLength(new z(e,t)),i=0;if(r!=null)for(let e=n.length;i<e;i+=1){let e=n[i],t=this.getClosestPointLength(e);if(t!=null&&r<t)break}return i}getEventArgs(e,t,n){let r=this,i=r.cell,a=i;return t==null||n==null?{e,view:r,edge:i,cell:a}:{e,x:t,y:n,view:r,edge:i,cell:a}}notifyUnhandledMouseDown(e,t,n){this.notify(`edge:unhandled:mousedown`,{e,x:t,y:n,view:this,cell:this.cell,edge:this.cell})}notifyMouseDown(e,t,n){super.onMouseDown(e,t,n),this.notify(`edge:mousedown`,this.getEventArgs(e,t,n))}notifyMouseMove(e,t,n){super.onMouseMove(e,t,n),this.notify(`edge:mousemove`,this.getEventArgs(e,t,n))}notifyMouseUp(e,t,n){super.onMouseUp(e,t,n),this.notify(`edge:mouseup`,this.getEventArgs(e,t,n))}onClick(e,t,n){super.onClick(e,t,n),this.notify(`edge:click`,this.getEventArgs(e,t,n))}onDblClick(e,t,n){super.onDblClick(e,t,n),this.notify(`edge:dblclick`,this.getEventArgs(e,t,n))}onContextMenu(e,t,n){super.onContextMenu(e,t,n),this.notify(`edge:contextmenu`,this.getEventArgs(e,t,n))}onMouseDown(e,t,n){this.notifyMouseDown(e,t,n),this.startEdgeDragging(e,t,n)}onMouseMove(e,t,n){let r=this.getEventData(e);switch(r.action){case`drag-label`:this.dragLabel(e,t,n);break;case`drag-arrowhead`:this.dragArrowhead(e,t,n);break;case`drag-edge`:this.dragEdge(e,t,n)}return this.notifyMouseMove(e,t,n),r}onMouseUp(e,t,n){let r=this.getEventData(e);switch(r.action){case`drag-label`:this.stopLabelDragging(e,t,n);break;case`drag-arrowhead`:this.stopArrowheadDragging(e,t,n);break;case`drag-edge`:this.stopEdgeDragging(e,t,n)}return this.notifyMouseUp(e,t,n),this.checkMouseleave(e),r}onMouseOver(e){super.onMouseOver(e),this.notify(`edge:mouseover`,this.getEventArgs(e))}onMouseOut(e){super.onMouseOut(e),this.notify(`edge:mouseout`,this.getEventArgs(e))}onMouseEnter(e){super.onMouseEnter(e),this.notify(`edge:mouseenter`,this.getEventArgs(e))}onMouseLeave(e){super.onMouseLeave(e),this.notify(`edge:mouseleave`,this.getEventArgs(e))}onMouseWheel(e,t,n,r){super.onMouseWheel(e,t,n,r),this.notify(`edge:mousewheel`,Object.assign({delta:r},this.getEventArgs(e,t,n)))}onCustomEvent(e,t,n,r){if(Tu(e.target,`edge-tool`,this.container)){if(e.stopPropagation(),this.can(`useEdgeTools`)){if(t===`edge:remove`){this.cell.remove({ui:!0});return}this.notify(`edge:customevent`,Object.assign({name:t},this.getEventArgs(e,n,r)))}this.notifyMouseDown(e,n,r)}else this.notify(`edge:customevent`,Object.assign({name:t},this.getEventArgs(e,n,r))),super.onCustomEvent(e,t,n,r)}onLabelMouseDown(e,t,n){this.notifyMouseDown(e,t,n),this.startLabelDragging(e,t,n),this.getEventData(e).stopPropagation&&e.stopPropagation()}startEdgeDragging(e,t,n){this.can(`edgeMovable`)?this.setEventData(e,{x:t,y:n,moving:!1,action:`drag-edge`}):this.notifyUnhandledMouseDown(e,t,n)}dragEdge(e,t,n){let r=this.getEventData(e);r.moving||(r.moving=!0,this.addClass(`edge-moving`),this.notify(`edge:move`,{e,x:t,y:n,view:this,cell:this.cell,edge:this.cell})),this.cell.translate(t-r.x,n-r.y,{ui:!0}),this.setEventData(e,{x:t,y:n}),this.notify(`edge:moving`,{e,x:t,y:n,view:this,cell:this.cell,edge:this.cell})}stopEdgeDragging(e,t,n){let r=this.getEventData(e);r.moving&&(this.removeClass(`edge-moving`),this.notify(`edge:moved`,{e,x:t,y:n,view:this,cell:this.cell,edge:this.cell})),r.moving=!1}prepareArrowheadDragging(e,t){let n=this.getTerminalMagnet(e),r={action:`drag-arrowhead`,x:t.x,y:t.y,isNewEdge:t.isNewEdge===!0,terminalType:e,initialMagnet:n,initialTerminal:Xo(this.cell[e]),fallbackAction:t.fallbackAction||`revert`,getValidateConnectionArgs:this.createValidateConnectionArgs(e),options:t.options};return this.beforeArrowheadDragging(r),r}createValidateConnectionArgs(e){let t=[];t[4]=e,t[5]=this;let n,r=0,i=0;e===`source`?(r=2,n=`target`):(i=2,n=`source`);let a=this.cell[n],o=a.cell;if(o){let e,n=t[r]=this.graph.findViewByCell(o);n&&(e=n.getMagnetFromEdgeTerminal(a),e===n.container&&(e=void 0)),t[r+1]=e}return(e,n)=>(t[i]=e,t[i+1]=e.container===n?void 0:n,t)}beforeArrowheadDragging(e){e.zIndex=this.cell.zIndex,this.cell.toFront();let t=this.container.style;e.pointerEvents=t.pointerEvents,t.pointerEvents=`none`,this.graph.options.connecting.highlight&&this.highlightAvailableMagnets(e)}afterArrowheadDragging(e){e.zIndex!=null&&(this.cell.setZIndex(e.zIndex,{ui:!0}),e.zIndex=null);let t=this.container;t.style.pointerEvents=e.pointerEvents||``,this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(e)}validateConnection(t,n,r,i,a,o,s){let c=this.graph.options.connecting,l=c.allowLoop,u=c.allowNode,d=c.allowEdge,f=c.allowPort,p=c.allowMulti,m=c.validateConnection,h=o?o.cell:null,g=a===`target`?r:t,_=a===`target`?i:n,v=!0,y=e=>{let c=a===`source`?s?s.port:null:h?h.getSourcePortId():null,l=a===`target`?s?s.port:null:h?h.getTargetPortId():null;return M(e,this.graph,{edge:h,edgeView:o,sourceView:t,targetView:r,sourcePort:c,targetPort:l,sourceMagnet:n,targetMagnet:i,sourceCell:t?t.cell:null,targetCell:r?r.cell:null,type:a})};if(l!=null&&(typeof l==`boolean`?!l&&t===r&&(v=!1):v=y(l)),v&&f!=null&&(typeof f==`boolean`?!f&&_&&(v=!1):v=y(f)),v&&d!=null&&(typeof d==`boolean`?!d&&e.isEdgeView(g)&&(v=!1):v=y(d)),v&&u!=null&&_==null&&(typeof u==`boolean`?!u&&ey.isNodeView(g)&&(v=!1):v=y(u)),v&&p!=null&&o){let e=o.cell,t=a===`source`?s:e.getSource(),n=a===`target`?s:e.getTarget(),r=s?this.graph.getCellById(s.cell):null;if(t&&n&&t.cell&&n.cell&&r){if(typeof p==`function`)v=y(p);else{let e=this.graph.model.getConnectedEdges(r,{outgoing:a===`source`,incoming:a===`target`});e.length&&(p===`withPort`?e.some(e=>{let r=e.getSource(),i=e.getTarget();return r&&i&&r.cell===t.cell&&i.cell===n.cell&&r.port!=null&&r.port===t.port&&i.port!=null&&i.port===n.port})&&(v=!1):p||e.some(e=>{let r=e.getSource(),i=e.getTarget();return r&&i&&r.cell===t.cell&&i.cell===n.cell})&&(v=!1))}}}return v&&m!=null&&(v=y(m)),v}allowConnectToBlank(e){let t=this.graph,n=t.options.connecting.allowBlank;if(typeof n!=`function`)return!!n;let r=t.findViewByCell(e),i=e.getSourceCell(),a=e.getTargetCell();return M(n,t,{edge:e,edgeView:r,sourceCell:i,targetCell:a,sourceView:t.findViewByCell(i),targetView:t.findViewByCell(a),sourcePort:e.getSourcePortId(),targetPort:e.getTargetPortId(),sourceMagnet:r.sourceMagnet,targetMagnet:r.targetMagnet})}validateEdge(e,t,n){let r=this.graph;if(!this.allowConnectToBlank(e)){let t=e.getSourceCellId(),n=e.getTargetCellId();if(!(t&&n))return!1}let i=r.options.connecting.validateEdge;return!i||M(i,r,{edge:e,type:t,previous:n})}arrowheadDragging(e,t,n,r){r.x=t,r.y=n,r.currentTarget!==e&&(r.currentMagnet&&r.currentView&&r.currentView.unhighlight(r.currentMagnet,{type:`magnetAdsorbed`}),r.currentView=this.graph.findViewByElem(e),r.currentView?(r.currentMagnet=r.currentView.findMagnet(e),r.currentMagnet&&this.validateConnection(...r.getValidateConnectionArgs(r.currentView,r.currentMagnet),r.currentView.getEdgeTerminal(r.currentMagnet,t,n,this.cell,r.terminalType))?r.currentView.highlight(r.currentMagnet,{type:`magnetAdsorbed`}):r.currentMagnet=null):r.currentMagnet=null),r.currentTarget=e,this.cell.prop(r.terminalType,{x:t,y:n},Object.assign(Object.assign({},r.options),{ui:!0}))}arrowheadDragged(e,t,n){let r=e.currentView,i=e.currentMagnet;if(!i||!r)return;r.unhighlight(i,{type:`magnetAdsorbed`});let a=e.terminalType,o=r.getEdgeTerminal(i,t,n,this.cell,a);this.cell.setTerminal(a,o,{ui:!0})}snapArrowhead(e,t,n){let r=this.graph,{snap:i,allowEdge:a}=r.options.connecting,o=typeof i==`object`&&i.radius||50,s=typeof i==`object`&&i.anchor||`center`,c=r.renderer.findViewsInArea({x:e-o,y:t-o,width:2*o,height:2*o},{nodeOnly:!0});if(a){let n=r.renderer.findEdgeViewsFromPoint({x:e,y:t},o).filter(e=>e!==this);c.push(...n)}let l=n.closestView||null,u=n.closestMagnet||null;n.closestView=null,n.closestMagnet=null;let d,f=2**53-1,p=new z(e,t);c.forEach(r=>{if(r.container.getAttribute(`magnet`)!==`false`){if(r.isNodeView())d=s===`center`?r.cell.getBBox().getCenter().distance(p):r.cell.getBBox().getNearestPointToPoint(p).distance(p);else if(r.isEdgeView()){let e=r.getClosestPoint(p);d=e?e.distance(p):2**53-1}d<o&&d<f&&(u===r.container||this.validateConnection(...n.getValidateConnectionArgs(r,null),r.getEdgeTerminal(r.container,e,t,this.cell,n.terminalType)))&&(f=d,n.closestView=r,n.closestMagnet=r.container)}r.container.querySelectorAll(`[magnet]`).forEach(i=>{if(i.getAttribute(`magnet`)!==`false`){let a=r.getBBoxOfElement(i);d=p.distance(a.getCenter()),d<o&&d<f&&(u===i||this.validateConnection(...n.getValidateConnectionArgs(r,i),r.getEdgeTerminal(i,e,t,this.cell,n.terminalType)))&&(f=d,n.closestView=r,n.closestMagnet=i)}})});let m,h=n.terminalType,g=n.closestView,_=n.closestMagnet,v=u!==_;if(l&&v&&l.unhighlight(u,{type:`magnetAdsorbed`}),g){if(!v)return;g.highlight(_,{type:`magnetAdsorbed`}),m=g.getEdgeTerminal(_,e,t,this.cell,h)}else m={x:e,y:t};this.cell.setTerminal(h,m,{},Object.assign(Object.assign({},n.options),{ui:!0}))}snapArrowheadEnd(e){let t=e.closestView,n=e.closestMagnet;t&&n&&(t.unhighlight(n,{type:`magnetAdsorbed`}),e.currentMagnet=t.findMagnet(n)),e.closestView=null,e.closestMagnet=null}finishEmbedding(e){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(e.zIndex=null)}fallbackConnection(e){switch(e.fallbackAction){case`remove`:this.cell.remove({ui:!0});break;default:this.cell.prop(e.terminalType,e.initialTerminal,{ui:!0})}}notifyConnectionEvent(e,t){let n=e.terminalType,r=e.initialTerminal,i=this.cell[n];if(i&&!Rv.equalTerminals(r,i)){let a=this.graph,o=r,s=o.cell?a.getCellById(o.cell):null,c=o.port,l=s?a.findViewByCell(s):null,u=s||e.isNewEdge?null:z.create(r).toJSON(),d=i,f=d.cell?a.getCellById(d.cell):null,p=d.port,m=f?a.findViewByCell(f):null,h=f?null:z.create(i).toJSON();this.notify(`edge:connected`,{e:t,previousCell:s,previousPort:c,previousView:l,previousPoint:u,currentCell:f,currentView:m,currentPort:p,currentPoint:h,previousMagnet:e.initialMagnet,currentMagnet:e.currentMagnet,edge:this.cell,view:this,type:n,isNew:e.isNewEdge})}}highlightAvailableMagnets(e){let t=this.graph,n=t.model.getCells();e.marked={};for(let r=0,i=n.length;r<i;r+=1){let i=t.findViewByCell(n[r]);if(!i||i.cell.id===this.cell.id)continue;let a=Array.prototype.slice.call(i.container.querySelectorAll(`[magnet]`));i.container.getAttribute(`magnet`)!==`false`&&a.push(i.container);let o=a.filter(t=>this.validateConnection(...e.getValidateConnectionArgs(i,t),i.getEdgeTerminal(t,e.x,e.y,this.cell,e.terminalType)));if(o.length>0){for(let e=0,t=o.length;e<t;e+=1)i.highlight(o[e],{type:`magnetAvailable`});i.highlight(null,{type:`nodeAvailable`}),e.marked[i.cell.id]=o}}}unhighlightAvailableMagnets(e){let t=e.marked||{};Object.keys(t).forEach(e=>{let n=this.graph.findViewByCell(e);n&&(t[e].forEach(e=>{n.unhighlight(e,{type:`magnetAvailable`})}),n.unhighlight(null,{type:`nodeAvailable`}))}),e.marked=null}startArrowheadDragging(e,t,n){if(!this.can(`arrowheadMovable`)){this.notifyUnhandledMouseDown(e,t,n);return}let r=e.target.getAttribute(`data-terminal`),i=this.prepareArrowheadDragging(r,{x:t,y:n});this.setEventData(e,i)}dragArrowhead(e,t,n){let r=this.getEventData(e);this.graph.options.connecting.snap?this.snapArrowhead(t,n,r):this.arrowheadDragging(this.getEventTarget(e),t,n,r)}stopArrowheadDragging(e,t,n){let r=this.graph,i=this.getEventData(e);r.options.connecting.snap?this.snapArrowheadEnd(i):this.arrowheadDragged(i,t,n),this.validateEdge(this.cell,i.terminalType,i.initialTerminal)?(this.finishEmbedding(i),this.notifyConnectionEvent(i,e)):this.fallbackConnection(i),this.afterArrowheadDragging(i)}startLabelDragging(e,t,n){if(this.can(`edgeLabelMovable`)){let t=e.currentTarget,n=parseInt(t.getAttribute(`data-index`),10),r=this.getLabelPositionAngle(n),i=this.getLabelPositionArgs(n),a=this.getDefaultLabelPositionArgs(),o=this.mergeLabelPositionArgs(i,a);this.setEventData(e,{index:n,positionAngle:r,positionArgs:o,stopPropagation:!0,action:`drag-label`})}else this.setEventData(e,{stopPropagation:!0});this.graph.view.delegateDragEvents(e,this)}dragLabel(e,t,n){let r=this.getEventData(e),i=Gc({},this.cell.getLabelAt(r.index),{position:this.getLabelPosition(t,n,r.positionAngle,r.positionArgs)});this.cell.setLabelAt(r.index,i)}stopLabelDragging(e,t,n){}};(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag],r=t;return!(n!=null&&n!==e.toStringTag||typeof r.isNodeView!=`function`||typeof r.isEdgeView!=`function`||typeof r.confirmUpdate!=`function`||typeof r.update!=`function`||typeof r.getConnection!=`function`)}e.isEdgeView=t})(ny||={}),ny.config({isSvgElement:!0,priority:1,bootstrap:[`render`,`source`,`target`],actions:{view:[`render`],markup:[`render`],attrs:[`update`],source:[`source`,`update`],target:[`target`,`update`],router:[`update`],connector:[`update`],labels:[`labels`],defaultLabel:[`labels`],tools:[`tools`],vertices:[`vertices`,`update`]}}),ny.registry.register(`edge`,ny,!0);var ry=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},iy=class e extends W{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(t){super(),this.graph=t;let{selectors:n,fragment:r}=G.parseJSONMarkup(e.markup);this.background=n.background,this.grid=n.grid,this.svg=n.svg,this.defs=n.defs,this.viewport=n.viewport,this.primer=n.primer,this.stage=n.stage,this.decorator=n.decorator,this.overlay=n.overlay,this.container=this.options.container,this.restore=e.snapshoot(this.container),N(this.container,this.prefixClassName(`graph`)),ku(this.container,r),this.delegateEvents()}delegateEvents(){let e=this.constructor;return super.delegateEvents(e.events),this}guard(e,t){return e.type===`mousedown`&&e.button===2||this.options.guard&&this.options.guard(e,t)?!0:e.data&&e.data.guarded!==void 0?e.data.guarded:!(t&&t.cell&&K.isCell(t.cell)||this.svg===e.target||this.container===e.target||this.svg.contains(e.target))}findView(e){return this.graph.findViewByElem(e)}onDblClick(e){this.options.preventDefaultDblClick&&e.preventDefault();let t=this.normalizeEvent(e),n=this.findView(t.target);if(this.guard(t,n))return;let r=this.graph.snapToGrid(t.clientX,t.clientY);n?n.onDblClick(t,r.x,r.y):this.graph.trigger(`blank:dblclick`,{e:t,x:r.x,y:r.y})}onClick(e){if(this.getMouseMovedCount(e)<=this.options.clickThreshold){let t=this.normalizeEvent(e),n=this.findView(t.target);if(this.guard(t,n))return;let r=this.graph.snapToGrid(t.clientX,t.clientY);n?n.onClick(t,r.x,r.y):this.graph.trigger(`blank:click`,{e:t,x:r.x,y:r.y})}}isPreventDefaultContextMenu(e){let t=this.options.preventDefaultContextMenu;return typeof t==`function`&&(t=M(t,this.graph,{view:e})),t}onContextMenu(e){let t=this.normalizeEvent(e),n=this.findView(t.target);if(this.isPreventDefaultContextMenu(n)&&e.preventDefault(),this.guard(t,n))return;let r=this.graph.snapToGrid(t.clientX,t.clientY);n?n.onContextMenu(t,r.x,r.y):this.graph.trigger(`blank:contextmenu`,{e:t,x:r.x,y:r.y})}delegateDragEvents(e,t){e.data??={},this.setEventData(e,{currentView:t||null,mouseMovedCount:0,startPosition:{x:e.clientX,y:e.clientY}});let n=this.constructor;this.delegateDocumentEvents(n.documentEvents,e.data),this.undelegateEvents()}getMouseMovedCount(e){return this.getEventData(e).mouseMovedCount||0}onMouseDown(e){let t=this.normalizeEvent(e),n=this.findView(t.target);if(this.guard(t,n))return;this.options.preventDefaultMouseDown&&e.preventDefault();let r=this.graph.snapToGrid(t.clientX,t.clientY);n?n.onMouseDown(t,r.x,r.y):(this.options.preventDefaultBlankAction&&[`touchstart`].includes(t.type)&&e.preventDefault(),this.graph.trigger(`blank:mousedown`,{e:t,x:r.x,y:r.y})),this.delegateDragEvents(t,n)}onMouseMove(e){let t=this.getEventData(e),n=t.startPosition;if(n&&n.x===e.clientX&&n.y===e.clientY||(t.mouseMovedCount??=0,t.mouseMovedCount+=1,t.mouseMovedCount<=this.options.moveThreshold))return;let r=this.normalizeEvent(e),i=this.graph.snapToGrid(r.clientX,r.clientY),a=t.currentView;a?a.onMouseMove(r,i.x,i.y):this.graph.trigger(`blank:mousemove`,{e:r,x:i.x,y:i.y}),this.setEventData(r,t)}onMouseUp(e){this.undelegateDocumentEvents();let t=this.normalizeEvent(e),n=this.graph.snapToGrid(t.clientX,t.clientY),r=this.getEventData(e).currentView;if(r?r.onMouseUp(t,n.x,n.y):this.graph.trigger(`blank:mouseup`,{e:t,x:n.x,y:n.y}),!e.isPropagationStopped()){let t=new cf(e,{type:`click`,data:e.data});this.onClick(t)}e.stopImmediatePropagation(),this.delegateEvents()}onMouseOver(e){let t=this.normalizeEvent(e),n=this.findView(t.target);if(!this.guard(t,n)){if(n)n.onMouseOver(t);else{if(this.container===t.target)return;this.graph.trigger(`blank:mouseover`,{e:t})}}}onMouseOut(e){let t=this.normalizeEvent(e),n=this.findView(t.target);if(!this.guard(t,n)){if(n)n.onMouseOut(t);else{if(this.container===t.target)return;this.graph.trigger(`blank:mouseout`,{e:t})}}}onMouseEnter(e){let t=this.normalizeEvent(e),n=this.findView(t.target);if(this.guard(t,n))return;let r=this.graph.findViewByElem(t.relatedTarget);if(n){if(r===n)return;n.onMouseEnter(t)}else{if(r)return;this.graph.trigger(`graph:mouseenter`,{e:t})}}onMouseLeave(e){let t=this.normalizeEvent(e),n=this.findView(t.target);if(this.guard(t,n))return;let r=this.graph.findViewByElem(t.relatedTarget);if(n){if(r===n)return;n.onMouseLeave(t)}else{if(r)return;this.graph.trigger(`graph:mouseleave`,{e:t})}}onMouseWheel(e){let t=this.normalizeEvent(e),n=this.findView(t.target);if(this.guard(t,n))return;let r=t.originalEvent,i=this.graph.snapToGrid(r.clientX,r.clientY),a=Math.max(-1,Math.min(1,r.wheelDelta||-r.detail));n?n.onMouseWheel(t,i.x,i.y,a):this.graph.trigger(`blank:mousewheel`,{e:t,delta:a,x:i.x,y:i.y})}onCustomEvent(e){let t=e.currentTarget,n=t.getAttribute(`event`)||t.getAttribute(`data-event`);if(n){let r=this.findView(t);if(r){let t=this.normalizeEvent(e);if(this.guard(t,r))return;let i=this.graph.snapToGrid(t.clientX,t.clientY);r.onCustomEvent(t,n,i.x,i.y)}}}handleMagnetEvent(e,t){let n=e.currentTarget,r=n.getAttribute(`magnet`);if(r&&r.toLowerCase()!==`false`){let r=this.findView(n);if(r){let i=this.normalizeEvent(e);if(this.guard(i,r))return;let a=this.graph.snapToGrid(i.clientX,i.clientY);M(t,this.graph,r,i,n,a.x,a.y)}}}onMagnetMouseDown(e){this.handleMagnetEvent(e,(e,t,n,r,i)=>{e.onMagnetMouseDown(t,n,r,i)})}onMagnetDblClick(e){this.handleMagnetEvent(e,(e,t,n,r,i)=>{e.onMagnetDblClick(t,n,r,i)})}onMagnetContextMenu(e){let t=this.findView(e.target);this.isPreventDefaultContextMenu(t)&&e.preventDefault(),this.handleMagnetEvent(e,(e,t,n,r,i)=>{e.onMagnetContextMenu(t,n,r,i)})}onLabelMouseDown(e){let t=e.currentTarget,n=this.findView(t);if(n){let t=this.normalizeEvent(e);if(this.guard(t,n))return;let r=this.graph.snapToGrid(t.clientX,t.clientY);n.onLabelMouseDown(t,r.x,r.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}};ry([W.dispose()],iy.prototype,`dispose`,null),(function(e){let t=`${dh.prefixCls}-graph`;e.markup=[{ns:hu.xhtml,tagName:`div`,selector:`background`,className:`${t}-background`},{ns:hu.xhtml,tagName:`div`,selector:`grid`,className:`${t}-grid`},{ns:hu.svg,tagName:`svg`,selector:`svg`,className:`${t}-svg`,attrs:{width:`100%`,height:`100%`,"xmlns:xlink":hu.xlink},children:[{tagName:`defs`,selector:`defs`},{tagName:`g`,selector:`viewport`,className:`${t}-svg-viewport`,children:[{tagName:`g`,selector:`primer`,className:`${t}-svg-primer`},{tagName:`g`,selector:`stage`,className:`${t}-svg-stage`},{tagName:`g`,selector:`decorator`,className:`${t}-svg-decorator`},{tagName:`g`,selector:`overlay`,className:`${t}-svg-overlay`}]}]}];function n(e){let t=e.cloneNode();return e.childNodes.forEach(e=>t.appendChild(e)),()=>{for(Ou(e);e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);for(let n=0,r=t.attributes.length;n<r;n+=1){let r=t.attributes[n];e.setAttribute(r.name,r.value)}t.childNodes.forEach(t=>e.appendChild(t))}}e.snapshoot=n})(iy||={}),(function(e){let t=dh.prefixCls;e.events={dblclick:`onDblClick`,contextmenu:`onContextMenu`,touchstart:`onMouseDown`,mousedown:`onMouseDown`,mouseover:`onMouseOver`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,mousewheel:`onMouseWheel`,DOMMouseScroll:`onMouseWheel`,[`mouseenter .${t}-cell`]:`onMouseEnter`,[`mouseleave .${t}-cell`]:`onMouseLeave`,[`mouseenter .${t}-cell-tools`]:`onMouseEnter`,[`mouseleave .${t}-cell-tools`]:`onMouseLeave`,[`mousedown .${t}-cell [event]`]:`onCustomEvent`,[`touchstart .${t}-cell [event]`]:`onCustomEvent`,[`mousedown .${t}-cell [data-event]`]:`onCustomEvent`,[`touchstart .${t}-cell [data-event]`]:`onCustomEvent`,[`dblclick .${t}-cell [magnet]`]:`onMagnetDblClick`,[`contextmenu .${t}-cell [magnet]`]:`onMagnetContextMenu`,[`mousedown .${t}-cell [magnet]`]:`onMagnetMouseDown`,[`touchstart .${t}-cell [magnet]`]:`onMagnetMouseDown`,[`dblclick .${t}-cell [data-magnet]`]:`onMagnetDblClick`,[`contextmenu .${t}-cell [data-magnet]`]:`onMagnetContextMenu`,[`mousedown .${t}-cell [data-magnet]`]:`onMagnetMouseDown`,[`touchstart .${t}-cell [data-magnet]`]:`onMagnetMouseDown`,[`dragstart .${t}-cell image`]:`onImageDragStart`,[`mousedown .${t}-edge .${t}-edge-label`]:`onLabelMouseDown`,[`touchstart .${t}-edge .${t}-edge-label`]:`onLabelMouseDown`},e.documentEvents={mousemove:`onMouseMove`,touchmove:`onMouseMove`,mouseup:`onMouseUp`,touchend:`onMouseUp`,touchcancel:`onMouseUp`}})(iy||={});var ay=`.x6-graph {
87
+ position: relative;
88
+ overflow: hidden;
89
+ outline: none;
90
+ touch-action: none;
91
+ }
92
+ .x6-graph-background,
93
+ .x6-graph-grid,
94
+ .x6-graph-svg {
95
+ position: absolute;
96
+ top: 0;
97
+ right: 0;
98
+ bottom: 0;
99
+ left: 0;
100
+ }
101
+ .x6-graph-background-stage,
102
+ .x6-graph-grid-stage,
103
+ .x6-graph-svg-stage {
104
+ user-select: none;
105
+ }
106
+ .x6-graph.x6-graph-pannable {
107
+ cursor: grab;
108
+ cursor: -moz-grab;
109
+ cursor: -webkit-grab;
110
+ }
111
+ .x6-graph.x6-graph-panning {
112
+ cursor: grabbing;
113
+ cursor: -moz-grabbing;
114
+ cursor: -webkit-grabbing;
115
+ user-select: none;
116
+ }
117
+ .x6-node {
118
+ cursor: move;
119
+ /* stylelint-disable-next-line */
120
+ }
121
+ .x6-node.x6-node-immovable {
122
+ cursor: default;
123
+ }
124
+ .x6-node * {
125
+ -webkit-user-drag: none;
126
+ }
127
+ .x6-node .scalable * {
128
+ vector-effect: non-scaling-stroke;
129
+ }
130
+ .x6-node [magnet='true'] {
131
+ cursor: crosshair;
132
+ transition: opacity 0.3s;
133
+ }
134
+ .x6-node [magnet='true']:hover {
135
+ opacity: 0.7;
136
+ }
137
+ .x6-node foreignObject {
138
+ display: block;
139
+ overflow: visible;
140
+ background-color: transparent;
141
+ }
142
+ .x6-node foreignObject > body {
143
+ position: static;
144
+ width: 100%;
145
+ height: 100%;
146
+ margin: 0;
147
+ padding: 0;
148
+ overflow: visible;
149
+ background-color: transparent;
150
+ }
151
+ .x6-edge .source-marker,
152
+ .x6-edge .target-marker {
153
+ vector-effect: non-scaling-stroke;
154
+ }
155
+ .x6-edge .connection {
156
+ stroke-linejoin: round;
157
+ fill: none;
158
+ }
159
+ .x6-edge .connection-wrap {
160
+ cursor: move;
161
+ opacity: 0;
162
+ fill: none;
163
+ stroke: #000;
164
+ stroke-width: 15;
165
+ stroke-linecap: round;
166
+ stroke-linejoin: round;
167
+ }
168
+ .x6-edge .connection-wrap:hover {
169
+ opacity: 0.4;
170
+ stroke-opacity: 0.4;
171
+ }
172
+ .x6-edge .vertices {
173
+ cursor: move;
174
+ opacity: 0;
175
+ }
176
+ .x6-edge .vertices .vertex {
177
+ fill: #1abc9c;
178
+ }
179
+ .x6-edge .vertices .vertex :hover {
180
+ fill: #34495e;
181
+ stroke: none;
182
+ }
183
+ .x6-edge .vertices .vertex-remove {
184
+ cursor: pointer;
185
+ fill: #fff;
186
+ }
187
+ .x6-edge .vertices .vertex-remove-area {
188
+ cursor: pointer;
189
+ opacity: 0.1;
190
+ }
191
+ .x6-edge .vertices .vertex-group:hover .vertex-remove-area {
192
+ opacity: 1;
193
+ }
194
+ .x6-edge .arrowheads {
195
+ cursor: move;
196
+ opacity: 0;
197
+ }
198
+ .x6-edge .arrowheads .arrowhead {
199
+ fill: #1abc9c;
200
+ }
201
+ .x6-edge .arrowheads .arrowhead :hover {
202
+ fill: #f39c12;
203
+ stroke: none;
204
+ }
205
+ .x6-edge .tools {
206
+ cursor: pointer;
207
+ opacity: 0;
208
+ }
209
+ .x6-edge .tools .tool-options {
210
+ display: none;
211
+ }
212
+ .x6-edge .tools .tool-remove circle {
213
+ fill: #f00;
214
+ }
215
+ .x6-edge .tools .tool-remove path {
216
+ fill: #fff;
217
+ }
218
+ .x6-edge:hover .vertices,
219
+ .x6-edge:hover .arrowheads,
220
+ .x6-edge:hover .tools {
221
+ opacity: 1;
222
+ }
223
+ .x6-highlight-opacity {
224
+ opacity: 0.3;
225
+ }
226
+ .x6-cell-tool-editor {
227
+ position: relative;
228
+ display: inline-block;
229
+ min-height: 1em;
230
+ margin: 0;
231
+ padding: 0;
232
+ line-height: 1;
233
+ white-space: normal;
234
+ text-align: center;
235
+ vertical-align: top;
236
+ overflow-wrap: normal;
237
+ outline: none;
238
+ transform-origin: 0 0;
239
+ -webkit-user-drag: none;
240
+ }
241
+ .x6-edge-tool-editor {
242
+ border: 1px solid #275fc5;
243
+ border-radius: 2px;
244
+ }
245
+ `,oy=class extends r{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(e){super(),this.graph=e,this.init()}init(){}},sy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},cy=class extends oy{init(){dh.autoInsertCSS&&Mf(`core`,ay)}dispose(){Nf(`core`)}};sy([cy.dispose()],cy.prototype,`dispose`,null);var ly=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},uy;(function(e){function t(t){let{grid:n,panning:r,mousewheel:i,embedding:a}=t,o=ly(t,[`grid`,`panning`,`mousewheel`,`embedding`]),s=t.container;if(s!=null)o.width??=s.clientWidth,o.height??=s.clientHeight;else throw Error(`Ensure the container of the graph is specified and valid`);let c=Gc({},e.defaults,o),l={size:10,visible:!1};return c.grid=typeof n==`number`?{size:n,visible:!1}:typeof n==`boolean`?Object.assign(Object.assign({},l),{visible:n}):Object.assign(Object.assign({},l),n),[`panning`,`mousewheel`,`embedding`].forEach(e=>{let n=t[e];typeof n==`boolean`?c[e].enabled=n:c[e]=Object.assign(Object.assign({},c[e]),n)}),c}e.get=t})(uy||={}),(function(e){e.defaults={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!1,eventTypes:[`leftMouseDown`]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:`stroke`,args:{padding:3}},nodeAvailable:{name:`className`,args:{className:dh.prefix(`available-node`)}},magnetAvailable:{name:`className`,args:{className:dh.prefix(`available-magnet`)}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:`center`,edgeAnchor:`ratio`,connectionPoint:`boundary`,router:`normal`,connector:`normal`,validateConnection({type:e,sourceView:t,targetView:n}){return(e===`target`?n:t)!=null},createEdge(){return new Yv}},translating:{restrict:!1},embedding:{enabled:!1,findParent:`bbox`,frontOnly:!0,validate:()=>!0},moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},async:!0,virtual:!1,guard:()=>!1}})(uy||={});var dy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},fy=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},py=class extends oy{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on(`scale`,this.update,this),this.graph.on(`translate`,this.update,this)}stopListening(){this.graph.off(`scale`,this.update,this),this.graph.off(`translate`,this.update,this)}setVisible(e){this.grid.visible!==e&&(this.grid.visible=e,this.update())}getGridSize(){return this.grid.size}setGridSize(e){this.grid.size=Math.max(e,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=``}draw(e){this.clear(),this.instance=null,Object.assign(this.grid,e),this.patterns=this.resolveGrid(e),this.update()}update(e={}){let t=this.grid.size;if(t<=1||!this.grid.visible)return this.clear();let n=this.graph.matrix(),r=this.getInstance(),i=Array.isArray(e)?e:[e];this.patterns.forEach((e,a)=>{let o=`pattern_${a}`,s=n.a||1,c=n.d||1,{update:l,markup:u}=e,d=fy(e,[`update`,`markup`]),f=Object.assign(Object.assign(Object.assign({},d),i[a]),{sx:s,sy:c,ox:n.e||0,oy:n.f||0,width:t*s,height:t*c});r.has(o)||r.add(o,F.create(`pattern`,{id:o,patternUnits:`userSpaceOnUse`},F.createVectors(u)).node);let p=r.get(o);typeof l==`function`&&l(p.childNodes[0],f);let m=f.ox%f.width;m<0&&(m+=f.width);let h=f.oy%f.height;h<0&&(h+=f.height),P(p,{x:m,y:h,width:f.width,height:f.height})});let a=new XMLSerializer().serializeToString(r.root),o=`url(data:image/svg+xml;base64,${btoa(a)})`;this.elem.style.backgroundImage=o}getInstance(){return this.instance||=new lp,this.instance}resolveGrid(e){if(!e)return[];let t=e.type;if(t==null)return[Object.assign(Object.assign({},lp.presets.dot),e.args)];let n=lp.registry.get(t);if(n){let t=e.args||[];return Array.isArray(t)||(t=[t]),Array.isArray(n)?n.map((e,n)=>Object.assign(Object.assign({},e),t[n])):[Object.assign(Object.assign({},n),t[0])]}return lp.registry.onNotFound(t)}dispose(){this.stopListening(),this.clear()}};dy([oy.dispose()],py.prototype,`dispose`,null);var my=class extends oy{get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get stage(){return this.graph.view.stage}init(){this.resize()}getMatrix(){let e=this.viewport.getAttribute(`transform`);return e!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=e),Hd(this.viewportMatrix)}setMatrix(e){let t=Hd(e);t.a=Number.isFinite(t.a)?t.a:1,t.b=Number.isFinite(t.b)?t.b:0,t.c=Number.isFinite(t.c)?t.c:0,t.d=Number.isFinite(t.d)?t.d:1,t.e=Number.isFinite(t.e)?t.e:0,t.f=Number.isFinite(t.f)?t.f:0;let n=Gd(t);this.viewport.setAttribute(`transform`,n),this.viewportMatrix=t,this.viewportTransformString=n}resize(e,t){let n=e===void 0?this.options.width:e,r=t===void 0?this.options.height:t;this.options.width=n,this.options.height=r,typeof n==`number`&&(n=Math.round(n)),typeof r==`number`&&(r=Math.round(r)),this.container.style.width=n==null?``:`${n}px`,this.container.style.height=r==null?``:`${r}px`;let i=this.getComputedSize();return this.graph.trigger(`resize`,Object.assign({},i)),this}getComputedSize(){let e=this.options.width,t=this.options.height;return Vc(e)||(e=this.container.clientWidth),Vc(t)||(t=this.container.clientHeight),{width:e,height:t}}getScale(){return Yd(this.getMatrix())}scale(e,t=e,n=0,r=0){if(e=this.clampScale(e),t=this.clampScale(t),n||r){let i=this.getTranslation(),a=i.tx-n*(e-1),o=i.ty-r*(t-1);(a!==i.tx||o!==i.ty)&&this.translate(a,o)}let i=this.getMatrix(),a=Number.isFinite(e)?e:1,o=Number.isFinite(t)?t:1;return i.a=a,i.d=o,this.setMatrix(i),this.graph.trigger(`scale`,{sx:a,sy:o,ox:n,oy:r}),this}clampScale(e){let t=this.graph.options.scaling;return Wi(e,t.min||.01,t.max||16)}getZoom(){return this.getScale().sx}zoom(e,t){t||={};let n=e,r=e,i=this.getScale(),a=this.getComputedSize(),o=a.width/2,s=a.height/2;if(t.absolute||(n+=i.sx,r+=i.sy),t.scaleGrid&&(n=Math.round(n/t.scaleGrid)*t.scaleGrid,r=Math.round(r/t.scaleGrid)*t.scaleGrid),t.maxScale&&(n=Math.min(t.maxScale,n),r=Math.min(t.maxScale,r)),t.minScale&&(n=Math.max(t.minScale,n),r=Math.max(t.minScale,r)),t.center&&(o=t.center.x,s=t.center.y),n=this.clampScale(n),r=this.clampScale(r),n=Number.isFinite(n)?n:i.sx,r=Number.isFinite(r)?r:i.sy,o||s){let e=this.getTranslation(),t=i.sx===0?1:i.sx,a=i.sy===0?1:i.sy,c=o-(o-e.tx)*(n/t),l=s-(s-e.ty)*(r/a);(c!==e.tx||l!==e.ty)&&this.translate(c,l)}return this.scale(n,r),this}getRotation(){return Xd(this.getMatrix())}rotate(e,t,n){if(t==null||n==null){let e=U.getBBox(this.stage);t=e.width/2,n=e.height/2}let r=this.getMatrix().translate(t,n).rotate(e).translate(-t,-n);return this.setMatrix(r),this}getTranslation(){return Zd(this.getMatrix())}translate(e,t){let n=this.getMatrix();n.e=Number.isFinite(e)?e:0,n.f=Number.isFinite(t)?t:0,this.setMatrix(n);let r=this.getTranslation();return this.options.x=r.tx,this.options.y=r.ty,this.graph.trigger(`translate`,Object.assign({},r)),this}setOrigin(e,t){return this.translate(e||0,t||0)}fitToContent(e,t,n,r){if(typeof e==`object`){let i=e;e=i.gridWidth||1,t=i.gridHeight||1,n=i.padding||0,r=i}else e||=1,t||=1,n||=0,r??={};let i=Bl(n),a=r.border||0,o=r.contentArea?B.create(r.contentArea):this.getContentArea(r);a>0&&o.inflate(a);let s=this.getScale(),c=this.getTranslation(),l=s.sx,u=s.sy;o.x*=l,o.y*=u,o.width*=l,o.height*=u;let d=Math.max(Math.ceil((o.width+o.x)/e),1)*e,f=Math.max(Math.ceil((o.height+o.y)/t),1)*t,p=0,m=0;(r.allowNewOrigin===`negative`&&o.x<0||r.allowNewOrigin===`positive`&&o.x>=0||r.allowNewOrigin===`any`)&&(p=Math.ceil(-o.x/e)*e,p+=i.left,d+=p),(r.allowNewOrigin===`negative`&&o.y<0||r.allowNewOrigin===`positive`&&o.y>=0||r.allowNewOrigin===`any`)&&(m=Math.ceil(-o.y/t)*t,m+=i.top,f+=m),d+=i.right,f+=i.bottom,d=Math.max(d,r.minWidth||0),f=Math.max(f,r.minHeight||0),d=Math.min(d,r.maxWidth||2**53-1),f=Math.min(f,r.maxHeight||2**53-1);let h=this.getComputedSize(),g=d!==h.width||f!==h.height;return(p!==c.tx||m!==c.ty)&&this.translate(p,m),g&&this.resize(d,f),new B(-p/l,-m/u,d/l,f/u)}scaleContentToFit(e={}){this.scaleContentToFitImpl(e)}scaleContentToFitImpl(e={},t=!0){let n,r;if(e.contentArea){let t=e.contentArea;n=this.graph.localToGraph(t),r=z.create(t)}else n=this.getContentBBox(e),r=this.graph.graphToLocal(n);if(!n.width||!n.height)return;let i=Bl(e.padding),a=e.minScale||0,o=e.maxScale||2**53-1,s=e.minScaleX||a,c=e.maxScaleX||o,l=e.minScaleY||a,u=e.maxScaleY||o,d;if(e.viewportArea)d=e.viewportArea;else{let e=this.getComputedSize(),t=this.getTranslation();d={x:t.tx,y:t.ty,width:e.width,height:e.height}}d=B.create(d).moveAndExpand({x:i.left,y:i.top,width:-i.left-i.right,height:-i.top-i.bottom});let f=this.getScale(),p=d.width/n.width*f.sx,m=d.height/n.height*f.sy;e.preserveAspectRatio!==!1&&(p=m=Math.min(p,m));let h=e.scaleGrid;if(h&&(p=h*Math.floor(p/h),m=h*Math.floor(m/h)),p=Wi(p,s,c),m=Wi(m,l,u),this.scale(p,m),t){let e=this.options,t=d.x-r.x*p-e.x,n=d.y-r.y*m-e.y;this.translate(t,n)}}getContentArea(e={}){return e.useCellGeometry===!1?U.getBBox(this.stage):this.model.getAllCellsBBox()||new B}getContentBBox(e={}){return this.graph.localToGraph(this.getContentArea(e))}getGraphArea(){let e=B.fromSize(this.getComputedSize());return this.graph.graphToLocal(e)}zoomToRect(e,t={}){let n=B.create(e),r=this.graph;t.contentArea=n,t.viewportArea??={x:r.options.x,y:r.options.y,width:this.options.width,height:this.options.height},this.scaleContentToFitImpl(t,!1);let i=n.getCenter();return this.centerPoint(i.x,i.y),this}zoomToFit(e={}){return this.zoomToRect(this.getContentArea(e),e)}centerPoint(e,t){let n=this.getComputedSize(),r=this.getScale(),i=this.getTranslation(),a=n.width/2,o=n.height/2;e=typeof e==`number`?e:a,t=typeof t==`number`?t:o,e=a-e*r.sx,t=o-t*r.sy,(i.tx!==e||i.ty!==t)&&this.translate(e,t)}centerContent(e){let t=this.graph.getContentArea(e).getCenter();this.centerPoint(t.x,t.y)}centerCell(e){return this.positionCell(e,`center`)}positionPoint(e,t,n){let r=this.getComputedSize();t=zl(t,Math.max(0,r.width)),t<0&&(t=r.width+t),n=zl(n,Math.max(0,r.height)),n<0&&(n=r.height+n);let i=this.getTranslation(),a=this.getScale(),o=t-e.x*a.sx,s=n-e.y*a.sy;(i.tx!==o||i.ty!==s)&&this.translate(o,s)}positionRect(e,t){let n=B.create(e);switch(t){case`center`:return this.positionPoint(n.getCenter(),`50%`,`50%`);case`top`:return this.positionPoint(n.getTopCenter(),`50%`,0);case`top-right`:return this.positionPoint(n.getTopRight(),`100%`,0);case`right`:return this.positionPoint(n.getRightMiddle(),`100%`,`50%`);case`bottom-right`:return this.positionPoint(n.getBottomRight(),`100%`,`100%`);case`bottom`:return this.positionPoint(n.getBottomCenter(),`50%`,`100%`);case`bottom-left`:return this.positionPoint(n.getBottomLeft(),0,`100%`);case`left`:return this.positionPoint(n.getLeftMiddle(),0,`50%`);case`top-left`:return this.positionPoint(n.getTopLeft(),0,0);default:return this}}positionCell(e,t){let n=e.getBBox();return this.positionRect(n,t)}positionContent(e,t){let n=this.graph.getContentArea(t);return this.positionRect(n,e)}},hy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},gy=class extends oy{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on(`scale`,this.update,this),this.graph.on(`translate`,this.update,this)}stopListening(){this.graph.off(`scale`,this.update,this),this.graph.off(`translate`,this.update,this)}updateBackgroundImage(e={}){let t=e.size||`auto auto`,n=e.position||`center`,r=this.graph.transform.getScale(),i=this.graph.translate();typeof n==`object`&&(n=`${i.tx+r.sx*(n.x||0)}px ${i.ty+r.sy*(n.y||0)}px`),typeof t==`object`&&(t=B.fromSize(t).scale(r.sx,r.sy),t=`${t.width}px ${t.height}px`),this.elem.style.backgroundSize=t,this.elem.style.backgroundPosition=n}drawBackgroundImage(e,t={}){if(!(e instanceof HTMLImageElement)){this.elem.style.backgroundImage=``;return}let n=this.optionsCache;if(n&&n.image!==t.image)return;let r,i=t.opacity,a=t.size,o=t.repeat||`no-repeat`,s=hp.registry.get(o);if(typeof s==`function`){let n=t.quality||1;e.width*=n,e.height*=n;let i=s(e,t);if(!(i instanceof HTMLCanvasElement))throw Error(`Background pattern must return an HTML Canvas instance`);r=i.toDataURL(`image/png`),o=t.repeat&&o!==t.repeat?t.repeat:`repeat`,typeof a==`object`?(a.width*=i.width/e.width,a.height*=i.height/e.height):a===void 0&&(t.size={width:i.width/n,height:i.height/n})}else r=e.src,a===void 0&&(t.size={width:e.width,height:e.height});n!=null&&typeof t.size==`object`&&t.image===n.image&&t.repeat===n.repeat&&t.quality===n.quality&&(n.size=Xo(t.size));let c=this.elem.style;c.backgroundImage=`url(${r})`,c.backgroundRepeat=o,c.opacity=i==null||i>=1?``:`${i}`,this.updateBackgroundImage(t)}updateBackgroundColor(e){this.elem.style.backgroundColor=e||``}updateBackgroundOptions(e){this.graph.options.background=e}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(e){let t=e||{};if(this.updateBackgroundOptions(e),this.updateBackgroundColor(t.color),t.image){this.optionsCache=Xo(t);let n=document.createElement(`img`);n.onload=()=>this.drawBackgroundImage(n,e),n.setAttribute(`crossorigin`,`anonymous`),n.src=t.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}};hy([oy.dispose()],gy.prototype,`dispose`,null);var _y=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},vy=class extends oy{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&this.widgetOptions.enabled===!0}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on(`blank:mousedown`,this.onMouseDown,this),this.graph.on(`node:unhandled:mousedown`,this.onMouseDown,this),this.graph.on(`edge:unhandled:mousedown`,this.onMouseDown,this),ff.on(this.graph.container,`mousedown`,this.onRightMouseDown),ff.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new mf(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()}stopListening(){this.graph.off(`blank:mousedown`,this.onMouseDown,this),this.graph.off(`node:unhandled:mousedown`,this.onMouseDown,this),this.graph.off(`edge:unhandled:mousedown`,this.onMouseDown,this),ff.off(this.graph.container,`mousedown`,this.onRightMouseDown),ff.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(e,t){return e.spaceKey=this.isSpaceKeyPressed,this.pannable&&Of.isMatch(e,this.widgetOptions.modifiers,t)}startPanning(e){let t=this.view.normalizeEvent(e);this.clientX=t.clientX,this.clientY=t.clientY,this.panning=!0,this.updateClassName(e),ff.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),ff.on(window,`mouseup.panning`,this.stopPanning.bind(this))}pan(e){let t=this.view.normalizeEvent(e),n=t.clientX-this.clientX,r=t.clientY-this.clientY;this.clientX=t.clientX,this.clientY=t.clientY,this.graph.translateBy(n,r)}stopPanning(e){this.panning=!1,this.updateClassName(e),ff.off(document.body,`.panning`),ff.off(window,`.panning`)}updateClassName(e){let t=this.widgetOptions.eventTypes;if(t?.length===1&&t.includes(`mouseWheel`))return;let n=this.view.container,r=this.view.prefixClassName(`graph-panning`),i=this.view.prefixClassName(`graph-pannable`),a=this.graph.getPlugin(`selection`),o=a&&a.allowRubberband(e,!0),s=t?.includes(`leftMouseDown`)&&!o;this.allowPanning(e??{},!0)||this.allowPanning(e??{})&&s?this.panning?(N(n,r),lu(n,i)):(lu(n,r),N(n,i)):this.panning||(lu(n,r),lu(n,i))}onMouseDown({e}){if(!this.allowBlankMouseDown(e))return;let t=this.graph.getPlugin(`selection`),n=t&&t.allowRubberband(e,!0);(this.allowPanning(e,!0)||this.allowPanning(e)&&!n)&&this.startPanning(e)}onRightMouseDown(e){this.widgetOptions.eventTypes?.includes(`rightMouseDown`)&&e.button===2&&this.allowPanning(e,!0)&&this.startPanning(e)}onMouseWheel(e,t,n){this.graph.translateBy(-t,-n)}onKeyDown(e){e.which===32&&(this.isSpaceKeyPressed=!0),this.updateClassName(e)}onKeyUp(e){e.which===32&&(this.isSpaceKeyPressed=!1),this.updateClassName(e)}allowBlankMouseDown(e){let t=this.widgetOptions.eventTypes;return t?.includes(`leftMouseDown`)&&e.button===0||t?.includes(`mouseWheelDown`)&&e.button===1}allowMouseWheel(e){return this.pannable&&!e.ctrlKey&&this.widgetOptions.eventTypes?.includes(`mouseWheel`)}autoPanning(e,t){let n=this.graph.getGraphArea(),r=0,i=0;e<=n.left+10&&(r=-10),t<=n.top+10&&(i=-10),e>=n.right-10&&(r=10),t>=n.bottom-10&&(i=10),(r!==0||i!==0)&&this.graph.translateBy(-r,-i)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}};_y([oy.dispose()],vy.prototype,`dispose`,null);var yy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},by=class extends oy{constructor(){super(...arguments),this.cumulatedFactor=1}get widgetOptions(){return this.options.mousewheel}init(){this.container=this.graph.container,this.target=this.widgetOptions.global?document:this.container,this.mousewheelHandle=new mf(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return this.widgetOptions.enabled!==!0}enable(e){(this.disabled||e)&&(this.widgetOptions.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.widgetOptions.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(e){let t=this.widgetOptions.guard;return(t==null||t(e))&&Of.isMatch(e,this.widgetOptions.modifiers)}onMouseWheel(e){let t=this.widgetOptions.guard;if((t==null||t(e))&&Of.isMatch(e,this.widgetOptions.modifiers)){let t=this.widgetOptions.factor||1.2;this.currentScale??=(this.startPos={x:e.clientX,y:e.clientY},this.graph.transform.getScale().sx),e.deltaY<0?(this.cumulatedFactor=this.currentScale<.15?(this.currentScale+.01)/this.currentScale:Math.round(this.currentScale*t*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.cumulatedFactor=this.currentScale<=.15?(this.currentScale-.01)/this.currentScale:Math.round(this.currentScale*(1/t)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);let n=this.currentScale,r=this.graph.transform.clampScale(n*this.cumulatedFactor),i=this.widgetOptions.minScale||-(2**53-1),a=this.widgetOptions.maxScale||2**53-1;if(r=Wi(r,i,a),r!==n){if(this.widgetOptions.zoomAtMousePosition){let e=this.graph.getPlugin(`scroller`)?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(r,{absolute:!0,center:e.clone()})}else this.graph.zoom(r,{absolute:!0})}this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}};yy([r.dispose()],by.prototype,`dispose`,null);var xy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Sy=class extends oy{init(){this.resetRenderArea=sl(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}startListening(){this.graph.on(`translate`,this.resetRenderArea,this),this.graph.on(`scale`,this.resetRenderArea,this),this.graph.on(`resize`,this.resetRenderArea,this)}stopListening(){this.graph.off(`translate`,this.resetRenderArea,this),this.graph.off(`scale`,this.resetRenderArea,this),this.graph.off(`resize`,this.resetRenderArea,this)}enableVirtualRender(){this.options.virtual=!0,this.resetRenderArea()}disableVirtualRender(){this.options.virtual=!1,this.graph.renderer.setRenderArea(void 0)}resetRenderArea(){if(this.options.virtual){let e=this.graph.getGraphArea();this.graph.renderer.setRenderArea(e)}}dispose(){this.stopListening()}};xy([oy.dispose()],Sy.prototype,`dispose`,null);var Cy=class{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(e){if(e.priority&wy.PRIOR)e.cb();else{let t=this.findInsertionIndex(e);t>=0&&this.queue.splice(t,0,e)}}queueFlush(){!this.isFlushing&&!this.isFlushPending&&(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){!this.isFlushing&&!this.isFlushPending&&(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(){this.isFlushPending=!1,this.isFlushing=!0;let e=this.getCurrentTime(),t;for(;(t=this.queue.shift())&&(t.cb(),!(this.getCurrentTime()-e>=this.frameInterval)););this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){this.isFlushPending=!1,this.isFlushing=!0;let e;for(;e=this.queue.shift();)try{e.cb()}catch(e){console.log(e)}this.isFlushing=!1}findInsertionIndex(e){let t=0,n=this.queue.length,r=n-1,i=e.priority;for(;t<=r;){let e=(r-t>>1)+t;i<=this.queue[e].priority?t=e+1:(n=e,r=e-1)}return n}scheduleJob(){`requestIdleCallback`in window?(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.requestIdleCallback(this.flushJobs.bind(this),{timeout:100})):(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.setTimeout(this.flushJobs.bind(this)))}cancelScheduleJob(){`cancelIdleCallback`in window?(this.scheduleId&&window.cancelIdleCallback(this.scheduleId),this.scheduleId=0):(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduleId=0)}getCurrentTime(){return typeof performance==`object`&&typeof performance.now==`function`?performance.now():Date.now()-this.initialTime}},wy;(function(e){e[e.Update=2]=`Update`,e[e.RenderEdge=4]=`RenderEdge`,e[e.RenderNode=8]=`RenderNode`,e[e.PRIOR=1048576]=`PRIOR`})(wy||={});var Ty=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ey=class e extends r{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(e){super(),this.views={},this.willRemoveViews={},this.queue=new Cy,this.graph=e,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on(`reseted`,this.onModelReseted,this),this.model.on(`cell:added`,this.onCellAdded,this),this.model.on(`cell:removed`,this.onCellRemoved,this),this.model.on(`cell:change:zIndex`,this.onCellZIndexChanged,this),this.model.on(`cell:change:visible`,this.onCellVisibleChanged,this)}stopListening(){this.model.off(`reseted`,this.onModelReseted,this),this.model.off(`cell:added`,this.onCellAdded,this),this.model.off(`cell:removed`,this.onCellRemoved,this),this.model.off(`cell:change:zIndex`,this.onCellZIndexChanged,this),this.model.off(`cell:change:visible`,this.onCellVisibleChanged,this)}onModelReseted({options:e}){this.queue.clearJobs(),this.removeZPivots(),this.resetViews();let t=this.model.getCells();this.renderViews(t,Object.assign(Object.assign({},e),{queue:t.map(e=>e.id)}))}onCellAdded({cell:e,options:t}){this.renderViews([e],t)}onCellRemoved({cell:e}){this.removeViews([e])}onCellZIndexChanged({cell:t,options:n}){let r=this.views[t.id];r&&this.requestViewUpdate(r.view,e.FLAG_INSERT,n,wy.Update,!0)}onCellVisibleChanged({cell:e,current:t}){this.toggleVisible(e,!!t)}requestViewUpdate(e,t,n={},r=wy.Update,i=!0){let a=e.cell.id,o=this.views[a];o&&(o.flag=t,o.options=n,(e.hasAction(t,[`translate`,`resize`,`rotate`])||n.async===!1)&&(r=wy.PRIOR,i=!1),this.queue.queueJob({id:a,priority:r,cb:()=>{this.renderViewInArea(e,t,n);let r=n.queue;if(r){let t=r.indexOf(e.cell.id);t>=0&&r.splice(t,1),r.length===0&&this.graph.trigger(`render:done`)}}}),this.getEffectedEdges(e).forEach(e=>{this.requestViewUpdate(e.view,e.flag,n,r,!1)}),i&&this.flush())}setRenderArea(e){this.renderArea=e,this.flushWaitingViews()}isViewMounted(t){if(t==null)return!1;let n=this.views[t.cell.id];return n?n.state===e.ViewState.MOUNTED:!1}renderViews(t,n={}){t.sort((e,t)=>e.isNode()&&t.isEdge()?-1:0),t.forEach(t=>{let r=t.id,i=this.views,a=0,o=i[r];if(o)a=e.FLAG_INSERT;else{let i=this.createCellView(t);i&&(i.graph=this.graph,a=e.FLAG_INSERT|i.getBootstrapFlag(),o={view:i,flag:a,options:n,state:e.ViewState.CREATED},this.views[r]=o)}o&&this.requestViewUpdate(o.view,a,n,this.getRenderPriority(o.view),!1)}),this.flush()}renderViewInArea(t,n,r={}){let i=t.cell,a=i.id,o=this.views[a];if(!o)return;let s=0;this.isUpdatable(t)||o.state===e.ViewState.MOUNTED?(s=this.updateView(t,n,r),o.flag=s):o.state=e.ViewState.WAITING,s&&i.isEdge()&&(s&t.getFlag([`source`,`target`]))===0&&this.queue.queueJob({id:a,priority:wy.RenderEdge,cb:()=>{this.updateView(t,n,r)}})}removeViews(e){e.forEach(e=>{let t=e.id,n=this.views[t];n&&(this.willRemoveViews[t]=n,delete this.views[t],this.queue.queueJob({id:t,priority:this.getRenderPriority(n.view),cb:()=>{this.removeView(n.view)}}))}),this.flush()}flush(){this.graph.options.async?this.queue.queueFlush():this.queue.queueFlushSync()}flushWaitingViews(){Object.values(this.views).forEach(t=>{if(t&&t.state===e.ViewState.WAITING){let{view:e,flag:n,options:r}=t;this.requestViewUpdate(e,n,r,this.getRenderPriority(e),!1)}}),this.flush()}updateView(t,n,r={}){if(t==null)return 0;if(cg.isCellView(t)){if(n&e.FLAG_REMOVE)return this.removeView(t.cell),0;n&e.FLAG_INSERT&&(this.insertView(t),n^=e.FLAG_INSERT)}return n?t.confirmUpdate(n,r):0}insertView(t){let n=this.views[t.cell.id];if(n){let r=t.cell.getZIndex(),i=this.addZPivot(r);this.container.insertBefore(t.container,i),t.cell.isVisible()||this.toggleVisible(t.cell,!1),n.state=e.ViewState.MOUNTED,this.graph.trigger(`view:mounted`,{view:t})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach(e=>{e&&this.removeView(e.view)}),this.views={},this.willRemoveViews={}}removeView(e){let t=e.cell,n=this.willRemoveViews[t.id];n&&e&&(n.view.remove(),delete this.willRemoveViews[t.id],this.graph.trigger(`view:unmounted`,{view:e}))}toggleVisible(e,t){let n=this.model.getConnectedEdges(e);for(let e=0,r=n.length;e<r;e+=1){let r=n[e];if(t){let e=r.getSourceCell(),t=r.getTargetCell();if(e&&!e.isVisible()||t&&!t.isVisible())continue;this.toggleVisible(r,!0)}else this.toggleVisible(r,!1)}let r=this.views[e.id];r&&ud(r.view.container,{display:t?`unset`:`none`})}addZPivot(e=0){this.zPivots??={};let t=this.zPivots,n=t[e];if(n)return n;n=t[e]=document.createComment(`z-index:${e+1}`);let r=-1/0;for(let n in t){let t=+n;t<e&&t>r&&(r=t,e-1)}let i=this.container;if(r!==-1/0){let e=t[r];i.insertBefore(n,e.nextSibling)}else i.insertBefore(n,i.firstChild);return n}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach(e=>{e&&e.parentNode&&e.parentNode.removeChild(e)}),this.zPivots={}}createCellView(e){let t={graph:this.graph},n=this.graph.options.createCellView;if(n){let r=M(n,this.graph,e);if(r)return new r(e,t);if(r===null)return null}let r=e.view;if(r!=null&&typeof r==`string`){let n=cg.registry.get(r);return n?new n(e,t):cg.registry.onNotFound(r)}return e.isNode()?new ey(e,t):e.isEdge()?new ny(e,t):null}getEffectedEdges(e){let t=[],n=e.cell,r=this.model.getConnectedEdges(n);for(let e=0,i=r.length;e<i;e+=1){let i=r[e],a=this.views[i.id];if(!a)continue;let o=a.view;if(!this.isViewMounted(o))continue;let s=[`update`];i.getTargetCell()===n&&s.push(`target`),i.getSourceCell()===n&&s.push(`source`),t.push({id:i.id,view:o,flag:o.getFlag(s)})}return t}isUpdatable(e){if(e.isNodeView())return!this.renderArea||this.renderArea.isIntersectWithRect(e.cell.getBBox());if(e.isEdgeView()){let t=e.cell,n=t.getSourceCell(),r=t.getTargetCell();if(this.renderArea&&n&&r)return this.renderArea.isIntersectWithRect(n.getBBox())||this.renderArea.isIntersectWithRect(r.getBBox())}return!0}getRenderPriority(e){return e.cell.isNode()?wy.RenderNode:wy.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(e=>{this.views[e].view.dispose()}),this.views={}}};Ty([r.dispose()],Ey.prototype,`dispose`,null),(function(e){e.FLAG_INSERT=1<<30,e.FLAG_REMOVE=1<<29,e.FLAG_RENDER=(1<<26)-1})(Ey||={}),(function(e){(function(e){e[e.CREATED=0]=`CREATED`,e[e.MOUNTED=1]=`MOUNTED`,e[e.WAITING=2]=`WAITING`})(e.ViewState||={})})(Ey||={});var Dy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Oy=class extends oy{constructor(){super(...arguments),this.schedule=new Ey(this.graph)}requestViewUpdate(e,t,n={}){this.schedule.requestViewUpdate(e,t,n)}isViewMounted(e){return this.schedule.isViewMounted(e)}setRenderArea(e){this.schedule.setRenderArea(e)}findViewByElem(e){if(e==null)return null;let t=this.options.container,n=typeof e==`string`?t.querySelector(e):e instanceof Element?e:e[0];if(n){let e=this.graph.view.findAttr(`data-cell-id`,n);if(e){let t=this.schedule.views;if(t[e])return t[e].view}}return null}findViewByCell(e){if(e==null)return null;let t=K.isCell(e)?e.id:e,n=this.schedule.views;return n[t]?n[t].view:null}findViewsFromPoint(e){let t={x:e.x,y:e.y};return this.model.getCells().map(e=>this.findViewByCell(e)).filter(e=>e!=null&&U.getBBox(e.container,{target:this.view.stage}).containsPoint(t))}findEdgeViewsFromPoint(e,t=5){return this.model.getEdges().map(e=>this.findViewByCell(e)).filter(n=>{if(n!=null){let r=n.getClosestPoint(e);if(r)return r.distance(e)<=t}return!1})}findViewsInArea(e,t={}){let n=B.create(e);return this.model.getCells().map(e=>this.findViewByCell(e)).filter(e=>{if(e){if(t.nodeOnly&&!e.isNodeView())return!1;let r=U.getBBox(e.container,{target:this.view.stage});return r.width===0?r.inflate(1,0):r.height===0&&r.inflate(0,1),t.strict?n.containsRect(r):n.isIntersectWithRect(r)}return!1})}dispose(){this.schedule.dispose()}};Dy([oy.dispose()],Oy.prototype,`dispose`,null);var ky=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Ay=class extends oy{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(e){return this.svg.getElementById(e)!=null}filter(e){let t=e.id,n=e.name;if(t||=`filter-${n}-${this.cid}-${Pl(JSON.stringify(e))}`,!this.isDefined(t)){let r=Ap.registry.get(n);if(r==null)return Ap.registry.onNotFound(n);let i=r(e.args||{}),a=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:`objectBoundingBox`},e.attrs),{id:t});F.create(G.sanitize(i),a).appendTo(this.defs)}return t}gradient(e){let t=e.id,n=e.type;if(t||=`gradient-${n}-${this.cid}-${Pl(JSON.stringify(e))}`,!this.isDefined(t)){let r=`<${n}>${e.stops.map(e=>{let t=e.opacity!=null&&Number.isFinite(e.opacity)?e.opacity:1;return`<stop offset="${e.offset}" stop-color="${e.color}" stop-opacity="${t}"/>`}).join(``)}</${n}>`,i=Object.assign({id:t},e.attrs);F.create(r,i).appendTo(this.defs)}return t}marker(e){let{id:t,refX:n,refY:r,markerUnits:i,markerOrient:a,tagName:o,children:s}=e,c=ky(e,[`id`,`refX`,`refY`,`markerUnits`,`markerOrient`,`tagName`,`children`]),l=t;if(l||=`marker-${this.cid}-${Pl(JSON.stringify(e))}`,!this.isDefined(l)){o!==`path`&&delete c.d;let e=F.create(`marker`,{refX:n,refY:r,id:l,overflow:`visible`,orient:a??`auto`,markerUnits:i||`userSpaceOnUse`},s?s.map(e=>{var{tagName:t}=e,n=ky(e,[`tagName`]);return F.create(`${t}`||`path`,Hu(Object.assign(Object.assign({},c),n)))}):[F.create(o||`path`,Hu(c))]);this.defs.appendChild(e.node)}return l}remove(e){let t=this.svg.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}},jy=class extends oy{getClientMatrix(){return Hd(this.view.stage.getScreenCTM())}getClientOffset(){let e=this.view.svg.getBoundingClientRect();return new z(e.left,e.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(e,t){return(typeof e==`number`?this.clientToLocalPoint(e,t):this.clientToLocalPoint(e.x,e.y)).snapToGrid(this.graph.getGridSize())}localToGraphPoint(e,t){let n=z.create(e,t);return U.transformPoint(n,this.graph.matrix())}localToClientPoint(e,t){let n=z.create(e,t);return U.transformPoint(n,this.getClientMatrix())}localToPagePoint(e,t){return(typeof e==`number`?this.localToGraphPoint(e,t):this.localToGraphPoint(e)).translate(this.getPageOffset())}localToGraphRect(e,t,n,r){let i=B.create(e,t,n,r);return U.transformRectangle(i,this.graph.matrix())}localToClientRect(e,t,n,r){let i=B.create(e,t,n,r);return U.transformRectangle(i,this.getClientMatrix())}localToPageRect(e,t,n,r){return(typeof e==`number`?this.localToGraphRect(e,t,n,r):this.localToGraphRect(e)).translate(this.getPageOffset())}graphToLocalPoint(e,t){let n=z.create(e,t);return U.transformPoint(n,this.graph.matrix().inverse())}clientToLocalPoint(e,t){let n=z.create(e,t);return U.transformPoint(n,this.getClientMatrix().inverse())}clientToGraphPoint(e,t){let n=z.create(e,t);return U.transformPoint(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(e,t){let n=z.create(e,t).diff(this.getPageOffset());return this.graphToLocalPoint(n)}graphToLocalRect(e,t,n,r){let i=B.create(e,t,n,r);return U.transformRectangle(i,this.graph.matrix().inverse())}clientToLocalRect(e,t,n,r){let i=B.create(e,t,n,r);return U.transformRectangle(i,this.getClientMatrix().inverse())}clientToGraphRect(e,t,n,r){let i=B.create(e,t,n,r);return U.transformRectangle(i,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(e,t,n,r){let i=B.create(e,t,n,r),a=this.getPageOffset();return i.x-=a.x,i.y-=a.y,this.graphToLocalRect(i)}},My=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ny=class extends oy{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on(`cell:highlight`,this.onCellHighlight,this),this.graph.on(`cell:unhighlight`,this.onCellUnhighlight,this)}stopListening(){this.graph.off(`cell:highlight`,this.onCellHighlight,this),this.graph.off(`cell:unhighlight`,this.onCellUnhighlight,this)}onCellHighlight({view:e,magnet:t,options:n={}}){let r=this.resolveHighlighter(n);if(!r)return;let i=this.getHighlighterId(t,r);if(!this.highlights[i]){let n=r.highlighter;n.highlight(e,t,Object.assign({},r.args)),this.highlights[i]={cellView:e,magnet:t,highlighter:n,args:r.args}}}onCellUnhighlight({magnet:e,options:t={}}){let n=this.resolveHighlighter(t);if(!n)return;let r=this.getHighlighterId(e,n);this.unhighlight(r)}resolveHighlighter(e){let t=this.options,n=e.highlighter;if(n==null){let r=e.type;n=r&&t.highlighting[r]||t.highlighting.default}if(n==null)return null;let r=typeof n==`string`?{name:n}:n,i=r.name,a=bh.registry.get(i);return a==null?bh.registry.onNotFound(i):(bh.check(i,a),{name:i,highlighter:a,args:r.args||{}})}getHighlighterId(e,t){return pu(e),t.name+e.id+JSON.stringify(t.args)}unhighlight(e){let t=this.highlights[e];t&&(t.highlighter.unhighlight(t.cellView,t.magnet,t.args),delete this.highlights[e])}dispose(){Object.keys(this.highlights).forEach(e=>this.unhighlight(e)),this.stopListening()}};My([Ny.dispose()],Ny.prototype,`dispose`,null);var Py=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Fy=class extends oy{getScroller(){let e=this.graph.getPlugin(`scroller`);return e&&e.options.enabled?e:null}getContainer(){let e=this.getScroller();return e?e.container.parentElement:this.graph.container.parentElement}getSensorTarget(){let e=this.options.autoResize;if(e)return typeof e==`boolean`?this.getContainer():e}init(){if(this.options.autoResize){let e=this.getSensorTarget();e&&Cf.bind(e,()=>{let t=e.offsetWidth,n=e.offsetHeight;this.resize(t,n)})}}resize(e,t){let n=this.getScroller();n?n.resize(e,t):this.graph.transform.resize(e,t)}dispose(){Cf.clear(this.graph.container)}};Py([oy.dispose()],Fy.prototype,`dispose`,null);var Iy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},q=class e extends Al{get container(){return this.options.container}get[Symbol.toStringTag](){return e.toStringTag}constructor(e){super(),this.installedPlugins=new Set,this.options=uy.get(e),this.css=new cy(this),this.view=new iy(this),this.defs=new Ay(this),this.coord=new jy(this),this.transform=new my(this),this.highlight=new Ny(this),this.grid=new py(this),this.background=new gy(this),this.options.model?this.model=this.options.model:(this.model=new Hv,this.model.graph=this),this.renderer=new Oy(this),this.panning=new vy(this),this.mousewheel=new by(this),this.virtualRender=new Sy(this),this.size=new Fy(this)}isNode(e){return e.isNode()}isEdge(e){return e.isEdge()}resetCells(e,t={}){return this.model.resetCells(e,t),this}clearCells(e={}){return this.model.clear(e),this}toJSON(e={}){return this.model.toJSON(e)}parseJSON(e){return this.model.parseJSON(e)}fromJSON(e,t={}){return this.model.fromJSON(e,t),this}getCellById(e){return this.model.getCell(e)}addNode(e,t={}){return this.model.addNode(e,t)}addNodes(e,t={}){return this.addCell(e.map(e=>Iv.isNode(e)?e:this.createNode(e)),t)}createNode(e){return this.model.createNode(e)}removeNode(e,t={}){return this.model.removeCell(e,t)}addEdge(e,t={}){return this.model.addEdge(e,t)}addEdges(e,t={}){return this.addCell(e.map(e=>Rv.isEdge(e)?e:this.createEdge(e)),t)}removeEdge(e,t={}){return this.model.removeCell(e,t)}createEdge(e){return this.model.createEdge(e)}addCell(e,t={}){return this.model.addCell(e,t),this}removeCell(e,t={}){return this.model.removeCell(e,t)}removeCells(e,t={}){return this.model.removeCells(e,t)}removeConnectedEdges(e,t={}){return this.model.removeConnectedEdges(e,t)}disconnectConnectedEdges(e,t={}){return this.model.disconnectConnectedEdges(e,t),this}hasCell(e){return this.model.has(e)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(e){return this.model.getOutgoingEdges(e)}getIncomingEdges(e){return this.model.getIncomingEdges(e)}getConnectedEdges(e,t={}){return this.model.getConnectedEdges(e,t)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(e){return this.model.isRoot(e)}isLeafNode(e){return this.model.isLeaf(e)}getNeighbors(e,t={}){return this.model.getNeighbors(e,t)}isNeighbor(e,t,n={}){return this.model.isNeighbor(e,t,n)}getSuccessors(e,t={}){return this.model.getSuccessors(e,t)}isSuccessor(e,t,n={}){return this.model.isSuccessor(e,t,n)}getPredecessors(e,t={}){return this.model.getPredecessors(e,t)}isPredecessor(e,t,n={}){return this.model.isPredecessor(e,t,n)}getCommonAncestor(...e){return this.model.getCommonAncestor(...e)}getSubGraph(e,t={}){return this.model.getSubGraph(e,t)}cloneSubGraph(e,t={}){return this.model.cloneSubGraph(e,t)}cloneCells(e){return this.model.cloneCells(e)}getNodesFromPoint(e,t){return this.model.getNodesFromPoint(e,t)}getNodesInArea(e,t,n,r,i){return this.model.getNodesInArea(e,t,n,r,i)}getNodesUnderNode(e,t={}){return this.model.getNodesUnderNode(e,t)}searchCell(e,t,n={}){return this.model.search(e,t,n),this}getShortestPath(e,t,n={}){return this.model.getShortestPath(e,t,n)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(e,t={}){return this.model.getCellsBBox(e,t)}startBatch(e,t={}){this.model.startBatch(e,t)}stopBatch(e,t={}){this.model.stopBatch(e,t)}batchUpdate(e,t,n){let r=typeof e==`string`?e:`update`,i=typeof e==`string`?t:e,a=typeof t==`function`?n:t;this.startBatch(r,a);let o=i();return this.stopBatch(r,a),o}updateCellId(e,t){return this.model.updateCellId(e,t)}findView(e){return K.isCell(e)?this.findViewByCell(e):this.findViewByElem(e)}findViews(e){return B.isRectangleLike(e)?this.findViewsInArea(e):z.isPointLike(e)?this.findViewsFromPoint(e):[]}findViewByCell(e){return this.renderer.findViewByCell(e)}findViewByElem(e){return this.renderer.findViewByElem(e)}findViewsFromPoint(e,t){let n=typeof e==`number`?{x:e,y:t}:e;return this.renderer.findViewsFromPoint(n)}findViewsInArea(e,t,n,r,i){let a=typeof e==`number`?{x:e,y:t,width:n,height:r}:e,o=typeof e==`number`?i:t;return this.renderer.findViewsInArea(a,o)}matrix(e){return e===void 0?this.transform.getMatrix():(this.transform.setMatrix(e),this)}resize(e,t){let n=this.getPlugin(`scroller`);return n?n.resize(e,t):this.transform.resize(e,t),this}scale(e,t=e,n=0,r=0){return e===void 0?this.transform.getScale():(this.transform.scale(e,t,n,r),this)}zoom(e,t){let n=this.getPlugin(`scroller`);if(n){if(e===void 0)return n.zoom();n.zoom(e,t)}else{if(e===void 0)return this.transform.getZoom();this.transform.zoom(e,t)}return this}zoomTo(e,t={}){let n=this.getPlugin(`scroller`);return n?n.zoom(e,Object.assign(Object.assign({},t),{absolute:!0})):this.transform.zoom(e,Object.assign(Object.assign({},t),{absolute:!0})),this}zoomToRect(e,t={}){let n=this.getPlugin(`scroller`);return n?n.zoomToRect(e,t):this.transform.zoomToRect(e,t),this}zoomToFit(e={}){let t=this.getPlugin(`scroller`);return t?t.zoomToFit(e):this.transform.zoomToFit(e),this}rotate(e,t,n){return e===void 0?this.transform.getRotation():(this.transform.rotate(e,t,n),this)}translate(e,t){return e===void 0?this.transform.getTranslation():(this.transform.translate(e,t),this)}translateBy(e,t){let n=this.translate(),r=n.tx+e,i=n.ty+t;return this.translate(r,i)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(e={}){return this.transform.getContentArea(e)}getContentBBox(e={}){return this.transform.getContentBBox(e)}fitToContent(e,t,n,r){return this.transform.fitToContent(e,t,n,r)}scaleContentToFit(e={}){return this.transform.scaleContentToFit(e),this}center(e){return this.centerPoint(e)}centerPoint(e,t,n){let r=this.getPlugin(`scroller`);return r?r.centerPoint(e,t,n):this.transform.centerPoint(e,t),this}centerContent(e){let t=this.getPlugin(`scroller`);return t?t.centerContent(e):this.transform.centerContent(e),this}centerCell(e,t){let n=this.getPlugin(`scroller`);return n?n.centerCell(e,t):this.transform.centerCell(e),this}positionPoint(e,t,n,r={}){let i=this.getPlugin(`scroller`);return i?i.positionPoint(e,t,n,r):this.transform.positionPoint(e,t,n),this}positionRect(e,t,n){let r=this.getPlugin(`scroller`);return r?r.positionRect(e,t,n):this.transform.positionRect(e,t),this}positionCell(e,t,n){let r=this.getPlugin(`scroller`);return r?r.positionCell(e,t,n):this.transform.positionCell(e,t),this}positionContent(e,t){let n=this.getPlugin(`scroller`);return n?n.positionContent(e,t):this.transform.positionContent(e,t),this}snapToGrid(e,t){return this.coord.snapToGrid(e,t)}pageToLocal(e,t,n,r){return B.isRectangleLike(e)?this.coord.pageToLocalRect(e):typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`?this.coord.pageToLocalRect(e,t,n,r):this.coord.pageToLocalPoint(e,t)}localToPage(e,t,n,r){return B.isRectangleLike(e)?this.coord.localToPageRect(e):typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`?this.coord.localToPageRect(e,t,n,r):this.coord.localToPagePoint(e,t)}clientToLocal(e,t,n,r){return B.isRectangleLike(e)?this.coord.clientToLocalRect(e):typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`?this.coord.clientToLocalRect(e,t,n,r):this.coord.clientToLocalPoint(e,t)}localToClient(e,t,n,r){return B.isRectangleLike(e)?this.coord.localToClientRect(e):typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`?this.coord.localToClientRect(e,t,n,r):this.coord.localToClientPoint(e,t)}localToGraph(e,t,n,r){return B.isRectangleLike(e)?this.coord.localToGraphRect(e):typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`?this.coord.localToGraphRect(e,t,n,r):this.coord.localToGraphPoint(e,t)}graphToLocal(e,t,n,r){return B.isRectangleLike(e)?this.coord.graphToLocalRect(e):typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`?this.coord.graphToLocalRect(e,t,n,r):this.coord.graphToLocalPoint(e,t)}clientToGraph(e,t,n,r){return B.isRectangleLike(e)?this.coord.clientToGraphRect(e):typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`?this.coord.clientToGraphRect(e,t,n,r):this.coord.clientToGraphPoint(e,t)}defineFilter(e){return this.defs.filter(e)}defineGradient(e){return this.defs.gradient(e)}defineMarker(e){return this.defs.marker(e)}getGridSize(){return this.grid.getGridSize()}setGridSize(e){return this.grid.setGridSize(e),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(e){return this.grid.draw(e),this}updateBackground(){return this.background.update(),this}drawBackground(e,t){let n=this.getPlugin(`scroller`);return n!=null&&(this.options.background==null||!t)?n.drawBackground(e,t):this.background.draw(e),this}clearBackground(e){let t=this.getPlugin(`scroller`);return t!=null&&(this.options.background==null||!e)?t.clearBackground(e):this.background.clear(),this}enableVirtualRender(){return this.virtualRender.enableVirtualRender(),this}disableVirtualRender(){return this.virtualRender.disableVirtualRender(),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(e){return e==null?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():e?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){let e=this.getPlugin(`scroller`);return e?e.isPannable():this.panning.pannable}enablePanning(){let e=this.getPlugin(`scroller`);return e?e.enablePanning():this.panning.enablePanning(),this}disablePanning(){let e=this.getPlugin(`scroller`);return e?e.disablePanning():this.panning.disablePanning(),this}togglePanning(e){return e==null?this.isPannable()?this.disablePanning():this.enablePanning():e!==this.isPannable()&&(e?this.enablePanning():this.disablePanning()),this}use(e,...t){return this.installedPlugins.has(e)||(this.installedPlugins.add(e),e.init(this,...t)),this}getPlugin(e){return Array.from(this.installedPlugins).find(t=>t.name===e)}getPlugins(e){return Array.from(this.installedPlugins).filter(t=>e.includes(t.name))}enablePlugins(e){let t=e;return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(e=>{var t;(t=e?.enable)==null||t.call(e)}),this}disablePlugins(e){let t=e;return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(e=>{var t;(t=e?.disable)==null||t.call(e)}),this}isPluginEnabled(e){let t=this.getPlugin(e);return(t?.isEnabled)?.call(t)}disposePlugins(e){let t=e;return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(e=>{e.dispose(),this.installedPlugins.delete(e)}),this}dispose(e=!0){e&&this.model.dispose(),this.css.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.highlight.dispose(),this.background.dispose(),this.mousewheel.dispose(),this.panning.dispose(),this.view.dispose(),this.renderer.dispose(),this.installedPlugins.forEach(e=>{e.dispose()})}};Iy([Al.dispose()],q.prototype,`dispose`,null),(function(e){e.View=iy,e.Renderer=Oy,e.MouseWheel=by,e.DefsManager=Ay,e.GridManager=py,e.CoordManager=jy,e.TransformManager=my,e.HighlightManager=Ny,e.BackgroundManager=gy,e.PanningManager=vy})(q||={}),(function(e){e.toStringTag=`X6.${e.name}`;function t(t){if(t==null)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag];return n==null||n===e.toStringTag}e.isGraph=t})(q||={}),(function(e){function t(t,n){let r=t instanceof HTMLElement?new e({container:t}):new e(t);return n!=null&&r.fromJSON(n),r}e.render=t})(q||={}),(function(e){e.registerNode=Iv.registry.register,e.registerEdge=Rv.registry.register,e.registerView=cg.registry.register,e.registerAttr=uh.registry.register,e.registerGrid=lp.registry.register,e.registerFilter=Ap.registry.register,e.registerNodeTool=Fg.registry.register,e.registerEdgeTool=Ig.registry.register,e.registerBackground=hp.registry.register,e.registerHighlighter=bh.registry.register,e.registerPortLayout=Fh.registry.register,e.registerPortLabelLayout=eg.registry.register,e.registerMarker=Km.registry.register,e.registerRouter=cv.registry.register,e.registerConnector=Dv.registry.register,e.registerAnchor=$g.registry.register,e.registerEdgeAnchor=o_.registry.register,e.registerConnectionPoint=g_.registry.register})(q||={}),(function(e){e.unregisterNode=Iv.registry.unregister,e.unregisterEdge=Rv.registry.unregister,e.unregisterView=cg.registry.unregister,e.unregisterAttr=uh.registry.unregister,e.unregisterGrid=lp.registry.unregister,e.unregisterFilter=Ap.registry.unregister,e.unregisterNodeTool=Fg.registry.unregister,e.unregisterEdgeTool=Ig.registry.unregister,e.unregisterBackground=hp.registry.unregister,e.unregisterHighlighter=bh.registry.unregister,e.unregisterPortLayout=Fh.registry.unregister,e.unregisterPortLabelLayout=eg.registry.unregister,e.unregisterMarker=Km.registry.unregister,e.unregisterRouter=cv.registry.unregister,e.unregisterConnector=Dv.registry.unregister,e.unregisterAnchor=$g.registry.unregister,e.unregisterEdgeAnchor=o_.registry.unregister,e.unregisterConnectionPoint=g_.registry.unregister})(q||={});var Ly=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ry=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},zy=class extends Iv{};(function(e){class t extends ey{init(){super.init(),this.cell.on(`change:*`,this.onCellChangeAny,this)}onCellChangeAny({key:t}){let n=e.shapeMaps[this.cell.shape];if(n){let{effect:e}=n;(!e||e.includes(t))&&this.renderHTMLComponent()}}confirmUpdate(e){let n=super.confirmUpdate(e);return this.handleAction(n,t.action,()=>this.renderHTMLComponent())}renderHTMLComponent(){let t=this.selectors&&this.selectors.foContent;if(t){Ou(t);let n=e.shapeMaps[this.cell.shape];if(!n)return;let{html:r}=n;typeof r==`function`&&(r=r(this.cell)),r&&(typeof r==`string`?t.innerHTML=r:ku(t,r))}}dispose(){this.cell.off(`change:*`,this.onCellChangeAny,this)}}Ly([t.dispose()],t.prototype,`dispose`,null),e.View=t,(function(e){e.action=`html`,e.config({bootstrap:[e.action],actions:{html:e.action}}),ey.registry.register(`html-view`,e,!0)})(t=e.View||={})})(zy||={}),(function(e){e.config({view:`html-view`,markup:[{tagName:`rect`,selector:`body`},Object.assign({},G.getForeignObjectMarkup()),{tagName:`text`,selector:`label`}],attrs:{body:{fill:`none`,stroke:`none`,refWidth:`100%`,refHeight:`100%`},fo:{refWidth:`100%`,refHeight:`100%`}}}),Iv.registry.register(`html`,e,!0)})(zy||={}),(function(e){e.shapeMaps={};function t(t){let{shape:n,html:r,effect:i,inherit:a}=t,o=Ry(t,[`shape`,`html`,`effect`,`inherit`]);if(!n)throw Error(`should specify shape in config`);e.shapeMaps[n]={html:r,effect:i},q.registerNode(n,Object.assign({inherit:a||`html`},o),!0)}e.register=t})(zy||={});var By=`.x6-widget-minimap {
246
+ position: relative;
247
+ display: table-cell;
248
+ box-sizing: border-box;
249
+ overflow: hidden;
250
+ text-align: center;
251
+ vertical-align: middle;
252
+ background-color: #fff;
253
+ user-select: none;
254
+ }
255
+ .x6-widget-minimap .x6-graph {
256
+ display: inline-block;
257
+ box-shadow: 0 0 4px 0 #eee;
258
+ cursor: pointer;
259
+ }
260
+ .x6-widget-minimap .x6-graph > svg {
261
+ pointer-events: none;
262
+ shape-rendering: optimizespeed;
263
+ }
264
+ .x6-widget-minimap .x6-graph .x6-node * {
265
+ /* stylelint-disable-next-line */
266
+ vector-effect: initial;
267
+ }
268
+ .x6-widget-minimap-viewport {
269
+ position: absolute;
270
+ box-sizing: content-box !important;
271
+ margin: -2px 0 0 -2px;
272
+ border: 2px solid #31d0c6;
273
+ cursor: move;
274
+ }
275
+ .x6-widget-minimap-viewport-zoom {
276
+ position: absolute;
277
+ right: 0;
278
+ bottom: 0;
279
+ box-sizing: border-box;
280
+ width: 12px;
281
+ height: 12px;
282
+ margin: 0 -6px -6px 0;
283
+ background-color: #fff;
284
+ border: 2px solid #31d0c6;
285
+ border-radius: 50%;
286
+ cursor: nwse-resize;
287
+ }
288
+ `,Vy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Hy=class extends W{get scroller(){return this.graph.getPlugin(`scroller`)}get graphContainer(){return this.scroller?this.scroller.container:this.graph.container}constructor(e){super(),this.name=`minimap`,this.options=Object.assign(Object.assign({},Wy.defaultOptions),e),Mf(this.name,By)}init(e){this.graph=e,this.updateViewport=dc(this.updateViewport.bind(this),0),this.container=document.createElement(`div`),N(this.container,this.prefixClassName(Uy.root));let t=document.createElement(`div`);this.container.appendChild(t),this.viewport=document.createElement(`div`),N(this.viewport,this.prefixClassName(Uy.viewport)),this.options.scalable&&(this.zoomHandle=document.createElement(`div`),N(this.zoomHandle,this.prefixClassName(Uy.zoom)),Mu(this.zoomHandle,this.viewport)),ku(this.container,this.viewport),ud(this.container,{width:this.options.width,height:this.options.height,padding:this.options.padding}),this.options.container&&this.options.container.appendChild(this.container),this.sourceGraph=this.graph;let n=Object.assign(Object.assign({},this.options.graphOptions),{container:t,model:this.sourceGraph.model,interacting:!1,grid:!1,background:!1,embedding:!1});this.targetGraph=this.options.createGraph?this.options.createGraph(n):new q(n),this.updatePaper(this.sourceGraph.options.width,this.sourceGraph.options.height),this.startListening()}startListening(){this.scroller?ff.on(this.graphContainer,`scroll${this.getEventNamespace()}`,this.updateViewport):(this.sourceGraph.on(`translate`,this.onTransform,this),this.sourceGraph.on(`scale`,this.onTransform,this),this.sourceGraph.on(`model:updated`,this.onModelUpdated,this)),this.sourceGraph.on(`resize`,this.updatePaper,this),this.delegateEvents({mousedown:`startAction`,touchstart:`startAction`,[`mousedown .${this.prefixClassName(`graph`)}`]:`scrollTo`,[`touchstart .${this.prefixClassName(`graph`)}`]:`scrollTo`})}stopListening(){this.scroller?ff.off(this.graphContainer,this.getEventNamespace()):(this.sourceGraph.off(`translate`,this.onTransform,this),this.sourceGraph.off(`scale`,this.onTransform,this),this.sourceGraph.off(`model:updated`,this.onModelUpdated,this)),this.sourceGraph.off(`resize`,this.updatePaper,this),this.undelegateEvents()}onRemove(){this.stopListening(),this.targetGraph.dispose(!1)}onTransform(e){(e.ui||this.targetGraphTransforming||!this.scroller)&&this.updateViewport()}onModelUpdated(){this.targetGraph.zoomToFit()}updatePaper(e,t){let n,r;typeof e==`object`?(n=e.width,r=e.height):(n=e,r=t);let i=this.sourceGraph.options,a=this.sourceGraph.transform.getScale(),o=this.options.width-2*this.options.padding,s=this.options.height-2*this.options.padding;n/=a.sx,r/=a.sy,this.ratio=Math.min(o/n,s/r);let c=this.ratio,l=i.x*c/a.sx,u=i.y*c/a.sy;return n*=c,r*=c,this.targetGraph.resize(n,r),this.targetGraph.translate(l,u),this.scroller?this.targetGraph.scale(c,c):this.targetGraph.zoomToFit(),this.updateViewport(),this}updateViewport(){let e=this.sourceGraph.transform.getScale(),t=this.targetGraph.transform.getScale(),n=null;n=this.scroller?this.scroller.clientToLocalPoint(0,0):this.graph.graphToLocal(0,0);let r=vf(this.targetGraph.container),i=this.targetGraph.translate();i.ty=i.ty||0,this.geometry={top:r.top+n.y*t.sy+i.ty,left:r.left+n.x*t.sx+i.tx,width:this.graphContainer.clientWidth*t.sx/e.sx,height:this.graphContainer.clientHeight*t.sy/e.sy},ud(this.viewport,this.geometry)}startAction(e){let t=this.normalizeEvent(e),n=t.target===this.zoomHandle?`zooming`:`panning`,{tx:r,ty:i}=this.sourceGraph.translate(),a={action:n,clientX:t.clientX,clientY:t.clientY,scrollLeft:this.graphContainer.scrollLeft,scrollTop:this.graphContainer.scrollTop,zoom:this.sourceGraph.zoom(),scale:this.sourceGraph.transform.getScale(),geometry:this.geometry,translateX:r,translateY:i};this.targetGraphTransforming=!0,this.delegateDocumentEvents(Wy.documentEvents,a)}doAction(e){let t=this.normalizeEvent(e),n=t.clientX,r=t.clientY,i=t.data;switch(i.action){case`panning`:{let e=this.sourceGraph.transform.getScale(),t=(n-i.clientX)*e.sx,a=(r-i.clientY)*e.sy;this.scroller?(this.graphContainer.scrollLeft=i.scrollLeft+t/this.ratio,this.graphContainer.scrollTop=i.scrollTop+a/this.ratio):this.sourceGraph.translate(i.translateX-t/this.ratio,i.translateY-a/this.ratio);break}case`zooming`:{let e=i.scale,t=i.geometry,r=1+(i.clientX-n)/t.width/e.sx;i.frameId&&cancelAnimationFrame(i.frameId),i.frameId=requestAnimationFrame(()=>{this.sourceGraph.zoom(r*i.zoom,{absolute:!0,minScale:this.options.minScale,maxScale:this.options.maxScale})});break}}}stopAction(){this.undelegateDocumentEvents(),this.targetGraphTransforming=!1}scrollTo(e){let t=this.normalizeEvent(e),n,r,i=this.targetGraph.translate();if(i.ty=i.ty||0,t.offsetX==null){let e=hf(this.targetGraph.container);n=t.pageX-e.left,r=t.pageY-e.top}else n=t.offsetX,r=t.offsetY;let a=(n-i.tx)/this.ratio,o=(r-i.ty)/this.ratio;this.sourceGraph.centerPoint(a,o)}dispose(){this.remove(),Nf(this.name)}};Vy([W.dispose()],Hy.prototype,`dispose`,null);var Uy;(function(e){e.root=`widget-minimap`,e.viewport=`${e.root}-viewport`,e.zoom=`${e.viewport}-zoom`})(Uy||={});var Wy;(function(e){e.defaultOptions={width:300,height:200,padding:10,scalable:!0,minScale:.01,maxScale:16,graphOptions:{},createGraph:e=>new q(e)},e.documentEvents={mousemove:`doAction`,touchmove:`doAction`,mouseup:`stopAction`,touchend:`stopAction`}})(Wy||={});var Gy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ky=class extends W{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(qy.classNames.box)}get $boxes(){return Fu(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(e){super(),this.options=e,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new Bv([],{comparator:qy.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.startListening()}startListening(){let e=this.graph,t=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:`onSelectionBoxMouseDown`,[`touchstart .${this.boxClassName}`]:`onSelectionBoxMouseDown`},!0),e.on(`scale`,this.onGraphTransformed,this),e.on(`translate`,this.onGraphTransformed,this),e.model.on(`updated`,this.onModelUpdated,this),t.on(`added`,this.onCellAdded,this),t.on(`removed`,this.onCellRemoved,this),t.on(`reseted`,this.onReseted,this),t.on(`updated`,this.onCollectionUpdated,this),t.on(`node:change:position`,this.onNodePositionChanged,this),t.on(`cell:changed`,this.onCellChanged,this)}stopListening(){let e=this.graph,t=this.collection;this.undelegateEvents(),e.off(`scale`,this.onGraphTransformed,this),e.off(`translate`,this.onGraphTransformed,this),e.model.off(`updated`,this.onModelUpdated,this),t.off(`added`,this.onCellAdded,this),t.off(`removed`,this.onCellRemoved,this),t.off(`reseted`,this.onReseted,this),t.off(`updated`,this.onCollectionUpdated,this),t.off(`node:change:position`,this.onNodePositionChanged,this),t.off(`cell:changed`,this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateSelectionBoxes()}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:e,options:t}){let{showNodeSelectionBox:n,pointerEvents:r}=this.options,{ui:i,selection:a,translateBy:o,snapped:s}=t,c=(n!==!0||r&&this.getPointerEventsValue(r)===`none`)&&!this.translating&&!a,l=i&&o&&e.id===o;if(c&&(l||s)){this.translating=!0;let n=e.position(),r=e.previous(`position`),i=n.x-r.x,a=n.y-r.y;(i!==0||a!==0)&&this.translateSelectedNodes(i,a,e,t),this.translating=!1}}onModelUpdated({removed:e}){e&&e.length&&this.unselect(e)}isEmpty(){return this.length<=0}isSelected(e){return this.collection.has(e)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(e,t={}){t.dryrun=!0;let n=this.filter(Array.isArray(e)?e:[e]);return this.collection.add(n,t),this}unselect(e,t={}){return t.dryrun=!0,this.collection.remove(Array.isArray(e)?e:[e],t),this}reset(e,t={}){if(e){if(t.batch){let n=this.filter(Array.isArray(e)?e:[e]);return this.collection.reset(n,Object.assign(Object.assign({},t),{ui:!0})),this}let n=this.cells,r=this.filter(Array.isArray(e)?e:[e]),i={},a={};n.forEach(e=>i[e.id]=e),r.forEach(e=>a[e.id]=e);let o=[],s=[];return r.forEach(e=>{i[e.id]||o.push(e)}),n.forEach(e=>{a[e.id]||s.push(e)}),s.length&&this.unselect(s,Object.assign(Object.assign({},t),{ui:!0})),o.length&&this.select(o,Object.assign(Object.assign({},t),{ui:!0})),s.length===0&&o.length===0&&this.updateContainer(),this}return this.clean(t)}clean(e={}){return this.length&&(e.batch===!1?this.unselect(this.cells,e):this.collection.reset([],Object.assign(Object.assign({},e),{ui:!0}))),this}setFilter(e){this.options.filter=e}setContent(e){this.options.content=e}startSelecting(e){e=this.normalizeEvent(e),this.clean();let t,n,r=this.graph.container;if(e.offsetX!=null&&e.offsetY!=null&&r.contains(e.target))t=e.offsetX,n=e.offsetY;else{let i=hf(r),a=r.scrollLeft,o=r.scrollTop;t=e.clientX-i.left+window.pageXOffset+a,n=e.clientY-i.top+window.pageYOffset+o}ud(this.container,{top:n,left:t,width:1,height:1}),this.setEventData(e,{action:`selecting`,clientX:e.clientX,clientY:e.clientY,offsetX:t,offsetY:n,scrollerX:0,scrollerY:0,moving:!1}),this.delegateDocumentEvents(qy.documentEvents,e.data)}filter(e){let t=this.options.filter;return e.filter(e=>Array.isArray(t)?t.some(t=>typeof t==`string`?e.shape===t:e.id===t.id):typeof t!=`function`||M(t,this.graph,e))}stopSelecting(e){let t=this.graph,n=this.getEventData(e);switch(n.action){case`selecting`:{let e=gf(this.container),n=_f(this.container),r=hf(this.container),i=t.pageToLocal(r.left,r.top),a=t.transform.getScale();e/=a.sx,n/=a.sy;let o=new B(i.x,i.y,e,n),s=this.getCellViewsInArea(o).map(e=>e.cell);this.reset(s,{batch:!0}),this.hideRubberband();break}case`translating`:{let r=t.snapToGrid(e.clientX,e.clientY);if(!this.options.following){let e=n;this.updateSelectedNodesPosition({dx:e.clientX-e.originX,dy:e.clientY-e.originY})}this.graph.model.stopBatch(`move-selection`),this.notifyBoxEvent(`box:mouseup`,e,r.x,r.y);break}default:this.clean()}}onMouseUp(e){this.getEventData(e).action&&(this.stopSelecting(e),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(e){this.options.following||e.stopPropagation();let t=this.normalizeEvent(e);this.options.movable&&this.startTranslating(t);let n=this.getCellViewFromElem(t.target);this.setEventData(t,{activeView:n});let r=this.graph.snapToGrid(t.clientX,t.clientY);this.notifyBoxEvent(`box:mousedown`,t,r.x,r.y),this.delegateDocumentEvents(qy.documentEvents,t.data)}startTranslating(e){this.graph.model.startBatch(`move-selection`);let t=this.graph.snapToGrid(e.clientX,e.clientY);this.setEventData(e,{action:`translating`,clientX:t.x,clientY:t.y,originX:t.x,originY:t.y})}getRestrictArea(){let e=this.graph.options.translating.restrict,t=typeof e==`function`?M(e,this.graph,null):e;return typeof t==`number`?this.graph.transform.getGraphArea().inflate(t):t===!0?this.graph.transform.getGraphArea():t||null}getSelectionOffset(e,t){let n=e.x-t.clientX,r=e.y-t.clientY,i=this.getRestrictArea();if(i){let a=this.collection.toArray(),o=K.getCellsBBox(a,{deep:!0})||B.create(),s=i.x-o.x,c=i.y-o.y,l=i.x+i.width-(o.x+o.width),u=i.y+i.height-(o.y+o.height);if(n<s&&(n=s),r<c&&(r=c),l<n&&(n=l),u<r&&(r=u),!this.options.following){let i=e.x-t.originX,a=e.y-t.originY;n=i<=s||i>=l?0:n,r=a<=c||a>=u?0:r}}return{dx:n,dy:r}}updateElementPosition(e,t,n){let r=ud(e,`left`),i=ud(e,`top`),a=r?parseFloat(r):0,o=i?parseFloat(i):0;ud(e,`left`,a+t),ud(e,`top`,o+n)}updateSelectedNodesPosition(e){let{dx:t,dy:n}=e;if(t||n){if(this.translateSelectedNodes(t,n),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{let e=this.graph.transform.getScale();for(let r=0,i=this.$boxes,a=i.length;r<a;r+=1)this.updateElementPosition(i[r],t*e.sx,n*e.sy);this.updateElementPosition(this.selectionContainer,t*e.sx,n*e.sy)}}}autoScrollGraph(e,t){let n=this.graph.getPlugin(`scroller`);return n?n.autoScroll(e,t):{scrollerX:0,scrollerY:0}}adjustSelection(e){let t=this.normalizeEvent(e),n=this.getEventData(t);switch(n.action){case`selecting`:{let e=n;e.moving!==!0&&(Mu(this.container,this.graph.container),this.showRubberband(),e.moving=!0);let{scrollerX:r,scrollerY:i}=this.autoScrollGraph(t.clientX,t.clientY);e.scrollerX+=r,e.scrollerY+=i;let a=t.clientX-e.clientX+e.scrollerX,o=t.clientY-e.clientY+e.scrollerY,s=parseInt(ud(this.container,`left`)||`0`,10),c=parseInt(ud(this.container,`top`)||`0`,10);ud(this.container,{left:a<0?e.offsetX+a:s,top:o<0?e.offsetY+o:c,width:Math.abs(a),height:Math.abs(o)});break}case`translating`:{let r=this.graph.snapToGrid(t.clientX,t.clientY),i=n,a=this.getSelectionOffset(r,i);this.options.following?this.updateSelectedNodesPosition(a):this.updateContainerPosition(a),a.dx&&(i.clientX=r.x),a.dy&&(i.clientY=r.y),this.notifyBoxEvent(`box:mousemove`,e,r.x,r.y);break}}this.boxesUpdated=!1}translateSelectedNodes(e,t,n,r){let i={},a=[];if(n&&(i[n.id]=!0),this.collection.toArray().forEach(e=>{e.getDescendants({deep:!0}).forEach(e=>{i[e.id]=!0})}),r&&r.translateBy){let e=this.graph.getCellById(r.translateBy);e&&(i[e.id]=!0,e.getDescendants({deep:!0}).forEach(e=>{i[e.id]=!0}),a.push(e))}this.collection.toArray().forEach(n=>{if(!i[n.id]){let o=Object.assign(Object.assign({},r),{selection:this.cid,exclude:a});n.translate(e,t,o),this.graph.model.getConnectedEdges(n).forEach(n=>{i[n.id]||(n.translate(e,t,o),i[n.id]=!0)})}})}getCellViewsInArea(e){let t=this.graph,n={strict:this.options.strict},r=[];return this.options.rubberNode&&(r=r.concat(t.model.getNodesInArea(e,n).map(e=>t.renderer.findViewByCell(e)).filter(e=>e!=null))),this.options.rubberEdge&&(r=r.concat(t.model.getEdgesInArea(e,n).map(e=>t.renderer.findViewByCell(e)).filter(e=>e!=null))),r}notifyBoxEvent(e,t,n,r){let i=this.getEventData(t).activeView;this.trigger(e,{e:t,view:i,x:n,y:r,cell:i.cell})}getSelectedClassName(e){return this.prefixClassName(`${e.isNode()?`node`:`edge`}-selected`)}addCellSelectedClassName(e){let t=this.graph.renderer.findViewByCell(e);t&&t.addClass(this.getSelectedClassName(e))}removeCellUnSelectedClassName(e){let t=this.graph.renderer.findViewByCell(e);t&&t.removeClass(this.getSelectedClassName(e))}destroySelectionBox(e){this.removeCellUnSelectedClassName(e),this.canShowSelectionBox(e)&&(Du(this.container.querySelector(`[data-cell-id="${e.id}"]`)),this.$boxes.length===0&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(e){e.forEach(e=>this.removeCellUnSelectedClassName(e)),this.hide(),Du(this.$boxes),this.boxCount=0}hide(){lu(this.container,this.prefixClassName(qy.classNames.rubberband)),lu(this.container,this.prefixClassName(qy.classNames.selected))}showRubberband(){N(this.container,this.prefixClassName(qy.classNames.rubberband))}hideRubberband(){lu(this.container,this.prefixClassName(qy.classNames.rubberband))}showSelected(){Ru(this.container,`style`),N(this.container,this.prefixClassName(qy.classNames.selected))}createContainer(){this.container=document.createElement(`div`),N(this.container,this.prefixClassName(qy.classNames.root)),this.options.className&&N(this.container,this.options.className),this.selectionContainer=document.createElement(`div`),N(this.selectionContainer,this.prefixClassName(qy.classNames.inner)),this.selectionContent=document.createElement(`div`),N(this.selectionContent,this.prefixClassName(qy.classNames.content)),ku(this.selectionContainer,this.selectionContent),P(this.selectionContainer,`data-selection-length`,this.collection.length),Au(this.container,this.selectionContainer)}updateContainerPosition(e){(e.dx||e.dy)&&this.updateElementPosition(this.selectionContainer,e.dx,e.dy)}updateContainer(){let e={x:1/0,y:1/0},t={x:0,y:0};this.collection.toArray().filter(e=>this.canShowSelectionBox(e)).forEach(n=>{let r=this.graph.renderer.findViewByCell(n);if(r){let n=r.getBBox({useCellGeometry:!0});e.x=Math.min(e.x,n.x),e.y=Math.min(e.y,n.y),t.x=Math.max(t.x,n.x+n.width),t.y=Math.max(t.y,n.y+n.height)}}),ud(this.selectionContainer,{position:`absolute`,pointerEvents:`none`,left:e.x,top:e.y,width:t.x-e.x,height:t.y-e.y}),P(this.selectionContainer,`data-selection-length`,this.collection.length);let n=this.options.content;if(n){if(typeof n==`function`){let e=M(n,this.graph,this,this.selectionContent);e&&(this.selectionContent.innerHTML=e)}else this.selectionContent.innerHTML=n}this.collection.length>0&&!this.container.parentNode?Mu(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(e){return e.isNode()&&this.options.showNodeSelectionBox===!0||e.isEdge()&&this.options.showEdgeSelectionBox===!0}getPointerEventsValue(e){return typeof e==`string`?e:e(this.cells)}createSelectionBox(e){if(this.addCellSelectedClassName(e),this.canShowSelectionBox(e)){let t=this.graph.renderer.findViewByCell(e);if(t){let n=t.getBBox({useCellGeometry:!0}),r=this.boxClassName,i=document.createElement(`div`),a=this.options.pointerEvents;N(i,r),N(i,`${r}-${e.isNode()?`node`:`edge`}`),P(i,`data-cell-id`,e.id),ud(i,{position:`absolute`,left:n.x,top:n.y,width:n.width,height:n.height,pointerEvents:a?this.getPointerEventsValue(a):`auto`}),Mu(i,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){this.collection.length>0&&(this.boxesUpdated=!0,this.confirmUpdate())}confirmUpdate(){if(this.boxCount){this.hide();for(let e=0,t=this.$boxes,n=t.length;e<n;e+=1){let n=t[e],r=P(n,`data-cell-id`);Du(n),--this.boxCount;let i=this.collection.get(r);i&&this.createSelectionBox(i)}this.updateContainer()}return 0}getCellViewFromElem(e){let t=e.getAttribute(`data-cell-id`);if(t){let e=this.collection.get(t);if(e)return this.graph.renderer.findViewByCell(e)}return null}onCellRemoved({cell:e}){this.destroySelectionBox(e),this.updateContainer()}onReseted({previous:e,current:t}){this.destroyAllSelectionBoxes(e),t.forEach(e=>{this.listenCellRemoveEvent(e),this.createSelectionBox(e)}),this.updateContainer()}onCellAdded({cell:e}){this.listenCellRemoveEvent(e),this.createSelectionBox(e),this.updateContainer()}listenCellRemoveEvent(e){e.off(`removed`,this.onCellRemoved,this),e.on(`removed`,this.onCellRemoved,this)}onCollectionUpdated({added:e,removed:t,options:n}){e.forEach(e=>{this.trigger(`cell:selected`,{cell:e,options:n}),e.isNode()?this.trigger(`node:selected`,{cell:e,options:n,node:e}):e.isEdge()&&this.trigger(`edge:selected`,{cell:e,options:n,edge:e})}),t.forEach(e=>{this.trigger(`cell:unselected`,{cell:e,options:n}),e.isNode()?this.trigger(`node:unselected`,{cell:e,options:n,node:e}):e.isEdge()&&this.trigger(`edge:unselected`,{cell:e,options:n,edge:e})});let r={added:e,removed:t,options:n,selected:this.cells.filter(e=>!!this.graph.getCellById(e.id))};this.trigger(`selection:changed`,r)}dispose(){this.clean(),this.remove(),this.off()}};Gy([W.dispose()],Ky.prototype,`dispose`,null);var qy;(function(e){let t=`widget-selection`;e.classNames={root:t,inner:`${t}-inner`,box:`${t}-box`,content:`${t}-content`,rubberband:`${t}-rubberband`,selected:`${t}-selected`},e.documentEvents={mousemove:`adjustSelection`,touchmove:`adjustSelection`,mouseup:`onMouseUp`,touchend:`onMouseUp`,touchcancel:`onMouseUp`};function n(e){return e.getAncestors().length}e.depthComparator=n})(qy||={});var Jy=`.x6-widget-selection {
289
+ position: absolute;
290
+ top: 0;
291
+ left: 0;
292
+ display: none;
293
+ width: 0;
294
+ height: 0;
295
+ touch-action: none;
296
+ }
297
+ .x6-widget-selection-rubberband {
298
+ display: block;
299
+ overflow: visible;
300
+ opacity: 0.3;
301
+ }
302
+ .x6-widget-selection-selected {
303
+ display: block;
304
+ }
305
+ .x6-widget-selection-box {
306
+ cursor: move;
307
+ }
308
+ .x6-widget-selection-inner[data-selection-length='0'],
309
+ .x6-widget-selection-inner[data-selection-length='1'] {
310
+ display: none;
311
+ }
312
+ .x6-widget-selection-content {
313
+ position: absolute;
314
+ top: 100%;
315
+ right: -20px;
316
+ left: -20px;
317
+ margin-top: 30px;
318
+ padding: 6px;
319
+ line-height: 14px;
320
+ text-align: center;
321
+ border-radius: 6px;
322
+ }
323
+ .x6-widget-selection-content:empty {
324
+ display: none;
325
+ }
326
+ .x6-widget-selection-rubberband {
327
+ background-color: #3498db;
328
+ border: 2px solid #2980b9;
329
+ }
330
+ .x6-widget-selection-box {
331
+ box-sizing: content-box !important;
332
+ margin-top: -4px;
333
+ margin-left: -4px;
334
+ padding-right: 4px;
335
+ padding-bottom: 4px;
336
+ border: 2px dashed #feb663;
337
+ box-shadow: 2px 2px 5px #d3d3d3;
338
+ }
339
+ .x6-widget-selection-inner {
340
+ box-sizing: content-box !important;
341
+ margin-top: -8px;
342
+ margin-left: -8px;
343
+ padding-right: 12px;
344
+ padding-bottom: 12px;
345
+ border: 2px solid #feb663;
346
+ box-shadow: 2px 2px 5px #d3d3d3;
347
+ }
348
+ .x6-widget-selection-content {
349
+ color: #fff;
350
+ font-size: 10px;
351
+ background-color: #6a6b8a;
352
+ }
353
+ `;q.prototype.isSelectionEnabled=function(){let e=this.getPlugin(`selection`);return e?e.isEnabled():!1},q.prototype.enableSelection=function(){let e=this.getPlugin(`selection`);return e&&e.enable(),this},q.prototype.disableSelection=function(){let e=this.getPlugin(`selection`);return e&&e.disable(),this},q.prototype.toggleSelection=function(e){let t=this.getPlugin(`selection`);return t&&t.toggleEnabled(e),this},q.prototype.isMultipleSelection=function(){let e=this.getPlugin(`selection`);return e?e.isMultipleSelection():!1},q.prototype.enableMultipleSelection=function(){let e=this.getPlugin(`selection`);return e&&e.enableMultipleSelection(),this},q.prototype.disableMultipleSelection=function(){let e=this.getPlugin(`selection`);return e&&e.disableMultipleSelection(),this},q.prototype.toggleMultipleSelection=function(e){let t=this.getPlugin(`selection`);return t&&t.toggleMultipleSelection(e),this},q.prototype.isSelectionMovable=function(){let e=this.getPlugin(`selection`);return e?e.isSelectionMovable():!1},q.prototype.enableSelectionMovable=function(){let e=this.getPlugin(`selection`);return e&&e.enableSelectionMovable(),this},q.prototype.disableSelectionMovable=function(){let e=this.getPlugin(`selection`);return e&&e.disableSelectionMovable(),this},q.prototype.toggleSelectionMovable=function(e){let t=this.getPlugin(`selection`);return t&&t.toggleSelectionMovable(e),this},q.prototype.isRubberbandEnabled=function(){let e=this.getPlugin(`selection`);return e?e.isRubberbandEnabled():!1},q.prototype.enableRubberband=function(){let e=this.getPlugin(`selection`);return e&&e.enableRubberband(),this},q.prototype.disableRubberband=function(){let e=this.getPlugin(`selection`);return e&&e.disableRubberband(),this},q.prototype.toggleRubberband=function(e){let t=this.getPlugin(`selection`);return t&&t.toggleRubberband(e),this},q.prototype.isStrictRubberband=function(){let e=this.getPlugin(`selection`);return e?e.isStrictRubberband():!1},q.prototype.enableStrictRubberband=function(){let e=this.getPlugin(`selection`);return e&&e.enableStrictRubberband(),this},q.prototype.disableStrictRubberband=function(){let e=this.getPlugin(`selection`);return e&&e.disableStrictRubberband(),this},q.prototype.toggleStrictRubberband=function(e){let t=this.getPlugin(`selection`);return t&&t.toggleStrictRubberband(e),this},q.prototype.setRubberbandModifiers=function(e){let t=this.getPlugin(`selection`);return t&&t.setRubberbandModifiers(e),this},q.prototype.setSelectionFilter=function(e){let t=this.getPlugin(`selection`);return t&&t.setSelectionFilter(e),this},q.prototype.setSelectionDisplayContent=function(e){let t=this.getPlugin(`selection`);return t&&t.setSelectionDisplayContent(e),this},q.prototype.isSelectionEmpty=function(){let e=this.getPlugin(`selection`);return!e||e.isEmpty()},q.prototype.cleanSelection=function(e){let t=this.getPlugin(`selection`);return t&&t.clean(e),this},q.prototype.resetSelection=function(e,t){let n=this.getPlugin(`selection`);return n&&n.reset(e,t),this},q.prototype.getSelectedCells=function(){let e=this.getPlugin(`selection`);return e?e.getSelectedCells():[]},q.prototype.getSelectedCellCount=function(){let e=this.getPlugin(`selection`);return e?e.getSelectedCellCount():0},q.prototype.isSelected=function(e){let t=this.getPlugin(`selection`);return t?t.isSelected(e):!1},q.prototype.select=function(e,t){let n=this.getPlugin(`selection`);return n&&n.select(e,t),this},q.prototype.unselect=function(e,t){let n=this.getPlugin(`selection`);return n&&n.unselect(e,t),this};var Yy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Xy=class e extends Al{get rubberbandDisabled(){return this.options.enabled!==!0||this.options.rubberband!==!0}get disabled(){return this.options.enabled!==!0}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(t={}){super(),this.name=`selection`,this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},e.defaultOptions),t),Mf(this.name,Jy)}init(e){this.graph=e,this.selectionImpl=new Ky(Object.assign(Object.assign({},this.options),{graph:e})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(e){return e==null?this.isEnabled()?this.disable():this.enable():e!==this.isEnabled()&&(e?this.enable():this.disable()),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(e){return e==null?this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection():e!==this.isMultipleSelection()&&(e?this.enableMultipleSelection():this.disableMultipleSelection()),this}isSelectionMovable(){return this.options.movable!==!1}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(e){return e==null?this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable():e!==this.isSelectionMovable()&&(e?this.enableSelectionMovable():this.disableSelectionMovable()),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(e){return e==null?this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband():e!==this.isRubberbandEnabled()&&(e?this.enableRubberband():this.disableRubberband()),this}isStrictRubberband(){return this.selectionImpl.options.strict===!0}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(e){return e==null?this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband():e!==this.isStrictRubberband()&&(e?this.enableStrictRubberband():this.disableStrictRubberband()),this}setRubberbandModifiers(e){this.setModifiers(e)}setSelectionFilter(e){return this.setFilter(e),this}setSelectionDisplayContent(e){return this.setContent(e),this}isEmpty(){return this.length<=0}clean(e={}){return this.selectionImpl.clean(e),this}reset(e,t={}){return this.selectionImpl.reset(e?this.getCells(e):[],t),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(e){return this.selectionImpl.isSelected(e)}select(e,t={}){let n=this.getCells(e);return n.length&&(this.isMultiple()?this.selectionImpl.select(n,t):this.reset(n.slice(0,1),t)),this}unselect(e,t={}){return this.selectionImpl.unselect(this.getCells(e),t),this}setup(){this.selectionImpl.on(`*`,(e,t)=>{this.trigger(e,t),this.graph.trigger(e,t)})}startListening(){this.graph.on(`blank:mousedown`,this.onBlankMouseDown,this),this.graph.on(`blank:click`,this.onBlankClick,this),this.graph.on(`cell:mousemove`,this.onCellMouseMove,this),this.graph.on(`cell:mouseup`,this.onCellMouseUp,this),this.selectionImpl.on(`box:mousedown`,this.onBoxMouseDown,this)}stopListening(){this.graph.off(`blank:mousedown`,this.onBlankMouseDown,this),this.graph.off(`blank:click`,this.onBlankClick,this),this.graph.off(`cell:mousemove`,this.onCellMouseMove,this),this.graph.off(`cell:mouseup`,this.onCellMouseUp,this),this.selectionImpl.off(`box:mousedown`,this.onBoxMouseDown,this)}onBlankMouseDown({e}){if(!this.allowBlankMouseDown(e))return;let t=this.graph.panning.allowPanning(e,!0),n=this.graph.getPlugin(`scroller`),r=n&&n.allowPanning(e,!0);(this.allowRubberband(e,!0)||this.allowRubberband(e)&&!r&&!t)&&this.startRubberband(e)}allowBlankMouseDown(e){let t=this.options.eventTypes;return t?.includes(`leftMouseDown`)&&e.button===0||t?.includes(`mouseWheelDown`)&&e.button===1}onBlankClick(){this.clean()}allowRubberband(e,t){return!this.rubberbandDisabled&&Of.isMatch(e,this.options.modifiers,t)}allowMultipleSelection(e){return this.isMultiple()&&Of.isMatch(e,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:e}){this.movedMap.set(e,!0)}onCellMouseUp({e,cell:t}){let n=this.options,r=this.disabled;!r&&this.movedMap.has(t)&&(r=n.selectCellOnMoved===!1,r||=n.selectNodeOnMoved===!1&&t.isNode(),r||=n.selectEdgeOnMoved===!1&&t.isEdge()),r||(this.allowMultipleSelection(e)?this.unselectMap.has(t)?this.unselectMap.delete(t):this.isSelected(t)?this.unselect(t):this.select(t):this.reset(t)),this.movedMap.delete(t)}onBoxMouseDown({e,cell:t}){this.disabled||this.allowMultipleSelection(e)&&(this.unselect(t),this.unselectMap.set(t,!0))}getCells(e){return(Array.isArray(e)?e:[e]).map(e=>typeof e==`string`?this.graph.getCellById(e):e).filter(e=>e!=null)}startRubberband(e){return this.rubberbandDisabled||this.selectionImpl.startSelecting(e),this}isMultiple(){return this.options.multiple!==!1}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(e){return this.options.modifiers=e,this}setContent(e){return this.selectionImpl.setContent(e),this}setFilter(e){return this.selectionImpl.setFilter(e),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),Nf(this.name)}};Yy([Al.dispose()],Xy.prototype,`dispose`,null),(function(e){e.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:`auto`,multiple:!0,multipleSelectionModifiers:[`ctrl`,`meta`],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:[`leftMouseDown`,`mouseWheelDown`]}})(Xy||={});function Zy(e,t){let n=e!=null&&e!==``?Number(e):t;if(!(n===void 0||!Number.isFinite(n)||Number(n)<=0))return Number(n)}var Qy=class{constructor(){this._isDragging=!1,this._suppressNextClick=!1}get isDragging(){return this._isDragging}onDragStart(){this._isDragging=!0,this._suppressNextClick=!0}onDragEnd(){this._isDragging=!1}consumeClick(){return!this._suppressNextClick||(this._suppressNextClick=!1,!1)}},$y=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},eb=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},tb=class extends W{get model(){return this.graph.model}get containerClassName(){return this.prefixClassName(`widget-snapline`)}get verticalClassName(){return`${this.containerClassName}-vertical`}get horizontalClassName(){return`${this.containerClassName}-horizontal`}constructor(e){super();let{graph:t}=e,n=eb(e,[`graph`]);this.graph=t,this.options=Object.assign({},n),this.offset={x:0,y:0},this.render(),this.disabled||this.startListening()}get disabled(){return this.options.enabled!==!0}enable(){this.disabled&&(this.options.enabled=!0,this.startListening())}disable(){this.disabled||(this.options.enabled=!1,this.stopListening())}setFilter(e){this.options.filter=e}render(){let e=this.containerWrapper=new F(`svg`),t=this.horizontal=new F(`line`),n=this.vertical=new F(`line`);e.addClass(this.containerClassName),t.addClass(this.horizontalClassName),n.addClass(this.verticalClassName),e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`100%`),t.setAttribute(`display`,`none`),n.setAttribute(`display`,`none`),e.append([t,n]),this.options.className&&e.addClass(this.options.className),this.container=this.containerWrapper.node}startListening(){this.stopListening(),this.graph.on(`node:mousedown`,this.captureCursorOffset,this),this.graph.on(`node:mousemove`,this.snapOnMoving,this),this.model.on(`batch:stop`,this.onBatchStop,this),this.delegateDocumentEvents({mouseup:`hide`,touchend:`hide`})}stopListening(){this.graph.off(`node:mousedown`,this.captureCursorOffset,this),this.graph.off(`node:mousemove`,this.snapOnMoving,this),this.model.off(`batch:stop`,this.onBatchStop,this),this.undelegateDocumentEvents()}onBatchStop({name:e,data:t}){e===`resize`&&this.snapOnResizing(t.cell,t)}captureCursorOffset({view:e,x:t,y:n}){let r=e.getDelegatedView();if(r&&this.isNodeMovable(r)){let r=e.cell.getPosition();this.offset={x:t-r.x,y:n-r.y}}}isNodeMovable(e){return e&&e.cell.isNode()&&e.can(`nodeMovable`)}getRestrictArea(e){let t=this.graph.options.translating.restrict,n=typeof t==`function`?M(t,this.graph,e):t;return typeof n==`number`?this.graph.transform.getGraphArea().inflate(n):n===!0?this.graph.transform.getGraphArea():n||null}snapOnResizing(e,t){if(this.options.resizing&&!t.snapped&&t.ui&&t.direction&&t.trueDirection){let n=this.graph.renderer.findViewByCell(e);if(n&&n.cell.isNode()){let r=e.getBBox(),i=r.bbox(e.getAngle()),a=i.getTopLeft(),o=i.getBottomRight(),s=L.normalize(e.getAngle()),c=this.options.tolerance||0,l,u,d,f,p,m,h={vertical:0,horizontal:0},g=t.direction,_=t.trueDirection,v=t.relativeDirection;h.vertical=_.indexOf(`right`)===-1?a.x:o.x,h.horizontal=_.indexOf(`bottom`)===-1?a.y:o.y,this.model.getNodes().some(t=>{if(this.isIgnored(e,t))return!1;let n=t.getBBox().bbox(t.getAngle()),r=n.getTopLeft(),a=n.getBottomRight(),s={vertical:[r.x,a.x],horizontal:[r.y,a.y]},g={};return Object.keys(s).forEach(e=>{let t=e,n=s[t].map(e=>({position:e,distance:Math.abs(e-h[t])})).filter(e=>e.distance<=c);g[t]=Xc(n,e=>e.distance)}),l==null&&g.vertical.length>0&&(l=g.vertical[0].position,u=Math.min(i.y,n.y),d=Math.max(o.y,a.y)-u),f==null&&g.horizontal.length>0&&(f=g.horizontal[0].position,p=Math.min(i.x,n.x),m=Math.max(o.x,a.x)-p),l!=null&&f!=null}),this.hide();let y=0,b=0;(f!=null||l!=null)&&(l!=null&&(y=_.indexOf(`right`)===-1?a.x-l:l-o.x),f!=null&&(b=_.indexOf(`bottom`)===-1?a.y-f:f-o.y));let x=0,S=0;if(s%90==0)s===90||s===270?(x=b,S=y):(x=y,S=b);else{let e=s>=0&&s<90?1:s>=90&&s<180?4:s>=180&&s<270?3:2;f!=null&&l!=null&&(y<b?(b=0,f=void 0):(y=0,l=void 0));let t=L.toRad(s%90);y&&(x=e===3?y/Math.cos(t):y/Math.sin(t)),b&&(S=e===3?b/Math.cos(t):b/Math.sin(t));let n=e===1||e===3;switch(v){case`top`:case`bottom`:S=b?b/(n?Math.cos(t):Math.sin(t)):y/(n?Math.sin(t):Math.cos(t));break;case`left`:case`right`:x=y?y/(n?Math.cos(t):Math.sin(t)):b/(n?Math.sin(t):Math.cos(t))}}switch(v){case`top`:case`bottom`:x=0;break;case`left`:case`right`:S=0}let C=this.graph.getGridSize(),w=Math.max(r.width+x,C),T=Math.max(r.height+S,C);t.minWidth&&t.minWidth>C&&(w=Math.max(w,t.minWidth)),t.minHeight&&t.minHeight>C&&(T=Math.max(T,t.minHeight)),t.maxWidth&&(w=Math.min(w,t.maxWidth)),t.maxHeight&&(T=Math.min(T,t.maxHeight)),t.preserveAspectRatio&&(S<x?T=w*(r.height/r.width):w=T*(r.width/r.height)),(w!==r.width||T!==r.height)&&(e.resize(w,T,{direction:g,relativeDirection:v,trueDirection:_,snapped:!0,snaplines:this.cid,restrict:this.getRestrictArea(n)}),d&&(d+=T-r.height),m&&(m+=w-r.width));let E=e.getBBox().bbox(s);l&&Math.abs(E.x-l)>1&&Math.abs(E.width+E.x-l)>1&&(l=void 0),f&&Math.abs(E.y-f)>1&&Math.abs(E.height+E.y-f)>1&&(f=void 0),this.update({verticalLeft:l,verticalTop:u,verticalHeight:d,horizontalTop:f,horizontalLeft:p,horizontalWidth:m})}}}snapOnMoving({view:e,e:t,x:n,y:r}){let i=e.getEventData(t).delegatedView||e;if(!this.isNodeMovable(i))return;let a=i.cell,o=a.getSize(),s=a.getPosition(),c=new B(n-this.offset.x,r-this.offset.y,o.width,o.height),l=a.getAngle(),u=c.getCenter(),d=c.bbox(l),f=d.getTopLeft(),p=d.getBottomRight(),m=this.options.tolerance||0,h,g,_,v,y,b,x=0,S=0;if(this.model.getNodes().some(e=>{if(this.isIgnored(a,e))return!1;let t=e.getBBox().bbox(e.getAngle()),n=t.getCenter(),r=t.getTopLeft(),i=t.getBottomRight();return h??(Math.abs(n.x-u.x)<m?(h=n.x,x=.5):Math.abs(r.x-f.x)<m?(h=r.x,x=0):Math.abs(r.x-p.x)<m?(h=r.x,x=1):Math.abs(i.x-p.x)<m?(h=i.x,x=1):Math.abs(i.x-f.x)<m&&(h=i.x),h!=null&&(g=Math.min(d.y,t.y),_=Math.max(p.y,i.y)-g)),v??(Math.abs(n.y-u.y)<m?(v=n.y,S=.5):Math.abs(r.y-f.y)<m?v=r.y:Math.abs(r.y-p.y)<m?(v=r.y,S=1):Math.abs(i.y-p.y)<m?(v=i.y,S=1):Math.abs(i.y-f.y)<m&&(v=i.y),v!=null&&(y=Math.min(d.x,t.x),b=Math.max(p.x,i.x)-y)),h!=null&&v!=null}),this.hide(),v!=null||h!=null){v!=null&&(d.y=v-S*d.height),h!=null&&(d.x=h-x*d.width);let e=d.getCenter(),t=e.x-c.width/2,n=e.y-c.height/2,r=t-s.x,o=n-s.y;(r!==0||o!==0)&&(a.translate(r,o,{snapped:!0,restrict:this.getRestrictArea(i)}),b&&(b+=r),_&&(_+=o)),this.update({verticalLeft:h,verticalTop:g,verticalHeight:_,horizontalTop:v,horizontalLeft:y,horizontalWidth:b})}}isIgnored(e,t){return t.id===e.id||t.isDescendantOf(e)||!this.filter(t)}filter(e){let t=this.options.filter;return Array.isArray(t)?t.some(t=>typeof t==`string`?e.shape===t:e.id===t.id):typeof t!=`function`||M(t,this.graph,e)}update(e){if(e.horizontalTop){let t=this.graph.localToGraph(new z(e.horizontalLeft,e.horizontalTop)),n=this.graph.localToGraph(new z(e.horizontalLeft+e.horizontalWidth,e.horizontalTop));this.horizontal.setAttributes({x1:this.options.sharp?`${t.x}`:`0`,y1:`${t.y}`,x2:this.options.sharp?`${n.x}`:`100%`,y2:`${n.y}`,display:`inherit`})}else this.horizontal.setAttribute(`display`,`none`);if(e.verticalLeft){let t=this.graph.localToGraph(new z(e.verticalLeft,e.verticalTop)),n=this.graph.localToGraph(new z(e.verticalLeft,e.verticalTop+e.verticalHeight));this.vertical.setAttributes({x1:`${t.x}`,y1:this.options.sharp?`${t.y}`:`0`,x2:`${n.x}`,y2:this.options.sharp?`${n.y}`:`100%`,display:`inherit`})}else this.vertical.setAttribute(`display`,`none`);this.show()}resetTimer(){this.timer&&=(clearTimeout(this.timer),null)}show(){return this.resetTimer(),this.container.parentNode??this.graph.container.appendChild(this.container),this}hide(){this.resetTimer(),this.vertical.setAttribute(`display`,`none`),this.horizontal.setAttribute(`display`,`none`);let e=this.options.clean,t=typeof e==`number`?e:e===!1?0:3e3;return t>0&&(this.timer=window.setTimeout(()=>{this.container.parentNode!==null&&this.unmount()},t)),this}onRemove(){this.stopListening(),this.hide()}dispose(){this.remove()}};$y([W.dispose()],tb.prototype,`dispose`,null);var nb=`.x6-widget-snapline {
354
+ position: absolute;
355
+ top: 0;
356
+ right: 0;
357
+ bottom: 0;
358
+ left: 0;
359
+ pointer-events: none;
360
+ }
361
+ .x6-widget-snapline-vertical,
362
+ .x6-widget-snapline-horizontal {
363
+ stroke: #2ecc71;
364
+ stroke-width: 1px;
365
+ }
366
+ `;q.prototype.isSnaplineEnabled=function(){let e=this.getPlugin(`snapline`);return e?e.isEnabled():!1},q.prototype.enableSnapline=function(){let e=this.getPlugin(`snapline`);return e&&e.enable(),this},q.prototype.disableSnapline=function(){let e=this.getPlugin(`snapline`);return e&&e.disable(),this},q.prototype.toggleSnapline=function(){let e=this.getPlugin(`snapline`);return e&&e.toggleEnabled(),this},q.prototype.hideSnapline=function(){let e=this.getPlugin(`snapline`);return e&&e.hide(),this},q.prototype.setSnaplineFilter=function(e){let t=this.getPlugin(`snapline`);return t&&t.setFilter(e),this},q.prototype.isSnaplineOnResizingEnabled=function(){let e=this.getPlugin(`snapline`);return e?e.isOnResizingEnabled():!1},q.prototype.enableSnaplineOnResizing=function(){let e=this.getPlugin(`snapline`);return e&&e.enableOnResizing(),this},q.prototype.disableSnaplineOnResizing=function(){let e=this.getPlugin(`snapline`);return e&&e.disableOnResizing(),this},q.prototype.toggleSnaplineOnResizing=function(e){let t=this.getPlugin(`snapline`);return t&&t.toggleOnResizing(e),this},q.prototype.isSharpSnapline=function(){let e=this.getPlugin(`snapline`);return e?e.isSharp():!1},q.prototype.enableSharpSnapline=function(){let e=this.getPlugin(`snapline`);return e&&e.enableSharp(),this},q.prototype.disableSharpSnapline=function(){let e=this.getPlugin(`snapline`);return e&&e.disableSharp(),this},q.prototype.toggleSharpSnapline=function(e){let t=this.getPlugin(`snapline`);return t&&t.toggleSharp(e),this},q.prototype.getSnaplineTolerance=function(){let e=this.getPlugin(`snapline`);if(e)return e.getTolerance()},q.prototype.setSnaplineTolerance=function(e){let t=this.getPlugin(`snapline`);return t&&t.setTolerance(e),this};var rb=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ib=class extends r{constructor(e={}){super(),this.name=`snapline`,this.options=Object.assign({enabled:!0,tolerance:10},e),Mf(this.name,nb)}init(e){this.snaplineImpl=new tb(Object.assign(Object.assign({},this.options),{graph:e}))}isEnabled(){return!this.snaplineImpl.disabled}enable(){this.snaplineImpl.enable()}disable(){this.snaplineImpl.disable()}toggleEnabled(e){if(e!=null)e!==this.isEnabled()&&(e?this.enable():this.disable());else return this.isEnabled()?this.disable():this.enable(),this}hide(){return this.snaplineImpl.hide(),this}setFilter(e){return this.snaplineImpl.setFilter(e),this}isOnResizingEnabled(){return this.snaplineImpl.options.resizing===!0}enableOnResizing(){return this.snaplineImpl.options.resizing=!0,this}disableOnResizing(){return this.snaplineImpl.options.resizing=!1,this}toggleOnResizing(e){return e==null?this.isOnResizingEnabled()?this.disableOnResizing():this.enableOnResizing():e!==this.isOnResizingEnabled()&&(e?this.enableOnResizing():this.disableOnResizing()),this}isSharp(){return this.snaplineImpl.options.sharp===!0}enableSharp(){return this.snaplineImpl.options.sharp=!0,this}disableSharp(){return this.snaplineImpl.options.sharp=!1,this}toggleSharp(e){return e==null?this.isSharp()?this.disableSharp():this.enableSharp():e!==this.isSharp()&&(e?this.enableSharp():this.disableSharp()),this}getTolerance(){return this.snaplineImpl.options.tolerance}setTolerance(e){return this.snaplineImpl.options.tolerance=e,this}captureCursorOffset(e){this.snaplineImpl.captureCursorOffset(e)}snapOnMoving(e){this.snaplineImpl.snapOnMoving(e)}dispose(){this.snaplineImpl.dispose(),Nf(this.name)}};rb([r.dispose()],ib.prototype,`dispose`,null);var ab={documentChange:`document-change`,selectionChange:`selection-change`,command:`command`,issueFocus:`issue-focus`};function ob(e,t,n){return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:n??t}function sb(e,t){return(e??[]).filter(t)}var cb={fontFamily:`inherit`,surfaceColor:`var(--bs-body-bg, #ffffff)`,borderColor:`var(--bs-gray-300, #dbdfe9)`,textColor:`var(--bs-gray-900, #071437)`,mutedTextColor:`var(--bs-gray-600, #78829d)`,primaryColor:`var(--bs-primary, #1b84ff)`,dangerColor:`var(--bs-danger, #f8285a)`,warningColor:`var(--bs-warning, #f6c000)`,successColor:`var(--bs-success, #17c653)`};function lb(e){return{...cb,...e??{}}}function ub(e){return[`--wf-font-family:${e.fontFamily}`,`--wf-surface:${e.surfaceColor}`,`--wf-border:${e.borderColor}`,`--wf-text:${e.textColor}`,`--wf-muted:${e.mutedTextColor}`,`--wf-primary:${e.primaryColor}`,`--wf-danger:${e.dangerColor}`,`--wf-warning:${e.warningColor}`,`--wf-success:${e.successColor}`].join(`;`)}function db(e,t){if(!(typeof e!=`number`||!Number.isInteger(e)||e<=0)&&e!==t)return{kind:e>t?`designer-outdated`:`server-outdated`,serverVersion:e,designerVersion:t}}var fb=new WeakMap,pb=0;function mb(e){let t=e=>{if(e==null)return`null`;if(typeof e==`function`){let t=fb.get(e);return t===void 0&&(t=pb++,fb.set(e,t)),`fn:`+t+`:`+e.name}return Array.isArray(e)?`[`+e.map(t).join(`,`)+`]`:typeof e==`object`?`{`+Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,n])=>JSON.stringify(e)+`:`+t(n)).join(`,`)+`}`:JSON.stringify(e)??`null`};return t(e)}var hb={restore:()=>void 0},gb=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`file`,`color`,`range`]);function _b(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&!gb.has(e.type)}function vb(e){let t=Array.from(e.attributes).filter(e=>e.name.startsWith(`data-`)||e.name===`name`||e.name===`id`).map(e=>`${e.name}=${e.value}`).sort(),n=Array.from(e.classList).sort();return[e.tagName.toLowerCase(),...n,...t].join(`|`)}function yb(e){try{return{start:e.selectionStart,end:e.selectionEnd}}catch{return{start:null,end:null}}}function bb(e,t,n){if(t!==null&&n!==null)try{e.setSelectionRange(t,n)}catch{}}function xb(e){let t=e.activeElement;if(!t||!(t instanceof HTMLElement))return hb;let n=vb(t),r=_b(t)?t:void 0,i=r?.value,{start:a,end:o}=r?yb(r):{start:null,end:null};return{restore:()=>{if(t.isConnected&&e.activeElement===t)return;let s=t.tagName.toLowerCase(),c=Array.from(e.querySelectorAll(s)).find(e=>vb(e)===n);if(c&&!c.disabled){if(r&&_b(c)&&i!==void 0&&c.value!==i){let e=c.value;c.value=i;let t=!1;c.addEventListener(`change`,()=>t=!0,{once:!0}),c.addEventListener(`blur`,()=>{!t&&c.value!==e&&c.dispatchEvent(new Event(`change`,{bubbles:!0}))},{once:!0})}c.focus({preventScroll:!0}),_b(c)&&bb(c,a,o)}}}}function Sb(e,t){let n=xb(e),r=t();return n.restore(),r}var Cb=class extends HTMLElement{constructor(){super(),this._permissions={canEdit:!0},this._capabilities={},this._lookups={},this._issues=[],this._connected=!1,this._stylesAdopted=!1,this._dispatchingChange=!1,this._hostFingerprints=new Map,this.root=this.attachShadow({mode:`open`}),this.hostValueChanged(`localization`,this._localization),this.hostValueChanged(`theme`,this._theme),this.hostValueChanged(`permissions`,this._permissions),this.hostValueChanged(`capabilities`,this._capabilities),this.hostValueChanged(`validationIssues`,this._issues),this.root.addEventListener(`change`,()=>{this._dispatchingChange=!0,queueMicrotask(()=>this._dispatchingChange=!1)},!0)}get localization(){return this._localization}set localization(e){this.hostValueChanged(`localization`,e)?(this._localization=e,this.requestHostRender()):this._localization=e}get theme(){return this._theme}set theme(e){this.hostValueChanged(`theme`,e)?(this._theme=e,this.applyTheme(),this.requestHostRender()):this._theme=e}get permissions(){return this._permissions}set permissions(e){let t=e??{canEdit:!0};this.hostValueChanged(`permissions`,t)?(this._permissions=t,this.requestHostRender()):this._permissions=t}get capabilities(){return this._capabilities}set capabilities(e){let t=e??{};this.hostValueChanged(`capabilities`,t)?(this._capabilities=t,this.requestHostRender()):this._capabilities=t}get lookups(){return this._lookups}set lookups(e){this._lookups=e??{}}get validationIssues(){return this._issues}set validationIssues(e){let t=e??[];this.hostValueChanged(`validationIssues`,t)?(this._issues=t,this.requestHostRender()):this._issues=t}get readOnly(){return this._permissions.canEdit===!1}set readOnly(e){let t=!e;this._permissions.canEdit!==t&&(this._permissions={...this._permissions,canEdit:t},this.hostValueChanged(`permissions`,this._permissions),this.requestHostRender())}connectedCallback(){this._connected=!0,this.applyTheme(),this.render()}disconnectedCallback(){this._connected=!1}l(e,t){return ob(this._localization,e,t)}emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}hostValueChanged(e,t){let n=mb(t);return this._hostFingerprints.get(e)!==n&&(this._hostFingerprints.set(e,n),!0)}requestRender(){this._connected&&this.render()}requestHostRender(){this._connected&&(this._dispatchingChange?this.render():Sb(this.root,()=>this.render()))}adoptStyles(e){if(!this._stylesAdopted){if(typeof CSSStyleSheet==`function`&&Array.isArray(this.root.adoptedStyleSheets))try{let t=new CSSStyleSheet;t.replaceSync(e),this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,t],this._stylesAdopted=!0;return}catch{this._stylesAdopted=!1}this._styleElement&&this._styleElement.parentNode===this.root||(this._styleElement=document.createElement(`style`),this._styleElement.textContent=e,this.root.appendChild(this._styleElement))}}applyTheme(){this.style.cssText=ub(lb(this._theme))}},wb=3,Tb=1,J=function(e){return e[e.Start=1]=`Start`,e[e.FormSubmission=2]=`FormSubmission`,e[e.Approval=3]=`Approval`,e[e.Condition=4]=`Condition`,e[e.Notification=5]=`Notification`,e[e.Action=6]=`Action`,e[e.Approved=7]=`Approved`,e[e.Rejected=8]=`Rejected`,e[e.Cancelled=9]=`Cancelled`,e[e.Parallel=10]=`Parallel`,e[e.Join=11]=`Join`,e[e.Timer=12]=`Timer`,e[e.Subprocess=13]=`Subprocess`,e[e.EventWait=14]=`EventWait`,e[e.SendSlackMessage=15]=`SendSlackMessage`,e[e.SendTeamsMessage=16]=`SendTeamsMessage`,e[e.RunAiAgent=17]=`RunAiAgent`,e}({}),Y=function(e){return e[e.Default=1]=`Default`,e[e.Approved=2]=`Approved`,e[e.Rejected=3]=`Rejected`,e[e.ChangesRequested=4]=`ChangesRequested`,e[e.ConditionBranch=5]=`ConditionBranch`,e[e.Otherwise=6]=`Otherwise`,e[e.ParallelBranch=7]=`ParallelBranch`,e[e.TimerElapsed=8]=`TimerElapsed`,e[e.SubprocessCompleted=9]=`SubprocessCompleted`,e[e.SubprocessRejected=10]=`SubprocessRejected`,e[e.EventReceived=11]=`EventReceived`,e[e.EventTimeout=12]=`EventTimeout`,e}({}),X=function(e){return e[e.ShortText=1]=`ShortText`,e[e.LongText=2]=`LongText`,e[e.Number=3]=`Number`,e[e.Money=4]=`Money`,e[e.Date=5]=`Date`,e[e.Time=6]=`Time`,e[e.DateTime=7]=`DateTime`,e[e.Boolean=8]=`Boolean`,e[e.SingleSelect=9]=`SingleSelect`,e[e.MultiSelect=10]=`MultiSelect`,e[e.UserPicker=11]=`UserPicker`,e[e.RolePicker=12]=`RolePicker`,e[e.OrganizationUnitPicker=13]=`OrganizationUnitPicker`,e[e.FileAttachment=14]=`FileAttachment`,e[e.StaticText=15]=`StaticText`,e[e.Repeater=16]=`Repeater`,e[e.Calculated=17]=`Calculated`,e}({}),Eb=function(e){return e[e.Anyone=1]=`Anyone`,e[e.Everyone=2]=`Everyone`,e[e.Quorum=3]=`Quorum`,e}({}),Db=function(e){return e[e.User=1]=`User`,e[e.Role=2]=`Role`,e[e.OrganizationUnit=3]=`OrganizationUnit`,e[e.RequesterManager=4]=`RequesterManager`,e[e.RoleInRequesterOrganizationUnit=5]=`RoleInRequesterOrganizationUnit`,e[e.PreviousStepApprover=6]=`PreviousStepApprover`,e[e.FallbackRole=7]=`FallbackRole`,e}({}),Ob=function(e){return e[e.RejectImmediately=1]=`RejectImmediately`,e[e.WaitForEveryone=2]=`WaitForEveryone`,e}({}),kb=function(e){return e[e.TenantDefault=0]=`TenantDefault`,e[e.Deny=1]=`Deny`,e[e.Allow=2]=`Allow`,e[e.SkipStep=3]=`SkipStep`,e}({}),Ab=function(e){return e[e.Group=1]=`Group`,e[e.Comparison=2]=`Comparison`,e}({}),jb=function(e){return e[e.And=1]=`And`,e[e.Or=2]=`Or`,e[e.Not=3]=`Not`,e}({}),Mb=function(e){return e[e.FormField=1]=`FormField`,e[e.Constant=2]=`Constant`,e[e.RequesterContext=3]=`RequesterContext`,e[e.TenantContext=4]=`TenantContext`,e[e.SystemContext=5]=`SystemContext`,e[e.Variable=6]=`Variable`,e}({}),Nb=function(e){return e[e.Equals=1]=`Equals`,e[e.NotEquals=2]=`NotEquals`,e[e.GreaterThan=3]=`GreaterThan`,e[e.GreaterOrEqual=4]=`GreaterOrEqual`,e[e.LessThan=5]=`LessThan`,e[e.LessOrEqual=6]=`LessOrEqual`,e[e.Contains=7]=`Contains`,e[e.NotContains=8]=`NotContains`,e[e.In=9]=`In`,e[e.NotIn=10]=`NotIn`,e[e.IsEmpty=11]=`IsEmpty`,e[e.IsNotEmpty=12]=`IsNotEmpty`,e}({}),Pb=function(e){return e[e.String=1]=`String`,e[e.Number=2]=`Number`,e[e.Boolean=3]=`Boolean`,e[e.Date=4]=`Date`,e[e.Time=5]=`Time`,e[e.DateTime=6]=`DateTime`,e[e.Money=7]=`Money`,e[e.Duration=8]=`Duration`,e[e.StringList=9]=`StringList`,e[e.NumberList=10]=`NumberList`,e}({}),Fb=function(e){return e[e.InApp=1]=`InApp`,e[e.Email=2]=`Email`,e[e.Teams=3]=`Teams`,e[e.Slack=4]=`Slack`,e}({}),Ib=function(e){return e[e.Text=1]=`Text`,e[e.Number=2]=`Number`,e[e.Boolean=3]=`Boolean`,e[e.Date=4]=`Date`,e[e.DateTime=5]=`DateTime`,e[e.UserId=6]=`UserId`,e[e.Json=7]=`Json`,e[e.Secret=8]=`Secret`,e[e.RoleId=9]=`RoleId`,e[e.OrganizationUnitId=10]=`OrganizationUnitId`,e[e.ConnectionProfileId=11]=`ConnectionProfileId`,e[e.Enum=12]=`Enum`,e}({});function Lb(e){return e?.formFieldId?`formField`:e?.contextKey?`context`:`constant`}var Rb=function(e){return e[e.WaitAll=1]=`WaitAll`,e[e.WaitAny=2]=`WaitAny`,e[e.WaitCount=3]=`WaitCount`,e}({}),zb=function(e){return e[e.Duration=1]=`Duration`,e[e.FormFieldDate=2]=`FormFieldDate`,e[e.FixedDate=3]=`FixedDate`,e}({}),Bb=function(e){return e[e.SingleOutcome=1]=`SingleOutcome`,e[e.ApprovalOutcome=2]=`ApprovalOutcome`,e}({}),Vb=function(e){return e[e.BusinessKey=1]=`BusinessKey`,e[e.ReferenceNumber=2]=`ReferenceNumber`,e[e.FormField=3]=`FormField`,e}({}),Hb=function(e){return e[e.ContinueTimeoutPath=1]=`ContinueTimeoutPath`,e[e.NeedsAttention=2]=`NeedsAttention`,e[e.Cancel=3]=`Cancel`,e}({}),Ub=function(e){return e[e.Manual=1]=`Manual`,e[e.Template=2]=`Template`,e[e.Bpmn=3]=`Bpmn`,e[e.Ai=4]=`Ai`,e}({}),Wb={instance:1,branch:2},Gb=function(e){return e[e.Sum=1]=`Sum`,e[e.Subtract=2]=`Subtract`,e[e.Multiply=3]=`Multiply`,e[e.Average=4]=`Average`,e[e.Min=5]=`Min`,e[e.Max=6]=`Max`,e[e.Count=7]=`Count`,e}({}),Kb=function(e){return e[e.NotVisited=0]=`NotVisited`,e[e.Active=1]=`Active`,e[e.Completed=2]=`Completed`,e[e.Skipped=3]=`Skipped`,e[e.Faulted=4]=`Faulted`,e[e.Cancelled=5]=`Cancelled`,e}({});function qb(){return{schemaVersion:3,nodes:[],edges:[],metadata:{}}}function Jb(){return{schemaVersion:1,sections:[],fields:[]}}function Z(e,t=``){return e?.defaultValue??t}function Yb(e){return{defaultValue:e}}function Xb(e){switch(e){case 3:case 17:return 2;case 4:return 7;case 5:return 4;case 6:return 5;case 7:return 6;case 8:return 3;case 10:case 11:case 12:case 13:case 14:return 9;default:return 1}}function Zb(e){return e===11||e===12}function Qb(e){return e===9||e===10}function $b(e){return e===3||e===4||e===5||e===6}function ex(e){return e===9||e===10}function tx(e){let t=[11,12];if(ex(e))return[7,8,9,10,...t];let n=[1,2];switch(e){case 2:case 7:case 8:case 4:case 5:case 6:return[...n,3,4,5,6,...t];case 3:return[...n,...t];default:return[...n,7,8,9,10,...t]}}var Q={singleLine:`singleline`,multiLine:`multiline`,checkbox:`checkbox`,checkList:`checklist`,radioList:`radiolist`,dropDown:`dropdown`,multiText:`multitext`,dictionary:`dictionary`,jsonEditor:`json-editor`,dateTimePicker:`datetime-picker`,variablePicker:`variable-picker`,outputPicker:`output-picker`,outcomePicker:`outcome-picker`,dynamicOutcomes:`dynamic-outcomes`,workflowDefinitionPicker:`workflow-definition-picker`,expressionEditor:`expression-editor`,secretPicker:`secret-picker`,connectionDropDown:`connection-dropdown`,httpStatusCodes:`http-status-codes`,assigneePicker:`assignee-picker`,rolePicker:`role-picker`,organizationUnitPicker:`organization-unit-picker`,formFieldPicker:`form-field-picker`,conditionBuilder:`condition-builder`,fieldMappingTable:`field-mapping-table`,slaEditor:`sla-editor`,channelEditor:`channel-editor`,adaptiveCardEditor:`adaptive-card-editor`,eventPayloadMappingTable:`event-payload-mapping-table`,actionParameterTable:`action-parameter-table`,conditionBranchTable:`condition-branch-table`,parallelBranchTable:`parallel-branch-table`,startTriggerEditor:`start-trigger-editor`,notificationRecipients:`notification-recipients`},nx={literal:`Literal`,formField:`FormField`,context:`Context`,variable:`Variable`,output:`Output`,condition:`Condition`,template:`Template`,secret:`Secret`};function rx(e,t){if(e==null||!t)return;let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}var ix=`WorkflowLocalizableText`;function ax(e,t,n){if(e.typeName!==`WorkflowLocalizableText`||t!=null&&typeof t!=`string`)return t;let r=typeof t==`string`?t:``;if(r.trim().length!==0)return{...n&&typeof n==`object`?n:{},defaultValue:r}}function ox(e,t,n){if(!t)return e;let r=t.split(`.`),i=r[0],a=e??{};if(r.length===1)return{...a,[i]:n};let o=a[i],s=o&&typeof o==`object`?o:{};return{...a,[i]:ox(s,r.slice(1).join(`.`),n)}}function sx(e){let t=[];for(let n of cx(e)){let e=n.category??``;t.includes(e)||t.push(e)}return t}function cx(e){return[...e??[]].filter(e=>e.isBrowsable!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}function lx(e){return Array.isArray(e)?e.map(e=>lx(e)):typeof e==`object`&&e?{...e}:e}function ux(e){let t=e.uiSpecifications;if(!t)return;let n=dx(t,`VisibleWhen`);if(!n||typeof n!=`object`)return;let r=n,i=dx(r,`Input`),a=dx(r,`EqualsAnyOf`);if(typeof i==`string`&&i.length!==0)return{input:i,equalsAnyOf:Array.isArray(a)?a:a===void 0?[]:[a],isNotEmpty:dx(r,`IsNotEmpty`)===!0}}function dx(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let n=Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase());return n?e[n]:void 0}function fx(e,t){if(e.isBrowsable===!1)return!1;let n=ux(e);if(!n)return!0;let r=rx(t,n.input);return n.isNotEmpty?Array.isArray(r)?r.length>0:r!=null&&r!==``:n.equalsAnyOf.some(e=>px(e,r))}function px(e,t){return e===t?!0:e==null||t==null?!1:String(e)===String(t)}function mx(e,t){return cx(e).filter(e=>fx(e,t))}var hx=[{id:`flow`,localizationKey:`WorkflowNodeCategory_Flow`,fallbackLabel:`Flow`},{id:`human`,localizationKey:`WorkflowNodeCategory_Human`,fallbackLabel:`Human tasks`},{id:`control`,localizationKey:`WorkflowNodeCategory_Control`,fallbackLabel:`Control`},{id:`integration`,localizationKey:`WorkflowNodeCategory_Integration`,fallbackLabel:`Integration`},{id:`terminal`,localizationKey:`WorkflowNodeCategory_Terminal`,fallbackLabel:`Outcomes`}],gx={Flow:`flow`,Human:`human`,Notification:`integration`,Integration:`integration`,Outcome:`terminal`,Chat:`integration`,Ai:`integration`},_x=new Map([[J.Start,{category:`flow`,icon:`▶`,iconName:`start`,color:`#17c653`}],[J.FormSubmission,{category:`human`,icon:`▤`,iconName:`form`,color:`#1b84ff`}],[J.Approval,{category:`human`,icon:`✓`,iconName:`approval`,color:`#7239ea`}],[J.Condition,{category:`control`,icon:`◆`,iconName:`condition`,color:`#f1860b`}],[J.Parallel,{category:`control`,icon:`⑂`,iconName:`parallel`,color:`#3f51d8`}],[J.Join,{category:`control`,icon:`⑃`,iconName:`join`,color:`#3f51d8`}],[J.Timer,{category:`control`,icon:`◷`,iconName:`timer`,color:`#0e9f8e`}],[J.Notification,{category:`integration`,icon:`✉`,iconName:`notification`,color:`#0ba5ec`}],[J.Action,{category:`integration`,icon:`⚙`,iconName:`action`,color:`#e0337f`}],[J.Subprocess,{category:`integration`,icon:`⧉`,iconName:`subprocess`,color:`#6941c6`}],[J.EventWait,{category:`integration`,icon:`⏸`,iconName:`eventWait`,color:`#c11574`}],[J.Approved,{category:`terminal`,icon:`●`,iconName:`approved`,color:`#17c653`}],[J.Rejected,{category:`terminal`,icon:`●`,iconName:`rejected`,color:`#f8285a`}],[J.Cancelled,{category:`terminal`,icon:`●`,iconName:`cancelled`,color:`#78829d`}]]),vx={category:`integration`,icon:`?`,iconName:`unknown`,color:`#f1860b`};function yx(e,t){_x.set(e,t)}function bx(e){if(!e)return vx;let t=e.legacyNodeType===void 0?void 0:_x.get(e.legacyNodeType);if(t)return t;let n=e.category?gx[e.category]:void 0;return{...vx,category:n??vx.category}}var xx={[Y.Default]:{key:`WorkflowEdgeKind_Default`,fallback:`Next`,color:`#99a1b7`},[Y.Approved]:{key:`WorkflowEdgeKind_Approved`,fallback:`Approved`,color:`#17c653`},[Y.Rejected]:{key:`WorkflowEdgeKind_Rejected`,fallback:`Rejected`,color:`#f8285a`},[Y.ChangesRequested]:{key:`WorkflowEdgeKind_ChangesRequested`,fallback:`Changes requested`,color:`#e8a300`},[Y.ConditionBranch]:{key:`WorkflowEdgeKind_ConditionBranch`,fallback:`Branch`,color:`#f1860b`},[Y.Otherwise]:{key:`WorkflowEdgeKind_Otherwise`,fallback:`Otherwise`,color:`#99a1b7`},[Y.ParallelBranch]:{key:`WorkflowEdgeKind_ParallelBranch`,fallback:`Parallel branch`,color:`#3f51d8`},[Y.TimerElapsed]:{key:`WorkflowEdgeKind_TimerElapsed`,fallback:`After delay`,color:`#0e9f8e`},[Y.SubprocessCompleted]:{key:`WorkflowEdgeKind_SubprocessCompleted`,fallback:`Completed`,color:`#17c653`},[Y.SubprocessRejected]:{key:`WorkflowEdgeKind_SubprocessRejected`,fallback:`Rejected`,color:`#f8285a`},[Y.EventReceived]:{key:`WorkflowEdgeKind_EventReceived`,fallback:`Event received`,color:`#17c653`},[Y.EventTimeout]:{key:`WorkflowEdgeKind_EventTimeout`,fallback:`Timed out`,color:`#e8a300`}},Sx={key:`WorkflowEdgeKind_Unknown`,fallback:`Outcome`,color:`#99a1b7`};function Cx(e){return e===void 0?Sx:xx[e]??Sx}var wx=new Set([Y.ChangesRequested,Y.SubprocessRejected,Y.EventTimeout]);function Tx(e){return(e??[]).filter(e=>e.edgeKind!==void 0).map(e=>{let t=Cx(e.edgeKind);return{kind:e.edgeKind,localizationKey:t.key,fallbackLabel:e.displayName??t.fallback,color:t.color,isDynamic:e.isDynamic===!0,isOptional:wx.has(e.edgeKind)}})}var Ex={[J.Start]:[{name:`Done`,edgeKind:Y.Default}],[J.FormSubmission]:[{name:`Done`,edgeKind:Y.Default}],[J.Approval]:[{name:`Approved`,edgeKind:Y.Approved},{name:`Rejected`,edgeKind:Y.Rejected},{name:`ChangesRequested`,edgeKind:Y.ChangesRequested}],[J.Condition]:[{name:`Branch`,edgeKind:Y.ConditionBranch,isDynamic:!0,expansionSource:`condition.branches`},{name:`Otherwise`,edgeKind:Y.Otherwise}],[J.Parallel]:[{name:`Branch`,edgeKind:Y.ParallelBranch,isDynamic:!0,expansionSource:`parallel.joinNodeId`}],[J.Join]:[{name:`Done`,edgeKind:Y.Default}],[J.Timer]:[{name:`Elapsed`,edgeKind:Y.TimerElapsed}],[J.Notification]:[{name:`Done`,edgeKind:Y.Default}],[J.Action]:[{name:`Done`,edgeKind:Y.Default}],[J.Subprocess]:[{name:`Completed`,edgeKind:Y.SubprocessCompleted},{name:`Rejected`,edgeKind:Y.SubprocessRejected}],[J.EventWait]:[{name:`Received`,edgeKind:Y.EventReceived},{name:`Timeout`,edgeKind:Y.EventTimeout}],[J.SendSlackMessage]:[{name:`Done`,edgeKind:Y.Default}],[J.SendTeamsMessage]:[{name:`Done`,edgeKind:Y.Default}],[J.RunAiAgent]:[{name:`Done`,edgeKind:Y.Default}]},Dx=new Set([J.Approved,J.Rejected,J.Cancelled]),Ox={[J.EventWait]:`eventWaitEnabled`,[J.SendSlackMessage]:`slackEnabled`,[J.SendTeamsMessage]:`teamsEnabled`,[J.Action]:`externalActionsEnabled`};function kx(){return Object.entries(J).filter(([,e])=>typeof e==`number`).map(([e,t])=>({type:t,name:e})).sort((e,t)=>e.type-t.type)}var Ax={[J.FormSubmission]:{"formSubmission.allowAttachments":!0,"formSubmission.allowWithdraw":!0},[J.Approval]:{"approval.targets":[],"approval.approvalPolicy":1,"approval.rejectionPolicy":1,"approval.selfApprovalPolicy":0,"approval.allowDelegation":!0,"approval.allowRequestChanges":!0,"approval.requireReasonOnApprove":!1,"approval.requireReasonOnReject":!0,"approval.requireReasonOnRequestChanges":!1,"channels.allowDecisionFromChannel":!1},[J.Condition]:{"condition.branches":[]},[J.RunAiAgent]:{"runAiAgent.continueOnFailure":!1},[J.Notification]:{"notification.sendInApp":!0,"notification.sendEmail":!1},[J.Action]:{"action.kind":1,"action.continueOnFailure":!1},[J.Parallel]:{"parallel.cancelRemainingBranchesOnRejection":!0},[J.Join]:{"join.mode":1},[J.Timer]:{"timer.mode":1,"timer.durationInMinutes":60,"timer.useBusinessCalendar":!1},[J.Subprocess]:{"subprocess.waitForCompletion":!0,"subprocess.outcomeMode":1,"subprocess.cancelChildOnParentCancel":!0,"subprocess.inputMappings":[]},[J.EventWait]:{"eventWait.correlationSource":1,"eventWait.onTimeout":2,"eventWait.payloadMappings":[]},[J.SendSlackMessage]:{"sendSlackMessage.severity":1,"sendSlackMessage.includeDeepLink":!0,"sendSlackMessage.factFieldIds":[]},[J.SendTeamsMessage]:{"sendTeamsMessage.severity":1,"sendTeamsMessage.includeDeepLink":!0,"sendTeamsMessage.factFieldIds":[]}},jx={[J.Condition]:[{name:`condition.branches`,typeName:`WorkflowConditionBranch[]`,displayNameKey:`WorkflowBranches`,category:`General`,order:1,uiHint:Q.conditionBuilder,isRequired:!0}],[J.EventWait]:[{name:`eventWait.eventName`,typeName:`String`,displayNameKey:`WorkflowEventWaitEvent`,category:`General`,order:1,uiHint:Q.dropDown,isRequired:!0,optionsProviderName:`workflow.eventDefinitions`,refreshOnChange:[`eventWait.payloadMappings`]},{name:`eventWait.correlationSource`,typeName:`Int32`,displayNameKey:`WorkflowEventWaitCorrelation`,category:`General`,order:2,uiHint:Q.dropDown,allowedValues:[{value:`1`,displayText:`WorkflowEventCorrelationSource_BusinessKey`},{value:`2`,displayText:`WorkflowEventCorrelationSource_ReferenceNumber`},{value:`3`,displayText:`WorkflowEventCorrelationSource_FormField`}],refreshOnChange:[`eventWait.correlationFieldKey`]},{name:`eventWait.correlationFieldKey`,typeName:`String`,displayNameKey:`WorkflowEventWaitCorrelationField`,category:`General`,order:3,uiHint:Q.formFieldPicker,optionsProviderName:`workflow.formFields`,uiSpecifications:{VisibleWhen:{Input:`eventWait.correlationSource`,EqualsAnyOf:[3]}}},{name:`eventWait.timeout.dueInMinutes`,typeName:`Int32`,displayNameKey:`WorkflowEventWaitTimeout`,descriptionKey:`WorkflowEventWaitTimeoutHint`,category:`Behaviour`,order:4,uiHint:Q.singleLine,minValue:1},{name:`eventWait.timeout.useBusinessCalendar`,typeName:`Boolean`,displayNameKey:`WorkflowSlaUseBusinessCalendar`,category:`Behaviour`,order:5,uiHint:Q.checkbox},{name:`eventWait.onTimeout`,typeName:`Int32`,displayNameKey:`WorkflowEventWaitOnTimeout`,category:`Behaviour`,order:6,uiHint:Q.dropDown,allowedValues:[{value:`1`,displayText:`WorkflowEventTimeoutBehavior_ContinueTimeoutPath`},{value:`2`,displayText:`WorkflowEventTimeoutBehavior_NeedsAttention`}]},{name:`eventWait.payloadMappings`,typeName:`WorkflowEventPayloadMapping[]`,displayNameKey:`WorkflowEventWaitPayloadMappings`,category:`Mapping`,order:7,uiHint:Q.eventPayloadMappingTable},{name:`eventWait.waitingMessage`,typeName:`WorkflowLocalizableText`,displayNameKey:`WorkflowEventWaitWaitingMessage`,category:`General`,order:8,uiHint:Q.singleLine}],[J.Action]:[{name:`action.kind`,typeName:`Int32`,displayNameKey:`WorkflowActionKind`,category:`General`,order:1,uiHint:Q.dropDown,allowedValues:[{value:`1`,displayText:`WorkflowActionKind_RegisteredApplicationAction`},{value:`2`,displayText:`WorkflowActionKind_Webhook`},{value:`3`,displayText:`WorkflowActionKind_HttpConnectionProfile`}],refreshOnChange:[`action.actionName`,`action.webhookName`,`action.relativePath`,`action.httpMethod`,`action.inputBindings`]},{name:`action.actionName`,typeName:`String`,displayNameKey:`WorkflowActionName`,category:`General`,order:2,uiHint:Q.dropDown,optionsProviderName:`workflow.registeredActions`,refreshOnChange:[`action.inputBindings`],uiSpecifications:{VisibleWhen:{Input:`action.kind`,EqualsAnyOf:[1]}}},{name:`action.webhookName`,typeName:`String`,displayNameKey:`WorkflowActionWebhookName`,category:`General`,order:3,uiHint:Q.dropDown,optionsProviderName:`workflow.webhookDefinitions`,uiSpecifications:{VisibleWhen:{Input:`action.kind`,EqualsAnyOf:[2]}}},{name:`action.connectionProfileName`,typeName:`String`,displayNameKey:`WorkflowActionConnectionProfile`,category:`General`,order:4,uiHint:Q.connectionDropDown,optionsProviderName:`workflow.connectionProfiles`,uiSpecifications:{VisibleWhen:{Input:`action.kind`,EqualsAnyOf:[3]}}},{name:`action.relativePath`,typeName:`String`,displayNameKey:`WorkflowActionRelativePath`,category:`General`,order:5,uiHint:Q.singleLine,uiSpecifications:{VisibleWhen:{Input:`action.kind`,EqualsAnyOf:[3]}}},{name:`action.httpMethod`,typeName:`String`,displayNameKey:`WorkflowActionHttpMethod`,category:`General`,order:6,uiHint:Q.dropDown,allowedValues:[{value:`GET`,displayText:`WorkflowActionHttpMethod_Get`},{value:`POST`,displayText:`WorkflowActionHttpMethod_Post`},{value:`PUT`,displayText:`WorkflowActionHttpMethod_Put`},{value:`PATCH`,displayText:`WorkflowActionHttpMethod_Patch`},{value:`DELETE`,displayText:`WorkflowActionHttpMethod_Delete`}],uiSpecifications:{VisibleWhen:{Input:`action.kind`,EqualsAnyOf:[3]}}},{name:`action.timeoutInSeconds`,typeName:`Int32`,displayNameKey:`WorkflowActionTimeout`,category:`Behaviour`,order:7,uiHint:Q.singleLine,minValue:1},{name:`action.maxAttempts`,typeName:`Int32`,displayNameKey:`WorkflowActionMaxAttempts`,category:`Behaviour`,order:8,uiHint:Q.singleLine,minValue:1},{name:`action.continueOnFailure`,typeName:`Boolean`,displayNameKey:`WorkflowActionContinueOnFailure`,category:`Behaviour`,order:9,uiHint:Q.checkbox},{name:`action.inputBindings`,typeName:`WorkflowActionInputBinding[]`,displayNameKey:`WorkflowActionInputs`,category:`Mapping`,order:10,uiHint:Q.actionParameterTable,uiSpecifications:{VisibleWhen:{Input:`action.kind`,EqualsAnyOf:[1]}}}],[J.Approval]:[{name:`approval.targets`,typeName:`WorkflowAssignmentTarget[]`,displayNameKey:`WorkflowTargets`,category:`Assignment`,order:1,uiHint:Q.assigneePicker,isRequired:!0},{name:`approval.approvalPolicy`,typeName:`Int32`,displayNameKey:`WorkflowApprovalPolicy`,category:`Behaviour`,order:3,uiHint:Q.dropDown,allowedValues:[{value:`1`,displayText:`WorkflowApprovalPolicy_Anyone`},{value:`2`,displayText:`WorkflowApprovalPolicy_Everyone`},{value:`3`,displayText:`WorkflowApprovalPolicy_Quorum`}],refreshOnChange:[`approval.quorumCount`],requiredCapability:`advancedApprovalsEnabled`},{name:`approval.quorumCount`,typeName:`Int32`,displayNameKey:`WorkflowApprovalQuorumCount`,category:`Behaviour`,order:4,uiHint:Q.singleLine,minValue:1,uiSpecifications:{VisibleWhen:{Input:`approval.approvalPolicy`,EqualsAnyOf:[3]}}},{name:`approval.allowDelegation`,typeName:`Boolean`,displayNameKey:`WorkflowApprovalAllowDelegation`,category:`Behaviour`,order:7,uiHint:Q.checkbox},{name:`approval.allowRequestChanges`,typeName:`Boolean`,displayNameKey:`WorkflowApprovalAllowRequestChanges`,category:`Behaviour`,order:8,uiHint:Q.checkbox},{name:`approval.requireReasonOnReject`,typeName:`Boolean`,displayNameKey:`WorkflowApprovalRequireReasonOnReject`,category:`Behaviour`,order:10,uiHint:Q.checkbox},{name:`channels.channels`,typeName:`WorkflowChannel[]`,displayNameKey:`WorkflowChannels`,category:`Delivery`,order:80,uiHint:Q.channelEditor,refreshOnChange:[`channels.connectionProfileName`]},{name:`channels.connectionProfileName`,typeName:`String`,displayNameKey:`WorkflowChannelConnectionProfile`,category:`Delivery`,order:81,uiHint:Q.connectionDropDown,optionsProviderName:`workflow.connectionProfiles`,uiSpecifications:{VisibleWhen:{Input:`channels.channels`,IsNotEmpty:!0}}},{name:`channels.allowDecisionFromChannel`,typeName:`Boolean`,displayNameKey:`WorkflowChannelAllowDecision`,category:`Delivery`,order:82,uiHint:Q.checkbox,defaultValue:!1,uiSpecifications:{VisibleWhen:{Input:`channels.channels`,IsNotEmpty:!0}}},{name:`sla`,typeName:`WorkflowSlaSettings`,displayNameKey:`WorkflowSla`,category:`Common`,order:90,uiHint:Q.slaEditor}],[J.Notification]:[{name:`notification.notificationName`,typeName:`String`,displayNameKey:`WorkflowNotificationName`,category:`General`,order:1,uiHint:Q.singleLine,isRequired:!0},{name:`notification.subject`,typeName:`WorkflowLocalizableText`,displayNameKey:`WorkflowNotificationSubject`,category:`General`,order:2,uiHint:Q.singleLine},{name:`notification.body`,typeName:`WorkflowLocalizableText`,displayNameKey:`WorkflowNotificationBody`,category:`General`,order:3,uiHint:Q.multiLine},{name:`notification.sendInApp`,typeName:`Boolean`,displayNameKey:`WorkflowNotificationSendInApp`,category:`Delivery`,order:4,uiHint:Q.checkbox},{name:`notification.sendEmail`,typeName:`Boolean`,displayNameKey:`WorkflowNotificationSendEmail`,category:`Delivery`,order:5,uiHint:Q.checkbox},{name:`notification.recipients`,typeName:`WorkflowNotificationRecipient[]`,displayNameKey:`WorkflowNotificationRecipients`,category:`Recipients`,order:6,uiHint:Q.notificationRecipients,isRequired:!0},{name:`channels.channels`,typeName:`WorkflowChannel[]`,displayNameKey:`WorkflowChannels`,category:`Delivery`,order:80,uiHint:Q.channelEditor,refreshOnChange:[`channels.connectionProfileName`]},{name:`channels.connectionProfileName`,typeName:`String`,displayNameKey:`WorkflowChannelConnectionProfile`,category:`Delivery`,order:81,uiHint:Q.connectionDropDown,optionsProviderName:`workflow.connectionProfiles`,uiSpecifications:{VisibleWhen:{Input:`channels.channels`,IsNotEmpty:!0}}}],[J.FormSubmission]:[{name:`formSubmission.readOnlyFieldIds`,typeName:`String[]`,displayNameKey:`WorkflowFormReadOnlyFields`,category:`General`,order:2,uiHint:Q.checkList,optionsProviderName:`workflow.formFields`},{name:`formSubmission.allowAttachments`,typeName:`Boolean`,displayNameKey:`WorkflowFormAllowAttachments`,category:`Behaviour`,order:3,uiHint:Q.checkbox,requiredCapability:`attachmentsEnabled`},{name:`formSubmission.allowWithdraw`,typeName:`Boolean`,displayNameKey:`WorkflowFormAllowWithdraw`,category:`Behaviour`,order:4,uiHint:Q.checkbox},{name:`sla`,typeName:`WorkflowSlaSettings`,displayNameKey:`WorkflowSla`,category:`Common`,order:90,uiHint:Q.slaEditor}],[J.Subprocess]:[{name:`subprocess.workflowDefinitionId`,typeName:`Guid`,displayNameKey:`WorkflowSubprocessWorkflow`,category:`General`,order:1,uiHint:Q.workflowDefinitionPicker,isRequired:!0,optionsProviderName:`workflow.workflowDefinitions`},{name:`subprocess.waitForCompletion`,typeName:`Boolean`,displayNameKey:`WorkflowSubprocessWait`,category:`Behaviour`,order:2,uiHint:Q.checkbox},{name:`subprocess.outcomeMode`,typeName:`Int32`,displayNameKey:`WorkflowSubprocessOutcomeMode`,category:`Behaviour`,order:3,uiHint:Q.dropDown,allowedValues:[{value:`1`,displayText:`WorkflowSubprocessOutcomeMode_SingleOutcome`},{value:`2`,displayText:`WorkflowSubprocessOutcomeMode_ApprovalOutcome`}]},{name:`subprocess.cancelChildOnParentCancel`,typeName:`Boolean`,displayNameKey:`WorkflowSubprocessCancelChild`,category:`Behaviour`,order:4,uiHint:Q.checkbox},{name:`subprocess.inputMappings`,typeName:`WorkflowFieldMapping[]`,displayNameKey:`WorkflowSubprocessInputMappings`,category:`Mapping`,order:5,uiHint:Q.fieldMappingTable,optionsProviderName:`workflow.formFields`}],[J.Parallel]:[{name:`parallel.joinNodeId`,typeName:`String`,displayNameKey:`WorkflowParallelJoinNode`,category:`General`,order:1,uiHint:Q.dropDown,isRequired:!0,optionsProviderName:`workflow.graph.joinNodes`},{name:`parallel.cancelRemainingBranchesOnRejection`,typeName:`Boolean`,displayNameKey:`WorkflowParallelCancelOnRejection`,category:`Behaviour`,order:2,uiHint:Q.checkbox}],[J.Join]:[{name:`join.parallelNodeId`,typeName:`String`,displayNameKey:`WorkflowJoinParallelNode`,category:`General`,order:1,uiHint:Q.dropDown,isRequired:!0,optionsProviderName:`workflow.graph.parallelNodes`},{name:`join.mode`,typeName:`Int32`,displayNameKey:`WorkflowJoinMode`,category:`Behaviour`,order:2,uiHint:Q.dropDown,allowedValues:[{value:`1`,displayText:`WorkflowJoinMode_WaitAll`},{value:`2`,displayText:`WorkflowJoinMode_WaitAny`},{value:`3`,displayText:`WorkflowJoinMode_WaitCount`}],refreshOnChange:[`join.requiredBranchCount`]},{name:`join.requiredBranchCount`,typeName:`Int32`,displayNameKey:`WorkflowJoinRequiredBranchCount`,category:`Behaviour`,order:3,uiHint:Q.singleLine,minValue:1,uiSpecifications:{VisibleWhen:{Input:`join.mode`,EqualsAnyOf:[3]}}}],[J.Timer]:[{name:`timer.mode`,typeName:`Int32`,displayNameKey:`WorkflowTimerMode`,category:`General`,order:1,uiHint:Q.dropDown,allowedValues:[{value:`1`,displayText:`WorkflowTimerMode_Duration`},{value:`2`,displayText:`WorkflowTimerMode_FormFieldDate`},{value:`3`,displayText:`WorkflowTimerMode_FixedDate`}],refreshOnChange:[`timer.durationInMinutes`,`timer.fieldId`,`timer.offsetInMinutes`,`timer.fixedDate`]},{name:`timer.durationInMinutes`,typeName:`Int32`,displayNameKey:`WorkflowTimerDuration`,category:`General`,order:2,uiHint:Q.singleLine,minValue:1,uiSpecifications:{VisibleWhen:{Input:`timer.mode`,EqualsAnyOf:[1]}}},{name:`timer.fieldId`,typeName:`String`,displayNameKey:`WorkflowTimerField`,category:`General`,order:3,uiHint:Q.formFieldPicker,optionsProviderName:`workflow.formFields`,uiSpecifications:{VisibleWhen:{Input:`timer.mode`,EqualsAnyOf:[2]}}},{name:`timer.offsetInMinutes`,typeName:`Int32`,displayNameKey:`WorkflowTimerOffset`,category:`General`,order:4,uiHint:Q.singleLine,uiSpecifications:{VisibleWhen:{Input:`timer.mode`,EqualsAnyOf:[2]}}},{name:`timer.fixedDate`,typeName:`DateTime`,displayNameKey:`WorkflowTimerFixedDate`,category:`General`,order:5,uiHint:Q.dateTimePicker,uiSpecifications:{VisibleWhen:{Input:`timer.mode`,EqualsAnyOf:[3]}}},{name:`timer.useBusinessCalendar`,typeName:`Boolean`,displayNameKey:`WorkflowSlaUseBusinessCalendar`,category:`Behaviour`,order:6,uiHint:Q.checkbox}]};function Mx(e){let t=Ax[e]??{},n=jx[e];return n?n.map(e=>({...e,defaultValue:t[e.name]})):Object.entries(t).map(([e,t])=>({name:e,defaultValue:t}))}function Nx(){return kx().map(({type:e,name:t})=>({typeName:`AspNetZero.Workflow.${t}`,namespace:`AspNetZero.Workflow`,name:t,version:1,category:void 0,displayName:void 0,description:void 0,inputs:Mx(e),ports:Ex[e]??[],isBrowsable:!0,isStart:e===J.Start,isTerminal:Dx.has(e),isSingleton:e===J.Start,isFanOut:e===J.Parallel,requiredCapability:Ox[e],legacyNodeType:e}))}function Px(e,t=[]){return{typeName:`AspNetZero.Workflow.Unknown.${e}`,name:`Unknown (${e})`,version:1,inputs:[],ports:t,isBrowsable:!1,isTerminal:!1,isSingleton:!1,legacyNodeType:e,customProperties:{isUnknown:!0}}}function Fx(e){return e?.customProperties?.isUnknown===!0}function Ix(e){let t=kx().find(t=>t.type===e);return t?`WorkflowNodeType_${t.name}`:`WorkflowNodeType_Unknown`}function Lx(e){let t=kx().find(t=>t.type===e);return t?`WorkflowNodeDescription_${t.name}`:``}function Rx(e){let t=bx(e),n=e.legacyNodeType??-1;return{type:n,category:t.category,localizationKey:e.displayName?``:Ix(n),fallbackLabel:e.displayName??e.name??String(n),descriptionKey:e.description?``:Lx(n),fallbackDescription:e.description??``,icon:t.icon,iconName:t.iconName,color:t.color,isTerminal:e.isTerminal===!0,isSingleton:e.isSingleton===!0,isUnknown:Fx(e),outcomes:Tx(e.ports)}}var zx=new Map(Nx().map(e=>[e.legacyNodeType,e]));function Bx(e){return zx.get(e)??Px(e)}function Vx(e){return Rx(Bx(e))}function Hx(e){return Tx(Bx(e).ports)}function Ux(e,t){return Hx(e).find(e=>e.kind===t)}function Wx(e,t){return Hx(e).some(e=>e.kind===t)}function Gx(e){let t=e;return Nx().filter(e=>!e.requiredCapability||t[e.requiredCapability]!==!1).map(Rx)}var Kx=Nx().map(Rx),qx={undo:`<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11"/>`,redo:`<path d="m15 14 5-5-5-5"/><path d="M20 9H9.5a5.5 5.5 0 0 0 0 11H13"/>`,copy:`<rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>`,paste:`<rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>`,trash:`<path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M10 11v6M14 11v6"/>`,outline:`<path d="M9 6h12M9 12h12M9 18h12"/><path d="M4 6h.01M4 12h.01M4 18h.01"/>`,canvas:`<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/><path d="M6.5 10v2.5a3 3 0 0 0 3 3H14"/>`,layout:`<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><path d="M17.5 14v7M14 17.5h7"/>`,zoomIn:`<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5M11 8v6M8 11h6"/>`,zoomOut:`<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5M8 11h6"/>`,fit:`<path d="M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M16 21h3a2 2 0 0 0 2-2v-3"/>`,plus:`<path d="M12 5v14M5 12h14"/>`,close:`<path d="M18 6 6 18M6 6l12 12"/>`,arrowUp:`<path d="M12 19V5M5 12l7-7 7 7"/>`,arrowDown:`<path d="M12 5v14M19 12l-7 7-7-7"/>`,arrowRight:`<path d="M5 12h14M13 6l6 6-6 6"/>`,search:`<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>`,variables:`<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5a2 2 0 0 0 2 2h1M16 21h1a2 2 0 0 0 2-2v-5a2 2 0 0 1 2-2 2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>`,warning:`<path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/><path d="M12 9v4M12 17h.01"/>`,info:`<circle cx="12" cy="12" r="9"/><path d="M12 16v-4M12 8h.01"/>`,sparkles:`<path d="M12 3.5 13.8 9l5.7 1.9-5.7 1.9L12 18.5l-1.8-5.7L4.5 11l5.7-2z"/><path d="M19 3v3M17.5 4.5h3M5 17v3M3.5 18.5h3"/>`,link:`<path d="M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"/><path d="M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"/>`,section:`<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 10h18M8 15h8"/>`,panelLeft:`<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M9 3v18"/>`,start:`<path d="M7 4.5v15a1 1 0 0 0 1.5.9l12-7.5a1 1 0 0 0 0-1.8l-12-7.5A1 1 0 0 0 7 4.5z"/>`,form:`<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M9 13h6M9 17h6M9 9h1"/>`,approval:`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="m16 11 2 2 4-4"/>`,condition:`<path d="M12 2.8 21.2 12 12 21.2 2.8 12z"/><path d="M9.2 9.8a2.8 2.8 0 1 1 3.9 2.6c-.7.3-1.1.9-1.1 1.6M12 16.5h.01"/>`,parallel:`<path d="M12 2.8 21.2 12 12 21.2 2.8 12z"/><path d="M12 8.5v7M8.5 12h7"/>`,join:`<circle cx="6" cy="6" r="2.5"/><circle cx="18" cy="18" r="2.5"/><path d="M6 8.5V21M6 12a6 6 0 0 0 6 6h3.5"/>`,timer:`<circle cx="12" cy="13" r="8"/><path d="M12 9v4l2.5 2.5M9 2h6"/>`,notification:`<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,action:`<path d="M13 2 3 14h9l-1 8 10-12h-9z"/>`,subprocess:`<path d="m12 2 10 5-10 5L2 7z"/><path d="m2 17 10 5 10-5M2 12l10 5 10-5"/>`,eventWait:`<path d="M5 22h14M5 2h14M17 22v-4.2a2 2 0 0 0-.6-1.4L12 12l-4.4 4.4a2 2 0 0 0-.6 1.4V22M7 2v4.2a2 2 0 0 0 .6 1.4L12 12l4.4-4.4a2 2 0 0 0 .6-1.4V2"/>`,approved:`<circle cx="12" cy="12" r="9"/><path d="m8.5 12.2 2.4 2.4 4.8-5"/>`,rejected:`<circle cx="12" cy="12" r="9"/><path d="m15 9-6 6M9 9l6 6"/>`,cancelled:`<circle cx="12" cy="12" r="9"/><path d="m5.7 5.7 12.6 12.6"/>`,unknown:`<circle cx="12" cy="12" r="9"/><path d="M9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3M12 17h.01"/>`,shortText:`<path d="M4 7V5h16v2M9 19h6M12 5v14"/>`,longText:`<path d="M21 6H3M17 12H3M21 18H3"/>`,number:`<path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/>`,money:`<rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="2.5"/><path d="M6 12h.01M18 12h.01"/>`,date:`<rect x="3" y="4" width="18" height="17" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/>`,time:`<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 3"/>`,dateTime:`<path d="M21 8V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4M16 2v4M8 2v4M3 10h5"/><circle cx="16.5" cy="16.5" r="5.5"/><path d="M16.5 14.5v2l1.3 1.3"/>`,boolean:`<rect x="2" y="6" width="20" height="12" rx="6"/><circle cx="16" cy="12" r="2.5"/>`,singleSelect:`<rect x="3" y="3" width="18" height="18" rx="2"/><path d="m8 10.5 4 4 4-4"/>`,multiSelect:`<path d="m3 17 2 2 4-4M3 7l2 2 4-4M13 6h8M13 12h8M13 18h8"/>`,user:`<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>`,role:`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8"/>`,organizationUnit:`<rect x="9" y="2" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="16" y="16" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3M12 12V8"/>`,attachment:`<path d="m21.4 11.1-9.2 9.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"/>`,staticText:`<path d="M13 4v16M17 4v16M19 4H9.5a4.5 4.5 0 0 0 0 9H13"/>`,repeater:`<rect x="3" y="3" width="18" height="7" rx="1.5"/><rect x="3" y="14" width="18" height="7" rx="1.5"/><path d="M7 6.5h6M7 17.5h6"/>`,calculated:`<path d="M18 7V4H6l6 8-6 8h12v-3"/>`};function $(e,t=16,n=`wf-icon`){return`<svg class="${n}" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${qx[e]??qx.unknown}</svg>`}function Jx(e,t){let n=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${qx[e]??qx.unknown}</svg>`;return`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(n)}function Yx(e){let t=e.escape(e.descriptor.displayName??e.descriptor.name);return e.descriptor.isRequired?`${t} <span class="wf-required">*</span>`:t}var Xx={requesterManager:Db.RequesterManager,user:Db.User,role:Db.Role,organizationUnit:Db.OrganizationUnit,fallbackRole:Db.FallbackRole},Zx=[{value:Xx.requesterManager,key:`WorkflowTarget_RequesterManager`,fallback:`Requester's manager`},{value:Xx.user,key:`WorkflowTarget_User`,fallback:`User`},{value:Xx.role,key:`WorkflowTarget_Role`,fallback:`Role`},{value:Xx.organizationUnit,key:`WorkflowTarget_OrganizationUnit`,fallback:`Organization unit`},{value:Xx.fallbackRole,key:`WorkflowTarget_FallbackRole`,fallback:`Fallback role`}],Qx={[Xx.user]:`workflow.users`,[Xx.role]:`workflow.roles`,[Xx.organizationUnit]:`workflow.organizationUnits`,[Xx.fallbackRole]:`workflow.roles`},$x=250;function eS(e){return Qx[e]!==void 0}function tS(e){return e===Xx.user}function nS(e){return Qx[e]}function rS(e,t){let n={type:e};return e===Xx.user?n.userId=Number(t):e===Xx.role||e===Xx.fallbackRole?n.roleId=Number(t):e===Xx.organizationUnit&&(n.organizationUnitId=Number(t),n.includeChildOrganizationUnits=!0),n}function iS(e,t,n){let r=Zx.find(t=>t.value===e.type),i=r?t(r.key,r.fallback):String(e.type),a=aS(e);if(a===void 0)return i;let o=nS(e.type),s=o&&n?n(o,String(a)):void 0;return s?`${i}: ${s}`:`${i} #${a}`}function aS(e){return(e.type===Xx.user?e.userId:e.type===Xx.role||e.type===Xx.fallbackRole?e.roleId:e.type===Xx.organizationUnit?e.organizationUnitId:void 0)??void 0}var oS=Yx;function sS(e){return Array.isArray(e)?e:[]}var cS={hint:Q.assigneePicker,render:e=>{let t=sS(e.value),n=e.disabled||e.descriptor.isReadOnly===!0,r=t.map((t,r)=>`
367
+ <li>
368
+ <span>${e.escape(iS(t,e.localize,e.nameOf))}</span>
369
+ <button type="button" data-target-remove="${r}" ${n?`disabled`:``}
370
+ title="${e.escape(e.localize(`WorkflowTargetRemove`,`Remove assignee`))}"
371
+ aria-label="${e.escape(e.localize(`WorkflowTargetRemove`,`Remove assignee`))}">&times;</button>
372
+ </li>`).join(``);return`
373
+ <div class="wf-input" data-input="${e.escape(e.descriptor.name)}">
374
+ <span>${oS(e)}</span>
375
+ ${t.length>0?`<ul class="wf-target-list">${r}</ul>`:`<p class="wf-input-empty">${e.escape(e.localize(`WorkflowTargetsEmpty`,`No assignee configured yet.`))}</p>`}
376
+ <div class="wf-subsection wf-target-add">
377
+ <label class="wf-input">
378
+ <span>${e.escape(e.localize(`WorkflowTargetType`,`Assignee type`))}</span>
379
+ <select data-target-type ${n?`disabled`:``}>
380
+ ${Zx.map(t=>`<option value="${t.value}">${e.escape(e.localize(t.key,t.fallback))}</option>`).join(``)}
381
+ </select>
382
+ </label>
383
+ <div class="wf-input" data-target-lookup hidden>
384
+ <span data-target-lookup-label></span>
385
+ <input type="search" data-target-filter hidden
386
+ placeholder="${e.escape(e.localize(`WorkflowTargetSearch`,`Search`))}"
387
+ aria-label="${e.escape(e.localize(`WorkflowTargetSearch`,`Search`))}"
388
+ ${n?`disabled`:``} />
389
+ <select data-target-value ${n?`disabled`:``}></select>
390
+ </div>
391
+ <button type="button" class="wf-secondary" data-target-add ${n?`disabled`:``}>
392
+ ${$(`plus`,15)}
393
+ ${e.escape(e.localize(`WorkflowTargetAdd`,`Add assignee`))}
394
+ </button>
395
+ </div>
396
+ </div>
397
+ `},read:()=>[],bind:(e,t,n)=>{let r=sS(t.value),i=e.querySelector(`[data-target-type]`),a=e.querySelector(`[data-target-lookup]`),o=e.querySelector(`[data-target-filter]`),s=e.querySelector(`[data-target-value]`),c=e.querySelector(`[data-target-lookup-label]`),l=()=>Number(i?.value??Xx.requesterManager),u=0,d,f=async()=>{if(!s)return;let e=++u,n=nS(l());if(!n||!t.lookup){s.innerHTML=``;return}let r=o&&!o.hidden?o.value.trim():``;try{let i=await t.lookup(n,r);if(e!==u)return;s.innerHTML=[`<option value="">${t.escape(t.localize(`WorkflowDesignerNotSelected`,`Not selected`))}</option>`,...i.map(e=>`<option value="${t.escape(e.value)}">${t.escape(e.displayText)}</option>`)].join(``)}catch{e===u&&(s.innerHTML=``)}},p=()=>{if(!a)return;let e=l();if(a.hidden=!eS(e),c){let n=Zx.find(t=>t.value===e);c.textContent=n?t.localize(n.key,n.fallback):``}o&&(o.hidden=!tS(e),o.value=``),a.hidden||f()};i?.addEventListener(`change`,p),o?.addEventListener(`input`,()=>{clearTimeout(d),d=setTimeout(()=>void f(),$x)}),o?.addEventListener(`change`,()=>{clearTimeout(d),f()}),p(),e.querySelector(`[data-target-add]`)?.addEventListener(`click`,()=>{let e=l(),t=s?.value??``;eS(e)&&t.length===0||n([...r,rS(e,t)])}),e.querySelectorAll(`[data-target-remove]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=Number(e.dataset.targetRemove);n(r.filter((e,n)=>n!==t))})})}},lS={inApp:1,email:2,teams:3,slack:4},uS=[{value:lS.teams,key:`WorkflowChannel_Teams`,fallback:`Microsoft Teams`},{value:lS.slack,key:`WorkflowChannel_Slack`,fallback:`Slack`}],dS=Yx;function fS(e){return Array.isArray(e)?e.map(e=>Number(e)):[]}function pS(e){return[...e.querySelectorAll(`input[data-channel]`)].filter(e=>e.checked).map(e=>Number(e.dataset.channel))}var mS={hint:Q.channelEditor,render:e=>{let t=new Set(fS(e.value)),n=e.disabled||e.descriptor.isReadOnly===!0;return`
398
+ <div class="wf-input" data-input="${e.escape(e.descriptor.name)}">
399
+ <span>${dS(e)}</span>
400
+ <p class="wf-input-hint">${e.escape(e.localize(`WorkflowChannelsNodeHint`,`Also deliver this notification to a chat platform. The channel must be enabled in workflow settings.`))}</p>
401
+ ${uS.map(r=>`
402
+ <label class="wf-check">
403
+ <input type="checkbox" data-channel="${r.value}"
404
+ ${t.has(r.value)?`checked`:``} ${n?`disabled`:``} />
405
+ <span>${e.escape(e.localize(r.key,r.fallback))}</span>
406
+ </label>`).join(``)}
407
+ </div>
408
+ `},read:e=>{let t=e.closest(`[data-input]`);return t?pS(t):[]},bind:(e,t,n)=>{e.querySelectorAll(`input[data-channel]`).forEach(t=>{t.addEventListener(`change`,()=>n(pS(e)))})}},hS=new Map;function gS(e,t){return`${e}\u0000${t}`}function _S(e){return{hint:e,render:e=>{let t=e.value===void 0||e.value===null?``:String(e.value),n=e.disabled||e.descriptor.isReadOnly===!0,r=e.descriptor.optionsProviderName,i=r&&t.length>0?hS.get(gS(r,t)):void 0,a=e.escape(e.localize(`WorkflowTargetSearch`,`Search`));return`
409
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
410
+ <span>${dS(e)}</span>
411
+ ${r?`<input type="text" data-lookup-filter placeholder="${a}"
412
+ aria-label="${a}" ${n?`disabled`:``} />`:``}
413
+ <select data-lookup-value data-current="${e.escape(t)}"
414
+ ${n?`disabled`:``}>
415
+ <option value="">${e.escape(e.localize(`WorkflowDesignerNotSelected`,`Not selected`))}</option>
416
+ ${t.length>0?`<option value="${e.escape(t)}" selected>${e.escape(i??t)}</option>`:``}
417
+ </select>
418
+ </label>
419
+ `},read:e=>{let t=e.value;return t.length===0?void 0:t},bind:(e,t,n)=>{let r=e.querySelector(`[data-lookup-value]`);if(!r)return;r.addEventListener(`change`,()=>n(r.value.length===0?void 0:r.value));let i=t.descriptor.optionsProviderName;if(!i||!t.lookup)return;let a=t.lookup,o=e.querySelector(`[data-lookup-filter]`),s=e=>{a(i,e).then(e=>{e.forEach(e=>hS.set(gS(i,e.value),e.displayText));let n=r.value||(r.dataset.current??``),a=e.some(e=>e.value===n),o=n.length>0&&!a?[{value:n,displayText:hS.get(gS(i,n))??n}]:[];r.innerHTML=[`<option value="">${t.escape(t.localize(`WorkflowDesignerNotSelected`,`Not selected`))}</option>`,...[...o,...e].map(e=>`<option value="${t.escape(e.value)}" ${e.value===n?`selected`:``}>${t.escape(e.displayText)}</option>`)].join(``)}).catch(()=>{})};o?.addEventListener(`change`,()=>s(o.value.trim())),s(``)}}}var vS=_S(Q.connectionDropDown),yS=_S(Q.workflowDefinitionPicker),bS=Yx;function xS(e){return e.descriptor.description?`<small class="wf-input-hint">${e.escape(e.descriptor.description)}</small>`:``}function SS(e){return e.disabled||e.descriptor.isReadOnly===!0}function CS(e){return[...e.querySelectorAll(`input[type="checkbox"][data-option]`)].filter(e=>e.checked).map(e=>e.dataset.option??``)}var wS={hint:Q.checkList,render:e=>{let t=new Set((Array.isArray(e.value)?e.value:[]).map(e=>String(e))),n=e.descriptor.allowedValues??[],r=SS(e),i=n.length===0?`<p class="wf-input-empty">${e.escape(e.localize(`WorkflowDesignerNoOptions`,`Nothing to choose from yet.`))}</p>`:`<ul class="wf-check-list">${n.map(n=>`
420
+ <li>
421
+ <label class="wf-check">
422
+ <input type="checkbox" data-option="${e.escape(n.value??``)}"
423
+ ${t.has(String(n.value))?`checked`:``}
424
+ ${r?`disabled`:``} />
425
+ <span>${e.escape(n.displayText??n.value??``)}</span>
426
+ </label>
427
+ </li>`).join(``)}</ul>`;return`
428
+ <div class="wf-input" data-input="${e.escape(e.descriptor.name)}">
429
+ <span>${bS(e)}</span>
430
+ ${i}
431
+ ${xS(e)}
432
+ </div>
433
+ `},read:e=>{let t=e.closest(`[data-input]`);return t?CS(t):[]},bind:(e,t,n)=>{e.querySelectorAll(`input[type="checkbox"][data-option]`).forEach(t=>{t.addEventListener(`change`,()=>n(CS(e)))})}},TS={hint:Q.fieldMappingTable,render:e=>{let t=Array.isArray(e.value)?e.value:[],n=e.descriptor.allowedValues??[],r=SS(e)||n.length===0,i=e=>n.find(t=>t.value===e)?.displayText??e??``,a=t.length===0?`<p class="wf-input-empty">${e.escape(e.localize(`WorkflowSubprocessMappingsEmpty`,`No field is mapped yet.`))}</p>`:`<ul class="wf-mapping-list">${t.map((t,n)=>`
434
+ <li>
435
+ <span>${e.escape(i(t.sourceFieldId))} &rarr; ${e.escape(t.targetFieldKey??``)}</span>
436
+ <button type="button" data-mapping-remove="${n}" ${r?`disabled`:``}
437
+ aria-label="${e.escape(e.localize(`WorkflowSubprocessRemoveMapping`,`Remove mapping`))}">&times;</button>
438
+ </li>`).join(``)}</ul>`;return`
439
+ <div class="wf-input" data-input="${e.escape(e.descriptor.name)}">
440
+ <span>${bS(e)}</span>
441
+ ${a}
442
+ <label class="wf-input">
443
+ <span>${e.escape(e.localize(`WorkflowSubprocessSourceField`,`Source field`))}</span>
444
+ <select data-mapping-source ${r?`disabled`:``}>
445
+ ${n.map(t=>`<option value="${e.escape(t.value??``)}">${e.escape(t.displayText??t.value??``)}</option>`).join(``)}
446
+ </select>
447
+ </label>
448
+ <label class="wf-input">
449
+ <span>${e.escape(e.localize(`WorkflowSubprocessTargetKey`,`Target field key`))}</span>
450
+ <input type="text" data-mapping-target ${r?`disabled`:``} />
451
+ </label>
452
+ <button type="button" class="wf-secondary" data-mapping-add ${r?`disabled`:``}>
453
+ ${$(`plus`,15)}
454
+ ${e.escape(e.localize(`WorkflowSubprocessAddMapping`,`Add mapping`))}
455
+ </button>
456
+ ${xS(e)}
457
+ </div>
458
+ `},read:e=>[],bind:(e,t,n)=>{let r=Array.isArray(t.value)?t.value:[];e.querySelectorAll(`[data-mapping-remove]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=Number(e.dataset.mappingRemove);n(r.filter((e,n)=>n!==t))})});let i=e.querySelector(`[data-mapping-source]`),a=e.querySelector(`[data-mapping-target]`);e.querySelector(`[data-mapping-add]`)?.addEventListener(`click`,()=>{let e=i?.value??``,t=(a?.value??``).trim();e.length!==0&&t.length!==0&&n([...r,{sourceFieldId:e,targetFieldKey:t}])})}},ES=[wS,TS,cS,mS,vS,yS];function DS(e){return e.nodeId+`.`+e.outputName}var OS=Yx;function kS(e){return e.descriptor.description?`<small class="wf-input-hint">${e.escape(e.descriptor.description)}</small>`:``}function AS(e){return e==null?``:String(e)}function jS(e,t,n){let r=AS(e.value),i=t.some(e=>e.value===r),a=(r.length>0&&!i?[...t,{value:r,text:r+` — `+n}]:t).map(t=>`
459
+ <option value="${e.escape(t.value)}" ${t.value===r?`selected`:``}>${e.escape(t.text)}</option>
460
+ `).join(``);return`
461
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
462
+ <span>${OS(e)}</span>
463
+ <select id="${e.escape(e.elementId)}"
464
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``}>
465
+ <option value=""></option>
466
+ ${a}
467
+ </select>
468
+ ${kS(e)}
469
+ </label>
470
+ `}function MS(e){let t=e.value;return t.length===0?void 0:t}var NS=[{hint:Q.variablePicker,render:e=>jS(e,(e.variables??[]).map(e=>({value:e.name,text:e.typeName?e.name+` (`+e.typeName+`)`:e.name})),e.localize(`WorkflowDesignerUnknownVariable`,`not declared`)),read:MS},{hint:Q.outputPicker,render:e=>jS(e,(e.outputs??[]).map(e=>({value:DS(e),text:(e.nodeName??e.nodeId)+` → `+e.outputName})),e.localize(`WorkflowDesignerUnknownOutput`,`no longer produced`)),read:MS}],PS=Yx;function FS(e){return e.descriptor.description?`<small class="wf-input-hint">${e.escape(e.descriptor.description)}</small>`:``}function IS(e,t){let n=e.displayName?.trim()?e.displayName.trim():e.name;return e.hasUsableValue===!1?n+` — `+t(`WorkflowDesignerSecretUnusable`,`has no usable value`):n}var LS={hint:Q.secretPicker,render:e=>{let t=e.value===null||e.value===void 0?``:String(e.value),n=e.secrets??[],r=n.some(e=>e.name===t),i=n.map(n=>`
471
+ <option value="${e.escape(n.name)}" ${n.name===t?`selected`:``}>${e.escape(IS(n,e.localize))}</option>
472
+ `).join(``),a=t.length>0&&!r?`<option value="${e.escape(t)}" selected>${e.escape(t+` — `+e.localize(`WorkflowDesignerUnknownSecret`,`not found`))}</option>`:``,o=n.length===0?`<small class="wf-input-hint">${e.escape(e.localize(`WorkflowDesignerNoSecrets`,`No secrets have been added yet.`))}</small>`:``;return`
473
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
474
+ <span>${PS(e)}</span>
475
+ <select id="${e.escape(e.elementId)}"
476
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``}>
477
+ <option value=""></option>
478
+ ${i}
479
+ ${a}
480
+ </select>
481
+ ${o}
482
+ ${FS(e)}
483
+ </label>
484
+ `},read:e=>{let t=e.value;return t.length===0?void 0:t}},RS=`AdaptiveCard`;function zS(e){let t=(e??``).trim();if(t.length===0)return;let n;try{n=JSON.parse(t)}catch(e){return{kind:`invalid-json`,detail:e.message}}if(typeof n!=`object`||!n||Array.isArray(n))return{kind:`not-an-object`};let r=n;if(r.type!==RS)return{kind:`wrong-type`,detail:String(r.type??``)};if(!Array.isArray(r.body)||r.body.length===0)return{kind:`no-body`}}function BS(e,t){switch(e.kind){case`invalid-json`:return t(`WorkflowDesignerCardNotJson`,`This is not valid JSON.`);case`not-an-object`:return t(`WorkflowDesignerCardNotAnObject`,`A card must be a JSON object.`);case`wrong-type`:return t(`WorkflowDesignerCardWrongType`,`A card needs "type": "AdaptiveCard".`);default:return t(`WorkflowDesignerCardNoBody`,`A card needs a non-empty "body" array.`)}}var VS=Yx,HS={hint:Q.adaptiveCardEditor,render:e=>{let t=e.value===null||e.value===void 0?``:String(e.value),n=zS(t);return`
485
+ <label class="wf-input wf-adaptive-card" data-input="${e.escape(e.descriptor.name)}">
486
+ <span>${VS(e)}</span>
487
+ <textarea id="${e.escape(e.elementId)}" rows="10" spellcheck="false"
488
+ class="${n?`wf-input-invalid`:``}"
489
+ placeholder="${e.escape(e.localize(`WorkflowDesignerCardPlaceholder`,`Leave empty to use the message above.`))}"
490
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``}>${e.escape(t)}</textarea>
491
+ ${n?`<small class="wf-input-error">${e.escape(BS(n,e.localize))}</small>`:``}
492
+ ${e.descriptor.description?`<small class="wf-input-hint">${e.escape(e.descriptor.description)}</small>`:``}
493
+ </label>
494
+ `},read:e=>{let t=e.value;return t.trim().length===0?void 0:t},changeEvent:`change`};function US(e){return Array.isArray(e)?e.filter(e=>!!e):[]}function WS(e){let t=US(e);return{targets:t.filter(e=>!!e.target).map(e=>e.target),includeRequester:t.some(e=>e.includeRequester===!0),includePreviousApprovers:t.some(e=>e.includePreviousApprovers===!0)}}function GS(e){let t=e.targets.map(e=>({target:e,includeRequester:!1,includePreviousApprovers:!1}));return e.includeRequester&&t.push({target:null,includeRequester:!0,includePreviousApprovers:!1}),e.includePreviousApprovers&&t.push({target:null,includeRequester:!1,includePreviousApprovers:!0}),t}function KS(e,t){return{...e,value:t,elementId:e.elementId+`-targets`,descriptor:{...e.descriptor,name:e.descriptor.name+`.targets`,displayName:e.localize(`WorkflowNotificationRecipientPeople`,`People, roles or units`),isRequired:!1}}}var qS={hint:Q.notificationRecipients,render:e=>{let t=WS(e.value),n=e.disabled||e.descriptor.isReadOnly===!0?`disabled`:``;return`
495
+ <div class="wf-input" data-input="${e.escape(e.descriptor.name)}">
496
+ <span>${Yx(e)}</span>
497
+ <label class="wf-check">
498
+ <input type="checkbox" data-recipient-requester ${t.includeRequester?`checked`:``} ${n} />
499
+ <span>${e.escape(e.localize(`WorkflowNotificationRecipientRequester`,`The requester`))}</span>
500
+ </label>
501
+ <label class="wf-check">
502
+ <input type="checkbox" data-recipient-previous ${t.includePreviousApprovers?`checked`:``} ${n} />
503
+ <span>${e.escape(e.localize(`WorkflowNotificationRecipientPreviousApprovers`,`Approvers of the earlier steps`))}</span>
504
+ </label>
505
+ ${cS.render(KS(e,t.targets))}
506
+ </div>
507
+ `},read:()=>[],bind:(e,t,n)=>{let r=WS(t.value),i=e.querySelector(`[data-recipient-requester]`),a=e.querySelector(`[data-recipient-previous]`),o=e=>n(GS({targets:e,includeRequester:i?.checked===!0,includePreviousApprovers:a?.checked===!0}));i?.addEventListener(`change`,()=>o(r.targets)),a?.addEventListener(`change`,()=>o(r.targets));let s=e.querySelector(`[data-input="${CSS.escape(t.descriptor.name+`.targets`)}"]`);s&&cS.bind&&cS.bind(s,KS(t,r.targets),e=>o(e))}};function JS(e){if(e==null)return``;if(typeof e==`object`){let t=e;return typeof t.defaultValue==`string`?t.defaultValue:``}return String(e)}var YS=Yx;function XS(e){return e.descriptor.description?`<small class="wf-input-hint">${e.escape(e.descriptor.description)}</small>`:``}var ZS={hint:Q.singleLine,render:e=>`
508
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
509
+ <span>${YS(e)}</span>
510
+ <input type="text" id="${e.escape(e.elementId)}"
511
+ value="${e.escape(JS(e.value))}"
512
+ ${e.descriptor.maxLength?`maxlength="${e.descriptor.maxLength}"`:``}
513
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``} />
514
+ ${XS(e)}
515
+ </label>
516
+ `,read:e=>e.value},QS={hint:`sensitive`,render:e=>{let t=e.value!==null&&e.value!==void 0&&String(e.value).length>0;return`
517
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
518
+ <span>${YS(e)}</span>
519
+ <input type="password" id="${e.escape(e.elementId)}"
520
+ autocomplete="new-password"
521
+ value=""
522
+ placeholder="${e.escape(t?e.localize(`WorkflowDesignerSensitiveKept`,`Stored — type to replace`):``)}"
523
+ ${e.descriptor.maxLength?`maxlength="${e.descriptor.maxLength}"`:``}
524
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``} />
525
+ ${XS(e)}
526
+ </label>
527
+ `},read:e=>{let t=e.value;return t.length===0?void 0:t}},$S={hint:Q.multiLine,render:e=>`
528
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
529
+ <span>${YS(e)}</span>
530
+ <textarea id="${e.escape(e.elementId)}" rows="3"
531
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``}>${e.escape(JS(e.value))}</textarea>
532
+ ${XS(e)}
533
+ </label>
534
+ `,read:e=>e.value},eC={hint:`number`,render:e=>`
535
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
536
+ <span>${YS(e)}</span>
537
+ <input type="number" id="${e.escape(e.elementId)}"
538
+ value="${e.escape(JS(e.value))}"
539
+ ${e.descriptor.minValue===void 0?``:`min="${e.descriptor.minValue}"`}
540
+ ${e.descriptor.maxValue===void 0?``:`max="${e.descriptor.maxValue}"`}
541
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``} />
542
+ ${XS(e)}
543
+ </label>
544
+ `,read:e=>{let t=e.value.trim();if(t.length===0)return;let n=Number(t);return Number.isFinite(n)?n:void 0}},tC={hint:Q.checkbox,render:e=>`
545
+ <label class="wf-input wf-input-check" data-input="${e.escape(e.descriptor.name)}">
546
+ <input type="checkbox" id="${e.escape(e.elementId)}"
547
+ ${e.value===!0?`checked`:``}
548
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``} />
549
+ <span>${YS(e)}</span>
550
+ ${XS(e)}
551
+ </label>
552
+ `,read:e=>e.checked};function nC(e){let t=JS(e.value),n=e.descriptor.allowedValues??[],r=e.descriptor.defaultValue!==void 0&&e.descriptor.defaultValue!==null;return!(e.descriptor.isRequired===!0||r)||!n.some(e=>(e.value??``)===t&&t.length>0)}var rC={hint:Q.dropDown,render:e=>{let t=JS(e.value),n=(e.descriptor.allowedValues??[]).map(n=>`
553
+ <option value="${e.escape(n.value??``)}" ${n.value===t?`selected`:``}>
554
+ ${e.escape(n.displayText??n.value??``)}
555
+ </option>
556
+ `).join(``);return`
557
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
558
+ <span>${YS(e)}</span>
559
+ <select id="${e.escape(e.elementId)}"
560
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``}>
561
+ ${nC(e)?`<option value=""></option>`:``}
562
+ ${n}
563
+ </select>
564
+ ${XS(e)}
565
+ </label>
566
+ `},read:e=>{let t=e.value;return t.length===0?void 0:t}};function iC(e){if(e instanceof Date)return Number.isNaN(e.getTime())?``:e.toISOString();if(e&&typeof e==`object`){let t=e;if(typeof t.toISO==`function`)return t.toISO()??``;if(typeof t.toJSON==`function`){let e=t.toJSON();return typeof e==`string`?e:``}}return JS(e)}function aC(e){let t=iC(e);if(!t)return``;if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(t))return t;let n=new Date(t);if(Number.isNaN(n.getTime()))return``;let r=e=>String(e).padStart(2,`0`);return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}function oC(e){if(e.length===0)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString()}var sC={hint:Q.dateTimePicker,render:e=>`
567
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
568
+ <span>${YS(e)}</span>
569
+ <input type="datetime-local" id="${e.escape(e.elementId)}"
570
+ value="${e.escape(aC(e.value))}"
571
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``} />
572
+ ${XS(e)}
573
+ </label>
574
+ `,read:e=>oC(e.value)},cC={hint:Q.multiText,render:e=>{let t=Array.isArray(e.value)?e.value.map(e=>JS(e)).join(`
575
+ `):``;return`
576
+ <label class="wf-input" data-input="${e.escape(e.descriptor.name)}">
577
+ <span>${YS(e)}</span>
578
+ <textarea id="${e.escape(e.elementId)}" rows="4"
579
+ ${e.disabled||e.descriptor.isReadOnly?`disabled`:``}>${e.escape(t)}</textarea>
580
+ ${XS(e)}
581
+ </label>
582
+ `},read:e=>e.value.split(`
583
+ `).map(e=>e.trim()).filter(e=>e.length>0)},lC=new Set([`Int32`,`Int64`,`Decimal`,`Double`,`Single`]),uC=new Map([ZS,$S,eC,tC,rC,sC,cC,...ES,...NS,LS,HS,qS].map(e=>[e.hint,e]));function dC(e){uC.set(e.hint,e)}function fC(e){return e?uC.get(e):void 0}function pC(e){if(e.isSensitive&&e.uiHint!==Q.secretPicker)return QS;if(e.allowedValues&&e.allowedValues.length>0){let t=fC(e.uiHint);return t&&t.hint!==Q.singleLine?t:rC}return fC(e.uiHint)||(e.typeName&&lC.has(e.typeName)?eC:e.typeName===`Boolean`?tC:ZS)}function mC(){return[...uC.keys()]}var hC=`var:`,gC=`field:`;function _C(e,t,n){let r=e.map(e=>({key:gC+e.id,kind:`field`,id:e.id,label:n(e)})),i=(t??[]).filter(e=>(e?.name??``).trim().length>0).map(e=>({key:hC+e.name.trim(),kind:`variable`,id:e.name.trim(),label:e.name.trim()}));return[...r,...i]}function vC(e,t){return t?e.find(e=>e.key===t)||e.find(e=>e.kind===`field`&&e.id===t):void 0}function yC(e){if(e)return e.type===Mb.Variable?e.variableName?hC+e.variableName:void 0:e.fieldId?gC+e.fieldId:void 0}function bC(e,t){return e.kind===`variable`?{type:Mb.Variable,valueType:t,variableName:e.id}:{type:Mb.FormField,valueType:t,fieldId:e.id}}var xC=[`String`,`Boolean`,`Int32`,`Int64`,`Decimal`,`Double`,`DateTime`,`Guid`,`Json`],SC={instance:1,branch:2};function CC(){return{id:`var-`+Math.random().toString(36).slice(2,10),name:``,typeName:`String`,isArray:!1,value:``,scope:SC.instance,isSensitive:!1}}function wC(e,t){let n=(e.name??``).trim();return n.length===0?`empty`:n.startsWith(`__out.`)?`reserved`:t.filter(e=>(e.name??``).trim()===n).length>1?`duplicate`:void 0}function TC(e){let t=e.filter(t=>wC(t,e)===void 0),n=new Set;return t.filter(e=>{let t=(e.name??``).trim();return!n.has(t)&&(n.add(t),!0)}).map(e=>({name:(e.name??``).trim(),typeName:e.typeName,scope:e.scope===SC.branch?`Branch`:`Instance`,isSensitive:e.isSensitive===!0}))}function EC(e){let{escape:t,localize:n,disabled:r}=e,i=e.variables.map((i,a)=>{let o=wC(i,e.variables),s=xC.map(e=>`
584
+ <option value="${t(e)}" ${i.typeName===e?`selected`:``}>
585
+ ${t(e)}
586
+ </option>
587
+ `).join(``);return`
588
+ <li data-variable-row="${a}" class="wf-variable-card ${o?`wf-variable-invalid`:``}">
589
+ <div class="wf-variable-grid">
590
+ <label class="wf-field wf-variable-wide">
591
+ <span>${t(n(`WorkflowDesignerVariableName`,`Name`))}</span>
592
+ <input type="text" data-variable-field="name"
593
+ value="${t(i.name??``)}"
594
+ placeholder="${t(n(`WorkflowDesignerVariableName`,`Name`))}"
595
+ ${o?`class="wf-input-invalid"`:``}
596
+ ${r?`disabled`:``} />
597
+ ${o?`<small class="wf-input-error">${t(DC(o,n))}</small>`:``}
598
+ </label>
599
+ <label class="wf-field">
600
+ <span>${t(n(`WorkflowDesignerVariableType`,`Type`))}</span>
601
+ <select data-variable-field="typeName" ${r?`disabled`:``}>${s}</select>
602
+ </label>
603
+ <label class="wf-field">
604
+ <span>${t(n(`WorkflowDesignerVariableScope`,`Scope`))}</span>
605
+ <select data-variable-field="scope" ${r?`disabled`:``}>
606
+ <option value="${SC.instance}" ${i.scope===SC.branch?``:`selected`}>${t(n(`WorkflowDesignerVariableScopeInstance`,`Whole request`))}</option>
607
+ <option value="${SC.branch}" ${i.scope===SC.branch?`selected`:``}>${t(n(`WorkflowDesignerVariableScopeBranch`,`Each parallel branch`))}</option>
608
+ </select>
609
+ </label>
610
+ <label class="wf-field wf-variable-wide">
611
+ <span>${t(n(`WorkflowDesignerVariableValue`,`Starting value`))}</span>
612
+ <input type="text" data-variable-field="value"
613
+ value="${t(i.value??``)}"
614
+ placeholder="${t(n(`WorkflowDesignerVariableValue`,`Starting value`))}"
615
+ ${r?`disabled`:``} />
616
+ </label>
617
+ </div>
618
+ <div class="wf-variable-footer">
619
+ <label class="wf-checkbox">
620
+ <input type="checkbox" data-variable-field="isSensitive"
621
+ ${i.isSensitive?`checked`:``} ${r?`disabled`:``} />
622
+ <span>${t(n(`WorkflowDesignerVariableSensitive`,`Sensitive`))}</span>
623
+ </label>
624
+ <button type="button" class="wf-variable-remove" data-variable-remove="${a}" ${r?`disabled`:``}
625
+ title="${t(n(`Delete`,`Delete`))}" aria-label="${t(n(`Delete`,`Delete`))}">
626
+ ${$(`trash`,15)}
627
+ </button>
628
+ </div>
629
+ </li>
630
+ `}).join(``);return`
631
+ <section class="wf-variables" part="variables">
632
+ <h4>${$(`variables`,14)} ${t(n(`WorkflowDesignerVariables`,`Variables`))}</h4>
633
+ <p class="wf-muted">${t(n(`WorkflowDesignerVariablesHint`,`Values steps can write and later steps can read.`))}</p>
634
+ ${i?`<ul class="wf-variable-list">${i}</ul>`:``}
635
+ ${r?``:`<button type="button" class="wf-secondary" data-variable-add>
636
+ ${$(`plus`,15)}
637
+ ${t(n(`WorkflowDesignerAddVariable`,`Add a variable`))}
638
+ </button>`}
639
+ </section>
640
+ `}function DC(e,t){return e===`empty`?t(`WorkflowDesignerVariableNameRequired`,`Give the variable a name.`):e===`duplicate`?t(`WorkflowDesignerVariableNameDuplicate`,`Another variable already has this name.`):t(`WorkflowDesignerVariableNameReserved`,`This name is reserved for step outputs.`)}function OC(e,t){let n=t=>e.querySelector(`[data-variable-field="${t}"]`),r=Number(n(`scope`)?.value);return{...t,name:n(`name`)?.value??t.name,typeName:n(`typeName`)?.value??t.typeName,scope:Number.isFinite(r)&&r>0?r:SC.instance,value:n(`value`)?.value??t.value,isSensitive:n(`isSensitive`)?.checked??t.isSensitive}}var kC={[nx.literal]:{labelKey:`WorkflowActionBinding_Constant`,fallbackLabel:`A fixed value`},[nx.formField]:{labelKey:`WorkflowActionBinding_FormField`,fallbackLabel:`From a form field`},[nx.context]:{labelKey:`WorkflowActionBinding_Context`,fallbackLabel:`From the request`},[nx.variable]:{labelKey:`WorkflowActionBinding_Variable`,fallbackLabel:`From a variable`},[nx.output]:{labelKey:`WorkflowActionBinding_Output`,fallbackLabel:`From a previous step`},[nx.secret]:{labelKey:`WorkflowActionBinding_Secret`,fallbackLabel:`From a secret`},[nx.template]:{labelKey:`WorkflowActionBinding_Template`,fallbackLabel:`A text template`},[nx.condition]:{labelKey:`WorkflowActionBinding_Condition`,fallbackLabel:`A condition`}};function AC(e){return(e.supportedSyntaxes??[]).filter(e=>kC[e]!==void 0).map(e=>({syntax:e,...kC[e]}))}function jC(e){return AC(e).length>1}var MC={[nx.literal]:`constant`,[nx.formField]:`formField`,[nx.context]:`context`};function NC(e){return MC[e]??`constant`}function PC(e){let t=Object.entries(MC).find(([,t])=>t===e);return t?t[0]:nx.literal}function FC(e){return e.options.length<2?``:`
641
+ <select class="${e.escape(e.className)}" data-syntax-picker
642
+ ${e.disabled?`disabled`:``}>
643
+ ${e.options.map(t=>`<option value="${e.escape(t.syntax)}" ${t.syntax===e.selected?`selected`:``}>${e.escape(e.localize(t.labelKey,t.fallbackLabel))}</option>`).join(``)}
644
+ </select>
645
+ `}var IC={parallelNodes:`workflow.graph.parallelNodes`,joinNodes:`workflow.graph.joinNodes`};function LC(e){return(t,n)=>t.nodes.filter(t=>t.type===e&&t.id!==n).map(e=>({value:e.id,displayText:Z(e.name,e.id)}))}var RC=new Map([[IC.parallelNodes,LC(J.Parallel)],[IC.joinNodes,LC(J.Join)]]);function zC(e,t){RC.set(e,t)}function BC(e){return e?RC.get(e):void 0}function VC(e){return BC(e)!==void 0}var HC=`workflow.formFields`,UC=`
646
+ :host {
647
+ --wf-canvas-bg: var(--bs-gray-100, #f9f9f9);
648
+ }
649
+
650
+ .wf-designer {
651
+ container: wf-designer / inline-size;
652
+ display: grid;
653
+ grid-template-columns: 232px minmax(0, 1fr) 328px;
654
+ grid-template-rows: auto minmax(0, 1fr);
655
+ grid-template-areas:
656
+ 'toolbar toolbar toolbar'
657
+ 'palette canvas inspector';
658
+ height: 100%;
659
+ min-height: var(--wf-designer-min-height, 560px);
660
+ overflow: hidden;
661
+ background: var(--wf-surface);
662
+ border: 1px solid var(--wf-border);
663
+ border-radius: var(--wf-radius-lg);
664
+ }
665
+
666
+ .wf-designer:focus-visible {
667
+ outline: none;
668
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
669
+ }
670
+
671
+ .wf-toolbar {
672
+ grid-area: toolbar;
673
+ display: flex;
674
+ flex-wrap: wrap;
675
+ align-items: center;
676
+ gap: 4px;
677
+ min-height: 52px;
678
+ padding: 8px 12px;
679
+ background: var(--wf-surface);
680
+ border-bottom: 1px solid var(--wf-border-light);
681
+ }
682
+
683
+ .wf-tool-group {
684
+ display: inline-flex;
685
+ align-items: center;
686
+ gap: 2px;
687
+ }
688
+
689
+ .wf-tool {
690
+ display: inline-flex;
691
+ align-items: center;
692
+ gap: 6px;
693
+ height: 34px;
694
+ padding: 0 10px;
695
+ font: inherit;
696
+ font-size: 12.5px;
697
+ font-weight: 600;
698
+ white-space: nowrap;
699
+ color: var(--wf-text-secondary);
700
+ background: transparent;
701
+ border: 1px solid transparent;
702
+ border-radius: var(--wf-radius);
703
+ cursor: pointer;
704
+ transition: background-color 0.15s ease, color 0.15s ease;
705
+ }
706
+
707
+ .wf-tool .wf-icon {
708
+ color: var(--wf-muted);
709
+ transition: color 0.15s ease;
710
+ }
711
+
712
+ .wf-tool:hover:not([disabled]),
713
+ .wf-tool[aria-pressed='true'] {
714
+ color: var(--wf-primary);
715
+ background: var(--wf-primary-light);
716
+ }
717
+
718
+ .wf-tool:hover:not([disabled]) .wf-icon,
719
+ .wf-tool[aria-pressed='true'] .wf-icon {
720
+ color: var(--wf-primary);
721
+ }
722
+
723
+ .wf-tool:focus-visible {
724
+ outline: none;
725
+ box-shadow: 0 0 0 2px var(--wf-primary);
726
+ }
727
+
728
+ .wf-tool[disabled] {
729
+ color: var(--wf-placeholder);
730
+ cursor: not-allowed;
731
+ }
732
+
733
+ .wf-tool[disabled] .wf-icon {
734
+ color: var(--bs-gray-400, #c4cada);
735
+ }
736
+
737
+ .wf-tool-divider {
738
+ flex: 0 0 auto;
739
+ width: 1px;
740
+ height: 22px;
741
+ margin: 0 6px;
742
+ background: var(--wf-border);
743
+ }
744
+
745
+ .wf-tool-spacer {
746
+ flex: 1 1 auto;
747
+ }
748
+
749
+ .wf-tool-text {
750
+ display: inline-flex;
751
+ align-items: center;
752
+ gap: 6px;
753
+ padding: 5px 10px;
754
+ font-size: 12px;
755
+ font-weight: 600;
756
+ white-space: nowrap;
757
+ color: var(--wf-text-secondary);
758
+ background: var(--wf-subtle);
759
+ border: 1px solid var(--wf-border-light);
760
+ border-radius: 999px;
761
+ }
762
+
763
+ .wf-tool-text strong {
764
+ color: var(--wf-text);
765
+ }
766
+
767
+ .wf-tool-warning {
768
+ display: inline-flex;
769
+ align-items: center;
770
+ gap: 6px;
771
+ max-width: 420px;
772
+ padding: 5px 10px;
773
+ overflow: hidden;
774
+ font-size: 12px;
775
+ font-weight: 600;
776
+ white-space: nowrap;
777
+ text-overflow: ellipsis;
778
+ color: var(--bs-warning-active, #dead00);
779
+ background: var(--wf-warning-light);
780
+ border-radius: var(--wf-radius);
781
+ }
782
+
783
+ @container wf-designer (max-width: 820px) {
784
+ .wf-tool-label {
785
+ display: none;
786
+ }
787
+
788
+ .wf-tool {
789
+ padding: 0 8px;
790
+ }
791
+ }
792
+
793
+ .wf-palette {
794
+ grid-area: palette;
795
+ min-height: 0;
796
+ padding: 16px 14px;
797
+ overflow-y: auto;
798
+ background: var(--wf-surface);
799
+ border-inline-end: 1px solid var(--wf-border-light);
800
+ }
801
+
802
+ .wf-palette-group {
803
+ margin: 0 0 18px;
804
+ }
805
+
806
+ .wf-palette-group h5 {
807
+ margin: 0 2px 8px;
808
+ font-size: 10.5px;
809
+ font-weight: 700;
810
+ letter-spacing: 0.08em;
811
+ text-transform: uppercase;
812
+ color: var(--wf-placeholder);
813
+ }
814
+
815
+ .wf-palette-item {
816
+ --wf-item-color: var(--wf-primary);
817
+ display: flex;
818
+ align-items: center;
819
+ gap: 10px;
820
+ width: 100%;
821
+ margin: 0 0 6px;
822
+ padding: 8px 10px;
823
+ font: inherit;
824
+ text-align: start;
825
+ color: var(--wf-text);
826
+ background: var(--wf-surface);
827
+ border: 1px solid var(--wf-border-light);
828
+ border-radius: var(--wf-radius-lg);
829
+ cursor: grab;
830
+ transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
831
+ }
832
+
833
+ .wf-palette-item:hover:not([disabled]) {
834
+ border-color: color-mix(in srgb, var(--wf-item-color) 45%, transparent);
835
+ box-shadow: var(--wf-shadow);
836
+ }
837
+
838
+ .wf-palette-item:active:not([disabled]) {
839
+ cursor: grabbing;
840
+ }
841
+
842
+ .wf-palette-item:focus-visible {
843
+ outline: none;
844
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
845
+ }
846
+
847
+ .wf-palette-item[disabled] {
848
+ opacity: 0.55;
849
+ cursor: not-allowed;
850
+ }
851
+
852
+ .wf-palette-icon {
853
+ display: inline-flex;
854
+ flex: 0 0 34px;
855
+ align-items: center;
856
+ justify-content: center;
857
+ width: 34px;
858
+ height: 34px;
859
+ font-size: 15px;
860
+ color: var(--wf-item-color);
861
+ background: color-mix(in srgb, var(--wf-item-color) 12%, transparent);
862
+ border-radius: var(--wf-radius);
863
+ }
864
+
865
+ .wf-palette-text {
866
+ display: flex;
867
+ flex-direction: column;
868
+ gap: 2px;
869
+ min-width: 0;
870
+ }
871
+
872
+ .wf-palette-text strong {
873
+ overflow: hidden;
874
+ font-size: 13px;
875
+ font-weight: 600;
876
+ white-space: nowrap;
877
+ text-overflow: ellipsis;
878
+ color: var(--wf-text);
879
+ }
880
+
881
+ .wf-palette-text small {
882
+ display: -webkit-box;
883
+ overflow: hidden;
884
+ font-size: 11.5px;
885
+ line-height: 1.4;
886
+ color: var(--wf-muted);
887
+ -webkit-line-clamp: 2;
888
+ -webkit-box-orient: vertical;
889
+ }
890
+
891
+ .wf-palette-search {
892
+ width: 100%;
893
+ }
894
+
895
+ .wf-designer.wf-palette-collapsed {
896
+ grid-template-columns: 70px minmax(0, 1fr) 328px;
897
+ }
898
+
899
+ .wf-designer.wf-readonly {
900
+ grid-template-columns: 0 minmax(0, 1fr) 328px;
901
+ /* Read-only views (instance timeline, template preview, analytics heat map) are embedded in boxes
902
+ shorter than the editor; a taller minimum would push the canvas, its zoom bar and minimap out of
903
+ the host box and over the content below it. */
904
+ min-height: var(--wf-designer-readonly-min-height, 320px);
905
+ }
906
+
907
+ .wf-readonly .wf-palette {
908
+ display: none;
909
+ }
910
+
911
+ .wf-palette-collapsed .wf-palette {
912
+ padding: 14px 10px;
913
+ }
914
+
915
+ .wf-palette-collapsed .wf-palette > h4,
916
+ .wf-palette-collapsed .wf-search,
917
+ .wf-palette-collapsed .wf-palette-text,
918
+ .wf-palette-collapsed .wf-palette-group h5,
919
+ .wf-palette-collapsed .wf-palette > .wf-muted,
920
+ .wf-palette-collapsed .wf-palette-items > .wf-muted {
921
+ display: none;
922
+ }
923
+
924
+ .wf-palette-collapsed .wf-palette-group {
925
+ margin-bottom: 10px;
926
+ padding-bottom: 10px;
927
+ border-bottom: 1px dashed var(--wf-border-light);
928
+ }
929
+
930
+ .wf-palette-collapsed .wf-palette-item {
931
+ justify-content: center;
932
+ padding: 6px;
933
+ }
934
+
935
+ .wf-stage {
936
+ container: wf-stage / size;
937
+ grid-area: canvas;
938
+ position: relative;
939
+ min-width: 0;
940
+ min-height: 0;
941
+ overflow: hidden;
942
+ background: var(--wf-canvas-bg);
943
+ }
944
+
945
+ .wf-stage.wf-drop-active {
946
+ box-shadow: inset 0 0 0 2px var(--wf-primary);
947
+ background: color-mix(in srgb, var(--wf-primary) 4%, var(--wf-canvas-bg));
948
+ }
949
+
950
+ .wf-canvas {
951
+ position: absolute;
952
+ inset: 0;
953
+ min-height: 0;
954
+ }
955
+
956
+ .wf-drop-hint {
957
+ position: absolute;
958
+ top: 14px;
959
+ left: 50%;
960
+ z-index: 3;
961
+ margin: 0;
962
+ padding: 6px 12px;
963
+ font-size: 12px;
964
+ font-weight: 600;
965
+ color: #ffffff;
966
+ background: var(--wf-primary);
967
+ border-radius: 999px;
968
+ box-shadow: var(--wf-shadow);
969
+ transform: translateX(-50%);
970
+ pointer-events: none;
971
+ }
972
+
973
+ .wf-zoom {
974
+ position: absolute;
975
+ inset-block-end: 16px;
976
+ inset-inline-start: 16px;
977
+ z-index: 3;
978
+ display: flex;
979
+ align-items: center;
980
+ gap: 2px;
981
+ padding: 4px;
982
+ background: var(--wf-surface);
983
+ border: 1px solid var(--wf-border-light);
984
+ border-radius: var(--wf-radius-lg);
985
+ box-shadow: var(--wf-shadow);
986
+ }
987
+
988
+ .wf-zoom-button,
989
+ .wf-zoom-level {
990
+ display: inline-flex;
991
+ align-items: center;
992
+ justify-content: center;
993
+ min-width: 30px;
994
+ height: 30px;
995
+ padding: 0 6px;
996
+ font: inherit;
997
+ font-size: 12px;
998
+ font-weight: 600;
999
+ color: var(--wf-text-secondary);
1000
+ background: transparent;
1001
+ border: 0;
1002
+ border-radius: var(--wf-radius);
1003
+ cursor: pointer;
1004
+ transition: background-color 0.15s ease, color 0.15s ease;
1005
+ }
1006
+
1007
+ .wf-zoom-level {
1008
+ min-width: 54px;
1009
+ }
1010
+
1011
+ .wf-zoom-button:hover,
1012
+ .wf-zoom-level:hover {
1013
+ color: var(--wf-primary);
1014
+ background: var(--wf-primary-light);
1015
+ }
1016
+
1017
+ .wf-zoom-button:focus-visible,
1018
+ .wf-zoom-level:focus-visible {
1019
+ outline: none;
1020
+ box-shadow: 0 0 0 2px var(--wf-primary);
1021
+ }
1022
+
1023
+ .wf-zoom-divider {
1024
+ width: 1px;
1025
+ height: 18px;
1026
+ margin: 0 2px;
1027
+ background: var(--wf-border);
1028
+ }
1029
+
1030
+ .wf-minimap {
1031
+ position: absolute;
1032
+ inset-block-end: 16px;
1033
+ inset-inline-end: 16px;
1034
+ z-index: 3;
1035
+ box-sizing: border-box;
1036
+ max-width: calc(100% - 32px);
1037
+ max-height: calc(100% - 32px);
1038
+ overflow: hidden;
1039
+ background: var(--wf-surface);
1040
+ border: 1px solid var(--wf-border-light);
1041
+ border-radius: var(--wf-radius-lg);
1042
+ box-shadow: var(--wf-shadow);
1043
+ }
1044
+
1045
+ .wf-minimap:empty {
1046
+ display: none;
1047
+ }
1048
+
1049
+ .wf-minimap .x6-widget-minimap {
1050
+ max-width: 100%;
1051
+ max-height: 100%;
1052
+ background: var(--wf-surface);
1053
+ }
1054
+
1055
+ .wf-minimap .x6-widget-minimap .x6-graph {
1056
+ background: transparent;
1057
+ }
1058
+
1059
+ .wf-minimap .x6-widget-minimap-viewport {
1060
+ border-color: var(--wf-primary);
1061
+ }
1062
+
1063
+ .wf-minimap .x6-widget-minimap-viewport-zoom {
1064
+ border-color: var(--wf-primary);
1065
+ background: var(--wf-surface);
1066
+ }
1067
+
1068
+ @container wf-designer (max-width: 1100px) {
1069
+ .wf-minimap {
1070
+ display: none;
1071
+ }
1072
+ }
1073
+
1074
+ /* The minimap is a navigation aid; once the canvas is too small to hold it next to the zoom bar
1075
+ without covering the diagram it is hidden rather than clipped. */
1076
+ @container wf-stage (max-height: 300px) {
1077
+ .wf-minimap {
1078
+ display: none;
1079
+ }
1080
+ }
1081
+
1082
+ @container wf-stage (max-width: 520px) {
1083
+ .wf-minimap {
1084
+ display: none;
1085
+ }
1086
+ }
1087
+
1088
+ .wf-inspector {
1089
+ grid-area: inspector;
1090
+ min-height: 0;
1091
+ padding: 16px 18px 20px;
1092
+ overflow-y: auto;
1093
+ background: var(--wf-surface);
1094
+ border-inline-start: 1px solid var(--wf-border-light);
1095
+ }
1096
+
1097
+ .wf-inspector-head {
1098
+ display: flex;
1099
+ align-items: center;
1100
+ gap: 12px;
1101
+ margin: 0 0 16px;
1102
+ }
1103
+
1104
+ .wf-inspector-icon {
1105
+ --wf-item-color: var(--wf-primary);
1106
+ display: inline-flex;
1107
+ flex: 0 0 40px;
1108
+ align-items: center;
1109
+ justify-content: center;
1110
+ width: 40px;
1111
+ height: 40px;
1112
+ color: var(--wf-item-color);
1113
+ background: color-mix(in srgb, var(--wf-item-color) 12%, transparent);
1114
+ border-radius: var(--wf-radius-lg);
1115
+ }
1116
+
1117
+ .wf-inspector-title {
1118
+ display: flex;
1119
+ flex-direction: column;
1120
+ gap: 2px;
1121
+ min-width: 0;
1122
+ }
1123
+
1124
+ .wf-inspector-title strong {
1125
+ overflow: hidden;
1126
+ font-size: 14px;
1127
+ font-weight: 700;
1128
+ white-space: nowrap;
1129
+ text-overflow: ellipsis;
1130
+ color: var(--wf-text);
1131
+ }
1132
+
1133
+ .wf-inspector-title small {
1134
+ overflow: hidden;
1135
+ font-size: 12px;
1136
+ font-weight: 500;
1137
+ white-space: nowrap;
1138
+ text-overflow: ellipsis;
1139
+ color: var(--wf-muted);
1140
+ }
1141
+
1142
+ .wf-inspector-empty {
1143
+ display: flex;
1144
+ flex-direction: column;
1145
+ align-items: center;
1146
+ gap: 8px;
1147
+ margin: 0 0 20px;
1148
+ padding: 20px 16px;
1149
+ text-align: center;
1150
+ color: var(--wf-muted);
1151
+ background: var(--wf-subtle);
1152
+ border: 1px dashed var(--wf-border);
1153
+ border-radius: var(--wf-radius-lg);
1154
+ }
1155
+
1156
+ .wf-inspector-empty .wf-icon {
1157
+ color: var(--wf-placeholder);
1158
+ }
1159
+
1160
+ .wf-inspector-empty p {
1161
+ margin: 0;
1162
+ font-size: 12.5px;
1163
+ line-height: 1.5;
1164
+ }
1165
+
1166
+ .wf-inspector-empty strong {
1167
+ font-size: 13px;
1168
+ color: var(--wf-text);
1169
+ }
1170
+
1171
+ .wf-node-meta {
1172
+ display: flex;
1173
+ flex-direction: column;
1174
+ gap: 6px;
1175
+ margin: 0 0 4px;
1176
+ padding: 12px;
1177
+ font-size: 12.5px;
1178
+ line-height: 1.5;
1179
+ color: var(--wf-muted);
1180
+ background: var(--wf-subtle);
1181
+ border-radius: var(--wf-radius);
1182
+ }
1183
+
1184
+ .wf-node-meta code {
1185
+ padding: 1px 6px;
1186
+ font-family: var(--bs-font-monospace, SFMono-Regular, Menlo, Consolas, monospace);
1187
+ font-size: 11.5px;
1188
+ color: var(--wf-text-secondary);
1189
+ background: var(--wf-hover);
1190
+ border-radius: 4px;
1191
+ }
1192
+
1193
+ .wf-inspector-footer {
1194
+ margin-top: 20px;
1195
+ padding-top: 16px;
1196
+ border-top: 1px solid var(--wf-border-light);
1197
+ }
1198
+
1199
+ .wf-tab-panel > .wf-section:first-child {
1200
+ margin-top: 0;
1201
+ padding-top: 0;
1202
+ border-top: 0;
1203
+ }
1204
+
1205
+ .wf-branch-list {
1206
+ display: flex;
1207
+ flex-direction: column;
1208
+ gap: 6px;
1209
+ margin: 0 0 12px;
1210
+ padding: 0;
1211
+ list-style: none;
1212
+ }
1213
+
1214
+ .wf-branch-list li {
1215
+ display: flex;
1216
+ align-items: center;
1217
+ gap: 4px;
1218
+ padding: 4px;
1219
+ background: var(--wf-surface);
1220
+ border: 1px solid var(--wf-border-light);
1221
+ border-radius: var(--wf-radius);
1222
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
1223
+ }
1224
+
1225
+ .wf-branch-list li:hover {
1226
+ border-color: var(--wf-border);
1227
+ }
1228
+
1229
+ .wf-branch-list li.wf-branch-active {
1230
+ border-color: var(--wf-primary);
1231
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
1232
+ }
1233
+
1234
+ .wf-branch-select {
1235
+ display: flex;
1236
+ flex: 1 1 auto;
1237
+ flex-direction: column;
1238
+ gap: 2px;
1239
+ min-width: 0;
1240
+ padding: 4px 8px;
1241
+ font: inherit;
1242
+ text-align: start;
1243
+ color: var(--wf-text);
1244
+ background: none;
1245
+ border: 0;
1246
+ cursor: pointer;
1247
+ }
1248
+
1249
+ .wf-branch-select span {
1250
+ overflow: hidden;
1251
+ font-size: 13px;
1252
+ font-weight: 600;
1253
+ white-space: nowrap;
1254
+ text-overflow: ellipsis;
1255
+ }
1256
+
1257
+ .wf-branch-select small {
1258
+ overflow: hidden;
1259
+ font-size: 12px;
1260
+ white-space: nowrap;
1261
+ text-overflow: ellipsis;
1262
+ color: var(--wf-muted);
1263
+ }
1264
+
1265
+ .wf-branch-actions {
1266
+ display: flex;
1267
+ flex: 0 0 auto;
1268
+ gap: 2px;
1269
+ }
1270
+
1271
+ .wf-variables {
1272
+ margin: 22px 0 0;
1273
+ padding-top: 18px;
1274
+ border-top: 1px solid var(--wf-border-light);
1275
+ }
1276
+
1277
+ .wf-variables > h4 {
1278
+ display: flex;
1279
+ align-items: center;
1280
+ gap: 6px;
1281
+ margin-bottom: 6px;
1282
+ }
1283
+
1284
+ .wf-variable-list {
1285
+ display: flex;
1286
+ flex-direction: column;
1287
+ gap: 10px;
1288
+ margin: 0 0 12px;
1289
+ padding: 0;
1290
+ list-style: none;
1291
+ }
1292
+
1293
+ .wf-variable-card {
1294
+ padding: 12px;
1295
+ background: var(--wf-subtle);
1296
+ border: 1px solid var(--wf-border-light);
1297
+ border-radius: var(--wf-radius-lg);
1298
+ }
1299
+
1300
+ .wf-variable-card.wf-variable-invalid {
1301
+ border-color: color-mix(in srgb, var(--wf-danger) 45%, transparent);
1302
+ background: color-mix(in srgb, var(--wf-danger-light) 60%, var(--wf-surface));
1303
+ }
1304
+
1305
+ .wf-variable-grid {
1306
+ display: grid;
1307
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
1308
+ gap: 10px;
1309
+ }
1310
+
1311
+ .wf-variable-grid .wf-field {
1312
+ margin: 0;
1313
+ }
1314
+
1315
+ .wf-variable-grid .wf-variable-wide {
1316
+ grid-column: 1 / -1;
1317
+ }
1318
+
1319
+ .wf-variable-footer {
1320
+ display: flex;
1321
+ align-items: center;
1322
+ justify-content: space-between;
1323
+ gap: 8px;
1324
+ margin-top: 10px;
1325
+ }
1326
+
1327
+ .wf-variable-footer .wf-checkbox {
1328
+ margin: 0;
1329
+ }
1330
+
1331
+ .wf-outline {
1332
+ grid-area: canvas;
1333
+ min-height: 0;
1334
+ padding: 18px 20px;
1335
+ overflow-y: auto;
1336
+ background: var(--wf-canvas-bg);
1337
+ }
1338
+
1339
+ .wf-outline-list {
1340
+ display: flex;
1341
+ flex-direction: column;
1342
+ gap: 10px;
1343
+ margin: 0 0 16px;
1344
+ padding: 0;
1345
+ list-style: none;
1346
+ }
1347
+
1348
+ .wf-outline-node {
1349
+ padding: 10px 12px;
1350
+ background: var(--wf-surface);
1351
+ border: 1px solid var(--wf-border-light);
1352
+ border-radius: var(--wf-radius-lg);
1353
+ box-shadow: var(--wf-shadow-sm);
1354
+ }
1355
+
1356
+ .wf-outline-active {
1357
+ border-color: var(--wf-primary);
1358
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
1359
+ }
1360
+
1361
+ .wf-outline-select {
1362
+ display: flex;
1363
+ align-items: center;
1364
+ gap: 10px;
1365
+ width: 100%;
1366
+ padding: 2px;
1367
+ font: inherit;
1368
+ text-align: start;
1369
+ color: var(--wf-text);
1370
+ background: none;
1371
+ border: 0;
1372
+ border-radius: var(--wf-radius);
1373
+ cursor: pointer;
1374
+ }
1375
+
1376
+ .wf-outline-select:focus-visible {
1377
+ outline: none;
1378
+ box-shadow: 0 0 0 2px var(--wf-primary);
1379
+ }
1380
+
1381
+ .wf-outline-icon {
1382
+ --wf-item-color: var(--wf-primary);
1383
+ display: inline-flex;
1384
+ flex: 0 0 32px;
1385
+ align-items: center;
1386
+ justify-content: center;
1387
+ width: 32px;
1388
+ height: 32px;
1389
+ color: var(--wf-item-color);
1390
+ background: color-mix(in srgb, var(--wf-item-color) 12%, transparent);
1391
+ border-radius: var(--wf-radius);
1392
+ }
1393
+
1394
+ .wf-outline-name {
1395
+ flex: 1 1 auto;
1396
+ min-width: 0;
1397
+ overflow: hidden;
1398
+ font-size: 13.5px;
1399
+ font-weight: 600;
1400
+ white-space: nowrap;
1401
+ text-overflow: ellipsis;
1402
+ }
1403
+
1404
+ .wf-outline-select small {
1405
+ flex: 0 0 auto;
1406
+ font-size: 12px;
1407
+ color: var(--wf-muted);
1408
+ }
1409
+
1410
+ .wf-outline-outcomes {
1411
+ display: flex;
1412
+ flex-direction: column;
1413
+ gap: 6px;
1414
+ margin: 10px 0 2px;
1415
+ padding: 10px 0 0 42px;
1416
+ list-style: none;
1417
+ border-top: 1px dashed var(--wf-border-light);
1418
+ }
1419
+
1420
+ .wf-outline-outcome {
1421
+ display: flex;
1422
+ align-items: center;
1423
+ gap: 8px;
1424
+ }
1425
+
1426
+ .wf-outline-outcome-label {
1427
+ display: flex;
1428
+ flex: 1 1 auto;
1429
+ align-items: center;
1430
+ gap: 10px;
1431
+ min-width: 0;
1432
+ font-size: 12.5px;
1433
+ }
1434
+
1435
+ .wf-outline-outcome-label > span {
1436
+ flex: 0 0 140px;
1437
+ overflow: hidden;
1438
+ font-weight: 600;
1439
+ white-space: nowrap;
1440
+ text-overflow: ellipsis;
1441
+ color: var(--wf-text-secondary);
1442
+ }
1443
+
1444
+ .wf-outline-outcome-label select {
1445
+ flex: 1 1 auto;
1446
+ min-width: 0;
1447
+ min-height: 34px;
1448
+ padding: 6px 34px 6px 10px;
1449
+ font: inherit;
1450
+ font-size: 12.5px;
1451
+ font-weight: 500;
1452
+ color: var(--wf-input-text);
1453
+ background-color: var(--wf-surface);
1454
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378829d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m6 9 6 6 6-6'/%3e%3c/svg%3e");
1455
+ background-repeat: no-repeat;
1456
+ background-position: right 10px center;
1457
+ background-size: 14px 14px;
1458
+ border: 1px solid var(--wf-border);
1459
+ border-radius: var(--wf-radius);
1460
+ appearance: none;
1461
+ outline: none;
1462
+ }
1463
+
1464
+ .wf-outline-outcome-label select:focus {
1465
+ border-color: var(--wf-primary);
1466
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
1467
+ }
1468
+
1469
+ .wf-outline .wf-outline-autolayout {
1470
+ width: auto;
1471
+ }
1472
+
1473
+ .wf-summary {
1474
+ margin: 0;
1475
+ padding: 14px;
1476
+ background: var(--wf-subtle);
1477
+ border: 1px solid var(--wf-border-light);
1478
+ border-radius: var(--wf-radius-lg);
1479
+ }
1480
+
1481
+ .wf-summary-head {
1482
+ display: flex;
1483
+ align-items: center;
1484
+ gap: 8px;
1485
+ }
1486
+
1487
+ .wf-summary-head h5 {
1488
+ flex: 1 1 auto;
1489
+ margin: 0;
1490
+ font-size: 11px;
1491
+ font-weight: 700;
1492
+ letter-spacing: 0.06em;
1493
+ text-transform: uppercase;
1494
+ color: var(--wf-muted);
1495
+ }
1496
+
1497
+ .wf-summary-toggle .wf-icon {
1498
+ transition: transform 0.2s ease;
1499
+ }
1500
+
1501
+ .wf-summary-collapsed .wf-summary-toggle .wf-icon {
1502
+ transform: rotate(180deg);
1503
+ }
1504
+
1505
+ .wf-summary-body {
1506
+ margin-top: 10px;
1507
+ }
1508
+
1509
+ .wf-summary-list {
1510
+ display: flex;
1511
+ flex-direction: column;
1512
+ gap: 4px;
1513
+ margin: 0;
1514
+ padding-inline-start: 20px;
1515
+ font-size: 12.5px;
1516
+ line-height: 1.55;
1517
+ color: var(--wf-text-secondary);
1518
+ }
1519
+
1520
+ .wf-summary-list li::marker {
1521
+ font-weight: 700;
1522
+ color: var(--wf-primary);
1523
+ }
1524
+
1525
+ .wf-assistant-warning {
1526
+ display: flex;
1527
+ align-items: flex-start;
1528
+ gap: 6px;
1529
+ margin: 8px 0 0;
1530
+ padding: 8px 10px;
1531
+ font-size: 12.5px;
1532
+ line-height: 1.45;
1533
+ color: var(--wf-text-secondary);
1534
+ background: var(--wf-warning-light);
1535
+ border: 1px solid color-mix(in srgb, var(--wf-warning) 35%, transparent);
1536
+ border-radius: var(--wf-radius);
1537
+ }
1538
+
1539
+ .wf-assistant-warning svg {
1540
+ flex: 0 0 auto;
1541
+ margin-top: 2px;
1542
+ color: var(--wf-warning);
1543
+ }
1544
+
1545
+ .wf-summary-assistant {
1546
+ margin: 12px 0 0;
1547
+ padding: 10px 12px;
1548
+ font-size: 12.5px;
1549
+ line-height: 1.55;
1550
+ color: var(--wf-text-secondary);
1551
+ background: var(--wf-primary-light);
1552
+ border-radius: var(--wf-radius);
1553
+ }
1554
+
1555
+ .wf-summary .wf-summary-explain {
1556
+ margin-top: 12px;
1557
+ }
1558
+
1559
+ .x6-graph {
1560
+ position: relative;
1561
+ overflow: hidden;
1562
+ outline: none;
1563
+ touch-action: none;
1564
+ }
1565
+
1566
+ .x6-graph-background,
1567
+ .x6-graph-grid,
1568
+ .x6-graph-svg {
1569
+ position: absolute;
1570
+ inset: 0;
1571
+ }
1572
+
1573
+ .x6-graph-background-stage,
1574
+ .x6-graph-grid-stage,
1575
+ .x6-graph-svg-stage {
1576
+ user-select: none;
1577
+ }
1578
+
1579
+ .x6-graph.x6-graph-pannable {
1580
+ cursor: grab;
1581
+ }
1582
+
1583
+ .x6-graph.x6-graph-panning {
1584
+ cursor: grabbing;
1585
+ user-select: none;
1586
+ }
1587
+
1588
+ .x6-node {
1589
+ cursor: move;
1590
+ }
1591
+
1592
+ .x6-node.x6-node-immovable {
1593
+ cursor: pointer;
1594
+ }
1595
+
1596
+ .x6-node * {
1597
+ -webkit-user-drag: none;
1598
+ }
1599
+
1600
+ .x6-node [magnet='true'] {
1601
+ cursor: crosshair;
1602
+ transition: opacity 0.2s ease;
1603
+ }
1604
+
1605
+ .x6-node [magnet='true']:hover {
1606
+ opacity: 0.75;
1607
+ }
1608
+
1609
+ .x6-edge .connection {
1610
+ fill: none;
1611
+ stroke-linejoin: round;
1612
+ }
1613
+
1614
+ .x6-edge .connection-wrap {
1615
+ fill: none;
1616
+ stroke: #000;
1617
+ stroke-width: 15;
1618
+ stroke-linecap: round;
1619
+ stroke-linejoin: round;
1620
+ opacity: 0;
1621
+ cursor: pointer;
1622
+ }
1623
+
1624
+ .x6-widget-selection {
1625
+ position: absolute;
1626
+ top: 0;
1627
+ left: 0;
1628
+ display: none;
1629
+ width: 0;
1630
+ height: 0;
1631
+ touch-action: none;
1632
+ }
1633
+
1634
+ .x6-widget-selection-rubberband {
1635
+ display: block;
1636
+ overflow: visible;
1637
+ background-color: color-mix(in srgb, var(--wf-primary) 10%, transparent);
1638
+ border: 1px solid var(--wf-primary);
1639
+ border-radius: 4px;
1640
+ }
1641
+
1642
+ .x6-widget-selection-selected {
1643
+ display: block;
1644
+ }
1645
+
1646
+ .x6-widget-selection-box,
1647
+ .x6-widget-selection-inner {
1648
+ display: none;
1649
+ }
1650
+
1651
+ .x6-widget-selection-content {
1652
+ display: none;
1653
+ }
1654
+
1655
+ .x6-widget-minimap {
1656
+ position: relative;
1657
+ display: table-cell;
1658
+ box-sizing: border-box;
1659
+ overflow: hidden;
1660
+ text-align: center;
1661
+ vertical-align: middle;
1662
+ background-color: var(--wf-surface);
1663
+ user-select: none;
1664
+ }
1665
+
1666
+ .x6-widget-minimap .x6-graph {
1667
+ display: inline-block;
1668
+ cursor: pointer;
1669
+ }
1670
+
1671
+ .x6-widget-minimap .x6-graph > svg {
1672
+ pointer-events: none;
1673
+ shape-rendering: optimizespeed;
1674
+ }
1675
+
1676
+ .x6-widget-minimap-viewport {
1677
+ position: absolute;
1678
+ box-sizing: content-box !important;
1679
+ margin: -2px 0 0 -2px;
1680
+ background: color-mix(in srgb, var(--wf-primary) 8%, transparent);
1681
+ border: 2px solid var(--wf-primary);
1682
+ border-radius: 4px;
1683
+ cursor: move;
1684
+ }
1685
+
1686
+ .x6-widget-minimap-viewport-zoom {
1687
+ position: absolute;
1688
+ right: 0;
1689
+ bottom: 0;
1690
+ box-sizing: border-box;
1691
+ width: 10px;
1692
+ height: 10px;
1693
+ margin: 0 -5px -5px 0;
1694
+ background-color: var(--wf-surface);
1695
+ border: 2px solid var(--wf-primary);
1696
+ border-radius: 50%;
1697
+ cursor: nwse-resize;
1698
+ }
1699
+
1700
+ .x6-widget-snapline {
1701
+ position: absolute;
1702
+ inset: 0;
1703
+ pointer-events: none;
1704
+ }
1705
+
1706
+ .x6-widget-snapline-vertical,
1707
+ .x6-widget-snapline-horizontal {
1708
+ stroke: var(--wf-primary);
1709
+ stroke-width: 1px;
1710
+ stroke-dasharray: 4 3;
1711
+ }
1712
+
1713
+ @media (max-width: 900px) {
1714
+ .wf-designer {
1715
+ grid-template-columns: minmax(0, 1fr);
1716
+ grid-template-rows: auto auto 440px auto;
1717
+ grid-template-areas:
1718
+ 'toolbar'
1719
+ 'palette'
1720
+ 'canvas'
1721
+ 'inspector';
1722
+ }
1723
+
1724
+ .wf-palette,
1725
+ .wf-inspector {
1726
+ max-height: none;
1727
+ border: 0;
1728
+ border-bottom: 1px solid var(--wf-border-light);
1729
+ }
1730
+ }
1731
+ `,WC=`
1732
+ :host {
1733
+ --wf-surface: var(--bs-body-bg, #ffffff);
1734
+ --wf-subtle: var(--bs-gray-100, #f9f9f9);
1735
+ --wf-hover: var(--bs-gray-200, #f1f1f4);
1736
+ --wf-border: var(--bs-gray-300, #dbdfe9);
1737
+ --wf-border-light: var(--bs-gray-200, #f1f1f4);
1738
+ --wf-text: var(--bs-gray-900, #071437);
1739
+ --wf-text-secondary: var(--bs-gray-700, #4b5675);
1740
+ --wf-input-text: var(--bs-gray-800, #252f4a);
1741
+ --wf-muted: var(--bs-gray-600, #78829d);
1742
+ --wf-placeholder: var(--bs-gray-500, #99a1b7);
1743
+ --wf-primary: var(--bs-primary, #1b84ff);
1744
+ --wf-primary-active: var(--bs-primary-active, #056ee9);
1745
+ --wf-primary-light: var(--bs-primary-light, #e9f3ff);
1746
+ --wf-danger: var(--bs-danger, #f8285a);
1747
+ --wf-danger-light: var(--bs-danger-light, #ffeef3);
1748
+ --wf-warning: var(--bs-warning, #f6c000);
1749
+ --wf-warning-light: var(--bs-warning-light, #fff8dd);
1750
+ --wf-success: var(--bs-success, #17c653);
1751
+ --wf-success-light: var(--bs-success-light, #dfffea);
1752
+ --wf-radius: var(--bs-border-radius, 0.475rem);
1753
+ --wf-radius-lg: var(--bs-border-radius-lg, 0.625rem);
1754
+ --wf-shadow: 0 0.1rem 1rem 0.25rem rgba(0, 0, 0, 0.05);
1755
+ --wf-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
1756
+ --wf-control-height: 38px;
1757
+
1758
+ display: block;
1759
+ font-family: var(--wf-font-family, inherit);
1760
+ font-size: 13px;
1761
+ line-height: 1.45;
1762
+ color: var(--wf-text);
1763
+ }
1764
+
1765
+ *,
1766
+ *::before,
1767
+ *::after {
1768
+ box-sizing: border-box;
1769
+ }
1770
+
1771
+ [hidden] {
1772
+ display: none !important;
1773
+ }
1774
+
1775
+ * {
1776
+ scrollbar-width: thin;
1777
+ scrollbar-color: var(--wf-border) transparent;
1778
+ }
1779
+
1780
+ button {
1781
+ font: inherit;
1782
+ }
1783
+
1784
+ .wf-icon {
1785
+ flex: 0 0 auto;
1786
+ display: inline-block;
1787
+ vertical-align: middle;
1788
+ }
1789
+
1790
+ h4,
1791
+ .wf-panel-title {
1792
+ margin: 0 0 14px;
1793
+ font-size: 11px;
1794
+ font-weight: 700;
1795
+ line-height: 1.3;
1796
+ letter-spacing: 0.06em;
1797
+ text-transform: uppercase;
1798
+ color: var(--wf-muted);
1799
+ }
1800
+
1801
+ .wf-muted,
1802
+ .wf-fb-muted {
1803
+ margin: 0 0 10px;
1804
+ font-size: 12.5px;
1805
+ line-height: 1.5;
1806
+ color: var(--wf-muted);
1807
+ }
1808
+
1809
+ .wf-input,
1810
+ .wf-field,
1811
+ .wf-fb-field {
1812
+ display: flex;
1813
+ flex-direction: column;
1814
+ gap: 6px;
1815
+ min-width: 0;
1816
+ margin: 0 0 16px;
1817
+ }
1818
+
1819
+ .wf-input .wf-input,
1820
+ .wf-input .wf-field {
1821
+ margin-bottom: 12px;
1822
+ }
1823
+
1824
+ .wf-input > span:first-child,
1825
+ .wf-field > span:first-child,
1826
+ .wf-fb-field > span:first-child {
1827
+ font-size: 12.5px;
1828
+ font-weight: 600;
1829
+ line-height: 1.35;
1830
+ color: var(--wf-text-secondary);
1831
+ }
1832
+
1833
+ .wf-required {
1834
+ color: var(--wf-danger);
1835
+ }
1836
+
1837
+ .wf-input input:not([type='checkbox']):not([type='radio']),
1838
+ .wf-input select,
1839
+ .wf-input textarea,
1840
+ .wf-field input:not([type='checkbox']):not([type='radio']),
1841
+ .wf-field select,
1842
+ .wf-field textarea,
1843
+ .wf-fb-field input:not([type='checkbox']):not([type='radio']),
1844
+ .wf-fb-field select,
1845
+ .wf-fb-field textarea,
1846
+ .wf-control {
1847
+ width: 100%;
1848
+ min-width: 0;
1849
+ min-height: var(--wf-control-height);
1850
+ margin: 0;
1851
+ padding: 8px 12px;
1852
+ font: inherit;
1853
+ font-size: 13px;
1854
+ font-weight: 500;
1855
+ line-height: 1.5;
1856
+ color: var(--wf-input-text);
1857
+ background-color: var(--wf-surface);
1858
+ border: 1px solid var(--wf-border);
1859
+ border-radius: var(--wf-radius);
1860
+ outline: none;
1861
+ box-shadow: none;
1862
+ transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
1863
+ }
1864
+
1865
+ .wf-input select,
1866
+ .wf-field select,
1867
+ .wf-fb-field select,
1868
+ select.wf-control {
1869
+ appearance: none;
1870
+ padding-inline-end: 34px;
1871
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378829d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m6 9 6 6 6-6'/%3e%3c/svg%3e");
1872
+ background-repeat: no-repeat;
1873
+ background-position: right 11px center;
1874
+ background-size: 14px 14px;
1875
+ cursor: pointer;
1876
+ }
1877
+
1878
+ :host([dir='rtl']) .wf-input select,
1879
+ :host([dir='rtl']) .wf-field select,
1880
+ :host([dir='rtl']) .wf-fb-field select {
1881
+ background-position: left 11px center;
1882
+ }
1883
+
1884
+ .wf-input textarea,
1885
+ .wf-field textarea,
1886
+ .wf-fb-field textarea,
1887
+ textarea.wf-control {
1888
+ min-height: 76px;
1889
+ resize: vertical;
1890
+ }
1891
+
1892
+ .wf-input input::placeholder,
1893
+ .wf-input textarea::placeholder,
1894
+ .wf-field input::placeholder,
1895
+ .wf-field textarea::placeholder,
1896
+ .wf-fb-field input::placeholder,
1897
+ .wf-control::placeholder {
1898
+ color: var(--wf-placeholder);
1899
+ font-weight: 500;
1900
+ }
1901
+
1902
+ .wf-input input:not([type='checkbox']):not([type='radio']):hover:not(:disabled),
1903
+ .wf-input select:hover:not(:disabled),
1904
+ .wf-input textarea:hover:not(:disabled),
1905
+ .wf-field input:not([type='checkbox']):not([type='radio']):hover:not(:disabled),
1906
+ .wf-field select:hover:not(:disabled),
1907
+ .wf-field textarea:hover:not(:disabled),
1908
+ .wf-fb-field input:not([type='checkbox']):not([type='radio']):hover:not(:disabled),
1909
+ .wf-control:hover:not(:disabled) {
1910
+ border-color: var(--bs-gray-400, #c4cada);
1911
+ }
1912
+
1913
+ .wf-input input:not([type='checkbox']):not([type='radio']):focus,
1914
+ .wf-input select:focus,
1915
+ .wf-input textarea:focus,
1916
+ .wf-field input:not([type='checkbox']):not([type='radio']):focus,
1917
+ .wf-field select:focus,
1918
+ .wf-field textarea:focus,
1919
+ .wf-fb-field input:not([type='checkbox']):not([type='radio']):focus,
1920
+ .wf-fb-field select:focus,
1921
+ .wf-fb-field textarea:focus,
1922
+ .wf-control:focus {
1923
+ border-color: var(--wf-primary);
1924
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
1925
+ }
1926
+
1927
+ .wf-input input:disabled,
1928
+ .wf-input select:disabled,
1929
+ .wf-input textarea:disabled,
1930
+ .wf-field input:disabled,
1931
+ .wf-field select:disabled,
1932
+ .wf-field textarea:disabled,
1933
+ .wf-fb-field input:disabled,
1934
+ .wf-fb-field select:disabled,
1935
+ .wf-fb-field textarea:disabled,
1936
+ .wf-control:disabled {
1937
+ color: var(--wf-muted);
1938
+ background-color: var(--wf-subtle);
1939
+ border-color: var(--wf-border-light);
1940
+ cursor: not-allowed;
1941
+ }
1942
+
1943
+ .wf-input-invalid,
1944
+ .wf-input textarea.wf-input-invalid,
1945
+ .wf-input input.wf-input-invalid {
1946
+ border-color: var(--wf-danger) !important;
1947
+ }
1948
+
1949
+ .wf-input-invalid:focus {
1950
+ box-shadow: 0 0 0 3px var(--wf-danger-light) !important;
1951
+ }
1952
+
1953
+ .wf-input-hint {
1954
+ display: block;
1955
+ margin: 0;
1956
+ font-size: 12px;
1957
+ line-height: 1.45;
1958
+ color: var(--wf-muted);
1959
+ }
1960
+
1961
+ .wf-input-error {
1962
+ display: block;
1963
+ margin: 0;
1964
+ font-size: 12px;
1965
+ line-height: 1.45;
1966
+ color: var(--wf-danger);
1967
+ }
1968
+
1969
+ .wf-input-empty {
1970
+ margin: 0;
1971
+ padding: 10px 12px;
1972
+ font-size: 12.5px;
1973
+ line-height: 1.45;
1974
+ color: var(--wf-muted);
1975
+ background: var(--wf-subtle);
1976
+ border: 1px dashed var(--wf-border);
1977
+ border-radius: var(--wf-radius);
1978
+ }
1979
+
1980
+ input[type='checkbox'],
1981
+ input[type='radio'] {
1982
+ appearance: none;
1983
+ flex: 0 0 18px;
1984
+ width: 18px;
1985
+ height: 18px;
1986
+ margin: 1px 0 0;
1987
+ background-color: var(--wf-surface);
1988
+ background-repeat: no-repeat;
1989
+ background-position: center;
1990
+ background-size: 12px 12px;
1991
+ border: 1px solid var(--bs-gray-400, #c4cada);
1992
+ border-radius: 5px;
1993
+ cursor: pointer;
1994
+ transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
1995
+ }
1996
+
1997
+ input[type='radio'] {
1998
+ border-radius: 50%;
1999
+ }
2000
+
2001
+ input[type='checkbox']:hover:not(:disabled),
2002
+ input[type='radio']:hover:not(:disabled) {
2003
+ border-color: var(--wf-primary);
2004
+ }
2005
+
2006
+ input[type='checkbox']:checked,
2007
+ input[type='radio']:checked {
2008
+ background-color: var(--wf-primary);
2009
+ border-color: var(--wf-primary);
2010
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m5 12.5 4.5 4.5L19 7.5'/%3e%3c/svg%3e");
2011
+ }
2012
+
2013
+ input[type='checkbox']:focus-visible,
2014
+ input[type='radio']:focus-visible {
2015
+ outline: none;
2016
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
2017
+ }
2018
+
2019
+ input[type='checkbox']:disabled,
2020
+ input[type='radio']:disabled {
2021
+ opacity: 0.55;
2022
+ cursor: not-allowed;
2023
+ }
2024
+
2025
+ .wf-check,
2026
+ .wf-input-check,
2027
+ .wf-checkbox,
2028
+ .wf-fb-check {
2029
+ display: flex;
2030
+ flex-direction: row;
2031
+ flex-wrap: wrap;
2032
+ align-items: flex-start;
2033
+ column-gap: 10px;
2034
+ row-gap: 4px;
2035
+ margin: 0 0 12px;
2036
+ font-size: 13px;
2037
+ font-weight: 500;
2038
+ line-height: 1.45;
2039
+ color: var(--wf-input-text);
2040
+ cursor: pointer;
2041
+ }
2042
+
2043
+ .wf-check > span,
2044
+ .wf-input-check > span,
2045
+ .wf-checkbox > span,
2046
+ .wf-fb-check > span {
2047
+ flex: 1 1 0;
2048
+ min-width: 0;
2049
+ font-size: 13px;
2050
+ font-weight: 500;
2051
+ color: var(--wf-input-text);
2052
+ }
2053
+
2054
+ .wf-input-check > .wf-input-hint {
2055
+ flex: 1 0 100%;
2056
+ padding-inline-start: 28px;
2057
+ }
2058
+
2059
+ .wf-check-list {
2060
+ display: flex;
2061
+ flex-direction: column;
2062
+ gap: 2px;
2063
+ margin: 0;
2064
+ padding: 0;
2065
+ list-style: none;
2066
+ }
2067
+
2068
+ .wf-check-list .wf-check {
2069
+ margin: 0;
2070
+ padding: 6px 0;
2071
+ }
2072
+
2073
+ .wf-btn,
2074
+ .wf-secondary,
2075
+ .wf-danger,
2076
+ .wf-primary,
2077
+ .wf-fb-secondary {
2078
+ display: inline-flex;
2079
+ align-items: center;
2080
+ justify-content: center;
2081
+ gap: 6px;
2082
+ min-height: 36px;
2083
+ margin: 0;
2084
+ padding: 7px 14px;
2085
+ font: inherit;
2086
+ font-size: 12.5px;
2087
+ font-weight: 600;
2088
+ line-height: 1.4;
2089
+ text-align: center;
2090
+ border: 1px solid transparent;
2091
+ border-radius: var(--wf-radius);
2092
+ cursor: pointer;
2093
+ transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
2094
+ }
2095
+
2096
+ .wf-secondary,
2097
+ .wf-fb-secondary {
2098
+ width: 100%;
2099
+ color: var(--wf-primary);
2100
+ background-color: var(--wf-primary-light);
2101
+ }
2102
+
2103
+ .wf-secondary:hover:not([disabled]),
2104
+ .wf-fb-secondary:hover:not([disabled]) {
2105
+ color: #ffffff;
2106
+ background-color: var(--wf-primary);
2107
+ }
2108
+
2109
+ .wf-primary {
2110
+ color: #ffffff;
2111
+ background-color: var(--wf-primary);
2112
+ }
2113
+
2114
+ .wf-primary:hover:not([disabled]) {
2115
+ background-color: var(--wf-primary-active);
2116
+ }
2117
+
2118
+ .wf-danger {
2119
+ width: 100%;
2120
+ color: var(--wf-danger);
2121
+ background-color: var(--wf-danger-light);
2122
+ }
2123
+
2124
+ .wf-danger:hover:not([disabled]) {
2125
+ color: #ffffff;
2126
+ background-color: var(--wf-danger);
2127
+ }
2128
+
2129
+ .wf-btn[disabled],
2130
+ .wf-secondary[disabled],
2131
+ .wf-danger[disabled],
2132
+ .wf-primary[disabled],
2133
+ .wf-fb-secondary[disabled] {
2134
+ opacity: 0.5;
2135
+ cursor: not-allowed;
2136
+ }
2137
+
2138
+ .wf-btn:focus-visible,
2139
+ .wf-secondary:focus-visible,
2140
+ .wf-danger:focus-visible,
2141
+ .wf-primary:focus-visible,
2142
+ .wf-fb-secondary:focus-visible,
2143
+ .wf-icon-btn:focus-visible {
2144
+ outline: none;
2145
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
2146
+ }
2147
+
2148
+ .wf-icon-btn,
2149
+ .wf-target-list button,
2150
+ .wf-mapping-list button,
2151
+ .wf-connection-remove,
2152
+ .wf-branch-actions button,
2153
+ .wf-fb-actions button,
2154
+ .wf-variable-remove {
2155
+ display: inline-flex;
2156
+ align-items: center;
2157
+ justify-content: center;
2158
+ flex: 0 0 auto;
2159
+ width: 28px;
2160
+ height: 28px;
2161
+ margin: 0;
2162
+ padding: 0;
2163
+ font: inherit;
2164
+ font-size: 15px;
2165
+ line-height: 1;
2166
+ color: var(--wf-muted);
2167
+ background: transparent;
2168
+ border: 0;
2169
+ border-radius: var(--wf-radius);
2170
+ cursor: pointer;
2171
+ transition: background-color 0.15s ease, color 0.15s ease;
2172
+ }
2173
+
2174
+ .wf-icon-btn:hover:not([disabled]),
2175
+ .wf-branch-actions button:hover:not([disabled]),
2176
+ .wf-fb-actions button:hover:not([disabled]) {
2177
+ color: var(--wf-primary);
2178
+ background: var(--wf-primary-light);
2179
+ }
2180
+
2181
+ .wf-target-list button:hover:not([disabled]),
2182
+ .wf-mapping-list button:hover:not([disabled]),
2183
+ .wf-connection-remove:hover:not([disabled]),
2184
+ .wf-branch-actions .wf-branch-remove:hover:not([disabled]),
2185
+ .wf-fb-actions [data-remove]:hover:not([disabled]),
2186
+ .wf-variable-remove:hover:not([disabled]),
2187
+ .wf-icon-btn.wf-icon-btn-danger:hover:not([disabled]) {
2188
+ color: var(--wf-danger);
2189
+ background: var(--wf-danger-light);
2190
+ }
2191
+
2192
+ .wf-icon-btn[disabled],
2193
+ .wf-target-list button[disabled],
2194
+ .wf-mapping-list button[disabled],
2195
+ .wf-connection-remove[disabled],
2196
+ .wf-branch-actions button[disabled],
2197
+ .wf-fb-actions button[disabled],
2198
+ .wf-variable-remove[disabled] {
2199
+ opacity: 0.4;
2200
+ cursor: not-allowed;
2201
+ }
2202
+
2203
+ .wf-target-list,
2204
+ .wf-mapping-list,
2205
+ .wf-connection-list {
2206
+ display: flex;
2207
+ flex-direction: column;
2208
+ gap: 6px;
2209
+ margin: 0;
2210
+ padding: 0;
2211
+ list-style: none;
2212
+ }
2213
+
2214
+ .wf-target-list li,
2215
+ .wf-mapping-list li,
2216
+ .wf-connection-list li {
2217
+ display: flex;
2218
+ align-items: center;
2219
+ gap: 8px;
2220
+ min-height: 38px;
2221
+ padding: 4px 4px 4px 12px;
2222
+ font-size: 13px;
2223
+ font-weight: 500;
2224
+ color: var(--wf-input-text);
2225
+ background: var(--wf-subtle);
2226
+ border: 1px solid var(--wf-border-light);
2227
+ border-radius: var(--wf-radius);
2228
+ }
2229
+
2230
+ .wf-target-list li > span,
2231
+ .wf-mapping-list li > span,
2232
+ .wf-connection-list li > span:not(.wf-dot) {
2233
+ flex: 1 1 auto;
2234
+ min-width: 0;
2235
+ overflow: hidden;
2236
+ text-overflow: ellipsis;
2237
+ white-space: nowrap;
2238
+ }
2239
+
2240
+ .wf-dot {
2241
+ flex: 0 0 auto;
2242
+ width: 8px;
2243
+ height: 8px;
2244
+ border-radius: 50%;
2245
+ }
2246
+
2247
+ .wf-section {
2248
+ margin: 20px 0 0;
2249
+ padding-top: 16px;
2250
+ border-top: 1px solid var(--wf-border-light);
2251
+ }
2252
+
2253
+ .wf-section h5,
2254
+ .wf-section-title {
2255
+ display: flex;
2256
+ align-items: center;
2257
+ gap: 6px;
2258
+ margin: 0 0 12px;
2259
+ font-size: 11px;
2260
+ font-weight: 700;
2261
+ letter-spacing: 0.06em;
2262
+ text-transform: uppercase;
2263
+ color: var(--wf-muted);
2264
+ }
2265
+
2266
+ .wf-subsection {
2267
+ margin: 14px 0 0;
2268
+ padding: 14px 14px 2px;
2269
+ background: var(--wf-subtle);
2270
+ border: 1px solid var(--wf-border-light);
2271
+ border-radius: var(--wf-radius-lg);
2272
+ }
2273
+
2274
+ .wf-subsection > .wf-secondary:last-child,
2275
+ .wf-subsection > .wf-btn:last-child,
2276
+ .wf-subsection > .wf-muted:last-child {
2277
+ margin-bottom: 12px;
2278
+ }
2279
+
2280
+ .wf-input > .wf-subsection {
2281
+ margin-top: 4px;
2282
+ }
2283
+
2284
+ .wf-group {
2285
+ margin: 18px 0 10px;
2286
+ font-size: 12px;
2287
+ font-weight: 700;
2288
+ color: var(--wf-text);
2289
+ }
2290
+
2291
+ .wf-issues,
2292
+ .wf-fb-issues {
2293
+ margin: 0 0 16px;
2294
+ padding: 10px 12px 10px 28px;
2295
+ font-size: 12.5px;
2296
+ line-height: 1.5;
2297
+ color: var(--wf-danger);
2298
+ background: var(--wf-danger-light);
2299
+ border-radius: var(--wf-radius);
2300
+ }
2301
+
2302
+ .wf-issues li + li,
2303
+ .wf-fb-issues li + li {
2304
+ margin-top: 4px;
2305
+ }
2306
+
2307
+ .wf-issue-link {
2308
+ display: inline;
2309
+ margin: 0;
2310
+ padding: 0;
2311
+ font: inherit;
2312
+ color: inherit;
2313
+ text-align: start;
2314
+ text-decoration: underline;
2315
+ text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
2316
+ text-underline-offset: 2px;
2317
+ background: none;
2318
+ border: 0;
2319
+ border-radius: 3px;
2320
+ cursor: pointer;
2321
+ }
2322
+
2323
+ .wf-issue-link:hover {
2324
+ text-decoration-color: currentColor;
2325
+ }
2326
+
2327
+ .wf-issue-link:focus-visible {
2328
+ outline: 2px solid var(--wf-primary);
2329
+ outline-offset: 2px;
2330
+ }
2331
+
2332
+ .wf-review-notice {
2333
+ display: flex;
2334
+ flex-direction: column;
2335
+ align-items: flex-start;
2336
+ gap: 8px;
2337
+ margin: 0 0 16px;
2338
+ padding: 10px 12px;
2339
+ font-size: 12.5px;
2340
+ line-height: 1.5;
2341
+ color: var(--wf-text);
2342
+ background: var(--wf-warning-light);
2343
+ border-radius: var(--wf-radius);
2344
+ }
2345
+
2346
+ .wf-review-notice p {
2347
+ margin: 0;
2348
+ }
2349
+
2350
+ .wf-tabs {
2351
+ display: flex;
2352
+ flex-wrap: wrap;
2353
+ gap: 4px;
2354
+ margin: 0 0 18px;
2355
+ padding: 4px;
2356
+ background: var(--wf-subtle);
2357
+ border: 1px solid var(--wf-border-light);
2358
+ border-radius: var(--wf-radius-lg);
2359
+ }
2360
+
2361
+ .wf-tab {
2362
+ flex: 1 1 auto;
2363
+ min-height: 30px;
2364
+ padding: 5px 10px;
2365
+ font: inherit;
2366
+ font-size: 12.5px;
2367
+ font-weight: 600;
2368
+ line-height: 1.3;
2369
+ white-space: nowrap;
2370
+ color: var(--wf-muted);
2371
+ background: transparent;
2372
+ border: 0;
2373
+ border-radius: calc(var(--wf-radius) - 1px);
2374
+ cursor: pointer;
2375
+ transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
2376
+ }
2377
+
2378
+ .wf-tab:hover {
2379
+ color: var(--wf-text);
2380
+ }
2381
+
2382
+ .wf-tab:focus-visible {
2383
+ outline: none;
2384
+ box-shadow: 0 0 0 2px var(--wf-primary);
2385
+ }
2386
+
2387
+ .wf-tab-active,
2388
+ .wf-tab-active:hover {
2389
+ color: var(--wf-primary);
2390
+ background: var(--wf-surface);
2391
+ box-shadow: var(--wf-shadow-sm);
2392
+ }
2393
+
2394
+ .wf-search {
2395
+ position: relative;
2396
+ margin: 0 0 14px;
2397
+ }
2398
+
2399
+ .wf-search .wf-icon {
2400
+ position: absolute;
2401
+ inset-inline-start: 11px;
2402
+ top: 50%;
2403
+ color: var(--wf-placeholder);
2404
+ transform: translateY(-50%);
2405
+ pointer-events: none;
2406
+ }
2407
+
2408
+ .wf-search input {
2409
+ padding-inline-start: 34px !important;
2410
+ }
2411
+
2412
+ .wf-badge {
2413
+ display: inline-flex;
2414
+ align-items: center;
2415
+ gap: 4px;
2416
+ padding: 3px 8px;
2417
+ font-size: 11.5px;
2418
+ font-weight: 600;
2419
+ line-height: 1.4;
2420
+ white-space: nowrap;
2421
+ color: var(--wf-text-secondary);
2422
+ background: var(--wf-hover);
2423
+ border-radius: var(--wf-radius);
2424
+ }
2425
+
2426
+ .wf-badge-primary {
2427
+ color: var(--wf-primary);
2428
+ background: var(--wf-primary-light);
2429
+ }
2430
+
2431
+ .wf-badge-warning {
2432
+ color: var(--bs-warning-active, #dead00);
2433
+ background: var(--wf-warning-light);
2434
+ }
2435
+ `;function GC(e){let t=/^#([0-9a-f]{3,8})$/i.exec(e.trim());if(!t)return;let n=t[1];if((n.length===3||n.length===4)&&(n=n.split(``).map(e=>e+e).join(``)),n.length===6||n.length===8)return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16),a:n.length===8?parseInt(n.slice(6,8),16)/255:1}}function KC(e){let t=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/i.exec(e.trim());if(!t)return;let n=t[4];return{r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:n===void 0?1:n.endsWith(`%`)?Number(n.slice(0,-1))/100:Number(n)}}function qC(e){return GC(e)??KC(e)}function JC(e){return Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,`0`)}function YC(e,t,n){let r=qC(e),i=qC(t);if(!r||!i)return`color-mix(in srgb, ${e} ${Math.round(n*100)}%, ${t})`;let a=(e,t)=>e*n+t*(1-n);return`#`+JC(a(r.r,i.r))+JC(a(r.g,i.g))+JC(a(r.b,i.b))}var XC=`WorkflowValidation_`,ZC=[/^StartTrigger/,/^ResponsibleUser/,/^PublicFormSlug/,/^PublicFormEmbedOrigin/,/^Schedule/],QC=[[/^Sla/,`sla`],[/^ApprovalNodeQuorum/,`approval.quorumCount`],[/^ApprovalNodePolicy/,`approval.approvalPolicy`],[/^ApprovalNodeTarget|^Assignment/,`approval.targets`],[/^Condition/,`condition.branches`],[/^NotificationNodeRecipient/,`notification.recipients`],[/^NotificationNodeContent/,`notification.body`],[/^ActionNodeConnectionProfile/,`action.connectionProfileName`],[/^ActionNodeHttpMethod/,`action.httpMethod`],[/^ActionBinding|^ActionNodeInputBinding/,`action.inputBindings`],[/^ActionNode/,`action.actionName`],[/^ChannelConnectionProfile/,`channels.connectionProfileName`],[/^Channel/,`channels.channels`],[/^TimerNodeField/,`timer.fieldId`],[/^TimerNodeFixedDate/,`timer.fixedDate`],[/^TimerNode/,`timer.durationInMinutes`],[/^ParallelNode/,`parallel.joinNodeId`],[/^JoinNodeRequiredBranchCount/,`join.requiredBranchCount`],[/^JoinNode/,`join.parallelNodeId`],[/^SubprocessNodeMapping/,`subprocess.inputMappings`],[/^SubprocessNode/,`subprocess.workflowDefinitionId`],[/^EventWaitCorrelation/,`eventWait.correlationFieldKey`],[/^EventWait/,`eventWait.eventName`],[/^AiAgent|^AiInput/,`runAiAgent.agentName`]];function $C(e){let t=e.code??``;return t.startsWith(XC)?t.slice(19):t}function ew(e){let t=$C(e);return QC.find(([e])=>e.test(t))?.[1]}function tw(e){let t=$C(e);return ZC.some(e=>e.test(t))}function nw(e,t,n){if(!e)return;if(e.fieldId&&n?.fields.some(t=>t.id===e.fieldId))return{tab:`form`,fieldId:e.fieldId};let r=e.nodeId?t?.nodes.find(t=>t.id===e.nodeId):e.branchId?t?.nodes.find(t=>(t.condition?.branches??[]).some(t=>t.id===e.branchId)):void 0;if(tw(e)&&(!e.nodeId||r?.type===J.Start))return{tab:`trigger`,nodeId:r?.id};if(r){let t=e.branchId&&(r.condition?.branches??[]).some(t=>t.id===e.branchId)?e.branchId:void 0;return{tab:`flow`,nodeId:r.id,branchId:t,inputName:ew(e)}}let i=e.edgeId?t?.edges.find(t=>t.id===e.edgeId):void 0;if(i)return{tab:`flow`,edgeId:i.id,nodeId:i.sourceNodeId}}var rw=192,iw=64,aw=26,ow=50,sw=20,cw=.25,lw=2.5,uw=184,dw=116,fw=32,pw=40,mw=2,hw=60,gw=60,_w=56,vw=324,yw=140,bw=56,xw=.7,Sw=`application/x-workflow-node-type`,Cw=.14,ww=`general`,Tw=`General`,Ew=3,Dw=`sla.escalationTarget`,Ow=new Set([Q.dropDown,Q.checkList,Q.radioList]),kw=class extends Cb{constructor(...e){super(...e),this._document=qb(),this._selectedNodeIds=[],this._isApplyingDocument=!1,this._past=[],this._future=[],this._paletteDrag=new Qy,this._paletteFilter=``,this._inspectorTab=ww,this._outlineVisible=!1,this._executionStates=[],this._secrets=[],this._heatMap=[],this._conditionSuggestionText=``,this._assistantSummaryBusy=!1,this._conditionSuggestionBusy=!1,this._summaryCollapsed=!1,this._paletteCollapsed=!1,this._viewportPending=!0,this._pendingFit=!0,this._lookupNames=new Map,this._requestedNameLookups=new Set,this._serverOptions=new Map,this._serverOptionsPending=new Set,this._inflightLookups=new Map}static get observedAttributes(){return[]}get formBuilder(){return this._formBuilder}set formBuilder(e){this._formBuilder=e??void 0}focusValidationIssue(e){let t=nw(e,this._document,this._form);return t?(t.tab===`form`?this._formBuilder?.focusValidationIssue(e):t.tab===`flow`&&(this.root.querySelector(`.wf-designer`)?(this._pendingFocus=void 0,this.applyIssueFocus(t)):this._pendingFocus=t),this.emit(ab.issueFocus,{...t,issue:e}),!0):!1}applyIssueFocus(e){if(e.edgeId&&this._document.edges.some(t=>t.id===e.edgeId)){this.selectEdge(e.edgeId),this.revealNode(e.nodeId);return}let t=this._document.nodes.find(t=>t.id===e.nodeId);t&&(this._inspectorTab=this.inspectorTabForInput(t,e.inputName),this.select(t.id),e.branchId&&(this._selectedBranchId=e.branchId,this.renderInspector()),this.revealNode(t.id))}inspectorTabForInput(e,t){if(!t)return ww;let n=mx(this.descriptorForNode(e).inputs,e),r=t.split(`.`)[0],i=(n.find(e=>e.name===t)??n.find(e=>e.name.startsWith(t+`.`))??n.find(e=>e.name.split(`.`)[0]===r))?.category??``;return i.length===0||i===Tw?ww:`category-`+i.toLowerCase()}revealNode(e,t=0){let n=this._graph,r=this._canvas;if(!n||!r||!e)return;let i=n.getCellById(e);i&&i.isNode()&&(r.clientWidth===0||r.clientHeight===0?t<20&&setTimeout(()=>this.revealNode(e,t+1),120):n.getGraphArea().containsRect(i.getBBox())||(n.centerCell(i),this.captureViewport(),this.renderZoomControls()))}get document(){return this._document}set document(e){let t=this.normalizeDocument(e),n=this.fingerprintOf(t);n===this._fingerprint?this._document=t:(this._document=t,this._fingerprint=n,this._past=[],this._future=[],this._viewportPending=!0,this._pendingFit=!0,this.syncGraphFromDocument(),this.requestHostRender())}get executionStates(){return this._executionStates}get secrets(){return this._secrets}set secrets(e){this._secrets=Array.isArray(e)?e:[],this.hostValueChanged(`secrets`,this._secrets)&&this.requestHostRender()}get heatMap(){return this._heatMap}set heatMap(e){this._heatMap=Array.isArray(e)?e:[],this.hostValueChanged(`heatMap`,this._heatMap)&&(this.syncGraphFromDocument(),this.requestHostRender())}get isHeatMapView(){return this._heatMap.length>0}get graphSchemaVersion(){return 3}get activityDescriptors(){let e=this.capabilities.activityDescriptors;return Array.isArray(e)&&e.length>0?e:Nx()}get availableActivityDescriptors(){let e=this.capabilities;return this.activityDescriptors.filter(e=>e.isBrowsable!==!1).filter(t=>!t.requiredCapability||e[t.requiredCapability]!==!1)}descriptorForNode(e){let t=rx(e,`runAiAgent.agentName`);if(e.type===J.RunAiAgent&&typeof t==`string`&&t.length>0){let n=this.activityDescriptors.find(n=>n.legacyNodeType===e.type&&n.customProperties?.agentName===t);if(n)return n}if(e.activityType){let t=this.activityDescriptors.find(t=>t.typeName===e.activityType);if(t)return t}return this.descriptorFor(e.type)}descriptorFor(e){return this.activityDescriptors.find(t=>t.legacyNodeType===e)||Px(e,this.observedPortsOf(e))}observedPortsOf(e){let t=new Set(this._document.nodes.filter(t=>t.type===e).map(e=>e.id)),n=new Set;for(let e of this._document.edges)t.has(e.sourceNodeId)&&e.kind!==void 0&&n.add(e.kind);return[...n].map(e=>({name:Cx(e).fallback,edgeKind:e}))}outcomesOf(e){return Tx(this.descriptorFor(e).ports)}paletteItemFor(e){return Rx(this.descriptorFor(e))}get schemaVersionMismatch(){return db(this.capabilities.graphSchemaVersion,3)}get slowestHeatSeconds(){return this._heatMap.reduce((e,t)=>Math.max(e,this.heatValueOf(t)),0)}heatValueOf(e){return e.ninetiethPercentileDwellSeconds??e.averageDwellSeconds??0}heatStyleOf(e,t=this.canvasColors()){if(!this.isHeatMapView)return null;let n=this._heatMap.find(t=>t.nodeId===e);if(!n||n.wasNeverEntered)return{fill:t.surface,opacity:.5,stroke:t.placeholder,strokeWidth:1.5,dashed:!0,badge:`∅`};let r=this.slowestHeatSeconds,i=this.heatValueOf(n),a=r<=0?0:i/r;return a>=.75?this.tintedState(t.danger,t,2.5):a>=.4?this.tintedState(t.warning,t,2):this.tintedState(t.success,t,2)}tintedState(e,t,n,r={}){return{fill:YC(e,t.surface,Cw),opacity:1,stroke:e,strokeWidth:n,dashed:!1,...r}}set executionStates(e){this._executionStates=Array.isArray(e)?e:[],this.hostValueChanged(`executionStates`,this._executionStates)&&(this.syncGraphFromDocument(),this.requestHostRender())}get isExecutionView(){return this._executionStates.length>0}get form(){return this._form}set form(e){this._form=e,this.hostValueChanged(`form`,e)&&this.requestHostRender()}get selectedNodeId(){return this._selectedNodeId}get canUndo(){return!this.readOnly&&this._past.length>0}get canRedo(){return!this.readOnly&&this._future.length>0}connectedCallback(){super.connectedCallback(),this.observeThemeChanges()}disconnectedCallback(){super.disconnectedCallback(),this._themeObserver?.disconnect(),this._themeObserver=void 0,this._graph?.dispose(),this._graph=void 0}applyTheme(){super.applyTheme(),this.syncGraphFromDocument()}observeThemeChanges(){this._themeObserver||typeof MutationObserver!=`function`||(this._themeObserver=new MutationObserver(()=>this.syncGraphFromDocument()),this._themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-bs-theme`,`data-theme`]}))}undo(){if(!this.canUndo)return;let e=this._past.pop();this._future.push(this._document),this._document=e,this.syncGraphFromDocument(),this.emitChange(),this.requestRender()}redo(){if(!this.canRedo)return;let e=this._future.pop();this._past.push(this._document),this._document=e,this.syncGraphFromDocument(),this.emitChange(),this.requestRender()}addNode(e,t,n){if(this.readOnly)return;let r=n?this.activityDescriptors.find(e=>e.typeName===n):void 0,i=r?Rx(r):this.paletteItemFor(e);if(i.isSingleton&&this._document.nodes.some(t=>t.type===e))return;let a=this.capabilities.maxSteps;if(a&&this.countsTowardStepLimit(e)&&this.countedSteps(this._document.nodes)>=a){this.renderToolbar();return}let o=this.nextNodeId(e),s={id:o,type:e,name:Yb(this.l(i.localizationKey,i.fallbackLabel)),layout:t??this.defaultNodePosition(this._document.nodes.length)},c=r?.customProperties?.agentName;typeof c==`string`&&c.length>0&&Object.assign(s,ox(s,`runAiAgent.agentName`,c)),this.applyNodeDefaults(s),this._selectedNodeId=o,this._selectedNodeIds=[o],this._selectedEdgeId=void 0,this._inspectorTab=`general`,this.commit({...this._document,nodes:[...this._document.nodes,s]}),this.requestRender(),this.emitSelection()}defaultNodePosition(e){let t=this._graph?.getGraphArea();if(t&&t.width>rw&&t.height>iw){let n=e%6*28;return{x:Math.round(t.x+t.width/2-rw/2+n),y:Math.round(t.y+t.height/2-iw/2+n)}}return{x:hw+e%4*vw,y:gw+Math.floor(e/4)*yw}}applyNodeDefaults(e){let t=this.descriptorForNode(e);for(let n of cx(t.inputs))n.defaultValue!==void 0&&n.defaultValue!==null&&Object.assign(e,ox(e,n.name,lx(n.defaultValue)));t.isFanOut===!0&&this.pairWithNewJoinNode(e)}pairWithNewJoinNode(e){let t=this._document.nodes.find(e=>e.type===J.Join&&!e.join?.parallelNodeId);t?.id&&(e.parallel={...e.parallel??{},joinNodeId:t.id})}removeSelectedNode(){if(this.readOnly||!this._selectedNodeId)return;let e=this._selectedNodeId;this.commit({...this._document,nodes:this._document.nodes.filter(t=>t.id!==e),edges:this._document.edges.filter(t=>t.sourceNodeId!==e&&t.targetNodeId!==e)}),this._selectedNodeId=void 0,this._selectedNodeIds=[],this._selectedBranchId=void 0,this.requestRender(),this.emitSelection()}renameSelectedNode(e){if(this.readOnly||!this._selectedNodeId)return;let t=this._selectedNodeId;this.commit({...this._document,nodes:this._document.nodes.map(n=>n.id===t?{...n,name:Yb(e)}:n)}),this.requestRender()}setSelectedEdgeKind(e,t){this.readOnly||(this.commit({...this._document,edges:this._document.edges.map(n=>n.id===e?{...n,kind:t}:n)}),this.requestRender())}addBranch(e){if(this.readOnly)return;let t=this._document.nodes.find(t=>t.id===e);if(!t||t.type!==J.Condition)return;let n=t.condition?.branches??[],r={id:this.nextBranchId(n),name:Yb(this.l(`WorkflowBranch`,`Branch`)+` `+(n.length+1)),order:n.length+1};this._selectedBranchId=r.id,this.updateNode(e,e=>({...e,condition:{...e.condition??{},branches:[...n,r]}}))}removeBranch(e,t){if(this.readOnly)return;let n=this._document.nodes.find(t=>t.id===e);if(!n)return;let r=(n.condition?.branches??[]).filter(e=>e.id!==t).map((e,t)=>({...e,order:t+1}));this._selectedBranchId===t&&(this._selectedBranchId=void 0),this.commit({...this._document,nodes:this._document.nodes.map(t=>t.id===e?{...t,condition:{...t.condition??{},branches:r}}:t),edges:this._document.edges.filter(n=>n.sourceNodeId!==e||n.branchId!==t)}),this.requestRender()}moveBranch(e,t,n){if(this.readOnly)return;let r=[...this._document.nodes.find(t=>t.id===e)?.condition?.branches??[]],i=r.findIndex(e=>e.id===t),a=i+n;if(i<0||a<0||a>=r.length)return;let o=r[i];r.splice(i,1),r.splice(a,0,o),this.updateNode(e,e=>({...e,condition:{...e.condition??{},branches:r.map((e,t)=>({...e,order:t+1}))}}))}render(){if(this.root.querySelector(`.wf-designer`)||(this.root.innerHTML=`
2436
+ <div class="wf-designer" tabindex="0">
2437
+ <div class="wf-toolbar" part="toolbar"></div>
2438
+ <aside class="wf-palette" part="palette"></aside>
2439
+ <div class="wf-stage">
2440
+ <div class="wf-canvas" part="canvas"></div>
2441
+ <div class="wf-zoom" part="zoom"></div>
2442
+ <div class="wf-minimap" part="minimap"></div>
2443
+ <p class="wf-drop-hint" hidden></p>
2444
+ </div>
2445
+ <section class="wf-outline" part="outline" hidden></section>
2446
+ <aside class="wf-inspector" part="inspector"></aside>
2447
+ </div>
2448
+ `,this.adoptStyles(WC+UC),this._canvas=this.root.querySelector(`.wf-canvas`),this.root.querySelector(`.wf-designer`)?.addEventListener(`keydown`,e=>this.handleShortcut(e)),this.bindCanvasDropTarget()),this._graph||(this._viewportPending=!0,this._pendingFit=!0,this.createGraph(),this.syncGraphFromDocument()),this.renderToolbar(),this.renderPalette(),this.renderZoomControls(),this.renderInspector(),this.renderOutline(),this.renderSummary(),this.applyOutlineVisibility(),this.applyPaletteVisibility(),this.applySelectionStyles(),this._pendingFocus){let e=this._pendingFocus;this._pendingFocus=void 0,this.applyIssueFocus(e)}}handleShortcut(e){let t=e.target?.tagName?.toLowerCase();if(t===`input`||t===`select`||t===`textarea`)return;if(e.key===`Delete`||e.key===`Backspace`){(this._selectedNodeIds.length>0||this._selectedEdgeId)&&(e.preventDefault(),this.deleteSelection());return}if(e.key===`Escape`){this.clearSelection();return}if(!e.ctrlKey&&!e.metaKey)return;let n=e.key.toLowerCase();n===`z`&&!e.shiftKey?(e.preventDefault(),this.undo()):n===`y`||n===`z`&&e.shiftKey?(e.preventDefault(),this.redo()):n===`c`?(e.preventDefault(),this.copySelection()):n===`v`?(e.preventDefault(),this.pasteClipboard()):n===`d`?(e.preventDefault(),this.copySelection(),this.pasteClipboard()):n===`a`&&(e.preventDefault(),this.selectAll())}createGraph(){if(!this._canvas||this._graph)return;this._canvas.innerHTML=``;let e=this.root.querySelector(`.wf-minimap`);e&&(e.innerHTML=``);let t=this.canvasColors();this._graph=new q({container:this._canvas,autoResize:!0,grid:{visible:!0,size:16,type:`dot`,args:{color:t.grid,thickness:1.2}},panning:{enabled:!0,eventTypes:[`leftMouseDown`,`rightMouseDown`,`mouseWheel`]},mousewheel:{enabled:!0,modifiers:[`ctrl`,`meta`],minScale:cw,maxScale:lw},connecting:{allowBlank:!1,allowLoop:!1,allowMulti:!0,allowNode:!1,allowEdge:!1,snap:{radius:24},highlight:!0,router:{name:`manhattan`,args:{padding:16,startDirections:[`right`],endDirections:[`left`]}},connector:{name:`rounded`,args:{radius:8}},validateMagnet:({magnet:e})=>!this.readOnly&&e.getAttribute(`port-group`)===`out`,validateConnection:({sourceCell:e,targetCell:t,sourceMagnet:n,targetMagnet:r})=>this.readOnly||!e||!t||e===t||n?.getAttribute(`port-group`)!==`out`||r&&r.getAttribute(`port-group`)!==`in`?!1:this.canConnect(e.id,t.id,n?.getAttribute(`port`)??void 0),createEdge:()=>new Yv({attrs:{line:{stroke:this.canvasColors().primary,strokeWidth:1.6,strokeDasharray:`5 4`,targetMarker:{name:`block`,size:8}}}})},highlighting:{magnetAvailable:{name:`stroke`,args:{padding:4,attrs:{strokeWidth:3,stroke:t.primary,strokeOpacity:.45}}},magnetAdsorbed:{name:`stroke`,args:{padding:4,attrs:{strokeWidth:3,stroke:t.success}}}},interacting:()=>!this.readOnly||{nodeMovable:!1,edgeMovable:!1}}),this._graph.use(new Xy({enabled:!0,multiple:!0,rubberband:!0,rubberNode:!0,rubberEdge:!1,movable:!0,strict:!1,showNodeSelectionBox:!1,pointerEvents:`none`,modifiers:[`shift`],multipleSelectionModifiers:[`ctrl`,`meta`,`shift`]})),this._graph.use(new ib({enabled:!0,sharp:!0,tolerance:8}));let n=this.root.querySelector(`.wf-minimap`);n&&this._graph.use(new Hy({container:n,width:uw,height:dw,padding:8,scalable:!1})),this._graph.on(`node:moved`,({node:e})=>this.onNodeMoved(e.id,e.getPosition())),this._graph.on(`selection:changed`,()=>this.onSelectionChanged());let r;this._graph.on(`edge:mousedown`,({edge:e,e:t})=>{r={id:e.id,x:t.clientX??0,y:t.clientY??0}}),this._graph.on(`edge:mouseup`,({edge:e,e:t})=>{let n=r;r=void 0,n&&n.id===e.id&&Math.abs((t.clientX??0)-n.x)<=Ew&&Math.abs((t.clientY??0)-n.y)<=Ew&&this.selectEdge(e.id)}),this._graph.on(`edge:click`,({edge:e})=>this.selectEdge(e.id)),this._graph.on(`blank:click`,()=>this.clearSelection()),this._graph.on(`node:dblclick`,({node:e})=>{this.select(e.id),this.root.querySelector(`.wf-node-name`)?.focus()}),this._graph.on(`edge:connected`,({edge:e,isNew:t})=>{if(!t||this._isApplyingDocument)return;let n=e.getSourceCellId(),r=e.getTargetCellId(),i=e.getSourcePortId();if(!n||!r){this._graph?.removeCell(e);return}let a=this.buildEdge(n,r,i);a?(this.commit({...this._document,edges:[...this._document.edges,a]}),this.renderToolbar(),this.renderInspector()):this._graph?.removeCell(e)}),this._graph.on(`scale`,()=>this.renderZoomControls())}countsTowardStepLimit(e){let t=this.descriptorFor(e);return!t.isStart&&!t.isTerminal}countedSteps(e){return e.filter(e=>this.countsTowardStepLimit(e.type)).length}selectEdge(e){(this._selectedEdgeId!==e||this._selectedNodeIds.length!==0)&&(this._selectedEdgeId=e,this._selectedNodeIds=[],this._selectedNodeId=void 0,this._graph?.cleanSelection(),this.applySelectionStyles(),this.renderToolbar(),this.renderInspector(),this.emitSelection())}onNodeMoved(e,t){this._isApplyingDocument||(this.commit({...this._document,nodes:this._document.nodes.map(n=>n.id===e?{...n,layout:{...n.layout,x:t.x,y:t.y}}:n)},{resync:!1}),this.renderToolbar())}onSelectionChanged(){if(this._isApplyingDocument)return;let e=(this._graph?.getSelectedCells()??[]).filter(e=>e.isNode()).map(e=>e.id),t=e.length===this._selectedNodeIds.length&&e.every(e=>this._selectedNodeIds.includes(e));this._selectedNodeIds=e,this._selectedNodeId=e.length===1?e[0]:void 0,e.length>0&&(this._selectedEdgeId=void 0),t||(this._selectedBranchId=void 0),this.applySelectionStyles(),this.renderToolbar(),this.renderInspector(),this.emitSelection()}applySelectionStyles(){let e=this._graph;if(!e)return;let t=this.canvasColors(),n=new Set(this._selectedNodeIds);for(let r of e.getNodes()){let e=this._document.nodes.find(e=>e.id===r.id);if(!e)continue;let i=n.has(r.id);r.setAttrs({halo:{visibility:i?`visible`:`hidden`},body:this.nodeBodyAttrs(e,t,i)})}for(let t of e.getEdges()){let e=this._document.edges.find(e=>e.id===t.id);e&&t.setAttrs({line:{strokeWidth:this.edgeStrokeWidth(e)}})}}bindCanvasDropTarget(){let e=this.root.querySelector(`.wf-stage`),t=this.root.querySelector(`.wf-drop-hint`);e&&(e.addEventListener(`dragover`,n=>{!this.readOnly&&this._paletteDrag.isDragging&&(n.preventDefault(),n.dataTransfer&&(n.dataTransfer.dropEffect=`copy`),e.classList.add(`wf-drop-active`),t&&(t.hidden=!1,t.textContent=this.l(`WorkflowDesignerDropHere`,`Drop to add the step`)))}),e.addEventListener(`dragleave`,n=>{n.target===e&&(e.classList.remove(`wf-drop-active`),t&&(t.hidden=!0))}),e.addEventListener(`drop`,n=>{if(e.classList.remove(`wf-drop-active`),t&&(t.hidden=!0),this.readOnly)return;n.preventDefault();let r=Zy(n.dataTransfer?.getData(Sw),this._draggedType),i=this._draggedActivity;this._draggedType=void 0,this._draggedActivity=void 0,r!==void 0&&this.addNode(r,this.toGraphPoint(n.clientX,n.clientY),i)}))}toGraphPoint(e,t){if(!this._graph)return;let n=this._graph.clientToLocal(e,t);return{x:Math.round(n.x-rw/2),y:Math.round(n.y-iw/2)}}canConnect(e,t,n){let r=this._document.nodes.find(e=>e.id===t);return!r||r.type===J.Start?!1:this.resolveOutcomeKind(e,n)!==void 0}resolveOutcomeKind(e,t){let n=this._document.nodes.find(t=>t.id===e);if(!n)return;let r=this._document.edges.filter(t=>t.sourceNodeId===e),i=t?this.parsePortId(t):void 0;if(i)return i.kind===Y.ParallelBranch?{kind:i.kind}:i.branchId?r.some(e=>e.kind===i.kind&&e.branchId===i.branchId)?void 0:{kind:i.kind,branchId:i.branchId}:r.some(e=>e.kind===i.kind)?void 0:{kind:i.kind};for(let e of this.outcomesOf(n.type)){if(e.kind===Y.ParallelBranch)return{kind:e.kind};if(e.kind===Y.ConditionBranch){let t=new Set(r.filter(e=>e.kind===Y.ConditionBranch&&e.branchId).map(e=>e.branchId)),i=(n.condition?.branches??[]).find(e=>e.id&&!t.has(e.id));if(i?.id)return{kind:e.kind,branchId:i.id}}else if(!r.some(t=>t.kind===e.kind))return{kind:e.kind}}}buildEdge(e,t,n){let r=this.resolveOutcomeKind(e,n);if(r)return{id:this.nextEdgeId(),sourceNodeId:e,targetNodeId:t,kind:r.kind,branchId:r.branchId}}portIdFor(e,t){return t?`out:${e}:${t}`:`out:${e}`}parsePortId(e){let t=e.split(`:`);if(t[0]!==`out`||t.length<2)return;let n=Number(t[1]);return Number.isFinite(n)?{kind:n,branchId:t[2]}:void 0}syncGraphFromDocument(){if(!this._graph)return;let e=this._graph,t=this.canvasColors(),n=[...this._selectedNodeIds];this._isApplyingDocument=!0;try{e.clearCells();for(let n of this._document.nodes)e.addNode(this.nodeMetadataOf(n,t));for(let n of this._document.edges)e.addEdge(this.edgeMetadataOf(n,t));e.drawGrid({type:`dot`,args:{color:t.grid,thickness:1.2}});let r=n.map(t=>e.getCellById(t)).filter(e=>!!e);r.length>0&&e.resetSelection(r),this._viewportPending&&(this._viewportPending=!1,this.applyViewport(),this.scheduleInitialFit())}finally{this._isApplyingDocument=!1}}canvasColors(){let e=typeof getComputedStyle==`function`?getComputedStyle(this):void 0,t=(t,n)=>{let r=e?.getPropertyValue(t)?.trim();return r&&!r.startsWith(`var(`)?r:n};return{surface:t(`--wf-surface`,`#ffffff`),subtle:t(`--wf-subtle`,`#f9f9f9`),border:t(`--wf-border`,`#dbdfe9`),borderLight:t(`--wf-border-light`,`#f1f1f4`),text:t(`--wf-text`,`#071437`),textSecondary:t(`--wf-text-secondary`,`#4b5675`),muted:t(`--wf-muted`,`#78829d`),grid:t(`--bs-gray-400`,`#c4cada`),placeholder:t(`--wf-placeholder`,`#99a1b7`),primary:t(`--wf-primary`,`#1b84ff`),danger:t(`--wf-danger`,`#f8285a`),warning:t(`--wf-warning`,`#f6c000`),success:t(`--wf-success`,`#17c653`),onAccent:t(`--wf-on-accent`,`#ffffff`)}}nodeMetadataOf(e,t){let n=this.paletteItemFor(e.type),r=this.executionStyleOf(e.id,t),i=this.nodeHeightOf(e),a=this._selectedNodeIds.includes(e.id),o=this.outcomeRowsOf(e).length>0,s=this.hasIssue(e.id)||n.isUnknown,c=r.badge??(s?`!`:void 0),l=s?t.danger:r.stroke??t.primary,u=134-(c?32:14);return{id:e.id,x:e.layout?.x??hw,y:e.layout?.y??gw,width:rw,height:i,shape:`rect`,markup:[{tagName:`rect`,selector:`halo`},{tagName:`rect`,selector:`body`},{tagName:`rect`,selector:`iconBackground`},{tagName:`image`,selector:`icon`},{tagName:`text`,selector:`glyph`},{tagName:`text`,selector:`label`},{tagName:`text`,selector:`subtitle`},{tagName:`line`,selector:`divider`},{tagName:`circle`,selector:`badgeBackground`},{tagName:`text`,selector:`badge`}],attrs:{halo:{x:-5,y:-5,width:202,height:i+10,rx:14,ry:14,fill:`none`,stroke:t.primary,strokeOpacity:.22,strokeWidth:5,pointerEvents:`none`,visibility:a?`visible`:`hidden`},body:{refWidth:`100%`,refHeight:`100%`,rx:10,ry:10,...this.nodeBodyAttrs(e,t,a)},iconBackground:{x:12,y:15,width:34,height:34,rx:9,ry:9,fill:n.color,fillOpacity:.12},icon:n.iconName?{x:20,y:23,width:18,height:18,"xlink:href":Jx(n.iconName,n.color)}:{visibility:`hidden`},glyph:{text:n.iconName?``:n.icon,refX:29,refY:iw/2,fill:n.color,fontSize:16,fontWeight:700,textAnchor:`middle`,textVerticalAnchor:`middle`,pointerEvents:`none`},label:{text:Z(e.name,e.id),refX:58,refY:24,fill:t.text,fontSize:13,fontWeight:600,textAnchor:`start`,textVerticalAnchor:`middle`,textWrap:{width:u,height:sw,ellipsis:!0,breakWord:!0},pointerEvents:`none`},subtitle:{text:this.l(n.localizationKey,n.fallbackLabel),refX:58,refY:43,fill:t.muted,fontSize:11.5,fontWeight:500,textAnchor:`start`,textVerticalAnchor:`middle`,textWrap:{width:u,height:sw,ellipsis:!0},pointerEvents:`none`},divider:{x1:14,y1:iw,x2:178,y2:iw,stroke:t.borderLight,strokeWidth:1,visibility:o?`visible`:`hidden`},badgeBackground:{cx:176,cy:16,r:9,fill:l,visibility:c?`visible`:`hidden`},badge:{text:c??``,refX:176,refY:16,fill:t.onAccent,fontSize:11,fontWeight:700,textAnchor:`middle`,textVerticalAnchor:`middle`,pointerEvents:`none`}},ports:this.buildPortsFor(e,t)}}nodeBodyAttrs(e,t,n){let r=this.paletteItemFor(e.type),i=this.executionStyleOf(e.id,t),a=this.hasIssue(e.id)||r.isUnknown,o=n?t.primary:a?t.danger:i.stroke??t.border;return{fill:i.fill,fillOpacity:i.opacity,stroke:o,strokeWidth:n?Math.max(2,i.strokeWidth):a?2:i.strokeWidth,strokeDasharray:i.dashed||r.isUnknown?`5,4`:`0`}}edgeStrokeWidth(e){return this._selectedEdgeId===e.id?3:1.6}canvasEdgeLabelOf(e,t){return e.kind===Y.Default||t&&this.outcomeRowsOf(t).length>0?``:this.edgeLabelText(e)}edgeMetadataOf(e,t){let n=Cx(e.kind),r=this._document.nodes.find(t=>t.id===e.sourceNodeId),i=this.canvasEdgeLabelOf(e,r),a=r?!this.paletteItemFor(r.type).isTerminal:!1,o=n?.color??t.muted;return{id:e.id,source:a?{cell:e.sourceNodeId,port:this.portIdForEdge(e)}:{cell:e.sourceNodeId},target:{cell:e.targetNodeId,port:`in`},router:{name:`manhattan`,args:{padding:16,startDirections:[`right`],endDirections:[`left`]}},connector:{name:`rounded`,args:{radius:10}},attrs:{line:{stroke:o,strokeWidth:this.edgeStrokeWidth(e),strokeOpacity:this.edgeOpacityOf(e),targetMarker:{name:`block`,size:8}}},labels:i?[{position:{distance:.5},attrs:{text:{text:i,fontSize:11.5,fontWeight:600,fill:o},rect:{fill:t.surface,stroke:t.border,strokeWidth:1,rx:6,ry:6,refX:-7,refY:-4,refWidth:14,refHeight:8}}}]:[]}}scheduleInitialFit(){typeof requestAnimationFrame==`function`&&requestAnimationFrame(()=>requestAnimationFrame(()=>this.fitContentIfNeeded()))}fitContentIfNeeded(){let e=this._graph,t=this._canvas;if(!e||!t||!this._pendingFit||this._document.nodes.length===0)return;if(t.clientWidth===0||t.clientHeight===0){setTimeout(()=>this.fitContentIfNeeded(),120);return}this._pendingFit=!1;let n=e.getContentBBox();e.getGraphArea().containsRect(n)||(Math.min(1,(t.clientWidth-112)/Math.max(n.width,1),(t.clientHeight-112)/Math.max(n.height,1))>=xw?e.zoomToFit({padding:bw,maxScale:1,minScale:cw}):(e.zoomTo(xw),e.positionContent(`left`),e.translateBy(bw/2,0)),this.renderZoomControls())}executionStyleOf(e,t=this.canvasColors()){let n=this.heatStyleOf(e,t);if(n)return n;if(!this.isExecutionView)return this.isUnreviewed(e)?this.tintedState(t.warning,t,2,{dashed:!0,badge:`!`}):{fill:t.surface,opacity:1,strokeWidth:1,dashed:!1};switch(this._executionStates.find(t=>t.nodeId===e)?.status??Kb.NotVisited){case Kb.Active:return this.tintedState(t.primary,t,2.5,{badge:`●`});case Kb.Completed:return this.tintedState(t.success,t,2,{badge:`✓`});case Kb.Faulted:return this.tintedState(t.danger,t,2.5,{badge:`!`});case Kb.Skipped:return{fill:t.subtle,opacity:1,stroke:t.grid,strokeWidth:1.5,dashed:!0,badge:`↷`};case Kb.Cancelled:return{fill:t.subtle,opacity:1,stroke:t.placeholder,strokeWidth:1.5,dashed:!0,badge:`✕`};default:return{fill:t.surface,opacity:.5,stroke:t.border,strokeWidth:1,dashed:!0}}}isUnreviewed(e){let t=this._document.nodes.find(t=>t.id===e);return t?.authoringOrigin===Ub.Bpmn||t?.authoringOrigin===Ub.Ai}getUnreviewedNodeIds(){return this._document.nodes.filter(e=>this.isUnreviewed(e.id)).map(e=>e.id)}markNodeReviewed(e){!this.readOnly&&this.isUnreviewed(e)&&(this.commit({...this._document,nodes:this._document.nodes.map(t=>t.id===e?{...t,authoringOrigin:Ub.Manual}:t)}),this.requestRender())}async suggestConditionForSelectedBranch(e){let t=this.lookups.suggestCondition;if(this.readOnly||!t||!this._selectedBranchId||this._conditionSuggestionBusy)return;let n=(e??``).trim();if(n){this._conditionSuggestionText=n,this._conditionSuggestionBusy=!0,this._conditionSuggestionError=void 0,this.requestRender();try{let e=await t(n,this.assistantContext());if(!e?.succeeded||!e.expression){this._conditionSuggestionError=e?.failureReason??this.l(`WorkflowConditionSuggestFailed`,`A usable condition could not be produced.`);return}this.applySuggestedExpression(e.expression)}catch{this._conditionSuggestionError=this.l(`WorkflowConditionSuggestFailed`,`A usable condition could not be produced.`)}finally{this._conditionSuggestionBusy=!1,this.requestRender()}}}assistantContext(){return{graph:JSON.parse(JSON.stringify(this._document)),form:this._form?JSON.parse(JSON.stringify(this._form)):void 0}}applySuggestedExpression(e){let t=this._selectedBranchId;this.commit({...this._document,nodes:this._document.nodes.map(n=>n.condition?{...n,condition:{...n.condition,branches:(n.condition.branches??[]).map(n=>n.id===t?{...n,expression:e}:n)}}:n)}),this._conditionSuggestionText=``}edgeOpacityOf(e){return this.isExecutionView?this.wasEdgeTaken(e)?1:.25:1}wasEdgeTaken(e){let t=this._executionStates.find(t=>t.nodeId===e.sourceNodeId),n=this._executionStates.find(t=>t.nodeId===e.targetNodeId);if(!t||!n)return!1;let r=e=>e!==void 0&&e!==Kb.NotVisited;return r(t.status)&&r(n.status)}nodeHeightOf(e){let t=this.outcomeRowsOf(e).length;return t===0?iw:80+t*aw}outcomeRowsOf(e){if(this.paletteItemFor(e.type).isTerminal)return[];let t=this.outcomePortsOf(e);return t.length>1?t:[]}outcomePortsOf(e){let t=this.paletteItemFor(e.type),n=[];for(let r of t.outcomes)if(r.kind===Y.ConditionBranch)for(let t of e.condition?.branches??[])t.id&&n.push({id:this.portIdFor(r.kind,t.id),label:Z(t.name,t.id),color:r.color});else if(r.kind===Y.ParallelBranch){let t=this.parallelEdgesOf(e.id).length,i=Math.max(mw,t+1);for(let e=0;e<i;e++)n.push({id:this.parallelPortId(e),label:`${this.l(r.localizationKey,r.fallbackLabel)} ${e+1}`,color:r.color})}else n.push({id:this.portIdFor(r.kind),label:this.l(r.localizationKey,r.fallbackLabel),color:r.color});return n}parallelEdgesOf(e){return this._document.edges.filter(t=>t.sourceNodeId===e&&t.kind===Y.ParallelBranch)}parallelPortId(e){return`out:${Y.ParallelBranch}:slot-${e}`}portIdForEdge(e){if(e.kind!==Y.ParallelBranch)return this.portIdFor(e.kind,e.branchId);let t=this.parallelEdgesOf(e.sourceNodeId).findIndex(t=>t.id===e.id);return this.parallelPortId(t<0?0:t)}buildPortsFor(e,t=this.canvasColors()){let n=this.paletteItemFor(e.type),r={r:6,strokeWidth:2,fill:t.surface},i={in:{position:{name:`absolute`},attrs:{circle:{...r,magnet:`passive`,stroke:t.muted}}},out:{position:{name:`absolute`},attrs:{circle:{...r,magnet:!0,stroke:t.muted},text:{fontSize:11.5,fontWeight:600,fill:t.textSecondary}},label:{position:{name:`left`,args:{x:-14,y:0}}}}},a=[];if(e.type!==J.Start&&a.push({id:`in`,group:`in`,args:{x:0,y:iw/2}}),!n.isTerminal){let n=this.outcomePortsOf(e),r=n.length>1;n.forEach((e,n)=>{a.push({id:e.id,group:`out`,args:{x:rw,y:r?72+n*aw+aw/2:iw/2},attrs:{circle:{stroke:e.color},text:r?{text:e.label,fill:t.textSecondary,textWrap:{width:148,height:sw,ellipsis:!0}}:{text:``}}})})}return{groups:i,items:a}}applyViewport(){if(!this._graph)return;let e=this._document.metadata;e?.zoom&&e.zoom>0&&this._graph.zoomTo(Math.min(lw,Math.max(cw,e.zoom))),e?.canvasOffsetX!==void 0&&e?.canvasOffsetY!==void 0&&this._graph.translate(e.canvasOffsetX,e.canvasOffsetY)}captureViewport(){if(!this._graph)return;let e=this._graph.translate();this.commit({...this._document,metadata:{...this._document.metadata??{},zoom:this._graph.zoom(),canvasOffsetX:e.tx,canvasOffsetY:e.ty}},{resync:!1,recordHistory:!1,viewOnly:!0})}zoomIn(){this._graph?.zoom(.15,{maxScale:lw}),this.captureViewport(),this.renderZoomControls()}zoomOut(){this._graph?.zoom(-.15,{minScale:cw}),this.captureViewport(),this.renderZoomControls()}zoomToFit(){this._graph?.zoomToFit({padding:bw,maxScale:1,minScale:cw}),this.captureViewport(),this.renderZoomControls()}resetZoom(){this._graph?.zoomTo(1),this._graph?.centerContent(),this.captureViewport(),this.renderZoomControls()}select(e){this._selectedEdgeId=void 0,this._selectedNodeId=e,this._selectedNodeIds=[e],this._selectedBranchId=void 0;let t=this._graph?.getCellById(e);t&&this._graph?.resetSelection([t]),this.renderToolbar(),this.renderInspector(),this.emitSelection()}selectAll(){let e=this._graph?.getNodes()??[];this._graph?.resetSelection(e)}clearSelection(){this._graph?.cleanSelection(),this._selectedNodeId=void 0,this._selectedNodeIds=[],this._selectedEdgeId=void 0,this._selectedBranchId=void 0,this.applySelectionStyles(),this.renderToolbar(),this.renderInspector(),this.emitSelection()}deleteSelection(){if(this.readOnly)return;if(this._selectedEdgeId){this.removeEdge(this._selectedEdgeId);return}if(this._selectedNodeIds.length===0)return;let e=new Set(this._selectedNodeIds);this.commit({...this._document,nodes:this._document.nodes.filter(t=>!e.has(t.id)),edges:this._document.edges.filter(t=>!e.has(t.sourceNodeId)&&!e.has(t.targetNodeId))}),this.clearSelection()}removeEdge(e){this.readOnly||(this.commit({...this._document,edges:this._document.edges.filter(t=>t.id!==e)}),this._selectedEdgeId=void 0,this.renderInspector())}copySelection(){let e=new Set(this._selectedNodeIds);e.size!==0&&(this._clipboard={nodes:this._document.nodes.filter(t=>e.has(t.id)&&!this.paletteItemFor(t.type).isSingleton).map(e=>JSON.parse(JSON.stringify(e))),edges:this._document.edges.filter(t=>e.has(t.sourceNodeId)&&e.has(t.targetNodeId)).map(e=>JSON.parse(JSON.stringify(e)))},this.renderToolbar())}pasteClipboard(){if(this.readOnly||!this._clipboard||this._clipboard.nodes.length===0)return;let e=this.capabilities.maxSteps;if(e&&this.countedSteps(this._document.nodes)+this.countedSteps(this._clipboard.nodes)>e)return;let t=new Map,n=[...this._document.nodes];for(let e of this._clipboard.nodes){let r=this.nextNodeId(e.type,n);t.set(e.id,r),n.push({...e,id:r,layout:{...e.layout,x:(e.layout?.x??60)+fw,y:(e.layout?.y??60)+fw}})}let r=[...this._document.edges];for(let e of this._clipboard.edges){let n=t.get(e.sourceNodeId),i=t.get(e.targetNodeId);n&&i&&r.push({...e,id:this.nextEdgeId(r),sourceNodeId:n,targetNodeId:i})}this.commit({...this._document,nodes:n,edges:r});let i=[...t.values()];this._selectedNodeIds=i,this._selectedNodeId=i.length===1?i[0]:void 0;let a=i.map(e=>this._graph?.getCellById(e)).filter(Boolean);a.length>0&&this._graph?.resetSelection(a),this.renderToolbar(),this.renderInspector()}autoLayout(){if(this.readOnly||this._document.nodes.length===0)return;this._outlineVisible&&this.toggleOutline();let e=this.layoutDepths(),t=new Map;for(let n of this._document.nodes){let r=e.get(n.id)??0;t.has(r)||t.set(r,[]),t.get(r)?.push(n.id)}let n=new Map(this._document.nodes.map(e=>[e.id,this.nodeHeightOf(e)])),r=e=>e.reduce((e,t)=>e+(n.get(t)??iw),0)+Math.max(0,e.length-1)*_w,i=Math.max(...[...t.values()].map(r)),a=new Map;for(let[e,o]of t){let t=gw+Math.round((i-r(o))/2);for(let r of o)a.set(r,{x:hw+e*vw,y:t}),t+=(n.get(r)??iw)+_w}this.commit({...this._document,nodes:this._document.nodes.map(e=>({...e,layout:{...e.layout,...a.get(e.id)??{x:60,y:60}}}))}),this.zoomToFit()}layoutDepths(){let e=this._document.nodes.map(e=>e.id),t=new Set(e),n=new Map(e.map(e=>[e,[]])),r=new Map(e.map(e=>[e,0]));for(let e of this._document.edges)t.has(e.sourceNodeId)&&t.has(e.targetNodeId)&&(n.get(e.sourceNodeId)?.push(e.targetNodeId),r.set(e.targetNodeId,(r.get(e.targetNodeId)??0)+1));let i=this._document.nodes.find(e=>e.type===J.Start),a=[...i?[i.id]:[],...e.filter(e=>e!==i?.id&&(r.get(e)??0)===0),...e],o=new Map,s=new Map(e.map(e=>[e,[]]));for(let e of a){if(o.has(e))continue;let t=[{id:e,next:0}];for(o.set(e,`active`);t.length>0;){let e=t[t.length-1],r=n.get(e.id)??[];if(e.next>=r.length){o.set(e.id,`done`),t.pop();continue}let i=r[e.next++],a=o.get(i);a!==`active`&&(s.get(e.id)?.push(i),a===void 0&&(o.set(i,`active`),t.push({id:i,next:0})))}}let c=new Map(e.map(e=>[e,0]));for(let e of s.values())for(let t of e)c.set(t,(c.get(t)??0)+1);let l=new Map,u=e.filter(e=>(c.get(e)??0)===0);for(let e of u)l.set(e,0);for(;u.length>0;){let e=u.shift(),t=l.get(e)??0;for(let n of s.get(e)??[]){l.set(n,Math.max(l.get(n)??0,t+1));let e=(c.get(n)??1)-1;c.set(n,e),e===0&&u.push(n)}}return l}edgeLabelText(e){if(e.kind===Y.ConditionBranch){let t=this.branchOf(e);if(t)return Z(t.name,t.id??``)}let t=Cx(e.kind);return t?.fallback?this.l(t.key,t.fallback):``}branchOf(e){if(e.branchId)return this._document.nodes.find(t=>t.id===e.sourceNodeId)?.condition?.branches?.find(t=>t.id===e.branchId)}renderSchemaVersionWarning(){let e=this.schemaVersionMismatch;if(!e)return``;let t=(e.kind===`designer-outdated`?this.l(`WorkflowDesignerSchemaVersionDesignerOutdated`,`This designer build understands workflow schema v{0} but the server saves v{1}. Refresh the page; if the warning stays, the designer bundle needs to be rebuilt.`):this.l(`WorkflowDesignerSchemaVersionServerOutdated`,`This designer build writes workflow schema v{0} but the server only understands v{1}. Update the server before saving.`)).replace(`{0}`,String(e.designerVersion)).replace(`{1}`,String(e.serverVersion));return`
2449
+ <span class="wf-tool-divider"></span>
2450
+ <span class="wf-tool-warning" part="schema-warning" role="status" title="${this.escape(t)}">
2451
+ ${$(`warning`,14)} ${this.escape(t)}
2452
+ </span>
2453
+ `}toolButton(e,t,n,r={}){let i=r.shortcut?`${n} (${r.shortcut})`:n;return`
2454
+ <button type="button" class="wf-tool ${e}" ${r.disabled?`disabled`:``}
2455
+ ${r.pressed===void 0?``:`aria-pressed="${r.pressed}"`}
2456
+ title="${this.escape(i)}" aria-label="${this.escape(n)}">
2457
+ ${$(t)}<span class="wf-tool-label">${this.escape(n)}</span>
2458
+ </button>
2459
+ `}renderToolbar(){let e=this.root.querySelector(`.wf-toolbar`);if(!e)return;let t=this.readOnly?`disabled`:``,n=this._selectedNodeIds.length>0||this._selectedEdgeId!==void 0,r=t===`disabled`;e.innerHTML=`
2460
+ ${r?``:`
2461
+ ${this.toolButton(`wf-palette-toggle`,`panelLeft`,this._paletteCollapsed?this.l(`WorkflowDesignerShowPalette`,`Show steps`):this.l(`WorkflowDesignerHidePalette`,`Hide steps`))}
2462
+ <span class="wf-tool-divider"></span>
2463
+ <span class="wf-tool-group">
2464
+ ${this.toolButton(`wf-undo`,`undo`,this.l(`WorkflowDesignerUndo`,`Undo`),{disabled:!this.canUndo,shortcut:`Ctrl+Z`})}
2465
+ ${this.toolButton(`wf-redo`,`redo`,this.l(`WorkflowDesignerRedo`,`Redo`),{disabled:!this.canRedo,shortcut:`Ctrl+Y`})}
2466
+ </span>
2467
+ <span class="wf-tool-divider"></span>
2468
+ <span class="wf-tool-group">
2469
+ ${this.toolButton(`wf-copy`,`copy`,this.l(`WorkflowDesignerCopy`,`Copy`),{disabled:!n||r,shortcut:`Ctrl+C`})}
2470
+ ${this.toolButton(`wf-paste`,`paste`,this.l(`WorkflowDesignerPaste`,`Paste`),{disabled:!this._clipboard||r,shortcut:`Ctrl+V`})}
2471
+ ${this.toolButton(`wf-delete`,`trash`,this.l(`WorkflowDesignerDelete`,`Delete`),{disabled:!n||r,shortcut:`Del`})}
2472
+ </span>
2473
+ <span class="wf-tool-divider"></span>`}
2474
+ <span class="wf-tool-group">
2475
+ ${this.toolButton(`wf-outline-toggle`,this._outlineVisible?`canvas`:`outline`,this._outlineVisible?this.l(`WorkflowDesignerCanvasView`,`Canvas`):this.l(`WorkflowDesignerOutline`,`Outline`),{pressed:this._outlineVisible})}
2476
+ ${r?``:this.toolButton(`wf-auto-layout`,`layout`,this.l(`WorkflowDesignerAutoLayout`,`Auto layout`))}
2477
+ </span>
2478
+ ${this.renderSchemaVersionWarning()}
2479
+ <span class="wf-tool-spacer"></span>
2480
+ <span class="wf-tool-text">
2481
+ ${this.escape(this.l(`WorkflowDesignerStepCount`,`Steps`))}
2482
+ <strong>${this.countedSteps(this._document.nodes)}${this.capabilities.maxSteps?` / `+this.capabilities.maxSteps:``}</strong>
2483
+ </span>
2484
+ ${this.capabilities.maxSteps&&this.countedSteps(this._document.nodes)>=this.capabilities.maxSteps?`<span class="wf-tool-warning" role="status">${this.escape(this.l(`WorkflowDesignerStepLimitReached`,`The step limit is reached. Remove a step before adding another.`))}</span>`:``}
2485
+ `,e.querySelector(`.wf-palette-toggle`)?.addEventListener(`click`,()=>this.togglePalette()),e.querySelector(`.wf-undo`)?.addEventListener(`click`,()=>this.undo()),e.querySelector(`.wf-redo`)?.addEventListener(`click`,()=>this.redo()),e.querySelector(`.wf-copy`)?.addEventListener(`click`,()=>this.copySelection()),e.querySelector(`.wf-paste`)?.addEventListener(`click`,()=>this.pasteClipboard()),e.querySelector(`.wf-delete`)?.addEventListener(`click`,()=>this.deleteSelection()),e.querySelector(`.wf-outline-toggle`)?.addEventListener(`click`,()=>this.toggleOutline()),e.querySelector(`.wf-auto-layout`)?.addEventListener(`click`,()=>this.autoLayout())}renderZoomControls(){let e=this.root.querySelector(`.wf-zoom`);if(!e)return;let t=Math.round((this._graph?.zoom()??1)*100),n=this.escape(this.l(`WorkflowDesignerZoomOut`,`Zoom out`)),r=this.escape(this.l(`WorkflowDesignerZoomIn`,`Zoom in`)),i=this.escape(this.l(`WorkflowDesignerZoomToFit`,`Fit to screen`));e.innerHTML=`
2486
+ <button type="button" class="wf-zoom-button wf-zoom-out" title="${n}" aria-label="${n}">
2487
+ ${$(`zoomOut`)}
2488
+ </button>
2489
+ <button type="button" class="wf-zoom-level"
2490
+ title="${this.escape(this.l(`WorkflowDesignerResetZoom`,`Reset zoom`))}">${t}%</button>
2491
+ <button type="button" class="wf-zoom-button wf-zoom-in" title="${r}" aria-label="${r}">
2492
+ ${$(`zoomIn`)}
2493
+ </button>
2494
+ <span class="wf-zoom-divider"></span>
2495
+ <button type="button" class="wf-zoom-button wf-zoom-fit" title="${i}" aria-label="${i}">
2496
+ ${$(`fit`)}
2497
+ </button>
2498
+ `,e.querySelector(`.wf-zoom-in`)?.addEventListener(`click`,()=>this.zoomIn()),e.querySelector(`.wf-zoom-out`)?.addEventListener(`click`,()=>this.zoomOut()),e.querySelector(`.wf-zoom-fit`)?.addEventListener(`click`,()=>this.zoomToFit()),e.querySelector(`.wf-zoom-level`)?.addEventListener(`click`,()=>this.resetZoom())}renderPalette(){let e=this.root.querySelector(`.wf-palette`);if(!e)return;let t=this.l(`WorkflowDesignerSearchSteps`,`Search steps`),n=e.querySelector(`.wf-palette-search`),r=e.querySelector(`.wf-palette-items`);if(!n||!r){e.innerHTML=`
2499
+ <h4 class="wf-palette-title"></h4>
2500
+ <div class="wf-search">
2501
+ ${$(`search`,15)}
2502
+ <input type="search" class="wf-palette-search wf-control" />
2503
+ </div>
2504
+ <div class="wf-palette-items"></div>
2505
+ `,n=e.querySelector(`.wf-palette-search`),r=e.querySelector(`.wf-palette-items`),n.value=this._paletteFilter;let t=n;t.addEventListener(`input`,()=>{this._paletteFilter=t.value,this.renderPaletteItems()})}let i=e.querySelector(`.wf-palette-title`);i&&(i.textContent=this.l(`WorkflowDesignerPalette`,`Steps`)),n.placeholder=t,n.setAttribute(`aria-label`,t),n.value!==this._paletteFilter&&this.root.activeElement!==n&&(n.value=this._paletteFilter),this.renderPaletteItems()}renderPaletteItems(){let e=this.root.querySelector(`.wf-palette-items`);if(!e)return;let t=this.readOnly?`disabled`:``,n=this._paletteFilter.trim().toLowerCase(),r=this.availableActivityDescriptors.map(e=>({...Rx(e),activityTypeName:e.customProperties?.agentName?e.typeName:``})).filter(e=>{if(!n)return!0;let t=this.l(e.localizationKey,e.fallbackLabel).toLowerCase(),r=this.l(e.descriptionKey,e.fallbackDescription).toLowerCase();return t.includes(n)||r.includes(n)});e.innerHTML=hx.map(e=>{let n=r.filter(t=>t.category===e.id);return n.length===0?``:`
2506
+ <div class="wf-palette-group">
2507
+ <h5>${this.escape(this.l(e.localizationKey,e.fallbackLabel))}</h5>
2508
+ ${n.map(e=>`
2509
+ <button type="button" class="wf-palette-item" data-type="${e.type}"
2510
+ data-activity="${this.escape(e.activityTypeName)}"
2511
+ style="--wf-item-color:${e.color}"
2512
+ draggable="${this.readOnly?`false`:`true`}" ${t}
2513
+ title="${this.escape([this.l(e.localizationKey,e.fallbackLabel),this.l(e.descriptionKey,e.fallbackDescription)].filter(e=>!!e).join(`: `))}">
2514
+ <span class="wf-palette-icon">${this.nodeIconMarkup(e,18)}</span>
2515
+ <span class="wf-palette-text">
2516
+ <strong>${this.escape(this.l(e.localizationKey,e.fallbackLabel))}</strong>
2517
+ <small>${this.escape(this.l(e.descriptionKey,e.fallbackDescription))}</small>
2518
+ </span>
2519
+ </button>`).join(``)}
2520
+ </div>`}).join(``)||`<p class="wf-muted">${this.escape(this.l(`WorkflowDesignerNoStepMatches`,`No step matches the search.`))}</p>`,e.querySelectorAll(`.wf-palette-item`).forEach(e=>{let t=Number(e.dataset.type),n=e.dataset.activity||void 0;e.addEventListener(`click`,()=>{this._paletteDrag.consumeClick()&&this.addNode(t,void 0,n)}),e.addEventListener(`dragstart`,e=>{this.readOnly?e.preventDefault():(this._draggedType=t,this._draggedActivity=n,this._paletteDrag.onDragStart(),e.dataTransfer?.setData(Sw,String(t)),e.dataTransfer&&(e.dataTransfer.effectAllowed=`copy`))}),e.addEventListener(`dragend`,()=>{this._draggedType=void 0,this._paletteDrag.onDragEnd(),this.root.querySelector(`.wf-stage`)?.classList.remove(`wf-drop-active`)})})}bindVariablesPanel(e){this.readOnly||(e.querySelector(`[data-variable-add]`)?.addEventListener(`click`,()=>{this.updateVariables(e=>[...e,CC()])}),e.querySelectorAll(`[data-variable-remove]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=Number(e.dataset.variableRemove);this.updateVariables(e=>e.filter((e,n)=>n!==t))})}),e.querySelectorAll(`[data-variable-row]`).forEach(e=>{let t=Number(e.dataset.variableRow);e.querySelectorAll(`[data-variable-field]`).forEach(n=>{n.tagName.toLowerCase()===`input`&&n.type,n.addEventListener(`change`,()=>{this.updateVariables(n=>n.map((n,r)=>r===t?OC(e,n):n))})})}))}updateVariables(e){let t=e(this._document.variables??[]);this.commit({...this._document,variables:t},{resync:!1,inspectorOnly:!0})}nodeIconMarkup(e,t=16){return e.iconName?$(e.iconName,t):`<span aria-hidden="true">${this.escape(e.icon)}</span>`}renderInspector(){let e=this.root.querySelector(`.wf-inspector`);if(!e)return;if(this._selectedEdgeId){this.renderEdgeInspector(e,this._selectedEdgeId);return}if(this._selectedNodeIds.length>1){e.innerHTML=`
2521
+ <h4>${this.escape(this.l(`WorkflowDesignerInspector`,`Properties`))}</h4>
2522
+ <div class="wf-inspector-empty">
2523
+ ${$(`outline`,22)}
2524
+ <p><strong>${this._selectedNodeIds.length}</strong> ${this.escape(this.l(`WorkflowDesignerMultiSelection`,`steps selected`))}</p>
2525
+ </div>
2526
+ `;return}let t=this._document.nodes.find(e=>e.id===this._selectedNodeId);if(!t){e.innerHTML=`
2527
+ <h4>${this.escape(this.l(`WorkflowDesignerInspector`,`Properties`))}</h4>
2528
+ <div class="wf-inspector-empty">
2529
+ ${$(`info`,22)}
2530
+ <p>${this.escape(this.l(`WorkflowDesignerNoSelection`,`Select a step to edit it.`))}</p>
2531
+ </div>
2532
+ <section class="wf-summary" part="summary"></section>
2533
+ ${this.readOnly&&(this._document.variables??[]).length===0?``:EC({variables:this._document.variables??[],disabled:this.readOnly,localize:(e,t)=>this.l(e,t),escape:e=>this.escape(e)})}
2534
+ `,this.bindVariablesPanel(e),this.renderSummary();return}let n=this.validationIssues.filter(e=>e.nodeId===t.id),r=this.paletteItemFor(t.type),i=this.inspectorTabsFor(t),a=i.find(e=>e.id===this._inspectorTab)?.id??ww;this._inspectorTab=a;let o=this.l(r.localizationKey,r.fallbackLabel),s=this.l(r.descriptionKey,r.fallbackDescription);e.innerHTML=`
2535
+ <div class="wf-inspector-head">
2536
+ <span class="wf-inspector-icon" style="--wf-item-color:${r.color}">${this.nodeIconMarkup(r,20)}</span>
2537
+ <span class="wf-inspector-title">
2538
+ <strong>${this.escape(Z(t.name,t.id))}</strong>
2539
+ <small>${this.escape(o)}</small>
2540
+ </span>
2541
+ </div>
2542
+ ${i.length>1?`<div class="wf-tabs" role="tablist">
2543
+ ${i.map(e=>`
2544
+ <button type="button" role="tab" class="wf-tab ${e.id===a?`wf-tab-active`:``}"
2545
+ data-tab="${e.id}" aria-selected="${e.id===a}">
2546
+ ${this.escape(e.label)}
2547
+ </button>`).join(``)}
2548
+ </div>`:``}
2549
+ ${n.length>0?`<ul class="wf-issues" role="alert">${n.map((e,t)=>`<li><button type="button" class="wf-issue-link" data-issue-index="${t}" title="${this.escape(this.l(`WorkflowDesignerShowIssue`,`Show the setting this is about`))}">${this.escape(e.message??e.code??``)}</button></li>`).join(``)}</ul>`:``}
2550
+ ${this.isUnreviewed(t.id)?`<div class="wf-review-notice" role="status">
2551
+ <p>${this.escape(this.l(`WorkflowDesignerStepNotReviewed`,`This step was generated and has not been reviewed yet.`))}</p>
2552
+ ${this.readOnly?``:`<button type="button" class="wf-secondary wf-mark-reviewed">${this.escape(this.l(`WorkflowDesignerMarkReviewed`,`Mark as reviewed`))}</button>`}
2553
+ </div>`:``}
2554
+ <div class="wf-tab-panel" ${a===ww?``:`hidden`}>
2555
+ <label class="wf-field">
2556
+ <span>${this.escape(this.l(`WorkflowDesignerStepName`,`Name`))}</span>
2557
+ <input type="text" class="wf-node-name" value="${this.escape(Z(t.name,t.id))}" ${this.readOnly?`disabled`:``} />
2558
+ </label>
2559
+ <label class="wf-field">
2560
+ <span>${this.escape(this.l(`WorkflowDesignerStepDescription`,`Description`))}</span>
2561
+ <textarea class="wf-node-description" rows="2" ${this.readOnly?`disabled`:``}>${this.escape(Z(t.description,``))}</textarea>
2562
+ </label>
2563
+ ${this.renderCategorySettings(t,Tw)}
2564
+ <div class="wf-node-meta">
2565
+ ${s?`<span>${this.escape(s)}</span>`:``}
2566
+ <span>${this.escape(o)} &middot; <code>${this.escape(t.id)}</code></span>
2567
+ </div>
2568
+ ${this.renderConnectionsSection(t)}
2569
+ ${this.readOnly?``:`<div class="wf-inspector-footer">
2570
+ <button type="button" class="wf-danger wf-remove-node">
2571
+ ${$(`trash`,15)}
2572
+ ${this.escape(this.l(`WorkflowDesignerRemoveStep`,`Remove step`))}
2573
+ </button>
2574
+ </div>`}
2575
+ </div>
2576
+ ${i.filter(e=>e.id!==ww).map(e=>`
2577
+ <div class="wf-tab-panel" data-tab-panel="${this.escape(e.id)}" ${e.id===a?``:`hidden`}>${this.renderCategorySettings(t,e.category)}</div>`).join(``)}
2578
+ `,e.querySelectorAll(`.wf-tab`).forEach(e=>{e.addEventListener(`click`,()=>{this._inspectorTab=e.dataset.tab??ww,this.renderInspector()})}),e.querySelectorAll(`.wf-issue-link`).forEach(e=>{e.addEventListener(`click`,()=>{let t=n[Number(e.dataset.issueIndex)];t&&this.focusValidationIssue(t)})});let c=e.querySelector(`.wf-node-name`);c?.addEventListener(`change`,()=>this.renameSelectedNode(c.value));let l=e.querySelector(`.wf-node-description`);l?.addEventListener(`change`,()=>this.updateNode(t.id,e=>({...e,description:l.value?Yb(l.value):void 0}))),e.querySelector(`.wf-remove-node`)?.addEventListener(`click`,()=>this.removeSelectedNode()),e.querySelector(`.wf-mark-reviewed`)?.addEventListener(`click`,()=>this.markNodeReviewed(t.id)),e.querySelectorAll(`.wf-connection-remove`).forEach(e=>{e.addEventListener(`click`,()=>this.removeEdge(e.dataset.edgeId??``))}),this.readOnly&&this.bindConditionSection(e,t),this.bindSettingsSection(e,t)}renderEdgeInspector(e,t){let n=this._document.edges.find(e=>e.id===t);if(!n){this._selectedEdgeId=void 0,this.renderInspector();return}let r=this._document.nodes.find(e=>e.id===n.sourceNodeId),i=this._document.nodes.find(e=>e.id===n.targetNodeId);e.innerHTML=`
2579
+ <div class="wf-inspector-head">
2580
+ <span class="wf-inspector-icon" style="--wf-item-color:${Cx(n.kind).color}">${$(`link`,20)}</span>
2581
+ <span class="wf-inspector-title">
2582
+ <strong>${this.escape(this.l(`WorkflowDesignerConnection`,`Connection`))}</strong>
2583
+ <small>${this.escape(Z(r?.name,n.sourceNodeId))} &rarr; ${this.escape(Z(i?.name,n.targetNodeId))}</small>
2584
+ </span>
2585
+ </div>
2586
+ <label class="wf-field">
2587
+ <span>${this.escape(this.l(`WorkflowDesignerConnectionOutcome`,`Outcome`))}</span>
2588
+ <input type="text" value="${this.escape(this.edgeLabelText(n))}" disabled />
2589
+ </label>
2590
+ <div class="wf-inspector-footer">
2591
+ <button type="button" class="wf-danger wf-remove-edge" ${this.readOnly?`disabled`:``}>
2592
+ ${$(`trash`,15)}
2593
+ ${this.escape(this.l(`WorkflowDesignerRemoveConnection`,`Remove connection`))}
2594
+ </button>
2595
+ </div>
2596
+ `,e.querySelector(`.wf-remove-edge`)?.addEventListener(`click`,()=>this.removeEdge(t))}renderConnectionsSection(e){let t=this._document.edges.filter(t=>t.sourceNodeId===e.id);if(t.length===0)return``;let n=this.readOnly?`disabled`:``;return`
2597
+ <div class="wf-section">
2598
+ <h5>${this.escape(this.l(`WorkflowDesignerConnections`,`Connections`))}</h5>
2599
+ <ul class="wf-connection-list">
2600
+ ${t.map(e=>{let t=this._document.nodes.find(t=>t.id===e.targetNodeId);return`
2601
+ <li>
2602
+ <span class="wf-dot" style="background:${Cx(e.kind).color}"></span>
2603
+ <span>${this.escape(this.edgeLabelText(e)||this.l(`WorkflowEdgeKind_Default`,`Next`))}
2604
+ &rarr; ${this.escape(Z(t?.name,e.targetNodeId))}</span>
2605
+ <button type="button" class="wf-connection-remove" data-edge-id="${this.escape(e.id)}" ${n}
2606
+ title="${this.escape(this.l(`WorkflowDesignerRemoveConnection`,`Remove connection`))}"
2607
+ aria-label="${this.escape(this.l(`WorkflowDesignerRemoveConnection`,`Remove connection`))}">${$(`close`,15)}</button>
2608
+ </li>`}).join(``)}
2609
+ </ul>
2610
+ </div>
2611
+ `}inspectorTabsFor(e){let t=this.descriptorForNode(e),n=[{id:ww,label:this.l(`WorkflowDesignerTabGeneral`,`General`)}];for(let r of sx(mx(t.inputs,e)))r.length!==0&&r!==Tw&&n.push({id:`category-`+r.toLowerCase(),category:r,label:this.l(`WorkflowInputCategory_`+r,r)});return n}renderCategorySettings(e,t){let n=this.descriptorForNode(e),r=mx(n.inputs,e).filter(e=>(e.category??``)===t);return r.length===0?``:this.isDescriptorCapabilityBlocked(n)?this.renderCapabilityBlockedMessage(n.requiredCapability):r.map(t=>this.renderDescriptorInput(e,t)).join(``)}renderCapabilityBlockedMessage(e){let t=e===`eventWaitEnabled`?this.l(`WorkflowEvent_EventWaitIsDisabled`,`Waiting for external events is turned off for this tenant.`):this.l(`WorkflowActionRequiresFeature`,`External actions are not enabled for this tenant.`);return`
2612
+ <div class="wf-section">
2613
+ <p class="wf-muted">${this.escape(t)}</p>
2614
+ </div>
2615
+ `}localEditors(){return this._localEditors||=new Map([[Q.actionParameterTable,this.createActionParameterEditor()],[Q.eventPayloadMappingTable,this.createEventPayloadMappingEditor()],[Q.conditionBuilder,this.createConditionBuilderEditor()],[Q.slaEditor,this.createSlaEditor()],[`eventWait.onTimeout`,this.createEventTimeoutEditor()]]),this._localEditors}editorFor(e){let t=this.localEditors();return t.get(e.name)||((e.uiHint?t.get(e.uiHint):void 0)??pC(e))}createActionParameterEditor(){return{hint:Q.actionParameterTable,render:()=>this._selectedNodeId?this.renderActionParameterSection(this.selectedNode()):``,read:()=>void 0,bind:e=>{this._selectedNodeId&&this.bindActionParameterSection(e,this.selectedNode())}}}createEventTimeoutEditor(){let e=pC({name:`eventWait.onTimeout`,uiHint:Q.dropDown});return{hint:`eventWait.onTimeout`,render:t=>{let n=Number(t.value)===Hb.ContinueTimeoutPath?this.l(`WorkflowEventWaitTimeoutEdgeRequiredHint`,`Draw a "Timed out" connection from this step.`):this.l(`WorkflowEventWaitTimeoutEdgeNotAllowedHint`,`Remove any "Timed out" connection from this step.`);return e.render(t)+`<p class="wf-input-hint">${this.escape(n)}</p>`},read:t=>e.read(t)}}createConditionBuilderEditor(){return{hint:Q.conditionBuilder,render:()=>this._selectedNodeId?`<div class="wf-input" data-input="condition.branches">${this.renderConditionSection(this.selectedNode())}</div>`:``,read:()=>void 0,bind:e=>{this._selectedNodeId&&this.bindConditionSection(e,this.selectedNode())}}}createSlaEditor(){return{hint:Q.slaEditor,render:()=>this._selectedNodeId?`<div class="wf-input" data-input="sla">${this.renderSlaSection(this.selectedNode())}</div>`:``,read:()=>void 0,bind:e=>{this._selectedNodeId&&this.bindSlaSection(e,this.selectedNode())}}}createEventPayloadMappingEditor(){return{hint:Q.eventPayloadMappingTable,render:()=>this._selectedNodeId?this.renderEventPayloadMappings(this.selectedNode()):``,read:()=>void 0,bind:e=>{this._selectedNodeId&&this.bindEventPayloadMappings(e,this.selectedNode())}}}selectedNode(){return this._document.nodes.find(e=>e.id===this._selectedNodeId)}payloadTargetFields(){return this.conditionFields().filter(e=>!!e.key)}renderEventPayloadMappings(e){let t=e.eventWait?.payloadMappings??[],n=this.payloadTargetFields(),r=this.readOnly||n.length===0?`disabled`:``;return`
2616
+ <div class="wf-input" data-input="eventWait.payloadMappings">
2617
+ <span>${this.escape(this.l(`WorkflowEventWaitPayloadMappings`,`Payload mapping`))}</span>
2618
+ ${t.length===0?`<p class="wf-input-empty">${this.escape(this.l(`WorkflowEventWaitMappingsEmpty`,`Nothing from the event is written to the form yet.`))}</p>`:`<ul class="wf-mapping-list">${t.map((e,t)=>`
2619
+ <li>
2620
+ <span>${this.escape(e.sourcePath??``)} &rarr; ${this.escape(e.targetFieldKey??``)}</span>
2621
+ <button type="button" class="wf-event-mapping-remove" data-index="${t}"
2622
+ ${this.readOnly?`disabled`:``}
2623
+ aria-label="${this.escape(this.l(`WorkflowEventWaitRemoveMapping`,`Remove mapping`))}">&times;</button>
2624
+ </li>`).join(``)}</ul>`}
2625
+ <label class="wf-input">
2626
+ <span>${this.escape(this.l(`WorkflowEventWaitSourcePath`,`Payload path`))}</span>
2627
+ <input type="text" class="wf-event-mapping-source" placeholder="data.status" ${r} />
2628
+ </label>
2629
+ <label class="wf-input">
2630
+ <span>${this.escape(this.l(`WorkflowEventWaitTargetField`,`Target field`))}</span>
2631
+ <select class="wf-event-mapping-target" ${r}>
2632
+ ${n.map(e=>`<option value="${this.escape(e.key??``)}">${this.escape(Z(e.label,e.key??e.id))}</option>`).join(``)}
2633
+ </select>
2634
+ </label>
2635
+ <button type="button" class="wf-secondary wf-event-mapping-add" ${r}>
2636
+ ${$(`plus`,15)}
2637
+ ${this.escape(this.l(`WorkflowEventWaitAddMapping`,`Add mapping`))}
2638
+ </button>
2639
+ ${n.length===0?`<p class="wf-input-hint">${this.escape(this.l(`WorkflowEventWaitNeedsTargetField`,`Add a form field with a key before mapping the payload.`))}</p>`:``}
2640
+ </div>
2641
+ `}bindEventPayloadMappings(e,t){let n=e.querySelector(`.wf-event-mapping-source`),r=e.querySelector(`.wf-event-mapping-target`);e.querySelector(`.wf-event-mapping-add`)?.addEventListener(`click`,()=>{let e=n?.value?.trim(),i=r?.value;e&&i&&this.updateEventWait(t.id,t=>({...t,payloadMappings:[...t.payloadMappings??[],{sourcePath:e,targetFieldKey:i}]}))}),e.querySelectorAll(`.wf-event-mapping-remove`).forEach(e=>{e.addEventListener(`click`,()=>{let n=Number(e.dataset.index);this.updateEventWait(t.id,e=>({...e,payloadMappings:(e.payloadMappings??[]).filter((e,t)=>t!==n)}))})})}updateNodeInput(e,t,n){this.readOnly||this.updateNode(e,e=>ox(e,t,n))}renderDescriptorInput(e,t){let n=this.resolveInputOptions(e,t);return this.editorFor(n).render(this.inputEditorContext(e,n))}inputEditorContext(e,t){return{descriptor:t,value:this.readInputWithDefault(e,t),disabled:this.readOnly||this.isCapabilityBlocked(t),elementId:`wf-node-input-`+t.name.replace(/[^A-Za-z0-9]/g,`-`),localize:(e,t)=>this.l(e,t),escape:e=>this.escape(e),lookup:(n,r)=>this.resolveOptionsAsync(n,r,e,t),variables:TC(this._document.variables??[]),outputs:this.stepOutputOptions(),secrets:this._secrets,nameOf:(e,t)=>this.lookupName(e,t)}}stepOutputOptions(){let e=[];for(let t of this._document.nodes){let n=this.descriptorForNode(t);for(let r of n?.outputs??[])e.push({nodeId:t.id,nodeName:t.name?.defaultValue??t.id,outputName:r.name})}return e}resolveOptionsAsync(e,t,n,r){let i={activityTypeName:this.descriptorForNode(n).typeName,inputName:r.name,nodeId:n.id,siblingValues:this.siblingValuesOf(n,r)},a=[`options`,e,t,mb(i)].join(`|`);return this.shareInflight(a,()=>this.requestOptions(e,t,i))}shareInflight(e,t){let n=this._inflightLookups.get(e);if(n)return n;let r;try{r=t()}catch(e){r=Promise.reject(e)}let i=Promise.resolve(r).finally(()=>{this._inflightLookups.get(e)===i&&this._inflightLookups.delete(e)});return this._inflightLookups.set(e,i),i}async requestOptions(e,t,n){let r=t=>{let n=t.map(e=>({value:String(e.id),displayText:e.displayName}));return this.rememberLookupNames(e,n),n};if(this.lookups.optionsProvider)try{return r(await this.lookups.optionsProvider(e,t,n)??[])}catch{return[]}let i=this.legacyLookupFor(e);if(!i)return[];try{return r(await i(t)??[])}catch{return[]}}legacyLookupFor(e){switch(e){case`workflow.users`:return this.lookups.users;case`workflow.roles`:return this.lookups.roles;case`workflow.organizationUnits`:return this.lookups.organizationUnits;case`workflow.registeredActions`:return this.lookups.registeredActions;case`workflow.connectionProfiles`:return this.lookups.connectionProfiles;case`workflow.workflowDefinitions`:return this.lookups.workflowDefinitions;case`workflow.eventDefinitions`:return this.lookups.eventDefinitions;default:return}}readInputWithDefault(e,t){return rx(e,t.name)??t.defaultValue}isDescriptorCapabilityBlocked(e){return e.requiredCapability?this.capabilities[e.requiredCapability]===!1:!1}isCapabilityBlocked(e){return e.requiredCapability?this.capabilities[e.requiredCapability]===!1:!1}resolveInputOptions(e,t){let n=BC(t.optionsProviderName),r=n?void 0:this.serverProviderOptions(e,t),i=t.optionsProviderName===`workflow.formFields`?this.formFieldOptions():n?n(this._document,e.id):r??t.allowedValues??[];return{...t,displayName:t.displayName??this.l(t.displayNameKey??``,t.name),allowedValues:i.map(e=>({...e,displayText:n||r||t.optionsProviderName===`workflow.formFields`?e.displayText:this.l(e.displayText,e.displayText)}))}}siblingValuesOf(e,t){let n={};for(let r of this.descriptorForNode(e).inputs??[]){if(r.name===t.name)continue;let i=rx(e,r.name);i!=null&&typeof i!=`object`&&(n[r.name]=String(i))}return n}serverProviderOptions(e,t){let n=t.optionsProviderName;if(!n||n===`workflow.formFields`||(t.allowedValues??[]).length>0||!Ow.has(t.uiHint??``))return;let r=[e.id,t.name,JSON.stringify(this.siblingValuesOf(e,t))].join(`|`),i=this._serverOptions.get(r);!i&&!this._serverOptionsPending.has(r)&&(this._serverOptionsPending.add(r),this.resolveOptionsAsync(n,``,e,t).catch(()=>[]).then(t=>{this._serverOptions.set(r,t),this._serverOptionsPending.delete(r),this._selectedNodeId===e.id&&Sb(this.root,()=>this.renderInspector())}));let a=i??[],o=rx(e,t.name);return o==null||typeof o==`object`||String(o).length===0||a.some(e=>e.value===String(o))?a:[...a,{value:String(o),displayText:this.lookupName(n,String(o))??String(o)}]}formFieldOptions(){return this.conditionFields().map(e=>({value:e.id,displayText:Z(e.label,e.key??e.id)}))}bindDescriptorSettings(e,t){let n=this.descriptorForNode(t);if(!this.isDescriptorCapabilityBlocked(n))for(let r of mx(n.inputs,t)){let n=e.querySelector(`[data-input="${CSS.escape(r.name)}"]`);if(!n)continue;let i=this.resolveInputOptions(t,r),a=this.editorFor(i),o=e=>{this.updateNode(t.id,t=>ox(t,r.name,ax(r,e,rx(t,r.name)))),((r.refreshOnChange??[]).length>0||a.bind)&&this.renderInspector()};if(a.bind){a.bind(n,this.inputEditorContext(t,i),o);continue}let s=n.querySelector(`input, select, textarea`);s&&s.addEventListener(a.changeEvent??`change`,()=>o(a.read(s)))}}bindSettingsSection(e,t){this.readOnly||this.bindDescriptorSettings(e,t)}renderActionParameterSection(e){let t=e.action?.actionName;if(!t)return``;let n=this.actionParametersOf(t);if(n.length===0)return`
2642
+ <div class="wf-section">
2643
+ <h5>${this.escape(this.l(`WorkflowActionInputs`,`Action inputs`))}</h5>
2644
+ <p class="wf-muted">${this.escape(this.l(`WorkflowActionHasNoInputs`,`This action does not take any input.`))}</p>
2645
+ </div>
2646
+ `;let r=this.groupActionParameters(n);return`
2647
+ <div class="wf-section wf-action-parameters">
2648
+ <h5>${this.escape(this.l(`WorkflowActionInputs`,`Action inputs`))}</h5>
2649
+ ${r.map(t=>`
2650
+ ${t.name?`<h6 class="wf-group">${this.escape(this.l(`WorkflowActionGroup_`+t.name,t.name))}</h6>`:``}
2651
+ ${t.parameters.map(t=>this.renderActionParameter(e,t)).join(``)}`).join(``)}
2652
+ </div>
2653
+ `}renderActionParameter(e,t){let n=t.name??``,r=this.findActionBinding(e,n),i=Lb(r),a=this.escape(t.displayName||n)+(t.isRequired?` <span class="wf-required">*</span>`:``);return`
2654
+ <div class="wf-action-parameter" data-parameter="${this.escape(n)}">
2655
+ <label class="wf-field">
2656
+ <span>${a}</span>
2657
+ ${FC({options:AC(this.syntaxDescriptorFor(t)),selected:PC(i),disabled:this.readOnly,className:`wf-parameter-source`,localize:(e,t)=>this.l(e,t),escape:e=>this.escape(e)})}
2658
+ </label>
2659
+ ${this.renderActionParameterEditor(t,r,i)}
2660
+ ${t.description?`<p class="wf-muted">${this.escape(t.description)}</p>`:``}
2661
+ ${this.describeParameterConstraints(t)?`<p class="wf-muted">${this.escape(this.describeParameterConstraints(t))}</p>`:``}
2662
+ </div>
2663
+ `}renderActionParameterEditor(e,t,n){let r=this.readOnly?`disabled`:``;if(n===`formField`){let e=this.conditionFields();return`
2664
+ <label class="wf-field">
2665
+ <select class="wf-parameter-form-field" ${r}>
2666
+ <option value="">${this.escape(this.l(`WorkflowDesignerNotSelected`,`Not selected`))}</option>
2667
+ ${e.map(e=>`<option value="${this.escape(e.id)}" ${t?.formFieldId===e.id?`selected`:``}>${this.escape(Z(e.label,e.key??e.id))}</option>`).join(``)}
2668
+ </select>
2669
+ </label>
2670
+ `}if(n===`context`)return`
2671
+ <label class="wf-field">
2672
+ <input type="text" class="wf-parameter-context" placeholder="ReferenceNumber"
2673
+ value="${this.escape(t?.contextKey??``)}" ${r} />
2674
+ </label>
2675
+ `;let i=t?.constantValue??e.defaultValue??``;return e.allowedValues&&e.allowedValues.length>0?`
2676
+ <label class="wf-field">
2677
+ <select class="wf-parameter-constant" ${r}>
2678
+ <option value="">${this.escape(this.l(`WorkflowDesignerNotSelected`,`Not selected`))}</option>
2679
+ ${e.allowedValues.map(e=>`<option value="${this.escape(e.value??``)}" ${i===e.value?`selected`:``}>${this.escape(e.displayName||e.value||``)}</option>`).join(``)}
2680
+ </select>
2681
+ </label>
2682
+ `:e.optionsProviderName?`
2683
+ <label class="wf-field">
2684
+ <select class="wf-parameter-provided" data-selected="${this.escape(i)}" ${r}></select>
2685
+ </label>
2686
+ `:`
2687
+ <label class="wf-field">
2688
+ ${this.renderTypedInput(e,i,r)}
2689
+ </label>
2690
+ `}renderTypedInput(e,t,n){let r=this.escape(t);switch(e.type){case Ib.Number:return`<input type="number" class="wf-parameter-constant" value="${r}"
2691
+ ${e.minValue==null?``:`min="${e.minValue}"`}
2692
+ ${e.maxValue==null?``:`max="${e.maxValue}"`} ${n} />`;case Ib.Boolean:return`<select class="wf-parameter-constant" ${n}>
2693
+ <option value="">${this.escape(this.l(`WorkflowDesignerNotSelected`,`Not selected`))}</option>
2694
+ <option value="true" ${t===`true`?`selected`:``}>${this.escape(this.l(`Yes`,`Yes`))}</option>
2695
+ <option value="false" ${t===`false`?`selected`:``}>${this.escape(this.l(`No`,`No`))}</option>
2696
+ </select>`;case Ib.Date:return`<input type="date" class="wf-parameter-constant" value="${r}" ${n} />`;case Ib.DateTime:return`<input type="datetime-local" class="wf-parameter-constant"
2697
+ value="${this.escape(t.slice(0,16))}" ${n} />`;case Ib.Json:return`<textarea rows="4" class="wf-parameter-constant" ${n}>${r}</textarea>`;case Ib.Secret:return`<input type="password" class="wf-parameter-constant" autocomplete="new-password"
2698
+ value="${r}" ${n} />`;default:return`<input type="text" class="wf-parameter-constant" value="${r}"
2699
+ ${e.maxLength==null?``:`maxlength="${e.maxLength}"`} ${n} />`}}bindActionParameterSection(e,t){let n=t.action?.actionName;n&&e.querySelectorAll(`.wf-action-parameter`).forEach(e=>{let r=e.dataset.parameter??``;e.querySelector(`.wf-parameter-source`)?.addEventListener(`change`,e=>{let n=e.target.value,i=NC(n);this.updateActionBinding(t.id,r,()=>({inputName:r,constantValue:i===`constant`?``:void 0,formFieldId:i===`formField`?``:void 0,contextKey:i===`context`?``:void 0})),this.renderInspector()}),e.querySelector(`.wf-parameter-form-field`)?.addEventListener(`change`,e=>this.updateActionBinding(t.id,r,()=>({inputName:r,formFieldId:e.target.value||void 0})));let i=e.querySelector(`.wf-parameter-context`);i?.addEventListener(`change`,()=>this.updateActionBinding(t.id,r,()=>({inputName:r,contextKey:i.value||void 0})));let a=e.querySelector(`.wf-parameter-constant`);a?.addEventListener(`change`,()=>this.updateActionBinding(t.id,r,()=>({inputName:r,constantValue:a.value||void 0})));let o=e.querySelector(`.wf-parameter-provided`);o&&(this.fillActionParameterOptions(o,n,r),o.addEventListener(`change`,()=>this.updateActionBinding(t.id,r,()=>({inputName:r,constantValue:o.value||void 0}))))})}async fillActionParameterOptions(e,t,n){let r=e.dataset.selected??``,i=`<option value="">${this.escape(this.l(`WorkflowDesignerNotSelected`,`Not selected`))}</option>`;if(!this.lookups.actionParameterOptions){e.innerHTML=i;return}let a=this.lookups.actionParameterOptions;try{e.innerHTML=i+(await this.shareInflight([`actionParameter`,t,n].join(`|`),()=>a(t,n,``))??[]).map(e=>`<option value="${this.escape(e.id)}" ${e.id===r?`selected`:``}>${this.escape(e.displayName)}</option>`).join(``)}catch{e.innerHTML=i}}updateActionBinding(e,t,n){this.updateAction(e,e=>{let r=(e.inputBindings??[]).filter(e=>e?.inputName!==t);return{...e,inputBindings:[...r,n()]}})}findActionBinding(e,t){return(e.action?.inputBindings??[]).find(e=>e?.inputName===t)}actionParametersOf(e){return[...(this.capabilities.actions??[]).find(t=>t.name?.toLowerCase()===e.toLowerCase())?.inputParameters??[]].sort((e,t)=>(e.displayOrder??0)-(t.displayOrder??0))}groupActionParameters(e){let t=[];for(let n of e){let e=n.group||void 0,r=t.find(t=>t.name===e);r?r.parameters.push(n):t.push({name:e,parameters:[n]})}return t}syntaxDescriptorFor(e){let t=[nx.literal];return e.allowFormFieldBinding!==!1&&t.push(nx.formField),e.allowInstanceBinding!==!1&&t.push(nx.context),{name:e.name??``,supportedSyntaxes:t}}describeParameterConstraints(e){let t=[];return e.minValue!=null&&t.push(`≥ `+e.minValue),e.maxValue!=null&&t.push(`≤ `+e.maxValue),e.maxLength!=null&&t.push(this.l(`WorkflowActionMaxLength`,`Max length`)+`: `+e.maxLength),e.regexPattern&&t.push(e.regexPattern),t.join(` · `)}updateEventWait(e,t){this.updateNode(e,e=>({...e,eventWait:t(e.eventWait??{})}))}updateAction(e,t){this.updateNode(e,e=>({...e,action:t(e.action??{})}))}renderConditionSection(e){let t=[...e.condition?.branches??[]].sort((e,t)=>e.order-t.order),n=this.readOnly?`disabled`:``,r=t.map((r,i)=>{let a=this._document.edges.find(t=>t.sourceNodeId===e.id&&t.branchId===r.id),o=a?Z(this._document.nodes.find(e=>e.id===a.targetNodeId)?.name,a.targetNodeId):this.l(`WorkflowBranchNotConnected`,`Not connected`),s=this.escape(r.id??``);return`
2700
+ <li class="${r.id===this._selectedBranchId?`wf-branch-active`:``}">
2701
+ <button type="button" class="wf-branch-select" data-branch-id="${s}">
2702
+ <span>${this.escape(Z(r.name,r.id??``))}</span>
2703
+ <small>&rarr; ${this.escape(o)}</small>
2704
+ </button>
2705
+ <span class="wf-branch-actions">
2706
+ <button type="button" class="wf-branch-move" data-branch-id="${s}" data-offset="-1"
2707
+ ${i===0?`disabled`:n}
2708
+ title="${this.escape(this.l(`WorkflowFormMoveUp`,`Move up`))}"
2709
+ aria-label="${this.escape(this.l(`WorkflowFormMoveUp`,`Move up`))}">${$(`arrowUp`,15)}</button>
2710
+ <button type="button" class="wf-branch-move" data-branch-id="${s}" data-offset="1"
2711
+ ${i===t.length-1?`disabled`:n}
2712
+ title="${this.escape(this.l(`WorkflowFormMoveDown`,`Move down`))}"
2713
+ aria-label="${this.escape(this.l(`WorkflowFormMoveDown`,`Move down`))}">${$(`arrowDown`,15)}</button>
2714
+ <button type="button" class="wf-branch-remove" data-branch-id="${s}" ${n}
2715
+ title="${this.escape(this.l(`WorkflowBranchRemove`,`Remove branch`))}"
2716
+ aria-label="${this.escape(this.l(`WorkflowBranchRemove`,`Remove branch`))}">${$(`close`,15)}</button>
2717
+ </span>
2718
+ </li>`}).join(``),i=t.find(e=>e.id===this._selectedBranchId);return`
2719
+ <div class="wf-section">
2720
+ <h5>${this.escape(this.l(`WorkflowBranches`,`Branches`))}</h5>
2721
+ ${t.length>0?`<ul class="wf-branch-list">${r}</ul>`:`<p class="wf-muted">${this.escape(this.l(`WorkflowBranchesEmpty`,`No branch defined yet.`))}</p>`}
2722
+ <button type="button" class="wf-secondary wf-branch-add" ${n}>
2723
+ ${$(`plus`,15)}
2724
+ ${this.escape(this.l(`WorkflowBranchAdd`,`Add branch`))}
2725
+ </button>
2726
+ ${i?this.renderBranchEditor(i):``}
2727
+ </div>
2728
+ `}renderConditionAssistant(){if(this.readOnly||!this.lookups.suggestCondition)return``;let e=this._conditionSuggestionError?`<p class="wf-assistant-warning" role="status">${$(`info`,14)}<span>${this.escape(this._conditionSuggestionError)}</span></p>`:``;return`
2729
+ <div class="wf-subsection">
2730
+ <label class="wf-field">
2731
+ <span>${this.escape(this.l(`WorkflowConditionSuggest`,`Describe the rule`))}</span>
2732
+ <input type="text" class="wf-condition-suggest-text"
2733
+ value="${this.escape(this._conditionSuggestionText)}"
2734
+ placeholder="${this.escape(this.l(`WorkflowConditionSuggestHint`,`Write the rule in your own words.`))}" />
2735
+ </label>
2736
+ <button type="button" class="wf-secondary wf-condition-suggest"
2737
+ ${this._conditionSuggestionBusy?`disabled`:``}>
2738
+ ${$(`sparkles`,15)}
2739
+ ${this.escape(this.l(`WorkflowConditionSuggestApply`,`Suggest a condition`))}
2740
+ </button>
2741
+ ${e}
2742
+ </div>
2743
+ `}renderBranchEditor(e){let t=this.readOnly?`disabled`:``,n=this.conditionFields(),r=`
2744
+ <label class="wf-field">
2745
+ <span>${this.escape(this.l(`WorkflowBranchName`,`Branch name`))}</span>
2746
+ <input type="text" class="wf-branch-name" value="${this.escape(Z(e.name,e.id??``))}" ${t} />
2747
+ </label>
2748
+ `;if(e.expression&&e.expression.kind!==Ab.Comparison)return`
2749
+ <div class="wf-subsection">
2750
+ ${r}
2751
+ <p class="wf-muted">${this.escape(this.l(`WorkflowBranchAdvancedExpression`,`This branch uses an advanced expression that this editor cannot display.`))}</p>
2752
+ </div>
2753
+ `;let i=n[0];if(!i)return`
2754
+ <div class="wf-subsection">
2755
+ ${r}
2756
+ <p class="wf-muted">${this.escape(this.l(`WorkflowBranchNeedsFormFields`,`Add a form field before defining a condition.`))}</p>
2757
+ </div>
2758
+ `;let a=_C(n,this._document.variables??[],e=>Z(e.label,e.key??e.id)),o=yC(e.expression?.left)??_C(n,[],e=>Z(e.label,e.key??e.id))[0]?.key,s=e.expression?.left?.fieldId??i.id,c=Xb((n.find(e=>e.id===s)??i).type),l=tx(c),u=e.expression?.operator??l[0],d=Zb(u),f=Qb(u),p=f?(e.expression?.right?.values??[]).join(`, `):e.expression?.right?.value??``;return`
2759
+ <div class="wf-subsection">
2760
+ ${r}
2761
+ ${this.renderConditionAssistant()}
2762
+ <label class="wf-field">
2763
+ <span>${this.escape(this.l(`WorkflowBranchField`,`Field`))}</span>
2764
+ <select class="wf-branch-field" ${t}>
2765
+ ${e.expression?.left?``:`<option value="" selected>${this.escape(this.l(`WorkflowBranchChooseField`,`Choose a field`))}</option>`}
2766
+ ${a.map(t=>`<option value="${this.escape(t.key)}" ${e.expression?.left&&t.key===o?`selected`:``}>${this.escape(t.label)}</option>`).join(``)}
2767
+ </select>
2768
+ </label>
2769
+ <label class="wf-field">
2770
+ <span>${this.escape(this.l(`WorkflowBranchOperator`,`Operator`))}</span>
2771
+ <select class="wf-branch-operator" ${t}>
2772
+ ${l.map(e=>`<option value="${e}" ${e===u?`selected`:``}>${this.escape(this.l(`WorkflowConditionOperator_`+Nb[e],Nb[e]))}</option>`).join(``)}
2773
+ </select>
2774
+ </label>
2775
+ <label class="wf-field" ${d?`hidden`:``}>
2776
+ <span>${this.escape(f?this.l(`WorkflowBranchValueList`,`Values (comma separated)`):this.l(`WorkflowBranchValue`,`Value`))}</span>
2777
+ ${c===Pb.Boolean&&!f?`<select class="wf-branch-value" ${t}>
2778
+ <option value="true" ${p===`true`?`selected`:``}>${this.escape(this.l(`Yes`,`Yes`))}</option>
2779
+ <option value="false" ${p===`false`?`selected`:``}>${this.escape(this.l(`No`,`No`))}</option>
2780
+ </select>`:`<input type="text" class="wf-branch-value" value="${this.escape(p)}" ${t} />`}
2781
+ </label>
2782
+ </div>
2783
+ `}renderSlaSection(e){let t=e.sla??{},n=this.readOnly?`disabled`:``;return`
2784
+ <div class="wf-sla">
2785
+ <label class="wf-field">
2786
+ <span>${this.escape(this.l(`WorkflowSlaDueInMinutes`,`Due in (minutes)`))}</span>
2787
+ <input type="number" min="0" class="wf-sla-due" value="${t.dueInMinutes??``}" ${n} />
2788
+ </label>
2789
+ <label class="wf-check">
2790
+ <input type="checkbox" class="wf-sla-calendar" ${t.useBusinessCalendar?`checked`:``} ${n} />
2791
+ <span>${this.escape(this.l(`WorkflowSlaUseBusinessCalendar`,`Use the business calendar`))}</span>
2792
+ </label>
2793
+ <label class="wf-field">
2794
+ <span>${this.escape(this.l(`WorkflowSlaReminderInterval`,`Reminder every (minutes)`))}</span>
2795
+ <input type="number" min="0" class="wf-sla-reminder" value="${t.reminderIntervalInMinutes??``}" ${n} />
2796
+ </label>
2797
+ <label class="wf-check">
2798
+ <input type="checkbox" class="wf-sla-escalate" ${t.escalateOnOverdue?`checked`:``} ${n} />
2799
+ <span>${this.escape(this.l(`WorkflowSlaEscalateOnOverdue`,`Escalate when overdue`))}</span>
2800
+ </label>
2801
+ ${t.escalateOnOverdue?this.renderSlaEscalation(e):``}
2802
+ </div>
2803
+ `}renderSlaEscalation(e){let t=e.sla??{},n=this.readOnly?`disabled`:``;return`
2804
+ <div class="wf-sla-escalation">
2805
+ <label class="wf-field">
2806
+ <span>${this.escape(this.l(`WorkflowSlaEscalateAfter`,`Escalate after (minutes)`))}</span>
2807
+ <input type="number" min="0" class="wf-sla-escalate-after" value="${t.escalateAfterMinutes??``}" ${n} />
2808
+ </label>
2809
+ ${cS.render(this.escalationTargetContext(e))}
2810
+ </div>
2811
+ `}escalationTargetContext(e){let t=e.sla?.escalationTarget,n={name:Dw,displayName:this.l(`WorkflowSlaEscalationTarget`,`Escalate to`)};return{descriptor:n,value:t?[t]:[],disabled:this.readOnly,elementId:`wf-sla-escalation-target`,localize:(e,t)=>this.l(e,t),escape:e=>this.escape(e),lookup:(t,r)=>this.resolveOptionsAsync(t,r,e,n),nameOf:(e,t)=>this.lookupName(e,t)}}bindConditionSection(e,t){if(t.type!==J.Condition||(e.querySelectorAll(`.wf-branch-select`).forEach(e=>{e.addEventListener(`click`,()=>{this._selectedBranchId=e.dataset.branchId,this.renderInspector()})}),this.readOnly))return;e.querySelector(`.wf-branch-add`)?.addEventListener(`click`,()=>this.addBranch(t.id));let n=e.querySelector(`.wf-condition-suggest-text`);n?.addEventListener(`input`,()=>{this._conditionSuggestionText=n.value});let r=e.querySelector(`.wf-condition-suggest`);r?.addEventListener(`click`,()=>{this._conditionSuggestionBusy||(r.disabled=!0,this.suggestConditionForSelectedBranch(n?.value??``))}),e.querySelectorAll(`.wf-branch-remove`).forEach(e=>{e.addEventListener(`click`,()=>this.removeBranch(t.id,e.dataset.branchId??``))}),e.querySelectorAll(`.wf-branch-move`).forEach(e=>{e.addEventListener(`click`,()=>this.moveBranch(t.id,e.dataset.branchId??``,Number(e.dataset.offset)))});let i=this._selectedBranchId;if(!i)return;let a=e.querySelector(`.wf-branch-name`);a?.addEventListener(`change`,()=>{this.updateBranch(t.id,i,e=>({...e,name:Yb(a.value)}))});let o=e.querySelector(`.wf-branch-field`),s=e.querySelector(`.wf-branch-operator`),c=e.querySelector(`.wf-branch-value`);if(!o||!s)return;let l=()=>{let e=this.conditionFields(),n=vC(_C(e,this._document.variables??[],e=>Z(e.label,e.key??e.id)),o.value);if(!n)return;let r=e.find(e=>e.id===n.id),a=n.kind===`field`&&r?Xb(r.type):Pb.String,l=Number(s.value),u={kind:Ab.Comparison,left:bC(n,a),operator:l};if(!Zb(l)){let e=c?.value??``;u.right=Qb(l)?{type:Mb.Constant,valueType:a,values:e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}:{type:Mb.Constant,valueType:a,value:e}}this.updateBranch(t.id,i,e=>({...e,expression:u}))};o.addEventListener(`change`,l),s.addEventListener(`change`,l),c?.addEventListener(`change`,l)}bindSlaSection(e,t){if(this.readOnly)return;let n=t=>{let n=e.querySelector(t)?.value?.trim();if(!n)return;let r=Number(n);return Number.isFinite(r)&&r>=0?r:void 0},r=t=>e.querySelector(t)?.checked===!0,i=()=>{this.updateNode(t.id,t=>({...t,sla:{...t.sla??{},dueInMinutes:n(`.wf-sla-due`),useBusinessCalendar:r(`.wf-sla-calendar`),reminderIntervalInMinutes:n(`.wf-sla-reminder`),escalateOnOverdue:r(`.wf-sla-escalate`),escalateAfterMinutes:e.querySelector(`.wf-sla-escalate-after`)?n(`.wf-sla-escalate-after`):t.sla?.escalateAfterMinutes}}))};[`.wf-sla-due`,`.wf-sla-reminder`,`.wf-sla-escalate-after`].forEach(t=>{e.querySelector(t)?.addEventListener(`change`,i)}),[`.wf-sla-calendar`,`.wf-sla-escalate`].forEach(t=>{e.querySelector(t)?.addEventListener(`change`,i)});let a=e.querySelector(`[data-input="${Dw}"]`);a&&cS.bind&&cS.bind(a,this.escalationTargetContext(t),e=>{let n=Array.isArray(e)?e:[],r=n.length>0?n[n.length-1]:void 0;this.updateNode(t.id,e=>({...e,sla:{...e.sla??{},escalationTarget:r}})),this.renderInspector()})}conditionFields(){return[...this._form?.fields??[]].sort((e,t)=>e.order-t.order)}describeTarget(e){switch(e.type){case Db.RequesterManager:return this.l(`WorkflowTarget_RequesterManager`,`Requester's manager`);case Db.User:return this.namedTarget(`WorkflowTarget_User`,`User`,`workflow.users`,e.userId);case Db.Role:return this.namedTarget(`WorkflowTarget_Role`,`Role`,`workflow.roles`,e.roleId);case Db.FallbackRole:return this.namedTarget(`WorkflowTarget_FallbackRole`,`Fallback role`,`workflow.roles`,e.roleId);case Db.OrganizationUnit:return this.namedTarget(`WorkflowTarget_OrganizationUnit`,`Organization unit`,`workflow.organizationUnits`,e.organizationUnitId);default:return String(e.type)}}namedTarget(e,t,n,r){let i=this.l(e,t);if(r==null)return i;let a=this.lookupName(n,String(r));return a?`${i}: ${a}`:`${i} #${r}`}lookupName(e,t){let n=this._lookupNames.get(`${e}:${t}`);return n===void 0&&this.loadLookupNames(e),n}rememberLookupNames(e,t){for(let n of t)this._lookupNames.set(`${e}:${n.value}`,n.displayText)}loadLookupNames(e){let t=this.legacyLookupFor(e);if(!(this.lookups.optionsProvider||t)||this._requestedNameLookups.has(e))return;this._requestedNameLookups.add(e);let n=this.lookups.optionsProvider;this.shareInflight([`names`,e].join(`|`),()=>n?n(e,``,{}):t(``)).then(t=>{let n=(t??[]).map(e=>({value:String(e.id),displayText:e.displayName}));this.rememberLookupNames(e,n),n.length>0&&this.renderAfterLookup()}).catch(()=>void 0)}renderAfterLookup(){this.isConnected&&Sb(this.root,()=>this.render())}updateBranch(e,t,n){this.updateNode(e,e=>({...e,condition:{...e.condition??{},branches:(e.condition?.branches??[]).map(e=>e.id===t?n(e):e)}}))}updateNode(e,t){this.commit({...this._document,nodes:this._document.nodes.map(n=>n.id===e?t(n):n)},{resync:!1,inspectorOnly:!0})}commit(e,t={}){t.recordHistory!==!1&&(this._past.push(this._document),this._past.length>ow&&this._past.shift(),this._future=[]),this._document=e,t.resync!==!1&&this.syncGraphFromDocument(),this.emitChange(t.viewOnly!==!0),t.inspectorOnly&&(this.renderToolbar(),this.renderInspector())}hasIssue(e){return this.validationIssues.some(t=>t.nodeId===e)}nextNodeId(e,t){let n=J[e].toLowerCase(),r=t??this._document.nodes,i=1;for(;r.some(e=>e.id===`${n}-${i}`);)i++;return`${n}-${i}`}nextEdgeId(e){let t=e??this._document.edges,n=1;for(;t.some(e=>e.id===`edge-${n}`);)n++;return`edge-${n}`}nextBranchId(e){let t=1;for(;e.some(e=>e.id===`branch-${t}`);)t++;return`branch-${t}`}normalizeDocument(e){return e?{...e,schemaVersion:e.schemaVersion??1,nodes:Array.isArray(e.nodes)?e.nodes:[],edges:Array.isArray(e.edges)?e.edges:[],metadata:e.metadata??{}}:qb()}fingerprintOf(e){return mb(e)}emitChange(e=!0){this._fingerprint=this.fingerprintOf(this._document),this.emit(ab.documentChange,{document:this._document,isDirty:e})}emitSelection(){this.emit(ab.selectionChange,{nodeId:this._selectedNodeId})}escape(e){return e.replace(/[&<>"']/g,e=>{switch(e){case`&`:return`&amp;`;case`<`:return`&lt;`;case`>`:return`&gt;`;case`"`:return`&quot;`;default:return`&#39;`}})}renderSummary(){let e=this.root.querySelector(`.wf-inspector .wf-summary`);if(!e)return;let t=this.buildSummarySentences(),n=this.escape(this._summaryCollapsed?this.l(`WorkflowDesignerSummaryShow`,`Show summary`):this.l(`WorkflowDesignerSummaryHide`,`Hide summary`));e.classList.toggle(`wf-summary-collapsed`,this._summaryCollapsed);let r=t.length===0?`<p class="wf-muted">${this.escape(this.l(`WorkflowDesignerSummaryEmpty`,`Add a start step to describe the flow.`))}</p>`:`<ol class="wf-summary-list">
2812
+ ${t.map(e=>`<li>${this.escape(e)}</li>`).join(``)}
2813
+ </ol>
2814
+ ${this.renderAssistantSummary()}`;e.innerHTML=`
2815
+ <div class="wf-summary-head">
2816
+ <h5>${this.escape(this.l(`WorkflowDesignerSummary`,`What this workflow does`))}</h5>
2817
+ <button type="button" class="wf-icon-btn wf-summary-toggle" aria-expanded="${!this._summaryCollapsed}"
2818
+ title="${n}" aria-label="${n}">${$(`arrowDown`,15)}</button>
2819
+ </div>
2820
+ <div class="wf-summary-body" ${this._summaryCollapsed?`hidden`:``}>${r}</div>
2821
+ `,e.querySelector(`.wf-summary-toggle`)?.addEventListener(`click`,()=>{this._summaryCollapsed=!this._summaryCollapsed,this.renderSummary()});let i=e.querySelector(`.wf-summary-explain`);i?.addEventListener(`click`,()=>{this._assistantSummaryBusy||(i.disabled=!0,this.summarizeWithAssistant())})}renderAssistantSummary(){return this.lookups.summarizeWorkflow?`
2822
+ ${this._assistantSummary?`<p class="wf-summary-assistant">${this.escape(this._assistantSummary)}</p>`:``}
2823
+ ${this._assistantSummaryError?`<p class="wf-assistant-warning" role="status">${$(`info`,14)}<span>${this.escape(this._assistantSummaryError)}</span></p>`:``}
2824
+ <button type="button" class="wf-secondary wf-summary-explain"
2825
+ ${this._assistantSummaryBusy?`disabled`:``}>
2826
+ ${$(`sparkles`,15)}
2827
+ ${this.escape(this.l(`WorkflowSummaryExplainWithAi`,`Explain with the assistant`))}
2828
+ </button>
2829
+ `:``}get assistantSummary(){return this._assistantSummary}get assistantSummaryError(){return this._assistantSummaryError}async summarizeWithAssistant(){let e=this.lookups.summarizeWorkflow;if(e&&!this._assistantSummaryBusy){this._assistantSummaryBusy=!0,this._assistantSummaryError=void 0,this.renderSummary();try{let t=await e(this.assistantContext());if(!t?.succeeded||!t.summary){this._assistantSummaryError=t?.failureReason??this.l(`WorkflowAi_SummaryCouldNotBeProduced`,`The assistant could not summarize this workflow.`);return}this._assistantSummary=t.summary}catch{this._assistantSummaryError=this.l(`WorkflowAi_SummaryCouldNotBeProduced`,`The assistant could not summarize this workflow.`)}finally{this._assistantSummaryBusy=!1,this.renderSummary()}}}buildSummarySentences(){let e=this._document.nodes.find(e=>e.type===J.Start);if(!e)return[];let t=[],n=new Set,r=[e.id];for(;r.length>0&&t.length<pw;){let e=r.shift();if(n.has(e))continue;n.add(e);let i=this._document.nodes.find(t=>t.id===e);if(!i)continue;let a=this.describeNode(i);a&&t.push(a);for(let t of this._document.edges.filter(t=>t.sourceNodeId===e))r.push(t.targetNodeId)}return t}describeNode(e){let t=Z(e.name,e.id),n=this._document.edges.filter(t=>t.sourceNodeId===e.id),r=e=>Z(this._document.nodes.find(t=>t.id===e.targetNodeId)?.name,e.targetNodeId);switch(e.type){case J.Start:return this.l(`WorkflowDesignerSummaryStart`,`The request starts.`);case J.FormSubmission:return this.format(this.l(`WorkflowDesignerSummaryForm`,`The requester fills in "{0}" and submits it.`),t);case J.Approval:{let i=e.approval?.targets??[],a=i.length===0?this.l(`WorkflowTargetsEmpty`,`No assignee configured yet.`):i.map(e=>this.describeTarget(e)).join(`, `),o=n.find(e=>e.kind===Y.Approved),s=n.find(e=>e.kind===Y.Rejected),c=this.format(this.l(`WorkflowDesignerSummaryApproval`,`"{0}" waits for a decision from {1}.`),t,a);return o&&s&&(c+=` `+this.format(this.l(`WorkflowDesignerSummaryApprovalOutcomes`,`If approved it continues with "{0}", if rejected with "{1}".`),r(o),r(s))),e.sla?.dueInMinutes&&(c+=` `+this.format(this.l(`WorkflowDesignerSummaryDue`,`It is due within {0} minutes.`),String(e.sla.dueInMinutes))),c}case J.Condition:{let n=e.condition?.branches??[];return this.format(this.l(`WorkflowDesignerSummaryCondition`,`"{0}" splits the flow into {1} branches.`),t,String(n.length))}case J.Parallel:return this.format(this.l(`WorkflowDesignerSummaryParallel`,`"{0}" runs {1} branches at the same time.`),t,String(n.filter(e=>e.kind===Y.ParallelBranch).length));case J.Join:return this.format(this.l(`WorkflowDesignerSummaryJoin`,`"{0}" waits for the parallel branches.`),t);case J.Timer:{let n=e.timer?.durationInMinutes;return n?this.format(this.l(`WorkflowDesignerSummaryTimerDuration`,`"{0}" waits for {1} minutes.`),t,String(n)):this.format(this.l(`WorkflowDesignerSummaryTimer`,`"{0}" waits for a date.`),t)}case J.Notification:return this.format(this.l(`WorkflowDesignerSummaryNotification`,`"{0}" sends a notification.`),t);case J.Action:return this.format(this.l(`WorkflowDesignerSummaryAction`,`"{0}" calls an external action.`),t);case J.Subprocess:return this.format(this.l(`WorkflowDesignerSummarySubprocess`,`"{0}" starts another workflow.`),t);case J.Approved:return this.l(`WorkflowDesignerSummaryApproved`,`The request closes as approved.`);case J.Rejected:return this.l(`WorkflowDesignerSummaryRejected`,`The request closes as rejected.`);case J.Cancelled:return this.l(`WorkflowDesignerSummaryCancelled`,`The request closes as cancelled.`);default:return``}}format(e,...t){return e.replace(/\{(\d+)\}/g,(e,n)=>t[Number(n)]??e)}renderOutline(){let e=this.root.querySelector(`.wf-outline`);if(!e)return;let t=this.readOnly?`disabled`:``,n=this.outlineOrderedNodes();if(n.length===0){e.innerHTML=`
2830
+ <h4>${this.escape(this.l(`WorkflowDesignerOutline`,`Outline`))}</h4>
2831
+ <p class="wf-muted">${this.escape(this.l(`WorkflowDesignerOutlineEmpty`,`Add a step from the palette to start.`))}</p>
2832
+ `;return}let r=n.map(e=>{let t=this.paletteItemFor(e.type),n=this.outlineOutcomeRows(e);return`
2833
+ <li class="wf-outline-node ${e.id===this._selectedNodeId?`wf-outline-active`:``}">
2834
+ <button type="button" class="wf-outline-select" data-node-id="${this.escape(e.id)}">
2835
+ <span class="wf-outline-icon" style="--wf-item-color:${t.color}">${this.nodeIconMarkup(t,16)}</span>
2836
+ <span class="wf-outline-name">${this.escape(Z(e.name,e.id))}</span>
2837
+ <small>${this.escape(this.l(t.localizationKey,t.fallbackLabel))}</small>
2838
+ </button>
2839
+ ${n}
2840
+ </li>`}).join(``);e.innerHTML=`
2841
+ <h4>${this.escape(this.l(`WorkflowDesignerOutline`,`Outline`))}</h4>
2842
+ <p class="wf-muted">${this.escape(this.l(`WorkflowDesignerOutlineHint`,`Every step and connection can be reached and changed with the keyboard here.`))}</p>
2843
+ <ul class="wf-outline-list">${r}</ul>
2844
+ <button type="button" class="wf-secondary wf-outline-autolayout" ${t}>
2845
+ ${$(`layout`,15)}
2846
+ ${this.escape(this.l(`WorkflowDesignerAutoLayout`,`Auto layout`))}
2847
+ </button>
2848
+ `,e.querySelectorAll(`.wf-outline-select`).forEach(e=>{e.addEventListener(`click`,()=>this.select(e.dataset.nodeId))}),e.querySelectorAll(`.wf-outline-target`).forEach(e=>{e.addEventListener(`change`,()=>this.setOutlineTarget(e.dataset.nodeId,Number(e.dataset.kind),e.dataset.branchId,e.value))}),e.querySelector(`.wf-outline-autolayout`)?.addEventListener(`click`,()=>this.autoLayout())}outlineOrderedNodes(){let e=this._document.nodes.find(e=>e.type===J.Start),t=[],n=new Set,r=e?[e.id]:[];for(;r.length>0;){let e=r.shift();if(n.has(e))continue;n.add(e);let i=this._document.nodes.find(t=>t.id===e);if(i){t.push(i);for(let t of this._document.edges.filter(t=>t.sourceNodeId===e))r.push(t.targetNodeId)}}for(let e of this._document.nodes)n.has(e.id)||t.push(e);return t}outlineOutcomeRows(e){if(this.paletteItemFor(e.type).isTerminal)return``;let t=this.readOnly?`disabled`:``,n=this._document.nodes.filter(t=>t.id!==e.id&&t.type!==J.Start),r=this.outcomePortsOf(e).map(r=>{let i=this.parsePortId(r.id),a=i?.kind??Y.Default,o=i?.branchId,s=this._document.edges.find(t=>t.sourceNodeId===e.id&&t.kind===a&&(a!==Y.ConditionBranch||t.branchId===o)),c=n.map(e=>`<option value="${this.escape(e.id)}" ${s?.targetNodeId===e.id?`selected`:``}>${this.escape(Z(e.name,e.id))}</option>`).join(``);return`
2849
+ <li class="wf-outline-outcome">
2850
+ <span class="wf-dot" style="background:${r.color}"></span>
2851
+ <label class="wf-outline-outcome-label">
2852
+ <span>${this.escape(r.label)}</span>
2853
+ <select class="wf-outline-target" data-node-id="${this.escape(e.id)}"
2854
+ data-kind="${a}" ${o?`data-branch-id="${this.escape(o)}"`:``} ${t}>
2855
+ <option value="">${this.escape(this.l(`WorkflowBranchNotConnected`,`Not connected`))}</option>
2856
+ ${c}
2857
+ </select>
2858
+ </label>
2859
+ </li>`});return r.length>0?`<ul class="wf-outline-outcomes">${r.join(``)}</ul>`:``}setOutlineTarget(e,t,n,r){if(this.readOnly)return;let i=t===Y.ParallelBranch,a=r=>r.sourceNodeId===e&&r.kind===t&&(t!==Y.ConditionBranch||r.branchId===n),o=i?this._document.edges:this._document.edges.filter(e=>!a(e));if(!r){this.commit({...this._document,edges:o}),this.renderOutline();return}let s=[...o,{id:this.nextEdgeId(o),sourceNodeId:e,targetNodeId:r,kind:t,branchId:t===Y.ConditionBranch?n:void 0}];this.commit({...this._document,edges:s}),this.renderOutline()}togglePalette(){this._paletteCollapsed=!this._paletteCollapsed,this.applyPaletteVisibility(),this.renderToolbar()}applyPaletteVisibility(){let e=this.root.querySelector(`.wf-designer`);e?.classList.toggle(`wf-palette-collapsed`,this._paletteCollapsed&&!this.readOnly),e?.classList.toggle(`wf-readonly`,this.readOnly)}toggleOutline(){this._outlineVisible=!this._outlineVisible,this.applyOutlineVisibility(),this.renderToolbar(),this.renderOutline(),this._outlineVisible||this._graph?.resize()}applyOutlineVisibility(){let e=this.root.querySelector(`.wf-stage`),t=this.root.querySelector(`.wf-outline`);e&&(e.hidden=this._outlineVisible),t&&(t.hidden=!this._outlineVisible)}},Aw={ı:`i`,ß:`ss`,æ:`ae`,Æ:`AE`,œ:`oe`,Œ:`OE`,ø:`o`,Ø:`O`,đ:`d`,Đ:`D`,ł:`l`,Ł:`L`,þ:`th`,Þ:`Th`},jw=`field`;function Mw(e){return e.replace(/[ıßæÆœŒøØđĐłŁþÞ]/g,e=>Aw[e]??e).normalize(`NFD`).replace(/[̀-ͯ]/g,``).replace(/[^A-Za-z0-9]+/g,` `)}function Nw(e,t=[]){let n=Mw(e??``).split(` `).filter(e=>e.length>0).map((e,t)=>t===0?e.charAt(0).toLowerCase()+e.slice(1):Pw(e)).join(``);n.length===0?n=jw:/^[A-Za-z]/.test(n)||(n=jw+Pw(n));let r=new Set;for(let e of t)typeof e==`string`&&r.add(e.toLowerCase());if(!r.has(n.toLowerCase()))return n;let i=2;for(;r.has((n+i).toLowerCase());)i++;return n+i}function Pw(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Fw=new Set([X.FileAttachment,X.StaticText,X.Repeater]),Iw=new Set([X.StaticText,X.Calculated]),Lw={[X.ShortText]:`≡`,[X.LongText]:`≣`,[X.Number]:`#`,[X.Money]:`¤`,[X.Date]:`◷`,[X.Time]:`◴`,[X.DateTime]:`◶`,[X.Boolean]:`✓`,[X.SingleSelect]:`●`,[X.MultiSelect]:`◉`,[X.UserPicker]:`☺`,[X.RolePicker]:`⚇`,[X.OrganizationUnitPicker]:`☷`,[X.FileAttachment]:`🖇`,[X.StaticText]:`¶`,[X.Repeater]:`⊞`,[X.Calculated]:`ƒ`},Rw={[X.ShortText]:`shortText`,[X.LongText]:`longText`,[X.Number]:`number`,[X.Money]:`money`,[X.Date]:`date`,[X.Time]:`time`,[X.DateTime]:`dateTime`,[X.Boolean]:`boolean`,[X.SingleSelect]:`singleSelect`,[X.MultiSelect]:`multiSelect`,[X.UserPicker]:`user`,[X.RolePicker]:`role`,[X.OrganizationUnitPicker]:`organizationUnit`,[X.FileAttachment]:`attachment`,[X.StaticText]:`staticText`,[X.Repeater]:`repeater`,[X.Calculated]:`calculated`};function zw(e){return e===void 0?void 0:Rw[e]}function Bw(){return Object.entries(X).filter(([,e])=>typeof e==`number`).map(([e,t])=>({type:t,name:e})).sort((e,t)=>e.type-t.type)}function Vw(){return Bw().map(({type:e,name:t})=>{let n=Iw.has(e),r=e===X.Repeater,i={type:e,typeKey:`AspNetZero.Workflow.FormField.${t}`,displayName:void 0,description:void 0,category:Fw.has(e)?`Content`:`General`,icon:Lw[e]??`▫`,order:e,isBrowsable:!0,isContainer:r,isReadOnlyContent:n,requiredCapability:e===X.FileAttachment?`attachmentsEnabled`:void 0,inputs:[{name:`label`,typeName:`WorkflowLocalizableText`,displayName:void 0,category:`General`,order:1,uiHint:Q.singleLine,isRequired:!0},{name:`key`,typeName:`String`,category:`General`,order:2,uiHint:Q.singleLine,isRequired:!0,maxLength:128}]};return!n&&!r&&i.inputs.push({name:`validation.isRequired`,typeName:`Boolean`,category:`Validation`,order:10,uiHint:Q.checkbox}),i})}function Hw(e){let t=Bw().find(t=>t.type===e);return t?`WorkflowFieldType_${t.name}`:`WorkflowFieldType_Unknown`}function Uw(e){switch(e){case`label`:return`WorkflowFormFieldLabel`;case`key`:return`WorkflowFormFieldKey`;case`validation.isRequired`:return`WorkflowFormRequiredField`;default:return``}}var Ww=`
2860
+ .wf-form-builder {
2861
+ display: grid;
2862
+ grid-template-columns: 252px minmax(0, 1fr) 340px;
2863
+ height: 100%;
2864
+ min-height: 480px;
2865
+ overflow: hidden;
2866
+ background: var(--wf-surface);
2867
+ border: 1px solid var(--wf-border);
2868
+ border-radius: var(--wf-radius-lg);
2869
+ }
2870
+
2871
+ .wf-fb-palette,
2872
+ .wf-fb-canvas,
2873
+ .wf-fb-inspector {
2874
+ min-height: 0;
2875
+ overflow-y: auto;
2876
+ }
2877
+
2878
+ .wf-fb-palette {
2879
+ padding: 16px 14px;
2880
+ background: var(--wf-surface);
2881
+ border-inline-end: 1px solid var(--wf-border-light);
2882
+ }
2883
+
2884
+ .wf-fb-canvas {
2885
+ padding: 16px 20px;
2886
+ background: var(--bs-gray-100, #f9f9f9);
2887
+ }
2888
+
2889
+ .wf-fb-inspector {
2890
+ padding: 16px 18px 20px;
2891
+ background: var(--wf-surface);
2892
+ border-inline-start: 1px solid var(--wf-border-light);
2893
+ }
2894
+
2895
+ .wf-fb-palette .wf-add-section {
2896
+ margin-bottom: 14px;
2897
+ border: 1px dashed color-mix(in srgb, var(--wf-primary) 45%, transparent);
2898
+ }
2899
+
2900
+ .wf-fb-items {
2901
+ display: flex;
2902
+ flex-direction: column;
2903
+ gap: 4px;
2904
+ }
2905
+
2906
+ .wf-fb-palette-note {
2907
+ display: flex;
2908
+ align-items: flex-start;
2909
+ gap: 6px;
2910
+ margin: 14px 0 0;
2911
+ padding: 8px 10px;
2912
+ font-size: 12px;
2913
+ line-height: 1.45;
2914
+ color: var(--wf-muted);
2915
+ background: var(--bs-gray-100, #f9f9f9);
2916
+ border-radius: var(--wf-radius);
2917
+ }
2918
+
2919
+ .wf-fb-palette-note svg {
2920
+ flex: none;
2921
+ margin-top: 2px;
2922
+ }
2923
+
2924
+ .wf-fb-item {
2925
+ display: flex;
2926
+ align-items: center;
2927
+ gap: 10px;
2928
+ width: 100%;
2929
+ min-height: 40px;
2930
+ margin: 0;
2931
+ padding: 6px 8px;
2932
+ font: inherit;
2933
+ font-size: 13px;
2934
+ font-weight: 500;
2935
+ text-align: start;
2936
+ color: var(--wf-text);
2937
+ background: transparent;
2938
+ border: 1px solid transparent;
2939
+ border-radius: var(--wf-radius);
2940
+ cursor: pointer;
2941
+ transition: background-color 0.15s ease, border-color 0.15s ease;
2942
+ }
2943
+
2944
+ .wf-fb-item:hover:not([disabled]) {
2945
+ background: var(--wf-primary-light);
2946
+ }
2947
+
2948
+ .wf-fb-item:focus-visible {
2949
+ outline: none;
2950
+ box-shadow: 0 0 0 2px var(--wf-primary);
2951
+ }
2952
+
2953
+ .wf-fb-item[disabled] {
2954
+ opacity: 0.5;
2955
+ cursor: not-allowed;
2956
+ }
2957
+
2958
+ .wf-fb-item-icon,
2959
+ .wf-fb-row-icon {
2960
+ display: inline-flex;
2961
+ flex: 0 0 30px;
2962
+ align-items: center;
2963
+ justify-content: center;
2964
+ width: 30px;
2965
+ height: 30px;
2966
+ color: var(--wf-primary);
2967
+ background: var(--wf-primary-light);
2968
+ border-radius: var(--wf-radius);
2969
+ }
2970
+
2971
+ .wf-fb-item-label {
2972
+ flex: 1 1 auto;
2973
+ min-width: 0;
2974
+ overflow: hidden;
2975
+ white-space: nowrap;
2976
+ text-overflow: ellipsis;
2977
+ }
2978
+
2979
+ .wf-fb-item-add {
2980
+ display: inline-flex;
2981
+ color: var(--wf-primary);
2982
+ opacity: 0;
2983
+ transition: opacity 0.15s ease;
2984
+ }
2985
+
2986
+ .wf-fb-item:hover:not([disabled]) .wf-fb-item-add,
2987
+ .wf-fb-item:focus-visible .wf-fb-item-add {
2988
+ opacity: 1;
2989
+ }
2990
+
2991
+ .wf-fb-list {
2992
+ display: flex;
2993
+ flex-direction: column;
2994
+ gap: 8px;
2995
+ max-width: 760px;
2996
+ margin: 0 auto;
2997
+ padding: 0;
2998
+ list-style: none;
2999
+ }
3000
+
3001
+ .wf-fb-section {
3002
+ max-width: 760px;
3003
+ margin: 0 auto 16px;
3004
+ padding: 10px 12px;
3005
+ border: 1px dashed var(--wf-border);
3006
+ border-radius: 10px;
3007
+ }
3008
+
3009
+ .wf-fb-section-head {
3010
+ display: flex;
3011
+ align-items: center;
3012
+ gap: 8px;
3013
+ margin-bottom: 8px;
3014
+ }
3015
+
3016
+ .wf-fb-section-title {
3017
+ flex: 1 1 auto;
3018
+ min-width: 0;
3019
+ padding: 6px 10px;
3020
+ font-weight: 600;
3021
+ color: var(--wf-text);
3022
+ background: var(--wf-subtle);
3023
+ border: 1px solid var(--wf-border-light);
3024
+ border-radius: 6px;
3025
+ }
3026
+
3027
+ .wf-fb-section-head button {
3028
+ display: inline-flex;
3029
+ align-items: center;
3030
+ justify-content: center;
3031
+ padding: 6px;
3032
+ color: var(--wf-text-secondary);
3033
+ background: transparent;
3034
+ border: 0;
3035
+ border-radius: 6px;
3036
+ cursor: pointer;
3037
+ }
3038
+
3039
+ .wf-fb-section-head button:hover:not([disabled]) {
3040
+ color: var(--wf-danger);
3041
+ background: var(--wf-danger-light);
3042
+ }
3043
+
3044
+ /* Same treatment as the field row actions, so a read-only form does not show a trash icon that looks
3045
+ usable and then does nothing. */
3046
+ .wf-fb-section-head button[disabled] {
3047
+ opacity: 0.4;
3048
+ cursor: not-allowed;
3049
+ }
3050
+
3051
+ .wf-fb-section-title[disabled] {
3052
+ cursor: default;
3053
+ }
3054
+
3055
+ .wf-fb-row.has-warning {
3056
+ flex-wrap: wrap;
3057
+ }
3058
+
3059
+ .wf-fb-row-warning {
3060
+ display: flex;
3061
+ flex: 1 0 100%;
3062
+ align-items: flex-start;
3063
+ gap: 6px;
3064
+ margin: 4px 0 0;
3065
+ padding: 6px 10px;
3066
+ font-size: 12px;
3067
+ line-height: 1.4;
3068
+ color: var(--wf-text-secondary);
3069
+ background: var(--wf-warning-light);
3070
+ border: 1px solid color-mix(in srgb, var(--wf-warning) 35%, transparent);
3071
+ border-radius: 6px;
3072
+ }
3073
+
3074
+ .wf-fb-row-warning svg {
3075
+ flex: 0 0 auto;
3076
+ margin-top: 1px;
3077
+ color: var(--wf-warning);
3078
+ }
3079
+
3080
+ .wf-fb-section-empty {
3081
+ margin: 0;
3082
+ font-size: 12px;
3083
+ color: var(--wf-text-secondary);
3084
+ }
3085
+
3086
+ .wf-fb-children {
3087
+ padding-left: 28px;
3088
+ list-style: none;
3089
+ }
3090
+
3091
+ .wf-fb-row {
3092
+ display: flex;
3093
+ align-items: center;
3094
+ gap: 12px;
3095
+ padding: 10px 10px 10px 12px;
3096
+ background: var(--wf-surface);
3097
+ border: 1px solid var(--wf-border-light);
3098
+ border-radius: var(--wf-radius-lg);
3099
+ box-shadow: var(--wf-shadow-sm);
3100
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
3101
+ }
3102
+
3103
+ .wf-fb-row:hover {
3104
+ border-color: var(--wf-border);
3105
+ }
3106
+
3107
+ .wf-fb-row.is-selected {
3108
+ border-color: var(--wf-primary);
3109
+ box-shadow: 0 0 0 3px var(--wf-primary-light);
3110
+ }
3111
+
3112
+ .wf-fb-row.has-issue {
3113
+ border-color: var(--wf-danger);
3114
+ }
3115
+
3116
+ .wf-fb-select {
3117
+ display: flex;
3118
+ flex: 1 1 auto;
3119
+ flex-direction: column;
3120
+ gap: 2px;
3121
+ min-width: 0;
3122
+ padding: 0;
3123
+ font: inherit;
3124
+ text-align: start;
3125
+ color: inherit;
3126
+ background: none;
3127
+ border: 0;
3128
+ cursor: pointer;
3129
+ }
3130
+
3131
+ .wf-fb-select:focus-visible {
3132
+ outline: none;
3133
+ border-radius: 4px;
3134
+ box-shadow: 0 0 0 2px var(--wf-primary);
3135
+ }
3136
+
3137
+ .wf-fb-select strong {
3138
+ overflow: hidden;
3139
+ font-size: 13.5px;
3140
+ font-weight: 600;
3141
+ white-space: nowrap;
3142
+ text-overflow: ellipsis;
3143
+ color: var(--wf-text);
3144
+ }
3145
+
3146
+ .wf-fb-select span {
3147
+ font-size: 12px;
3148
+ color: var(--wf-muted);
3149
+ }
3150
+
3151
+ .wf-fb-required {
3152
+ flex: 0 0 auto;
3153
+ padding: 3px 8px;
3154
+ font-size: 11px;
3155
+ font-style: normal;
3156
+ font-weight: 600;
3157
+ color: var(--wf-danger);
3158
+ background: var(--wf-danger-light);
3159
+ border-radius: var(--wf-radius);
3160
+ }
3161
+
3162
+ .wf-fb-actions {
3163
+ display: flex;
3164
+ flex: 0 0 auto;
3165
+ gap: 2px;
3166
+ }
3167
+
3168
+ .wf-option-list {
3169
+ display: flex;
3170
+ flex-direction: column;
3171
+ gap: 6px;
3172
+ margin: 0 0 8px;
3173
+ padding: 0;
3174
+ list-style: none;
3175
+ }
3176
+
3177
+ .wf-option-row {
3178
+ display: flex;
3179
+ align-items: center;
3180
+ gap: 6px;
3181
+ }
3182
+
3183
+ .wf-option-row input {
3184
+ flex: 1 1 auto;
3185
+ min-width: 0;
3186
+ }
3187
+
3188
+ .wf-fb-actions .wf-option-remove:hover:not([disabled]) {
3189
+ color: var(--wf-danger);
3190
+ background: var(--wf-danger-light);
3191
+ }
3192
+
3193
+ .wf-fb-empty {
3194
+ display: flex;
3195
+ flex-direction: column;
3196
+ align-items: center;
3197
+ gap: 10px;
3198
+ max-width: 760px;
3199
+ margin: 12px auto 0;
3200
+ padding: 36px 20px;
3201
+ text-align: center;
3202
+ color: var(--wf-muted);
3203
+ background: var(--wf-surface);
3204
+ border: 1px dashed var(--wf-border);
3205
+ border-radius: var(--wf-radius-lg);
3206
+ }
3207
+
3208
+ .wf-fb-empty .wf-icon {
3209
+ color: var(--wf-placeholder);
3210
+ }
3211
+
3212
+ .wf-fb-empty p {
3213
+ margin: 0;
3214
+ font-size: 13px;
3215
+ }
3216
+
3217
+ .wf-fb-empty-compact {
3218
+ margin: 0;
3219
+ padding: 20px 16px;
3220
+ background: var(--wf-subtle);
3221
+ }
3222
+
3223
+ .wf-fb-group {
3224
+ min-width: 0;
3225
+ margin: 0 0 16px;
3226
+ padding: 14px 14px 2px;
3227
+ background: var(--wf-surface);
3228
+ border: 1px solid var(--wf-border-light);
3229
+ border-radius: var(--wf-radius-lg);
3230
+ }
3231
+
3232
+ .wf-fb-group legend {
3233
+ float: left;
3234
+ width: 100%;
3235
+ margin: 0 0 12px;
3236
+ padding: 0;
3237
+ font-size: 11px;
3238
+ font-weight: 700;
3239
+ letter-spacing: 0.06em;
3240
+ text-transform: uppercase;
3241
+ color: var(--wf-muted);
3242
+ }
3243
+
3244
+ .wf-fb-group legend + * {
3245
+ clear: both;
3246
+ }
3247
+
3248
+ @media (max-width: 900px) {
3249
+ .wf-form-builder {
3250
+ grid-template-columns: minmax(0, 1fr);
3251
+ }
3252
+
3253
+ .wf-fb-palette,
3254
+ .wf-fb-inspector {
3255
+ border: 0;
3256
+ border-bottom: 1px solid var(--wf-border-light);
3257
+ }
3258
+ }
3259
+ `,Gw=`option-list`;function Kw(e){return Array.isArray(e)?e.map(e=>String(e??``)):[]}function qw(e,t){let n=e.localize(`WorkflowFormNewOption`,`Option {0}`),r=t.length+1;for(;t.includes(n.replace(`{0}`,String(r)));)r++;return n.replace(`{0}`,String(r))}var Jw={hint:Gw,render:e=>{let t=Kw(e.value),n=e.disabled||e.descriptor.isReadOnly===!0,r=n?`disabled`:``,i=e.escape(e.localize(`WorkflowFormMoveUp`,`Move up`)),a=e.escape(e.localize(`WorkflowFormMoveDown`,`Move down`)),o=e.escape(e.localize(`WorkflowFormRemoveOption`,`Remove option`)),s=e.escape(e.localize(`WorkflowFormOptionText`,`Option text`)),c=t.map((c,l)=>`
3260
+ <li class="wf-option-row" data-option-row="${l}">
3261
+ <input type="text" data-option-text="${l}" value="${e.escape(c)}"
3262
+ aria-label="${s}" ${r} />
3263
+ <span class="wf-fb-actions">
3264
+ <button type="button" data-option-up="${l}" ${n||l===0?`disabled`:``}
3265
+ title="${i}" aria-label="${i}">${$(`arrowUp`,15)}</button>
3266
+ <button type="button" data-option-down="${l}"
3267
+ ${n||l===t.length-1?`disabled`:``}
3268
+ title="${a}" aria-label="${a}">${$(`arrowDown`,15)}</button>
3269
+ <button type="button" class="wf-option-remove" data-option-remove="${l}" ${r}
3270
+ title="${o}" aria-label="${o}">${$(`trash`,15)}</button>
3271
+ </span>
3272
+ </li>`).join(``);return`
3273
+ <div class="wf-input" data-input="${e.escape(e.descriptor.name)}">
3274
+ <span>${Yx(e)}</span>
3275
+ ${t.length>0?`<ul class="wf-option-list">${c}</ul>`:`<p class="wf-input-empty">${e.escape(e.localize(`WorkflowFormNoOptions`,`No option yet. Add at least one.`))}</p>`}
3276
+ <button type="button" class="wf-fb-secondary" data-option-add ${r}>
3277
+ ${$(`plus`,15)}
3278
+ ${e.escape(e.localize(`WorkflowFormAddOption`,`Add option`))}
3279
+ </button>
3280
+ ${e.descriptor.description?`<small class="wf-input-hint">${e.escape(e.descriptor.description)}</small>`:``}
3281
+ </div>
3282
+ `},read:()=>[],bind:(e,t,n)=>{let r=()=>Array.from(e.querySelectorAll(`[data-option-text]`)).map(e=>e.value),i=e=>n(e.map(e=>e.trim()));e.querySelectorAll(`[data-option-text]`).forEach(e=>{e.addEventListener(`change`,()=>i(r()))}),e.querySelector(`[data-option-add]`)?.addEventListener(`click`,()=>{let e=r().filter(e=>e.trim().length>0);i([...e,qw(t,e)])});let a=(e,t)=>{let n=r(),a=e+t;if(e<0||a<0||a>=n.length)return;let[o]=n.splice(e,1);n.splice(a,0,o),i(n)};e.querySelectorAll(`[data-option-up]`).forEach(e=>{e.addEventListener(`click`,()=>a(Number(e.dataset.optionUp),-1))}),e.querySelectorAll(`[data-option-down]`).forEach(e=>{e.addEventListener(`click`,()=>a(Number(e.dataset.optionDown),1))}),e.querySelectorAll(`[data-option-remove]`).forEach(e=>{e.addEventListener(`click`,()=>{let t=Number(e.dataset.optionRemove);i(r().filter((e,n)=>n!==t))})})}},Yw=`workflow.formFields`,Xw=`WorkflowFormFieldOption[]`,Zw=new Set([X.Number,X.Money,X.Calculated]),Qw=class extends Cb{constructor(){super(),this._document=Jb(),this._pointerDown=!1,this._renderDeferred=!1,this._keyFollowsLabel=new Set,this.onPointerDown=()=>{this._pointerDown=!0},this.onPointerUp=()=>{this._pointerDown&&(this._pointerDown=!1,this._renderDeferred&&setTimeout(()=>{this._renderDeferred&&!this._pointerDown&&super.requestRender()},0))},this.root.addEventListener(`pointerdown`,this.onPointerDown,!0)}connectedCallback(){window.addEventListener(`pointerup`,this.onPointerUp,!0),window.addEventListener(`pointercancel`,this.onPointerUp,!0),super.connectedCallback()}disconnectedCallback(){window.removeEventListener(`pointerup`,this.onPointerUp,!0),window.removeEventListener(`pointercancel`,this.onPointerUp,!0),this._pointerDown=!1,super.disconnectedCallback()}requestRender(){this._pointerDown?this._renderDeferred=!0:super.requestRender()}get fieldDescriptors(){let e=this.capabilities.formFieldDescriptors;return Array.isArray(e)&&e.length>0?e:Vw()}get availableFieldDescriptors(){let e=this.capabilities;return this.fieldDescriptors.filter(e=>e.isBrowsable!==!1).filter(t=>t.type===X.FileAttachment&&!this.fileAttachmentsAvailable?!1:!t.requiredCapability||e[t.requiredCapability]!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}get fileAttachmentsAvailable(){return this.capabilities.attachmentsEnabled!==!1&&this.capabilities.publicFormEnabled===!0}descriptorFor(e){return this.fieldDescriptors.find(t=>t.type===e)}get document(){return this._document}set document(e){let t=this.normalizeDocument(e),n=mb(t);if(n===this._fingerprint)this._document=t;else{this._document=t,this._fingerprint=n,this._selectedFieldId&&!t.fields.some(e=>e.id===this._selectedFieldId)&&(this._selectedFieldId=void 0);for(let e of[...this._keyFollowsLabel])t.fields.some(t=>t.id===e)||this._keyFollowsLabel.delete(e);this.requestHostRender()}}keyFollowsLabel(e){return this._keyFollowsLabel.has(e)}focusValidationIssue(e){let t=nw(e,void 0,this._document);return!t||t.tab!==`form`||!t.fieldId?!1:(this._selectedFieldId=t.fieldId,this._scrollToFieldId=t.fieldId,this.emit(ab.issueFocus,{...t,issue:e}),this.emit(ab.selectionChange,{fieldId:this._selectedFieldId}),this.isConnected&&super.requestRender(),!0)}get selectedFieldId(){return this._selectedFieldId}addSection(){if(this.readOnly)return;let e={id:this.nextId(`section`,this._document.sections.map(e=>e.id)),title:Yb(this.l(`WorkflowFormNewSection`,`New section`)),order:this._document.sections.length+1};this._document={...this._document,sections:[...this._document.sections,e]},this.emitChange(),this.requestRender()}addField(e,t){if(this.readOnly)return;let n=this.capabilities.maxFormFields;if(n&&this._document.fields.length>=n)return;let r=t?this._document.fields.find(e=>e.id===t):void 0;if(t&&(!r||r.type!==X.Repeater))return;let i=this.nextId(`field`,this._document.fields.map(e=>e.id)),a=this._document.fields.find(e=>e.id===this._selectedFieldId),o=r?.sectionId??a?.sectionId??this._document.sections[0]?.id,s=this.descriptorFor(e),c=this.fieldTypeLabel(s)||`Field`,l={id:i,key:this.nextFieldKey(c),type:e,label:Yb(c),sectionId:o,order:this._document.fields.length+1,validation:{isRequired:!1},options:e===X.SingleSelect||e===X.MultiSelect?[{value:`option-1`,label:Yb(`Option 1`),order:1}]:[]};r&&(l.parentFieldId=r.id),e===X.Calculated&&(l.calculation={operator:Gb.Sum,sourceFieldIds:[]}),this._document={...this._document,fields:[...this._document.fields,l]},this._selectedFieldId=i,this._keyFollowsLabel.add(i),this.emitChange(),this.requestRender()}removeField(e){this.readOnly||(this._document={...this._document,fields:this._document.fields.filter(t=>t.id!==e&&t.parentFieldId!==e)},this._selectedFieldId===e&&(this._selectedFieldId=void 0),this._keyFollowsLabel.delete(e),this.emitChange(),this.requestRender())}moveField(e,t){if(this.readOnly)return;let n=[...this._document.fields].sort((e,t)=>e.order-t.order),r=n.findIndex(t=>t.id===e),i=r+t;if(r<0||i<0||i>=n.length)return;let[a]=n.splice(r,1);n.splice(i,0,a),this._document={...this._document,fields:n.map((e,t)=>({...e,order:t+1}))},this.emitChange(),this.requestRender()}renameSection(e,t){this.readOnly||(t.trim().length===0||(this._document={...this._document,sections:this._document.sections.map(n=>n.id===e?{...n,title:Yb(t.trim())}:n)},this.emitChange()),this.requestRender())}removeSection(e){if(this.readOnly)return;let t=[...this._document.sections].sort((e,t)=>e.order-t.order),n=t.findIndex(t=>t.id===e);if(n<0)return;let r=t.filter(t=>t.id!==e),i=r[Math.max(0,n-1)]?.id;this._document={...this._document,sections:r.map((e,t)=>({...e,order:t+1})),fields:this._document.fields.map(t=>{if(t.sectionId!==e)return t;if(i)return{...t,sectionId:i};let{sectionId:n,...r}=t;return r})},this.emitChange(),this.requestRender()}updateField(e,t){this.readOnly||(this._document={...this._document,fields:this._document.fields.map(n=>n.id===e?{...n,...t}:n)},this.emitChange(),this.requestRender())}render(){this._renderDeferred=!1;let e=[...this._document.fields].sort((e,t)=>e.order-t.order),t=e.find(e=>e.id===this._selectedFieldId);this.root.innerHTML=`
3283
+ <div class="wf-form-builder">
3284
+ <aside class="wf-fb-palette">
3285
+ <h4>${this.escape(this.l(`WorkflowFormBuilderFields`,`Field types`))}</h4>
3286
+ <button type="button" class="wf-fb-secondary wf-add-section" ${this.readOnly?`disabled`:``}>
3287
+ ${$(`section`,15)}
3288
+ ${this.escape(this.l(`WorkflowFormAddSection`,`Add section`))}
3289
+ </button>
3290
+ <div class="wf-fb-items">
3291
+ ${this.availableFieldDescriptors.map(e=>`
3292
+ <button type="button" class="wf-fb-item" data-type="${e.type}" ${this.readOnly?`disabled`:``}
3293
+ title="${this.escape(e.description??this.fieldTypeLabel(e))}">
3294
+ <span class="wf-fb-item-icon">${this.fieldIconMarkup(e,16)}</span>
3295
+ <span class="wf-fb-item-label">${this.escape(this.fieldTypeLabel(e))}</span>
3296
+ <span class="wf-fb-item-add">${$(`plus`,14)}</span>
3297
+ </button>`).join(``)}
3298
+ </div>
3299
+ <p class="wf-fb-palette-note" role="note">
3300
+ ${$(`info`,14)}
3301
+ <span>${this.escape(this.l(`WorkflowFormBuilderAttachmentsHint`,`Signed-in requesters attach files from the request page. The File attachment field is only for public forms.`))}</span>
3302
+ </p>
3303
+ </aside>
3304
+
3305
+ <section class="wf-fb-canvas">
3306
+ <h4>${this.escape(this.l(`WorkflowFormBuilderLayout`,`Form layout`))}</h4>
3307
+ ${e.length===0&&this._document.sections.length===0?`<div class="wf-fb-empty">
3308
+ ${$(`form`,26)}
3309
+ <p>${this.escape(this.l(`WorkflowFormBuilderEmpty`,`Add a field to start building the form.`))}</p>
3310
+ </div>`:this.renderLayout(e)}
3311
+ </section>
3312
+
3313
+ <aside class="wf-fb-inspector">
3314
+ <h4>${this.escape(this.l(`WorkflowDesignerInspector`,`Properties`))}</h4>
3315
+ ${t?this.renderFieldInspector(t):`<div class="wf-fb-empty wf-fb-empty-compact">
3316
+ ${$(`info`,22)}
3317
+ <p>${this.escape(this.l(`WorkflowFormBuilderNoSelection`,`Select a field to edit it.`))}</p>
3318
+ </div>`}
3319
+ </aside>
3320
+ </div>
3321
+ `,this.adoptStyles(WC+Ww),this.bindEvents(),this.scrollToPendingField()}scrollToPendingField(){let e=this._scrollToFieldId;if(!e)return;this._scrollToFieldId=void 0;let t=this.root.querySelector(`[data-field-row="${CSS.escape(e)}"]`);t&&typeof t.scrollIntoView==`function`&&t.scrollIntoView({block:`nearest`}),t?.querySelector(`.wf-fb-select`)?.focus({preventScroll:!0})}fieldIconMarkup(e,t=16){let n=zw(e?.type);return n?$(n,t):`<span aria-hidden="true">${this.escape(e?.icon??``)}</span>`}fieldTypeLabel(e){return e?e.displayName?e.displayName:this.l(Hw(e.type),X[e.type]??``):``}inputLabel(e){if(e.displayName)return e.displayName;let t=Uw(e.name);return t?this.l(t,e.name):e.name}renderLayout(e){let t=e.filter(e=>!e.parentFieldId),n=[...this._document.sections].sort((e,t)=>e.order-t.order);if(n.length===0)return`<ul class="wf-fb-list">${t.map(t=>this.renderFieldTree(t,e)).join(``)}</ul>`;let r=new Set(n.map(e=>e.id)),i=this.readOnly?`disabled`:``,a=this.escape(this.l(`WorkflowFormRemoveSection`,`Remove section`));return n.map((n,o)=>{let s=t.filter(e=>e.sectionId===n.id||o===0&&(!e.sectionId||!r.has(e.sectionId)));return`
3322
+ <div class="wf-fb-section" data-section="${this.escape(n.id)}">
3323
+ <div class="wf-fb-section-head">
3324
+ <input type="text" class="wf-fb-section-title" data-section-title="${this.escape(n.id)}"
3325
+ value="${this.escape(Z(n.title,n.id))}"
3326
+ aria-label="${this.escape(this.l(`WorkflowFormSectionTitle`,`Section title`))}" ${i} />
3327
+ <button type="button" data-section-remove="${this.escape(n.id)}" ${i}
3328
+ title="${a}" aria-label="${a}">${$(`trash`,15)}</button>
3329
+ </div>
3330
+ ${s.length===0?`<p class="wf-fb-section-empty">${this.escape(this.l(`WorkflowFormSectionEmpty`,`No field in this section yet.`))}</p>`:`<ul class="wf-fb-list">${s.map(t=>this.renderFieldTree(t,e)).join(``)}</ul>`}
3331
+ </div>
3332
+ `}).join(``)}renderFieldTree(e,t){let n=t.filter(t=>t.parentFieldId===e.id);return n.length===0?this.renderFieldRow(e):this.renderFieldRow(e)+`<li class="wf-fb-children"><ul class="wf-fb-list">${n.map(e=>this.renderFieldRow(e)).join(``)}</ul></li>`}renderFieldRow(e){let t=this.descriptorFor(e.type),n=this.validationIssues.some(t=>t.fieldId===e.id),r=this.fieldWarningOf(e),i=this.escape(this.l(`WorkflowFormMoveUp`,`Move up`)),a=this.escape(this.l(`WorkflowFormMoveDown`,`Move down`)),o=this.escape(this.l(`WorkflowFormRemoveField`,`Remove field`));return`
3333
+ <li class="wf-fb-row ${e.id===this._selectedFieldId?`is-selected`:``} ${n?`has-issue`:``} ${r?`has-warning`:``}" data-field-row="${this.escape(e.id)}">
3334
+ <span class="wf-fb-row-icon">${this.fieldIconMarkup(t,16)}</span>
3335
+ <button type="button" class="wf-fb-select" data-field="${this.escape(e.id)}">
3336
+ <strong>${this.escape(Z(e.label,e.id))}</strong>
3337
+ <span>${this.escape(this.fieldTypeLabel(t))}</span>
3338
+ </button>
3339
+ ${e.validation?.isRequired?`<em class="wf-fb-required">${this.escape(this.l(`WorkflowFormRequiredField`,`Required`))}</em>`:``}
3340
+ <span class="wf-fb-actions">
3341
+ <button type="button" data-move-up="${this.escape(e.id)}" ${this.readOnly?`disabled`:``}
3342
+ title="${i}" aria-label="${i}">${$(`arrowUp`,15)}</button>
3343
+ <button type="button" data-move-down="${this.escape(e.id)}" ${this.readOnly?`disabled`:``}
3344
+ title="${a}" aria-label="${a}">${$(`arrowDown`,15)}</button>
3345
+ <button type="button" data-remove="${this.escape(e.id)}" ${this.readOnly?`disabled`:``}
3346
+ title="${o}" aria-label="${o}">${$(`trash`,15)}</button>
3347
+ </span>
3348
+ ${r?`<p class="wf-fb-row-warning" role="note">${$(`info`,14)}<span>${this.escape(r)}</span></p>`:``}
3349
+ </li>
3350
+ `}fieldWarningOf(e){if(e.type===X.FileAttachment){if(this.capabilities.attachmentsEnabled===!1)return this.l(`WorkflowValidation_FieldAttachmentsRequireAttachmentsFeature`,`File attachment fields require the workflow attachments feature.`);if(this.capabilities.publicFormEnabled!==!0)return this.l(`WorkflowFormFileAttachmentPublicFormOnly`,`Only public forms can collect files.`)}}renderStructureInputs(e){let t=this.readOnly?`disabled`:``,n=[],r=[...this._document.sections].sort((e,t)=>e.order-t.order);if(!e.parentFieldId&&r.length>1&&n.push(`
3351
+ <label class="wf-input">
3352
+ <span>${this.escape(this.l(`WorkflowFormFieldSection`,`Section`))}</span>
3353
+ <select class="wf-fb-field-section" ${t}>
3354
+ ${r.map(t=>`<option value="${this.escape(t.id)}" ${t.id===e.sectionId?`selected`:``}>${this.escape(Z(t.title,t.id))}</option>`).join(``)}
3355
+ </select>
3356
+ </label>
3357
+ `),e.type===X.Repeater){let e=this.availableFieldDescriptors.filter(e=>!e.isContainer&&e.type!==X.FileAttachment);n.push(`
3358
+ <fieldset class="wf-fb-group">
3359
+ <legend>${this.escape(this.l(`WorkflowFormRepeaterFields`,`Row fields`))}</legend>
3360
+ <label class="wf-input">
3361
+ <span>${this.escape(this.l(`WorkflowFormRepeaterFieldType`,`Field type`))}</span>
3362
+ <select class="wf-fb-child-type" ${t}>
3363
+ ${e.map(e=>`<option value="${e.type}">${this.escape(this.fieldTypeLabel(e))}</option>`).join(``)}
3364
+ </select>
3365
+ </label>
3366
+ <button type="button" class="wf-fb-secondary wf-fb-child-add" ${t}>
3367
+ ${$(`plus`,15)}
3368
+ ${this.escape(this.l(`WorkflowFormRepeaterAddField`,`Add row field`))}
3369
+ </button>
3370
+ </fieldset>
3371
+ `)}return n.join(``)}renderFieldInspector(e){let t=this.validationIssues.filter(t=>t.fieldId===e.id),n=cx(this.descriptorFor(e.type)?.inputs??[]);return`
3372
+ ${sx(n).map(t=>{let r=n.filter(e=>(e.category??``)===t).map(t=>this.renderInput(e,t)).join(``);return r.length===0?``:t.length===0?r:`
3373
+ <fieldset class="wf-fb-group" data-category="${this.escape(t)}">
3374
+ <legend>${this.escape(this.l(`WorkflowInputCategory_`+t,t))}</legend>
3375
+ ${r}
3376
+ </fieldset>
3377
+ `}).join(``)}
3378
+ ${this.renderStructureInputs(e)}
3379
+ ${t.length>0?`<ul class="wf-fb-issues" role="alert">${t.map(e=>`<li>${this.escape(e.message??e.code??``)}</li>`).join(``)}</ul>`:``}
3380
+ `}resolveFieldInput(e,t){if(t.name===`key`)return{...t,displayName:this.inputLabel(t),description:this.keyHint(e)};if(t.optionsProviderName!==Yw)return{...t,displayName:this.inputLabel(t)};let n=this._document.fields.filter(t=>t.id!==e.id&&(t.parentFieldId??null)===(e.parentFieldId??null)&&Zw.has(t.type)).sort((e,t)=>e.order-t.order).map(e=>({value:e.id,displayText:Z(e.label,e.key??e.id)}));return{...t,displayName:this.inputLabel(t),allowedValues:n}}fieldInputContext(e,t){return{descriptor:this.resolveFieldInput(e,t),value:this.readFieldInput(e,t),disabled:this.readOnly,elementId:`wf-input-`+t.name.replace(/[^A-Za-z0-9]/g,`-`),localize:(e,t)=>this.l(e,t),escape:e=>this.escape(e)}}editorFor(e){return e.typeName===Xw?Jw:pC(e)}renderInput(e,t){let n=this.fieldInputContext(e,t);return this.editorFor(n.descriptor).render(n)}readFieldInput(e,t){if(t.name===`key`)return e.key??e.id;let n=rx(e,t.name);return t.typeName===`WorkflowLocalizableText`?Z(n,``):t.typeName===Xw?(Array.isArray(n)?n:[]).map(e=>Z(e.label,e.value??``)):n}applyFieldInput(e,t,n){let r=t.typeName===`WorkflowLocalizableText`?Yb(String(n??``)):t.typeName===Xw?this.toOptions(e,n):n,i=ox(e,t.name,r),a=t.name.split(`.`)[0];return{[a]:i[a]}}toOptions(e,t){return(Array.isArray(t)?t:[]).map(e=>String(e??``).trim()).filter(e=>e.length>0).map((t,n)=>{let r=(e.options??[]).find(e=>Z(e.label,e.value??``)===t);return{...r??{},value:r?.value??t,label:r?.label??Yb(t),order:n+1}})}keyHint(e){return this._keyFollowsLabel.has(e.id)?this.l(`WorkflowFormFieldKeyFollowsLabelHint`,`Filled in from the label; change it only if integrations need a specific key.`):this.l(`WorkflowFormFieldKeyHint`,`Conditions and integrations refer to the field by this key.`)}nextFieldKey(e,t){return Nw(e,this._document.fields.filter(e=>e.id!==t).map(e=>e.key).filter(e=>typeof e==`string`))}inspectorChanges(e,t,n){let r=this.applyFieldInput(e,t,n);return t.name===`key`?(this._keyFollowsLabel.delete(e.id),r):t.name===`label`&&this._keyFollowsLabel.has(e.id)?{...r,key:this.nextFieldKey(Z(r.label,``),e.id)}:r}bindEvents(){this.root.querySelector(`.wf-add-section`)?.addEventListener(`click`,()=>this.addSection()),this.root.querySelectorAll(`[data-section-title]`).forEach(e=>{e.addEventListener(`change`,()=>this.renameSection(e.dataset.sectionTitle??``,e.value))}),this.root.querySelectorAll(`[data-section-remove]`).forEach(e=>{e.addEventListener(`click`,()=>this.removeSection(e.dataset.sectionRemove??``))});let e=this.root.querySelector(`.wf-fb-field-section`);e?.addEventListener(`change`,()=>{this._selectedFieldId&&this.updateField(this._selectedFieldId,{sectionId:e.value})});let t=this.root.querySelector(`.wf-fb-child-type`);this.root.querySelector(`.wf-fb-child-add`)?.addEventListener(`click`,()=>{this._selectedFieldId&&t?.value&&this.addField(Number(t.value),this._selectedFieldId)}),this.root.querySelectorAll(`.wf-fb-item`).forEach(e=>{e.addEventListener(`click`,()=>this.addField(Number(e.dataset.type)))}),this.root.querySelectorAll(`.wf-fb-select`).forEach(e=>{e.addEventListener(`click`,()=>{this._selectedFieldId=e.dataset.field,this.emit(ab.selectionChange,{fieldId:this._selectedFieldId}),this.render()})}),this.root.querySelectorAll(`[data-move-up]`).forEach(e=>{e.addEventListener(`click`,()=>this.moveField(e.dataset.moveUp,-1))}),this.root.querySelectorAll(`[data-move-down]`).forEach(e=>{e.addEventListener(`click`,()=>this.moveField(e.dataset.moveDown,1))}),this.root.querySelectorAll(`[data-remove]`).forEach(e=>{e.addEventListener(`click`,()=>this.removeField(e.dataset.remove))}),this.bindInspectorInputs()}bindInspectorInputs(){let e=this._document.fields.find(e=>e.id===this._selectedFieldId);if(!e)return;let t=this.descriptorFor(e.type);for(let n of cx(t?.inputs??[])){let t=this.root.querySelector(`[data-input="${CSS.escape(n.name)}"]`);if(!t)continue;let r=this.fieldInputContext(e,n),i=this.editorFor(r.descriptor),a=e=>{let t=this._document.fields.find(e=>e.id===this._selectedFieldId);t&&this.updateField(t.id,this.inspectorChanges(t,n,e))};if(i.bind){this.readOnly||i.bind(t,r,a);continue}let o=t.querySelector(`input, select, textarea`);o&&o.addEventListener(i.changeEvent??`change`,()=>a(i.read(o)))}}normalizeDocument(e){return e?{...e,schemaVersion:e.schemaVersion??1,title:e.title,description:e.description,sections:Array.isArray(e.sections)?e.sections:[],fields:Array.isArray(e.fields)?e.fields:[]}:Jb()}nextId(e,t){let n=1;for(;t.includes(`${e}-${n}`);)n++;return`${e}-${n}`}emitChange(){this._fingerprint=mb(this._document),this.emit(ab.documentChange,{document:this._document,isDirty:!0})}escape(e){return e.replace(/[&<>"']/g,e=>{switch(e){case`&`:return`&amp;`;case`<`:return`&lt;`;case`>`:return`&gt;`;case`"`:return`&quot;`;default:return`&#39;`}})}},$w=`workflow-designer`,eT=`workflow-form-builder`;function tT(){typeof customElements<`u`&&(customElements.get(`workflow-designer`)||customElements.define($w,kw),customElements.get(`workflow-form-builder`)||customElements.define(eT,Qw))}tT(),e.ASSIGNMENT_TARGET_TYPE=Xx,e.BINDING_SOURCE_BY_SYNTAX=MC,e.BUILT_IN_INPUTS=jx,e.BUILT_IN_INPUT_DEFAULTS=Ax,e.DEFAULT_THEME=cb,e.FORM_FIELD_OPTIONS_PROVIDER=HC,e.GRAPH_OPTIONS_PROVIDERS=IC,e.LOCALIZABLE_TEXT_TYPE_NAME=ix,e.NODE_CATEGORY_DEFINITIONS=hx,e.NODE_PALETTE=Kx,e.RICH_INPUT_EDITORS=ES,e.UNKNOWN_PRESENTATION=vx,e.WORKFLOW_CHANNEL=lS,e.WORKFLOW_DESIGNER_EVENTS=ab,e.WORKFLOW_DESIGNER_TAG=$w,e.WORKFLOW_EXPRESSION_SYNTAX=nx,e.WORKFLOW_FORM_BUILDER_TAG=eT,e.WORKFLOW_FORM_SCHEMA_VERSION=Tb,e.WORKFLOW_GRAPH_SCHEMA_VERSION=wb,e.WORKFLOW_UI_HINTS=Q,e.WORKFLOW_VARIABLE_SCOPE=Wb,e.WorkflowActionParameterType=Ib,e.WorkflowApprovalPolicy=Eb,e.WorkflowAssignmentTargetType=Db,e.WorkflowAuthoringOrigin=Ub,e.WorkflowChannel=Fb,e.WorkflowConditionExpressionKind=Ab,e.WorkflowConditionLogicalOperator=jb,e.WorkflowConditionOperandType=Mb,e.WorkflowConditionOperator=Nb,e.WorkflowConditionValueType=Pb,e.WorkflowDesignerElement=kw,e.WorkflowEdgeKind=Y,e.WorkflowEventCorrelationSource=Vb,e.WorkflowEventTimeoutBehavior=Hb,e.WorkflowFormBuilderElement=Qw,e.WorkflowFormCalculationOperator=Gb,e.WorkflowFormFieldType=X,e.WorkflowJoinMode=Rb,e.WorkflowNodeExecutionStatus=Kb,e.WorkflowNodeType=J,e.WorkflowRejectionPolicy=Ob,e.WorkflowSelfApprovalPolicy=kb,e.WorkflowSubprocessOutcomeMode=Bb,e.WorkflowTimerNodeMode=zb,e.assigneePickerEditor=cS,e.availablePalette=Gx,e.bindingSourceForSyntax=NC,e.bindingSourceOf=Lb,e.buildAssignmentTarget=rS,e.builtInActivityDescriptors=Nx,e.builtInDescriptorFor=Bx,e.builtInFormFieldDescriptors=Vw,e.channelEditor=mS,e.checkListEditor=wS,e.cloneDefaultValue=lx,e.conditionOperatorsFor=tx,e.connectionDropDownEditor=vS,e.createEmptyForm=Jb,e.createEmptyGraph=qb,e.createLookupDropDownEditor=_S,e.defineWorkflowDesignerElements=tT,e.describeAssignmentTarget=iS,e.descriptionKeyForNodeType=Lx,e.dropDownNeedsEmptyOption=nC,e.edgeKindPresentation=Cx,e.fieldKeyFromLabel=Nw,e.fieldMappingTableEditor=TS,e.findGraphOptionsResolver=BC,e.findInputEditor=fC,e.formFieldTypeNames=Bw,e.fromLocalDateTimeInputValue=oC,e.inputCategoriesOf=sx,e.isEdgeKindAllowed=Wx,e.isGraphOptionsProvider=VC,e.isInputVisible=fx,e.isListConditionOperator=Qb,e.isMultiValuedConditionValueType=ex,e.isOrderConditionOperator=$b,e.isTriggerIssue=tw,e.isUnaryConditionOperator=Zb,e.isUnknownDescriptor=Fx,e.issueCodeFamily=$C,e.issueFocusTargetOf=nw,e.issueInputName=ew,e.issuesFor=sb,e.knownInputEditorHints=mC,e.localizableText=Yb,e.localizationKeyForFieldType=Hw,e.localizationKeyForNodeType=Ix,e.localize=ob,e.needsSyntaxPicker=jC,e.nodeTypeNames=kx,e.optionsProviderForTarget=nS,e.orderedInputs=cx,e.outcomeOf=Ux,e.outcomesFromPorts=Tx,e.outcomesOf=Hx,e.paletteItemFor=Vx,e.paletteItemOf=Rx,e.presentationFor=bx,e.readInputValue=rx,e.registerActivityPresentation=yx,e.registerGraphOptionsResolver=zC,e.registerInputEditor=dC,e.renderSyntaxPicker=FC,e.resolveInputEditor=pC,e.resolveTheme=lb,e.schemaVersionMismatchOf=db,e.storedInputValue=ax,e.syntaxForBindingSource=PC,e.syntaxOptionsOf=AC,e.targetHasSearch=tS,e.targetNeedsLookup=eS,e.textOf=Z,e.themeToCssVariables=ub,e.toLocalDateTimeInputValue=aC,e.unknownActivityDescriptor=Px,e.valueTypeOfFieldType=Xb,e.visibleInputs=mx,e.visibleWhenRuleOf=ux,e.workflowDefinitionPickerEditor=yS,e.writeInputValue=ox});
3381
+ //# sourceMappingURL=workflow-designer.umd.cjs.map