@nocobase/plugin-graph-collection-manager 2.0.0-alpha.56 → 2.0.0-alpha.57
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.
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
stroke: #2ecc71;
|
|
187
187
|
stroke-width: 1px;
|
|
188
188
|
}
|
|
189
|
-
`;r.kJ.prototype.isSnaplineEnabled=function(){let e=this.getPlugin("snapline");return!!e&&e.isEnabled()},r.kJ.prototype.enableSnapline=function(){let e=this.getPlugin("snapline");return e&&e.enable(),this},r.kJ.prototype.disableSnapline=function(){let e=this.getPlugin("snapline");return e&&e.disable(),this},r.kJ.prototype.toggleSnapline=function(){let e=this.getPlugin("snapline");return e&&e.toggleEnabled(),this},r.kJ.prototype.hideSnapline=function(){let e=this.getPlugin("snapline");return e&&e.hide(),this},r.kJ.prototype.setSnaplineFilter=function(e){let t=this.getPlugin("snapline");return t&&t.setFilter(e),this},r.kJ.prototype.isSnaplineOnResizingEnabled=function(){let e=this.getPlugin("snapline");return!!e&&e.isOnResizingEnabled()},r.kJ.prototype.enableSnaplineOnResizing=function(){let e=this.getPlugin("snapline");return e&&e.enableOnResizing(),this},r.kJ.prototype.disableSnaplineOnResizing=function(){let e=this.getPlugin("snapline");return e&&e.disableOnResizing(),this},r.kJ.prototype.toggleSnaplineOnResizing=function(e){let t=this.getPlugin("snapline");return t&&t.toggleOnResizing(e),this},r.kJ.prototype.isSharpSnapline=function(){let e=this.getPlugin("snapline");return!!e&&e.isSharp()},r.kJ.prototype.enableSharpSnapline=function(){let e=this.getPlugin("snapline");return e&&e.enableSharp(),this},r.kJ.prototype.disableSharpSnapline=function(){let e=this.getPlugin("snapline");return e&&e.disableSharp(),this},r.kJ.prototype.toggleSharpSnapline=function(e){let t=this.getPlugin("snapline");return t&&t.toggleSharp(e),this},r.kJ.prototype.getSnaplineTolerance=function(){let e=this.getPlugin("snapline");if(e)return e.getTolerance()},r.kJ.prototype.setSnaplineTolerance=function(e){let t=this.getPlugin("snapline");return t&&t.setTolerance(e),this};class l extends r.JT{constructor(e={}){super(),this.name="snapline",this.options=Object.assign({enabled:!0,tolerance:10},e),r.mf.ensure(this.name,s)}init(e){this.snaplineImpl=new o(Object.assign(Object.assign({},this.options),{graph:e}))}isEnabled(){return!this.snaplineImpl.disabled}enable(){this.snaplineImpl.enable()}disable(){this.snaplineImpl.disable()}toggleEnabled(e){if(null==e)return this.isEnabled()?this.disable():this.enable(),this;e!==this.isEnabled()&&(e?this.enable():this.disable())}hide(){return this.snaplineImpl.hide(),this}setFilter(e){return this.snaplineImpl.setFilter(e),this}isOnResizingEnabled(){return!0===this.snaplineImpl.options.resizing}enableOnResizing(){return this.snaplineImpl.options.resizing=!0,this}disableOnResizing(){return this.snaplineImpl.options.resizing=!1,this}toggleOnResizing(e){return null!=e?e!==this.isOnResizingEnabled()&&(e?this.enableOnResizing():this.disableOnResizing()):this.isOnResizingEnabled()?this.disableOnResizing():this.enableOnResizing(),this}isSharp(){return!0===this.snaplineImpl.options.sharp}enableSharp(){return this.snaplineImpl.options.sharp=!0,this}disableSharp(){return this.snaplineImpl.options.sharp=!1,this}toggleSharp(e){return null!=e?e!==this.isSharp()&&(e?this.enableSharp():this.disableSharp()):this.isSharp()?this.disableSharp():this.enableSharp(),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(),r.mf.clean(this.name)}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([r.JT.dispose()],l.prototype,"dispose",null)},2403:function(e,t,n){"use strict";n.d(t,{z2:function(){return p}});var r,i,o=n(5535);class s extends o.NB{}var l=s||(s={});function a(e){let t=[],n=o.Lu.getForeignObjectMarkup();return e?t.push({tagName:e,selector:"body"},n):t.push(n),t}l.config({view:"react-shape-view",markup:a(),attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}},propHooks(e){if(null==e.markup){let t=e.primer;if(t){e.markup=a(t);let n={};switch(t){case"circle":n={refCx:"50%",refCy:"50%",refR:"50%"};break;case"ellipse":n={refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}e.attrs=o.QK.merge({},{body:Object.assign({refWidth:null,refHeight:null},n)},e.attrs||{})}}return e}}),o.NB.registry.register("react-shape",l,!0);var u=n(8156),c=n.n(u),h=n(5350),d=n(9195);!function(e){let t,n=!1,r=(e,t)=>{let n=t.payload;switch(t.type){case"add":{let t=e.findIndex(e=>e.id===n.id);if(t>=0)return e[t]=n,[...e];return[...e,n]}case"remove":{let t=e.findIndex(e=>e.id===n.id);if(t>=0){let n=[...e];return n.splice(t,1),n}}}return e};e.connect=function(e,r){n&&t({type:"add",payload:{id:e,portal:r}})},e.disconnect=function(e){n&&t({type:"remove",payload:{id:e}})},e.isActive=function(){return n},e.getProvider=function(){return()=>{n=!0;let[e,i]=(0,u.useReducer)(r,[]);return t=i,c().createElement(c().Fragment,{children:e.map(e=>e.portal)})}}}(i||(i={}));var f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let g={};function p(e){let{shape:t,component:n,effect:r,inherit:i}=e,s=f(e,["shape","component","effect","inherit"]);if(!t)throw Error("should specify shape in config");g[t]={component:n,effect:r},o.kJ.registerNode(t,Object.assign({inherit:i||"react-shape"},s),!0)}class m extends c().PureComponent{constructor(e){super(e),this.state={tick:0}}componentDidMount(){let{node:e}=this.props;e.on("change:*",({key:t})=>{let n=g[e.shape];if(n){let{effect:e}=n;(!e||e.includes(t))&&this.setState({tick:this.state.tick+1})}})}clone(e){let{node:t,graph:n}=this.props;return"string"==typeof e.type?c().cloneElement(e):c().cloneElement(e,{node:t,graph:n})}render(){let{node:e}=this.props,t=g[e.shape];if(!t)return null;let{component:n}=t;return c().isValidElement(n)?this.clone(n):this.clone(c().createElement(n,null))}}class y extends o.DK{targetId(){return`${this.graph.view.cid}:${this.cell.id}`}getComponentContainer(){return this.selectors&&this.selectors.foContent}confirmUpdate(e){let t=super.confirmUpdate(e);return this.handleAction(t,y.action,()=>{this.renderReactComponent()})}renderReactComponent(){this.unmountReactComponent();let e=this.getComponentContainer(),t=this.cell;if(e){let n=c().createElement(m,{node:t,graph:this.graph});if(i.isActive()){let t=(0,h.createPortal)(n,e);i.connect(this.targetId(),t)}else this.root=(0,d.createRoot)(e),this.root.render(n)}}unmountReactComponent(){this.getComponentContainer()&&this.root&&(this.root.unmount(),this.root=void 0)}onMouseDown(e,t,n){let r=e.target;if("input"===r.tagName.toLowerCase()){let e=r.getAttribute("type");if(null==e||["text","password","number","email","search","tel","url"].includes(e))return}super.onMouseDown(e,t,n)}unmount(){return i.isActive()&&i.disconnect(this.targetId()),this.unmountReactComponent(),super.unmount(),this}}(r=y||(y={})).action="react",r.config({bootstrap:[r.action],actions:{component:r.action}}),o.DK.registry.register("react-shape-view",r,!0)},5535:function(e,t,n){"use strict";let r,i,o,s,l,a,u,c,h;n.d(t,{RZ:function(){return tl},RO:function(){return tL},bL:function(){return gy},kJ:function(){return pe},NB:function(){return gx},t4:function(){return e2},tw:function(){return gV},QK:function(){return tj},DK:function(){return gD},tx:function(){return ti},ew:function(){return oQ},GH:function(){return tR},E9:function(){return ci},Ae:function(){return co},iC:function(){return gZ},mf:function(){return tz},Iw:function(){return tI},OW:function(){return aX},De:function(){return dl},FE:function(){return gP},Lu:function(){return tv},is:function(){return t_},JT:function(){return tZ},Zr:function(){return tf},G7:function(){return dq}});var d,f,g,p,m,y,b,v,x,w,C,E,S,P,k,O,M,A,T,N,j,L,R,I,_,z,D,B,V,F,$,U,G,H,q,W,J,X,Y,Q,Z,K,ee,et,en,er,ei,eo,es,el,ea,eu,ec,eh,ed,ef,eg,ep,em,ey,eb,ev,ex,ew,eC,eE,eS,eP,ek,eO,eM,eA,eT,eN,ej,eL,eR,eI,e_,ez,eD,eB,eV,eF,e$,eU,eG,eH,eq,eW,eJ,eX,eY,eQ,eZ,eK,e0,e1,e2,e3,e5,e6,e4,e9,e8,e7,te,tt,tn,tr,ti,to,ts,tl,ta,tu,tc,th,td,tf,tg,tp,tm,ty,tb,tv,tx,tw,tC,tE,tS,tP,tk,tO,tM,tA,tT,tN,tj={};n.r(tj),n.d(tj,{applyMixins:function(){return oD},clone:function(){return ov},cloneDeep:function(){return of},createClass:function(){return o$},defaults:function(){return ie},defaultsDeep:function(){return r4},ensure:function(){return oU},flatten:function(){return function e(t,n="/",r){let i={};for(let o in Object.keys(t).forEach(o=>{let s=t[o],l="object"==typeof s||Array.isArray(s);if(l&&r&&r(s)&&(l=!1),l){let t=e(s,n,r);Object.keys(t).forEach(e=>{i[o+n+e]=t[e]})}else i[o]=s}),t)if(!Object.prototype.hasOwnProperty.call(t,o))continue;return i}},getBoolean:function(){return oq},getByPath:function(){return oJ},getNumber:function(){return oH},getValue:function(){return oG},has:function(){return ob},inherit:function(){return oV},isEmpty:function(){return op},isEqual:function(){return oz},isMaliciousProp:function(){return oW},isObject:function(){return t0},isPlainObject:function(){return rj},merge:function(){return r9},pick:function(){return iA},setByPath:function(){return oX},unsetByPath:function(){return oY}});var tL={};n.r(tL),n.d(tL,{difference:function(){return sv},groupBy:function(){return sa},max:function(){return o6},sortBy:function(){return sP},sortedIndex:function(){return o2},sortedIndexBy:function(){return su},union:function(){return sy},uniq:function(){return sk}});var tR={};n.r(tR),n.d(tR,{clamp:function(){return lx},isNumber:function(){return lv},isPercentage:function(){return lE},mod:function(){return lw},normalizePercentage:function(){return lS},normalizeSides:function(){return lk},parseCssNumeric:function(){return lP},random:function(){return lC}});var tI={};n.r(tI),n.d(tI,{apply:function(){return nv},call:function(){return nx},debounce:function(){return ny},isAsync:function(){return nC},isAsyncLike:function(){return nw},throttle:function(){return nb},toAsyncBoolean:function(){return nE},toDeferredBoolean:function(){return nS}});var t_={};n.r(t_),n.d(t_,{CASE_SENSITIVE_ATTR:function(){return ay},Event:function(){return te},EventHook:function(){return e6},EventObject:function(){return uV},KAPPA:function(){return a3},MouseWheelHandle:function(){return uq},addClass:function(){return lQ},after:function(){return ad},append:function(){return au},appendTo:function(){return af},attr:function(){return aC},before:function(){return ah},breakText:function(){return a2},children:function(){return am},circleToPathData:function(){return ut},clearSelection:function(){return aD},computeStyle:function(){return aF},computeStyleInt:function(){return a$},contains:function(){return as},createElement:function(){return l4},createElementNS:function(){return l9},createSVGMatrix:function(){return uf},createSVGPoint:function(){return ud},createSVGTransform:function(){return ug},createSlicePathData:function(){return ul},createSvgDocument:function(){return l7},createSvgElement:function(){return l8},css:function(){return aU},data:function(){return aW},decomposeMatrix:function(){return uv},ellipseToPathData:function(){return un},empty:function(){return aa},ensureId:function(){return l2},find:function(){return ar},findOne:function(){return ai},findParentByClass:function(){return ao},getAttribute:function(){return ab},getClass:function(){return lX},getComputedStyle:function(){return a_},getData:function(){return aH},getPointsFromSvgElement:function(){return ue},getTransformToElement:function(){return uO},getTransformToParentElement:function(){return uM},getVendorPrefixedName:function(){return aR},hasClass:function(){return lY},hasScrollbars:function(){return az},height:function(){return uX},index:function(){return an},isCSSVariable:function(){return aV},isElement:function(){return ag},isHTMLElement:function(){return ap},isSVGGraphicsElement:function(){return l3},kebablizeAttrs:function(){return aS},lineToPathData:function(){return a4},matrixToRotation:function(){return uw},matrixToScale:function(){return ux},matrixToTransformString:function(){return um},matrixToTranslation:function(){return uC},measureText:function(){return a0},mergeAttrs:function(){return ak},ns:function(){return l5},offset:function(){return uW},parseTransformString:function(){return uy},parseXML:function(){return ae},polygonToPathData:function(){return a9},polylineToPathData:function(){return a8},position:function(){return uY},prepend:function(){return ac},prop:function(){return function e(t,n,r){if(n){if("string"==typeof n)return(n=aJ[n]||n,arguments.length<3)?t[n]:void(t[n]=r);for(let r in n)e(t,r,n[r])}}},qualifyAttr:function(){return aE},rectToPathData:function(){return ui},rectangleToPathData:function(){return ur},remove:function(){return al},removeAttribute:function(){return av},removeClass:function(){return lZ},rotate:function(){return uP},sample:function(){return a6},scale:function(){return uk},setAttribute:function(){return ax},setAttributes:function(){return aw},setData:function(){return aq},setPrefixedStyle:function(){return aI},splitTextByLength:function(){return a1},styleToObject:function(){return aP},svgVersion:function(){return l6},tagName:function(){return at},text:function(){return aK},toLocalPoint:function(){return uA},toPath:function(){return uo},toPathData:function(){return us},toggleClass:function(){return lK},transform:function(){return uE},transformStringToMatrix:function(){return up},translate:function(){return uS},uniqueId:function(){return l1},width:function(){return uJ}});var tz={};n.r(tz),n.d(tz,{clean:function(){return cn},ensure:function(){return ct}});var tD={};n.r(tD),n.d(tD,{dot:function(){return cT},doubleMesh:function(){return cL},fixedDot:function(){return cN},mesh:function(){return cj}});var tB={};n.r(tB),n.d(tB,{flipX:function(){return cI},flipXY:function(){return cz},flipY:function(){return c_},watermark:function(){return cD}});var tV={};n.r(tV),n.d(tV,{blur:function(){return cU},brightness:function(){return cY},contrast:function(){return cQ},dropShadow:function(){return cG},grayScale:function(){return cH},highlight:function(){return c$},hueRotate:function(){return cJ},invert:function(){return cX},outline:function(){return cF},saturate:function(){return cW},sepia:function(){return cq}});var tF={};n.r(tF),n.d(tF,{async:function(){return hX},block:function(){return hB},circle:function(){return hQ},circlePlus:function(){return hZ},classic:function(){return hV},cross:function(){return hW},diamond:function(){return hU},ellipse:function(){return h0},path:function(){return hH}});var t$={};n.r(t$),n.d(t$,{annotations:function(){return hP},atConnectionLength:function(){return dr},atConnectionLengthIgnoreGradient:function(){return de},atConnectionLengthKeepGradient:function(){return h7},atConnectionRatio:function(){return di},atConnectionRatioIgnoreGradient:function(){return dn},atConnectionRatioKeepGradient:function(){return dt},connection:function(){return h8},displayEmpty:function(){return hO},eol:function(){return hk},fill:function(){return hy},filter:function(){return hI},html:function(){return hR},lineHeight:function(){return hC},port:function(){return h_},ref:function(){return cZ},refCx:function(){return c7},refCy:function(){return he},refD:function(){return hs},refDKeepOffset:function(){return hn},refDResetOffset:function(){return ht},refDx:function(){return c1},refDy:function(){return c2},refHeight:function(){return c5},refHeight2:function(){return hh},refPoints:function(){return hl},refPointsKeepOffset:function(){return hi},refPointsResetOffset:function(){return hr},refR:function(){return ho},refRCircumscribed:function(){return c8},refRInscribed:function(){return c9},refRx:function(){return c6},refRy:function(){return c4},refWidth:function(){return c3},refWidth2:function(){return hc},refX:function(){return cK},refX2:function(){return ha},refY:function(){return c0},refY2:function(){return hu},resetOffset:function(){return hN},sourceMarker:function(){return h3},stroke:function(){return hb},style:function(){return hL},targetMarker:function(){return h5},text:function(){return hv},textPath:function(){return hS},textVerticalAnchor:function(){return hE},textWrap:function(){return hx},title:function(){return hM},vertexMarker:function(){return h6},xAlign:function(){return hA},yAlign:function(){return hT}});var tU={};n.r(tU),n.d(tU,{className:function(){return du},opacity:function(){return dh},stroke:function(){return df}});var tG={};n.r(tG),n.d(tG,{absolute:function(){return db},bottom:function(){return dO},ellipse:function(){return dv},ellipseSpread:function(){return dx},left:function(){return dS},line:function(){return dE},right:function(){return dP},top:function(){return dk}});var tH={};n.r(tH),n.d(tH,{bottom:function(){return dI},inside:function(){return dD},insideOriented:function(){return dB},left:function(){return dj},manual:function(){return dN},outside:function(){return d_},outsideOriented:function(){return dz},radial:function(){return dU},radialOriented:function(){return dG},right:function(){return dL},top:function(){return dR}});var tq={};n.r(tq),n.d(tq,{noop:function(){return dK},pinAbsolute:function(){return d3},pinRelative:function(){return d2}});var tW={};n.r(tW),n.d(tW,{bottom:function(){return fg},bottomLeft:function(){return fv},bottomRight:function(){return fx},center:function(){return fd},left:function(){return fp},midSide:function(){return fk},nodeCenter:function(){return fP},orth:function(){return fS},right:function(){return fm},top:function(){return ff},topLeft:function(){return fy},topRight:function(){return fb}});var tJ={};n.r(tJ),n.d(tJ,{closest:function(){return fT},length:function(){return fM},orth:function(){return fN},ratio:function(){return fO}});var tX={};n.r(tX),n.d(tX,{anchor:function(){return fz},bbox:function(){return fR},boundary:function(){return f_},rect:function(){return fI}});var tY={};n.r(tY),n.d(tY,{er:function(){return gt},loop:function(){return gr},manhattan:function(){return f8},metro:function(){return ge},normal:function(){return fD},oneSide:function(){return fB},orth:function(){return fG}});var tQ={};n.r(tQ),n.d(tQ,{jumpover:function(){return gf},loop:function(){return go},normal:function(){return gi},rounded:function(){return gs},smooth:function(){return gl}}),n(9652);class tZ{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}(tZ||(tZ={})).dispose=function(){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))}}};class tK{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()}}(d=tK||(tK={})).from=function(e){let t=new d;return e.forEach(e=>{t.add(e)}),t};var t0=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},t1="object"==typeof global&&global&&global.Object===Object&&global,t2="object"==typeof self&&self&&self.Object===Object&&self,t3=t1||t2||Function("return this")(),t5=function(){return t3.Date.now()},t6=/\s/,t4=function(e){for(var t=e.length;t--&&t6.test(e.charAt(t)););return t},t9=/^\s+/,t8=t3.Symbol,t7=Object.prototype,ne=t7.hasOwnProperty,nt=t7.toString,nn=t8?t8.toStringTag:void 0,nr=function(e){var t=ne.call(e,nn),n=e[nn];try{e[nn]=void 0;var r=!0}catch(e){}var i=nt.call(e);return r&&(t?e[nn]=n:delete e[nn]),i},ni=Object.prototype.toString,no=t8?t8.toStringTag:void 0,ns=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":no&&no in Object(e)?nr(e):ni.call(e)},nl=function(e){return null!=e&&"object"==typeof e},na=function(e){return"symbol"==typeof e||nl(e)&&"[object Symbol]"==ns(e)},nu=0/0,nc=/^[-+]0x[0-9a-f]+$/i,nh=/^0b[01]+$/i,nd=/^0o[0-7]+$/i,nf=parseInt,ng=function(e){if("number"==typeof e)return e;if(na(e))return nu;if(t0(e)){var t,n="function"==typeof e.valueOf?e.valueOf():e;e=t0(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)?t.slice(0,t4(t)+1).replace(t9,""):t;var r=nh.test(e);return r||nd.test(e)?nf(e.slice(2),r?2:8):nc.test(e)?nu:+e},np=Math.max,nm=Math.min,ny=function(e,t,n){var r,i,o,s,l,a,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw TypeError("Expected a function");function f(t){var n=r,o=i;return r=i=void 0,u=t,s=e.apply(o,n)}function g(e){var n=e-a,r=e-u;return void 0===a||n>=t||n<0||h&&r>=o}function p(){var e,n,r,i=t5();if(g(i))return m(i);l=setTimeout(p,(e=i-a,n=i-u,r=t-e,h?nm(r,o-n):r))}function m(e){return(l=void 0,d&&r)?f(e):(r=i=void 0,s)}function y(){var e,n=t5(),o=g(n);if(r=arguments,i=this,a=n,o){if(void 0===l)return u=e=a,l=setTimeout(p,t),c?f(e):s;if(h)return clearTimeout(l),l=setTimeout(p,t),f(a)}return void 0===l&&(l=setTimeout(p,t)),s}return t=ng(t)||0,t0(n)&&(c=!!n.leading,o=(h="maxWait"in n)?np(ng(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==l&&clearTimeout(l),u=0,r=a=i=l=void 0},y.flush=function(){return void 0===l?s:m(t5())},y},nb=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw TypeError("Expected a function");return t0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ny(e,t,{leading:r,maxWait:t,trailing:i})};function nv(e,t,n){if(n)switch(n.length){case 0:break;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 nx(e,t,...n){return nv(e,t,n)}function nw(e){return"object"==typeof e&&e.then&&"function"==typeof e.then}function nC(e){return null!=e&&(e instanceof Promise||nw(e))}function nE(...e){let t=[];return(e.forEach(e=>{Array.isArray(e)?t.push(...e):t.push(e)}),t.some(e=>nC(e)))?Promise.all(t.map(e=>nC(e)?e:Promise.resolve(!1!==e))).then(e=>e.reduce((e,t)=>!1!==t&&e,!0)):t.every(e=>!1!==e)}function nS(...e){let t=nE(e);return"boolean"==typeof t?Promise.resolve(t):t}function nP(e,t){let n=[];for(let r=0;r<e.length;r+=2){let i=e[r],o=nv(i,e[r+1],Array.isArray(t)?t:[t]);n.push(o)}return nE(n)}class nk{constructor(){this.listeners={}}on(e,t,n){return null==t||(this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t,n)),this}once(e,t,n){let r=(...i)=>(this.off(e,r),nP([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))return void delete r[e];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];null!=r&&(n=nP([...r],t))}let r=this.listeners["*"];return null!=r?nE([n,nP([...r],[e,...t])]):n}emit(e,...t){return this.trigger(e,...t)}}var nO=function(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)},nM=function(e){return e},nA=Math.max,nT=function(e,t,n){return t=nA(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=nA(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(s),nO(e,this,l)}},nN=function(e){if(!t0(e))return!1;var t=ns(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},nj=t3["__core-js_shared__"],nL=(f=/[^.]+$/.exec(nj&&nj.keys&&nj.keys.IE_PROTO||""))?"Symbol(src)_1."+f:"",nR=Function.prototype.toString,nI=function(e){if(null!=e){try{return nR.call(e)}catch(e){}try{return e+""}catch(e){}}return""},n_=/^\[object .+?Constructor\]$/,nz=Object.prototype,nD=Function.prototype.toString,nB=nz.hasOwnProperty,nV=RegExp("^"+nD.call(nB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nF=function(e){return!!t0(e)&&(!nL||!(nL in e))&&(nN(e)?nV:n_).test(nI(e))},n$=function(e,t){var n=null==e?void 0:e[t];return nF(n)?n:void 0},nU=function(){try{var e=n$(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),nG=Date.now,nH=(g=nU?function(e,t){return nU(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:nM,p=0,m=0,function(){var e=nG(),t=16-(e-m);if(m=e,t>0){if(++p>=800)return arguments[0]}else p=0;return g.apply(void 0,arguments)}),nq=function(e,t){return nH(nT(e,t,nM),e+"")},nW=function(e,t){return e===t||e!=e&&t!=t},nJ=function(e,t){for(var n=e.length;n--;)if(nW(e[n][0],t))return n;return -1},nX=Array.prototype.splice;function nY(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}nY.prototype.clear=function(){this.__data__=[],this.size=0},nY.prototype.delete=function(e){var t=this.__data__,n=nJ(t,e);return!(n<0)&&(n==t.length-1?t.pop():nX.call(t,n,1),--this.size,!0)},nY.prototype.get=function(e){var t=this.__data__,n=nJ(t,e);return n<0?void 0:t[n][1]},nY.prototype.has=function(e){return nJ(this.__data__,e)>-1},nY.prototype.set=function(e,t){var n=this.__data__,r=nJ(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var nQ=n$(t3,"Map"),nZ=n$(Object,"create"),nK=Object.prototype.hasOwnProperty,n0=Object.prototype.hasOwnProperty;function n1(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}n1.prototype.clear=function(){this.__data__=nZ?nZ(null):{},this.size=0},n1.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},n1.prototype.get=function(e){var t=this.__data__;if(nZ){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return nK.call(t,e)?t[e]:void 0},n1.prototype.has=function(e){var t=this.__data__;return nZ?void 0!==t[e]:n0.call(t,e)},n1.prototype.set=function(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=nZ&&void 0===t?"__lodash_hash_undefined__":t,this};var n2=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},n3=function(e,t){var n=e.__data__;return n2(t)?n["string"==typeof t?"string":"hash"]:n.map};function n5(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function n6(e){var t=this.__data__=new nY(e);this.size=t.size}n5.prototype.clear=function(){this.size=0,this.__data__={hash:new n1,map:new(nQ||nY),string:new n1}},n5.prototype.delete=function(e){var t=n3(this,e).delete(e);return this.size-=+!!t,t},n5.prototype.get=function(e){return n3(this,e).get(e)},n5.prototype.has=function(e){return n3(this,e).has(e)},n5.prototype.set=function(e,t){var n=n3(this,e),r=n.size;return n.set(e,t),this.size+=+(n.size!=r),this},n6.prototype.clear=function(){this.__data__=new nY,this.size=0},n6.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},n6.prototype.get=function(e){return this.__data__.get(e)},n6.prototype.has=function(e){return this.__data__.has(e)},n6.prototype.set=function(e,t){var n=this.__data__;if(n instanceof nY){var r=n.__data__;if(!nQ||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new n5(r)}return n.set(e,t),this.size=n.size,this};var n4=function(e,t,n){"__proto__"==t&&nU?nU(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},n9=function(e,t,n){(void 0===n||nW(e[t],n))&&(void 0!==n||t in e)||n4(e,t,n)},n8=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var l=o[++r];if(!1===t(i[l],l,i))break}return e},n7="object"==typeof exports&&exports&&!exports.nodeType&&exports,re=n7&&"object"==typeof module&&module&&!module.nodeType&&module,rt=re&&re.exports===n7?t3.Buffer:void 0,rn=rt?rt.allocUnsafe:void 0,rr=function(e,t){if(t)return e.slice();var n=e.length,r=rn?rn(n):new e.constructor(n);return e.copy(r),r},ri=t3.Uint8Array,ro=function(e){var t=new e.constructor(e.byteLength);return new ri(t).set(new ri(e)),t},rs=function(e,t){var n=t?ro(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},rl=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t},ra=Object.create,ru=function(){function e(){}return function(t){if(!t0(t))return{};if(ra)return ra(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),rc=function(e,t){return function(n){return e(t(n))}},rh=rc(Object.getPrototypeOf,Object),rd=Object.prototype,rf=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||rd)},rg=function(e){return"function"!=typeof e.constructor||rf(e)?{}:ru(rh(e))},rp=function(e){return nl(e)&&"[object Arguments]"==ns(e)},rm=Object.prototype,ry=rm.hasOwnProperty,rb=rm.propertyIsEnumerable,rv=rp(function(){return arguments}())?rp:function(e){return nl(e)&&ry.call(e,"callee")&&!rb.call(e,"callee")},rx=Array.isArray,rw=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},rC=function(e){return null!=e&&rw(e.length)&&!nN(e)},rE=function(e){return nl(e)&&rC(e)},rS="object"==typeof exports&&exports&&!exports.nodeType&&exports,rP=rS&&"object"==typeof module&&module&&!module.nodeType&&module,rk=rP&&rP.exports===rS?t3.Buffer:void 0,rO=(rk?rk.isBuffer:void 0)||function(){return!1},rM=Object.prototype,rA=Function.prototype.toString,rT=rM.hasOwnProperty,rN=rA.call(Object),rj=function(e){if(!nl(e)||"[object Object]"!=ns(e))return!1;var t=rh(e);if(null===t)return!0;var n=rT.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&rA.call(n)==rN},rL={};rL["[object Float32Array]"]=rL["[object Float64Array]"]=rL["[object Int8Array]"]=rL["[object Int16Array]"]=rL["[object Int32Array]"]=rL["[object Uint8Array]"]=rL["[object Uint8ClampedArray]"]=rL["[object Uint16Array]"]=rL["[object Uint32Array]"]=!0,rL["[object Arguments]"]=rL["[object Array]"]=rL["[object ArrayBuffer]"]=rL["[object Boolean]"]=rL["[object DataView]"]=rL["[object Date]"]=rL["[object Error]"]=rL["[object Function]"]=rL["[object Map]"]=rL["[object Number]"]=rL["[object Object]"]=rL["[object RegExp]"]=rL["[object Set]"]=rL["[object String]"]=rL["[object WeakMap]"]=!1;var rR=function(e){return function(t){return e(t)}},rI="object"==typeof exports&&exports&&!exports.nodeType&&exports,r_=rI&&"object"==typeof module&&module&&!module.nodeType&&module,rz=r_&&r_.exports===rI&&t1.process,rD=function(){try{var e=r_&&r_.require&&r_.require("util").types;if(e)return e;return rz&&rz.binding&&rz.binding("util")}catch(e){}}(),rB=rD&&rD.isTypedArray,rV=rB?rR(rB):function(e){return nl(e)&&rw(e.length)&&!!rL[ns(e)]},rF=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},r$=Object.prototype.hasOwnProperty,rU=function(e,t,n){var r=e[t];r$.call(e,t)&&nW(r,n)&&(void 0!==n||t in e)||n4(e,t,n)},rG=function(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var l=t[o],a=r?r(n[l],e[l],l,n,e):void 0;void 0===a&&(a=e[l]),i?n4(n,l,a):rU(n,l,a)}return n},rH=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},rq=/^(?:0|[1-9]\d*)$/,rW=function(e,t){var n=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==n||"symbol"!=n&&rq.test(e))&&e>-1&&e%1==0&&e<t},rJ=Object.prototype.hasOwnProperty,rX=function(e,t){var n=rx(e),r=!n&&rv(e),i=!n&&!r&&rO(e),o=!n&&!r&&!i&&rV(e),s=n||r||i||o,l=s?rH(e.length,String):[],a=l.length;for(var u in e)(t||rJ.call(e,u))&&!(s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||rW(u,a)))&&l.push(u);return l},rY=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},rQ=Object.prototype.hasOwnProperty,rZ=function(e){if(!t0(e))return rY(e);var t=rf(e),n=[];for(var r in e)"constructor"==r&&(t||!rQ.call(e,r))||n.push(r);return n},rK=function(e){return rC(e)?rX(e,!0):rZ(e)},r0=function(e,t,n,r,i,o,s){var l=rF(e,n),a=rF(t,n),u=s.get(a);if(u)return void n9(e,n,u);var c=o?o(l,a,n+"",e,t,s):void 0,h=void 0===c;if(h){var d=rx(a),f=!d&&rO(a),g=!d&&!f&&rV(a);(c=a,d||f||g)?rx(l)?c=l:rE(l)?c=rl(l):f?(h=!1,c=rr(a,!0)):g?(h=!1,c=rs(a,!0)):c=[]:rj(a)||rv(a)?(c=l,rv(l))?c=rG(l,rK(l)):(!t0(l)||nN(l))&&(c=rg(a)):h=!1}h&&(s.set(a,c),i(c,a,r,o,s),s.delete(a)),n9(e,n,c)},r1=function e(t,n,r,i,o){t!==n&&n8(n,function(s,l){if(o||(o=new n6),t0(s))r0(t,n,l,r,e,i,o);else{var a=i?i(rF(t,l),s,l+"",t,n,o):void 0;void 0===a&&(a=s),n9(t,l,a)}},rK)},r2=function e(t,n,r,i,o,s){return t0(t)&&t0(n)&&(s.set(n,t),r1(t,n,void 0,e,s),s.delete(n)),t},r3=function(e,t,n){if(!t0(n))return!1;var r=typeof t;return("number"==r?!!(rC(n)&&rW(t,n.length)):"string"==r&&t in n)&&nW(n[t],e)},r5=function(e){return nq(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&r3(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var l=n[r];l&&e(t,l,r,o)}return t})},r6=r5(function(e,t,n,r){r1(e,t,n,r)}),r4=nq(function(e){return e.push(void 0,r2),nO(r6,void 0,e)}),r9=r5(function(e,t,n){r1(e,t,n)}),r8=Object.prototype,r7=r8.hasOwnProperty,ie=nq(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&r3(t[0],t[1],i)&&(r=1);++n<r;)for(var o=t[n],s=rK(o),l=-1,a=s.length;++l<a;){var u=s[l],c=e[u];(void 0===c||nW(c,r8[u])&&!r7.call(e,u))&&(e[u]=o[u])}return e}),it=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ir=/^\w*$/,ii=function(e,t){if(rx(e))return!1;var n=typeof e;return!!("number"==n||"symbol"==n||"boolean"==n||null==e||na(e))||ir.test(e)||!it.test(e)||null!=t&&e in Object(t)};function io(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(io.Cache||n5),n}io.Cache=n5;var is=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,il=/\\(\\)?/g,ia=(b=(y=io(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(is,function(e,n,r,i){t.push(r?i.replace(il,"$1"):n||e)}),t},function(e){return 500===b.size&&b.clear(),e})).cache,y),iu=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},ic=1/0,ih=t8?t8.prototype:void 0,id=ih?ih.toString:void 0,ig=function e(t){if("string"==typeof t)return t;if(rx(t))return iu(t,e)+"";if(na(t))return id?id.call(t):"";var n=t+"";return"0"==n&&1/t==-ic?"-0":n},ip=function(e){return null==e?"":ig(e)},im=function(e,t){return rx(e)?e:ii(e,t)?[e]:ia(ip(e))},iy=1/0,ib=function(e){if("string"==typeof e||na(e))return e;var t=e+"";return"0"==t&&1/e==-iy?"-0":t},iv=function(e,t){t=im(t,e);for(var n=0,r=t.length;null!=e&&n<r;)e=e[ib(t[n++])];return n&&n==r?e:void 0},ix=function(e,t,n,r){if(!t0(e))return e;t=im(t,e);for(var i=-1,o=t.length,s=o-1,l=e;null!=l&&++i<o;){var a=ib(t[i]),u=n;if("__proto__"===a||"constructor"===a||"prototype"===a)break;if(i!=s){var c=l[a];void 0===(u=r?r(c,a,l):void 0)&&(u=t0(c)?c:rW(t[i+1])?[]:{})}rU(l,a,u),l=l[a]}return e},iw=function(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],l=iv(e,s);n(l,s)&&ix(o,im(s,e),l)}return o},iC=function(e,t){return null!=e&&t in Object(e)},iE=function(e,t,n){t=im(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=ib(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&rw(i)&&rW(s,i)&&(rx(e)||rv(e))},iS=function(e,t){return null!=e&&iE(e,t,iC)},iP=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},ik=t8?t8.isConcatSpreadable:void 0,iO=function(e){return rx(e)||rv(e)||!!(ik&&e&&e[ik])},iM=function e(t,n,r,i,o){var s=-1,l=t.length;for(r||(r=iO),o||(o=[]);++s<l;){var a=t[s];n>0&&r(a)?n>1?e(a,n-1,r,i,o):iP(o,a):i||(o[o.length]=a)}return o},iA=nH(nT(v=function(e,t){return null==e?{}:iw(e,t,function(t,n){return iS(e,n)})},void 0,function(e){return(null==e?0:e.length)?iM(e,1):[]}),v+""),iT=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e},iN=rc(Object.keys,Object),ij=Object.prototype.hasOwnProperty,iL=function(e){if(!rf(e))return iN(e);var t=[];for(var n in Object(e))ij.call(e,n)&&"constructor"!=n&&t.push(n);return t},iR=function(e){return rC(e)?rX(e):iL(e)},iI=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o},i_=function(){return[]},iz=Object.prototype.propertyIsEnumerable,iD=Object.getOwnPropertySymbols,iB=iD?function(e){return null==e?[]:iI(iD(e=Object(e)),function(t){return iz.call(e,t)})}:i_,iV=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)iP(t,iB(e)),e=rh(e);return t}:i_,iF=function(e,t,n){var r=t(e);return rx(e)?r:iP(r,n(e))},i$=function(e){return iF(e,iR,iB)},iU=function(e){return iF(e,rK,iV)},iG=n$(t3,"DataView"),iH=n$(t3,"Promise"),iq=n$(t3,"Set"),iW=n$(t3,"WeakMap"),iJ="[object Map]",iX="[object Promise]",iY="[object Set]",iQ="[object WeakMap]",iZ="[object DataView]",iK=nI(iG),i0=nI(nQ),i1=nI(iH),i2=nI(iq),i3=nI(iW),i5=ns;(iG&&i5(new iG(new ArrayBuffer(1)))!=iZ||nQ&&i5(new nQ)!=iJ||iH&&i5(iH.resolve())!=iX||iq&&i5(new iq)!=iY||iW&&i5(new iW)!=iQ)&&(i5=function(e){var t=ns(e),n="[object Object]"==t?e.constructor:void 0,r=n?nI(n):"";if(r)switch(r){case iK:return iZ;case i0:return iJ;case i1:return iX;case i2:return iY;case i3:return iQ}return t});var i6=i5,i4=Object.prototype.hasOwnProperty,i9=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&i4.call(e,"index")&&(n.index=e.index,n.input=e.input),n},i8=function(e,t){var n=t?ro(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},i7=/\w*$/,oe=function(e){var t=new e.constructor(e.source,i7.exec(e));return t.lastIndex=e.lastIndex,t},ot=t8?t8.prototype:void 0,on=ot?ot.valueOf:void 0,or=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return ro(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return i8(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return rs(e,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return oe(e);case"[object Symbol]":return on?Object(on.call(e)):{}}},oi=rD&&rD.isMap,oo=oi?rR(oi):function(e){return nl(e)&&"[object Map]"==i6(e)},os=rD&&rD.isSet,ol=os?rR(os):function(e){return nl(e)&&"[object Set]"==i6(e)},oa="[object Arguments]",ou="[object Function]",oc="[object Object]",oh={};oh[oa]=oh["[object Array]"]=oh["[object ArrayBuffer]"]=oh["[object DataView]"]=oh["[object Boolean]"]=oh["[object Date]"]=oh["[object Float32Array]"]=oh["[object Float64Array]"]=oh["[object Int8Array]"]=oh["[object Int16Array]"]=oh["[object Int32Array]"]=oh["[object Map]"]=oh["[object Number]"]=oh[oc]=oh["[object RegExp]"]=oh["[object Set]"]=oh["[object String]"]=oh["[object Symbol]"]=oh["[object Uint8Array]"]=oh["[object Uint8ClampedArray]"]=oh["[object Uint16Array]"]=oh["[object Uint32Array]"]=!0,oh["[object Error]"]=oh[ou]=oh["[object WeakMap]"]=!1;var od=function e(t,n,r,i,o,s){var l,a=1&n,u=2&n,c=4&n;if(r&&(l=o?r(t,i,o,s):r(t)),void 0!==l)return l;if(!t0(t))return t;var h=rx(t);if(h){if(l=i9(t),!a)return rl(t,l)}else{var d,f,g,p,m=i6(t),y=m==ou||"[object GeneratorFunction]"==m;if(rO(t))return rr(t,a);if(m==oc||m==oa||y&&!o){if(l=u||y?{}:rg(t),!a)return u?(f=(d=l)&&rG(t,rK(t),d),rG(t,iV(t),f)):(p=(g=l)&&rG(t,iR(t),g),rG(t,iB(t),p))}else{if(!oh[m])return o?t:{};l=or(t,m,a)}}s||(s=new n6);var b=s.get(t);if(b)return b;s.set(t,l),ol(t)?t.forEach(function(i){l.add(e(i,n,r,i,t,s))}):oo(t)&&t.forEach(function(i,o){l.set(o,e(i,n,r,o,t,s))});var v=c?u?iU:i$:u?rK:iR,x=h?void 0:v(t);return iT(x||t,function(i,o){x&&(i=t[o=i]),rU(l,o,e(i,n,r,o,t,s))}),l},of=function(e){return od(e,5)},og=Object.prototype.hasOwnProperty,op=function(e){if(null==e)return!0;if(rC(e)&&(rx(e)||"string"==typeof e||"function"==typeof e.splice||rO(e)||rV(e)||rv(e)))return!e.length;var t=i6(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(rf(e))return!iL(e).length;for(var n in e)if(og.call(e,n))return!1;return!0},om=Object.prototype.hasOwnProperty,oy=function(e,t){return null!=e&&om.call(e,t)},ob=function(e,t){return null!=e&&iE(e,t,oy)},ov=function(e){return od(e,4)};function ox(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new n5;++t<n;)this.add(e[t])}ox.prototype.add=ox.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ox.prototype.has=function(e){return this.__data__.has(e)};var ow=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},oC=function(e,t){return e.has(t)},oE=function(e,t,n,r,i,o){var s=1&n,l=e.length,a=t.length;if(l!=a&&!(s&&a>l))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var h=-1,d=!0,f=2&n?new ox:void 0;for(o.set(e,t),o.set(t,e);++h<l;){var g=e[h],p=t[h];if(r)var m=s?r(p,g,h,t,e,o):r(g,p,h,e,t,o);if(void 0!==m){if(m)continue;d=!1;break}if(f){if(!ow(t,function(e,t){if(!oC(f,t)&&(g===e||i(g,e,n,r,o)))return f.push(t)})){d=!1;break}}else if(!(g===p||i(g,p,n,r,o))){d=!1;break}}return o.delete(e),o.delete(t),d},oS=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},oP=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},ok=t8?t8.prototype:void 0,oO=ok?ok.valueOf:void 0,oM=function(e,t,n,r,i,o,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!o(new ri(e),new ri(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return nW(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=oS;case"[object Set]":var a=1&r;if(l||(l=oP),e.size!=t.size&&!a)break;var u=s.get(e);if(u)return u==t;r|=2,s.set(e,t);var c=oE(l(e),l(t),r,i,o,s);return s.delete(e),c;case"[object Symbol]":if(oO)return oO.call(e)==oO.call(t)}return!1},oA=Object.prototype.hasOwnProperty,oT=function(e,t,n,r,i,o){var s=1&n,l=i$(e),a=l.length;if(a!=i$(t).length&&!s)return!1;for(var u=a;u--;){var c=l[u];if(!(s?c in t:oA.call(t,c)))return!1}var h=o.get(e),d=o.get(t);if(h&&d)return h==t&&d==e;var f=!0;o.set(e,t),o.set(t,e);for(var g=s;++u<a;){var p=e[c=l[u]],m=t[c];if(r)var y=s?r(m,p,c,t,e,o):r(p,m,c,e,t,o);if(!(void 0===y?p===m||i(p,m,n,r,o):y)){f=!1;break}g||(g="constructor"==c)}if(f&&!g){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(f=!1)}return o.delete(e),o.delete(t),f},oN="[object Arguments]",oj="[object Array]",oL="[object Object]",oR=Object.prototype.hasOwnProperty,oI=function(e,t,n,r,i,o){var s=rx(e),l=rx(t),a=s?oj:i6(e),u=l?oj:i6(t);a=a==oN?oL:a,u=u==oN?oL:u;var c=a==oL,h=u==oL,d=a==u;if(d&&rO(e)){if(!rO(t))return!1;s=!0,c=!1}if(d&&!c)return o||(o=new n6),s||rV(e)?oE(e,t,n,r,i,o):oM(e,t,a,n,r,i,o);if(!(1&n)){var f=c&&oR.call(e,"__wrapped__"),g=h&&oR.call(t,"__wrapped__");if(f||g){var p=f?e.value():e,m=g?t.value():t;return o||(o=new n6),i(p,m,n,r,o)}}return!!d&&(o||(o=new n6),oT(e,t,n,r,i,o))},o_=function e(t,n,r,i,o){return t===n||(null!=t&&null!=n&&(nl(t)||nl(n))?oI(t,n,r,i,e,o):t!=t&&n!=n)},oz=function(e,t){return o_(e,t)};function oD(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{"constructor"!==n&&Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})}let oB=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 oV(e,t){function n(){this.constructor=e}oB(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}let oF=/^\s*class\s+/.test(`${class{}}`)||/^\s*class\s*\{/.test(`${class{}}`);function o$(e,t){let n;return oF?n=class extends t{}:oV(n=function(){return t.apply(this,arguments)},t),Object.defineProperty(n,"name",{value:e}),n}function oU(e,t){return null!=e?e:t}function oG(e,t,n){let r=null!=e?e[t]:null;return void 0!==n?oU(r,n):r}function oH(e,t,n){let r=null!=e?e[t]:null;return null==r||Number.isNaN(r*=1)||!Number.isFinite(r)?n:r}function oq(e,t,n){let r=null!=e?e[t]:null;return null==r?n:!!r}function oW(e){return"__proto__"===e}function oJ(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))return;r=r[e]}return r}function oX(e,t,n,r="/"){let i=Array.isArray(t)?t:t.split(r),o=i.pop();if(o&&!oW(o)){let t=e;i.forEach(e=>{oW(e)||(null==t[e]&&(t[e]={}),t=t[e])}),t[o]=n}return e}function oY(e,t,n="/"){let r=Array.isArray(t)?t.slice():t.split(n),i=r.pop();if(i)if(r.length>0){let t=oJ(e,r);t&&delete t[i]}else delete e[i];return e}class oQ extends nk{dispose(){this.off()}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([tZ.dispose()],oQ.prototype,"dispose",null),(oQ||(oQ={})).dispose=tZ.dispose,oD(oQ,tZ);var oZ=Math.floor,oK=Math.min,o0=function(e,t,n,r){var i=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=n(t))!=t,l=null===t,a=na(t),u=void 0===t;i<o;){var c=oZ((i+o)/2),h=n(e[c]),d=void 0!==h,f=null===h,g=h==h,p=na(h);if(s)var m=r||g;else m=u?g&&(r||d):l?g&&d&&(r||!f):a?g&&d&&!f&&(r||!p):!f&&!p&&(r?h<=t:h<t);m?i=c+1:o=c}return oK(o,0xfffffffe)},o1=function(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=0x7fffffff){for(;r<i;){var o=r+i>>>1,s=e[o];null!==s&&!na(s)&&(n?s<=t:s<t)?r=o+1:i=o}return i}return o0(e,t,nM,n)},o2=function(e,t){return o1(e,t)},o3=function(e,t,n){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=t(o);if(null!=s&&(void 0===l?s==s&&!na(s):n(s,l)))var l=s,a=o}return a},o5=function(e,t){return e>t},o6=function(e){return e&&e.length?o3(e,nM,o5):void 0},o4=function(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r},o9=(x=function(e,t){return e&&n8(e,t,iR)},function(e,t){if(null==e)return e;if(!rC(e))return x(e,t);for(var n=e.length,r=-1,i=Object(e);(w?r--:++r<n)&&!1!==t(i[r],r,i););return e}),o8=function(e,t,n,r){return o9(e,function(e,i,o){t(r,e,n(e),o)}),r},o7=function(e,t,n,r){var i=n.length,o=i,s=!r;if(null==e)return!o;for(e=Object(e);i--;){var l=n[i];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<o;){var a=(l=n[i])[0],u=e[a],c=l[1];if(s&&l[2]){if(void 0===u&&!(a in e))return!1}else{var h=new n6;if(r)var d=r(u,c,a,e,t,h);if(!(void 0===d?o_(c,u,3,r,h):d))return!1}}return!0},se=function(e){return e==e&&!t0(e)},st=function(e){for(var t=iR(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,se(i)]}return t},sn=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}},sr=function(e){var t=st(e);return 1==t.length&&t[0][2]?sn(t[0][0],t[0][1]):function(n){return n===e||o7(n,e,t)}},si=function(e,t,n){var r=null==e?void 0:iv(e,t);return void 0===r?n:r},so=function(e){var t;return ii(e)?(t=ib(e),function(e){return null==e?void 0:e[t]}):function(t){return iv(t,e)}},ss=function(e){if("function"==typeof e)return e;if(null==e)return nM;if("object"==typeof e){var t,n;return rx(e)?(t=e[0],n=e[1],ii(t)&&se(n)?sn(ib(t),n):function(e){var r=si(e,t);return void 0===r&&r===n?iS(e,t):o_(n,r,3)}):sr(e)}return so(e)},sl=Object.prototype.hasOwnProperty,sa=(C=function(e,t,n){sl.call(e,n)?e[n].push(t):n4(e,n,[t])},function(e,t){return(rx(e)?o4:o8)(e,C,ss(t,2),{})}),su=function(e,t,n){return o0(e,t,ss(n,2))},sc=function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return -1},sh=function(e){return e!=e},sd=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return -1},sf=function(e,t){return!!(null==e?0:e.length)&&(t==t?sd(e,t,0):sc(e,sh,0))>-1},sg=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1},sp=iq&&1/oP(new iq([,-0]))[1]==1/0?function(e){return new iq(e)}:function(){},sm=function(e,t,n){var r=-1,i=sf,o=e.length,s=!0,l=[],a=l;if(n)s=!1,i=sg;else if(o>=200){var u=t?null:sp(e);if(u)return oP(u);s=!1,i=oC,a=new ox}else a=t?[]:l;e:for(;++r<o;){var c=e[r],h=t?t(c):c;if(c=n||0!==c?c:0,s&&h==h){for(var d=a.length;d--;)if(a[d]===h)continue e;t&&a.push(h),l.push(c)}else i(a,h,n)||(a!==l&&a.push(h),l.push(c))}return l},sy=nq(function(e){return sm(iM(e,1,rE,!0))}),sb=function(e,t,n,r){var i=-1,o=sf,s=!0,l=e.length,a=[],u=t.length;if(!l)return a;n&&(t=iu(t,rR(n))),r?(o=sg,s=!1):t.length>=200&&(o=oC,s=!1,t=new ox(t));e:for(;++i<l;){var c=e[i],h=null==n?c:n(c);if(c=r||0!==c?c:0,s&&h==h){for(var d=u;d--;)if(t[d]===h)continue e;a.push(c)}else o(t,h,r)||a.push(c)}return a},sv=nq(function(e,t){return rE(e)?sb(e,iM(t,1,rE,!0)):[]}),sx=function(e,t){var n=-1,r=rC(e)?Array(e.length):[];return o9(e,function(e,i,o){r[++n]=t(e,i,o)}),r},sw=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e},sC=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=na(e),s=void 0!==t,l=null===t,a=t==t,u=na(t);if(!l&&!u&&!o&&e>t||o&&s&&a&&!l&&!u||r&&s&&a||!n&&a||!i)return 1;if(!r&&!o&&!u&&e<t||u&&n&&i&&!r&&!o||l&&n&&i||!s&&i||!a)return -1}return 0},sE=function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,l=n.length;++r<s;){var a=sC(i[r],o[r]);if(a){if(r>=l)return a;return a*("desc"==n[r]?-1:1)}}return e.index-t.index},sS=function(e,t,n){t=t.length?iu(t,function(e){return rx(e)?function(t){return iv(t,1===e.length?e[0]:e)}:e}):[nM];var r=-1;return t=iu(t,rR(ss)),sw(sx(e,function(e,n,i){return{criteria:iu(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return sE(e,t,n)})},sP=nq(function(e,t){if(null==e)return[];var n=t.length;return n>1&&r3(e,t[0],t[1])?t=[]:n>2&&r3(t[0],t[1],t[2])&&(t=[t[0]]),sS(e,iM(t,1),[])}),sk=function(e){return e&&e.length?sm(e):[]},sO=function(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n},sM=(E={À:"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"},function(e){return null==E?void 0:E[e]}),sA=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,sT=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),sN=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,sj=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,sL="\ud800-\udfff",sR="\\u2700-\\u27bf",sI="a-z\\xdf-\\xf6\\xf8-\\xff",s_="A-Z\\xc0-\\xd6\\xd8-\\xde",sz="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",sD="['’]",sB="["+sz+"]",sV="["+sI+"]",sF="[^"+sL+sz+"\\d+"+sR+sI+s_+"]",s$="(?:\ud83c[\udde6-\uddff]){2}",sU="[\ud800-\udbff][\udc00-\udfff]",sG="["+s_+"]",sH="(?:"+sV+"|"+sF+")",sq="(?:"+sG+"|"+sF+")",sW="(?:"+sD+"(?:d|ll|m|re|s|t|ve))?",sJ="(?:"+sD+"(?:D|LL|M|RE|S|T|VE))?",sX="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\ud83c[\udffb-\udfff])?",sY="[\\ufe0e\\ufe0f]?",sQ="(?:\\u200d(?:"+["[^"+sL+"]",s$,sU].join("|")+")"+sY+sX+")*",sZ="(?:"+["["+sR+"]",s$,sU].join("|")+")"+(sY+sX+sQ),sK=RegExp([sG+"?"+sV+"+"+sW+"(?="+[sB,sG,"$"].join("|")+")",sq+"+"+sJ+"(?="+[sB,sG+sH,"$"].join("|")+")",sG+"?"+sH+"+"+sW,sG+"+"+sJ,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",sZ].join("|"),"g"),s0=function(e,t,n){if(e=ip(e),void 0===(t=n?void 0:t)){var r;return(r=e,sj.test(r))?e.match(sK)||[]:e.match(sN)||[]}return e.match(t)||[]},s1=RegExp("['’]","g"),s2=function(e){return function(t){var n;return sO(s0(((n=ip(n=t))&&n.replace(sA,sM).replace(sT,"")).replace(s1,"")),e,"")}},s3=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o},s5=function(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:s3(e,t,n)},s6=RegExp("[\\u200d\ud800-\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),s4=function(e){return s6.test(e)},s9="\ud800-\udfff",s8="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",s7="\ud83c[\udffb-\udfff]",le="[^"+s9+"]",lt="(?:\ud83c[\udde6-\uddff]){2}",ln="[\ud800-\udbff][\udc00-\udfff]",lr="(?:"+s8+"|"+s7+")?",li="[\\ufe0e\\ufe0f]?",lo="(?:\\u200d(?:"+[le,lt,ln].join("|")+")"+li+lr+")*",ls=RegExp(s7+"(?="+s7+")|"+("(?:"+[le+s8+"?",s8,lt,ln,"["+s9+"]"].join("|"))+")"+(li+lr+lo),"g"),ll=function(e){return function(t){var n,r=s4(t=ip(t))?s4(n=t)?n.match(ls)||[]:n.split(""):void 0,i=r?r[0]:t.charAt(0),o=r?s5(r,1).join(""):t.slice(1);return i[e]()+o}},la=ll("toUpperCase"),lu=s2(function(e,t,n){return e+(n?" ":"")+la(t)}),lc=s2(function(e,t,n){return t=t.toLowerCase(),e+(n?la(ip(t).toLowerCase()):t)}),lh=s2(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ld=s2(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),lf=ll("toLowerCase");let lg=e=>{let t=Object.create(null);return n=>t[n]||(t[n]=e(n))},lp=lg(e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase()),lm=lg(e=>lu(lc(e)).replace(/ /g,""));function ly(e){let t=0x811c9dc5,n=!1,r=e;for(let e=0,i=r.length;e<i;e+=1){let i=r.charCodeAt(e);i>127&&!n&&(i=(r=unescape(encodeURIComponent(r))).charCodeAt(e),n=!0),t^=i,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function lb(){let e="",t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let n=0,r=t.length;n<r;n+=1){let r=t[n],i=16*Math.random()|0;e+=("x"===r?i:"y"===r?3&i|8:r).toString(16)}return e}lg(e=>lh(e).replace(/ /g,"_")),lg(e=>ld(e).replace(/ /g,".")),lg(e=>ld(e).replace(/ /g,"/")),lg(e=>la(ld(e))),lg(e=>lu(lc(e)));var lv=function(e){return"number"==typeof e||nl(e)&&"[object Number]"==ns(e)},lx=function(e,t,n){var r,i,o;return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=ng(n))==n?n:0),void 0!==t&&(t=(t=ng(t))==t?t:0),r=ng(e),i=t,o=n,r==r&&(void 0!==o&&(r=r<=o?r:o),void 0!==i&&(r=r>=i?r:i)),r};function lw(e,t){return(e%t+t)%t}function lC(e,t){if(null==t)t=null==e?1:e,e=0;else if(t<e){let n=e;e=t,t=n}return Math.floor(Math.random()*(t-e+1)+e)}function lE(e){return"string"==typeof e&&"%"===e.slice(-1)}function lS(e,t){let n;if(null==e)return 0;if("string"==typeof e){if(n=parseFloat(e),lE(e)&&Number.isFinite(n/=100))return n*t}else n=e;return Number.isFinite(n)?n>0&&n<1?n*t:n:0}function lP(e,t){let n,r=parseFloat(e);if(Number.isNaN(r))return null;if(null==t)n="[A-Za-z]*";else if(Array.isArray(t)){if(0===t.length)return null;n=t.join("|")}else"string"==typeof t&&(n=t);let i=function(t){let n=RegExp(`(?:\\d+(?:\\.\\d+)*)(${t})$`).exec(e);return n?n[1]:null}(n);return null===i?null:{unit:i,value:r}}function lk(e){if("object"==typeof e){let t=0,n=0,r=0,i=0;return null!=e.vertical&&Number.isFinite(e.vertical)&&(n=i=e.vertical),null!=e.horizontal&&Number.isFinite(e.horizontal)&&(r=t=e.horizontal),null!=e.left&&Number.isFinite(e.left)&&(t=e.left),null!=e.top&&Number.isFinite(e.top)&&(n=e.top),null!=e.right&&Number.isFinite(e.right)&&(r=e.right),null!=e.bottom&&Number.isFinite(e.bottom)&&(i=e.bottom),{top:n,right:r,bottom:i,left:t}}let t=0;return null!=e&&Number.isFinite(e)&&(t=e),{top:t,right:t,bottom:t,left:t}}let lO=!1,lM=!1,lA=!1,lT=!1,lN=!1,lj=!1,lL=!1,lR=!1,lI=!1,l_=!1,lz=!1,lD=!1,lB=!1,lV=!1,lF=!1,l$=!1;if("object"==typeof navigator){let e=navigator.userAgent;lO=e.indexOf("Macintosh")>=0,lM=!!e.match(/(iPad|iPhone|iPod)/g),lA=e.indexOf("Windows")>=0,lT=e.indexOf("MSIE")>=0,lN=!!e.match(/Trident\/7\./),lj=!!e.match(/Edge\//),lL=e.indexOf("Mozilla/")>=0&&0>e.indexOf("MSIE")&&0>e.indexOf("Edge/"),lI=e.indexOf("Chrome/")>=0&&0>e.indexOf("Edge/"),l_=e.indexOf("Opera/")>=0||e.indexOf("OPR/")>=0,lz=e.indexOf("Firefox/")>=0,lD=e.indexOf("AppleWebKit/")>=0&&0>e.indexOf("Chrome/")&&0>e.indexOf("Edge/"),"object"==typeof document&&(l$=!document.createElementNS||"[object SVGForeignObjectElement]"!=`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`||e.indexOf("Opera/")>=0)}if("object"==typeof window&&(lR=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,lV=null!=window.PointerEvent&&!lO),"object"==typeof document){lB="ontouchstart"in document.documentElement;try{let e=Object.defineProperty({},"passive",{get(){lF=!0}}),t=document.createElement("div");t.addEventListener&&t.addEventListener("click",()=>{},e)}catch(e){}}(S=e2||(e2={})).IS_MAC=lO,S.IS_IOS=lM,S.IS_WINDOWS=lA,S.IS_IE=lT,S.IS_IE11=lN,S.IS_EDGE=lj,S.IS_NETSCAPE=lL,S.IS_CHROME_APP=lR,S.IS_CHROME=lI,S.IS_OPERA=l_,S.IS_FIREFOX=lz,S.IS_SAFARI=lD,S.SUPPORT_TOUCH=lB,S.SUPPORT_POINTER=lV,S.SUPPORT_PASSIVE=lF,S.NO_FOREIGNOBJECT=l$,S.SUPPORT_FOREIGNOBJECT=!S.NO_FOREIGNOBJECT;var lU=e2||(e2={});function lG(){let e=window.module;return null!=e&&null!=e.hot&&null!=e.hot.status?e.hot.status():"unkonwn"}lU.getHMRStatus=lG,lU.isApplyingHMR=function(){return"apply"===lG()};let lH={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};lU.isEventSupported=function(e){let t=document.createElement(lH[e]||"div"),n=`on${e}`,r=n in t;return r||(t.setAttribute(n,"return;"),r="function"==typeof t[n]),r};let lq=/[\t\r\n\f]/g,lW=/\S+/g,lJ=e=>` ${e} `;function lX(e){return e&&e.getAttribute&&e.getAttribute("class")||""}function lY(e,t){if(null==e||null==t)return!1;let n=lJ(lX(e)),r=lJ(t);return 1===e.nodeType&&n.replace(lq," ").includes(r)}function lQ(e,t){if(null!=e&&null!=t){if("function"==typeof t)return lQ(e,t(lX(e)));if("string"==typeof t&&1===e.nodeType){let n=t.match(lW)||[],r=lJ(lX(e)).replace(lq," "),i=n.reduce((e,t)=>0>e.indexOf(lJ(t))?`${e}${t} `:e,r);r!==(i=i.trim())&&e.setAttribute("class",i)}}}function lZ(e,t){if(null!=e){if("function"==typeof t)return lZ(e,t(lX(e)));if((!t||"string"==typeof t)&&1===e.nodeType){let n=(t||"").match(lW)||[],r=lJ(lX(e)).replace(lq," "),i=n.reduce((e,t)=>{let n=lJ(t);return e.indexOf(n)>-1?e.replace(n," "):e},r);r!==(i=t?i.trim():"")&&e.setAttribute("class",i)}}}function lK(e,t,n){if(null!=e&&null!=t){if(null!=n&&"string"==typeof t)return void(n?lQ(e,t):lZ(e,t));if("function"==typeof t)return lK(e,t(lX(e),n),n);"string"==typeof t&&(t.match(lW)||[]).forEach(t=>{lY(e,t)?lZ(e,t):lQ(e,t)})}}let l0=0;function l1(){return l0+=1,`v${l0}`}function l2(e){return(null==e.id||""===e.id)&&(e.id=l1()),e.id}function l3(e){return null!=e&&"function"==typeof e.getScreenCTM&&e instanceof SVGElement}let l5={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"},l6="1.1";function l4(e,t=document){return t.createElement(e)}function l9(e,t=l5.xhtml,n=document){return n.createElementNS(t,e)}function l8(e,t=document){return l9(e,l5.svg,t)}function l7(e){if(e){let{documentElement:t}=ae(`<svg xmlns="${l5.svg}" xmlns:xlink="${l5.xlink}" version="${l6}">${e}</svg>`,{async:!1});return t}let t=document.createElementNS(l5.svg,"svg");return t.setAttributeNS(l5.xmlns,"xmlns:xlink",l5.xlink),t.setAttribute("version",l6),t}function ae(e,t={}){let n;try{let r=new DOMParser;null!=t.async&&(r.async=t.async),n=r.parseFromString(e,t.mimeType||"text/xml")}catch(e){n=void 0}if(!n||n.getElementsByTagName("parsererror").length)throw Error(`Invalid XML: ${e}`);return n}function at(e,t=!0){let n=e.nodeName;return t?n.toLowerCase():n.toUpperCase()}function an(e){let t=0,n=e.previousSibling;for(;n;)1===n.nodeType&&(t+=1),n=n.previousSibling;return t}function ar(e,t){return e.querySelectorAll(t)}function ai(e,t){return e.querySelector(t)}function ao(e,t,n){let r=e.ownerSVGElement,i=e.parentNode;for(;i&&i!==n&&i!==r;){if(lY(i,t))return i;i=i.parentNode}return null}function as(e,t){let n=t&&t.parentNode;return e===n||!!(n&&1===n.nodeType&&16&e.compareDocumentPosition(n))}function al(e){e&&(Array.isArray(e)?e:[e]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}function aa(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function au(e,t){(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&e.appendChild(t)})}function ac(e,t){let n=e.firstChild;return n?ah(n,t):au(e,t)}function ah(e,t){let n=e.parentNode;n&&(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&n.insertBefore(t,e)})}function ad(e,t){let n=e.parentNode;n&&(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&n.insertBefore(t,e.nextSibling)})}function af(e,t){null!=t&&t.appendChild(e)}function ag(e){return!!e&&1===e.nodeType}function ap(e){try{return e instanceof HTMLElement}catch(t){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}}function am(e,t){let n=[],r=e.firstChild;for(;r;r=r.nextSibling)1===r.nodeType&&(!t||lY(r,t))&&n.push(r);return n}let ay=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function ab(e,t){return e.getAttribute(t)}function av(e,t){let n=aE(t);n.ns?e.hasAttributeNS(n.ns,n.local)&&e.removeAttributeNS(n.ns,n.local):e.hasAttribute(t)&&e.removeAttribute(t)}function ax(e,t,n){if(null==n)return av(e,t);let r=aE(t);r.ns&&"string"==typeof n?e.setAttributeNS(r.ns,t,n):"id"===t?e.id=`${n}`:e.setAttribute(t,`${n}`)}function aw(e,t){Object.keys(t).forEach(n=>{ax(e,n,t[n])})}function aC(e,t,n){if(null==t){let t=e.attributes,n={};for(let e=0;e<t.length;e+=1)n[t[e].name]=t[e].value;return n}if("string"==typeof t&&void 0===n)return e.getAttribute(t);"object"==typeof t?aw(e,t):ax(e,t,n)}function aE(e){if(-1!==e.indexOf(":")){let t=e.split(":");return{ns:l5[t[0]],local:t[1]}}return{ns:null,local:e}}function aS(e){let t={};return Object.keys(e).forEach(n=>{t[ay.includes(n)?n:lp(n)]=e[n]}),t}function aP(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 ak(e,t){return Object.keys(t).forEach(n=>{if("class"===n)e[n]=e[n]?`${e[n]} ${t[n]}`:t[n];else if("style"===n){let r,i,o="object"==typeof e[n],s="object"==typeof t[n];o&&s?(r=e[n],i=t[n]):o?(r=e[n],i=aP(t[n])):s?(r=aP(e[n]),i=t[n]):(r=aP(e[n]),i=aP(t[n])),e[n]=ak(r,i)}else e[n]=t[n]}),e}!function(e){function t(e){let t="data:";return e.substr(0,t.length)===t}function n(e){let t,n=e.replace(/\s/g,""),r=(n=decodeURIComponent(n)).indexOf(","),i=n.slice(0,r),o=i.split(":")[1].split(";")[0],s=n.slice(r+1),l=new Uint8Array((t=i.indexOf("base64")>=0?atob(s):unescape(encodeURIComponent(s))).length);for(let e=0;e<t.length;e+=1)l[e]=t.charCodeAt(e);return new Blob([l],{type:o})}function r(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)}}function i(e){let t=parseFloat(e);return Number.isNaN(t)?null:t}e.isDataUrl=t,e.imageToDataUri=function(e,n){if(!e||t(e))return void setTimeout(()=>n(null,e));let r=()=>{n(Error(`Failed to load image: ${e}`))},i=window.FileReader?e=>{if(200===e.status){let t=new FileReader;t.onload=e=>{n(null,e.target.result)},t.onerror=r,t.readAsDataURL(e.response)}else r()}:t=>{if(200===t.status){let r=e.split(".").pop()||"png";"svg"===r&&(r="svg+xml"),n(null,`data:image/${r};base64,`+btoa((e=>{let t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return t.join("")})(new Uint8Array(t.response))))}else r()},o=new XMLHttpRequest;o.responseType=window.FileReader?"blob":"arraybuffer",o.open("GET",e,!0),o.addEventListener("error",r),o.addEventListener("load",()=>i(o)),o.send()},e.dataUriToBlob=n,e.downloadBlob=r,e.downloadDataUri=function(e,t){r(n(e),t)},e.svgToDataUrl=function(e,t={}){let n=null,r=t=>(null==n&&(n=function(e){let t=e.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return t&&t[2]?t[2].replace(/\s+/," ").split(" "):null}(e)),null!=n)?i(n[t]):null,o=t=>{let n=e.match(t);return n&&n[2]?i(n[2]):null},s=t.width;if(null==s&&(s=o(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==s&&(s=r(2)),null==s)throw Error("Can not parse width from svg string");let l=t.height;if(null==l&&(l=o(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==l&&(l=r(3)),null==l)throw Error("Can not parse height from svg string");let a=encodeURIComponent(e).replace(/'/g,"%27").replace(/"/g,"%22");return`data:image/svg+xml,${a}`}}(e3||(e3={}));let aO={px:e=>e,mm:e=>r*e,cm:e=>r*e*10,in:e=>r*e*25.4,pt:e=>25.4*e/72*r,pc:e=>25.4*e/6*r};var aM=e5||(e5={});function aA(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 o=r.getBoundingClientRect(),s={width:o.width||0,height:o.height||0};return document.body.removeChild(r),s}aM.measure=aA,aM.toPx=function(e,t){null==r&&(r=aA("1","1","mm").width);let n=t?aO[t]:null;return n?n(e):e};let aT=/-(.)/g,aN={},aj=["webkit","ms","moz","o"],aL=document?document.createElement("div").style:{};function aR(e){let t=e.replace(aT,(e,t)=>t.toUpperCase());if(null==aN[t]){let e=t.charAt(0).toUpperCase()+t.slice(1);aN[t]=t in aL?t:function(e){for(let t=0;t<aj.length;t+=1){let n=aj[t]+e;if(n in aL)return n}return null}(e)}return aN[t]}function aI(e,t,n){let r=aR(t);null!=r&&(e[r]=n),e[t]=n}function a_(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 az(e){let t=a_(e);return null!=t&&("scroll"===t.overflow||"auto"===t.overflow)}let aD=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(){}}(),aB={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 aV(e){return/^--/.test(e)}function aF(e,t,n){let r=window.getComputedStyle(e,null);return n?r.getPropertyValue(t)||void 0:r[t]||e.style[t]}function a$(e,t){return parseInt(aF(e,t),10)||0}function aU(e,t,n){if("string"==typeof t){var r,i;let o=aV(t);if(o||(t=aR(t)),void 0===n)return aF(e,t,o);o||(r=t,i=n,n=aB[r]||"number"!=typeof i?i:`${i}px`);let s=e.style;return void(o?s.setProperty(t,n):s[t]=n)}for(let n in t)aU(e,n,t[n])}let aG=new WeakMap;function aH(e,t){let n=lc(t),r=aG.get(e);if(r)return r[n]}function aq(e,t,n){let r=lc(t),i=aG.get(e);i?i[r]=n:aG.set(e,{[r]:n})}function aW(e,t,n){if(!t){let t={};return Object.keys(aG).forEach(n=>{t[n]=aH(e,n)}),t}if("string"==typeof t)return void 0===n?aH(e,t):void aq(e,t,n);for(let n in t)aW(e,n,t[n])}let aJ={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};class aX{get[Symbol.toStringTag](){return aX.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(e){this.node.id=e}constructor(e,t,n){let r;if(!e)throw TypeError("Invalid element to create vector");if(aX.isVector(e))r=e.node;else if("string"==typeof e)if("svg"===e.toLowerCase())r=l7();else if("<"===e[0]){let t=l7(e);r=document.importNode(t.firstChild,!0)}else r=document.createElementNS(l5.svg,e);else r=e;this.node=r,t&&this.setAttributes(t),n&&this.append(n)}transform(e,t){return null==e?uE(this.node):(uE(this.node,e,t),this)}translate(e,t=0,n={}){return null==e?uS(this.node):(uS(this.node,e,t,n),this)}rotate(e,t,n,r={}){return null==e?uP(this.node):(uP(this.node,e,t,n,r),this)}scale(e,t){return null==e?uk(this.node):(uk(this.node,e,t),this)}getTransformToElement(e){let t=aX.toNode(e);return uO(this.node,t)}removeAttribute(e){return av(this.node,e),this}getAttribute(e){return ab(this.node,e)}setAttribute(e,t){return ax(this.node,e,t),this}setAttributes(e){return aw(this.node,e),this}attr(e,t){return null==e?aC(this.node):"string"==typeof e&&void 0===t?aC(this.node,e):("object"==typeof e?aC(this.node,e):aC(this.node,e,t),this)}svg(){return this.node instanceof SVGSVGElement?this:aX.create(this.node.ownerSVGElement)}defs(){let e=this.svg()||this,t=e.node.getElementsByTagName("defs")[0];return t?aX.create(t):aX.create("defs").appendTo(e)}text(e,t={}){return aK(this.node,e,t),this}tagName(){return at(this.node)}clone(){return aX.create(this.node.cloneNode(!0))}remove(){return al(this.node),this}empty(){return aa(this.node),this}append(e){return au(this.node,aX.toNodes(e)),this}appendTo(e){return af(this.node,aX.isVector(e)?e.node:e),this}prepend(e){return ac(this.node,aX.toNodes(e)),this}before(e){return ah(this.node,aX.toNodes(e)),this}replace(e){return this.node.parentNode&&this.node.parentNode.replaceChild(aX.toNode(e),this.node),aX.create(e)}first(){return this.node.firstChild?aX.create(this.node.firstChild):null}last(){return this.node.lastChild?aX.create(this.node.lastChild):null}get(e){let t=this.node.childNodes[e];return t?aX.create(t):null}indexOf(e){return Array.prototype.slice.call(this.node.childNodes).indexOf(aX.toNode(e))}find(e){let t=[],n=ar(this.node,e);if(n)for(let e=0,r=n.length;e<r;e+=1)t.push(aX.create(n[e]));return t}findOne(e){let t=ai(this.node,e);return t?aX.create(t):null}findParentByClass(e,t){let n=ao(this.node,e,t);return n?aX.create(n):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(e){return as(this.node,aX.isVector(e)?e.node:e)}wrap(e){let t=aX.create(e),n=this.node.parentNode;return null!=n&&n.insertBefore(t.node,this.node),t.append(this)}parent(e){let t=this;if(null==t.node.parentNode)return null;if(t=aX.create(t.node.parentNode),null==e)return t;do if("string"==typeof e?t.matches(e):t instanceof e)break;while(t=aX.create(t.node.parentNode));return t}children(){let e=this.node.childNodes,t=[];for(let n=0;n<e.length;n+=1)1===e[n].nodeType&&t.push(aX.create(e[n]));return t}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 an(this.node)}hasClass(e){return lY(this.node,e)}addClass(e){return lQ(this.node,e),this}removeClass(e){return lZ(this.node,e),this}toggleClass(e,t){return lK(this.node,e,t),this}toLocalPoint(e,t){return uA(this.node,e,t)}sample(e=1){return this.node instanceof SVGPathElement?a6(this.node,e):[]}toPath(){return aX.create(uo(this.node))}toPathData(){return us(this.node)}}!function(e){function t(t){if(null==t)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag];return!!((null==n||n===e.toStringTag)&&t.node instanceof SVGElement)&&"function"==typeof t.sample&&"function"==typeof t.toPath}function n(t,n,r){return new e(t,n,r)}function r(e){return t(e)?e.node:e}e.toStringTag=`X6.${e.name}`,e.isVector=t,e.create=n,e.createVectors=function(e){if("<"===e[0]){let t=l7(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.toNode=r,e.toNodes=function(e){return Array.isArray(e)?e.map(e=>r(e)):[r(e)]}}(aX||(aX={}));let aY=document.createElement("canvas").getContext("2d"),aQ=/em$/;function aZ(e,t){let n=parseFloat(e);return aQ.test(e)?n*t:n}function aK(e,t,n={}){let r,i,o;t=t.replace(/ /g,"\xa0");let s=n.eol,l=n.textPath,a=n.textVerticalAnchor,u="middle"===a||"bottom"===a||"top"===a,c=n.x;void 0===c&&(c=e.getAttribute("x")||0);let h=n.includeAnnotationIndices,d=n.annotations;d&&!Array.isArray(d)&&(d=[d]);let f=n.lineHeight,g="auto"===f,p=g?"1.5em":f||"1em",m=!0,y=e.childNodes;if(1===y.length){let e=y[0];e&&"TITLE"===e.tagName.toUpperCase()&&(m=!1)}m&&aa(e),aC(e,{"xml:space":"preserve",display:t||n.displayEmpty?null:"none"});let b=aC(e,"font-size"),v=parseFloat(b);!v&&(v=16,(u||d)&&!b&&aC(e,"font-size",`${v}`)),l?("string"==typeof l&&(l={d:l}),r=function(e,t){let n=aX.create(t),r=aX.create("textPath"),i=e.d;if(i&&void 0===e["xlink:href"]){let e=aX.create("path").attr("d",i).appendTo(n.defs());r.attr("xlink:href",`#${e.id}`)}return"object"==typeof e&&r.attr(e),r.node}(l,e)):r=document.createDocumentFragment();let x=0,w=t.split("\n"),C=[],E=w.length-1;for(let e=0;e<=E;e+=1){let t;i=p;let n="v-line",a=l8("tspan"),u=w[e];if(u)if(d){let n=(t=function(e,t,n){let r,i=n.eol,o=n.baseSize,s=n.lineHeight,l=0,a={},u=t.length-1;for(let s=0;s<=u;s+=1){let a=t[s],c=null;if("object"==typeof a){let e=a.attrs,t=aX.create("tspan",e);r=t.node;let h=a.t;i&&s===u&&(h+=i),r.textContent=h;let d=e.class;d&&t.addClass(d),n.includeAnnotationIndices&&t.attr("annotations",a.annotations.join(",")),void 0===(c=parseFloat(e["font-size"]))&&(c=o),c&&c>l&&(l=c)}else i&&s===u&&(a+=i),r=document.createTextNode(a||" "),o&&o>l&&(l=o);e.appendChild(r)}return l&&(a.maxFontSize=l),s?a.lineHeight=s:l&&(a.lineHeight=1.2*l),a}(a,function(e,t,n={}){let r,i,o=n.offset||0,s=[],l=[],a=null;for(let u=0;u<e.length;u+=1){r=l[u]=e[u];for(let i=0,s=t.length;i<s;i+=1){let s=t[i],a=s.start+o,c=s.end+o;u>=a&&u<c&&("string"==typeof r?r=l[u]={t:e[u],attrs:s.attrs}:r.attrs=ak(ak({},r.attrs),s.attrs),n.includeAnnotationIndices&&(null==r.annotations&&(r.annotations=[]),r.annotations.push(i)))}(i=l[u-1])?t0(r)&&t0(i)?JSON.stringify(r.attrs)===JSON.stringify(i.attrs)?a.t+=r.t:(s.push(a),a=r):t0(r)||t0(i)?(s.push(a),a=r):a=(a||"")+r:a=r}return null!=a&&s.push(a),s}(u,d,{offset:-x,includeAnnotationIndices:h}),{eol:e!==E&&s,baseSize:v,lineHeight:g?null:p,includeAnnotationIndices:h})).lineHeight;n&&g&&0!==e&&(i=n),0===e&&(o=.8*t.maxFontSize)}else s&&e!==E&&(u+=s),a.textContent=u;else{a.textContent="-",n+=" v-empty-line";let e=a.style;e.fillOpacity=0,e.strokeOpacity=0,d&&(t={})}t&&C.push(t),e>0&&a.setAttribute("dy",i),(e>0||l)&&a.setAttribute("x",c),a.className.baseVal=n,r.appendChild(a),x+=u.length+1}if(u)if(d)i=function(e,t,n,r){let i;if(!Array.isArray(t))return 0;let o=t.length;if(!o)return 0;let s=t[0],l=aZ(s.maxFontSize,n)||n,a=0,u=aZ(r,n);for(let e=1;e<o;e+=1)a+=aZ((s=t[e]).lineHeight,n)||u;let c=aZ(s.maxFontSize,n)||n;switch(e){case"middle":i=l/2-.15*c-a/2;break;case"bottom":i=-(.25*c)-a;break;default:i=.8*l}return i}(a,C,v,p);else if("top"===a)i="0.8em";else{let e;switch(E>0?(e=(parseFloat(p)||1)*E,!aQ.test(p)&&(e/=v)):e=0,a){case"middle":i=`${.3-e/2}em`;break;case"bottom":i=`${-e-.3}em`}}else 0===a?i="0em":a?i=a:(i=0,null==e.getAttribute("y")&&e.setAttribute("y",`${o||"0.8em"}`));r.firstChild.setAttribute("dy",i),e.appendChild(r)}function a0(e,t={}){if(!e)return{width:0};let n=[],r=t["font-size"]?`${parseFloat(t["font-size"])}px`:"14px";return n.push(t["font-style"]||"normal"),n.push(t["font-variant"]||"normal"),n.push(t["font-weight"]||400),n.push(r),n.push(t["font-family"]||"sans-serif"),aY.font=n.join(" "),aY.measureText(e)}function a1(e,t,n,r={}){if(t>=n)return[e,""];let i=e.length,o={},s=Math.round(t/n*i-1);for(s<0&&(s=0);s>=0&&s<i;){let n=e.slice(0,s),i=o[n]||a0(n,r).width,l=e.slice(0,s+1),a=o[l]||a0(l,r).width;if(o[n]=i,o[l]=a,i>t)s-=1;else if(a<=t)s+=1;else break}return[e.slice(0,s),e.slice(s)]}function a2(e,t,n={},r={}){let i=t.width,o=t.height,s=r.eol||"\n",l=n.fontSize||14,a=Math.floor(o/(n.lineHeight?parseFloat(n.lineHeight):Math.ceil(1.4*l)));if(e.indexOf(s)>-1){let i=lb(),o=[];return e.split(s).map(e=>{let s=a2(e,Object.assign(Object.assign({},t),{height:Number.MAX_SAFE_INTEGER}),n,Object.assign(Object.assign({},r),{eol:i}));s&&o.push(...s.split(i))}),o.slice(0,a).join(s)}let{width:u}=a0(e,n);if(u<i)return e;let c=[],h=e,d=u,f=r.ellipsis,g=0;f&&("string"!=typeof f&&(f="…"),g=a0(f,n).width);for(let e=0;e<a;e+=1)if(d>i)if(e===a-1){let[e]=a1(h,i-g,d,n);c.push(f?`${e}${f}`:e)}else{let[e,t]=a1(h,i,d,n);c.push(e),d=a0(h=t,n).width}else{c.push(h);break}return c.join(s)}let a3=.551784;function a5(e,t,n=NaN){let r=e.getAttribute(t);if(null==r)return n;let i=parseFloat(r);return Number.isNaN(i)?n:i}function a6(e,t=1){let n,r=e.getTotalLength(),i=[],o=0;for(;o<r;)n=e.getPointAtLength(o),i.push({distance:o,x:n.x,y:n.y}),o+=t;return i}function a4(e){return["M",a5(e,"x1"),a5(e,"y1"),"L",a5(e,"x2"),a5(e,"y2")].join(" ")}function a9(e){let t=ue(e);return 0===t.length?null:`${a7(t)} Z`}function a8(e){let t=ue(e);return 0===t.length?null:a7(t)}function a7(e){let t=e.map(e=>`${e.x} ${e.y}`);return`M ${t.join(" L")}`}function ue(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 ut(e){let t=a5(e,"cx",0),n=a5(e,"cy",0),r=a5(e,"r"),i=r*a3;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 un(e){let t=a5(e,"cx",0),n=a5(e,"cy",0),r=a5(e,"rx"),i=a5(e,"ry")||r,o=r*a3,s=i*a3;return["M",t,n-i,"C",t+o,n-i,t+r,n-s,t+r,n,"C",t+r,n+s,t+o,n+i,t,n+i,"C",t-o,n+i,t-r,n+s,t-r,n,"C",t-r,n-s,t-o,n-i,t,n-i,"Z"].join(" ")}function ur(e){return ui({x:a5(e,"x",0),y:a5(e,"y",0),width:a5(e,"width",0),height:a5(e,"height",0),rx:a5(e,"rx",0),ry:a5(e,"ry",0)})}function ui(e){let t=e.x,n=e.y,r=e.width,i=e.height,o=Math.min(e.rx||e["top-rx"]||0,r/2),s=Math.min(e.rx||e["bottom-rx"]||0,r/2),l=Math.min(e.ry||e["top-ry"]||0,i/2),a=Math.min(e.ry||e["bottom-ry"]||0,i/2);return(o||s||l||a?["M",t,n+l,"v",i-l-a,"a",s,a,0,0,0,s,a,"h",r-2*s,"a",s,a,0,0,0,s,-a,"v",-(i-a-l),"a",o,l,0,0,0,-o,-l,"h",-(r-2*o),"a",o,l,0,0,0,-o,l,"Z"]:["M",t,n,"H",t+r,"V",n+i,"H",t,"V",n,"Z"]).join(" ")}function uo(e){let t=l8("path");aC(t,aC(e));let n=us(e);return n&&t.setAttribute("d",n),t}function us(e){let t=e.tagName.toLowerCase();switch(t){case"path":return e.getAttribute("d");case"line":return a4(e);case"polygon":return a9(e);case"polyline":return a8(e);case"ellipse":return un(e);case"circle":return ut(e);case"rect":return ur(e)}throw Error(`"${t}" cannot be converted to svg path element.`)}function ul(e,t,n,r){let i=2*Math.PI-1e-6,o=n,s=r;if(s<o){let e=o;o=s,s=e}let l=s-o,a=l<Math.PI?"0":"1",u=Math.cos(o),c=Math.sin(o),h=Math.cos(s),d=Math.sin(s);return l>=i?e?`M0,${t}A${t},${t} 0 1,1 0,${-t}A${t},${t} 0 1,1 0,${t}M0,${e}A${e},${e} 0 1,0 0,${-e}A${e},${e} 0 1,0 0,${e}Z`:`M0,${t}A${t},${t} 0 1,1 0,${-t}A${t},${t} 0 1,1 0,${t}Z`:e?`M${t*u},${t*c}A${t},${t} 0 ${a},1 ${t*h},${t*d}L${e*h},${e*d}A${e},${e} 0 ${a},0 ${e*u},${e*c}Z`:`M${t*u},${t*c}A${t},${t} 0 ${a},1 ${t*h},${t*d}L0,0Z`}let ua=l8("svg"),uu=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,uc=/[ ,]+/,uh=/^(\w+)\((.*)\)/;function ud(e,t){let n=ua.createSVGPoint();return n.x=e,n.y=t,n}function uf(e){let t=ua.createSVGMatrix();if(null!=e)for(let n in e)t[n]=e[n];return t}function ug(e){return null!=e?(e instanceof DOMMatrix||(e=uf(e)),ua.createSVGTransformFromMatrix(e)):ua.createSVGTransform()}function up(e){let t=uf(),n=null!=e&&e.match(uu);if(!n)return t;for(let e=0,r=n.length;e<r;e+=1){let r=n[e].match(uh);if(r){let e,n,i,o,s,l=uf(),a=r[2].split(uc);switch(r[1].toLowerCase()){case"scale":e=parseFloat(a[0]),n=void 0===a[1]?e:parseFloat(a[1]),l=l.scaleNonUniform(e,n);break;case"translate":i=parseFloat(a[0]),o=parseFloat(a[1]),l=l.translate(i,o);break;case"rotate":s=parseFloat(a[0]),i=parseFloat(a[1])||0,o=parseFloat(a[2])||0,l=0!==i||0!==o?l.translate(i,o).rotate(s).translate(-i,-o):l.rotate(s);break;case"skewx":s=parseFloat(a[0]),l=l.skewX(s);break;case"skewy":s=parseFloat(a[0]),l=l.skewY(s);break;case"matrix":l.a=parseFloat(a[0]),l.b=parseFloat(a[1]),l.c=parseFloat(a[2]),l.d=parseFloat(a[3]),l.e=parseFloat(a[4]),l.f=parseFloat(a[5]);break;default:continue}t=t.multiply(l)}}return t}function um(e){let t=e||{},n=null!=t.a?t.a:1,r=null!=t.b?t.b:0,i=null!=t.c?t.c:0,o=null!=t.d?t.d:1,s=null!=t.e?t.e:0,l=null!=t.f?t.f:0;return`matrix(${n},${r},${i},${o},${s},${l})`}function uy(e){let t,n,r;if(e)if(e.trim().indexOf("matrix")>=0){let i=uv(up(e));t=[i.translateX,i.translateY],n=[i.rotation],r=[i.scaleX,i.scaleY];let o=[];(0!==t[0]||0!==t[1])&&o.push(`translate(${t.join(",")})`),(1!==r[0]||1!==r[1])&&o.push(`scale(${r.join(",")})`),0!==n[0]&&o.push(`rotate(${n[0]})`),e=o.join(" ")}else{let i=e.match(/translate\((.*?)\)/);i&&(t=i[1].split(uc));let o=e.match(/rotate\((.*?)\)/);o&&(n=o[1].split(uc));let s=e.match(/scale\((.*?)\)/);s&&(r=s[1].split(uc))}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 ub(e,t){return{x:t.x*e.a+t.y*e.c+0,y:t.x*e.b+t.y*e.d+0}}function uv(e){let t=ub(e,{x:0,y:1}),n=ub(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 ux(e){let t,n,r,i;return e?(t=null==e.a?1:e.a,i=null==e.d?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 uw(e){let t={x:0,y:1};e&&(t=ub(e,t));let n=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:n%360+360*(n<0)}}function uC(e){return{tx:e&&e.e||0,ty:e&&e.f||0}}function uE(e,t,n={}){if(null==t)return up(aC(e,"transform"));if(n.absolute)return void e.setAttribute("transform",um(t));let r=e.transform,i=ug(t);r.baseVal.appendItem(i)}function uS(e,t,n=0,r={}){let i=aC(e,"transform"),o=uy(i);if(null==t)return o.translation;i=(i=o.raw).replace(/translate\([^)]*\)/g,"").trim();let s=r.absolute?t:o.translation.tx+t,l=r.absolute?n:o.translation.ty+n,a=`translate(${s},${l})`;e.setAttribute("transform",`${a} ${i}`.trim())}function uP(e,t,n,r,i={}){let o=aC(e,"transform"),s=uy(o);if(null==t)return s.rotation;o=(o=s.raw).replace(/rotate\([^)]*\)/g,"").trim(),t%=360;let l=i.absolute?t:s.rotation.angle+t,a=null!=n&&null!=r?`,${n},${r}`:"",u=`rotate(${l}${a})`;e.setAttribute("transform",`${o} ${u}`.trim())}function uk(e,t,n){let r=aC(e,"transform"),i=uy(r);if(null==t)return i.scale;n=null==n?t:n,r=(r=i.raw).replace(/scale\([^)]*\)/g,"").trim();let o=`scale(${t},${n})`;e.setAttribute("transform",`${r} ${o}`.trim())}function uO(e,t){if(l3(t)&&l3(e)){let n=t.getScreenCTM(),r=e.getScreenCTM();if(n&&r)return n.inverse().multiply(r)}return uf()}function uM(e,t){let n=uf();if(l3(t)&&l3(e)){let r=e,i=[];for(;r&&r!==t;){let e=up(r.getAttribute("transform")||null);i.push(e),r=r.parentNode}i.reverse().forEach(e=>{n=n.multiply(e)})}return n}function uA(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()),o=uO(e,r).inverse();return n.matrixTransform(o)}catch(e){return i}}var uT=e6||(e6={});let uN={};uT.get=function(e){return uN[e]||{}},uT.register=function(e,t){uN[e]=t},uT.unregister=function(e){delete uN[e]};var uj=e4||(e4={});let uL=new WeakMap;uj.ensure=function(e){return uL.has(e)||uL.set(e,{events:Object.create(null)}),uL.get(e)},uj.get=function(e){return uL.get(e)},uj.remove=function(e){return uL.delete(e)},(P=e9||(e9={})).returnTrue=()=>!0,P.returnFalse=()=>!1,P.stopPropagationCallback=function(e){e.stopPropagation()},P.addEventListener=function(e,t,n){null!=e.addEventListener&&e.addEventListener(t,n)},P.removeEventListener=function(e,t,n){null!=e.removeEventListener&&e.removeEventListener(t,n)};var uR=e9||(e9={});let uI=/[^\x20\t\r\n\f]+/g,u_=/^([^.]*)(?:\.(.+)|)/;uR.splitType=function(e){return(e||"").match(uI)||[""]},uR.normalizeType=function(e){let t=u_.exec(e)||[];return{originType:t[1]?t[1].trim():t[1],namespaces:t[2]?t[2].split(".").map(e=>e.trim()).sort():[]}},uR.isValidTarget=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},uR.isValidSelector=function(e,t){return!t||null!=e.querySelector&&null!=e.querySelector(t)};var uz=e9||(e9={});let uD=0,uB=new WeakMap;uz.ensureHandlerId=function(e){return uB.has(e)||(uB.set(e,uD),uD+=1),uB.get(e)},uz.getHandlerId=function(e){return uB.get(e)},uz.removeHandlerId=function(e){return uB.delete(e)},uz.setHandlerId=function(e,t){return uB.set(e,t)},(e9||(e9={})).getHandlerQueue=function(e,t){let n=[],r=e4.get(e),i=r&&r.events&&r.events[t.type],o=i&&i.handlers||[],s=i?i.delegateCount:0;if(s>0&&!("click"===t.type&&"number"==typeof t.button&&t.button>=1)){for(let r=t.target;r!==e;r=r.parentNode||e)if(1===r.nodeType&&("click"!==t.type||!0!==r.disabled)){let t=[],i={};for(let n=0;n<s;n+=1){let s=o[n],l=s.selector;if(null!=l&&null==i[l]){let t=[];e.querySelectorAll(l).forEach(e=>{t.push(e)}),i[l]=t.includes(r)}i[l]&&t.push(s)}t.length&&n.push({elem:r,handlers:t})}}return s<o.length&&n.push({elem:e,handlers:o.slice(s)}),n},(e9||(e9={})).isWindow=function(e){return null!=e&&e===e.window},(e9||(e9={})).contains=function(e,t){let n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))};class uV{constructor(e,t){this.isDefaultPrevented=e9.returnFalse,this.isPropagationStopped=e9.returnFalse,this.isImmediatePropagationStopped=e9.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{let e=this.originalEvent;this.isDefaultPrevented=e9.returnTrue,e&&!this.isSimulated&&e.preventDefault()},this.stopPropagation=()=>{let e=this.originalEvent;this.isPropagationStopped=e9.returnTrue,e&&!this.isSimulated&&e.stopPropagation()},this.stopImmediatePropagation=()=>{let e=this.originalEvent;this.isImmediatePropagationStopped=e9.returnTrue,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()},"string"==typeof e?this.type=e:e.type&&(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?e9.returnTrue:e9.returnFalse,this.target=e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget,this.timeStamp=e.timeStamp),t&&Object.assign(this,t),this.timeStamp||(this.timeStamp=Date.now())}}(k=uV||(uV={})).create=function(e){return e instanceof k?e:new k(e)},(O=uV||(uV={})).addProperty=function(e,t){Object.defineProperty(O.prototype,e,{enumerable:!0,configurable:!0,get:"function"==typeof t?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})};var uF=uV||(uV={});let u$={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(u$).forEach(e=>uF.addProperty(e,u$[e])),e8||(e8={}),e6.register("load",{noBubble:!0}),e8||(e8={}),e6.register("beforeunload",{postDispatch(e,t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}),e8||(e8={}),e6.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(e,t){let n,r=t.relatedTarget,i=t.handleObj;return r&&(r===e||e9.contains(e,r))||(t.type=i.originType,n=i.handler.call(e,t),t.type="mouseover"),n}}),e6.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(e,t){let n,r=t.relatedTarget,i=t.handleObj;return r&&(r===e||e9.contains(e,r))||(t.type=i.originType,n=i.handler.call(e,t),t.type="mouseout"),n}});var uU=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},uG=e7||(e7={});function uH(e,t,...n){let r=uV.create(t);r.delegateTarget=e;let i=e6.get(r.type);if(i.preDispatch&&!1===i.preDispatch(e,r))return;let o=e9.getHandlerQueue(e,r);for(let e=0,t=o.length;e<t&&!r.isPropagationStopped();e+=1){let t=o[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(null==r.rnamespace||i.namespace&&r.rnamespace.test(i.namespace)){r.handleObj=i,r.data=i.data;let e=e6.get(i.originType).handle,o=e?e(t.elem,r,...n):i.handler.call(t.elem,r,...n);void 0!==o&&(r.result=o,!1===o&&(r.preventDefault(),r.stopPropagation()))}}}return i.postDispatch&&i.postDispatch(e,r),r.result}uG.on=function(e,t,n,r,i){let o;if(!e9.isValidTarget(e))return;if("function"!=typeof n){let{handler:e,selector:t}=n,r=uU(n,["handler","selector"]);n=e,i=t,o=r}let l=e4.ensure(e),a=l.handler;null==a&&(a=l.handler=function(t,...n){return s!==t.type?uH(e,t,...n):void 0});let u=e9.ensureHandlerId(n);e9.splitType(t).forEach(t=>{let{originType:s,namespaces:c}=e9.normalizeType(t);if(!s)return;let h=s,d=e6.get(h);h=(i?d.delegateType:d.bindType)||h,d=e6.get(h);let f=Object.assign({type:h,originType:s,data:r,selector:i,guid:u,handler:n,namespace:c.join(".")},o),g=l.events,p=g[h];!p&&(p=g[h]={handlers:[],delegateCount:0},d.setup&&!1!==d.setup(e,r,c,a)||e9.addEventListener(e,h,a)),d.add&&(e9.removeHandlerId(f.handler),d.add(e,f),e9.setHandlerId(f.handler,u)),i?(p.handlers.splice(p.delegateCount,0,f),p.delegateCount+=1):p.handlers.push(f)})},uG.off=function e(t,n,r,i,o){let s=e4.get(t);if(!s)return;let l=s.events;l&&(e9.splitType(n).forEach(n=>{let{originType:a,namespaces:u}=e9.normalizeType(n);if(!a)return void Object.keys(l).forEach(o=>{e(t,o+n,r,i,!0)});let c=a,h=e6.get(c),d=l[c=(i?h.delegateType:h.bindType)||c];if(!d)return;let f=u.length>0?RegExp(`(^|\\.)${u.join("\\.(?:.*\\.|)")}(\\.|$)`):null,g=d.handlers.length;for(let e=d.handlers.length-1;e>=0;e-=1){let n=d.handlers[e];(o||a===n.originType)&&(!r||e9.getHandlerId(r)===n.guid)&&(null==f||n.namespace&&f.test(n.namespace))&&(null==i||i===n.selector||"**"===i&&n.selector)&&(d.handlers.splice(e,1),n.selector&&(d.delegateCount-=1),h.remove&&h.remove(t,n))}g&&0===d.handlers.length&&(h.teardown&&!1!==h.teardown(t,u,s.handler)||e9.removeEventListener(t,c,s.handler),delete l[c])}),0===Object.keys(l).length&&e4.remove(t))},uG.dispatch=uH,uG.trigger=function(e,t,n,r){let i,o=e,l="string"==typeof e?e:e.type,a="string"==typeof e||null==o.namespace?[]:o.namespace.split(".");if(3===n.nodeType||8===n.nodeType)return;l.indexOf(".")>-1&&(l=(a=l.split(".")).shift(),a.sort());let u=0>l.indexOf(":")&&`on${l}`;(o=e instanceof uV?e:new uV(l,"object"==typeof e?e:null)).namespace=a.join("."),o.rnamespace=o.namespace?RegExp(`(^|\\.)${a.join("\\.(?:.*\\.|)")}(\\.|$)`):null,o.result=void 0,o.target||(o.target=n);let c=[o];Array.isArray(t)?c.push(...t):c.push(t);let h=e6.get(l);if(!r&&h.trigger&&!1===h.trigger(n,o,t))return;let d=[n];if(!r&&!h.noBubble&&!e9.isWindow(n)){i=h.delegateType||l;let e=n,t=n.parentNode;for(;null!=t;)d.push(t),e=t,t=t.parentNode;if(e===(n.ownerDocument||document)){let t=e.defaultView||e.parentWindow||window;d.push(t)}}let f=n;for(let e=0,t=d.length;e<t&&!o.isPropagationStopped();e+=1){let t=d[e];f=t,o.type=e>1?i:h.bindType||l;let n=e4.get(t);n&&n.events[o.type]&&n.handler&&n.handler.call(t,...c);let r=u&&t[u]||null;r&&e9.isValidTarget(t)&&(o.result=r.call(t,...c),!1===o.result&&o.preventDefault())}if(o.type=l,!r&&!o.isDefaultPrevented()){let e=h.preventDefault;if((null==e||!1===e(d.pop(),o,t))&&e9.isValidTarget(n)&&u&&"function"==typeof n[l]&&!e9.isWindow(n)){let e=n[u];e&&(n[u]=null),s=l,o.isPropagationStopped()&&f.addEventListener(l,e9.stopPropagationCallback),n[l](),o.isPropagationStopped()&&f.removeEventListener(l,e9.stopPropagationCallback),s=void 0,e&&(n[u]=e)}}return o.result},(N=te||(te={})).on=function(e,t,n,r,i){return tt.on(e,t,n,r,i),e},N.once=function(e,t,n,r,i){return tt.on(e,t,n,r,i,!0),e},N.off=function(e,t,n,r){return tt.off(e,t,n,r),e},N.trigger=function(e,t,n,r){return e7.trigger(t,n,e,r),e},(j=tt||(tt={})).on=function e(t,n,r,i,o,s){if("object"==typeof n){"string"!=typeof r&&(i=i||r,r=void 0),Object.keys(n).forEach(o=>e(t,o,r,i,n[o],s));return}if(null==i&&null==o?(o=r,i=r=void 0):null==o&&("string"==typeof r?(o=i,i=void 0):(o=i,i=r,r=void 0)),!1===o)o=e9.returnFalse;else if(!o)return;if(s){let e=o;o=function(n,...r){return j.off(t,n),e.call(this,n,...r)},e9.setHandlerId(o,e9.ensureHandlerId(e))}e7.on(t,n,o,i,r)},j.off=function e(t,n,r,i){if(n&&null!=n.preventDefault&&null!=n.handleObj){let t=n.handleObj;e(n.delegateTarget,t.namespace?`${t.originType}.${t.namespace}`:t.originType,t.selector,t.handler);return}if("object"==typeof n)return void Object.keys(n).forEach(i=>e(t,i,r,n[i]));(!1===r||"function"==typeof r)&&(i=r,r=void 0),!1===i&&(i=e9.returnFalse),e7.off(t,n,i,r)};class uq{constructor(e,t,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=e2.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){let t;(null==this.onWheelGuard||this.onWheelGuard(e))&&(this.deltaX+=e.deltaX,this.deltaY+=e.deltaY,e.preventDefault(),(0!==this.deltaX||0!==this.deltaY)&&(e.stopPropagation(),t=!0),!0===t&&0===this.animationFrameId&&(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 uW(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView;return{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}}function uJ(e){return e.getBoundingClientRect().width}function uX(e){return e.getBoundingClientRect().height}function uY(e){let t,n="fixed"===aF(e,"position");if(n){let n=e.getBoundingClientRect();t={left:n.left,top:n.top}}else t=uW(e);if(!n){let n=e.ownerDocument,r=e.offsetParent||n.documentElement;for(;(r===n.body||r===n.documentElement)&&"static"===aF(r,"position");)r=r.parentNode;if(r!==e&&ag(r)){let e=uW(r);t.top-=e.top+a$(r,"borderTopWidth"),t.left-=e.left+a$(r,"borderLeftWidth")}}return{top:t.top-a$(e,"marginTop"),left:t.left-a$(e,"marginLeft")}}function uQ(e,t=60){let n=null;return(...r)=>{n&&clearTimeout(n),n=window.setTimeout(()=>{e.apply(this,r)},t)}}let uZ="undefined"!=typeof ResizeObserver?function(e){let t=null,n=[],r=uQ(()=>{n.forEach(t=>{t(e)})}),i=()=>{let t=new ResizeObserver(r);return t.observe(e),r(),t},o=()=>{t&&(t.disconnect(),n=[],t=null)};return{element:e,bind:e=>{t||(t=i()),-1===n.indexOf(e)&&n.push(e)},destroy:o,unbind:e=>{let r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&t&&o()}}}:function(e){let t=null,n=[],r=()=>{"static"===getComputedStyle(e).position&&(e.style.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=uQ(()=>{n.forEach(t=>t(e))}),o=()=>{t&&t.parentNode&&(t.contentDocument&&t.contentDocument.defaultView.removeEventListener("resize",i),t.parentNode.removeChild(t),t=null,n=[])};return{element:e,bind:e=>{t||(t=r()),-1===n.indexOf(e)&&n.push(e)},destroy:o,unbind:e=>{let r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&t&&o()}}};var uK=tn||(tn={});let u0=new WeakMap;function u1(e){let t=u0.get(e);return t||(t=uZ(e),u0.set(e,t)),t}uK.bind=(e,t)=>{let n=u1(e);return n.bind(t),()=>n.unbind(t)},uK.clear=e=>{var t;(t=u1(e)).destroy(),u0.delete(t.element)};class u2{constructor(e={}){this.comparator=e.comparator||u2.defaultComparator,this.index={},this.data=e.data||[],this.heapify()}isEmpty(){return 0===this.data.length}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(void 0===n)throw Error(`Node with id '${e}' was not found in the heap.`);let r=this.data,i=r[n].priority,o=this.comparator(t,i);o<0?(r[n].priority=t,this.bubbleUp(n)):o>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,n,r=this.data,i=e;for(;i>0;)if(n=i-1>>>1,0>this.comparator(r[i].priority,r[n].priority)){t=r[n],r[n]=r[i];let e=r[i].id;null!=e&&(this.index[e]=n),r[i]=t,null!=(e=r[i].id)&&(this.index[e]=i),i=n}else break}bubbleDown(e){let t=this.data,n=t.length-1,r=e;for(;;){let e=(r<<1)+1,i=e+1,o=r;if(e<=n&&0>this.comparator(t[e].priority,t[o].priority)&&(o=e),i<=n&&0>this.comparator(t[i].priority,t[o].priority)&&(o=i),o!==r){let e=t[o];t[o]=t[r];let n=t[r].id;null!=n&&(this.index[n]=o),t[r]=e,null!=(n=t[r].id)&&(this.index[n]=r),r=o}else break}}}(u2||(u2={})).defaultComparator=(e,t)=>e-t,(tr||(tr={})).run=function(e,t,n=(e,t)=>1){let r={},i={},o={},s=new u2;for(r[t]=0,Object.keys(e).forEach(e=>{e!==t&&(r[e]=1/0),s.insert(r[e],e,e)});!s.isEmpty();){let t=s.remove();o[t]=!0;let l=e[t]||[];for(let e=0;e<l.length;e+=1){let a=l[e];if(!o[a]){let e=r[t]+n(t,a);e<r[a]&&(r[a]=e,i[a]=t,s.updatePriority(a,e))}}}return i};class u3{constructor(e,t,n,r){if(null==e)return this.set(255,255,255,1);if("number"==typeof e)return this.set(e,t,n,r);if("string"==typeof e)return u3.fromString(e)||this;if(Array.isArray(e))return this.set(e);this.set(e.r,e.g,e.b,null==e.a?1:e.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(e){let t=u3.lighten(this.toArray(),e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}darken(e){this.lighten(-e)}set(e,t,n,r){let i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,s=Array.isArray(e)?e[2]:n,l=Array.isArray(e)?e[3]:r;return this.r=Math.round(lx(i,0,255)),this.g=Math.round(lx(o,0,255)),this.b=Math.round(lx(s,0,255)),this.a=null==l?1:lx(l,0,1),this}toHex(){let e=["r","g","b"].map(e=>{let t=this[e].toString(16);return t.length<2?`0${t}`:t});return`#${e.join("")}`}toRGBA(){return this.toArray()}toHSLA(){return u3.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 u3.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([...l(t),1])}function n(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}function r(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 i(t){let n=t.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(n){let t=n[2].split(/\s*,\s*/),r=(parseFloat(t[0])%360+360)%360/360,i=parseFloat(t[1])/100;return new e(o(r,i,parseFloat(t[2])/100,null==t[3]?1:parseInt(t[3],10)))}return null}function o(e,t,n,i){let o=Array.isArray(e)?e[0]:e,s=Array.isArray(e)?e[1]:t,l=Array.isArray(e)?e[2]:n,a=Array.isArray(e)?e[3]:i,u=l<=.5?l*(s+1):l+s-l*s,c=2*l-u;return[256*r(c,u,o+1/3),256*r(c,u,o),256*r(c,u,o-1/3),null==a?1:a]}function s(t){return new e(Math.round(256*Math.random()),Math.round(256*Math.random()),Math.round(256*Math.random()),t?void 0:parseFloat(Math.random().toFixed(2)))}function l(e){let t=0===e.indexOf("#")?e:`#${e}`,n=Number(`0x${t.substr(1)}`);if(4!==t.length&&7!==t.length||Number.isNaN(n))throw Error("Invalid hex color.");let r=4===t.length?4:8,i=(1<<r)-1,o=["b","g","r"].map(()=>{let e=n&i;return n>>=r,4===r?17*e:e});return[o[2],o[1],o[0]]}function a(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 u(e,t){if("string"==typeof e){let n="#"===e[0],r=parseInt(n?e.substr(1):e,16),i=lx((r>>16)+t,0,255),o=lx((r>>8&255)+t,0,255),s=lx((255&r)+t,0,255);return`${n?"#":""}${(s|o<<8|i<<16).toString(16)}`}let n=l(u(a(e[0],e[1],e[2]),t));return[n[0],n[1],n[2],e[3]]}e.fromArray=function(t){return new e(t)},e.fromHex=t,e.fromRGBA=n,e.fromHSLA=i,e.fromString=function(r){if(r.startsWith("#"))return t(r);if(r.startsWith("rgb"))return n(r);let o=e.named[r];return o?t(o):i(r)},e.makeGrey=function(t,n){return e.fromArray([t,t,t,n])},e.rgba2hsla=function(e,t,n,r){let i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,s=Array.isArray(e)?e[2]:n,l=Array.isArray(e)?e[3]:r,a=Math.max(i,o,s),u=Math.min(i,o,s),c=(a+u)/2,h=0,d=0;if(u!==a){let e=a-u;switch(d=c>.5?e/(2-a-u):e/(a+u),a){case i:h=(o-s)/e+6*(o<s);break;case o:h=(s-i)/e+2;break;case s:h=(i-o)/e+4}h/=6}return[h,d,c,null==l?1:l]},e.hsla2rgba=o,e.random=s,e.randomHex=function(){let e="#";for(let t=0;t<6;t+=1)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e},e.randomRGBA=function(e){return s(e).toString()},e.invert=function(e,t){if("string"==typeof e){let n="#"===e[0],[r,i,o]=l(e);return t?.299*r+.587*i+.114*o>186?"#000000":"#ffffff":`${n?"#":""}${a(255-r,255-i,255-o)}`}let n=e[0],r=e[1],i=e[2],o=e[3];return t?.299*n+.587*r+.114*i>186?[0,0,0,o]:[255,255,255,o]:[255-n,255-r,255-i,o]},e.lighten=function(e,t){return u(e,t)},e.darken=function(e,t){return u(e,-t)}}(u3||(u3={})),(u3||(u3={})).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"};class u5{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()}}var u6=ti||(ti={});function u4(e){let t=[],n=[];return Array.isArray(e)?t.push(...e):e.split("|").forEach(e=>{-1===e.indexOf("&")?t.push(e):n.push(...e.split("&"))}),{or:t,and:n}}u6.parse=u4,u6.equals=function(e,t){if(null!=e&&null!=t){let n=u4(e),r=u4(t),i=n.or.sort(),o=r.or.sort(),s=n.and.sort(),l=r.and.sort(),a=(e,t)=>e.length===t.length&&(0===e.length||e.every((e,n)=>e===t[n]));return a(i,o)&&a(s,l)}return null==e&&null==t},u6.isMatch=function(e,t,n){if(null==t||Array.isArray(t)&&0===t.length)return!n||!0!==e.altKey&&!0!==e.ctrlKey&&!0!==e.metaKey&&!0!==e.shiftKey;let{or:r,and:i}=u4(t),o=t=>!0===e[`${t.toLowerCase()}Key`];return r.some(e=>o(e))&&i.every(e=>o(e))},(L=to||(to={})).linear=e=>e,L.quad=e=>e*e,L.cubic=e=>e*e*e,L.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)},L.exponential=e=>Math.pow(2,10*(e-1)),L.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}},(to||(to={})).decorators={reverse:e=>t=>1-e(1-t),reflect:e=>t=>.5*(t<.5?e(2*t):2-e(2-2*t)),clamp:(e,t=0,n=1)=>r=>{let i=e(r);return i<t?t:i>n?n:i},back:(e=1.70158)=>t=>t*t*((e+1)*t-e),elastic:(e=1.5)=>t=>Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*e/3*t)};var u9=to||(to={});function u8(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}}function u7(e){return 1-u8(1-e)}u9.easeInSine=function(e){return -1*Math.cos(Math.PI/2*e)+1},u9.easeOutSine=function(e){return Math.sin(Math.PI/2*e)},u9.easeInOutSine=function(e){return -.5*(Math.cos(Math.PI*e)-1)},u9.easeInQuad=function(e){return e*e},u9.easeOutQuad=function(e){return e*(2-e)},u9.easeInOutQuad=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},u9.easeInCubic=function(e){return e*e*e},u9.easeOutCubic=function(e){let t=e-1;return t*t*t+1},u9.easeInOutCubic=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},u9.easeInQuart=function(e){return e*e*e*e},u9.easeOutQuart=function(e){let t=e-1;return 1-t*t*t*t},u9.easeInOutQuart=function(e){let t=e-1;return e<.5?8*e*e*e*e:1-8*t*t*t*t},u9.easeInQuint=function(e){return e*e*e*e*e},u9.easeOutQuint=function(e){let t=e-1;return 1+t*t*t*t*t},u9.easeInOutQuint=function(e){let t=e-1;return e<.5?16*e*e*e*e*e:1+16*t*t*t*t*t},u9.easeInExpo=function(e){return 0===e?0:Math.pow(2,10*(e-1))},u9.easeOutExpo=function(e){return 1===e?1:-Math.pow(2,-10*e)+1},u9.easeInOutExpo=function(e){if(0===e||1===e)return e;let t=2*e,n=t-1;return t<1?.5*Math.pow(2,10*n):.5*(-Math.pow(2,-10*n)+2)},u9.easeInCirc=function(e){return -1*(Math.sqrt(1-e/1*e)-1)},u9.easeOutCirc=function(e){let t=e-1;return Math.sqrt(1-t*t)},u9.easeInOutCirc=function(e){let t=2*e,n=t-2;return t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-n*n)+1)},u9.easeInBack=function(e,t=1.70158){return e*e*((t+1)*e-t)},u9.easeOutBack=function(e,t=1.70158){let n=e/1-1;return n*n*((t+1)*n+t)+1},u9.easeInOutBack=function(e,t=1.70158){let n=2*e,r=n-2,i=1.525*t;return n<1?.5*n*n*((i+1)*n-i):.5*(r*r*((i+1)*r+i)+2)},u9.easeInElastic=function(e,t=.7){if(0===e||1===e)return e;let n=e/1-1,r=1-t;return-(Math.pow(2,10*n)*Math.sin(2*Math.PI*(n-r/(2*Math.PI)*Math.asin(1))/r))},u9.easeOutElastic=function(e,t=.7){let n=1-t,r=2*e;return 0===e||1===e?e:Math.pow(2,-10*r)*Math.sin(2*Math.PI*(r-n/(2*Math.PI)*Math.asin(1))/n)+1},u9.easeInOutElastic=function(e,t=.65){let n=1-t;if(0===e||1===e)return e;let r=2*e,i=r-1,o=n/(2*Math.PI)*Math.asin(1);return r<1?-(Math.pow(2,10*i)*Math.sin(2*Math.PI*(i-o)/n)*.5):Math.pow(2,-10*i)*Math.sin(2*Math.PI*(i-o)/n)*.5+1},u9.easeOutBounce=u8,u9.easeInBounce=u7,u9.easeInOutBounce=function(e){return e<.5?.5*u7(2*e):.5*u8(2*e-1)+.5},(R=ts||(ts={})).number=(e,t)=>{let n=t-e;return t=>e+n*t},R.object=(e,t)=>{let n=Object.keys(e);return r=>{let i={};for(let o=n.length-1;-1!==o;o-=1){let s=n[o];i[s]=e[s]+(t[s]-e[s])*r}return i}},R.unit=(e,t)=>{let n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,r=n.exec(e),i=n.exec(t),o=i?i[1]:"",s=r?+r[1]:0,l=i?+i[1]:0,a=o.indexOf("."),u=a>0?o[1].length-a-1:0,c=l-s,h=r?r[2]:"";return e=>(s+c*e).toFixed(u)+h},R.color=(e,t)=>{let n=parseInt(e.slice(1),16),r=parseInt(t.slice(1),16),i=255&n,o=(255&r)-i,s=65280&n,l=(65280&r)-s,a=0xff0000&n,u=(0xff0000&r)-a;return e=>`#${(0x1000000|i+o*e&255|s+l*e&65280|a+u*e&0xff0000).toString(16).slice(1)}`};let ce=[];function ct(e,t){let n=ce.find(t=>t.name===e);if((!n||(n.loadTimes+=1,!(n.loadTimes>1)))&&!e2.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),ce.push({name:e,loadTimes:1,styleElement:n})}}function cn(e){let t=ce.findIndex(t=>t.name===e);if(t>-1){let e=ce[t];if(e.loadTimes-=1,e.loadTimes>0)return;let n=e.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,ce.splice(t,1)}}(I=tl||(tl={})).toDeg=function(e){return 180*e/Math.PI%360},I.toRad=function(e,t=!1){return(t?e:e%360)*Math.PI/180},I.normalize=function(e){return e%360+360*(e<0)},(_=ta||(ta={})).round=function(e,t=0){return Number.isInteger(e)?e:+e.toFixed(t)},_.random=function(e,t){let n,r;if(null==t?(r=null==e?1:e,n=0):(r=t,n=null==e?0:e),r<n){let e=n;n=r,r=e}return Math.floor(Math.random()*(r-n+1)+n)},_.clamp=function(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},_.snapToGrid=function(e,t){return t*Math.round(e/t)},_.containsPoint=function(e,t){return null!=t&&null!=e&&t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height},_.squaredLength=function(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r};class cr{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class ci extends cr{constructor(e,t){super(),this.x=null==e?0:e,this.y=null==t?0:t}round(e=0){return this.x=ta.round(this.x,e),this.y=ta.round(this.y,e),this}add(e,t){let n=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}update(e,t){let n=ci.create(e,t);return this.x=n.x,this.y=n.y,this}translate(e,t){let n=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}rotate(e,t){let n=ci.rotate(this,e,t);return this.x=n.x,this.y=n.y,this}scale(e,t,n=new ci){let r=ci.create(n);return this.x=r.x+e*(this.x-r.x),this.y=r.y+t*(this.y-r.y),this}closest(e){if(1===e.length)return ci.create(e[0]);let t=null,n=1/0;return e.forEach(e=>{let r=this.squaredDistance(e);r<n&&(t=e,n=r)}),t?ci.create(t):null}distance(e){return Math.sqrt(this.squaredDistance(e))}squaredDistance(e){let t=ci.create(e),n=this.x-t.x,r=this.y-t.y;return n*n+r*r}manhattanDistance(e){let t=ci.create(e);return Math.abs(t.x-this.x)+Math.abs(t.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(e=new ci){let t=ci.create(e),n=Math.atan2(-(t.y-this.y),t.x-this.x);return n<0&&(n=2*Math.PI+n),180*n/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(e){return new ci(0,0).angleBetween(this,e)}toPolar(e){return this.update(ci.toPolar(this,e)),this}changeInAngle(e,t,n=new ci){return this.clone().translate(-e,-t).theta(n)-this.theta(n)}adhereToRect(e){return ta.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(e){let t=ci.create(e),n=tl.toRad(this.y),r=tl.toRad(t.y),i=this.x,o=t.x,s=tl.toRad(o-i),l=Math.sin(s)*Math.cos(r),a=Math.cos(n)*Math.sin(r)-Math.sin(n)*Math.cos(r)*Math.cos(s),u=tl.toDeg(Math.atan2(l,a))-22.5;return u<0&&(u+=360),["NE","E","SE","S","SW","W","NW","N"][u=parseInt(u/45,10)]}cross(e,t){if(null!=e&&null!=t){let n=ci.create(e),r=ci.create(t);return(r.x-this.x)*(n.y-this.y)-(r.y-this.y)*(n.x-this.x)}return NaN}dot(e){let t=ci.create(e);return this.x*t.x+this.y*t.y}diff(e,t){if("number"==typeof e)return new ci(this.x-e,this.y-t);let n=ci.create(e);return new ci(this.x-n.x,this.y-n.y)}lerp(e,t){let n=ci.create(e);return new ci((1-t)*this.x+t*n.x,(1-t)*this.y+t*n.y)}normalize(e=1){let t=e/this.magnitude();return this.scale(t,t)}move(e,t){let n=ci.create(e),r=tl.toRad(n.theta(this));return this.translate(Math.cos(r)*t,-Math.sin(r)*t)}reflection(e){return ci.create(e).move(this,this.distance(e))}snapToGrid(e,t){return this.x=ta.snapToGrid(this.x,e),this.y=ta.snapToGrid(this.y,null==t?e:t),this}equals(e){let t=ci.create(e);return null!=t&&t.x===this.x&&t.y===this.y}clone(){return ci.clone(this)}toJSON(){return ci.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}(z=ci||(ci={})).isPoint=function(e){return null!=e&&e instanceof z},(D=ci||(ci={})).isPointLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y},D.isPointData=function(e){return null!=e&&Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]},function(e){function t(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)}function n(e,t){return e===t||null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function r(n,i,o,s=new e){let l=t(n),a=t(s),u=l.x-a.x,c=l.y-a.y;return new e(u*i-c*o+a.x,c*i+u*o+a.y)}e.create=function(n,r){return null==n||"number"==typeof n?new e(n,r):t(n)},e.clone=t,e.toJSON=function(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.fromPolar=function(n,r,i=new e){let o=Math.abs(n*Math.cos(r)),s=Math.abs(n*Math.sin(r)),l=t(i),a=tl.normalize(tl.toDeg(r));return a<90?s=-s:a<180?(o=-o,s=-s):a<270&&(o=-o),new e(l.x+o,l.y+s)},e.toPolar=function(n,r=new e){let i=t(n),o=t(r),s=i.x-o.x,l=i.y-o.y;return new e(Math.sqrt(s*s+l*l),tl.toRad(o.theta(i)))},e.equals=n,e.equalPoints=function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!==t.length)return!1;if(null!=e&&null!=t){for(let r=0,i=e.length;r<i;r+=1)if(!n(e[r],t[r]))return!1}return!0},e.random=function(t,n,r,i){return new e(ta.random(t,n),ta.random(r,i))},e.rotate=function(e,t,n){let i=tl.toRad(tl.normalize(-t)),o=Math.sin(i);return r(e,Math.cos(i),o,n)},e.rotateEx=r}(ci||(ci={}));class co extends cr{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 ci(this.x,this.y)}get topLeft(){return new ci(this.x,this.y)}get topCenter(){return new ci(this.x+this.width/2,this.y)}get topRight(){return new ci(this.x+this.width,this.y)}get center(){return new ci(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new ci(this.x,this.y+this.height)}get bottomCenter(){return new ci(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new ci(this.x+this.width,this.y+this.height)}get corner(){return new ci(this.x+this.width,this.y+this.height)}get rightMiddle(){return new ci(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new ci(this.x,this.y+this.height/2)}get topLine(){return new ca(this.topLeft,this.topRight)}get rightLine(){return new ca(this.topRight,this.bottomRight)}get bottomLine(){return new ca(this.bottomLeft,this.bottomRight)}get leftLine(){return new ca(this.topLeft,this.bottomLeft)}constructor(e,t,n,r){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.width=null==n?0:n,this.height=null==r?0:r}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(e){if(!e)return this.clone();let t=tl.toRad(e),n=Math.abs(Math.sin(t)),r=Math.abs(Math.cos(t)),i=this.width*r+this.height*n,o=this.width*n+this.height*r;return new co(this.x+(this.width-i)/2,this.y+(this.height-o)/2,i,o)}round(e=0){return this.x=ta.round(this.x,e),this.y=ta.round(this.y,e),this.width=ta.round(this.width,e),this.height=ta.round(this.height,e),this}add(e,t,n,r){let i=co.create(e,t,n,r),o=Math.min(this.x,i.x),s=Math.min(this.y,i.y),l=Math.max(this.x+this.width,i.x+i.width),a=Math.max(this.y+this.height,i.y+i.height);return this.x=o,this.y=s,this.width=l-o,this.height=a-s,this}update(e,t,n,r){let i=co.create(e,t,n,r);return this.x=i.x,this.y=i.y,this.width=i.width,this.height=i.height,this}inflate(e,t){let n=null!=t?t:e;return this.x-=e,this.y-=n,this.width+=2*e,this.height+=2*n,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=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}scale(e,t,n=new ci){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(e,t=this.getCenter()){if(0!==e){let n=tl.toRad(e),r=Math.cos(n),i=Math.sin(n),o=this.getOrigin(),s=this.getTopRight(),l=this.getBottomRight(),a=this.getBottomLeft();o=ci.rotateEx(o,r,i,t),s=ci.rotateEx(s,r,i,t),l=ci.rotateEx(l,r,i,t),a=ci.rotateEx(a,r,i,t);let u=new co(o.x,o.y,0,0);u.add(s.x,s.y,0,0),u.add(l.x,l.y,0,0),u.add(a.x,a.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(e){let t=co.clone(e);return this.x+=t.x||0,this.y+=t.y||0,this.width+=t.width||0,this.height+=t.height||0,this}getMaxScaleToFit(e,t=this.center){let n=co.clone(e),r=t.x,i=t.y,o=1/0,s=1/0,l=1/0,a=1/0,u=1/0,c=1/0,h=1/0,d=1/0,f=n.topLeft;f.x<r&&(o=(this.x-r)/(f.x-r)),f.y<i&&(u=(this.y-i)/(f.y-i));let g=n.bottomRight;g.x>r&&(s=(this.x+this.width-r)/(g.x-r)),g.y>i&&(c=(this.y+this.height-i)/(g.y-i));let p=n.topRight;p.x>r&&(l=(this.x+this.width-r)/(p.x-r)),p.y<i&&(h=(this.y-i)/(p.y-i));let m=n.bottomLeft;return m.x<r&&(a=(this.x-r)/(m.x-r)),m.y>i&&(d=(this.y+this.height-i)/(m.y-i)),{sx:Math.min(o,s,l,a),sy:Math.min(u,c,h,d)}}getMaxUniformScaleToFit(e,t=this.center){let n=this.getMaxScaleToFit(e,t);return Math.min(n.sx,n.sy)}containsPoint(e,t){return ta.containsPoint(this,ci.create(e,t))}containsRect(e,t,n,r){let i=co.create(e,t,n,r),o=this.x,s=this.y,l=this.width,a=this.height,u=i.x,c=i.y,h=i.width,d=i.height;return 0!==l&&0!==a&&0!==h&&0!==d&&u>=o&&c>=s&&u+h<=o+l&&c+d<=s+a}intersectsWithLine(e){let t=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],r=[];return t.forEach(t=>{let i=e.intersectsWithLine(t);null!==i&&0>r.indexOf(i.toString())&&(n.push(i),r.push(i.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(e,t){let n=ci.clone(e),r=this.center,i=null;null!=t&&0!==t&&n.rotate(t,r);let o=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],s=new ca(r,n);for(let e=o.length-1;e>=0;e-=1){let t=o[e].intersectsWithLine(s);if(null!==t){i=t;break}}return i&&null!=t&&0!==t&&i.rotate(-t,r),i}intersectsWithRect(e,t,n,r){let i=co.create(e,t,n,r);if(!this.isIntersectWithRect(i))return null;let o=this.origin,s=this.corner,l=i.origin,a=i.corner,u=Math.max(o.x,l.x),c=Math.max(o.y,l.y);return new co(u,c,Math.min(s.x,a.x)-u,Math.min(s.y,a.y)-c)}isIntersectWithRect(e,t,n,r){let i=co.create(e,t,n,r),o=this.origin,s=this.corner,l=i.origin,a=i.corner;return!(a.x<=o.x)&&!(a.y<=o.y)&&!(l.x>=s.x)&&!(l.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(e){let t=co.clone(e),n=this.origin,r=this.corner,i=t.origin,o=t.corner,s=Math.min(n.x,i.x),l=Math.min(n.y,i.y),a=Math.max(r.x,o.x),u=Math.max(r.y,o.y);return new co(s,l,a-s,u-l)}getNearestSideToPoint(e){let t=ci.clone(e),n=t.x-this.x,r=this.x+this.width-t.x,i=t.y-this.y,o=this.y+this.height-t.y,s=n,l="left";return r<s&&(s=r,l="right"),i<s&&(s=i,l="top"),o<s&&(l="bottom"),l}getNearestPointToPoint(e){let t=ci.clone(e);if(this.containsPoint(t)){let e=this.getNearestSideToPoint(t);if("left"===e)return new ci(this.x,t.y);if("top"===e)return new ci(t.x,this.y);if("right"===e)return new ci(this.x+this.width,t.y);if("bottom"===e)return new ci(t.x,this.y+this.height)}return t.adhereToRect(this)}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}clone(){return new co(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}`}}(B=co||(co={})).isRectangle=function(e){return null!=e&&e instanceof B},(co||(co={})).isRectangleLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.width&&"number"==typeof e.height};var cs=co||(co={});function cl(e){return cs.isRectangle(e)?e.clone():Array.isArray(e)?new cs(e[0],e[1],e[2],e[3]):new cs(e.x,e.y,e.width,e.height)}cs.create=function(e,t,n,r){return null==e||"number"==typeof e?new cs(e,t,n,r):cl(e)},cs.clone=cl,cs.fromEllipse=function(e){return new cs(e.x-e.a,e.y-e.b,2*e.a,2*e.b)},cs.fromSize=function(e){return new cs(0,0,e.width,e.height)},cs.fromPositionAndSize=function(e,t){return new cs(e.x,e.y,t.width,t.height)};class ca extends cr{get center(){return new ci((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(e,t,n,r){super(),"number"==typeof e&&"number"==typeof t?(this.start=new ci(e,t),this.end=new ci(n,r)):(this.start=ci.create(e),this.end=ci.create(t))}getCenter(){return this.center}round(e=0){return this.start.round(e),this.end.round(e),this}translate(e,t){return"number"==typeof e?(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),o=r.clone().rotate(90,n);return n.move(o,e),r.move(i,e),t}vector(){return new ci(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){let e=new ci(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 co(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(e){let t=Math.min(1,Math.max(0,this.vector().dot(new ca(this.start,e).vector())/this.squaredLength()));return Number.isNaN(t)?0:t}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 o=(r?e:i-e)/i;return this.pointAt(o)}divideAt(e){let t=this.pointAt(e);return[new ca(this.start,t),new ca(t,this.end)]}divideAtLength(e){let t=this.pointAtLength(e);return[new ca(this.start,t),new ca(t,this.end)]}containsPoint(e){let t=this.start,n=this.end;if(0!==t.cross(e,n))return!1;let r=this.length();return!(new ca(t,e).length()>r||new ca(e,n).length()>r)}intersect(e,t){let n=e.intersectsWithLine(this,t);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(e){let t=new ci(this.end.x-this.start.x,this.end.y-this.start.y),n=new ci(e.end.x-e.start.x,e.end.y-e.start.y),r=t.x*n.y-t.y*n.x,i=new ci(e.start.x-this.start.x,e.start.y-this.start.y),o=i.x*n.y-i.y*n.x,s=i.x*t.y-i.y*t.x;if(0===r||o*r<0||s*r<0)return null;if(r>0){if(o>r||s>r)return null}else if(o<r||s<r)return null;return new ci(this.start.x+o*t.x/r,this.start.y+o*t.y/r)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(e){let t=ci.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=ci.create(e,t);return this.closestPoint(n).squaredDistance(n)}pointDistance(e,t){let n=ci.create(e,t);return this.closestPoint(n).distance(n)}tangentAt(e){if(!this.isDifferentiable())return null;let t=this.start,n=this.end,r=this.pointAt(e),i=new ca(t,n);return i.translate(r.x-t.x,r.y-t.y),i}tangentAtLength(e){if(!this.isDifferentiable())return null;let t=this.start,n=this.end,r=this.pointAtLength(e),i=new ca(t,n);return i.translate(r.x-t.x,r.y-t.y),i}relativeCcw(e,t){let n=ci.create(e,t),r=n.x-this.start.x,i=n.y-this.start.y,o=this.end.x-this.start.x,s=this.end.y-this.start.y,l=r*s-i*o;return 0===l&&(l=r*o+i*s)>0&&(r-=o,i-=s,(l=r*o+i*s)<0&&(l=0)),l<0?-1:+(l>0)}equals(e){return null!=e&&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 ca(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}(V=ca||(ca={})).isLine=function(e){return null!=e&&e instanceof V};class cu extends cr{get center(){return new ci(this.x,this.y)}constructor(e,t,n,r){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.a=null==n?0:n,this.b=null==r?0:r}bbox(){return co.fromEllipse(this)}getCenter(){return this.center}inflate(e,t){return this.a+=2*e,this.b+=2*(null!=t?t:e),this}normalizedDistance(e,t){let n=ci.create(e,t),r=n.x-this.x,i=n.y-this.y,o=this.a,s=this.b;return r*r/(o*o)+i*i/(s*s)}containsPoint(e,t){return 1>=this.normalizedDistance(e,t)}intersectsWithLine(e){let t=[],n=this.a,r=this.b,i=e.start,o=e.end,s=e.vector(),l=i.diff(new ci(this.x,this.y)),a=new ci(s.x/(n*n),s.y/(r*r)),u=new ci(l.x/(n*n),l.y/(r*r)),c=s.dot(a),h=s.dot(u),d=h*h-c*(l.dot(u)-1);if(d<0)return null;if(d>0){let e=Math.sqrt(d),n=(-h-e)/c,r=(-h+e)/c;if((n<0||n>1)&&(r<0||r>1))return null;n>=0&&n<=1&&t.push(i.lerp(o,n)),r>=0&&r<=1&&t.push(i.lerp(o,r))}else{let e=-h/c;if(!(e>=0)||!(e<=1))return null;t.push(i.lerp(o,e))}return t}intersectsWithLineFromCenterToPoint(e,t=0){let n,r=ci.clone(e);t&&r.rotate(t,this.getCenter());let i=r.x-this.x,o=r.y-this.y;if(0===i)return(n=this.bbox().getNearestPointToPoint(r),t)?n.rotate(-t,this.getCenter()):n;let s=o/i,l=Math.sqrt(1/(1/(this.a*this.a)+s*s/(this.b*this.b))),a=s*(l=i<0?-l:l);return(n=new ci(this.x+l,this.y+a),t)?n.rotate(-t,this.getCenter()):n}tangentTheta(e){let t,n,r=ci.clone(e),i=r.x,o=r.y,s=this.a,l=this.b,a=this.bbox().center,u=a.x,c=a.y,h=i>a.x+s/2,d=i<a.x-s/2;return h||d?(n=i>a.x?o-30:o+30,t=s*s/(i-u)-s*s*(o-c)*(n-c)/(l*l*(i-u))+u):(t=o>a.y?i+30:i-30,n=l*l/(o-c)-l*l*(i-u)*(t-u)/(s*s*(o-c))+c),new ci(t,n).theta(r)}scale(e,t){return this.a*=e,this.b*=t,this}rotate(e,t){let n=co.fromEllipse(this);n.rotate(e,t);let r=cu.fromRect(n);return this.a=r.a,this.b=r.b,this.x=r.x,this.y=r.y,this}translate(e,t){let n=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.a===this.a&&e.b===this.b}clone(){return new cu(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}`}}(F=cu||(cu={})).isEllipse=function(e){return null!=e&&e instanceof F};var cc=cu||(cu={});function ch(e){return cc.isEllipse(e)?e.clone():Array.isArray(e)?new cc(e[0],e[1],e[2],e[3]):new cc(e.x,e.y,e.a,e.b)}cc.create=function(e,t,n,r){return null==e||"number"==typeof e?new cc(e,t,n,r):ch(e)},cc.parse=ch,cc.fromRect=function(e){let t=e.center;return new cc(t.x,t.y,e.width/2,e.height/2)};let cd=RegExp("^[\\s\\dLMCZz,.]*$");function cf(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})}),function(e,t,n,r,i){let o=[],s=e[e.length-1],l=null!=t&&t>0,a=t||0;if(r&&l){let t=(e=e.slice())[0],n=new ci(s.x+(t.x-s.x)/2,s.y+(t.y-s.y)/2);e.splice(0,0,n)}let u=e[0],c=1;for(n?o.push("M",u.x,u.y):o.push("L",u.x,u.y);c<(r?e.length:e.length-1);){var h,d,f;let t=e[(c%(h=e.length)+h)%h],n=u.x-t.x,r=u.y-t.y;if(l&&(0!==n||0!==r)&&(null==i||0>i.indexOf(c-1))){let i=Math.sqrt(n*n+r*r),s=n*Math.min(a,i/2)/i,l=r*Math.min(a,i/2)/i,u=t.x+s,h=t.y+l;o.push("L",u,h);let g=e[((c+1)%(d=e.length)+d)%d];for(;c<e.length-2&&0===Math.round(g.x-t.x)&&0===Math.round(g.y-t.y);)g=e[((c+2)%(f=e.length)+f)%f],c+=1;i=Math.max(1,Math.sqrt((n=g.x-t.x)*n+(r=g.y-t.y)*r));let p=n*Math.min(a,i/2)/i,m=r*Math.min(a,i/2)/i,y=t.x+p,b=t.y+m;o.push("Q",t.x,t.y,y,b),t=new ci(y,b)}else o.push("L",t.x,t.y);u=t,c+=1}return r?o.push("Z"):o.push("L",s.x,s.y),o.map(e=>"string"==typeof e?e:+e.toFixed(3)).join(" ")}(n,t.round,null==t.initialMove||t.initialMove,t.close,t.exclude)}function cg(e,t,n,r,i=0,o=0,s=0,l,a){let u;if(0===n||0===r)return[];let c=-(l-=e)/2,h=-(a-=t)/2,d=Math.cos(i*Math.PI/180),f=Math.sin(i*Math.PI/180),g=d*c+f*h,p=-1*f*c+d*h,m=g*g,y=p*p,b=(n=Math.abs(n))*n,v=(r=Math.abs(r))*r,x=m/b+y/v;if(x>1)n=Math.sqrt(x)*n,r=Math.sqrt(x)*r,u=0;else{let e=1;o===s&&(e=-1),u=e*Math.sqrt((b*v-b*y-v*m)/(b*y+v*m))}let w=u*n*p/r,C=-1*u*r*g/n,E=d*w-f*C+l/2,S=f*w+d*C+a/2,P=Math.atan2((p-C)/r,(g-w)/n)-Math.atan2(0,1),k=P>=0?P:2*Math.PI+P,O=(P=Math.atan2((-p-C)/r,(-g-w)/n)-Math.atan2((p-C)/r,(g-w)/n))>=0?P:2*Math.PI+P;0===s&&O>0?O-=2*Math.PI:0!==s&&O<0&&(O+=2*Math.PI);let M=2*O/Math.PI,A=Math.ceil(M<0?-1*M:M),T=O/A,N=8/3*Math.sin(T/4)*Math.sin(T/4)/Math.sin(T/2),j=d*n,L=d*r,R=f*n,I=f*r,_=Math.cos(k),z=Math.sin(k),D=-N*(j*z+I*_),B=-N*(R*z-L*_),V=0,F=0,$=[];for(let n=0;n<A;n+=1){k+=T,V=j*(_=Math.cos(k))-I*(z=Math.sin(k))+E,F=R*_+L*z+S;let r=-N*(j*z+I*_),i=-N*(R*z-L*_),o=6*n;$[o]=Number(D+e),$[o+1]=Number(B+t),$[o+2]=Number(V-r+e),$[o+3]=Number(F-i+t),$[o+4]=Number(V+e),$[o+5]=Number(F+t),D=V+r,B=F+i}return $.map(e=>+e.toFixed(2))}class cp extends cr{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(e){if(super(),null!=e){if("string"==typeof e)return cp.parse(e);this.points=e.map(e=>ci.create(e))}else this.points=[]}scale(e,t,n=new ci){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=ci.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(0===this.points.length)return new co;let e=1/0,t=-1/0,n=1/0,r=-1/0,i=this.points;for(let o=0,s=i.length;o<s;o+=1){let s=i[o],l=s.x,a=s.y;l<e&&(e=l),l>t&&(t=l),a<n&&(n=a),a>r&&(r=a)}return new co(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(0===n||1===n)return 0;let r=0,i=0,o=1/0;for(let s=0,l=n-1;s<l;s+=1){let n=new ca(t[s],t[s+1]),l=n.length(),a=n.closestPointNormalizedLength(e),u=n.pointAt(a).squaredDistance(e);u<o&&(o=u,i=r+a*l),r+=l}return i}closestPointNormalizedLength(e){let t=this.length();return 0===t?0:this.closestPointLength(e)/t}closestPointTangent(e){let t=this.closestPointLength(e);return this.tangentAtLength(t)}containsPoint(e){if(0===this.points.length)return!1;let t=ci.clone(e),n=t.x,r=t.y,i=this.points,o=i.length,s=o-1,l=0;for(let a=0;a<o;a+=1){let o=i[s],u=i[a];if(t.equals(o))return!0;let c=new ca(o,u);if(c.containsPoint(e))return!0;if(r<=o.y&&r>u.y||r>o.y&&r<=u.y){let t=o.x-n>u.x-n?o.x-n:u.x-n;if(t>=0){let i=new ci(n+t,r),o=new ca(e,i);c.intersectsWithLine(o)&&(l+=1)}}s=a}return l%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],o=e.intersectsWithLine(new ca(r,i));o&&t.push(o)}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 ca(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(0===n)return null;if(1===n||e<=0)return t[0].clone();if(e>=1)return t[n-1].clone();let r=this.length();return this.pointAtLength(r*e)}pointAtLength(e){let t=this.points,n=t.length;if(0===n)return null;if(1===n)return t[0].clone();let r=!0;e<0&&(r=!1,e=-e);let i=0;for(let o=0,s=n-1;o<s;o+=1){let n=r?o:s-1-o,l=t[n],a=t[n+1],u=new ca(l,a),c=l.distance(a);if(e<=i+c)return u.pointAtLength((r?1:-1)*(e-i));i+=c}return(r?t[n-1]:t[0]).clone()}tangentAt(e){let t=this.points.length;if(0===t||1===t)return null;e<0&&(e=0),e>1&&(e=1);let n=this.length()*e;return this.tangentAtLength(n)}tangentAtLength(e){let t,n=this.points,r=n.length;if(0===r||1===r)return null;let i=!0;e<0&&(i=!1,e=-e);let o=0;for(let s=0,l=r-1;s<l;s+=1){let r=i?s:l-1-s,a=n[r],u=n[r+1],c=new ca(a,u),h=a.distance(u);if(c.isDifferentiable()){if(e<=o+h)return c.tangentAtLength((i?1:-1)*(e-o));t=c}o+=h}if(t){let e=+!!i;return t.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,o=r+2,s=t[e],l=t[i],a=t[o];new ca(s,a).closestPoint(l).distance(l)<=n?t.splice(i,1):r+=1}return this}toHull(){let e,t=this.points,n=t.length;if(0===n)return new cp;let r=t[0];for(let e=1;e<n;e+=1)t[e].y<r.y?r=t[e]: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]);0===n&&(n=360),i.push([t[e],e,n])}if(i.sort((e,t)=>{let n=e[2]-t[2];return 0===n&&(n=t[1]-e[1]),n}),i.length>2){let e=i[i.length-1];i.unshift(e)}let o={},s=[],l=e=>`${e[0].toString()}@${e[1]}`;for(;0!==i.length;){let e=i.pop(),t=e[0];if(o[l(e)])continue;let n=!1;for(;!n;)if(s.length<2)s.push(e),n=!0;else{let r=s.pop(),a=r[0],u=s.pop(),c=u[0],h=c.cross(a,t);if(h<0)s.push(u),s.push(r),s.push(e),n=!0;else if(0===h){let e=a.angleBetween(c,t);1e-10>Math.abs(e-180)||a.equals(t)||c.equals(a)?(o[l(r)]=a,s.push(u)):1e-10>Math.abs((e+1)%360-1)&&(s.push(u),i.push(r))}else o[l(r)]=a,s.push(u)}}s.length>2&&s.pop();let a=-1;for(let t=0,n=s.length;t<n;t+=1){let n=s[t][1];(void 0===e||n<e)&&(e=n,a=t)}let u=[];if(a>0){let e=s.slice(a),t=s.slice(0,a);u=e.concat(t)}else u=s;let c=[];for(let e=0,t=u.length;e<t;e+=1)c.push(u[e][0]);return new cp(c)}equals(e){return null!=e&&e.points.length===this.points.length&&e.points.every((e,t)=>e.equals(this.points[t]))}clone(){return new cp(this.points.map(e=>e.clone()))}toJSON(){return this.points.map(e=>e.toJSON())}serialize(){return this.points.map(e=>`${e.serialize()}`).join(" ")}}($=cp||(cp={})).isPolyline=function(e){return null!=e&&e instanceof $},(U=cp||(cp={})).parse=function(e){let t=e.trim();if(""===t)return new U;let n=[],r=t.split(/\s*,\s*|\s+/);for(let e=0,t=r.length;e<t;e+=2)n.push({x:+r[e],y:+r[e+1]});return new U(n)};class cm extends cr{constructor(e,t,n,r){super(),this.PRECISION=3,this.start=ci.create(e),this.controlPoint1=ci.create(t),this.controlPoint2=ci.create(n),this.end=ci.create(r)}bbox(){let e,t,n,r,i,o,s,l,a,u,c,h=this.start,d=this.controlPoint1,f=this.controlPoint2,g=this.end,p=h.x,m=h.y,y=d.x,b=d.y,v=f.x,x=f.y,w=g.x,C=g.y,E=[],S=[],P=[[],[]];for(let a=0;a<2;a+=1){if(0===a?(t=6*p-12*y+6*v,e=-3*p+9*y-9*v+3*w,n=3*y-3*p):(t=6*m-12*b+6*x,e=-3*m+9*b-9*x+3*C,n=3*b-3*m),1e-12>Math.abs(e)){if(1e-12>Math.abs(t))continue;(r=-n/t)>0&&r<1&&S.push(r);continue}l=Math.sqrt(s=t*t-4*n*e),!(s<0)&&((i=(-t+l)/(2*e))>0&&i<1&&S.push(i),(o=(-t-l)/(2*e))>0&&o<1&&S.push(o))}let k=S.length,O=k;for(;k;)k-=1,a=(c=1-(r=S[k]))*c*c*p+3*c*c*r*y+3*c*r*r*v+r*r*r*w,P[0][k]=a,u=c*c*c*m+3*c*c*r*b+3*c*r*r*x+r*r*r*C,P[1][k]=u,E[k]={X:a,Y:u};S[O]=0,S[O+1]=1,E[O]={X:p,Y:m},E[O+1]={X:w,Y:C},P[0][O]=p,P[1][O]=m,P[0][O+1]=w,P[1][O+1]=C,S.length=O+2,P[0].length=O+2,P[1].length=O+2,E.length=O+2;let M=Math.min.apply(null,P[0]),A=Math.min.apply(null,P[1]),T=Math.max.apply(null,P[0]),N=Math.max.apply(null,P[1]);return new co(M,A,T-M,N-A)}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 0===i?0:r/i}closestPointT(e,t={}){let n=this.getPrecision(t),r=this.getDivisions(t),i=Math.pow(10,-n),o=null,s=0,l=0,a=0,u=0,c=0,h=null,d=r.length,f=d>0?1/d:0;for(r.forEach((t,n)=>{let r=t.start.distance(e),i=t.end.distance(e),d=r+i;(null==h||d<h)&&(o=t,s=n*f,l=(n+1)*f,a=r,u=i,h=d,c=t.endpointDistance())});;){let t=a?Math.abs(a-u)/a:0,n=null!=u?Math.abs(a-u)/u:0,r=t<i||n<i,h=!a||a<c*i,d=!u||u<c*i,g=h||d;if(r||g)return a<=u?s:l;let p=o.divide(.5);f/=2;let m=p[0].start.distance(e),y=p[0].end.distance(e),b=m+y,v=p[1].start.distance(e),x=p[1].end.distance(e);b<=v+x?(o=p[0],l-=f,a=m,u=y):(o=p[1],s+=f,a=v,u=x)}}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(e){let t=this.start,n=this.controlPoint1,r=this.controlPoint2,i=this.end;if(e<=0)return[new cm(t,t,t,t),new cm(t,n,r,i)];if(e>=1)return[new cm(t,n,r,i),new cm(i,i,i,i)];let o=this.getSkeletonPoints(e),s=o.startControlPoint1,l=o.startControlPoint2,a=o.divider,u=o.dividerControlPoint1,c=o.dividerControlPoint2;return[new cm(t,s,l,a),new cm(a,u,c,i)]}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 o=new ca(t,n).pointAt(e),s=new ca(n,r).pointAt(e),l=new ca(r,i).pointAt(e),a=new ca(o,s).pointAt(e),u=new ca(s,l).pointAt(e),c=new ca(a,u).pointAt(e);return{startControlPoint1:o,startControlPoint2:a,divider:c,dividerControlPoint1:u,dividerControlPoint2:l}}getSubdivisions(e={}){let t=this.getPrecision(e),n=[new cm(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===t)return n;let r=this.endpointDistance(),i=Math.pow(10,-t),o=0;for(;;){o+=1;let e=[];n.forEach(t=>{let n=t.divide(.5);e.push(n[0],n[1])});let t=e.reduce((e,t)=>e+t.endpointDistance(),0),s=0!==t?(t-r)/t:0;if(o>1&&s<i)return e;n=e,r=t}}length(e={}){return this.getDivisions(e).reduce((e,t)=>e+t.endpointDistance(),0)}lengthAtT(e,t={}){if(e<=0)return 0;let n=void 0===t.precision?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,o=new ca(n,r);return o.translate(i.x-n.x,i.y-n.y),o}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getDivisions(e={}){if(null!=e.subdivisions)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);return this.tAtLength(r*e,n)}tAtLength(e,t={}){let n,r,i=!0;e<0&&(i=!1,e=-e);let o=this.getPrecision(t),s=this.getDivisions(t),l=null,a=0,u=0,c=0,h=s.length,d=h>0?1/h:0;for(let t=0;t<h;t+=1){let o=i?t:h-1-t,f=s[t],g=f.endpointDistance();if(e<=c+g){l=f,n=o*d,r=(o+1)*d,a=i?e-c:g+c-e,u=i?g+c-e:e-c;break}c+=g}if(null==l)return+!!i;let f=this.length({precision:o,subdivisions:s}),g=Math.pow(10,-o);for(;;){let e,t,i;if((0!==f?a/f:0)<g)return n;if((0!==f?u/f:0)<g)return r;let o=l.divide(.5);d/=2;let s=o[0].endpointDistance(),c=o[1].endpointDistance();a<=s?(l=o[0],r-=d,i=s-(t=a)):(l=o[1],n+=d,i=c-(t=a-s)),a=t,u=i}}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 cp(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"number"==typeof e?(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 null!=e&&this.start.equals(e.start)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)&&this.end.equals(e.end)}clone(){return new cm(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(" ")}}(G=cm||(cm={})).isCurve=function(e){return null!=e&&e instanceof G};var cy=cm||(cm={});function cb(e){let t=e.length,n=[],r=[],i=2;n[0]=e[0]/i;for(let o=1;o<t;o+=1)r[o]=1/i,i=(o<t-1?4:3.5)-r[o],n[o]=(e[o]-n[o-1])/i;for(let e=1;e<t;e+=1)n[t-e-1]-=r[t-e]*n[t-e];return n}cy.throughPoints=function(e){if(null==e||Array.isArray(e)&&e.length<2)throw Error("At least 2 points are required");let t=function(e){let t=e.map(e=>ci.clone(e)),n=[],r=[],i=t.length-1;if(1===i)return n[0]=new ci((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),r[0]=new ci(2*n[0].x-t[0].x,2*n[0].y-t[0].y),[n,r];let o=[];for(let e=1;e<i-1;e+=1)o[e]=4*t[e].x+2*t[e+1].x;o[0]=t[0].x+2*t[1].x,o[i-1]=(8*t[i-1].x+t[i].x)/2;let s=cb(o);for(let e=1;e<i-1;e+=1)o[e]=4*t[e].y+2*t[e+1].y;o[0]=t[0].y+2*t[1].y,o[i-1]=(8*t[i-1].y+t[i].y)/2;let l=cb(o);for(let e=0;e<i;e+=1)n.push(new ci(s[e],l[e])),e<i-1?r.push(new ci(2*t[e+1].x-s[e+1],2*t[e+1].y-l[e+1])):r.push(new ci((t[i].x+s[i-1])/2,(t[i].y+l[i-1])/2));return[n,r]}(e),n=[];for(let r=0,i=t[0].length;r<i;r+=1){let i=new ci(t[0][r].x,t[0][r].y),o=new ci(t[1][r].x,t[1][r].y);n.push(new cy(e[r],i,o,e[r+1]))}return n};class cv extends cr{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(null==this.previousSegment)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.")}}class cx extends cv{constructor(e,t){super(),ca.isLine(e)?this.endPoint=e.end.clone().round(2):this.endPoint=ci.create(e,t).round(2)}get type(){return"L"}get line(){return new ca(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[new cx(t[0]),new cx(t[1])]}divideAtLength(e){let t=this.line.divideAtLength(e);return[new cx(t[0]),new cx(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 null!=this.previousSegment&&!this.start.equals(this.end)}clone(){return new cx(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"number"==typeof e?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}`}}(H=cx||(cx={})).create=function(...e){let t=e.length,n=e[0];if(ca.isLine(n))return new H(n);if(ci.isPointLike(n))return 1===t?new H(n):e.map(e=>new H(e));if(2===t)return new H(+e[0],+e[1]);let r=[];for(let n=0;n<t;n+=2){let t=+e[n],i=+e[n+1];r.push(new H(t,i))}return r};class cw extends cv{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 ca(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 cx(t[0]):this.clone(),new cx(t[1])]}divideAtLength(e){let t=this.line.divideAtLength(e);return[t[1].isDifferentiable()?new cx(t[0]):this.clone(),new cx(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&&!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 cw}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}(q=cw||(cw={})).create=function(){return new q};class cC extends cv{constructor(e,t){super(),this.isVisible=!1,this.isSubpathStart=!0,ca.isLine(e)||cm.isCurve(e)?this.endPoint=e.end.clone().round(2):this.endPoint=ci.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"number"==typeof e?this.end.translate(e,t):this.end.translate(e),this}clone(){return new cC(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}`}}(W=cC||(cC={})).create=function(...e){let t=e.length,n=e[0];if(ca.isLine(n)||cm.isCurve(n))return new W(n);if(ci.isPointLike(n)){if(1===t)return new W(n);let r=[];for(let n=0;n<t;n+=1)0===n?r.push(new W(e[n])):r.push(new cx(e[n]));return r}if(2===t)return new W(+e[0],+e[1]);let r=[];for(let n=0;n<t;n+=2){let t=+e[n],i=+e[n+1];0===n?r.push(new W(t,i)):r.push(new cx(t,i))}return r};class cE extends cv{constructor(e,t,n,r,i,o){super(),cm.isCurve(e)?(this.controlPoint1=e.controlPoint1.clone().round(2),this.controlPoint2=e.controlPoint2.clone().round(2),this.endPoint=e.end.clone().round(2)):"number"==typeof e?(this.controlPoint1=new ci(e,t).round(2),this.controlPoint2=new ci(n,r).round(2),this.endPoint=new ci(i,o).round(2)):(this.controlPoint1=ci.create(e).round(2),this.controlPoint2=ci.create(t).round(2),this.endPoint=ci.create(n).round(2))}get type(){return"C"}get curve(){return new cm(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(e,t={}){let n=this.curve.divideAt(e,t);return[new cE(n[0]),new cE(n[1])]}divideAtLength(e,t={}){let n=this.curve.divideAtLength(e,t);return[new cE(n[0]),new cE(n[1])]}divideAtT(e){let t=this.curve.divideAtT(e);return[new cE(t[0]),new cE(t[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"number"==typeof e?(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 cE(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 cS(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function cP(e,t,n,r,i,o){return[1/3*e+2/3*n,1/3*t+2/3*r,1/3*i+2/3*n,1/3*o+2/3*r,i,o]}(J=cE||(cE={})).create=function(...e){let t=e.length,n=e[0];if(cm.isCurve(n))return new J(n);if(ci.isPointLike(n)){if(3===t)return new J(e[0],e[1],e[2]);let n=[];for(let r=0;r<t;r+=3)n.push(new J(e[r],e[r+1],e[r+2]));return n}if(6===t)return new J(e[0],e[1],e[2],e[3],e[4],e[5]);let r=[];for(let n=0;n<t;n+=6)r.push(new J(e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5]));return r};class ck extends cr{constructor(e){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(e))if(ca.isLine(e[0])||cm.isCurve(e[0])){let t=null;e.forEach((e,n)=>{0===n&&this.appendSegment(ck.createSegment("M",e.start)),null==t||t.end.equals(e.start)||this.appendSegment(ck.createSegment("M",e.start)),ca.isLine(e)?this.appendSegment(ck.createSegment("L",e.end)):cm.isCurve(e)&&this.appendSegment(ck.createSegment("C",e.controlPoint1,e.controlPoint2,e.end)),t=e})}else e.forEach(e=>{e.isSegment&&this.appendSegment(e)});else null!=e&&(ca.isLine(e)?(this.appendSegment(ck.createSegment("M",e.start)),this.appendSegment(ck.createSegment("L",e.end))):cm.isCurve(e)?(this.appendSegment(ck.createSegment("M",e.start)),this.appendSegment(ck.createSegment("C",e.controlPoint1,e.controlPoint2,e.end))):cp.isPolyline(e)?e.points&&e.points.length&&e.points.forEach((e,t)=>{let n=0===t?ck.createSegment("M",e):ck.createSegment("L",e);this.appendSegment(n)}):e.isSegment&&this.appendSegment(e))}get start(){let e=this.segments,t=e.length;if(0===t)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(0===t)return null;for(let n=t-1;n>=0;n-=1){let t=e[n];if(t.isVisible)return t.end}return e[t-1].end}moveTo(...e){return this.appendSegment(cC.create.call(null,...e))}lineTo(...e){return this.appendSegment(cx.create.call(null,...e))}curveTo(...e){return this.appendSegment(cE.create.call(null,...e))}arcTo(e,t,n,r,i,o,s){let l=this.end||new ci,a="number"==typeof o?cg(l.x,l.y,e,t,n,r,i,o,s):cg(l.x,l.y,e,t,n,r,i,o.x,o.y);if(null!=a)for(let e=0,t=a.length;e<t;e+=6)this.curveTo(a[e],a[e+1],a[e+2],a[e+3],a[e+4],a[e+5]);return this}quadTo(e,t,n,r){let i=this.end||new ci,o=["M",i.x,i.y];"number"==typeof e?o.push("Q",e,t,n,r):o.push("Q",e.x,e.y,t.x,t.y);let s=ck.parse(o.join(" "));return this.appendSegment(s.segments.slice(1)),this}close(){return this.appendSegment(cw.create())}drawPoints(e,t={}){let n=cf(e,t),r=ck.parse(n);r&&r.segments&&this.appendSegment(r.segments)}bbox(){let e,t=this.segments,n=t.length;if(0===n)return null;for(let r=0;r<n;r+=1){let n=t[r];if(n.isVisible){let t=n.bbox();null!=t&&(e=e?e.union(t):t)}}if(null!=e)return e;let r=t[n-1];return new co(r.end.x,r.end.y,0,0)}appendSegment(e){let t,n=this.segments.length,r=0!==n?this.segments[n-1]:null;if(Array.isArray(e))for(let n=0,i=e.length;n<i;n+=1){let i=e[n];t=this.prepareSegment(i,r,null),this.segments.push(t),r=t}else null!=e&&e.isSegment&&(t=this.prepareSegment(e,r,null),this.segments.push(t));return this}insertSegment(e,t){let n,r=this.segments.length;if(e<0&&(e=r+e+1),e>r||e<0)throw Error("Index out of range.");let i=null,o=null;if(0!==r&&(e>=1?o=(i=this.segments[e-1]).nextSegment:(i=null,o=this.segments[0])),Array.isArray(t))for(let r=0,s=t.length;r<s;r+=1){let s=t[r];n=this.prepareSegment(s,i,o),this.segments.splice(e+r,0,n),i=n}else n=this.prepareSegment(t,i,o),this.segments.splice(e,0,n);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,r=this.fixIndex(e),i=this.segments[r],o=i.previousSegment,s=i.nextSegment,l=i.isSubpathStart;if(Array.isArray(t)){this.segments.splice(e,1);for(let r=0,i=t.length;r<i;r+=1){let i=t[r];n=this.prepareSegment(i,o,s),this.segments.splice(e+r,0,n),o=n,l&&n.isSubpathStart&&(l=!1)}}else n=this.prepareSegment(t,o,s),this.segments.splice(r,1,n),l&&n.isSubpathStart&&(l=!1);l&&s&&this.updateSubpathStartSegment(s)}getSegment(e){let t=this.fixIndex(e);return this.segments[t]}fixIndex(e){let t=this.segments.length;if(0===t)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(0===this.segments.length)return null;let n=ta.clamp(e,0,1),r=this.getOptions(t),i=this.length(r);return this.segmentIndexAtLength(i*n,r)}segmentIndexAtLength(e,t={}){let n=this.segments.length;if(0===n)return null;let r=!0;e<0&&(r=!1,e=-e);let i=this.getPrecision(t),o=this.getSubdivisions(t),s=0,l=null;for(let t=0;t<n;t+=1){let a=r?t:n-1-t,u=this.segments[a],c=o[a],h=u.length({precision:i,subdivisions:c});if(u.isVisible){if(e<=s+h)return a;l=a}s+=h}return l}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;)null!=t?n.subpathStartSegment=t.subpathStartSegment:n.subpathStartSegment=null,t=n,n=n.nextSegment}prepareSegment(e,t,n){e.previousSegment=t,e.nextSegment=n,null!=t&&(t.nextSegment=e),null!=n&&(n.previousSegment=e);let r=e;return e.isSubpathStart&&(e.subpathStartSegment=e,r=n),null!=r&&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(0===r)return 0;let i=this.length(n);return 0===i?0:r/i}closestPointT(e,t={}){let n;if(0===this.segments.length)return null;let r=this.getPrecision(t),i=this.getSubdivisions(t),o=1/0;for(let t=0,s=this.segments.length;t<s;t+=1){let s=this.segments[t],l=i[t];if(s.isVisible){let i=s.closestPointT(e,{precision:r,subdivisions:l}),a=s.pointAtT(i),u=ta.squaredLength(a,e);u<o&&(n={segmentIndex:t,value:i},o=u)}}return n||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(e,t={}){let n;if(0===this.segments.length)return null;let r=this.getPrecision(t),i=this.getSubdivisions(t),o=1/0;for(let t=0,s=this.segments.length;t<s;t+=1){let s=this.segments[t],l=i[t];if(s.isDifferentiable()){let t=s.closestPointT(e,{precision:r,subdivisions:l}),i=s.pointAtT(t),a=ta.squaredLength(i,e);a<o&&(n=s.tangentAtT(t),o=a)}}return n||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(0===this.segments.length)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);return this.pointAtLength(r*e,n)}pointAtLength(e,t={}){let n;if(0===this.segments.length)return null;if(0===e)return this.start.clone();let r=!0;e<0&&(r=!1,e=-e);let i=this.getPrecision(t),o=this.getSubdivisions(t),s=0;for(let t=0,l=this.segments.length;t<l;t+=1){let a=r?t:l-1-t,u=this.segments[a],c=o[a],h=u.length({precision:i,subdivisions:c});if(u.isVisible){if(e<=s+h)return u.pointAtLength((r?1:-1)*(e-s),{precision:i,subdivisions:c});n=u}s+=h}return n?r?n.end:n.start:this.segments[this.segments.length-1].end.clone()}pointAtT(e){let t=this.segments,n=t.length;if(0===n)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=ta.clamp(e.value,0,1);return t[r].pointAtT(i)}divideAt(e,t={}){if(0===this.segments.length)return null;let n=ta.clamp(e,0,1),r=this.getOptions(t),i=this.length(r);return this.divideAtLength(i*n,r)}divideAtLength(e,t={}){let n,r,i,o,s;if(0===this.segments.length)return null;let l=!0;e<0&&(l=!1,e=-e);let a=this.getPrecision(t),u=this.getSubdivisions(t),c=0;for(let t=0,s=this.segments.length;t<s;t+=1){let h=l?t:s-1-t,d=this.getSegment(h),f={precision:a,subdivisions:u[h]},g=d.length(f);if(d.isDifferentiable()&&(i=d,o=h,e<=c+g)){r=h,n=d.divideAtLength((l?1:-1)*(e-c),f);break}c+=g}if(!i)return null;n||(r=o,s=+!!l,n=i.divideAtT(s));let h=this.clone(),d=r;h.replaceSegment(d,n);let f=d+1,g=d+2;n[0].isDifferentiable()||(h.removeSegment(d),f-=1,g-=1);let p=h.getSegment(f).start;h.insertSegment(f,ck.createSegment("M",p)),g+=1,n[1].isDifferentiable()||(h.removeSegment(g-1),g-=1);let m=g-d-1;for(let e=g,t=h.segments.length;e<t;e+=1){let t=this.getSegment(e-m),n=h.getSegment(e);if("Z"===n.type&&!t.subpathStartSegment.end.equals(n.subpathStartSegment.end)){let n=ck.createSegment("L",t.end);h.replaceSegment(e,n)}}return[new ck(h.segments.slice(0,f)),new ck(h.segments.slice(f))]}intersectsWithLine(e,t={}){let n=this.toPolylines(t);if(null==n)return null;let r=null;for(let t=0,i=n.length;t<i;t+=1){let i=n[t],o=e.intersect(i);o&&(null==r&&(r=[]),Array.isArray(o)?r.push(...o):r.push(o))}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 0===e.length||"M"===e[0].type}length(e={}){if(0===this.segments.length)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(0===n)return 0;let r=e.segmentIndex;if(r<0)return 0;let i=ta.clamp(e.value,0,1);r>=n&&(r=n-1,i=1);let o=this.getPrecision(t),s=this.getSubdivisions(t),l=0;for(let e=0;e<r;e+=1){let t=this.segments[e],n=s[e];l+=t.length({precision:o,subdivisions:n})}let a=this.segments[r],u=s[r];return l+a.lengthAtT(i,{precision:o,subdivisions:u})}tangentAt(e,t={}){if(0===this.segments.length)return null;let n=ta.clamp(e,0,1),r=this.getOptions(t),i=this.length(r);return this.tangentAtLength(i*n,r)}tangentAtLength(e,t={}){let n;if(0===this.segments.length)return null;let r=!0;e<0&&(r=!1,e=-e);let i=this.getPrecision(t),o=this.getSubdivisions(t),s=0;for(let t=0,l=this.segments.length;t<l;t+=1){let a=r?t:l-1-t,u=this.segments[a],c=o[a],h=u.length({precision:i,subdivisions:c});if(u.isDifferentiable()){if(e<=s+h)return u.tangentAtLength((r?1:-1)*(e-s),{precision:i,subdivisions:c});n=u}s+=h}if(n){let e=+!!r;return n.tangentAtT(e)}return null}tangentAtT(e){let t=this.segments.length;if(0===t)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=ta.clamp(e.value,0,1);return this.segments[n].tangentAtT(r)}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getSubdivisions(e={}){if(null==e.segmentSubdivisions){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(0===n)return null;let r=this.getSubdivisions(e),i=[],o=[];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=>o.push(e.start)):o.push(n.start)}else o.length>0&&(o.push(t[e-1].end),i.push(o),o=[])}return o.length>0&&(o.push(this.end),i.push(o)),i}toPolylines(e={}){let t=this.toPoints(e);return t?t.map(e=>new cp(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"number"==typeof e?this.segments.forEach(n=>n.translate(e,t)):this.segments.forEach(t=>t.translate(e)),this}clone(){let e=new ck;return this.segments.forEach(t=>e.appendSegment(t.clone())),e}equals(e){if(null==e)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()}}(X=ck||(ck={})).isPath=function(e){return null!=e&&e instanceof X};var cO=ck||(ck={});function cM(e,...t){if("M"===e)return cC.create.call(null,...t);if("L"===e)return cx.create.call(null,...t);if("C"===e)return cE.create.call(null,...t);if("z"===e||"Z"===e)return cw.create();throw Error(`Invalid path segment type "${e}"`)}cO.parse=function(e){if(!e)return new cO;let t=new cO,n=cO.normalize(e).match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g);if(null!=n)for(let e=0,r=n.length;e<r;e+=1){let r=n[e],i=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,o=r.match(i);if(null!=o){let e=o[0],n=cM.call(null,e,...o.slice(1).map(e=>+e));t.appendSegment(n)}}return t},cO.createSegment=cM,(Y=ck||(ck={})).normalize=function(e){return(function(e){let t=function(e){let t=function(e){if(!e)return null;let t=" \n\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},o=[];return e.replace(n,(e,t,n)=>{let s=[],l=t.toLowerCase();n.replace(r,(e,t)=>(t&&s.push(+t),e)),"m"===l&&s.length>2&&(o.push([t,...s.splice(0,2)]),l="l",t="m"===t?"l":"L");let a=i[l];for(;s.length>=a&&(o.push([t,...s.splice(0,a)]),a););return e}),o}(e);if(!t||!t.length)return[["M",0,0]];let n=0,r=0,i=0,o=0,s=[];for(let e=0,l=t.length;e<l;e+=1){let l=[];s.push(l);let a=t[e],u=a[0];if(u!==u.toUpperCase())switch(l[0]=u.toUpperCase(),l[0]){case"A":l[1]=a[1],l[2]=a[2],l[3]=a[3],l[4]=a[4],l[5]=a[5],l[6]=+a[6]+n,l[7]=+a[7]+r;break;case"V":l[1]=+a[1]+r;break;case"H":l[1]=+a[1]+n;break;case"M":i=+a[1]+n,o=+a[2]+r;for(let e=1,t=a.length;e<t;e+=1)l[e]=+a[e]+(e%2?n:r);break;default:for(let e=1,t=a.length;e<t;e+=1)l[e]=+a[e]+(e%2?n:r)}else for(let e=0,t=a.length;e<t;e+=1)l[e]=a[e];switch(l[0]){case"Z":n=+i,r=+o;break;case"H":n=l[1];break;case"V":r=l[1];break;case"M":i=l[l.length-2],o=l[l.length-1],n=l[l.length-2],r=l[l.length-1];break;default:n=l[l.length-2],r=l[l.length-1]}}return s}(e),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r=[],i="",o=t.length;for(let e=0;e<o;e+=1){let l="";t[e]&&(l=t[e][0]),"C"!==l&&(r[e]=l,e>0&&(i=r[e-1])),t[e]=function(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":if(0===parseFloat(e[1])||0===parseFloat(e[2]))return["L",e[6],e[7]];return["C"].concat((function e(t,n,r,i,o,s,l,a,u,c){let h,d,f,g,p,m=120*Math.PI/180,y=Math.PI/180*(+o||0),b=[];if(c)d=c[0],f=c[1],g=c[2],p=c[3];else{t=(h=cS(t,n,-y)).x,n=h.y,a=(h=cS(a,u,-y)).x,u=h.y;let e=(t-a)/2,o=(n-u)/2,c=e*e/(r*r)+o*o/(i*i);c>1&&(r*=c=Math.sqrt(c),i*=c);let m=r*r,b=i*i,v=(s===l?-1:1)*Math.sqrt(Math.abs((m*b-m*o*o-b*e*e)/(m*o*o+b*e*e)));g=v*r*o/i+(t+a)/2,p=-(v*i)*e/r+(n+u)/2,d=Math.asin((n-p)/i),f=Math.asin((u-p)/i),d=t<g?Math.PI-d:d,f=a<g?Math.PI-f:f,d<0&&(d=2*Math.PI+d),f<0&&(f=2*Math.PI+f),l&&d>f&&(d-=2*Math.PI),!l&&f>d&&(f-=2*Math.PI)}let v=f-d;if(Math.abs(v)>m){let t=f,n=a,s=u;b=e(a=g+r*Math.cos(f=d+m*(l&&f>d?1:-1)),u=p+i*Math.sin(f),r,i,o,0,l,n,s,[f,t,g,p])}v=f-d;let x=Math.cos(d),w=Math.cos(f),C=Math.tan(v/4),E=4/3*(r*C),S=4/3*(i*C),P=[t,n],k=[t+E*Math.sin(d),n-S*x],O=[a+E*Math.sin(f),u-S*w],M=[a,u];if(k[0]=2*P[0]-k[0],k[1]=2*P[1]-k[1],c)return[k,O,M].concat(b);{b=[k,O,M].concat(b).join().split(",");let e=[],t=b.length;for(let n=0;n<t;n+=1)e[n]=n%2?cS(+b[n-1],+b[n],y).y:cS(+b[n],+b[n+1],y).x;return e}}).apply(0,[t.x,t.y].concat(e.slice(1))));case"S":return"C"===n||"S"===n?(r=2*t.x-t.bx,i=2*t.y-t.by):(r=t.x,i=t.y),["C",r,i].concat(e.slice(1));case"T":return"Q"===n||"T"===n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),["C"].concat(cP(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(cP(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}(t[e],n,i),"A"!==r[e]&&"C"===l&&(r[e]="C");var s=e;if(t[s].length>7){t[s].shift();let e=t[s];for(;e.length;)r[s]="A",s+=1,t.splice(s,0,["C"].concat(e.splice(0,6)));t.splice(s,1),o=t.length}let a=t[e],u=a.length;n.x=a[u-2],n.y=a[u-1],n.bx=parseFloat(a[u-4])||n.x,n.by=parseFloat(a[u-3])||n.y}return t[0][0]&&"M"===t[0][0]||t.unshift(["M",0,0]),t})(e).map(e=>e.map(e=>"string"==typeof e?e:ta.round(e,2))).join(",").split(",").join(" ")},Y.isValid=function(e){return"string"==typeof e&&cd.test(e)},Y.drawArc=function(e,t,n,r,i=0,o=0,s=0,l,a){let u=[],c=cg(e,t,n,r,i,o,s,l,a);if(null!=c)for(let e=0,t=c.length;e<t;e+=6)u.push("C",c[e],c[e+1],c[e+2],c[e+3],c[e+4],c[e+5]);return u.join(" ")},Y.drawPoints=cf,Y.arcToCurves=cg;class cA{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("object"==typeof e)return void Object.entries(e).forEach(([e,n])=>{this.register(e,n,t)});!this.exist(e)||n||e2.isApplyingHMR()||this.onDuplicated(e);let r=this.options.process,i=r?nx(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&&null!=this.data[e]}onDuplicated(e){try{throw this.options.onConflict&&nx(this.options.onConflict,this,e),Error(`${la(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),r=t?`${t} ${lf(this.options.type)}`:this.options.type;return`${la(r)} with name '${e}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(e){return function(e,t,n){let r,i=Math.min(2,Math.floor(.34*e.length)),o=Math.floor(.4*e.length)+1,s=!1,l=e.toLowerCase();for(let a of t){let t=n(a);if(void 0!==t&&Math.abs(t.length-l.length)<=i){let n=t.toLowerCase();if(n===l){if(t===e)continue;return a}if(s||t.length<3)continue;let i=function(e,t,n){let r=Array(t.length+1),i=Array(t.length+1),o=n+1;for(let e=0;e<=t.length;e+=1)r[e]=e;for(let s=1;s<=e.length;s+=1){let l=e.charCodeAt(s-1),a=s>n?s-n:1,u=t.length>n+s?n+s:t.length;i[0]=s;let c=s;for(let e=1;e<a;e+=1)i[e]=o;for(let e=a;e<=u;e+=1){let n=l===t.charCodeAt(e-1)?r[e-1]:Math.min(r[e]+1,i[e-1]+1,r[e-1]+2);i[e]=n,c=Math.min(c,n)}for(let e=u+1;e<=t.length;e+=1)i[e]=o;if(c>n)return;let h=r;r=i,i=h}let s=r[t.length];return s>n?void 0:s}(l,n,o-1);if(void 0===i)continue;i<3?s=!0:o=i,r=a}}return r}(e,Object.keys(this.data),e=>e)}}(Q=cA||(cA={})).create=function(e){return new Q(e)};let cT={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){let n=t.thickness*t.sx,r=t.thickness*t.sy;aC(e,{width:n,height:r,rx:n,ry:r,fill:t.color})}},cN={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){let n=t.sx<=1?t.thickness*t.sx:t.thickness;aC(e,{width:n,height:n,rx:n,ry:n,fill:t.color})}},cj={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let n,r=t.width,i=t.height,o=t.thickness;aC(e,{d:r-o>=0&&i-o>=0?["M",r,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",stroke:t.color,"stroke-width":t.thickness})}},cL=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let n,r=t.width,i=t.height,o=t.thickness;aC(e,{d:r-o>=0&&i-o>=0?["M",r,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",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,o=t.height*r,s=t.thickness;n=i-s>=0&&o-s>=0?["M",i,0,"H0 M0 0 V0",o].join(" "):"M 0 0 0 0",t.width=i,t.height=o,aC(e,{d:n,stroke:t.color,"stroke-width":t.thickness})}}];class cR{constructor(){this.patterns={},this.root=aX.create(l7(),{width:"100%",height:"100%"},[l8("defs")]).node}add(e,t){let n=this.root.childNodes[0];n&&n.appendChild(t),this.patterns[e]=t,aX.create("rect",{width:"100%",height:"100%",fill:`url(#${e})`}).appendTo(this.root)}get(e){return this.patterns[e]}has(e){return null!=this.patterns[e]}}(Z=cR||(cR={})).presets=tD,Z.registry=cA.create({type:"grid"}),Z.registry.register(Z.presets,!0);let cI=function(e){let t=document.createElement("canvas"),n=e.width,r=e.height;t.width=2*n,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},c_=function(e){let t=document.createElement("canvas"),n=e.width,r=e.height;t.width=n,t.height=2*r;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},cz=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},cD=function(e,t){let n=e.width,r=e.height,i=document.createElement("canvas");i.width=3*n,i.height=3*r;let o=i.getContext("2d"),s=null!=t.angle?-t.angle:-20,l=tl.toRad(s),a=i.width/4,u=i.height/4;for(let t=0;t<4;t+=1)for(let i=0;i<4;i+=1)(t+i)%2>0&&(o.setTransform(1,0,0,1,(2*t-1)*a,(2*i-1)*u),o.rotate(l),o.drawImage(e,-n/2,-r/2,n,r));return i};function cB(e,t){return null!=e?e:t}function cV(e,t){return null!=e&&Number.isFinite(e)?e:t}function cF(e={}){let t=cB(e.color,"blue"),n=cV(e.width,1),r=cV(e.margin,2),i=cV(e.opacity,1);return`
|
|
189
|
+
`;r.kJ.prototype.isSnaplineEnabled=function(){let e=this.getPlugin("snapline");return!!e&&e.isEnabled()},r.kJ.prototype.enableSnapline=function(){let e=this.getPlugin("snapline");return e&&e.enable(),this},r.kJ.prototype.disableSnapline=function(){let e=this.getPlugin("snapline");return e&&e.disable(),this},r.kJ.prototype.toggleSnapline=function(){let e=this.getPlugin("snapline");return e&&e.toggleEnabled(),this},r.kJ.prototype.hideSnapline=function(){let e=this.getPlugin("snapline");return e&&e.hide(),this},r.kJ.prototype.setSnaplineFilter=function(e){let t=this.getPlugin("snapline");return t&&t.setFilter(e),this},r.kJ.prototype.isSnaplineOnResizingEnabled=function(){let e=this.getPlugin("snapline");return!!e&&e.isOnResizingEnabled()},r.kJ.prototype.enableSnaplineOnResizing=function(){let e=this.getPlugin("snapline");return e&&e.enableOnResizing(),this},r.kJ.prototype.disableSnaplineOnResizing=function(){let e=this.getPlugin("snapline");return e&&e.disableOnResizing(),this},r.kJ.prototype.toggleSnaplineOnResizing=function(e){let t=this.getPlugin("snapline");return t&&t.toggleOnResizing(e),this},r.kJ.prototype.isSharpSnapline=function(){let e=this.getPlugin("snapline");return!!e&&e.isSharp()},r.kJ.prototype.enableSharpSnapline=function(){let e=this.getPlugin("snapline");return e&&e.enableSharp(),this},r.kJ.prototype.disableSharpSnapline=function(){let e=this.getPlugin("snapline");return e&&e.disableSharp(),this},r.kJ.prototype.toggleSharpSnapline=function(e){let t=this.getPlugin("snapline");return t&&t.toggleSharp(e),this},r.kJ.prototype.getSnaplineTolerance=function(){let e=this.getPlugin("snapline");if(e)return e.getTolerance()},r.kJ.prototype.setSnaplineTolerance=function(e){let t=this.getPlugin("snapline");return t&&t.setTolerance(e),this};class l extends r.JT{constructor(e={}){super(),this.name="snapline",this.options=Object.assign({enabled:!0,tolerance:10},e),r.mf.ensure(this.name,s)}init(e){this.snaplineImpl=new o(Object.assign(Object.assign({},this.options),{graph:e}))}isEnabled(){return!this.snaplineImpl.disabled}enable(){this.snaplineImpl.enable()}disable(){this.snaplineImpl.disable()}toggleEnabled(e){if(null==e)return this.isEnabled()?this.disable():this.enable(),this;e!==this.isEnabled()&&(e?this.enable():this.disable())}hide(){return this.snaplineImpl.hide(),this}setFilter(e){return this.snaplineImpl.setFilter(e),this}isOnResizingEnabled(){return!0===this.snaplineImpl.options.resizing}enableOnResizing(){return this.snaplineImpl.options.resizing=!0,this}disableOnResizing(){return this.snaplineImpl.options.resizing=!1,this}toggleOnResizing(e){return null!=e?e!==this.isOnResizingEnabled()&&(e?this.enableOnResizing():this.disableOnResizing()):this.isOnResizingEnabled()?this.disableOnResizing():this.enableOnResizing(),this}isSharp(){return!0===this.snaplineImpl.options.sharp}enableSharp(){return this.snaplineImpl.options.sharp=!0,this}disableSharp(){return this.snaplineImpl.options.sharp=!1,this}toggleSharp(e){return null!=e?e!==this.isSharp()&&(e?this.enableSharp():this.disableSharp()):this.isSharp()?this.disableSharp():this.enableSharp(),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(),r.mf.clean(this.name)}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([r.JT.dispose()],l.prototype,"dispose",null)},2403:function(e,t,n){"use strict";n.d(t,{z2:function(){return p}});var r,i,o=n(5535);class s extends o.NB{}var l=s||(s={});function a(e){let t=[],n=o.Lu.getForeignObjectMarkup();return e?t.push({tagName:e,selector:"body"},n):t.push(n),t}l.config({view:"react-shape-view",markup:a(),attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}},propHooks(e){if(null==e.markup){let t=e.primer;if(t){e.markup=a(t);let n={};switch(t){case"circle":n={refCx:"50%",refCy:"50%",refR:"50%"};break;case"ellipse":n={refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}e.attrs=o.QK.merge({},{body:Object.assign({refWidth:null,refHeight:null},n)},e.attrs||{})}}return e}}),o.NB.registry.register("react-shape",l,!0);var u=n(8156),c=n.n(u),h=n(5350),d=n(9195);!function(e){let t,n=!1,r=(e,t)=>{let n=t.payload;switch(t.type){case"add":{let t=e.findIndex(e=>e.id===n.id);if(t>=0)return e[t]=n,[...e];return[...e,n]}case"remove":{let t=e.findIndex(e=>e.id===n.id);if(t>=0){let n=[...e];return n.splice(t,1),n}}}return e};e.connect=function(e,r){n&&t({type:"add",payload:{id:e,portal:r}})},e.disconnect=function(e){n&&t({type:"remove",payload:{id:e}})},e.isActive=function(){return n},e.getProvider=function(){return()=>{n=!0;let[e,i]=(0,u.useReducer)(r,[]);return t=i,c().createElement(c().Fragment,{children:e.map(e=>e.portal)})}}}(i||(i={}));var f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let g={};function p(e){let{shape:t,component:n,effect:r,inherit:i}=e,s=f(e,["shape","component","effect","inherit"]);if(!t)throw Error("should specify shape in config");g[t]={component:n,effect:r},o.kJ.registerNode(t,Object.assign({inherit:i||"react-shape"},s),!0)}class m extends c().PureComponent{constructor(e){super(e),this.state={tick:0}}componentDidMount(){let{node:e}=this.props;e.on("change:*",({key:t})=>{let n=g[e.shape];if(n){let{effect:e}=n;(!e||e.includes(t))&&this.setState({tick:this.state.tick+1})}})}clone(e){let{node:t,graph:n}=this.props;return"string"==typeof e.type?c().cloneElement(e):c().cloneElement(e,{node:t,graph:n})}render(){let{node:e}=this.props,t=g[e.shape];if(!t)return null;let{component:n}=t;return c().isValidElement(n)?this.clone(n):this.clone(c().createElement(n,null))}}class y extends o.DK{targetId(){return`${this.graph.view.cid}:${this.cell.id}`}getComponentContainer(){return this.selectors&&this.selectors.foContent}confirmUpdate(e){let t=super.confirmUpdate(e);return this.handleAction(t,y.action,()=>{this.renderReactComponent()})}renderReactComponent(){this.unmountReactComponent();let e=this.getComponentContainer(),t=this.cell;if(e){let n=c().createElement(m,{node:t,graph:this.graph});if(i.isActive()){let t=(0,h.createPortal)(n,e);i.connect(this.targetId(),t)}else this.root=(0,d.createRoot)(e),this.root.render(n)}}unmountReactComponent(){this.getComponentContainer()&&this.root&&(this.root.unmount(),this.root=void 0)}onMouseDown(e,t,n){let r=e.target;if("input"===r.tagName.toLowerCase()){let e=r.getAttribute("type");if(null==e||["text","password","number","email","search","tel","url"].includes(e))return}super.onMouseDown(e,t,n)}unmount(){return i.isActive()&&i.disconnect(this.targetId()),this.unmountReactComponent(),super.unmount(),this}}(r=y||(y={})).action="react",r.config({bootstrap:[r.action],actions:{component:r.action}}),o.DK.registry.register("react-shape-view",r,!0)},5535:function(e,t,n){"use strict";let r,i,o,s,l,a,u,c,h;n.d(t,{RZ:function(){return tl},RO:function(){return tL},bL:function(){return gy},kJ:function(){return pe},NB:function(){return gx},t4:function(){return e2},tw:function(){return gV},QK:function(){return tj},DK:function(){return gD},tx:function(){return ti},ew:function(){return oQ},GH:function(){return tR},E9:function(){return ci},Ae:function(){return co},iC:function(){return gZ},mf:function(){return tz},Iw:function(){return tI},OW:function(){return aX},De:function(){return dl},FE:function(){return gP},Lu:function(){return tv},is:function(){return t_},JT:function(){return tZ},Zr:function(){return tf},G7:function(){return dq}});var d,f,g,p,m,y,b,v,x,w,C,E,S,P,k,O,M,A,T,N,j,L,R,I,_,z,D,B,V,F,$,U,G,H,q,W,J,X,Y,Q,Z,K,ee,et,en,er,ei,eo,es,el,ea,eu,ec,eh,ed,ef,eg,ep,em,ey,eb,ev,ex,ew,eC,eE,eS,eP,ek,eO,eM,eA,eT,eN,ej,eL,eR,eI,e_,ez,eD,eB,eV,eF,e$,eU,eG,eH,eq,eW,eJ,eX,eY,eQ,eZ,eK,e0,e1,e2,e3,e5,e6,e4,e9,e8,e7,te,tt,tn,tr,ti,to,ts,tl,ta,tu,tc,th,td,tf,tg,tp,tm,ty,tb,tv,tx,tw,tC,tE,tS,tP,tk,tO,tM,tA,tT,tN,tj={};n.r(tj),n.d(tj,{applyMixins:function(){return oD},clone:function(){return ov},cloneDeep:function(){return of},createClass:function(){return o$},defaults:function(){return ie},defaultsDeep:function(){return r4},ensure:function(){return oU},flatten:function(){return function e(t,n="/",r){let i={};for(let o in Object.keys(t).forEach(o=>{let s=t[o],l="object"==typeof s||Array.isArray(s);if(l&&r&&r(s)&&(l=!1),l){let t=e(s,n,r);Object.keys(t).forEach(e=>{i[o+n+e]=t[e]})}else i[o]=s}),t)if(!Object.prototype.hasOwnProperty.call(t,o))continue;return i}},getBoolean:function(){return oq},getByPath:function(){return oJ},getNumber:function(){return oH},getValue:function(){return oG},has:function(){return ob},inherit:function(){return oV},isEmpty:function(){return op},isEqual:function(){return oz},isMaliciousProp:function(){return oW},isObject:function(){return t0},isPlainObject:function(){return rj},merge:function(){return r9},pick:function(){return iA},setByPath:function(){return oX},unsetByPath:function(){return oY}});var tL={};n.r(tL),n.d(tL,{difference:function(){return sx},groupBy:function(){return sf},max:function(){return sb},sortBy:function(){return sk},sortedIndex:function(){return se},sortedIndexBy:function(){return sg},union:function(){return sp},uniq:function(){return o6}});var tR={};n.r(tR),n.d(tR,{clamp:function(){return lx},isNumber:function(){return lv},isPercentage:function(){return lE},mod:function(){return lw},normalizePercentage:function(){return lS},normalizeSides:function(){return lk},parseCssNumeric:function(){return lP},random:function(){return lC}});var tI={};n.r(tI),n.d(tI,{apply:function(){return nv},call:function(){return nx},debounce:function(){return ny},isAsync:function(){return nC},isAsyncLike:function(){return nw},throttle:function(){return nb},toAsyncBoolean:function(){return nE},toDeferredBoolean:function(){return nS}});var t_={};n.r(t_),n.d(t_,{CASE_SENSITIVE_ATTR:function(){return ay},Event:function(){return te},EventHook:function(){return e6},EventObject:function(){return uV},KAPPA:function(){return a3},MouseWheelHandle:function(){return uq},addClass:function(){return lQ},after:function(){return ad},append:function(){return au},appendTo:function(){return af},attr:function(){return aC},before:function(){return ah},breakText:function(){return a2},children:function(){return am},circleToPathData:function(){return ut},clearSelection:function(){return aD},computeStyle:function(){return aF},computeStyleInt:function(){return a$},contains:function(){return as},createElement:function(){return l4},createElementNS:function(){return l9},createSVGMatrix:function(){return uf},createSVGPoint:function(){return ud},createSVGTransform:function(){return ug},createSlicePathData:function(){return ul},createSvgDocument:function(){return l7},createSvgElement:function(){return l8},css:function(){return aU},data:function(){return aW},decomposeMatrix:function(){return uv},ellipseToPathData:function(){return un},empty:function(){return aa},ensureId:function(){return l2},find:function(){return ar},findOne:function(){return ai},findParentByClass:function(){return ao},getAttribute:function(){return ab},getClass:function(){return lX},getComputedStyle:function(){return a_},getData:function(){return aH},getPointsFromSvgElement:function(){return ue},getTransformToElement:function(){return uO},getTransformToParentElement:function(){return uM},getVendorPrefixedName:function(){return aR},hasClass:function(){return lY},hasScrollbars:function(){return az},height:function(){return uX},index:function(){return an},isCSSVariable:function(){return aV},isElement:function(){return ag},isHTMLElement:function(){return ap},isSVGGraphicsElement:function(){return l3},kebablizeAttrs:function(){return aS},lineToPathData:function(){return a4},matrixToRotation:function(){return uw},matrixToScale:function(){return ux},matrixToTransformString:function(){return um},matrixToTranslation:function(){return uC},measureText:function(){return a0},mergeAttrs:function(){return ak},ns:function(){return l5},offset:function(){return uW},parseTransformString:function(){return uy},parseXML:function(){return ae},polygonToPathData:function(){return a9},polylineToPathData:function(){return a8},position:function(){return uY},prepend:function(){return ac},prop:function(){return function e(t,n,r){if(n){if("string"==typeof n)return(n=aJ[n]||n,arguments.length<3)?t[n]:void(t[n]=r);for(let r in n)e(t,r,n[r])}}},qualifyAttr:function(){return aE},rectToPathData:function(){return ui},rectangleToPathData:function(){return ur},remove:function(){return al},removeAttribute:function(){return av},removeClass:function(){return lZ},rotate:function(){return uP},sample:function(){return a6},scale:function(){return uk},setAttribute:function(){return ax},setAttributes:function(){return aw},setData:function(){return aq},setPrefixedStyle:function(){return aI},splitTextByLength:function(){return a1},styleToObject:function(){return aP},svgVersion:function(){return l6},tagName:function(){return at},text:function(){return aK},toLocalPoint:function(){return uA},toPath:function(){return uo},toPathData:function(){return us},toggleClass:function(){return lK},transform:function(){return uE},transformStringToMatrix:function(){return up},translate:function(){return uS},uniqueId:function(){return l1},width:function(){return uJ}});var tz={};n.r(tz),n.d(tz,{clean:function(){return cn},ensure:function(){return ct}});var tD={};n.r(tD),n.d(tD,{dot:function(){return cT},doubleMesh:function(){return cL},fixedDot:function(){return cN},mesh:function(){return cj}});var tB={};n.r(tB),n.d(tB,{flipX:function(){return cI},flipXY:function(){return cz},flipY:function(){return c_},watermark:function(){return cD}});var tV={};n.r(tV),n.d(tV,{blur:function(){return cU},brightness:function(){return cY},contrast:function(){return cQ},dropShadow:function(){return cG},grayScale:function(){return cH},highlight:function(){return c$},hueRotate:function(){return cJ},invert:function(){return cX},outline:function(){return cF},saturate:function(){return cW},sepia:function(){return cq}});var tF={};n.r(tF),n.d(tF,{async:function(){return hX},block:function(){return hB},circle:function(){return hQ},circlePlus:function(){return hZ},classic:function(){return hV},cross:function(){return hW},diamond:function(){return hU},ellipse:function(){return h0},path:function(){return hH}});var t$={};n.r(t$),n.d(t$,{annotations:function(){return hP},atConnectionLength:function(){return dr},atConnectionLengthIgnoreGradient:function(){return de},atConnectionLengthKeepGradient:function(){return h7},atConnectionRatio:function(){return di},atConnectionRatioIgnoreGradient:function(){return dn},atConnectionRatioKeepGradient:function(){return dt},connection:function(){return h8},displayEmpty:function(){return hO},eol:function(){return hk},fill:function(){return hy},filter:function(){return hI},html:function(){return hR},lineHeight:function(){return hC},port:function(){return h_},ref:function(){return cZ},refCx:function(){return c7},refCy:function(){return he},refD:function(){return hs},refDKeepOffset:function(){return hn},refDResetOffset:function(){return ht},refDx:function(){return c1},refDy:function(){return c2},refHeight:function(){return c5},refHeight2:function(){return hh},refPoints:function(){return hl},refPointsKeepOffset:function(){return hi},refPointsResetOffset:function(){return hr},refR:function(){return ho},refRCircumscribed:function(){return c8},refRInscribed:function(){return c9},refRx:function(){return c6},refRy:function(){return c4},refWidth:function(){return c3},refWidth2:function(){return hc},refX:function(){return cK},refX2:function(){return ha},refY:function(){return c0},refY2:function(){return hu},resetOffset:function(){return hN},sourceMarker:function(){return h3},stroke:function(){return hb},style:function(){return hL},targetMarker:function(){return h5},text:function(){return hv},textPath:function(){return hS},textVerticalAnchor:function(){return hE},textWrap:function(){return hx},title:function(){return hM},vertexMarker:function(){return h6},xAlign:function(){return hA},yAlign:function(){return hT}});var tU={};n.r(tU),n.d(tU,{className:function(){return du},opacity:function(){return dh},stroke:function(){return df}});var tG={};n.r(tG),n.d(tG,{absolute:function(){return db},bottom:function(){return dO},ellipse:function(){return dv},ellipseSpread:function(){return dx},left:function(){return dS},line:function(){return dE},right:function(){return dP},top:function(){return dk}});var tH={};n.r(tH),n.d(tH,{bottom:function(){return dI},inside:function(){return dD},insideOriented:function(){return dB},left:function(){return dj},manual:function(){return dN},outside:function(){return d_},outsideOriented:function(){return dz},radial:function(){return dU},radialOriented:function(){return dG},right:function(){return dL},top:function(){return dR}});var tq={};n.r(tq),n.d(tq,{noop:function(){return dK},pinAbsolute:function(){return d3},pinRelative:function(){return d2}});var tW={};n.r(tW),n.d(tW,{bottom:function(){return fg},bottomLeft:function(){return fv},bottomRight:function(){return fx},center:function(){return fd},left:function(){return fp},midSide:function(){return fk},nodeCenter:function(){return fP},orth:function(){return fS},right:function(){return fm},top:function(){return ff},topLeft:function(){return fy},topRight:function(){return fb}});var tJ={};n.r(tJ),n.d(tJ,{closest:function(){return fT},length:function(){return fM},orth:function(){return fN},ratio:function(){return fO}});var tX={};n.r(tX),n.d(tX,{anchor:function(){return fz},bbox:function(){return fR},boundary:function(){return f_},rect:function(){return fI}});var tY={};n.r(tY),n.d(tY,{er:function(){return gt},loop:function(){return gr},manhattan:function(){return f8},metro:function(){return ge},normal:function(){return fD},oneSide:function(){return fB},orth:function(){return fG}});var tQ={};n.r(tQ),n.d(tQ,{jumpover:function(){return gf},loop:function(){return go},normal:function(){return gi},rounded:function(){return gs},smooth:function(){return gl}}),n(9652);class tZ{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}(tZ||(tZ={})).dispose=function(){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))}}};class tK{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()}}(d=tK||(tK={})).from=function(e){let t=new d;return e.forEach(e=>{t.add(e)}),t};var t0=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},t1="object"==typeof global&&global&&global.Object===Object&&global,t2="object"==typeof self&&self&&self.Object===Object&&self,t3=t1||t2||Function("return this")(),t5=function(){return t3.Date.now()},t6=/\s/,t4=function(e){for(var t=e.length;t--&&t6.test(e.charAt(t)););return t},t9=/^\s+/,t8=t3.Symbol,t7=Object.prototype,ne=t7.hasOwnProperty,nt=t7.toString,nn=t8?t8.toStringTag:void 0,nr=function(e){var t=ne.call(e,nn),n=e[nn];try{e[nn]=void 0;var r=!0}catch(e){}var i=nt.call(e);return r&&(t?e[nn]=n:delete e[nn]),i},ni=Object.prototype.toString,no=t8?t8.toStringTag:void 0,ns=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":no&&no in Object(e)?nr(e):ni.call(e)},nl=function(e){return null!=e&&"object"==typeof e},na=function(e){return"symbol"==typeof e||nl(e)&&"[object Symbol]"==ns(e)},nu=0/0,nc=/^[-+]0x[0-9a-f]+$/i,nh=/^0b[01]+$/i,nd=/^0o[0-7]+$/i,nf=parseInt,ng=function(e){if("number"==typeof e)return e;if(na(e))return nu;if(t0(e)){var t,n="function"==typeof e.valueOf?e.valueOf():e;e=t0(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)?t.slice(0,t4(t)+1).replace(t9,""):t;var r=nh.test(e);return r||nd.test(e)?nf(e.slice(2),r?2:8):nc.test(e)?nu:+e},np=Math.max,nm=Math.min,ny=function(e,t,n){var r,i,o,s,l,a,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw TypeError("Expected a function");function f(t){var n=r,o=i;return r=i=void 0,u=t,s=e.apply(o,n)}function g(e){var n=e-a,r=e-u;return void 0===a||n>=t||n<0||h&&r>=o}function p(){var e,n,r,i=t5();if(g(i))return m(i);l=setTimeout(p,(e=i-a,n=i-u,r=t-e,h?nm(r,o-n):r))}function m(e){return(l=void 0,d&&r)?f(e):(r=i=void 0,s)}function y(){var e,n=t5(),o=g(n);if(r=arguments,i=this,a=n,o){if(void 0===l)return u=e=a,l=setTimeout(p,t),c?f(e):s;if(h)return clearTimeout(l),l=setTimeout(p,t),f(a)}return void 0===l&&(l=setTimeout(p,t)),s}return t=ng(t)||0,t0(n)&&(c=!!n.leading,o=(h="maxWait"in n)?np(ng(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==l&&clearTimeout(l),u=0,r=a=i=l=void 0},y.flush=function(){return void 0===l?s:m(t5())},y},nb=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw TypeError("Expected a function");return t0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ny(e,t,{leading:r,maxWait:t,trailing:i})};function nv(e,t,n){if(n)switch(n.length){case 0:break;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 nx(e,t,...n){return nv(e,t,n)}function nw(e){return"object"==typeof e&&e.then&&"function"==typeof e.then}function nC(e){return null!=e&&(e instanceof Promise||nw(e))}function nE(...e){let t=[];return(e.forEach(e=>{Array.isArray(e)?t.push(...e):t.push(e)}),t.some(e=>nC(e)))?Promise.all(t.map(e=>nC(e)?e:Promise.resolve(!1!==e))).then(e=>e.reduce((e,t)=>!1!==t&&e,!0)):t.every(e=>!1!==e)}function nS(...e){let t=nE(e);return"boolean"==typeof t?Promise.resolve(t):t}function nP(e,t){let n=[];for(let r=0;r<e.length;r+=2){let i=e[r],o=nv(i,e[r+1],Array.isArray(t)?t:[t]);n.push(o)}return nE(n)}class nk{constructor(){this.listeners={}}on(e,t,n){return null==t||(this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t,n)),this}once(e,t,n){let r=(...i)=>(this.off(e,r),nP([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))return void delete r[e];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];null!=r&&(n=nP([...r],t))}let r=this.listeners["*"];return null!=r?nE([n,nP([...r],[e,...t])]):n}emit(e,...t){return this.trigger(e,...t)}}var nO=function(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)},nM=function(e){return e},nA=Math.max,nT=function(e,t,n){return t=nA(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=nA(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(s),nO(e,this,l)}},nN=function(e){if(!t0(e))return!1;var t=ns(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},nj=t3["__core-js_shared__"],nL=(f=/[^.]+$/.exec(nj&&nj.keys&&nj.keys.IE_PROTO||""))?"Symbol(src)_1."+f:"",nR=Function.prototype.toString,nI=function(e){if(null!=e){try{return nR.call(e)}catch(e){}try{return e+""}catch(e){}}return""},n_=/^\[object .+?Constructor\]$/,nz=Object.prototype,nD=Function.prototype.toString,nB=nz.hasOwnProperty,nV=RegExp("^"+nD.call(nB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nF=function(e){return!!t0(e)&&(!nL||!(nL in e))&&(nN(e)?nV:n_).test(nI(e))},n$=function(e,t){var n=null==e?void 0:e[t];return nF(n)?n:void 0},nU=function(){try{var e=n$(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),nG=Date.now,nH=(g=nU?function(e,t){return nU(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:nM,p=0,m=0,function(){var e=nG(),t=16-(e-m);if(m=e,t>0){if(++p>=800)return arguments[0]}else p=0;return g.apply(void 0,arguments)}),nq=function(e,t){return nH(nT(e,t,nM),e+"")},nW=function(e,t){return e===t||e!=e&&t!=t},nJ=function(e,t){for(var n=e.length;n--;)if(nW(e[n][0],t))return n;return -1},nX=Array.prototype.splice;function nY(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}nY.prototype.clear=function(){this.__data__=[],this.size=0},nY.prototype.delete=function(e){var t=this.__data__,n=nJ(t,e);return!(n<0)&&(n==t.length-1?t.pop():nX.call(t,n,1),--this.size,!0)},nY.prototype.get=function(e){var t=this.__data__,n=nJ(t,e);return n<0?void 0:t[n][1]},nY.prototype.has=function(e){return nJ(this.__data__,e)>-1},nY.prototype.set=function(e,t){var n=this.__data__,r=nJ(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var nQ=n$(t3,"Map"),nZ=n$(Object,"create"),nK=Object.prototype.hasOwnProperty,n0=Object.prototype.hasOwnProperty;function n1(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}n1.prototype.clear=function(){this.__data__=nZ?nZ(null):{},this.size=0},n1.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},n1.prototype.get=function(e){var t=this.__data__;if(nZ){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return nK.call(t,e)?t[e]:void 0},n1.prototype.has=function(e){var t=this.__data__;return nZ?void 0!==t[e]:n0.call(t,e)},n1.prototype.set=function(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=nZ&&void 0===t?"__lodash_hash_undefined__":t,this};var n2=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},n3=function(e,t){var n=e.__data__;return n2(t)?n["string"==typeof t?"string":"hash"]:n.map};function n5(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function n6(e){var t=this.__data__=new nY(e);this.size=t.size}n5.prototype.clear=function(){this.size=0,this.__data__={hash:new n1,map:new(nQ||nY),string:new n1}},n5.prototype.delete=function(e){var t=n3(this,e).delete(e);return this.size-=+!!t,t},n5.prototype.get=function(e){return n3(this,e).get(e)},n5.prototype.has=function(e){return n3(this,e).has(e)},n5.prototype.set=function(e,t){var n=n3(this,e),r=n.size;return n.set(e,t),this.size+=+(n.size!=r),this},n6.prototype.clear=function(){this.__data__=new nY,this.size=0},n6.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},n6.prototype.get=function(e){return this.__data__.get(e)},n6.prototype.has=function(e){return this.__data__.has(e)},n6.prototype.set=function(e,t){var n=this.__data__;if(n instanceof nY){var r=n.__data__;if(!nQ||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new n5(r)}return n.set(e,t),this.size=n.size,this};var n4=function(e,t,n){"__proto__"==t&&nU?nU(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},n9=function(e,t,n){(void 0===n||nW(e[t],n))&&(void 0!==n||t in e)||n4(e,t,n)},n8=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var l=o[++r];if(!1===t(i[l],l,i))break}return e},n7="object"==typeof exports&&exports&&!exports.nodeType&&exports,re=n7&&"object"==typeof module&&module&&!module.nodeType&&module,rt=re&&re.exports===n7?t3.Buffer:void 0,rn=rt?rt.allocUnsafe:void 0,rr=function(e,t){if(t)return e.slice();var n=e.length,r=rn?rn(n):new e.constructor(n);return e.copy(r),r},ri=t3.Uint8Array,ro=function(e){var t=new e.constructor(e.byteLength);return new ri(t).set(new ri(e)),t},rs=function(e,t){var n=t?ro(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},rl=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t},ra=Object.create,ru=function(){function e(){}return function(t){if(!t0(t))return{};if(ra)return ra(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),rc=function(e,t){return function(n){return e(t(n))}},rh=rc(Object.getPrototypeOf,Object),rd=Object.prototype,rf=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||rd)},rg=function(e){return"function"!=typeof e.constructor||rf(e)?{}:ru(rh(e))},rp=function(e){return nl(e)&&"[object Arguments]"==ns(e)},rm=Object.prototype,ry=rm.hasOwnProperty,rb=rm.propertyIsEnumerable,rv=rp(function(){return arguments}())?rp:function(e){return nl(e)&&ry.call(e,"callee")&&!rb.call(e,"callee")},rx=Array.isArray,rw=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},rC=function(e){return null!=e&&rw(e.length)&&!nN(e)},rE=function(e){return nl(e)&&rC(e)},rS="object"==typeof exports&&exports&&!exports.nodeType&&exports,rP=rS&&"object"==typeof module&&module&&!module.nodeType&&module,rk=rP&&rP.exports===rS?t3.Buffer:void 0,rO=(rk?rk.isBuffer:void 0)||function(){return!1},rM=Object.prototype,rA=Function.prototype.toString,rT=rM.hasOwnProperty,rN=rA.call(Object),rj=function(e){if(!nl(e)||"[object Object]"!=ns(e))return!1;var t=rh(e);if(null===t)return!0;var n=rT.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&rA.call(n)==rN},rL={};rL["[object Float32Array]"]=rL["[object Float64Array]"]=rL["[object Int8Array]"]=rL["[object Int16Array]"]=rL["[object Int32Array]"]=rL["[object Uint8Array]"]=rL["[object Uint8ClampedArray]"]=rL["[object Uint16Array]"]=rL["[object Uint32Array]"]=!0,rL["[object Arguments]"]=rL["[object Array]"]=rL["[object ArrayBuffer]"]=rL["[object Boolean]"]=rL["[object DataView]"]=rL["[object Date]"]=rL["[object Error]"]=rL["[object Function]"]=rL["[object Map]"]=rL["[object Number]"]=rL["[object Object]"]=rL["[object RegExp]"]=rL["[object Set]"]=rL["[object String]"]=rL["[object WeakMap]"]=!1;var rR=function(e){return function(t){return e(t)}},rI="object"==typeof exports&&exports&&!exports.nodeType&&exports,r_=rI&&"object"==typeof module&&module&&!module.nodeType&&module,rz=r_&&r_.exports===rI&&t1.process,rD=function(){try{var e=r_&&r_.require&&r_.require("util").types;if(e)return e;return rz&&rz.binding&&rz.binding("util")}catch(e){}}(),rB=rD&&rD.isTypedArray,rV=rB?rR(rB):function(e){return nl(e)&&rw(e.length)&&!!rL[ns(e)]},rF=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},r$=Object.prototype.hasOwnProperty,rU=function(e,t,n){var r=e[t];r$.call(e,t)&&nW(r,n)&&(void 0!==n||t in e)||n4(e,t,n)},rG=function(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var l=t[o],a=r?r(n[l],e[l],l,n,e):void 0;void 0===a&&(a=e[l]),i?n4(n,l,a):rU(n,l,a)}return n},rH=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},rq=/^(?:0|[1-9]\d*)$/,rW=function(e,t){var n=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==n||"symbol"!=n&&rq.test(e))&&e>-1&&e%1==0&&e<t},rJ=Object.prototype.hasOwnProperty,rX=function(e,t){var n=rx(e),r=!n&&rv(e),i=!n&&!r&&rO(e),o=!n&&!r&&!i&&rV(e),s=n||r||i||o,l=s?rH(e.length,String):[],a=l.length;for(var u in e)(t||rJ.call(e,u))&&!(s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||rW(u,a)))&&l.push(u);return l},rY=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},rQ=Object.prototype.hasOwnProperty,rZ=function(e){if(!t0(e))return rY(e);var t=rf(e),n=[];for(var r in e)"constructor"==r&&(t||!rQ.call(e,r))||n.push(r);return n},rK=function(e){return rC(e)?rX(e,!0):rZ(e)},r0=function(e,t,n,r,i,o,s){var l=rF(e,n),a=rF(t,n),u=s.get(a);if(u)return void n9(e,n,u);var c=o?o(l,a,n+"",e,t,s):void 0,h=void 0===c;if(h){var d=rx(a),f=!d&&rO(a),g=!d&&!f&&rV(a);(c=a,d||f||g)?rx(l)?c=l:rE(l)?c=rl(l):f?(h=!1,c=rr(a,!0)):g?(h=!1,c=rs(a,!0)):c=[]:rj(a)||rv(a)?(c=l,rv(l))?c=rG(l,rK(l)):(!t0(l)||nN(l))&&(c=rg(a)):h=!1}h&&(s.set(a,c),i(c,a,r,o,s),s.delete(a)),n9(e,n,c)},r1=function e(t,n,r,i,o){t!==n&&n8(n,function(s,l){if(o||(o=new n6),t0(s))r0(t,n,l,r,e,i,o);else{var a=i?i(rF(t,l),s,l+"",t,n,o):void 0;void 0===a&&(a=s),n9(t,l,a)}},rK)},r2=function e(t,n,r,i,o,s){return t0(t)&&t0(n)&&(s.set(n,t),r1(t,n,void 0,e,s),s.delete(n)),t},r3=function(e,t,n){if(!t0(n))return!1;var r=typeof t;return("number"==r?!!(rC(n)&&rW(t,n.length)):"string"==r&&t in n)&&nW(n[t],e)},r5=function(e){return nq(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&r3(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var l=n[r];l&&e(t,l,r,o)}return t})},r6=r5(function(e,t,n,r){r1(e,t,n,r)}),r4=nq(function(e){return e.push(void 0,r2),nO(r6,void 0,e)}),r9=r5(function(e,t,n){r1(e,t,n)}),r8=Object.prototype,r7=r8.hasOwnProperty,ie=nq(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&r3(t[0],t[1],i)&&(r=1);++n<r;)for(var o=t[n],s=rK(o),l=-1,a=s.length;++l<a;){var u=s[l],c=e[u];(void 0===c||nW(c,r8[u])&&!r7.call(e,u))&&(e[u]=o[u])}return e}),it=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ir=/^\w*$/,ii=function(e,t){if(rx(e))return!1;var n=typeof e;return!!("number"==n||"symbol"==n||"boolean"==n||null==e||na(e))||ir.test(e)||!it.test(e)||null!=t&&e in Object(t)};function io(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(io.Cache||n5),n}io.Cache=n5;var is=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,il=/\\(\\)?/g,ia=(b=(y=io(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(is,function(e,n,r,i){t.push(r?i.replace(il,"$1"):n||e)}),t},function(e){return 500===b.size&&b.clear(),e})).cache,y),iu=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},ic=1/0,ih=t8?t8.prototype:void 0,id=ih?ih.toString:void 0,ig=function e(t){if("string"==typeof t)return t;if(rx(t))return iu(t,e)+"";if(na(t))return id?id.call(t):"";var n=t+"";return"0"==n&&1/t==-ic?"-0":n},ip=function(e){return null==e?"":ig(e)},im=function(e,t){return rx(e)?e:ii(e,t)?[e]:ia(ip(e))},iy=1/0,ib=function(e){if("string"==typeof e||na(e))return e;var t=e+"";return"0"==t&&1/e==-iy?"-0":t},iv=function(e,t){t=im(t,e);for(var n=0,r=t.length;null!=e&&n<r;)e=e[ib(t[n++])];return n&&n==r?e:void 0},ix=function(e,t,n,r){if(!t0(e))return e;t=im(t,e);for(var i=-1,o=t.length,s=o-1,l=e;null!=l&&++i<o;){var a=ib(t[i]),u=n;if("__proto__"===a||"constructor"===a||"prototype"===a)break;if(i!=s){var c=l[a];void 0===(u=r?r(c,a,l):void 0)&&(u=t0(c)?c:rW(t[i+1])?[]:{})}rU(l,a,u),l=l[a]}return e},iw=function(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],l=iv(e,s);n(l,s)&&ix(o,im(s,e),l)}return o},iC=function(e,t){return null!=e&&t in Object(e)},iE=function(e,t,n){t=im(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=ib(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&rw(i)&&rW(s,i)&&(rx(e)||rv(e))},iS=function(e,t){return null!=e&&iE(e,t,iC)},iP=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},ik=t8?t8.isConcatSpreadable:void 0,iO=function(e){return rx(e)||rv(e)||!!(ik&&e&&e[ik])},iM=function e(t,n,r,i,o){var s=-1,l=t.length;for(r||(r=iO),o||(o=[]);++s<l;){var a=t[s];n>0&&r(a)?n>1?e(a,n-1,r,i,o):iP(o,a):i||(o[o.length]=a)}return o},iA=nH(nT(v=function(e,t){return null==e?{}:iw(e,t,function(t,n){return iS(e,n)})},void 0,function(e){return(null==e?0:e.length)?iM(e,1):[]}),v+""),iT=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e},iN=rc(Object.keys,Object),ij=Object.prototype.hasOwnProperty,iL=function(e){if(!rf(e))return iN(e);var t=[];for(var n in Object(e))ij.call(e,n)&&"constructor"!=n&&t.push(n);return t},iR=function(e){return rC(e)?rX(e):iL(e)},iI=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o},i_=function(){return[]},iz=Object.prototype.propertyIsEnumerable,iD=Object.getOwnPropertySymbols,iB=iD?function(e){return null==e?[]:iI(iD(e=Object(e)),function(t){return iz.call(e,t)})}:i_,iV=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)iP(t,iB(e)),e=rh(e);return t}:i_,iF=function(e,t,n){var r=t(e);return rx(e)?r:iP(r,n(e))},i$=function(e){return iF(e,iR,iB)},iU=function(e){return iF(e,rK,iV)},iG=n$(t3,"DataView"),iH=n$(t3,"Promise"),iq=n$(t3,"Set"),iW=n$(t3,"WeakMap"),iJ="[object Map]",iX="[object Promise]",iY="[object Set]",iQ="[object WeakMap]",iZ="[object DataView]",iK=nI(iG),i0=nI(nQ),i1=nI(iH),i2=nI(iq),i3=nI(iW),i5=ns;(iG&&i5(new iG(new ArrayBuffer(1)))!=iZ||nQ&&i5(new nQ)!=iJ||iH&&i5(iH.resolve())!=iX||iq&&i5(new iq)!=iY||iW&&i5(new iW)!=iQ)&&(i5=function(e){var t=ns(e),n="[object Object]"==t?e.constructor:void 0,r=n?nI(n):"";if(r)switch(r){case iK:return iZ;case i0:return iJ;case i1:return iX;case i2:return iY;case i3:return iQ}return t});var i6=i5,i4=Object.prototype.hasOwnProperty,i9=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&i4.call(e,"index")&&(n.index=e.index,n.input=e.input),n},i8=function(e,t){var n=t?ro(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},i7=/\w*$/,oe=function(e){var t=new e.constructor(e.source,i7.exec(e));return t.lastIndex=e.lastIndex,t},ot=t8?t8.prototype:void 0,on=ot?ot.valueOf:void 0,or=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return ro(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return i8(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return rs(e,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return oe(e);case"[object Symbol]":return on?Object(on.call(e)):{}}},oi=rD&&rD.isMap,oo=oi?rR(oi):function(e){return nl(e)&&"[object Map]"==i6(e)},os=rD&&rD.isSet,ol=os?rR(os):function(e){return nl(e)&&"[object Set]"==i6(e)},oa="[object Arguments]",ou="[object Function]",oc="[object Object]",oh={};oh[oa]=oh["[object Array]"]=oh["[object ArrayBuffer]"]=oh["[object DataView]"]=oh["[object Boolean]"]=oh["[object Date]"]=oh["[object Float32Array]"]=oh["[object Float64Array]"]=oh["[object Int8Array]"]=oh["[object Int16Array]"]=oh["[object Int32Array]"]=oh["[object Map]"]=oh["[object Number]"]=oh[oc]=oh["[object RegExp]"]=oh["[object Set]"]=oh["[object String]"]=oh["[object Symbol]"]=oh["[object Uint8Array]"]=oh["[object Uint8ClampedArray]"]=oh["[object Uint16Array]"]=oh["[object Uint32Array]"]=!0,oh["[object Error]"]=oh[ou]=oh["[object WeakMap]"]=!1;var od=function e(t,n,r,i,o,s){var l,a=1&n,u=2&n,c=4&n;if(r&&(l=o?r(t,i,o,s):r(t)),void 0!==l)return l;if(!t0(t))return t;var h=rx(t);if(h){if(l=i9(t),!a)return rl(t,l)}else{var d,f,g,p,m=i6(t),y=m==ou||"[object GeneratorFunction]"==m;if(rO(t))return rr(t,a);if(m==oc||m==oa||y&&!o){if(l=u||y?{}:rg(t),!a)return u?(f=(d=l)&&rG(t,rK(t),d),rG(t,iV(t),f)):(p=(g=l)&&rG(t,iR(t),g),rG(t,iB(t),p))}else{if(!oh[m])return o?t:{};l=or(t,m,a)}}s||(s=new n6);var b=s.get(t);if(b)return b;s.set(t,l),ol(t)?t.forEach(function(i){l.add(e(i,n,r,i,t,s))}):oo(t)&&t.forEach(function(i,o){l.set(o,e(i,n,r,o,t,s))});var v=c?u?iU:i$:u?rK:iR,x=h?void 0:v(t);return iT(x||t,function(i,o){x&&(i=t[o=i]),rU(l,o,e(i,n,r,o,t,s))}),l},of=function(e){return od(e,5)},og=Object.prototype.hasOwnProperty,op=function(e){if(null==e)return!0;if(rC(e)&&(rx(e)||"string"==typeof e||"function"==typeof e.splice||rO(e)||rV(e)||rv(e)))return!e.length;var t=i6(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(rf(e))return!iL(e).length;for(var n in e)if(og.call(e,n))return!1;return!0},om=Object.prototype.hasOwnProperty,oy=function(e,t){return null!=e&&om.call(e,t)},ob=function(e,t){return null!=e&&iE(e,t,oy)},ov=function(e){return od(e,4)};function ox(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new n5;++t<n;)this.add(e[t])}ox.prototype.add=ox.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ox.prototype.has=function(e){return this.__data__.has(e)};var ow=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},oC=function(e,t){return e.has(t)},oE=function(e,t,n,r,i,o){var s=1&n,l=e.length,a=t.length;if(l!=a&&!(s&&a>l))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var h=-1,d=!0,f=2&n?new ox:void 0;for(o.set(e,t),o.set(t,e);++h<l;){var g=e[h],p=t[h];if(r)var m=s?r(p,g,h,t,e,o):r(g,p,h,e,t,o);if(void 0!==m){if(m)continue;d=!1;break}if(f){if(!ow(t,function(e,t){if(!oC(f,t)&&(g===e||i(g,e,n,r,o)))return f.push(t)})){d=!1;break}}else if(!(g===p||i(g,p,n,r,o))){d=!1;break}}return o.delete(e),o.delete(t),d},oS=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},oP=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},ok=t8?t8.prototype:void 0,oO=ok?ok.valueOf:void 0,oM=function(e,t,n,r,i,o,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!o(new ri(e),new ri(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return nW(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=oS;case"[object Set]":var a=1&r;if(l||(l=oP),e.size!=t.size&&!a)break;var u=s.get(e);if(u)return u==t;r|=2,s.set(e,t);var c=oE(l(e),l(t),r,i,o,s);return s.delete(e),c;case"[object Symbol]":if(oO)return oO.call(e)==oO.call(t)}return!1},oA=Object.prototype.hasOwnProperty,oT=function(e,t,n,r,i,o){var s=1&n,l=i$(e),a=l.length;if(a!=i$(t).length&&!s)return!1;for(var u=a;u--;){var c=l[u];if(!(s?c in t:oA.call(t,c)))return!1}var h=o.get(e),d=o.get(t);if(h&&d)return h==t&&d==e;var f=!0;o.set(e,t),o.set(t,e);for(var g=s;++u<a;){var p=e[c=l[u]],m=t[c];if(r)var y=s?r(m,p,c,t,e,o):r(p,m,c,e,t,o);if(!(void 0===y?p===m||i(p,m,n,r,o):y)){f=!1;break}g||(g="constructor"==c)}if(f&&!g){var b=e.constructor,v=t.constructor;b!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof v&&v instanceof v)&&(f=!1)}return o.delete(e),o.delete(t),f},oN="[object Arguments]",oj="[object Array]",oL="[object Object]",oR=Object.prototype.hasOwnProperty,oI=function(e,t,n,r,i,o){var s=rx(e),l=rx(t),a=s?oj:i6(e),u=l?oj:i6(t);a=a==oN?oL:a,u=u==oN?oL:u;var c=a==oL,h=u==oL,d=a==u;if(d&&rO(e)){if(!rO(t))return!1;s=!0,c=!1}if(d&&!c)return o||(o=new n6),s||rV(e)?oE(e,t,n,r,i,o):oM(e,t,a,n,r,i,o);if(!(1&n)){var f=c&&oR.call(e,"__wrapped__"),g=h&&oR.call(t,"__wrapped__");if(f||g){var p=f?e.value():e,m=g?t.value():t;return o||(o=new n6),i(p,m,n,r,o)}}return!!d&&(o||(o=new n6),oT(e,t,n,r,i,o))},o_=function e(t,n,r,i,o){return t===n||(null!=t&&null!=n&&(nl(t)||nl(n))?oI(t,n,r,i,e,o):t!=t&&n!=n)},oz=function(e,t){return o_(e,t)};function oD(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{"constructor"!==n&&Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})}let oB=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 oV(e,t){function n(){this.constructor=e}oB(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}let oF=/^\s*class\s+/.test(`${class{}}`)||/^\s*class\s*\{/.test(`${class{}}`);function o$(e,t){let n;return oF?n=class extends t{}:oV(n=function(){return t.apply(this,arguments)},t),Object.defineProperty(n,"name",{value:e}),n}function oU(e,t){return null!=e?e:t}function oG(e,t,n){let r=null!=e?e[t]:null;return void 0!==n?oU(r,n):r}function oH(e,t,n){let r=null!=e?e[t]:null;return null==r||Number.isNaN(r*=1)||!Number.isFinite(r)?n:r}function oq(e,t,n){let r=null!=e?e[t]:null;return null==r?n:!!r}function oW(e){return"__proto__"===e}function oJ(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))return;r=r[e]}return r}function oX(e,t,n,r="/"){let i=Array.isArray(t)?t:t.split(r),o=i.pop();if(o&&!oW(o)){let t=e;i.forEach(e=>{oW(e)||(null==t[e]&&(t[e]={}),t=t[e])}),t[o]=n}return e}function oY(e,t,n="/"){let r=Array.isArray(t)?t.slice():t.split(n),i=r.pop();if(i)if(r.length>0){let t=oJ(e,r);t&&delete t[i]}else delete e[i];return e}class oQ extends nk{dispose(){this.off()}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([tZ.dispose()],oQ.prototype,"dispose",null),(oQ||(oQ={})).dispose=tZ.dispose,oD(oQ,tZ);var oZ=function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return -1},oK=function(e){return e!=e},o0=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return -1},o1=function(e,t){return!!(null==e?0:e.length)&&(t==t?o0(e,t,0):oZ(e,oK,0))>-1},o2=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1},o3=iq&&1/oP(new iq([,-0]))[1]==1/0?function(e){return new iq(e)}:function(){},o5=function(e,t,n){var r=-1,i=o1,o=e.length,s=!0,l=[],a=l;if(n)s=!1,i=o2;else if(o>=200){var u=t?null:o3(e);if(u)return oP(u);s=!1,i=oC,a=new ox}else a=t?[]:l;e:for(;++r<o;){var c=e[r],h=t?t(c):c;if(c=n||0!==c?c:0,s&&h==h){for(var d=a.length;d--;)if(a[d]===h)continue e;t&&a.push(h),l.push(c)}else i(a,h,n)||(a!==l&&a.push(h),l.push(c))}return l},o6=function(e){return e&&e.length?o5(e):[]},o4=Math.floor,o9=Math.min,o8=function(e,t,n,r){var i=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=n(t))!=t,l=null===t,a=na(t),u=void 0===t;i<o;){var c=o4((i+o)/2),h=n(e[c]),d=void 0!==h,f=null===h,g=h==h,p=na(h);if(s)var m=r||g;else m=u?g&&(r||d):l?g&&d&&(r||!f):a?g&&d&&!f&&(r||!p):!f&&!p&&(r?h<=t:h<t);m?i=c+1:o=c}return o9(o,0xfffffffe)},o7=function(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=0x7fffffff){for(;r<i;){var o=r+i>>>1,s=e[o];null!==s&&!na(s)&&(n?s<=t:s<t)?r=o+1:i=o}return i}return o8(e,t,nM,n)},se=function(e,t){return o7(e,t)},st=function(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r},sn=(x=function(e,t){return e&&n8(e,t,iR)},function(e,t){if(null==e)return e;if(!rC(e))return x(e,t);for(var n=e.length,r=-1,i=Object(e);(w?r--:++r<n)&&!1!==t(i[r],r,i););return e}),sr=function(e,t,n,r){return sn(e,function(e,i,o){t(r,e,n(e),o)}),r},si=function(e,t,n,r){var i=n.length,o=i,s=!r;if(null==e)return!o;for(e=Object(e);i--;){var l=n[i];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<o;){var a=(l=n[i])[0],u=e[a],c=l[1];if(s&&l[2]){if(void 0===u&&!(a in e))return!1}else{var h=new n6;if(r)var d=r(u,c,a,e,t,h);if(!(void 0===d?o_(c,u,3,r,h):d))return!1}}return!0},so=function(e){return e==e&&!t0(e)},ss=function(e){for(var t=iR(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,so(i)]}return t},sl=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}},sa=function(e){var t=ss(e);return 1==t.length&&t[0][2]?sl(t[0][0],t[0][1]):function(n){return n===e||si(n,e,t)}},su=function(e,t,n){var r=null==e?void 0:iv(e,t);return void 0===r?n:r},sc=function(e){var t;return ii(e)?(t=ib(e),function(e){return null==e?void 0:e[t]}):function(t){return iv(t,e)}},sh=function(e){if("function"==typeof e)return e;if(null==e)return nM;if("object"==typeof e){var t,n;return rx(e)?(t=e[0],n=e[1],ii(t)&&so(n)?sl(ib(t),n):function(e){var r=su(e,t);return void 0===r&&r===n?iS(e,t):o_(n,r,3)}):sa(e)}return sc(e)},sd=Object.prototype.hasOwnProperty,sf=(C=function(e,t,n){sd.call(e,n)?e[n].push(t):n4(e,n,[t])},function(e,t){return(rx(e)?st:sr)(e,C,sh(t,2),{})}),sg=function(e,t,n){return o8(e,t,sh(n,2))},sp=nq(function(e){return o5(iM(e,1,rE,!0))}),sm=function(e,t,n){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=t(o);if(null!=s&&(void 0===l?s==s&&!na(s):n(s,l)))var l=s,a=o}return a},sy=function(e,t){return e>t},sb=function(e){return e&&e.length?sm(e,nM,sy):void 0},sv=function(e,t,n,r){var i=-1,o=o1,s=!0,l=e.length,a=[],u=t.length;if(!l)return a;n&&(t=iu(t,rR(n))),r?(o=o2,s=!1):t.length>=200&&(o=oC,s=!1,t=new ox(t));e:for(;++i<l;){var c=e[i],h=null==n?c:n(c);if(c=r||0!==c?c:0,s&&h==h){for(var d=u;d--;)if(t[d]===h)continue e;a.push(c)}else o(t,h,r)||a.push(c)}return a},sx=nq(function(e,t){return rE(e)?sv(e,iM(t,1,rE,!0)):[]}),sw=function(e,t){var n=-1,r=rC(e)?Array(e.length):[];return sn(e,function(e,i,o){r[++n]=t(e,i,o)}),r},sC=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e},sE=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=na(e),s=void 0!==t,l=null===t,a=t==t,u=na(t);if(!l&&!u&&!o&&e>t||o&&s&&a&&!l&&!u||r&&s&&a||!n&&a||!i)return 1;if(!r&&!o&&!u&&e<t||u&&n&&i&&!r&&!o||l&&n&&i||!s&&i||!a)return -1}return 0},sS=function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,l=n.length;++r<s;){var a=sE(i[r],o[r]);if(a){if(r>=l)return a;return a*("desc"==n[r]?-1:1)}}return e.index-t.index},sP=function(e,t,n){t=t.length?iu(t,function(e){return rx(e)?function(t){return iv(t,1===e.length?e[0]:e)}:e}):[nM];var r=-1;return t=iu(t,rR(sh)),sC(sw(e,function(e,n,i){return{criteria:iu(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return sS(e,t,n)})},sk=nq(function(e,t){if(null==e)return[];var n=t.length;return n>1&&r3(e,t[0],t[1])?t=[]:n>2&&r3(t[0],t[1],t[2])&&(t=[t[0]]),sP(e,iM(t,1),[])}),sO=function(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n},sM=(E={À:"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"},function(e){return null==E?void 0:E[e]}),sA=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,sT=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),sN=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,sj=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,sL="\ud800-\udfff",sR="\\u2700-\\u27bf",sI="a-z\\xdf-\\xf6\\xf8-\\xff",s_="A-Z\\xc0-\\xd6\\xd8-\\xde",sz="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",sD="['’]",sB="["+sz+"]",sV="["+sI+"]",sF="[^"+sL+sz+"\\d+"+sR+sI+s_+"]",s$="(?:\ud83c[\udde6-\uddff]){2}",sU="[\ud800-\udbff][\udc00-\udfff]",sG="["+s_+"]",sH="(?:"+sV+"|"+sF+")",sq="(?:"+sG+"|"+sF+")",sW="(?:"+sD+"(?:d|ll|m|re|s|t|ve))?",sJ="(?:"+sD+"(?:D|LL|M|RE|S|T|VE))?",sX="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\ud83c[\udffb-\udfff])?",sY="[\\ufe0e\\ufe0f]?",sQ="(?:\\u200d(?:"+["[^"+sL+"]",s$,sU].join("|")+")"+sY+sX+")*",sZ="(?:"+["["+sR+"]",s$,sU].join("|")+")"+(sY+sX+sQ),sK=RegExp([sG+"?"+sV+"+"+sW+"(?="+[sB,sG,"$"].join("|")+")",sq+"+"+sJ+"(?="+[sB,sG+sH,"$"].join("|")+")",sG+"?"+sH+"+"+sW,sG+"+"+sJ,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",sZ].join("|"),"g"),s0=function(e,t,n){if(e=ip(e),void 0===(t=n?void 0:t)){var r;return(r=e,sj.test(r))?e.match(sK)||[]:e.match(sN)||[]}return e.match(t)||[]},s1=RegExp("['’]","g"),s2=function(e){return function(t){var n;return sO(s0(((n=ip(n=t))&&n.replace(sA,sM).replace(sT,"")).replace(s1,"")),e,"")}},s3=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o},s5=function(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:s3(e,t,n)},s6=RegExp("[\\u200d\ud800-\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),s4=function(e){return s6.test(e)},s9="\ud800-\udfff",s8="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",s7="\ud83c[\udffb-\udfff]",le="[^"+s9+"]",lt="(?:\ud83c[\udde6-\uddff]){2}",ln="[\ud800-\udbff][\udc00-\udfff]",lr="(?:"+s8+"|"+s7+")?",li="[\\ufe0e\\ufe0f]?",lo="(?:\\u200d(?:"+[le,lt,ln].join("|")+")"+li+lr+")*",ls=RegExp(s7+"(?="+s7+")|"+("(?:"+[le+s8+"?",s8,lt,ln,"["+s9+"]"].join("|"))+")"+(li+lr+lo),"g"),ll=function(e){return function(t){var n,r=s4(t=ip(t))?s4(n=t)?n.match(ls)||[]:n.split(""):void 0,i=r?r[0]:t.charAt(0),o=r?s5(r,1).join(""):t.slice(1);return i[e]()+o}},la=ll("toUpperCase"),lu=s2(function(e,t,n){return e+(n?" ":"")+la(t)}),lc=s2(function(e,t,n){return t=t.toLowerCase(),e+(n?la(ip(t).toLowerCase()):t)}),lh=s2(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ld=s2(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),lf=ll("toLowerCase");let lg=e=>{let t=Object.create(null);return n=>t[n]||(t[n]=e(n))},lp=lg(e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase()),lm=lg(e=>lu(lc(e)).replace(/ /g,""));function ly(e){let t=0x811c9dc5,n=!1,r=e;for(let e=0,i=r.length;e<i;e+=1){let i=r.charCodeAt(e);i>127&&!n&&(i=(r=unescape(encodeURIComponent(r))).charCodeAt(e),n=!0),t^=i,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function lb(){let e="",t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let n=0,r=t.length;n<r;n+=1){let r=t[n],i=16*Math.random()|0;e+=("x"===r?i:"y"===r?3&i|8:r).toString(16)}return e}lg(e=>lh(e).replace(/ /g,"_")),lg(e=>ld(e).replace(/ /g,".")),lg(e=>ld(e).replace(/ /g,"/")),lg(e=>la(ld(e))),lg(e=>lu(lc(e)));var lv=function(e){return"number"==typeof e||nl(e)&&"[object Number]"==ns(e)},lx=function(e,t,n){var r,i,o;return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=ng(n))==n?n:0),void 0!==t&&(t=(t=ng(t))==t?t:0),r=ng(e),i=t,o=n,r==r&&(void 0!==o&&(r=r<=o?r:o),void 0!==i&&(r=r>=i?r:i)),r};function lw(e,t){return(e%t+t)%t}function lC(e,t){if(null==t)t=null==e?1:e,e=0;else if(t<e){let n=e;e=t,t=n}return Math.floor(Math.random()*(t-e+1)+e)}function lE(e){return"string"==typeof e&&"%"===e.slice(-1)}function lS(e,t){let n;if(null==e)return 0;if("string"==typeof e){if(n=parseFloat(e),lE(e)&&Number.isFinite(n/=100))return n*t}else n=e;return Number.isFinite(n)?n>0&&n<1?n*t:n:0}function lP(e,t){let n,r=parseFloat(e);if(Number.isNaN(r))return null;if(null==t)n="[A-Za-z]*";else if(Array.isArray(t)){if(0===t.length)return null;n=t.join("|")}else"string"==typeof t&&(n=t);let i=function(t){let n=RegExp(`(?:\\d+(?:\\.\\d+)*)(${t})$`).exec(e);return n?n[1]:null}(n);return null===i?null:{unit:i,value:r}}function lk(e){if("object"==typeof e){let t=0,n=0,r=0,i=0;return null!=e.vertical&&Number.isFinite(e.vertical)&&(n=i=e.vertical),null!=e.horizontal&&Number.isFinite(e.horizontal)&&(r=t=e.horizontal),null!=e.left&&Number.isFinite(e.left)&&(t=e.left),null!=e.top&&Number.isFinite(e.top)&&(n=e.top),null!=e.right&&Number.isFinite(e.right)&&(r=e.right),null!=e.bottom&&Number.isFinite(e.bottom)&&(i=e.bottom),{top:n,right:r,bottom:i,left:t}}let t=0;return null!=e&&Number.isFinite(e)&&(t=e),{top:t,right:t,bottom:t,left:t}}let lO=!1,lM=!1,lA=!1,lT=!1,lN=!1,lj=!1,lL=!1,lR=!1,lI=!1,l_=!1,lz=!1,lD=!1,lB=!1,lV=!1,lF=!1,l$=!1;if("object"==typeof navigator){let e=navigator.userAgent;lO=e.indexOf("Macintosh")>=0,lM=!!e.match(/(iPad|iPhone|iPod)/g),lA=e.indexOf("Windows")>=0,lT=e.indexOf("MSIE")>=0,lN=!!e.match(/Trident\/7\./),lj=!!e.match(/Edge\//),lL=e.indexOf("Mozilla/")>=0&&0>e.indexOf("MSIE")&&0>e.indexOf("Edge/"),lI=e.indexOf("Chrome/")>=0&&0>e.indexOf("Edge/"),l_=e.indexOf("Opera/")>=0||e.indexOf("OPR/")>=0,lz=e.indexOf("Firefox/")>=0,lD=e.indexOf("AppleWebKit/")>=0&&0>e.indexOf("Chrome/")&&0>e.indexOf("Edge/"),"object"==typeof document&&(l$=!document.createElementNS||"[object SVGForeignObjectElement]"!=`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`||e.indexOf("Opera/")>=0)}if("object"==typeof window&&(lR=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,lV=null!=window.PointerEvent&&!lO),"object"==typeof document){lB="ontouchstart"in document.documentElement;try{let e=Object.defineProperty({},"passive",{get(){lF=!0}}),t=document.createElement("div");t.addEventListener&&t.addEventListener("click",()=>{},e)}catch(e){}}(S=e2||(e2={})).IS_MAC=lO,S.IS_IOS=lM,S.IS_WINDOWS=lA,S.IS_IE=lT,S.IS_IE11=lN,S.IS_EDGE=lj,S.IS_NETSCAPE=lL,S.IS_CHROME_APP=lR,S.IS_CHROME=lI,S.IS_OPERA=l_,S.IS_FIREFOX=lz,S.IS_SAFARI=lD,S.SUPPORT_TOUCH=lB,S.SUPPORT_POINTER=lV,S.SUPPORT_PASSIVE=lF,S.NO_FOREIGNOBJECT=l$,S.SUPPORT_FOREIGNOBJECT=!S.NO_FOREIGNOBJECT;var lU=e2||(e2={});function lG(){let e=window.module;return null!=e&&null!=e.hot&&null!=e.hot.status?e.hot.status():"unkonwn"}lU.getHMRStatus=lG,lU.isApplyingHMR=function(){return"apply"===lG()};let lH={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};lU.isEventSupported=function(e){let t=document.createElement(lH[e]||"div"),n=`on${e}`,r=n in t;return r||(t.setAttribute(n,"return;"),r="function"==typeof t[n]),r};let lq=/[\t\r\n\f]/g,lW=/\S+/g,lJ=e=>` ${e} `;function lX(e){return e&&e.getAttribute&&e.getAttribute("class")||""}function lY(e,t){if(null==e||null==t)return!1;let n=lJ(lX(e)),r=lJ(t);return 1===e.nodeType&&n.replace(lq," ").includes(r)}function lQ(e,t){if(null!=e&&null!=t){if("function"==typeof t)return lQ(e,t(lX(e)));if("string"==typeof t&&1===e.nodeType){let n=t.match(lW)||[],r=lJ(lX(e)).replace(lq," "),i=n.reduce((e,t)=>0>e.indexOf(lJ(t))?`${e}${t} `:e,r);r!==(i=i.trim())&&e.setAttribute("class",i)}}}function lZ(e,t){if(null!=e){if("function"==typeof t)return lZ(e,t(lX(e)));if((!t||"string"==typeof t)&&1===e.nodeType){let n=(t||"").match(lW)||[],r=lJ(lX(e)).replace(lq," "),i=n.reduce((e,t)=>{let n=lJ(t);return e.indexOf(n)>-1?e.replace(n," "):e},r);r!==(i=t?i.trim():"")&&e.setAttribute("class",i)}}}function lK(e,t,n){if(null!=e&&null!=t){if(null!=n&&"string"==typeof t)return void(n?lQ(e,t):lZ(e,t));if("function"==typeof t)return lK(e,t(lX(e),n),n);"string"==typeof t&&(t.match(lW)||[]).forEach(t=>{lY(e,t)?lZ(e,t):lQ(e,t)})}}let l0=0;function l1(){return l0+=1,`v${l0}`}function l2(e){return(null==e.id||""===e.id)&&(e.id=l1()),e.id}function l3(e){return null!=e&&"function"==typeof e.getScreenCTM&&e instanceof SVGElement}let l5={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"},l6="1.1";function l4(e,t=document){return t.createElement(e)}function l9(e,t=l5.xhtml,n=document){return n.createElementNS(t,e)}function l8(e,t=document){return l9(e,l5.svg,t)}function l7(e){if(e){let{documentElement:t}=ae(`<svg xmlns="${l5.svg}" xmlns:xlink="${l5.xlink}" version="${l6}">${e}</svg>`,{async:!1});return t}let t=document.createElementNS(l5.svg,"svg");return t.setAttributeNS(l5.xmlns,"xmlns:xlink",l5.xlink),t.setAttribute("version",l6),t}function ae(e,t={}){let n;try{let r=new DOMParser;null!=t.async&&(r.async=t.async),n=r.parseFromString(e,t.mimeType||"text/xml")}catch(e){n=void 0}if(!n||n.getElementsByTagName("parsererror").length)throw Error(`Invalid XML: ${e}`);return n}function at(e,t=!0){let n=e.nodeName;return t?n.toLowerCase():n.toUpperCase()}function an(e){let t=0,n=e.previousSibling;for(;n;)1===n.nodeType&&(t+=1),n=n.previousSibling;return t}function ar(e,t){return e.querySelectorAll(t)}function ai(e,t){return e.querySelector(t)}function ao(e,t,n){let r=e.ownerSVGElement,i=e.parentNode;for(;i&&i!==n&&i!==r;){if(lY(i,t))return i;i=i.parentNode}return null}function as(e,t){let n=t&&t.parentNode;return e===n||!!(n&&1===n.nodeType&&16&e.compareDocumentPosition(n))}function al(e){e&&(Array.isArray(e)?e:[e]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}function aa(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function au(e,t){(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&e.appendChild(t)})}function ac(e,t){let n=e.firstChild;return n?ah(n,t):au(e,t)}function ah(e,t){let n=e.parentNode;n&&(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&n.insertBefore(t,e)})}function ad(e,t){let n=e.parentNode;n&&(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&n.insertBefore(t,e.nextSibling)})}function af(e,t){null!=t&&t.appendChild(e)}function ag(e){return!!e&&1===e.nodeType}function ap(e){try{return e instanceof HTMLElement}catch(t){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}}function am(e,t){let n=[],r=e.firstChild;for(;r;r=r.nextSibling)1===r.nodeType&&(!t||lY(r,t))&&n.push(r);return n}let ay=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function ab(e,t){return e.getAttribute(t)}function av(e,t){let n=aE(t);n.ns?e.hasAttributeNS(n.ns,n.local)&&e.removeAttributeNS(n.ns,n.local):e.hasAttribute(t)&&e.removeAttribute(t)}function ax(e,t,n){if(null==n)return av(e,t);let r=aE(t);r.ns&&"string"==typeof n?e.setAttributeNS(r.ns,t,n):"id"===t?e.id=`${n}`:e.setAttribute(t,`${n}`)}function aw(e,t){Object.keys(t).forEach(n=>{ax(e,n,t[n])})}function aC(e,t,n){if(null==t){let t=e.attributes,n={};for(let e=0;e<t.length;e+=1)n[t[e].name]=t[e].value;return n}if("string"==typeof t&&void 0===n)return e.getAttribute(t);"object"==typeof t?aw(e,t):ax(e,t,n)}function aE(e){if(-1!==e.indexOf(":")){let t=e.split(":");return{ns:l5[t[0]],local:t[1]}}return{ns:null,local:e}}function aS(e){let t={};return Object.keys(e).forEach(n=>{t[ay.includes(n)?n:lp(n)]=e[n]}),t}function aP(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 ak(e,t){return Object.keys(t).forEach(n=>{if("class"===n)e[n]=e[n]?`${e[n]} ${t[n]}`:t[n];else if("style"===n){let r,i,o="object"==typeof e[n],s="object"==typeof t[n];o&&s?(r=e[n],i=t[n]):o?(r=e[n],i=aP(t[n])):s?(r=aP(e[n]),i=t[n]):(r=aP(e[n]),i=aP(t[n])),e[n]=ak(r,i)}else e[n]=t[n]}),e}!function(e){function t(e){let t="data:";return e.substr(0,t.length)===t}function n(e){let t,n=e.replace(/\s/g,""),r=(n=decodeURIComponent(n)).indexOf(","),i=n.slice(0,r),o=i.split(":")[1].split(";")[0],s=n.slice(r+1),l=new Uint8Array((t=i.indexOf("base64")>=0?atob(s):unescape(encodeURIComponent(s))).length);for(let e=0;e<t.length;e+=1)l[e]=t.charCodeAt(e);return new Blob([l],{type:o})}function r(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)}}function i(e){let t=parseFloat(e);return Number.isNaN(t)?null:t}e.isDataUrl=t,e.imageToDataUri=function(e,n){if(!e||t(e))return void setTimeout(()=>n(null,e));let r=()=>{n(Error(`Failed to load image: ${e}`))},i=window.FileReader?e=>{if(200===e.status){let t=new FileReader;t.onload=e=>{n(null,e.target.result)},t.onerror=r,t.readAsDataURL(e.response)}else r()}:t=>{if(200===t.status){let r=e.split(".").pop()||"png";"svg"===r&&(r="svg+xml"),n(null,`data:image/${r};base64,`+btoa((e=>{let t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return t.join("")})(new Uint8Array(t.response))))}else r()},o=new XMLHttpRequest;o.responseType=window.FileReader?"blob":"arraybuffer",o.open("GET",e,!0),o.addEventListener("error",r),o.addEventListener("load",()=>i(o)),o.send()},e.dataUriToBlob=n,e.downloadBlob=r,e.downloadDataUri=function(e,t){r(n(e),t)},e.svgToDataUrl=function(e,t={}){let n=null,r=t=>(null==n&&(n=function(e){let t=e.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return t&&t[2]?t[2].replace(/\s+/," ").split(" "):null}(e)),null!=n)?i(n[t]):null,o=t=>{let n=e.match(t);return n&&n[2]?i(n[2]):null},s=t.width;if(null==s&&(s=o(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==s&&(s=r(2)),null==s)throw Error("Can not parse width from svg string");let l=t.height;if(null==l&&(l=o(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==l&&(l=r(3)),null==l)throw Error("Can not parse height from svg string");let a=encodeURIComponent(e).replace(/'/g,"%27").replace(/"/g,"%22");return`data:image/svg+xml,${a}`}}(e3||(e3={}));let aO={px:e=>e,mm:e=>r*e,cm:e=>r*e*10,in:e=>r*e*25.4,pt:e=>25.4*e/72*r,pc:e=>25.4*e/6*r};var aM=e5||(e5={});function aA(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 o=r.getBoundingClientRect(),s={width:o.width||0,height:o.height||0};return document.body.removeChild(r),s}aM.measure=aA,aM.toPx=function(e,t){null==r&&(r=aA("1","1","mm").width);let n=t?aO[t]:null;return n?n(e):e};let aT=/-(.)/g,aN={},aj=["webkit","ms","moz","o"],aL=document?document.createElement("div").style:{};function aR(e){let t=e.replace(aT,(e,t)=>t.toUpperCase());if(null==aN[t]){let e=t.charAt(0).toUpperCase()+t.slice(1);aN[t]=t in aL?t:function(e){for(let t=0;t<aj.length;t+=1){let n=aj[t]+e;if(n in aL)return n}return null}(e)}return aN[t]}function aI(e,t,n){let r=aR(t);null!=r&&(e[r]=n),e[t]=n}function a_(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 az(e){let t=a_(e);return null!=t&&("scroll"===t.overflow||"auto"===t.overflow)}let aD=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(){}}(),aB={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 aV(e){return/^--/.test(e)}function aF(e,t,n){let r=window.getComputedStyle(e,null);return n?r.getPropertyValue(t)||void 0:r[t]||e.style[t]}function a$(e,t){return parseInt(aF(e,t),10)||0}function aU(e,t,n){if("string"==typeof t){var r,i;let o=aV(t);if(o||(t=aR(t)),void 0===n)return aF(e,t,o);o||(r=t,i=n,n=aB[r]||"number"!=typeof i?i:`${i}px`);let s=e.style;return void(o?s.setProperty(t,n):s[t]=n)}for(let n in t)aU(e,n,t[n])}let aG=new WeakMap;function aH(e,t){let n=lc(t),r=aG.get(e);if(r)return r[n]}function aq(e,t,n){let r=lc(t),i=aG.get(e);i?i[r]=n:aG.set(e,{[r]:n})}function aW(e,t,n){if(!t){let t={};return Object.keys(aG).forEach(n=>{t[n]=aH(e,n)}),t}if("string"==typeof t)return void 0===n?aH(e,t):void aq(e,t,n);for(let n in t)aW(e,n,t[n])}let aJ={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};class aX{get[Symbol.toStringTag](){return aX.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(e){this.node.id=e}constructor(e,t,n){let r;if(!e)throw TypeError("Invalid element to create vector");if(aX.isVector(e))r=e.node;else if("string"==typeof e)if("svg"===e.toLowerCase())r=l7();else if("<"===e[0]){let t=l7(e);r=document.importNode(t.firstChild,!0)}else r=document.createElementNS(l5.svg,e);else r=e;this.node=r,t&&this.setAttributes(t),n&&this.append(n)}transform(e,t){return null==e?uE(this.node):(uE(this.node,e,t),this)}translate(e,t=0,n={}){return null==e?uS(this.node):(uS(this.node,e,t,n),this)}rotate(e,t,n,r={}){return null==e?uP(this.node):(uP(this.node,e,t,n,r),this)}scale(e,t){return null==e?uk(this.node):(uk(this.node,e,t),this)}getTransformToElement(e){let t=aX.toNode(e);return uO(this.node,t)}removeAttribute(e){return av(this.node,e),this}getAttribute(e){return ab(this.node,e)}setAttribute(e,t){return ax(this.node,e,t),this}setAttributes(e){return aw(this.node,e),this}attr(e,t){return null==e?aC(this.node):"string"==typeof e&&void 0===t?aC(this.node,e):("object"==typeof e?aC(this.node,e):aC(this.node,e,t),this)}svg(){return this.node instanceof SVGSVGElement?this:aX.create(this.node.ownerSVGElement)}defs(){let e=this.svg()||this,t=e.node.getElementsByTagName("defs")[0];return t?aX.create(t):aX.create("defs").appendTo(e)}text(e,t={}){return aK(this.node,e,t),this}tagName(){return at(this.node)}clone(){return aX.create(this.node.cloneNode(!0))}remove(){return al(this.node),this}empty(){return aa(this.node),this}append(e){return au(this.node,aX.toNodes(e)),this}appendTo(e){return af(this.node,aX.isVector(e)?e.node:e),this}prepend(e){return ac(this.node,aX.toNodes(e)),this}before(e){return ah(this.node,aX.toNodes(e)),this}replace(e){return this.node.parentNode&&this.node.parentNode.replaceChild(aX.toNode(e),this.node),aX.create(e)}first(){return this.node.firstChild?aX.create(this.node.firstChild):null}last(){return this.node.lastChild?aX.create(this.node.lastChild):null}get(e){let t=this.node.childNodes[e];return t?aX.create(t):null}indexOf(e){return Array.prototype.slice.call(this.node.childNodes).indexOf(aX.toNode(e))}find(e){let t=[],n=ar(this.node,e);if(n)for(let e=0,r=n.length;e<r;e+=1)t.push(aX.create(n[e]));return t}findOne(e){let t=ai(this.node,e);return t?aX.create(t):null}findParentByClass(e,t){let n=ao(this.node,e,t);return n?aX.create(n):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(e){return as(this.node,aX.isVector(e)?e.node:e)}wrap(e){let t=aX.create(e),n=this.node.parentNode;return null!=n&&n.insertBefore(t.node,this.node),t.append(this)}parent(e){let t=this;if(null==t.node.parentNode)return null;if(t=aX.create(t.node.parentNode),null==e)return t;do if("string"==typeof e?t.matches(e):t instanceof e)break;while(t=aX.create(t.node.parentNode));return t}children(){let e=this.node.childNodes,t=[];for(let n=0;n<e.length;n+=1)1===e[n].nodeType&&t.push(aX.create(e[n]));return t}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 an(this.node)}hasClass(e){return lY(this.node,e)}addClass(e){return lQ(this.node,e),this}removeClass(e){return lZ(this.node,e),this}toggleClass(e,t){return lK(this.node,e,t),this}toLocalPoint(e,t){return uA(this.node,e,t)}sample(e=1){return this.node instanceof SVGPathElement?a6(this.node,e):[]}toPath(){return aX.create(uo(this.node))}toPathData(){return us(this.node)}}!function(e){function t(t){if(null==t)return!1;if(t instanceof e)return!0;let n=t[Symbol.toStringTag];return!!((null==n||n===e.toStringTag)&&t.node instanceof SVGElement)&&"function"==typeof t.sample&&"function"==typeof t.toPath}function n(t,n,r){return new e(t,n,r)}function r(e){return t(e)?e.node:e}e.toStringTag=`X6.${e.name}`,e.isVector=t,e.create=n,e.createVectors=function(e){if("<"===e[0]){let t=l7(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.toNode=r,e.toNodes=function(e){return Array.isArray(e)?e.map(e=>r(e)):[r(e)]}}(aX||(aX={}));let aY=document.createElement("canvas").getContext("2d"),aQ=/em$/;function aZ(e,t){let n=parseFloat(e);return aQ.test(e)?n*t:n}function aK(e,t,n={}){let r,i,o;t=t.replace(/ /g,"\xa0");let s=n.eol,l=n.textPath,a=n.textVerticalAnchor,u="middle"===a||"bottom"===a||"top"===a,c=n.x;void 0===c&&(c=e.getAttribute("x")||0);let h=n.includeAnnotationIndices,d=n.annotations;d&&!Array.isArray(d)&&(d=[d]);let f=n.lineHeight,g="auto"===f,p=g?"1.5em":f||"1em",m=!0,y=e.childNodes;if(1===y.length){let e=y[0];e&&"TITLE"===e.tagName.toUpperCase()&&(m=!1)}m&&aa(e),aC(e,{"xml:space":"preserve",display:t||n.displayEmpty?null:"none"});let b=aC(e,"font-size"),v=parseFloat(b);!v&&(v=16,(u||d)&&!b&&aC(e,"font-size",`${v}`)),l?("string"==typeof l&&(l={d:l}),r=function(e,t){let n=aX.create(t),r=aX.create("textPath"),i=e.d;if(i&&void 0===e["xlink:href"]){let e=aX.create("path").attr("d",i).appendTo(n.defs());r.attr("xlink:href",`#${e.id}`)}return"object"==typeof e&&r.attr(e),r.node}(l,e)):r=document.createDocumentFragment();let x=0,w=t.split("\n"),C=[],E=w.length-1;for(let e=0;e<=E;e+=1){let t;i=p;let n="v-line",a=l8("tspan"),u=w[e];if(u)if(d){let n=(t=function(e,t,n){let r,i=n.eol,o=n.baseSize,s=n.lineHeight,l=0,a={},u=t.length-1;for(let s=0;s<=u;s+=1){let a=t[s],c=null;if("object"==typeof a){let e=a.attrs,t=aX.create("tspan",e);r=t.node;let h=a.t;i&&s===u&&(h+=i),r.textContent=h;let d=e.class;d&&t.addClass(d),n.includeAnnotationIndices&&t.attr("annotations",a.annotations.join(",")),void 0===(c=parseFloat(e["font-size"]))&&(c=o),c&&c>l&&(l=c)}else i&&s===u&&(a+=i),r=document.createTextNode(a||" "),o&&o>l&&(l=o);e.appendChild(r)}return l&&(a.maxFontSize=l),s?a.lineHeight=s:l&&(a.lineHeight=1.2*l),a}(a,function(e,t,n={}){let r,i,o=n.offset||0,s=[],l=[],a=null;for(let u=0;u<e.length;u+=1){r=l[u]=e[u];for(let i=0,s=t.length;i<s;i+=1){let s=t[i],a=s.start+o,c=s.end+o;u>=a&&u<c&&("string"==typeof r?r=l[u]={t:e[u],attrs:s.attrs}:r.attrs=ak(ak({},r.attrs),s.attrs),n.includeAnnotationIndices&&(null==r.annotations&&(r.annotations=[]),r.annotations.push(i)))}(i=l[u-1])?t0(r)&&t0(i)?JSON.stringify(r.attrs)===JSON.stringify(i.attrs)?a.t+=r.t:(s.push(a),a=r):t0(r)||t0(i)?(s.push(a),a=r):a=(a||"")+r:a=r}return null!=a&&s.push(a),s}(u,d,{offset:-x,includeAnnotationIndices:h}),{eol:e!==E&&s,baseSize:v,lineHeight:g?null:p,includeAnnotationIndices:h})).lineHeight;n&&g&&0!==e&&(i=n),0===e&&(o=.8*t.maxFontSize)}else s&&e!==E&&(u+=s),a.textContent=u;else{a.textContent="-",n+=" v-empty-line";let e=a.style;e.fillOpacity=0,e.strokeOpacity=0,d&&(t={})}t&&C.push(t),e>0&&a.setAttribute("dy",i),(e>0||l)&&a.setAttribute("x",c),a.className.baseVal=n,r.appendChild(a),x+=u.length+1}if(u)if(d)i=function(e,t,n,r){let i;if(!Array.isArray(t))return 0;let o=t.length;if(!o)return 0;let s=t[0],l=aZ(s.maxFontSize,n)||n,a=0,u=aZ(r,n);for(let e=1;e<o;e+=1)a+=aZ((s=t[e]).lineHeight,n)||u;let c=aZ(s.maxFontSize,n)||n;switch(e){case"middle":i=l/2-.15*c-a/2;break;case"bottom":i=-(.25*c)-a;break;default:i=.8*l}return i}(a,C,v,p);else if("top"===a)i="0.8em";else{let e;switch(E>0?(e=(parseFloat(p)||1)*E,!aQ.test(p)&&(e/=v)):e=0,a){case"middle":i=`${.3-e/2}em`;break;case"bottom":i=`${-e-.3}em`}}else 0===a?i="0em":a?i=a:(i=0,null==e.getAttribute("y")&&e.setAttribute("y",`${o||"0.8em"}`));r.firstChild.setAttribute("dy",i),e.appendChild(r)}function a0(e,t={}){if(!e)return{width:0};let n=[],r=t["font-size"]?`${parseFloat(t["font-size"])}px`:"14px";return n.push(t["font-style"]||"normal"),n.push(t["font-variant"]||"normal"),n.push(t["font-weight"]||400),n.push(r),n.push(t["font-family"]||"sans-serif"),aY.font=n.join(" "),aY.measureText(e)}function a1(e,t,n,r={}){if(t>=n)return[e,""];let i=e.length,o={},s=Math.round(t/n*i-1);for(s<0&&(s=0);s>=0&&s<i;){let n=e.slice(0,s),i=o[n]||a0(n,r).width,l=e.slice(0,s+1),a=o[l]||a0(l,r).width;if(o[n]=i,o[l]=a,i>t)s-=1;else if(a<=t)s+=1;else break}return[e.slice(0,s),e.slice(s)]}function a2(e,t,n={},r={}){let i=t.width,o=t.height,s=r.eol||"\n",l=n.fontSize||14,a=Math.floor(o/(n.lineHeight?parseFloat(n.lineHeight):Math.ceil(1.4*l)));if(e.indexOf(s)>-1){let i=lb(),o=[];return e.split(s).map(e=>{let s=a2(e,Object.assign(Object.assign({},t),{height:Number.MAX_SAFE_INTEGER}),n,Object.assign(Object.assign({},r),{eol:i}));s&&o.push(...s.split(i))}),o.slice(0,a).join(s)}let{width:u}=a0(e,n);if(u<i)return e;let c=[],h=e,d=u,f=r.ellipsis,g=0;f&&("string"!=typeof f&&(f="…"),g=a0(f,n).width);for(let e=0;e<a;e+=1)if(d>i)if(e===a-1){let[e]=a1(h,i-g,d,n);c.push(f?`${e}${f}`:e)}else{let[e,t]=a1(h,i,d,n);c.push(e),d=a0(h=t,n).width}else{c.push(h);break}return c.join(s)}let a3=.551784;function a5(e,t,n=NaN){let r=e.getAttribute(t);if(null==r)return n;let i=parseFloat(r);return Number.isNaN(i)?n:i}function a6(e,t=1){let n,r=e.getTotalLength(),i=[],o=0;for(;o<r;)n=e.getPointAtLength(o),i.push({distance:o,x:n.x,y:n.y}),o+=t;return i}function a4(e){return["M",a5(e,"x1"),a5(e,"y1"),"L",a5(e,"x2"),a5(e,"y2")].join(" ")}function a9(e){let t=ue(e);return 0===t.length?null:`${a7(t)} Z`}function a8(e){let t=ue(e);return 0===t.length?null:a7(t)}function a7(e){let t=e.map(e=>`${e.x} ${e.y}`);return`M ${t.join(" L")}`}function ue(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 ut(e){let t=a5(e,"cx",0),n=a5(e,"cy",0),r=a5(e,"r"),i=r*a3;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 un(e){let t=a5(e,"cx",0),n=a5(e,"cy",0),r=a5(e,"rx"),i=a5(e,"ry")||r,o=r*a3,s=i*a3;return["M",t,n-i,"C",t+o,n-i,t+r,n-s,t+r,n,"C",t+r,n+s,t+o,n+i,t,n+i,"C",t-o,n+i,t-r,n+s,t-r,n,"C",t-r,n-s,t-o,n-i,t,n-i,"Z"].join(" ")}function ur(e){return ui({x:a5(e,"x",0),y:a5(e,"y",0),width:a5(e,"width",0),height:a5(e,"height",0),rx:a5(e,"rx",0),ry:a5(e,"ry",0)})}function ui(e){let t=e.x,n=e.y,r=e.width,i=e.height,o=Math.min(e.rx||e["top-rx"]||0,r/2),s=Math.min(e.rx||e["bottom-rx"]||0,r/2),l=Math.min(e.ry||e["top-ry"]||0,i/2),a=Math.min(e.ry||e["bottom-ry"]||0,i/2);return(o||s||l||a?["M",t,n+l,"v",i-l-a,"a",s,a,0,0,0,s,a,"h",r-2*s,"a",s,a,0,0,0,s,-a,"v",-(i-a-l),"a",o,l,0,0,0,-o,-l,"h",-(r-2*o),"a",o,l,0,0,0,-o,l,"Z"]:["M",t,n,"H",t+r,"V",n+i,"H",t,"V",n,"Z"]).join(" ")}function uo(e){let t=l8("path");aC(t,aC(e));let n=us(e);return n&&t.setAttribute("d",n),t}function us(e){let t=e.tagName.toLowerCase();switch(t){case"path":return e.getAttribute("d");case"line":return a4(e);case"polygon":return a9(e);case"polyline":return a8(e);case"ellipse":return un(e);case"circle":return ut(e);case"rect":return ur(e)}throw Error(`"${t}" cannot be converted to svg path element.`)}function ul(e,t,n,r){let i=2*Math.PI-1e-6,o=n,s=r;if(s<o){let e=o;o=s,s=e}let l=s-o,a=l<Math.PI?"0":"1",u=Math.cos(o),c=Math.sin(o),h=Math.cos(s),d=Math.sin(s);return l>=i?e?`M0,${t}A${t},${t} 0 1,1 0,${-t}A${t},${t} 0 1,1 0,${t}M0,${e}A${e},${e} 0 1,0 0,${-e}A${e},${e} 0 1,0 0,${e}Z`:`M0,${t}A${t},${t} 0 1,1 0,${-t}A${t},${t} 0 1,1 0,${t}Z`:e?`M${t*u},${t*c}A${t},${t} 0 ${a},1 ${t*h},${t*d}L${e*h},${e*d}A${e},${e} 0 ${a},0 ${e*u},${e*c}Z`:`M${t*u},${t*c}A${t},${t} 0 ${a},1 ${t*h},${t*d}L0,0Z`}let ua=l8("svg"),uu=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,uc=/[ ,]+/,uh=/^(\w+)\((.*)\)/;function ud(e,t){let n=ua.createSVGPoint();return n.x=e,n.y=t,n}function uf(e){let t=ua.createSVGMatrix();if(null!=e)for(let n in e)t[n]=e[n];return t}function ug(e){return null!=e?(e instanceof DOMMatrix||(e=uf(e)),ua.createSVGTransformFromMatrix(e)):ua.createSVGTransform()}function up(e){let t=uf(),n=null!=e&&e.match(uu);if(!n)return t;for(let e=0,r=n.length;e<r;e+=1){let r=n[e].match(uh);if(r){let e,n,i,o,s,l=uf(),a=r[2].split(uc);switch(r[1].toLowerCase()){case"scale":e=parseFloat(a[0]),n=void 0===a[1]?e:parseFloat(a[1]),l=l.scaleNonUniform(e,n);break;case"translate":i=parseFloat(a[0]),o=parseFloat(a[1]),l=l.translate(i,o);break;case"rotate":s=parseFloat(a[0]),i=parseFloat(a[1])||0,o=parseFloat(a[2])||0,l=0!==i||0!==o?l.translate(i,o).rotate(s).translate(-i,-o):l.rotate(s);break;case"skewx":s=parseFloat(a[0]),l=l.skewX(s);break;case"skewy":s=parseFloat(a[0]),l=l.skewY(s);break;case"matrix":l.a=parseFloat(a[0]),l.b=parseFloat(a[1]),l.c=parseFloat(a[2]),l.d=parseFloat(a[3]),l.e=parseFloat(a[4]),l.f=parseFloat(a[5]);break;default:continue}t=t.multiply(l)}}return t}function um(e){let t=e||{},n=null!=t.a?t.a:1,r=null!=t.b?t.b:0,i=null!=t.c?t.c:0,o=null!=t.d?t.d:1,s=null!=t.e?t.e:0,l=null!=t.f?t.f:0;return`matrix(${n},${r},${i},${o},${s},${l})`}function uy(e){let t,n,r;if(e)if(e.trim().indexOf("matrix")>=0){let i=uv(up(e));t=[i.translateX,i.translateY],n=[i.rotation],r=[i.scaleX,i.scaleY];let o=[];(0!==t[0]||0!==t[1])&&o.push(`translate(${t.join(",")})`),(1!==r[0]||1!==r[1])&&o.push(`scale(${r.join(",")})`),0!==n[0]&&o.push(`rotate(${n[0]})`),e=o.join(" ")}else{let i=e.match(/translate\((.*?)\)/);i&&(t=i[1].split(uc));let o=e.match(/rotate\((.*?)\)/);o&&(n=o[1].split(uc));let s=e.match(/scale\((.*?)\)/);s&&(r=s[1].split(uc))}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 ub(e,t){return{x:t.x*e.a+t.y*e.c+0,y:t.x*e.b+t.y*e.d+0}}function uv(e){let t=ub(e,{x:0,y:1}),n=ub(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 ux(e){let t,n,r,i;return e?(t=null==e.a?1:e.a,i=null==e.d?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 uw(e){let t={x:0,y:1};e&&(t=ub(e,t));let n=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:n%360+360*(n<0)}}function uC(e){return{tx:e&&e.e||0,ty:e&&e.f||0}}function uE(e,t,n={}){if(null==t)return up(aC(e,"transform"));if(n.absolute)return void e.setAttribute("transform",um(t));let r=e.transform,i=ug(t);r.baseVal.appendItem(i)}function uS(e,t,n=0,r={}){let i=aC(e,"transform"),o=uy(i);if(null==t)return o.translation;i=(i=o.raw).replace(/translate\([^)]*\)/g,"").trim();let s=r.absolute?t:o.translation.tx+t,l=r.absolute?n:o.translation.ty+n,a=`translate(${s},${l})`;e.setAttribute("transform",`${a} ${i}`.trim())}function uP(e,t,n,r,i={}){let o=aC(e,"transform"),s=uy(o);if(null==t)return s.rotation;o=(o=s.raw).replace(/rotate\([^)]*\)/g,"").trim(),t%=360;let l=i.absolute?t:s.rotation.angle+t,a=null!=n&&null!=r?`,${n},${r}`:"",u=`rotate(${l}${a})`;e.setAttribute("transform",`${o} ${u}`.trim())}function uk(e,t,n){let r=aC(e,"transform"),i=uy(r);if(null==t)return i.scale;n=null==n?t:n,r=(r=i.raw).replace(/scale\([^)]*\)/g,"").trim();let o=`scale(${t},${n})`;e.setAttribute("transform",`${r} ${o}`.trim())}function uO(e,t){if(l3(t)&&l3(e)){let n=t.getScreenCTM(),r=e.getScreenCTM();if(n&&r)return n.inverse().multiply(r)}return uf()}function uM(e,t){let n=uf();if(l3(t)&&l3(e)){let r=e,i=[];for(;r&&r!==t;){let e=up(r.getAttribute("transform")||null);i.push(e),r=r.parentNode}i.reverse().forEach(e=>{n=n.multiply(e)})}return n}function uA(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()),o=uO(e,r).inverse();return n.matrixTransform(o)}catch(e){return i}}var uT=e6||(e6={});let uN={};uT.get=function(e){return uN[e]||{}},uT.register=function(e,t){uN[e]=t},uT.unregister=function(e){delete uN[e]};var uj=e4||(e4={});let uL=new WeakMap;uj.ensure=function(e){return uL.has(e)||uL.set(e,{events:Object.create(null)}),uL.get(e)},uj.get=function(e){return uL.get(e)},uj.remove=function(e){return uL.delete(e)},(P=e9||(e9={})).returnTrue=()=>!0,P.returnFalse=()=>!1,P.stopPropagationCallback=function(e){e.stopPropagation()},P.addEventListener=function(e,t,n){null!=e.addEventListener&&e.addEventListener(t,n)},P.removeEventListener=function(e,t,n){null!=e.removeEventListener&&e.removeEventListener(t,n)};var uR=e9||(e9={});let uI=/[^\x20\t\r\n\f]+/g,u_=/^([^.]*)(?:\.(.+)|)/;uR.splitType=function(e){return(e||"").match(uI)||[""]},uR.normalizeType=function(e){let t=u_.exec(e)||[];return{originType:t[1]?t[1].trim():t[1],namespaces:t[2]?t[2].split(".").map(e=>e.trim()).sort():[]}},uR.isValidTarget=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},uR.isValidSelector=function(e,t){return!t||null!=e.querySelector&&null!=e.querySelector(t)};var uz=e9||(e9={});let uD=0,uB=new WeakMap;uz.ensureHandlerId=function(e){return uB.has(e)||(uB.set(e,uD),uD+=1),uB.get(e)},uz.getHandlerId=function(e){return uB.get(e)},uz.removeHandlerId=function(e){return uB.delete(e)},uz.setHandlerId=function(e,t){return uB.set(e,t)},(e9||(e9={})).getHandlerQueue=function(e,t){let n=[],r=e4.get(e),i=r&&r.events&&r.events[t.type],o=i&&i.handlers||[],s=i?i.delegateCount:0;if(s>0&&!("click"===t.type&&"number"==typeof t.button&&t.button>=1)){for(let r=t.target;r!==e;r=r.parentNode||e)if(1===r.nodeType&&("click"!==t.type||!0!==r.disabled)){let t=[],i={};for(let n=0;n<s;n+=1){let s=o[n],l=s.selector;if(null!=l&&null==i[l]){let t=[];e.querySelectorAll(l).forEach(e=>{t.push(e)}),i[l]=t.includes(r)}i[l]&&t.push(s)}t.length&&n.push({elem:r,handlers:t})}}return s<o.length&&n.push({elem:e,handlers:o.slice(s)}),n},(e9||(e9={})).isWindow=function(e){return null!=e&&e===e.window},(e9||(e9={})).contains=function(e,t){let n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))};class uV{constructor(e,t){this.isDefaultPrevented=e9.returnFalse,this.isPropagationStopped=e9.returnFalse,this.isImmediatePropagationStopped=e9.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{let e=this.originalEvent;this.isDefaultPrevented=e9.returnTrue,e&&!this.isSimulated&&e.preventDefault()},this.stopPropagation=()=>{let e=this.originalEvent;this.isPropagationStopped=e9.returnTrue,e&&!this.isSimulated&&e.stopPropagation()},this.stopImmediatePropagation=()=>{let e=this.originalEvent;this.isImmediatePropagationStopped=e9.returnTrue,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()},"string"==typeof e?this.type=e:e.type&&(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?e9.returnTrue:e9.returnFalse,this.target=e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget,this.timeStamp=e.timeStamp),t&&Object.assign(this,t),this.timeStamp||(this.timeStamp=Date.now())}}(k=uV||(uV={})).create=function(e){return e instanceof k?e:new k(e)},(O=uV||(uV={})).addProperty=function(e,t){Object.defineProperty(O.prototype,e,{enumerable:!0,configurable:!0,get:"function"==typeof t?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})};var uF=uV||(uV={});let u$={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(u$).forEach(e=>uF.addProperty(e,u$[e])),e8||(e8={}),e6.register("load",{noBubble:!0}),e8||(e8={}),e6.register("beforeunload",{postDispatch(e,t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}),e8||(e8={}),e6.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(e,t){let n,r=t.relatedTarget,i=t.handleObj;return r&&(r===e||e9.contains(e,r))||(t.type=i.originType,n=i.handler.call(e,t),t.type="mouseover"),n}}),e6.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(e,t){let n,r=t.relatedTarget,i=t.handleObj;return r&&(r===e||e9.contains(e,r))||(t.type=i.originType,n=i.handler.call(e,t),t.type="mouseout"),n}});var uU=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},uG=e7||(e7={});function uH(e,t,...n){let r=uV.create(t);r.delegateTarget=e;let i=e6.get(r.type);if(i.preDispatch&&!1===i.preDispatch(e,r))return;let o=e9.getHandlerQueue(e,r);for(let e=0,t=o.length;e<t&&!r.isPropagationStopped();e+=1){let t=o[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(null==r.rnamespace||i.namespace&&r.rnamespace.test(i.namespace)){r.handleObj=i,r.data=i.data;let e=e6.get(i.originType).handle,o=e?e(t.elem,r,...n):i.handler.call(t.elem,r,...n);void 0!==o&&(r.result=o,!1===o&&(r.preventDefault(),r.stopPropagation()))}}}return i.postDispatch&&i.postDispatch(e,r),r.result}uG.on=function(e,t,n,r,i){let o;if(!e9.isValidTarget(e))return;if("function"!=typeof n){let{handler:e,selector:t}=n,r=uU(n,["handler","selector"]);n=e,i=t,o=r}let l=e4.ensure(e),a=l.handler;null==a&&(a=l.handler=function(t,...n){return s!==t.type?uH(e,t,...n):void 0});let u=e9.ensureHandlerId(n);e9.splitType(t).forEach(t=>{let{originType:s,namespaces:c}=e9.normalizeType(t);if(!s)return;let h=s,d=e6.get(h);h=(i?d.delegateType:d.bindType)||h,d=e6.get(h);let f=Object.assign({type:h,originType:s,data:r,selector:i,guid:u,handler:n,namespace:c.join(".")},o),g=l.events,p=g[h];!p&&(p=g[h]={handlers:[],delegateCount:0},d.setup&&!1!==d.setup(e,r,c,a)||e9.addEventListener(e,h,a)),d.add&&(e9.removeHandlerId(f.handler),d.add(e,f),e9.setHandlerId(f.handler,u)),i?(p.handlers.splice(p.delegateCount,0,f),p.delegateCount+=1):p.handlers.push(f)})},uG.off=function e(t,n,r,i,o){let s=e4.get(t);if(!s)return;let l=s.events;l&&(e9.splitType(n).forEach(n=>{let{originType:a,namespaces:u}=e9.normalizeType(n);if(!a)return void Object.keys(l).forEach(o=>{e(t,o+n,r,i,!0)});let c=a,h=e6.get(c),d=l[c=(i?h.delegateType:h.bindType)||c];if(!d)return;let f=u.length>0?RegExp(`(^|\\.)${u.join("\\.(?:.*\\.|)")}(\\.|$)`):null,g=d.handlers.length;for(let e=d.handlers.length-1;e>=0;e-=1){let n=d.handlers[e];(o||a===n.originType)&&(!r||e9.getHandlerId(r)===n.guid)&&(null==f||n.namespace&&f.test(n.namespace))&&(null==i||i===n.selector||"**"===i&&n.selector)&&(d.handlers.splice(e,1),n.selector&&(d.delegateCount-=1),h.remove&&h.remove(t,n))}g&&0===d.handlers.length&&(h.teardown&&!1!==h.teardown(t,u,s.handler)||e9.removeEventListener(t,c,s.handler),delete l[c])}),0===Object.keys(l).length&&e4.remove(t))},uG.dispatch=uH,uG.trigger=function(e,t,n,r){let i,o=e,l="string"==typeof e?e:e.type,a="string"==typeof e||null==o.namespace?[]:o.namespace.split(".");if(3===n.nodeType||8===n.nodeType)return;l.indexOf(".")>-1&&(l=(a=l.split(".")).shift(),a.sort());let u=0>l.indexOf(":")&&`on${l}`;(o=e instanceof uV?e:new uV(l,"object"==typeof e?e:null)).namespace=a.join("."),o.rnamespace=o.namespace?RegExp(`(^|\\.)${a.join("\\.(?:.*\\.|)")}(\\.|$)`):null,o.result=void 0,o.target||(o.target=n);let c=[o];Array.isArray(t)?c.push(...t):c.push(t);let h=e6.get(l);if(!r&&h.trigger&&!1===h.trigger(n,o,t))return;let d=[n];if(!r&&!h.noBubble&&!e9.isWindow(n)){i=h.delegateType||l;let e=n,t=n.parentNode;for(;null!=t;)d.push(t),e=t,t=t.parentNode;if(e===(n.ownerDocument||document)){let t=e.defaultView||e.parentWindow||window;d.push(t)}}let f=n;for(let e=0,t=d.length;e<t&&!o.isPropagationStopped();e+=1){let t=d[e];f=t,o.type=e>1?i:h.bindType||l;let n=e4.get(t);n&&n.events[o.type]&&n.handler&&n.handler.call(t,...c);let r=u&&t[u]||null;r&&e9.isValidTarget(t)&&(o.result=r.call(t,...c),!1===o.result&&o.preventDefault())}if(o.type=l,!r&&!o.isDefaultPrevented()){let e=h.preventDefault;if((null==e||!1===e(d.pop(),o,t))&&e9.isValidTarget(n)&&u&&"function"==typeof n[l]&&!e9.isWindow(n)){let e=n[u];e&&(n[u]=null),s=l,o.isPropagationStopped()&&f.addEventListener(l,e9.stopPropagationCallback),n[l](),o.isPropagationStopped()&&f.removeEventListener(l,e9.stopPropagationCallback),s=void 0,e&&(n[u]=e)}}return o.result},(N=te||(te={})).on=function(e,t,n,r,i){return tt.on(e,t,n,r,i),e},N.once=function(e,t,n,r,i){return tt.on(e,t,n,r,i,!0),e},N.off=function(e,t,n,r){return tt.off(e,t,n,r),e},N.trigger=function(e,t,n,r){return e7.trigger(t,n,e,r),e},(j=tt||(tt={})).on=function e(t,n,r,i,o,s){if("object"==typeof n){"string"!=typeof r&&(i=i||r,r=void 0),Object.keys(n).forEach(o=>e(t,o,r,i,n[o],s));return}if(null==i&&null==o?(o=r,i=r=void 0):null==o&&("string"==typeof r?(o=i,i=void 0):(o=i,i=r,r=void 0)),!1===o)o=e9.returnFalse;else if(!o)return;if(s){let e=o;o=function(n,...r){return j.off(t,n),e.call(this,n,...r)},e9.setHandlerId(o,e9.ensureHandlerId(e))}e7.on(t,n,o,i,r)},j.off=function e(t,n,r,i){if(n&&null!=n.preventDefault&&null!=n.handleObj){let t=n.handleObj;e(n.delegateTarget,t.namespace?`${t.originType}.${t.namespace}`:t.originType,t.selector,t.handler);return}if("object"==typeof n)return void Object.keys(n).forEach(i=>e(t,i,r,n[i]));(!1===r||"function"==typeof r)&&(i=r,r=void 0),!1===i&&(i=e9.returnFalse),e7.off(t,n,i,r)};class uq{constructor(e,t,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=e2.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){let t;(null==this.onWheelGuard||this.onWheelGuard(e))&&(this.deltaX+=e.deltaX,this.deltaY+=e.deltaY,e.preventDefault(),(0!==this.deltaX||0!==this.deltaY)&&(e.stopPropagation(),t=!0),!0===t&&0===this.animationFrameId&&(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 uW(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView;return{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}}function uJ(e){return e.getBoundingClientRect().width}function uX(e){return e.getBoundingClientRect().height}function uY(e){let t,n="fixed"===aF(e,"position");if(n){let n=e.getBoundingClientRect();t={left:n.left,top:n.top}}else t=uW(e);if(!n){let n=e.ownerDocument,r=e.offsetParent||n.documentElement;for(;(r===n.body||r===n.documentElement)&&"static"===aF(r,"position");)r=r.parentNode;if(r!==e&&ag(r)){let e=uW(r);t.top-=e.top+a$(r,"borderTopWidth"),t.left-=e.left+a$(r,"borderLeftWidth")}}return{top:t.top-a$(e,"marginTop"),left:t.left-a$(e,"marginLeft")}}function uQ(e,t=60){let n=null;return(...r)=>{n&&clearTimeout(n),n=window.setTimeout(()=>{e.apply(this,r)},t)}}let uZ="undefined"!=typeof ResizeObserver?function(e){let t=null,n=[],r=uQ(()=>{n.forEach(t=>{t(e)})}),i=()=>{let t=new ResizeObserver(r);return t.observe(e),r(),t},o=()=>{t&&(t.disconnect(),n=[],t=null)};return{element:e,bind:e=>{t||(t=i()),-1===n.indexOf(e)&&n.push(e)},destroy:o,unbind:e=>{let r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&t&&o()}}}:function(e){let t=null,n=[],r=()=>{"static"===getComputedStyle(e).position&&(e.style.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=uQ(()=>{n.forEach(t=>t(e))}),o=()=>{t&&t.parentNode&&(t.contentDocument&&t.contentDocument.defaultView.removeEventListener("resize",i),t.parentNode.removeChild(t),t=null,n=[])};return{element:e,bind:e=>{t||(t=r()),-1===n.indexOf(e)&&n.push(e)},destroy:o,unbind:e=>{let r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&t&&o()}}};var uK=tn||(tn={});let u0=new WeakMap;function u1(e){let t=u0.get(e);return t||(t=uZ(e),u0.set(e,t)),t}uK.bind=(e,t)=>{let n=u1(e);return n.bind(t),()=>n.unbind(t)},uK.clear=e=>{var t;(t=u1(e)).destroy(),u0.delete(t.element)};class u2{constructor(e={}){this.comparator=e.comparator||u2.defaultComparator,this.index={},this.data=e.data||[],this.heapify()}isEmpty(){return 0===this.data.length}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(void 0===n)throw Error(`Node with id '${e}' was not found in the heap.`);let r=this.data,i=r[n].priority,o=this.comparator(t,i);o<0?(r[n].priority=t,this.bubbleUp(n)):o>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,n,r=this.data,i=e;for(;i>0;)if(n=i-1>>>1,0>this.comparator(r[i].priority,r[n].priority)){t=r[n],r[n]=r[i];let e=r[i].id;null!=e&&(this.index[e]=n),r[i]=t,null!=(e=r[i].id)&&(this.index[e]=i),i=n}else break}bubbleDown(e){let t=this.data,n=t.length-1,r=e;for(;;){let e=(r<<1)+1,i=e+1,o=r;if(e<=n&&0>this.comparator(t[e].priority,t[o].priority)&&(o=e),i<=n&&0>this.comparator(t[i].priority,t[o].priority)&&(o=i),o!==r){let e=t[o];t[o]=t[r];let n=t[r].id;null!=n&&(this.index[n]=o),t[r]=e,null!=(n=t[r].id)&&(this.index[n]=r),r=o}else break}}}(u2||(u2={})).defaultComparator=(e,t)=>e-t,(tr||(tr={})).run=function(e,t,n=(e,t)=>1){let r={},i={},o={},s=new u2;for(r[t]=0,Object.keys(e).forEach(e=>{e!==t&&(r[e]=1/0),s.insert(r[e],e,e)});!s.isEmpty();){let t=s.remove();o[t]=!0;let l=e[t]||[];for(let e=0;e<l.length;e+=1){let a=l[e];if(!o[a]){let e=r[t]+n(t,a);e<r[a]&&(r[a]=e,i[a]=t,s.updatePriority(a,e))}}}return i};class u3{constructor(e,t,n,r){if(null==e)return this.set(255,255,255,1);if("number"==typeof e)return this.set(e,t,n,r);if("string"==typeof e)return u3.fromString(e)||this;if(Array.isArray(e))return this.set(e);this.set(e.r,e.g,e.b,null==e.a?1:e.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(e){let t=u3.lighten(this.toArray(),e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}darken(e){this.lighten(-e)}set(e,t,n,r){let i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,s=Array.isArray(e)?e[2]:n,l=Array.isArray(e)?e[3]:r;return this.r=Math.round(lx(i,0,255)),this.g=Math.round(lx(o,0,255)),this.b=Math.round(lx(s,0,255)),this.a=null==l?1:lx(l,0,1),this}toHex(){let e=["r","g","b"].map(e=>{let t=this[e].toString(16);return t.length<2?`0${t}`:t});return`#${e.join("")}`}toRGBA(){return this.toArray()}toHSLA(){return u3.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 u3.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([...l(t),1])}function n(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}function r(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 i(t){let n=t.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(n){let t=n[2].split(/\s*,\s*/),r=(parseFloat(t[0])%360+360)%360/360,i=parseFloat(t[1])/100;return new e(o(r,i,parseFloat(t[2])/100,null==t[3]?1:parseInt(t[3],10)))}return null}function o(e,t,n,i){let o=Array.isArray(e)?e[0]:e,s=Array.isArray(e)?e[1]:t,l=Array.isArray(e)?e[2]:n,a=Array.isArray(e)?e[3]:i,u=l<=.5?l*(s+1):l+s-l*s,c=2*l-u;return[256*r(c,u,o+1/3),256*r(c,u,o),256*r(c,u,o-1/3),null==a?1:a]}function s(t){return new e(Math.round(256*Math.random()),Math.round(256*Math.random()),Math.round(256*Math.random()),t?void 0:parseFloat(Math.random().toFixed(2)))}function l(e){let t=0===e.indexOf("#")?e:`#${e}`,n=Number(`0x${t.substr(1)}`);if(4!==t.length&&7!==t.length||Number.isNaN(n))throw Error("Invalid hex color.");let r=4===t.length?4:8,i=(1<<r)-1,o=["b","g","r"].map(()=>{let e=n&i;return n>>=r,4===r?17*e:e});return[o[2],o[1],o[0]]}function a(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 u(e,t){if("string"==typeof e){let n="#"===e[0],r=parseInt(n?e.substr(1):e,16),i=lx((r>>16)+t,0,255),o=lx((r>>8&255)+t,0,255),s=lx((255&r)+t,0,255);return`${n?"#":""}${(s|o<<8|i<<16).toString(16)}`}let n=l(u(a(e[0],e[1],e[2]),t));return[n[0],n[1],n[2],e[3]]}e.fromArray=function(t){return new e(t)},e.fromHex=t,e.fromRGBA=n,e.fromHSLA=i,e.fromString=function(r){if(r.startsWith("#"))return t(r);if(r.startsWith("rgb"))return n(r);let o=e.named[r];return o?t(o):i(r)},e.makeGrey=function(t,n){return e.fromArray([t,t,t,n])},e.rgba2hsla=function(e,t,n,r){let i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,s=Array.isArray(e)?e[2]:n,l=Array.isArray(e)?e[3]:r,a=Math.max(i,o,s),u=Math.min(i,o,s),c=(a+u)/2,h=0,d=0;if(u!==a){let e=a-u;switch(d=c>.5?e/(2-a-u):e/(a+u),a){case i:h=(o-s)/e+6*(o<s);break;case o:h=(s-i)/e+2;break;case s:h=(i-o)/e+4}h/=6}return[h,d,c,null==l?1:l]},e.hsla2rgba=o,e.random=s,e.randomHex=function(){let e="#";for(let t=0;t<6;t+=1)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e},e.randomRGBA=function(e){return s(e).toString()},e.invert=function(e,t){if("string"==typeof e){let n="#"===e[0],[r,i,o]=l(e);return t?.299*r+.587*i+.114*o>186?"#000000":"#ffffff":`${n?"#":""}${a(255-r,255-i,255-o)}`}let n=e[0],r=e[1],i=e[2],o=e[3];return t?.299*n+.587*r+.114*i>186?[0,0,0,o]:[255,255,255,o]:[255-n,255-r,255-i,o]},e.lighten=function(e,t){return u(e,t)},e.darken=function(e,t){return u(e,-t)}}(u3||(u3={})),(u3||(u3={})).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"};class u5{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()}}var u6=ti||(ti={});function u4(e){let t=[],n=[];return Array.isArray(e)?t.push(...e):e.split("|").forEach(e=>{-1===e.indexOf("&")?t.push(e):n.push(...e.split("&"))}),{or:t,and:n}}u6.parse=u4,u6.equals=function(e,t){if(null!=e&&null!=t){let n=u4(e),r=u4(t),i=n.or.sort(),o=r.or.sort(),s=n.and.sort(),l=r.and.sort(),a=(e,t)=>e.length===t.length&&(0===e.length||e.every((e,n)=>e===t[n]));return a(i,o)&&a(s,l)}return null==e&&null==t},u6.isMatch=function(e,t,n){if(null==t||Array.isArray(t)&&0===t.length)return!n||!0!==e.altKey&&!0!==e.ctrlKey&&!0!==e.metaKey&&!0!==e.shiftKey;let{or:r,and:i}=u4(t),o=t=>!0===e[`${t.toLowerCase()}Key`];return r.some(e=>o(e))&&i.every(e=>o(e))},(L=to||(to={})).linear=e=>e,L.quad=e=>e*e,L.cubic=e=>e*e*e,L.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)},L.exponential=e=>Math.pow(2,10*(e-1)),L.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}},(to||(to={})).decorators={reverse:e=>t=>1-e(1-t),reflect:e=>t=>.5*(t<.5?e(2*t):2-e(2-2*t)),clamp:(e,t=0,n=1)=>r=>{let i=e(r);return i<t?t:i>n?n:i},back:(e=1.70158)=>t=>t*t*((e+1)*t-e),elastic:(e=1.5)=>t=>Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*e/3*t)};var u9=to||(to={});function u8(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}}function u7(e){return 1-u8(1-e)}u9.easeInSine=function(e){return -1*Math.cos(Math.PI/2*e)+1},u9.easeOutSine=function(e){return Math.sin(Math.PI/2*e)},u9.easeInOutSine=function(e){return -.5*(Math.cos(Math.PI*e)-1)},u9.easeInQuad=function(e){return e*e},u9.easeOutQuad=function(e){return e*(2-e)},u9.easeInOutQuad=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},u9.easeInCubic=function(e){return e*e*e},u9.easeOutCubic=function(e){let t=e-1;return t*t*t+1},u9.easeInOutCubic=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},u9.easeInQuart=function(e){return e*e*e*e},u9.easeOutQuart=function(e){let t=e-1;return 1-t*t*t*t},u9.easeInOutQuart=function(e){let t=e-1;return e<.5?8*e*e*e*e:1-8*t*t*t*t},u9.easeInQuint=function(e){return e*e*e*e*e},u9.easeOutQuint=function(e){let t=e-1;return 1+t*t*t*t*t},u9.easeInOutQuint=function(e){let t=e-1;return e<.5?16*e*e*e*e*e:1+16*t*t*t*t*t},u9.easeInExpo=function(e){return 0===e?0:Math.pow(2,10*(e-1))},u9.easeOutExpo=function(e){return 1===e?1:-Math.pow(2,-10*e)+1},u9.easeInOutExpo=function(e){if(0===e||1===e)return e;let t=2*e,n=t-1;return t<1?.5*Math.pow(2,10*n):.5*(-Math.pow(2,-10*n)+2)},u9.easeInCirc=function(e){return -1*(Math.sqrt(1-e/1*e)-1)},u9.easeOutCirc=function(e){let t=e-1;return Math.sqrt(1-t*t)},u9.easeInOutCirc=function(e){let t=2*e,n=t-2;return t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-n*n)+1)},u9.easeInBack=function(e,t=1.70158){return e*e*((t+1)*e-t)},u9.easeOutBack=function(e,t=1.70158){let n=e/1-1;return n*n*((t+1)*n+t)+1},u9.easeInOutBack=function(e,t=1.70158){let n=2*e,r=n-2,i=1.525*t;return n<1?.5*n*n*((i+1)*n-i):.5*(r*r*((i+1)*r+i)+2)},u9.easeInElastic=function(e,t=.7){if(0===e||1===e)return e;let n=e/1-1,r=1-t;return-(Math.pow(2,10*n)*Math.sin(2*Math.PI*(n-r/(2*Math.PI)*Math.asin(1))/r))},u9.easeOutElastic=function(e,t=.7){let n=1-t,r=2*e;return 0===e||1===e?e:Math.pow(2,-10*r)*Math.sin(2*Math.PI*(r-n/(2*Math.PI)*Math.asin(1))/n)+1},u9.easeInOutElastic=function(e,t=.65){let n=1-t;if(0===e||1===e)return e;let r=2*e,i=r-1,o=n/(2*Math.PI)*Math.asin(1);return r<1?-(Math.pow(2,10*i)*Math.sin(2*Math.PI*(i-o)/n)*.5):Math.pow(2,-10*i)*Math.sin(2*Math.PI*(i-o)/n)*.5+1},u9.easeOutBounce=u8,u9.easeInBounce=u7,u9.easeInOutBounce=function(e){return e<.5?.5*u7(2*e):.5*u8(2*e-1)+.5},(R=ts||(ts={})).number=(e,t)=>{let n=t-e;return t=>e+n*t},R.object=(e,t)=>{let n=Object.keys(e);return r=>{let i={};for(let o=n.length-1;-1!==o;o-=1){let s=n[o];i[s]=e[s]+(t[s]-e[s])*r}return i}},R.unit=(e,t)=>{let n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,r=n.exec(e),i=n.exec(t),o=i?i[1]:"",s=r?+r[1]:0,l=i?+i[1]:0,a=o.indexOf("."),u=a>0?o[1].length-a-1:0,c=l-s,h=r?r[2]:"";return e=>(s+c*e).toFixed(u)+h},R.color=(e,t)=>{let n=parseInt(e.slice(1),16),r=parseInt(t.slice(1),16),i=255&n,o=(255&r)-i,s=65280&n,l=(65280&r)-s,a=0xff0000&n,u=(0xff0000&r)-a;return e=>`#${(0x1000000|i+o*e&255|s+l*e&65280|a+u*e&0xff0000).toString(16).slice(1)}`};let ce=[];function ct(e,t){let n=ce.find(t=>t.name===e);if((!n||(n.loadTimes+=1,!(n.loadTimes>1)))&&!e2.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),ce.push({name:e,loadTimes:1,styleElement:n})}}function cn(e){let t=ce.findIndex(t=>t.name===e);if(t>-1){let e=ce[t];if(e.loadTimes-=1,e.loadTimes>0)return;let n=e.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,ce.splice(t,1)}}(I=tl||(tl={})).toDeg=function(e){return 180*e/Math.PI%360},I.toRad=function(e,t=!1){return(t?e:e%360)*Math.PI/180},I.normalize=function(e){return e%360+360*(e<0)},(_=ta||(ta={})).round=function(e,t=0){return Number.isInteger(e)?e:+e.toFixed(t)},_.random=function(e,t){let n,r;if(null==t?(r=null==e?1:e,n=0):(r=t,n=null==e?0:e),r<n){let e=n;n=r,r=e}return Math.floor(Math.random()*(r-n+1)+n)},_.clamp=function(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},_.snapToGrid=function(e,t){return t*Math.round(e/t)},_.containsPoint=function(e,t){return null!=t&&null!=e&&t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height},_.squaredLength=function(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r};class cr{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class ci extends cr{constructor(e,t){super(),this.x=null==e?0:e,this.y=null==t?0:t}round(e=0){return this.x=ta.round(this.x,e),this.y=ta.round(this.y,e),this}add(e,t){let n=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}update(e,t){let n=ci.create(e,t);return this.x=n.x,this.y=n.y,this}translate(e,t){let n=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}rotate(e,t){let n=ci.rotate(this,e,t);return this.x=n.x,this.y=n.y,this}scale(e,t,n=new ci){let r=ci.create(n);return this.x=r.x+e*(this.x-r.x),this.y=r.y+t*(this.y-r.y),this}closest(e){if(1===e.length)return ci.create(e[0]);let t=null,n=1/0;return e.forEach(e=>{let r=this.squaredDistance(e);r<n&&(t=e,n=r)}),t?ci.create(t):null}distance(e){return Math.sqrt(this.squaredDistance(e))}squaredDistance(e){let t=ci.create(e),n=this.x-t.x,r=this.y-t.y;return n*n+r*r}manhattanDistance(e){let t=ci.create(e);return Math.abs(t.x-this.x)+Math.abs(t.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(e=new ci){let t=ci.create(e),n=Math.atan2(-(t.y-this.y),t.x-this.x);return n<0&&(n=2*Math.PI+n),180*n/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(e){return new ci(0,0).angleBetween(this,e)}toPolar(e){return this.update(ci.toPolar(this,e)),this}changeInAngle(e,t,n=new ci){return this.clone().translate(-e,-t).theta(n)-this.theta(n)}adhereToRect(e){return ta.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(e){let t=ci.create(e),n=tl.toRad(this.y),r=tl.toRad(t.y),i=this.x,o=t.x,s=tl.toRad(o-i),l=Math.sin(s)*Math.cos(r),a=Math.cos(n)*Math.sin(r)-Math.sin(n)*Math.cos(r)*Math.cos(s),u=tl.toDeg(Math.atan2(l,a))-22.5;return u<0&&(u+=360),["NE","E","SE","S","SW","W","NW","N"][u=parseInt(u/45,10)]}cross(e,t){if(null!=e&&null!=t){let n=ci.create(e),r=ci.create(t);return(r.x-this.x)*(n.y-this.y)-(r.y-this.y)*(n.x-this.x)}return NaN}dot(e){let t=ci.create(e);return this.x*t.x+this.y*t.y}diff(e,t){if("number"==typeof e)return new ci(this.x-e,this.y-t);let n=ci.create(e);return new ci(this.x-n.x,this.y-n.y)}lerp(e,t){let n=ci.create(e);return new ci((1-t)*this.x+t*n.x,(1-t)*this.y+t*n.y)}normalize(e=1){let t=e/this.magnitude();return this.scale(t,t)}move(e,t){let n=ci.create(e),r=tl.toRad(n.theta(this));return this.translate(Math.cos(r)*t,-Math.sin(r)*t)}reflection(e){return ci.create(e).move(this,this.distance(e))}snapToGrid(e,t){return this.x=ta.snapToGrid(this.x,e),this.y=ta.snapToGrid(this.y,null==t?e:t),this}equals(e){let t=ci.create(e);return null!=t&&t.x===this.x&&t.y===this.y}clone(){return ci.clone(this)}toJSON(){return ci.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}(z=ci||(ci={})).isPoint=function(e){return null!=e&&e instanceof z},(D=ci||(ci={})).isPointLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y},D.isPointData=function(e){return null!=e&&Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]},function(e){function t(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)}function n(e,t){return e===t||null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function r(n,i,o,s=new e){let l=t(n),a=t(s),u=l.x-a.x,c=l.y-a.y;return new e(u*i-c*o+a.x,c*i+u*o+a.y)}e.create=function(n,r){return null==n||"number"==typeof n?new e(n,r):t(n)},e.clone=t,e.toJSON=function(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.fromPolar=function(n,r,i=new e){let o=Math.abs(n*Math.cos(r)),s=Math.abs(n*Math.sin(r)),l=t(i),a=tl.normalize(tl.toDeg(r));return a<90?s=-s:a<180?(o=-o,s=-s):a<270&&(o=-o),new e(l.x+o,l.y+s)},e.toPolar=function(n,r=new e){let i=t(n),o=t(r),s=i.x-o.x,l=i.y-o.y;return new e(Math.sqrt(s*s+l*l),tl.toRad(o.theta(i)))},e.equals=n,e.equalPoints=function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!==t.length)return!1;if(null!=e&&null!=t){for(let r=0,i=e.length;r<i;r+=1)if(!n(e[r],t[r]))return!1}return!0},e.random=function(t,n,r,i){return new e(ta.random(t,n),ta.random(r,i))},e.rotate=function(e,t,n){let i=tl.toRad(tl.normalize(-t)),o=Math.sin(i);return r(e,Math.cos(i),o,n)},e.rotateEx=r}(ci||(ci={}));class co extends cr{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 ci(this.x,this.y)}get topLeft(){return new ci(this.x,this.y)}get topCenter(){return new ci(this.x+this.width/2,this.y)}get topRight(){return new ci(this.x+this.width,this.y)}get center(){return new ci(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new ci(this.x,this.y+this.height)}get bottomCenter(){return new ci(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new ci(this.x+this.width,this.y+this.height)}get corner(){return new ci(this.x+this.width,this.y+this.height)}get rightMiddle(){return new ci(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new ci(this.x,this.y+this.height/2)}get topLine(){return new ca(this.topLeft,this.topRight)}get rightLine(){return new ca(this.topRight,this.bottomRight)}get bottomLine(){return new ca(this.bottomLeft,this.bottomRight)}get leftLine(){return new ca(this.topLeft,this.bottomLeft)}constructor(e,t,n,r){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.width=null==n?0:n,this.height=null==r?0:r}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(e){if(!e)return this.clone();let t=tl.toRad(e),n=Math.abs(Math.sin(t)),r=Math.abs(Math.cos(t)),i=this.width*r+this.height*n,o=this.width*n+this.height*r;return new co(this.x+(this.width-i)/2,this.y+(this.height-o)/2,i,o)}round(e=0){return this.x=ta.round(this.x,e),this.y=ta.round(this.y,e),this.width=ta.round(this.width,e),this.height=ta.round(this.height,e),this}add(e,t,n,r){let i=co.create(e,t,n,r),o=Math.min(this.x,i.x),s=Math.min(this.y,i.y),l=Math.max(this.x+this.width,i.x+i.width),a=Math.max(this.y+this.height,i.y+i.height);return this.x=o,this.y=s,this.width=l-o,this.height=a-s,this}update(e,t,n,r){let i=co.create(e,t,n,r);return this.x=i.x,this.y=i.y,this.width=i.width,this.height=i.height,this}inflate(e,t){let n=null!=t?t:e;return this.x-=e,this.y-=n,this.width+=2*e,this.height+=2*n,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=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}scale(e,t,n=new ci){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(e,t=this.getCenter()){if(0!==e){let n=tl.toRad(e),r=Math.cos(n),i=Math.sin(n),o=this.getOrigin(),s=this.getTopRight(),l=this.getBottomRight(),a=this.getBottomLeft();o=ci.rotateEx(o,r,i,t),s=ci.rotateEx(s,r,i,t),l=ci.rotateEx(l,r,i,t),a=ci.rotateEx(a,r,i,t);let u=new co(o.x,o.y,0,0);u.add(s.x,s.y,0,0),u.add(l.x,l.y,0,0),u.add(a.x,a.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(e){let t=co.clone(e);return this.x+=t.x||0,this.y+=t.y||0,this.width+=t.width||0,this.height+=t.height||0,this}getMaxScaleToFit(e,t=this.center){let n=co.clone(e),r=t.x,i=t.y,o=1/0,s=1/0,l=1/0,a=1/0,u=1/0,c=1/0,h=1/0,d=1/0,f=n.topLeft;f.x<r&&(o=(this.x-r)/(f.x-r)),f.y<i&&(u=(this.y-i)/(f.y-i));let g=n.bottomRight;g.x>r&&(s=(this.x+this.width-r)/(g.x-r)),g.y>i&&(c=(this.y+this.height-i)/(g.y-i));let p=n.topRight;p.x>r&&(l=(this.x+this.width-r)/(p.x-r)),p.y<i&&(h=(this.y-i)/(p.y-i));let m=n.bottomLeft;return m.x<r&&(a=(this.x-r)/(m.x-r)),m.y>i&&(d=(this.y+this.height-i)/(m.y-i)),{sx:Math.min(o,s,l,a),sy:Math.min(u,c,h,d)}}getMaxUniformScaleToFit(e,t=this.center){let n=this.getMaxScaleToFit(e,t);return Math.min(n.sx,n.sy)}containsPoint(e,t){return ta.containsPoint(this,ci.create(e,t))}containsRect(e,t,n,r){let i=co.create(e,t,n,r),o=this.x,s=this.y,l=this.width,a=this.height,u=i.x,c=i.y,h=i.width,d=i.height;return 0!==l&&0!==a&&0!==h&&0!==d&&u>=o&&c>=s&&u+h<=o+l&&c+d<=s+a}intersectsWithLine(e){let t=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],r=[];return t.forEach(t=>{let i=e.intersectsWithLine(t);null!==i&&0>r.indexOf(i.toString())&&(n.push(i),r.push(i.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(e,t){let n=ci.clone(e),r=this.center,i=null;null!=t&&0!==t&&n.rotate(t,r);let o=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],s=new ca(r,n);for(let e=o.length-1;e>=0;e-=1){let t=o[e].intersectsWithLine(s);if(null!==t){i=t;break}}return i&&null!=t&&0!==t&&i.rotate(-t,r),i}intersectsWithRect(e,t,n,r){let i=co.create(e,t,n,r);if(!this.isIntersectWithRect(i))return null;let o=this.origin,s=this.corner,l=i.origin,a=i.corner,u=Math.max(o.x,l.x),c=Math.max(o.y,l.y);return new co(u,c,Math.min(s.x,a.x)-u,Math.min(s.y,a.y)-c)}isIntersectWithRect(e,t,n,r){let i=co.create(e,t,n,r),o=this.origin,s=this.corner,l=i.origin,a=i.corner;return!(a.x<=o.x)&&!(a.y<=o.y)&&!(l.x>=s.x)&&!(l.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(e){let t=co.clone(e),n=this.origin,r=this.corner,i=t.origin,o=t.corner,s=Math.min(n.x,i.x),l=Math.min(n.y,i.y),a=Math.max(r.x,o.x),u=Math.max(r.y,o.y);return new co(s,l,a-s,u-l)}getNearestSideToPoint(e){let t=ci.clone(e),n=t.x-this.x,r=this.x+this.width-t.x,i=t.y-this.y,o=this.y+this.height-t.y,s=n,l="left";return r<s&&(s=r,l="right"),i<s&&(s=i,l="top"),o<s&&(l="bottom"),l}getNearestPointToPoint(e){let t=ci.clone(e);if(this.containsPoint(t)){let e=this.getNearestSideToPoint(t);if("left"===e)return new ci(this.x,t.y);if("top"===e)return new ci(t.x,this.y);if("right"===e)return new ci(this.x+this.width,t.y);if("bottom"===e)return new ci(t.x,this.y+this.height)}return t.adhereToRect(this)}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}clone(){return new co(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}`}}(B=co||(co={})).isRectangle=function(e){return null!=e&&e instanceof B},(co||(co={})).isRectangleLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.width&&"number"==typeof e.height};var cs=co||(co={});function cl(e){return cs.isRectangle(e)?e.clone():Array.isArray(e)?new cs(e[0],e[1],e[2],e[3]):new cs(e.x,e.y,e.width,e.height)}cs.create=function(e,t,n,r){return null==e||"number"==typeof e?new cs(e,t,n,r):cl(e)},cs.clone=cl,cs.fromEllipse=function(e){return new cs(e.x-e.a,e.y-e.b,2*e.a,2*e.b)},cs.fromSize=function(e){return new cs(0,0,e.width,e.height)},cs.fromPositionAndSize=function(e,t){return new cs(e.x,e.y,t.width,t.height)};class ca extends cr{get center(){return new ci((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(e,t,n,r){super(),"number"==typeof e&&"number"==typeof t?(this.start=new ci(e,t),this.end=new ci(n,r)):(this.start=ci.create(e),this.end=ci.create(t))}getCenter(){return this.center}round(e=0){return this.start.round(e),this.end.round(e),this}translate(e,t){return"number"==typeof e?(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),o=r.clone().rotate(90,n);return n.move(o,e),r.move(i,e),t}vector(){return new ci(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){let e=new ci(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 co(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(e){let t=Math.min(1,Math.max(0,this.vector().dot(new ca(this.start,e).vector())/this.squaredLength()));return Number.isNaN(t)?0:t}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 o=(r?e:i-e)/i;return this.pointAt(o)}divideAt(e){let t=this.pointAt(e);return[new ca(this.start,t),new ca(t,this.end)]}divideAtLength(e){let t=this.pointAtLength(e);return[new ca(this.start,t),new ca(t,this.end)]}containsPoint(e){let t=this.start,n=this.end;if(0!==t.cross(e,n))return!1;let r=this.length();return!(new ca(t,e).length()>r||new ca(e,n).length()>r)}intersect(e,t){let n=e.intersectsWithLine(this,t);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(e){let t=new ci(this.end.x-this.start.x,this.end.y-this.start.y),n=new ci(e.end.x-e.start.x,e.end.y-e.start.y),r=t.x*n.y-t.y*n.x,i=new ci(e.start.x-this.start.x,e.start.y-this.start.y),o=i.x*n.y-i.y*n.x,s=i.x*t.y-i.y*t.x;if(0===r||o*r<0||s*r<0)return null;if(r>0){if(o>r||s>r)return null}else if(o<r||s<r)return null;return new ci(this.start.x+o*t.x/r,this.start.y+o*t.y/r)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(e){let t=ci.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=ci.create(e,t);return this.closestPoint(n).squaredDistance(n)}pointDistance(e,t){let n=ci.create(e,t);return this.closestPoint(n).distance(n)}tangentAt(e){if(!this.isDifferentiable())return null;let t=this.start,n=this.end,r=this.pointAt(e),i=new ca(t,n);return i.translate(r.x-t.x,r.y-t.y),i}tangentAtLength(e){if(!this.isDifferentiable())return null;let t=this.start,n=this.end,r=this.pointAtLength(e),i=new ca(t,n);return i.translate(r.x-t.x,r.y-t.y),i}relativeCcw(e,t){let n=ci.create(e,t),r=n.x-this.start.x,i=n.y-this.start.y,o=this.end.x-this.start.x,s=this.end.y-this.start.y,l=r*s-i*o;return 0===l&&(l=r*o+i*s)>0&&(r-=o,i-=s,(l=r*o+i*s)<0&&(l=0)),l<0?-1:+(l>0)}equals(e){return null!=e&&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 ca(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}(V=ca||(ca={})).isLine=function(e){return null!=e&&e instanceof V};class cu extends cr{get center(){return new ci(this.x,this.y)}constructor(e,t,n,r){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.a=null==n?0:n,this.b=null==r?0:r}bbox(){return co.fromEllipse(this)}getCenter(){return this.center}inflate(e,t){return this.a+=2*e,this.b+=2*(null!=t?t:e),this}normalizedDistance(e,t){let n=ci.create(e,t),r=n.x-this.x,i=n.y-this.y,o=this.a,s=this.b;return r*r/(o*o)+i*i/(s*s)}containsPoint(e,t){return 1>=this.normalizedDistance(e,t)}intersectsWithLine(e){let t=[],n=this.a,r=this.b,i=e.start,o=e.end,s=e.vector(),l=i.diff(new ci(this.x,this.y)),a=new ci(s.x/(n*n),s.y/(r*r)),u=new ci(l.x/(n*n),l.y/(r*r)),c=s.dot(a),h=s.dot(u),d=h*h-c*(l.dot(u)-1);if(d<0)return null;if(d>0){let e=Math.sqrt(d),n=(-h-e)/c,r=(-h+e)/c;if((n<0||n>1)&&(r<0||r>1))return null;n>=0&&n<=1&&t.push(i.lerp(o,n)),r>=0&&r<=1&&t.push(i.lerp(o,r))}else{let e=-h/c;if(!(e>=0)||!(e<=1))return null;t.push(i.lerp(o,e))}return t}intersectsWithLineFromCenterToPoint(e,t=0){let n,r=ci.clone(e);t&&r.rotate(t,this.getCenter());let i=r.x-this.x,o=r.y-this.y;if(0===i)return(n=this.bbox().getNearestPointToPoint(r),t)?n.rotate(-t,this.getCenter()):n;let s=o/i,l=Math.sqrt(1/(1/(this.a*this.a)+s*s/(this.b*this.b))),a=s*(l=i<0?-l:l);return(n=new ci(this.x+l,this.y+a),t)?n.rotate(-t,this.getCenter()):n}tangentTheta(e){let t,n,r=ci.clone(e),i=r.x,o=r.y,s=this.a,l=this.b,a=this.bbox().center,u=a.x,c=a.y,h=i>a.x+s/2,d=i<a.x-s/2;return h||d?(n=i>a.x?o-30:o+30,t=s*s/(i-u)-s*s*(o-c)*(n-c)/(l*l*(i-u))+u):(t=o>a.y?i+30:i-30,n=l*l/(o-c)-l*l*(i-u)*(t-u)/(s*s*(o-c))+c),new ci(t,n).theta(r)}scale(e,t){return this.a*=e,this.b*=t,this}rotate(e,t){let n=co.fromEllipse(this);n.rotate(e,t);let r=cu.fromRect(n);return this.a=r.a,this.b=r.b,this.x=r.x,this.y=r.y,this}translate(e,t){let n=ci.create(e,t);return this.x+=n.x,this.y+=n.y,this}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.a===this.a&&e.b===this.b}clone(){return new cu(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}`}}(F=cu||(cu={})).isEllipse=function(e){return null!=e&&e instanceof F};var cc=cu||(cu={});function ch(e){return cc.isEllipse(e)?e.clone():Array.isArray(e)?new cc(e[0],e[1],e[2],e[3]):new cc(e.x,e.y,e.a,e.b)}cc.create=function(e,t,n,r){return null==e||"number"==typeof e?new cc(e,t,n,r):ch(e)},cc.parse=ch,cc.fromRect=function(e){let t=e.center;return new cc(t.x,t.y,e.width/2,e.height/2)};let cd=RegExp("^[\\s\\dLMCZz,.]*$");function cf(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})}),function(e,t,n,r,i){let o=[],s=e[e.length-1],l=null!=t&&t>0,a=t||0;if(r&&l){let t=(e=e.slice())[0],n=new ci(s.x+(t.x-s.x)/2,s.y+(t.y-s.y)/2);e.splice(0,0,n)}let u=e[0],c=1;for(n?o.push("M",u.x,u.y):o.push("L",u.x,u.y);c<(r?e.length:e.length-1);){var h,d,f;let t=e[(c%(h=e.length)+h)%h],n=u.x-t.x,r=u.y-t.y;if(l&&(0!==n||0!==r)&&(null==i||0>i.indexOf(c-1))){let i=Math.sqrt(n*n+r*r),s=n*Math.min(a,i/2)/i,l=r*Math.min(a,i/2)/i,u=t.x+s,h=t.y+l;o.push("L",u,h);let g=e[((c+1)%(d=e.length)+d)%d];for(;c<e.length-2&&0===Math.round(g.x-t.x)&&0===Math.round(g.y-t.y);)g=e[((c+2)%(f=e.length)+f)%f],c+=1;i=Math.max(1,Math.sqrt((n=g.x-t.x)*n+(r=g.y-t.y)*r));let p=n*Math.min(a,i/2)/i,m=r*Math.min(a,i/2)/i,y=t.x+p,b=t.y+m;o.push("Q",t.x,t.y,y,b),t=new ci(y,b)}else o.push("L",t.x,t.y);u=t,c+=1}return r?o.push("Z"):o.push("L",s.x,s.y),o.map(e=>"string"==typeof e?e:+e.toFixed(3)).join(" ")}(n,t.round,null==t.initialMove||t.initialMove,t.close,t.exclude)}function cg(e,t,n,r,i=0,o=0,s=0,l,a){let u;if(0===n||0===r)return[];let c=-(l-=e)/2,h=-(a-=t)/2,d=Math.cos(i*Math.PI/180),f=Math.sin(i*Math.PI/180),g=d*c+f*h,p=-1*f*c+d*h,m=g*g,y=p*p,b=(n=Math.abs(n))*n,v=(r=Math.abs(r))*r,x=m/b+y/v;if(x>1)n=Math.sqrt(x)*n,r=Math.sqrt(x)*r,u=0;else{let e=1;o===s&&(e=-1),u=e*Math.sqrt((b*v-b*y-v*m)/(b*y+v*m))}let w=u*n*p/r,C=-1*u*r*g/n,E=d*w-f*C+l/2,S=f*w+d*C+a/2,P=Math.atan2((p-C)/r,(g-w)/n)-Math.atan2(0,1),k=P>=0?P:2*Math.PI+P,O=(P=Math.atan2((-p-C)/r,(-g-w)/n)-Math.atan2((p-C)/r,(g-w)/n))>=0?P:2*Math.PI+P;0===s&&O>0?O-=2*Math.PI:0!==s&&O<0&&(O+=2*Math.PI);let M=2*O/Math.PI,A=Math.ceil(M<0?-1*M:M),T=O/A,N=8/3*Math.sin(T/4)*Math.sin(T/4)/Math.sin(T/2),j=d*n,L=d*r,R=f*n,I=f*r,_=Math.cos(k),z=Math.sin(k),D=-N*(j*z+I*_),B=-N*(R*z-L*_),V=0,F=0,$=[];for(let n=0;n<A;n+=1){k+=T,V=j*(_=Math.cos(k))-I*(z=Math.sin(k))+E,F=R*_+L*z+S;let r=-N*(j*z+I*_),i=-N*(R*z-L*_),o=6*n;$[o]=Number(D+e),$[o+1]=Number(B+t),$[o+2]=Number(V-r+e),$[o+3]=Number(F-i+t),$[o+4]=Number(V+e),$[o+5]=Number(F+t),D=V+r,B=F+i}return $.map(e=>+e.toFixed(2))}class cp extends cr{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(e){if(super(),null!=e){if("string"==typeof e)return cp.parse(e);this.points=e.map(e=>ci.create(e))}else this.points=[]}scale(e,t,n=new ci){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=ci.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(0===this.points.length)return new co;let e=1/0,t=-1/0,n=1/0,r=-1/0,i=this.points;for(let o=0,s=i.length;o<s;o+=1){let s=i[o],l=s.x,a=s.y;l<e&&(e=l),l>t&&(t=l),a<n&&(n=a),a>r&&(r=a)}return new co(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(0===n||1===n)return 0;let r=0,i=0,o=1/0;for(let s=0,l=n-1;s<l;s+=1){let n=new ca(t[s],t[s+1]),l=n.length(),a=n.closestPointNormalizedLength(e),u=n.pointAt(a).squaredDistance(e);u<o&&(o=u,i=r+a*l),r+=l}return i}closestPointNormalizedLength(e){let t=this.length();return 0===t?0:this.closestPointLength(e)/t}closestPointTangent(e){let t=this.closestPointLength(e);return this.tangentAtLength(t)}containsPoint(e){if(0===this.points.length)return!1;let t=ci.clone(e),n=t.x,r=t.y,i=this.points,o=i.length,s=o-1,l=0;for(let a=0;a<o;a+=1){let o=i[s],u=i[a];if(t.equals(o))return!0;let c=new ca(o,u);if(c.containsPoint(e))return!0;if(r<=o.y&&r>u.y||r>o.y&&r<=u.y){let t=o.x-n>u.x-n?o.x-n:u.x-n;if(t>=0){let i=new ci(n+t,r),o=new ca(e,i);c.intersectsWithLine(o)&&(l+=1)}}s=a}return l%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],o=e.intersectsWithLine(new ca(r,i));o&&t.push(o)}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 ca(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(0===n)return null;if(1===n||e<=0)return t[0].clone();if(e>=1)return t[n-1].clone();let r=this.length();return this.pointAtLength(r*e)}pointAtLength(e){let t=this.points,n=t.length;if(0===n)return null;if(1===n)return t[0].clone();let r=!0;e<0&&(r=!1,e=-e);let i=0;for(let o=0,s=n-1;o<s;o+=1){let n=r?o:s-1-o,l=t[n],a=t[n+1],u=new ca(l,a),c=l.distance(a);if(e<=i+c)return u.pointAtLength((r?1:-1)*(e-i));i+=c}return(r?t[n-1]:t[0]).clone()}tangentAt(e){let t=this.points.length;if(0===t||1===t)return null;e<0&&(e=0),e>1&&(e=1);let n=this.length()*e;return this.tangentAtLength(n)}tangentAtLength(e){let t,n=this.points,r=n.length;if(0===r||1===r)return null;let i=!0;e<0&&(i=!1,e=-e);let o=0;for(let s=0,l=r-1;s<l;s+=1){let r=i?s:l-1-s,a=n[r],u=n[r+1],c=new ca(a,u),h=a.distance(u);if(c.isDifferentiable()){if(e<=o+h)return c.tangentAtLength((i?1:-1)*(e-o));t=c}o+=h}if(t){let e=+!!i;return t.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,o=r+2,s=t[e],l=t[i],a=t[o];new ca(s,a).closestPoint(l).distance(l)<=n?t.splice(i,1):r+=1}return this}toHull(){let e,t=this.points,n=t.length;if(0===n)return new cp;let r=t[0];for(let e=1;e<n;e+=1)t[e].y<r.y?r=t[e]: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]);0===n&&(n=360),i.push([t[e],e,n])}if(i.sort((e,t)=>{let n=e[2]-t[2];return 0===n&&(n=t[1]-e[1]),n}),i.length>2){let e=i[i.length-1];i.unshift(e)}let o={},s=[],l=e=>`${e[0].toString()}@${e[1]}`;for(;0!==i.length;){let e=i.pop(),t=e[0];if(o[l(e)])continue;let n=!1;for(;!n;)if(s.length<2)s.push(e),n=!0;else{let r=s.pop(),a=r[0],u=s.pop(),c=u[0],h=c.cross(a,t);if(h<0)s.push(u),s.push(r),s.push(e),n=!0;else if(0===h){let e=a.angleBetween(c,t);1e-10>Math.abs(e-180)||a.equals(t)||c.equals(a)?(o[l(r)]=a,s.push(u)):1e-10>Math.abs((e+1)%360-1)&&(s.push(u),i.push(r))}else o[l(r)]=a,s.push(u)}}s.length>2&&s.pop();let a=-1;for(let t=0,n=s.length;t<n;t+=1){let n=s[t][1];(void 0===e||n<e)&&(e=n,a=t)}let u=[];if(a>0){let e=s.slice(a),t=s.slice(0,a);u=e.concat(t)}else u=s;let c=[];for(let e=0,t=u.length;e<t;e+=1)c.push(u[e][0]);return new cp(c)}equals(e){return null!=e&&e.points.length===this.points.length&&e.points.every((e,t)=>e.equals(this.points[t]))}clone(){return new cp(this.points.map(e=>e.clone()))}toJSON(){return this.points.map(e=>e.toJSON())}serialize(){return this.points.map(e=>`${e.serialize()}`).join(" ")}}($=cp||(cp={})).isPolyline=function(e){return null!=e&&e instanceof $},(U=cp||(cp={})).parse=function(e){let t=e.trim();if(""===t)return new U;let n=[],r=t.split(/\s*,\s*|\s+/);for(let e=0,t=r.length;e<t;e+=2)n.push({x:+r[e],y:+r[e+1]});return new U(n)};class cm extends cr{constructor(e,t,n,r){super(),this.PRECISION=3,this.start=ci.create(e),this.controlPoint1=ci.create(t),this.controlPoint2=ci.create(n),this.end=ci.create(r)}bbox(){let e,t,n,r,i,o,s,l,a,u,c,h=this.start,d=this.controlPoint1,f=this.controlPoint2,g=this.end,p=h.x,m=h.y,y=d.x,b=d.y,v=f.x,x=f.y,w=g.x,C=g.y,E=[],S=[],P=[[],[]];for(let a=0;a<2;a+=1){if(0===a?(t=6*p-12*y+6*v,e=-3*p+9*y-9*v+3*w,n=3*y-3*p):(t=6*m-12*b+6*x,e=-3*m+9*b-9*x+3*C,n=3*b-3*m),1e-12>Math.abs(e)){if(1e-12>Math.abs(t))continue;(r=-n/t)>0&&r<1&&S.push(r);continue}l=Math.sqrt(s=t*t-4*n*e),!(s<0)&&((i=(-t+l)/(2*e))>0&&i<1&&S.push(i),(o=(-t-l)/(2*e))>0&&o<1&&S.push(o))}let k=S.length,O=k;for(;k;)k-=1,a=(c=1-(r=S[k]))*c*c*p+3*c*c*r*y+3*c*r*r*v+r*r*r*w,P[0][k]=a,u=c*c*c*m+3*c*c*r*b+3*c*r*r*x+r*r*r*C,P[1][k]=u,E[k]={X:a,Y:u};S[O]=0,S[O+1]=1,E[O]={X:p,Y:m},E[O+1]={X:w,Y:C},P[0][O]=p,P[1][O]=m,P[0][O+1]=w,P[1][O+1]=C,S.length=O+2,P[0].length=O+2,P[1].length=O+2,E.length=O+2;let M=Math.min.apply(null,P[0]),A=Math.min.apply(null,P[1]),T=Math.max.apply(null,P[0]),N=Math.max.apply(null,P[1]);return new co(M,A,T-M,N-A)}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 0===i?0:r/i}closestPointT(e,t={}){let n=this.getPrecision(t),r=this.getDivisions(t),i=Math.pow(10,-n),o=null,s=0,l=0,a=0,u=0,c=0,h=null,d=r.length,f=d>0?1/d:0;for(r.forEach((t,n)=>{let r=t.start.distance(e),i=t.end.distance(e),d=r+i;(null==h||d<h)&&(o=t,s=n*f,l=(n+1)*f,a=r,u=i,h=d,c=t.endpointDistance())});;){let t=a?Math.abs(a-u)/a:0,n=null!=u?Math.abs(a-u)/u:0,r=t<i||n<i,h=!a||a<c*i,d=!u||u<c*i,g=h||d;if(r||g)return a<=u?s:l;let p=o.divide(.5);f/=2;let m=p[0].start.distance(e),y=p[0].end.distance(e),b=m+y,v=p[1].start.distance(e),x=p[1].end.distance(e);b<=v+x?(o=p[0],l-=f,a=m,u=y):(o=p[1],s+=f,a=v,u=x)}}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(e){let t=this.start,n=this.controlPoint1,r=this.controlPoint2,i=this.end;if(e<=0)return[new cm(t,t,t,t),new cm(t,n,r,i)];if(e>=1)return[new cm(t,n,r,i),new cm(i,i,i,i)];let o=this.getSkeletonPoints(e),s=o.startControlPoint1,l=o.startControlPoint2,a=o.divider,u=o.dividerControlPoint1,c=o.dividerControlPoint2;return[new cm(t,s,l,a),new cm(a,u,c,i)]}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 o=new ca(t,n).pointAt(e),s=new ca(n,r).pointAt(e),l=new ca(r,i).pointAt(e),a=new ca(o,s).pointAt(e),u=new ca(s,l).pointAt(e),c=new ca(a,u).pointAt(e);return{startControlPoint1:o,startControlPoint2:a,divider:c,dividerControlPoint1:u,dividerControlPoint2:l}}getSubdivisions(e={}){let t=this.getPrecision(e),n=[new cm(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===t)return n;let r=this.endpointDistance(),i=Math.pow(10,-t),o=0;for(;;){o+=1;let e=[];n.forEach(t=>{let n=t.divide(.5);e.push(n[0],n[1])});let t=e.reduce((e,t)=>e+t.endpointDistance(),0),s=0!==t?(t-r)/t:0;if(o>1&&s<i)return e;n=e,r=t}}length(e={}){return this.getDivisions(e).reduce((e,t)=>e+t.endpointDistance(),0)}lengthAtT(e,t={}){if(e<=0)return 0;let n=void 0===t.precision?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,o=new ca(n,r);return o.translate(i.x-n.x,i.y-n.y),o}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getDivisions(e={}){if(null!=e.subdivisions)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);return this.tAtLength(r*e,n)}tAtLength(e,t={}){let n,r,i=!0;e<0&&(i=!1,e=-e);let o=this.getPrecision(t),s=this.getDivisions(t),l=null,a=0,u=0,c=0,h=s.length,d=h>0?1/h:0;for(let t=0;t<h;t+=1){let o=i?t:h-1-t,f=s[t],g=f.endpointDistance();if(e<=c+g){l=f,n=o*d,r=(o+1)*d,a=i?e-c:g+c-e,u=i?g+c-e:e-c;break}c+=g}if(null==l)return+!!i;let f=this.length({precision:o,subdivisions:s}),g=Math.pow(10,-o);for(;;){let e,t,i;if((0!==f?a/f:0)<g)return n;if((0!==f?u/f:0)<g)return r;let o=l.divide(.5);d/=2;let s=o[0].endpointDistance(),c=o[1].endpointDistance();a<=s?(l=o[0],r-=d,i=s-(t=a)):(l=o[1],n+=d,i=c-(t=a-s)),a=t,u=i}}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 cp(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"number"==typeof e?(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 null!=e&&this.start.equals(e.start)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)&&this.end.equals(e.end)}clone(){return new cm(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(" ")}}(G=cm||(cm={})).isCurve=function(e){return null!=e&&e instanceof G};var cy=cm||(cm={});function cb(e){let t=e.length,n=[],r=[],i=2;n[0]=e[0]/i;for(let o=1;o<t;o+=1)r[o]=1/i,i=(o<t-1?4:3.5)-r[o],n[o]=(e[o]-n[o-1])/i;for(let e=1;e<t;e+=1)n[t-e-1]-=r[t-e]*n[t-e];return n}cy.throughPoints=function(e){if(null==e||Array.isArray(e)&&e.length<2)throw Error("At least 2 points are required");let t=function(e){let t=e.map(e=>ci.clone(e)),n=[],r=[],i=t.length-1;if(1===i)return n[0]=new ci((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),r[0]=new ci(2*n[0].x-t[0].x,2*n[0].y-t[0].y),[n,r];let o=[];for(let e=1;e<i-1;e+=1)o[e]=4*t[e].x+2*t[e+1].x;o[0]=t[0].x+2*t[1].x,o[i-1]=(8*t[i-1].x+t[i].x)/2;let s=cb(o);for(let e=1;e<i-1;e+=1)o[e]=4*t[e].y+2*t[e+1].y;o[0]=t[0].y+2*t[1].y,o[i-1]=(8*t[i-1].y+t[i].y)/2;let l=cb(o);for(let e=0;e<i;e+=1)n.push(new ci(s[e],l[e])),e<i-1?r.push(new ci(2*t[e+1].x-s[e+1],2*t[e+1].y-l[e+1])):r.push(new ci((t[i].x+s[i-1])/2,(t[i].y+l[i-1])/2));return[n,r]}(e),n=[];for(let r=0,i=t[0].length;r<i;r+=1){let i=new ci(t[0][r].x,t[0][r].y),o=new ci(t[1][r].x,t[1][r].y);n.push(new cy(e[r],i,o,e[r+1]))}return n};class cv extends cr{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(null==this.previousSegment)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.")}}class cx extends cv{constructor(e,t){super(),ca.isLine(e)?this.endPoint=e.end.clone().round(2):this.endPoint=ci.create(e,t).round(2)}get type(){return"L"}get line(){return new ca(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[new cx(t[0]),new cx(t[1])]}divideAtLength(e){let t=this.line.divideAtLength(e);return[new cx(t[0]),new cx(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 null!=this.previousSegment&&!this.start.equals(this.end)}clone(){return new cx(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"number"==typeof e?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}`}}(H=cx||(cx={})).create=function(...e){let t=e.length,n=e[0];if(ca.isLine(n))return new H(n);if(ci.isPointLike(n))return 1===t?new H(n):e.map(e=>new H(e));if(2===t)return new H(+e[0],+e[1]);let r=[];for(let n=0;n<t;n+=2){let t=+e[n],i=+e[n+1];r.push(new H(t,i))}return r};class cw extends cv{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 ca(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 cx(t[0]):this.clone(),new cx(t[1])]}divideAtLength(e){let t=this.line.divideAtLength(e);return[t[1].isDifferentiable()?new cx(t[0]):this.clone(),new cx(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&&!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 cw}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}(q=cw||(cw={})).create=function(){return new q};class cC extends cv{constructor(e,t){super(),this.isVisible=!1,this.isSubpathStart=!0,ca.isLine(e)||cm.isCurve(e)?this.endPoint=e.end.clone().round(2):this.endPoint=ci.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"number"==typeof e?this.end.translate(e,t):this.end.translate(e),this}clone(){return new cC(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}`}}(W=cC||(cC={})).create=function(...e){let t=e.length,n=e[0];if(ca.isLine(n)||cm.isCurve(n))return new W(n);if(ci.isPointLike(n)){if(1===t)return new W(n);let r=[];for(let n=0;n<t;n+=1)0===n?r.push(new W(e[n])):r.push(new cx(e[n]));return r}if(2===t)return new W(+e[0],+e[1]);let r=[];for(let n=0;n<t;n+=2){let t=+e[n],i=+e[n+1];0===n?r.push(new W(t,i)):r.push(new cx(t,i))}return r};class cE extends cv{constructor(e,t,n,r,i,o){super(),cm.isCurve(e)?(this.controlPoint1=e.controlPoint1.clone().round(2),this.controlPoint2=e.controlPoint2.clone().round(2),this.endPoint=e.end.clone().round(2)):"number"==typeof e?(this.controlPoint1=new ci(e,t).round(2),this.controlPoint2=new ci(n,r).round(2),this.endPoint=new ci(i,o).round(2)):(this.controlPoint1=ci.create(e).round(2),this.controlPoint2=ci.create(t).round(2),this.endPoint=ci.create(n).round(2))}get type(){return"C"}get curve(){return new cm(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(e,t={}){let n=this.curve.divideAt(e,t);return[new cE(n[0]),new cE(n[1])]}divideAtLength(e,t={}){let n=this.curve.divideAtLength(e,t);return[new cE(n[0]),new cE(n[1])]}divideAtT(e){let t=this.curve.divideAtT(e);return[new cE(t[0]),new cE(t[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"number"==typeof e?(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 cE(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 cS(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function cP(e,t,n,r,i,o){return[1/3*e+2/3*n,1/3*t+2/3*r,1/3*i+2/3*n,1/3*o+2/3*r,i,o]}(J=cE||(cE={})).create=function(...e){let t=e.length,n=e[0];if(cm.isCurve(n))return new J(n);if(ci.isPointLike(n)){if(3===t)return new J(e[0],e[1],e[2]);let n=[];for(let r=0;r<t;r+=3)n.push(new J(e[r],e[r+1],e[r+2]));return n}if(6===t)return new J(e[0],e[1],e[2],e[3],e[4],e[5]);let r=[];for(let n=0;n<t;n+=6)r.push(new J(e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5]));return r};class ck extends cr{constructor(e){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(e))if(ca.isLine(e[0])||cm.isCurve(e[0])){let t=null;e.forEach((e,n)=>{0===n&&this.appendSegment(ck.createSegment("M",e.start)),null==t||t.end.equals(e.start)||this.appendSegment(ck.createSegment("M",e.start)),ca.isLine(e)?this.appendSegment(ck.createSegment("L",e.end)):cm.isCurve(e)&&this.appendSegment(ck.createSegment("C",e.controlPoint1,e.controlPoint2,e.end)),t=e})}else e.forEach(e=>{e.isSegment&&this.appendSegment(e)});else null!=e&&(ca.isLine(e)?(this.appendSegment(ck.createSegment("M",e.start)),this.appendSegment(ck.createSegment("L",e.end))):cm.isCurve(e)?(this.appendSegment(ck.createSegment("M",e.start)),this.appendSegment(ck.createSegment("C",e.controlPoint1,e.controlPoint2,e.end))):cp.isPolyline(e)?e.points&&e.points.length&&e.points.forEach((e,t)=>{let n=0===t?ck.createSegment("M",e):ck.createSegment("L",e);this.appendSegment(n)}):e.isSegment&&this.appendSegment(e))}get start(){let e=this.segments,t=e.length;if(0===t)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(0===t)return null;for(let n=t-1;n>=0;n-=1){let t=e[n];if(t.isVisible)return t.end}return e[t-1].end}moveTo(...e){return this.appendSegment(cC.create.call(null,...e))}lineTo(...e){return this.appendSegment(cx.create.call(null,...e))}curveTo(...e){return this.appendSegment(cE.create.call(null,...e))}arcTo(e,t,n,r,i,o,s){let l=this.end||new ci,a="number"==typeof o?cg(l.x,l.y,e,t,n,r,i,o,s):cg(l.x,l.y,e,t,n,r,i,o.x,o.y);if(null!=a)for(let e=0,t=a.length;e<t;e+=6)this.curveTo(a[e],a[e+1],a[e+2],a[e+3],a[e+4],a[e+5]);return this}quadTo(e,t,n,r){let i=this.end||new ci,o=["M",i.x,i.y];"number"==typeof e?o.push("Q",e,t,n,r):o.push("Q",e.x,e.y,t.x,t.y);let s=ck.parse(o.join(" "));return this.appendSegment(s.segments.slice(1)),this}close(){return this.appendSegment(cw.create())}drawPoints(e,t={}){let n=cf(e,t),r=ck.parse(n);r&&r.segments&&this.appendSegment(r.segments)}bbox(){let e,t=this.segments,n=t.length;if(0===n)return null;for(let r=0;r<n;r+=1){let n=t[r];if(n.isVisible){let t=n.bbox();null!=t&&(e=e?e.union(t):t)}}if(null!=e)return e;let r=t[n-1];return new co(r.end.x,r.end.y,0,0)}appendSegment(e){let t,n=this.segments.length,r=0!==n?this.segments[n-1]:null;if(Array.isArray(e))for(let n=0,i=e.length;n<i;n+=1){let i=e[n];t=this.prepareSegment(i,r,null),this.segments.push(t),r=t}else null!=e&&e.isSegment&&(t=this.prepareSegment(e,r,null),this.segments.push(t));return this}insertSegment(e,t){let n,r=this.segments.length;if(e<0&&(e=r+e+1),e>r||e<0)throw Error("Index out of range.");let i=null,o=null;if(0!==r&&(e>=1?o=(i=this.segments[e-1]).nextSegment:(i=null,o=this.segments[0])),Array.isArray(t))for(let r=0,s=t.length;r<s;r+=1){let s=t[r];n=this.prepareSegment(s,i,o),this.segments.splice(e+r,0,n),i=n}else n=this.prepareSegment(t,i,o),this.segments.splice(e,0,n);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,r=this.fixIndex(e),i=this.segments[r],o=i.previousSegment,s=i.nextSegment,l=i.isSubpathStart;if(Array.isArray(t)){this.segments.splice(e,1);for(let r=0,i=t.length;r<i;r+=1){let i=t[r];n=this.prepareSegment(i,o,s),this.segments.splice(e+r,0,n),o=n,l&&n.isSubpathStart&&(l=!1)}}else n=this.prepareSegment(t,o,s),this.segments.splice(r,1,n),l&&n.isSubpathStart&&(l=!1);l&&s&&this.updateSubpathStartSegment(s)}getSegment(e){let t=this.fixIndex(e);return this.segments[t]}fixIndex(e){let t=this.segments.length;if(0===t)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(0===this.segments.length)return null;let n=ta.clamp(e,0,1),r=this.getOptions(t),i=this.length(r);return this.segmentIndexAtLength(i*n,r)}segmentIndexAtLength(e,t={}){let n=this.segments.length;if(0===n)return null;let r=!0;e<0&&(r=!1,e=-e);let i=this.getPrecision(t),o=this.getSubdivisions(t),s=0,l=null;for(let t=0;t<n;t+=1){let a=r?t:n-1-t,u=this.segments[a],c=o[a],h=u.length({precision:i,subdivisions:c});if(u.isVisible){if(e<=s+h)return a;l=a}s+=h}return l}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;)null!=t?n.subpathStartSegment=t.subpathStartSegment:n.subpathStartSegment=null,t=n,n=n.nextSegment}prepareSegment(e,t,n){e.previousSegment=t,e.nextSegment=n,null!=t&&(t.nextSegment=e),null!=n&&(n.previousSegment=e);let r=e;return e.isSubpathStart&&(e.subpathStartSegment=e,r=n),null!=r&&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(0===r)return 0;let i=this.length(n);return 0===i?0:r/i}closestPointT(e,t={}){let n;if(0===this.segments.length)return null;let r=this.getPrecision(t),i=this.getSubdivisions(t),o=1/0;for(let t=0,s=this.segments.length;t<s;t+=1){let s=this.segments[t],l=i[t];if(s.isVisible){let i=s.closestPointT(e,{precision:r,subdivisions:l}),a=s.pointAtT(i),u=ta.squaredLength(a,e);u<o&&(n={segmentIndex:t,value:i},o=u)}}return n||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(e,t={}){let n;if(0===this.segments.length)return null;let r=this.getPrecision(t),i=this.getSubdivisions(t),o=1/0;for(let t=0,s=this.segments.length;t<s;t+=1){let s=this.segments[t],l=i[t];if(s.isDifferentiable()){let t=s.closestPointT(e,{precision:r,subdivisions:l}),i=s.pointAtT(t),a=ta.squaredLength(i,e);a<o&&(n=s.tangentAtT(t),o=a)}}return n||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(0===this.segments.length)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);return this.pointAtLength(r*e,n)}pointAtLength(e,t={}){let n;if(0===this.segments.length)return null;if(0===e)return this.start.clone();let r=!0;e<0&&(r=!1,e=-e);let i=this.getPrecision(t),o=this.getSubdivisions(t),s=0;for(let t=0,l=this.segments.length;t<l;t+=1){let a=r?t:l-1-t,u=this.segments[a],c=o[a],h=u.length({precision:i,subdivisions:c});if(u.isVisible){if(e<=s+h)return u.pointAtLength((r?1:-1)*(e-s),{precision:i,subdivisions:c});n=u}s+=h}return n?r?n.end:n.start:this.segments[this.segments.length-1].end.clone()}pointAtT(e){let t=this.segments,n=t.length;if(0===n)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=ta.clamp(e.value,0,1);return t[r].pointAtT(i)}divideAt(e,t={}){if(0===this.segments.length)return null;let n=ta.clamp(e,0,1),r=this.getOptions(t),i=this.length(r);return this.divideAtLength(i*n,r)}divideAtLength(e,t={}){let n,r,i,o,s;if(0===this.segments.length)return null;let l=!0;e<0&&(l=!1,e=-e);let a=this.getPrecision(t),u=this.getSubdivisions(t),c=0;for(let t=0,s=this.segments.length;t<s;t+=1){let h=l?t:s-1-t,d=this.getSegment(h),f={precision:a,subdivisions:u[h]},g=d.length(f);if(d.isDifferentiable()&&(i=d,o=h,e<=c+g)){r=h,n=d.divideAtLength((l?1:-1)*(e-c),f);break}c+=g}if(!i)return null;n||(r=o,s=+!!l,n=i.divideAtT(s));let h=this.clone(),d=r;h.replaceSegment(d,n);let f=d+1,g=d+2;n[0].isDifferentiable()||(h.removeSegment(d),f-=1,g-=1);let p=h.getSegment(f).start;h.insertSegment(f,ck.createSegment("M",p)),g+=1,n[1].isDifferentiable()||(h.removeSegment(g-1),g-=1);let m=g-d-1;for(let e=g,t=h.segments.length;e<t;e+=1){let t=this.getSegment(e-m),n=h.getSegment(e);if("Z"===n.type&&!t.subpathStartSegment.end.equals(n.subpathStartSegment.end)){let n=ck.createSegment("L",t.end);h.replaceSegment(e,n)}}return[new ck(h.segments.slice(0,f)),new ck(h.segments.slice(f))]}intersectsWithLine(e,t={}){let n=this.toPolylines(t);if(null==n)return null;let r=null;for(let t=0,i=n.length;t<i;t+=1){let i=n[t],o=e.intersect(i);o&&(null==r&&(r=[]),Array.isArray(o)?r.push(...o):r.push(o))}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 0===e.length||"M"===e[0].type}length(e={}){if(0===this.segments.length)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(0===n)return 0;let r=e.segmentIndex;if(r<0)return 0;let i=ta.clamp(e.value,0,1);r>=n&&(r=n-1,i=1);let o=this.getPrecision(t),s=this.getSubdivisions(t),l=0;for(let e=0;e<r;e+=1){let t=this.segments[e],n=s[e];l+=t.length({precision:o,subdivisions:n})}let a=this.segments[r],u=s[r];return l+a.lengthAtT(i,{precision:o,subdivisions:u})}tangentAt(e,t={}){if(0===this.segments.length)return null;let n=ta.clamp(e,0,1),r=this.getOptions(t),i=this.length(r);return this.tangentAtLength(i*n,r)}tangentAtLength(e,t={}){let n;if(0===this.segments.length)return null;let r=!0;e<0&&(r=!1,e=-e);let i=this.getPrecision(t),o=this.getSubdivisions(t),s=0;for(let t=0,l=this.segments.length;t<l;t+=1){let a=r?t:l-1-t,u=this.segments[a],c=o[a],h=u.length({precision:i,subdivisions:c});if(u.isDifferentiable()){if(e<=s+h)return u.tangentAtLength((r?1:-1)*(e-s),{precision:i,subdivisions:c});n=u}s+=h}if(n){let e=+!!r;return n.tangentAtT(e)}return null}tangentAtT(e){let t=this.segments.length;if(0===t)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=ta.clamp(e.value,0,1);return this.segments[n].tangentAtT(r)}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getSubdivisions(e={}){if(null==e.segmentSubdivisions){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(0===n)return null;let r=this.getSubdivisions(e),i=[],o=[];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=>o.push(e.start)):o.push(n.start)}else o.length>0&&(o.push(t[e-1].end),i.push(o),o=[])}return o.length>0&&(o.push(this.end),i.push(o)),i}toPolylines(e={}){let t=this.toPoints(e);return t?t.map(e=>new cp(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"number"==typeof e?this.segments.forEach(n=>n.translate(e,t)):this.segments.forEach(t=>t.translate(e)),this}clone(){let e=new ck;return this.segments.forEach(t=>e.appendSegment(t.clone())),e}equals(e){if(null==e)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()}}(X=ck||(ck={})).isPath=function(e){return null!=e&&e instanceof X};var cO=ck||(ck={});function cM(e,...t){if("M"===e)return cC.create.call(null,...t);if("L"===e)return cx.create.call(null,...t);if("C"===e)return cE.create.call(null,...t);if("z"===e||"Z"===e)return cw.create();throw Error(`Invalid path segment type "${e}"`)}cO.parse=function(e){if(!e)return new cO;let t=new cO,n=cO.normalize(e).match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g);if(null!=n)for(let e=0,r=n.length;e<r;e+=1){let r=n[e],i=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,o=r.match(i);if(null!=o){let e=o[0],n=cM.call(null,e,...o.slice(1).map(e=>+e));t.appendSegment(n)}}return t},cO.createSegment=cM,(Y=ck||(ck={})).normalize=function(e){return(function(e){let t=function(e){let t=function(e){if(!e)return null;let t=" \n\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},o=[];return e.replace(n,(e,t,n)=>{let s=[],l=t.toLowerCase();n.replace(r,(e,t)=>(t&&s.push(+t),e)),"m"===l&&s.length>2&&(o.push([t,...s.splice(0,2)]),l="l",t="m"===t?"l":"L");let a=i[l];for(;s.length>=a&&(o.push([t,...s.splice(0,a)]),a););return e}),o}(e);if(!t||!t.length)return[["M",0,0]];let n=0,r=0,i=0,o=0,s=[];for(let e=0,l=t.length;e<l;e+=1){let l=[];s.push(l);let a=t[e],u=a[0];if(u!==u.toUpperCase())switch(l[0]=u.toUpperCase(),l[0]){case"A":l[1]=a[1],l[2]=a[2],l[3]=a[3],l[4]=a[4],l[5]=a[5],l[6]=+a[6]+n,l[7]=+a[7]+r;break;case"V":l[1]=+a[1]+r;break;case"H":l[1]=+a[1]+n;break;case"M":i=+a[1]+n,o=+a[2]+r;for(let e=1,t=a.length;e<t;e+=1)l[e]=+a[e]+(e%2?n:r);break;default:for(let e=1,t=a.length;e<t;e+=1)l[e]=+a[e]+(e%2?n:r)}else for(let e=0,t=a.length;e<t;e+=1)l[e]=a[e];switch(l[0]){case"Z":n=+i,r=+o;break;case"H":n=l[1];break;case"V":r=l[1];break;case"M":i=l[l.length-2],o=l[l.length-1],n=l[l.length-2],r=l[l.length-1];break;default:n=l[l.length-2],r=l[l.length-1]}}return s}(e),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r=[],i="",o=t.length;for(let e=0;e<o;e+=1){let l="";t[e]&&(l=t[e][0]),"C"!==l&&(r[e]=l,e>0&&(i=r[e-1])),t[e]=function(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":if(0===parseFloat(e[1])||0===parseFloat(e[2]))return["L",e[6],e[7]];return["C"].concat((function e(t,n,r,i,o,s,l,a,u,c){let h,d,f,g,p,m=120*Math.PI/180,y=Math.PI/180*(+o||0),b=[];if(c)d=c[0],f=c[1],g=c[2],p=c[3];else{t=(h=cS(t,n,-y)).x,n=h.y,a=(h=cS(a,u,-y)).x,u=h.y;let e=(t-a)/2,o=(n-u)/2,c=e*e/(r*r)+o*o/(i*i);c>1&&(r*=c=Math.sqrt(c),i*=c);let m=r*r,b=i*i,v=(s===l?-1:1)*Math.sqrt(Math.abs((m*b-m*o*o-b*e*e)/(m*o*o+b*e*e)));g=v*r*o/i+(t+a)/2,p=-(v*i)*e/r+(n+u)/2,d=Math.asin((n-p)/i),f=Math.asin((u-p)/i),d=t<g?Math.PI-d:d,f=a<g?Math.PI-f:f,d<0&&(d=2*Math.PI+d),f<0&&(f=2*Math.PI+f),l&&d>f&&(d-=2*Math.PI),!l&&f>d&&(f-=2*Math.PI)}let v=f-d;if(Math.abs(v)>m){let t=f,n=a,s=u;b=e(a=g+r*Math.cos(f=d+m*(l&&f>d?1:-1)),u=p+i*Math.sin(f),r,i,o,0,l,n,s,[f,t,g,p])}v=f-d;let x=Math.cos(d),w=Math.cos(f),C=Math.tan(v/4),E=4/3*(r*C),S=4/3*(i*C),P=[t,n],k=[t+E*Math.sin(d),n-S*x],O=[a+E*Math.sin(f),u-S*w],M=[a,u];if(k[0]=2*P[0]-k[0],k[1]=2*P[1]-k[1],c)return[k,O,M].concat(b);{b=[k,O,M].concat(b).join().split(",");let e=[],t=b.length;for(let n=0;n<t;n+=1)e[n]=n%2?cS(+b[n-1],+b[n],y).y:cS(+b[n],+b[n+1],y).x;return e}}).apply(0,[t.x,t.y].concat(e.slice(1))));case"S":return"C"===n||"S"===n?(r=2*t.x-t.bx,i=2*t.y-t.by):(r=t.x,i=t.y),["C",r,i].concat(e.slice(1));case"T":return"Q"===n||"T"===n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),["C"].concat(cP(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(cP(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}(t[e],n,i),"A"!==r[e]&&"C"===l&&(r[e]="C");var s=e;if(t[s].length>7){t[s].shift();let e=t[s];for(;e.length;)r[s]="A",s+=1,t.splice(s,0,["C"].concat(e.splice(0,6)));t.splice(s,1),o=t.length}let a=t[e],u=a.length;n.x=a[u-2],n.y=a[u-1],n.bx=parseFloat(a[u-4])||n.x,n.by=parseFloat(a[u-3])||n.y}return t[0][0]&&"M"===t[0][0]||t.unshift(["M",0,0]),t})(e).map(e=>e.map(e=>"string"==typeof e?e:ta.round(e,2))).join(",").split(",").join(" ")},Y.isValid=function(e){return"string"==typeof e&&cd.test(e)},Y.drawArc=function(e,t,n,r,i=0,o=0,s=0,l,a){let u=[],c=cg(e,t,n,r,i,o,s,l,a);if(null!=c)for(let e=0,t=c.length;e<t;e+=6)u.push("C",c[e],c[e+1],c[e+2],c[e+3],c[e+4],c[e+5]);return u.join(" ")},Y.drawPoints=cf,Y.arcToCurves=cg;class cA{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("object"==typeof e)return void Object.entries(e).forEach(([e,n])=>{this.register(e,n,t)});!this.exist(e)||n||e2.isApplyingHMR()||this.onDuplicated(e);let r=this.options.process,i=r?nx(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&&null!=this.data[e]}onDuplicated(e){try{throw this.options.onConflict&&nx(this.options.onConflict,this,e),Error(`${la(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),r=t?`${t} ${lf(this.options.type)}`:this.options.type;return`${la(r)} with name '${e}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(e){return function(e,t,n){let r,i=Math.min(2,Math.floor(.34*e.length)),o=Math.floor(.4*e.length)+1,s=!1,l=e.toLowerCase();for(let a of t){let t=n(a);if(void 0!==t&&Math.abs(t.length-l.length)<=i){let n=t.toLowerCase();if(n===l){if(t===e)continue;return a}if(s||t.length<3)continue;let i=function(e,t,n){let r=Array(t.length+1),i=Array(t.length+1),o=n+1;for(let e=0;e<=t.length;e+=1)r[e]=e;for(let s=1;s<=e.length;s+=1){let l=e.charCodeAt(s-1),a=s>n?s-n:1,u=t.length>n+s?n+s:t.length;i[0]=s;let c=s;for(let e=1;e<a;e+=1)i[e]=o;for(let e=a;e<=u;e+=1){let n=l===t.charCodeAt(e-1)?r[e-1]:Math.min(r[e]+1,i[e-1]+1,r[e-1]+2);i[e]=n,c=Math.min(c,n)}for(let e=u+1;e<=t.length;e+=1)i[e]=o;if(c>n)return;let h=r;r=i,i=h}let s=r[t.length];return s>n?void 0:s}(l,n,o-1);if(void 0===i)continue;i<3?s=!0:o=i,r=a}}return r}(e,Object.keys(this.data),e=>e)}}(Q=cA||(cA={})).create=function(e){return new Q(e)};let cT={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){let n=t.thickness*t.sx,r=t.thickness*t.sy;aC(e,{width:n,height:r,rx:n,ry:r,fill:t.color})}},cN={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){let n=t.sx<=1?t.thickness*t.sx:t.thickness;aC(e,{width:n,height:n,rx:n,ry:n,fill:t.color})}},cj={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let n,r=t.width,i=t.height,o=t.thickness;aC(e,{d:r-o>=0&&i-o>=0?["M",r,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",stroke:t.color,"stroke-width":t.thickness})}},cL=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let n,r=t.width,i=t.height,o=t.thickness;aC(e,{d:r-o>=0&&i-o>=0?["M",r,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",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,o=t.height*r,s=t.thickness;n=i-s>=0&&o-s>=0?["M",i,0,"H0 M0 0 V0",o].join(" "):"M 0 0 0 0",t.width=i,t.height=o,aC(e,{d:n,stroke:t.color,"stroke-width":t.thickness})}}];class cR{constructor(){this.patterns={},this.root=aX.create(l7(),{width:"100%",height:"100%"},[l8("defs")]).node}add(e,t){let n=this.root.childNodes[0];n&&n.appendChild(t),this.patterns[e]=t,aX.create("rect",{width:"100%",height:"100%",fill:`url(#${e})`}).appendTo(this.root)}get(e){return this.patterns[e]}has(e){return null!=this.patterns[e]}}(Z=cR||(cR={})).presets=tD,Z.registry=cA.create({type:"grid"}),Z.registry.register(Z.presets,!0);let cI=function(e){let t=document.createElement("canvas"),n=e.width,r=e.height;t.width=2*n,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},c_=function(e){let t=document.createElement("canvas"),n=e.width,r=e.height;t.width=n,t.height=2*r;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},cz=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},cD=function(e,t){let n=e.width,r=e.height,i=document.createElement("canvas");i.width=3*n,i.height=3*r;let o=i.getContext("2d"),s=null!=t.angle?-t.angle:-20,l=tl.toRad(s),a=i.width/4,u=i.height/4;for(let t=0;t<4;t+=1)for(let i=0;i<4;i+=1)(t+i)%2>0&&(o.setTransform(1,0,0,1,(2*t-1)*a,(2*i-1)*u),o.rotate(l),o.drawImage(e,-n/2,-r/2,n,r));return i};function cB(e,t){return null!=e?e:t}function cV(e,t){return null!=e&&Number.isFinite(e)?e:t}function cF(e={}){let t=cB(e.color,"blue"),n=cV(e.width,1),r=cV(e.margin,2),i=cV(e.opacity,1);return`
|
|
190
190
|
<filter>
|
|
191
191
|
<feFlood flood-color="${t}" flood-opacity="${i}" result="colored"/>
|
|
192
192
|
<feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${r+n}" />
|
|
@@ -264,11 +264,11 @@
|
|
|
264
264
|
<feFuncB type="linear" slope="${t}" intercept="${n}"/>
|
|
265
265
|
</feComponentTransfer>
|
|
266
266
|
</filter>
|
|
267
|
-
`.trim()}(K=tu||(tu={})).presets=Object.assign({},tB),K.presets["flip-x"]=cI,K.presets["flip-y"]=c_,K.presets["flip-xy"]=cz,K.registry=cA.create({type:"background pattern"}),K.registry.register(K.presets,!0),(ee=tc||(tc={})).presets=tV,ee.registry=cA.create({type:"filter"}),ee.registry.register(ee.presets,!0);let cZ={},cK={position:hd("x","width","origin")},c0={position:hd("y","height","origin")},c1={position:hd("x","width","corner")},c2={position:hd("y","height","corner")},c3={set:hf("width","width")},c5={set:hf("height","height")},c6={set:hf("rx","width")},c4={set:hf("ry","height")},c9={set:(e=>{let t=hf(e,"width"),n=hf(e,"height");return function(e,r){let i=r.refBBox;return nx(i.height>i.width?t:n,this,e,r)}})("r")},c8={set(e,{refBBox:t}){let n,r=parseFloat(e),i=lE(e);i&&(r/=100);let o=Math.sqrt(t.height*t.height+t.width*t.width);return Number.isFinite(r)&&(n=i||r>=0&&r<=1?r*o:Math.max(r+o,0)),{r:n}}},c7={set:hf("cx","width")},he={set:hf("cy","height")},ht={set:hp({resetOffset:!0})},hn={set:hp({resetOffset:!1})},hr={set:hm({resetOffset:!0})},hi={set:hm({resetOffset:!1})},ho=c9,hs=ht,hl=hr,ha=cK,hu=c0,hc=c3,hh=c5;function hd(e,t,n){return(r,{refBBox:i})=>{let o;if(null==r)return null;let s=parseFloat(r),l=lE(r);if(l&&(s/=100),Number.isFinite(s)){let r=i[n];o=l||s>0&&s<1?r[e]+i[t]*s:r[e]+s}let a=new ci;return a[e]=o||0,a}}function hf(e,t){return function(n,{refBBox:r}){let i=parseFloat(n),o=lE(n);o&&(i/=100);let s={};if(Number.isFinite(i)){let n=o||i>=0&&i<=1?i*r[t]:Math.max(i+r[t],0);s[e]=n}return s}}function hg(e,t){let n="x6-shape",r=t&&t.resetOffset;return function(t,{elem:i,refBBox:o}){let s=aW(i,n);if(!s||s.value!==t){let r=e(t);aW(i,n,s={value:t,shape:r,shapeBBox:r.bbox()})}let l=s.shape.clone(),a=s.shapeBBox.clone(),u=a.getOrigin(),c=o.getOrigin();a.x=c.x,a.y=c.y;let h=o.getMaxScaleToFit(a,c),d=0===a.width||0===o.width?1:h.sx,f=0===a.height||0===o.height?1:h.sy;return l.scale(d,f,u),r&&l.translate(-u.x,-u.y),l}}function hp(e){let t=hg(function(e){return ck.parse(e)},e);return(e,n)=>({d:t(e,n).serialize()})}function hm(e){let t=hg(e=>new cp(e),e);return(e,n)=>({points:t(e,n).serialize()})}let hy={qualify:rj,set:(e,{view:t})=>`url(#${t.graph.defineGradient(e)})`},hb={qualify:rj,set(e,{view:t}){let n=t.cell,r=Object.assign({},e);if(n.isEdge()&&"linearGradient"===r.type){let e=t.sourcePoint,i=t.targetPoint;r.id=`gradient-${r.type}-${n.id}`,r.attrs=Object.assign(Object.assign({},r.attrs),{x1:e.x,y1:e.y,x2:i.x,y2:i.y,gradientUnits:"userSpaceOnUse"}),t.graph.defs.remove(r.id)}return`url(#${t.graph.defineGradient(r)})`}},hv={qualify:(e,{attrs:t})=>null==t.textWrap||!rj(t.textWrap),set(e,{view:t,elem:n,attrs:r}){let i="x6-text",o=aW(n,i),s=e=>{try{return JSON.parse(e)}catch(t){return e}},l={x:r.x,eol:r.eol,annotations:s(r.annotations),textPath:s(r["text-path"]||r.textPath),textVerticalAnchor:r["text-vertical-anchor"]||r.textVerticalAnchor,displayEmpty:"true"===(r["display-empty"]||r.displayEmpty),lineHeight:r["line-height"]||r.lineHeight},a=r["font-size"]||r.fontSize,u=JSON.stringify([e,l]);if(a&&n.setAttribute("font-size",a),null==o||o!==u){let r=l.textPath;if(null!=r&&"object"==typeof r){let e=r.selector;if("string"==typeof e){let n=t.find(e)[0];n instanceof SVGPathElement&&(l2(n),l.textPath=Object.assign({"xlink:href":`#${n.id}`},r))}}aK(n,`${e}`,l),aW(n,i,u)}}},hx={qualify:rj,set(e,{view:t,elem:n,attrs:r,refBBox:i}){let o,s=e.width||0;lE(s)?i.width*=parseFloat(s)/100:s<=0?i.width+=s:i.width=s;let l=e.height||0;lE(l)?i.height*=parseFloat(l)/100:l<=0?i.height+=l:i.height=l;let a=e.text;null==a&&(a=r.text||(null==n?void 0:n.textContent)),o=null!=a?a2(`${a}`,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:e.ellipsis}):"",nx(hv.set,this,o,{view:t,elem:n,attrs:r,refBBox:i,cell:t.cell})}},hw=(e,{attrs:t})=>void 0!==t.text,hC={qualify:hw},hE={qualify:hw},hS={qualify:hw},hP={qualify:hw},hk={qualify:hw},hO={qualify:hw},hM={qualify:(e,{elem:t})=>t instanceof SVGElement,set(e,{elem:t}){let n="x6-title",r=`${e}`,i=aW(t,n);if(null==i||i!==r){aW(t,n,r);let e=t.firstChild;if(e&&"TITLE"===e.tagName.toUpperCase())e.textContent=r;else{let n=document.createElementNS(t.namespaceURI,"title");n.textContent=r,t.insertBefore(n,e)}}}},hA={offset:hj("x","width","right")},hT={offset:hj("y","height","bottom")},hN={offset:(e,{refBBox:t})=>e?{x:-t.x,y:-t.y}:{x:0,y:0}};function hj(e,t,n){return(r,{refBBox:i})=>{let o,s=new ci;return o="middle"===r?i[t]/2:r===n?i[t]:"number"==typeof r&&Number.isFinite(r)?r>-1&&r<1?-i[t]*r:-r:lE(r)?i[t]*parseFloat(r)/100:0,s[e]=-(i[e]+o),s}}let hL={qualify:rj,set(e,{elem:t}){aU(t,e)}},hR={set(e,{elem:t}){t.innerHTML=`${e}`}},hI={qualify:rj,set:(e,{view:t})=>`url(#${t.graph.defineFilter(e)})`},h_={set:e=>null!=e&&"object"==typeof e&&e.id?e.id:e};function hz(e,t,n){let r,i;"object"==typeof t?(r=t.x,i=t.y):(r=t,i=n);let o=ck.parse(e),s=o.bbox();if(s){let e=-s.height/2-s.y,t=-s.width/2-s.x;"number"==typeof r&&(t-=r),"number"==typeof i&&(e-=i),o.translate(t,e)}return o.serialize()}var hD=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hB=e=>{var{size:t,width:n,height:r,offset:i,open:o}=e;return hF({size:t,width:n,height:r,offset:i},!0===o,!0,void 0,hD(e,["size","width","height","offset","open"]))},hV=e=>{var{size:t,width:n,height:r,offset:i,factor:o}=e;return hF({size:t,width:n,height:r,offset:i},!1,!1,o,hD(e,["size","width","height","offset","factor"]))};function hF(e,t,n,r=3/4,i={}){let o=e.size||10,s=e.width||o,l=e.height||o,a=new ck,u={};if(t)a.moveTo(s,0).lineTo(0,l/2).lineTo(s,l),u.fill="none";else{if(a.moveTo(0,l/2),a.lineTo(s,0),!n){let e=lx(r,0,1);a.lineTo(s*e,l/2)}a.lineTo(s,l),a.close()}return Object.assign(Object.assign(Object.assign({},u),i),{tagName:"path",d:hz(a.serialize(),{x:null!=e.offset?e.offset:-s/2})})}var h$=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hU=e=>{var{size:t,width:n,height:r,offset:i}=e,o=h$(e,["size","width","height","offset"]);let s=t||10,l=n||s,a=r||s,u=new ck;return u.moveTo(0,a/2).lineTo(l/2,0).lineTo(l,a/2).lineTo(l/2,a).close(),Object.assign(Object.assign({},o),{tagName:"path",d:hz(u.serialize(),null==i?-l/2:i)})};var hG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hH=e=>{var{d:t,offsetX:n,offsetY:r}=e;return Object.assign(Object.assign({},hG(e,["d","offsetX","offsetY"])),{tagName:"path",d:hz(t,n,r)})};var hq=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hW=e=>{var{size:t,width:n,height:r,offset:i}=e,o=hq(e,["size","width","height","offset"]);let s=t||10,l=n||s,a=r||s,u=new ck;return u.moveTo(0,0).lineTo(l,a).moveTo(0,a).lineTo(l,0),Object.assign(Object.assign({},o),{tagName:"path",fill:"none",d:hz(u.serialize(),i||-l/2)})};var hJ=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hX=e=>{var{width:t,height:n,offset:r,open:i,flip:o}=e,s=hJ(e,["width","height","offset","open","flip"]);let l=n||6,a=t||10,u=Object.assign(Object.assign({},s),{tagName:"path"});!0===o&&(l=-l);let c=new ck;return c.moveTo(0,l).lineTo(a,0),!0===i?u.fill="none":(c.lineTo(a,l),c.close()),u.d=hz(c.serialize(),{x:r||-a/2,y:l/2}),u};var hY=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hQ=e=>{var{r:t}=e,n=hY(e,["r"]);let r=t||5;return Object.assign(Object.assign({cx:r},n),{tagName:"circle",r:r})},hZ=e=>{var{r:t}=e,n=hY(e,["r"]);let r=t||5,i=new ck;return i.moveTo(r,0).lineTo(r,2*r),i.moveTo(0,r).lineTo(2*r,r),{children:[Object.assign(Object.assign({},hQ({r:r})),{fill:"none"}),Object.assign(Object.assign({},n),{tagName:"path",d:hz(i.serialize(),-r)})]}};var hK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let h0=e=>{var{rx:t,ry:n}=e,r=hK(e,["rx","ry"]);let i=t||5;return Object.assign(Object.assign({cx:i},r),{tagName:"ellipse",rx:i,ry:n||5})};(et=th||(th={})).presets=tF,et.registry=cA.create({type:"marker"}),et.registry.register(et.presets,!0),(th||(th={})).normalize=hz;var h1=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function h2(e){return"string"==typeof e||rj(e)}let h3={qualify:h2,set:(e,{view:t,attrs:n})=>h4("marker-start",e,t,n)},h5={qualify:h2,set:(e,{view:t,attrs:n})=>h4("marker-end",e,t,n,{transform:"rotate(180)"})},h6={qualify:h2,set:(e,{view:t,attrs:n})=>h4("marker-mid",e,t,n)};function h4(e,t,n,r,i={}){let o="string"==typeof t?{name:t}:t,{name:s,args:l}=o,a=h1(o,["name","args"]),u=a;if(s&&"string"==typeof s){let e=th.registry.get(s);if(!e)return th.registry.onNotFound(s);u=e(Object.assign(Object.assign({},a),l))}let c=Object.assign(Object.assign(Object.assign({},function(e,t){let n={},r=e.stroke;"string"==typeof r&&(n.stroke=r,n.fill=r);let i=e.strokeOpacity;if(null==i&&(i=e["stroke-opacity"]),null==i&&(i=e.opacity),null!=i&&(n["stroke-opacity"]=i,n["fill-opacity"]=i),"marker-mid"!==t){let r=parseFloat(e.strokeWidth||e["stroke-width"]);if(Number.isFinite(r)&&r>1){let e=Math.ceil(r/2);n.refX="marker-start"===t?e:-e}}return n}(r,e)),i),u);return{[e]:`url(#${n.graph.defineMarker(c)})`}}let h9=(e,{view:t})=>t.cell.isEdge(),h8={qualify:h9,set(e,t){var n,r,i,o;let s,l=t.view,a=e.reverse||!1,u=e.stubs||0;if(Number.isFinite(u)&&0!==u)if(a){let e,t,a=l.getConnectionLength()||0;u<0?(e=(a+u)/2,t=-u):(e=u,t=a-2*u);let c=l.getConnection();s=null==(o=null==(i=null==(r=null==(n=null==c?void 0:c.divideAtLength(e))?void 0:n[1])?void 0:r.divideAtLength(t))?void 0:i[0])?void 0:o.serialize()}else{let e;e=u<0?((l.getConnectionLength()||0)+u)/2:u;let t=l.getConnection();if(t){let n=t.divideAtLength(e),r=t.divideAtLength(-e);n&&r&&(s=`${n[0].serialize()} ${r[1].serialize()}`)}}return{d:s||l.getConnectionPathData()}}},h7={qualify:h9,set:ds("getTangentAtLength",{rotate:!0})},de={qualify:h9,set:ds("getTangentAtLength",{rotate:!1})},dt={qualify:h9,set:ds("getTangentAtRatio",{rotate:!0})},dn={qualify:h9,set:ds("getTangentAtRatio",{rotate:!1})},dr=h7,di=dt;function ds(e,t){let n={x:1,y:0};return(r,i)=>{let o,s,l=i.view,a=l[e](Number(r));return(a?(s=t.rotate?a.vector().vectorAngle(n):0,o=a.start):(o=l.path.start,s=0),0===s)?{transform:`translate(${o.x},${o.y}')`}:{transform:`translate(${o.x},${o.y}') rotate(${s})`}}}(td||(td={})).isValidDefinition=function(e,t,n){return!!(null!=e&&("string"==typeof e||"function"!=typeof e.qualify||nx(e.qualify,this,t,n)))||!1},(en=td||(td={})).presets=Object.assign(Object.assign({},{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"}),t$),en.registry=cA.create({type:"attribute definition"}),en.registry.register(en.presets,!0);let dl={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix:e=>`${dl.prefixCls}-${e}`},da=dl.prefix("highlighted"),du={highlight(e,t,n){lQ(t,n&&n.className||da)},unhighlight(e,t,n){lZ(t,n&&n.className||da)}},dc=dl.prefix("highlight-opacity"),dh={highlight(e,t){lQ(t,dc)},unhighlight(e,t){lZ(t,dc)}};!function(e){let t=l8("svg");function n(e,t){let n=ud(e.x,e.y).matrixTransform(t);return new ci(n.x,n.y)}function r(e,n){let r=t.createSVGPoint();r.x=e.x,r.y=e.y;let i=r.matrixTransform(n);r.x=e.x+e.width,r.y=e.y;let o=r.matrixTransform(n);r.x=e.x+e.width,r.y=e.y+e.height;let s=r.matrixTransform(n);r.x=e.x,r.y=e.y+e.height;let l=r.matrixTransform(n),a=Math.min(i.x,o.x,s.x,l.x),u=Math.max(i.x,o.x,s.x,l.x),c=Math.min(i.y,o.y,s.y,l.y),h=Math.max(i.y,o.y,s.y,l.y);return new co(a,c,u-a,h-c)}function i(e,t={}){let n;if(!e.ownerSVGElement||!l3(e)){if(ap(e)){let{left:t,top:n,width:r,height:i}=o(e);return new co(t,n,r,i)}return new co(0,0,0,0)}let s=t.target;if(!t.recursive){try{n=e.getBBox()}catch(t){n={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return s?r(n,uO(e,s)):co.create(n)}{let t=e.childNodes,r=t.length;if(0===r)return i(e,{target:s});s||(s=e);for(let e=0;e<r;e+=1){let r,o=t[e];r=0===o.childNodes.length?i(o,{target:s}):i(o,{target:s,recursive:!0}),n=n?n.union(r):r}return n}}function o(e){let t=0,n=0,r=0,i=0;if(e){let o=e;for(;o;)t+=o.offsetLeft,n+=o.offsetTop,(o=o.offsetParent)&&(t+=parseInt(a_(o,"borderLeft"),10),n+=parseInt(a_(o,"borderTop"),10));r=e.offsetWidth,i=e.offsetHeight}return{left:t,top:n,width:r,height:i}}function s(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 co(t("x"),t("y"),t("width"),t("height"));case"circle":return new cu(t("cx"),t("cy"),t("r"),t("r"));case"ellipse":return new cu(t("cx"),t("cy"),t("rx"),t("ry"));case"polyline":{let t=ue(e);return new cp(t)}case"polygon":{let t=ue(e);return t.length>1&&t.push(t[0]),new cp(t)}case"path":{let t=e.getAttribute("d");return ck.isValid(t)||(t=ck.normalize(t)),ck.parse(t)}case"line":return new ca(t("x1"),t("y1"),t("x2"),t("y2"))}return i(e)}function l(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if(e=e.toUpperCase(),lY(t,"x6-port"))t=t.nextElementSibling;else if("G"===e)t=t.firstElementChild;else if("TITLE"===e)t=t.nextElementSibling;else break}while(t);return t}e.normalizeMarker=hz,e.transformPoint=n,e.transformLine=function(e,t){return new ca(n(e.start,t),n(e.end,t))},e.transformPolyline=function(e,t){let r=e instanceof cp?e.points:e;return Array.isArray(r)||(r=[]),new cp(r.map(e=>n(e,t)))},e.transformRectangle=r,e.bbox=function(e,t,n){let i,o=e.ownerSVGElement;if(!o)return new co(0,0,0,0);try{i=e.getBBox()}catch(t){i={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return t?co.create(i):r(i,uO(e,n||o))},e.getBBox=i,e.getBoundingOffsetRect=o,e.toGeometryShape=s,e.translateAndAutoOrient=function(e,t,n,r){let o=ci.create(t),s=ci.create(n);r||(r=e instanceof SVGSVGElement?e:e.ownerSVGElement);let l=uk(e);e.setAttribute("transform","");let a=i(e,{target:r}).scale(l.sx,l.sy),u=ug();u.setTranslate(-a.x-a.width/2,-a.y-a.height/2);let c=ug(),h=o.angleBetween(s,o.clone().translate(1,0));h&&c.setRotate(h,0,0);let d=ug(),f=o.clone().move(s,a.width/2);d.setTranslate(2*o.x-f.x,2*o.y-f.y);let g=uO(e,r),p=ug();p.setMatrix(d.matrix.multiply(c.matrix.multiply(u.matrix.multiply(g.scale(l.sx,l.sy))))),e.setAttribute("transform",um(p.matrix))},e.findShapeNode=l,e.getBBoxV2=function(e){let t=l(e);if(!l3(t)){if(ap(e)){let{left:t,top:n,width:r,height:i}=o(e);return new co(t,n,r,i)}return new co(0,0,0,0)}return s(t).bbox()||co.create()}}(tf||(tf={}));let dd={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},df={highlight(e,t,n){let r,i,o=tg.getHighlighterId(t,n);if(tg.hasCache(o))return;n=r4({},n,dd);let s=aX.create(t);try{r=s.toPathData()}catch(e){i=tf.bbox(s.node,!0),r=ui(Object.assign(Object.assign({},n),i))}let l=l8("path");if(aC(l,Object.assign({d:r,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},n.attrs?aS(n.attrs):null)),e.isEdgeElement(t))aC(l,"d",e.getConnectionPathData());else{let t=s.getTransformToElement(e.container),r=n.padding;if(r){null==i&&(i=tf.bbox(s.node,!0));let e=i.x+i.width/2,n=i.y+i.height/2,o=Math.max((i=tf.transformRectangle(i,t)).width,1),l=Math.max(i.height,1),a=(o+r)/o,u=(l+r)/l,c=uf({a:a,b:0,c:0,d:u,e:e-a*e,f:n-u*n});t=t.multiply(c)}uE(l,t)}lQ(l,dl.prefix("highlight-stroke"));let a=e.cell,u=()=>tg.removeHighlighter(o);a.on("removed",u),a.model&&a.model.on("reseted",u),e.container.appendChild(l),tg.setCache(o,l)},unhighlight(e,t,n){tg.removeHighlighter(tg.getHighlighterId(t,n))}};var dg=tg||(tg={});dg.getHighlighterId=function(e,t){return l2(e),e.id+JSON.stringify(t)};let dp={};function dm(e,t={}){return new ci(lS(t.x,e.width),lS(t.y,e.height))}function dy(e,t,n){return Object.assign({angle:t,position:e.toJSON()},n)}dg.setCache=function(e,t){dp[e]=t},dg.hasCache=function(e){return null!=dp[e]},dg.removeHighlighter=function(e){let t=dp[e];t&&(al(t),delete dp[e])},(tp||(tp={})).check=function(e,t){if("function"!=typeof t.highlight)throw Error(`Highlighter '${e}' is missing required \`highlight()\` method`);if("function"!=typeof t.unhighlight)throw Error(`Highlighter '${e}' is missing required \`unhighlight()\` method`)},(er=tp||(tp={})).presets=tU,er.registry=cA.create({type:"highlighter"}),er.registry.register(er.presets,!0);let db=(e,t)=>e.map(({x:e,y:n,angle:r})=>dy(dm(t,{x:e,y:n}),r||0)),dv=(e,t,n)=>{let r=n.start||0,i=n.step||20;return dw(e,t,r,(e,t)=>(e+.5-t/2)*i)},dx=(e,t,n)=>{let r=n.start||0,i=n.step||360/e.length;return dw(e,t,r,e=>e*i)};function dw(e,t,n,r){let i=t.getCenter(),o=t.getTopCenter(),s=t.width/t.height,l=cu.fromRect(t),a=e.length;return e.map((e,t)=>{let u=n+r(t,a),c=o.clone().rotate(-u,i).scale(s,1,i),h=e.compensateRotate?-l.tangentTheta(c):0;return(e.dx||e.dy)&&c.translate(e.dx||0,e.dy||0),e.dr&&c.move(i,e.dr),dy(c.round(),h,e)})}var dC=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let dE=(e,t,n)=>dM(e,dm(t,n.start||t.getOrigin()),dm(t,n.end||t.getCorner()),n),dS=(e,t,n)=>dM(e,t.getTopLeft(),t.getBottomLeft(),n),dP=(e,t,n)=>dM(e,t.getTopRight(),t.getBottomRight(),n),dk=(e,t,n)=>dM(e,t.getTopLeft(),t.getTopRight(),n),dO=(e,t,n)=>dM(e,t.getBottomLeft(),t.getBottomRight(),n);function dM(e,t,n,r){let i=new ca(t,n),o=e.length;return e.map((e,t)=>{var{strict:n}=e,s=dC(e,["strict"]);let l=n||r.strict?(t+1)/(o+1):(t+.5)/o,a=i.pointAt(l);return(s.dx||s.dy)&&a.translate(s.dx||0,s.dy||0),dy(a.round(),0,s)})}(ei=tm||(tm={})).presets=tG,ei.registry=cA.create({type:"port layout"}),ei.registry.register(ei.presets,!0);let dA={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function dT(e,t){let{x:n,y:r,angle:i,attrs:o}=t||{};return r4({},{angle:i,attrs:o,position:{x:n,y:r}},e,dA)}let dN=(e,t,n)=>dT({position:t.getTopLeft()},n),dj=(e,t,n)=>dT({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},n),dL=(e,t,n)=>dT({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},n),dR=(e,t,n)=>dT({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},n),dI=(e,t,n)=>dT({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},n),d_=(e,t,n)=>dV(e,t,!1,n),dz=(e,t,n)=>dV(e,t,!0,n),dD=(e,t,n)=>dF(e,t,!1,n),dB=(e,t,n)=>dF(e,t,!0,n);function dV(e,t,n,r){let i,o,s,l,a=null!=r.offset?r.offset:15,u=t.getCenter().theta(e),c=d$(t),h=0;return u<c[1]||u>c[2]?(i=".3em",o=a,s=0,l="start"):u<c[0]?(i="0",o=0,s=-a,n?(h=-90,l="start"):l="middle"):u<c[3]?(i=".3em",o=-a,s=0,l="end"):(i=".6em",o=0,s=a,n?(h=90,l="start"):l="middle"),dT({position:{x:Math.round(o),y:Math.round(s)},angle:h,attrs:{".":{y:i,"text-anchor":l}}},r)}function dF(e,t,n,r){let i,o,s,l,a=null!=r.offset?r.offset:15,u=t.getCenter().theta(e),c=d$(t),h=0;return u<c[1]||u>c[2]?(i=".3em",o=-a,s=0,l="end"):u<c[0]?(i=".6em",o=0,s=a,n?(h=90,l="start"):l="middle"):u<c[3]?(i=".3em",o=a,s=0,l="start"):(i="0em",o=0,s=-a,n?(h=-90,l="start"):l="middle"),dT({position:{x:Math.round(o),y:Math.round(s)},angle:h,attrs:{".":{y:i,"text-anchor":l}}},r)}function d$(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]}let dU=(e,t,n)=>dH(e.diff(t.getCenter()),!1,n),dG=(e,t,n)=>dH(e.diff(t.getCenter()),!0,n);function dH(e,t,n){let r,i=null!=n.offset?n.offset:20,o=new ci(0,0),s=-e.theta(o),l=e.clone().move(o,i).diff(e).round(),a=".3em",u=s;return(s+90)%180==0?(r=t?"end":"middle",t||-270!==s||(a="0em")):s>-270&&s<-90?(r="start",u=s-180):r="end",dT({position:l.round().toJSON(),angle:t?u:0,attrs:{".":{y:a,"text-anchor":r}}},n)}(eo=ty||(ty={})).presets=tH,eo.registry=cA.create({type:"port label layout"}),eo.registry.register(eo.presets,!0);class dq extends oQ{get priority(){return 2}constructor(){super(),this.cid=tb.uniqueId(),dq.views[this.cid]=this}confirmUpdate(e,t){return 0}empty(e=this.container){return aa(e),this}unmount(e=this.container){return al(e),this}remove(e=this.container){return e===this.container&&(this.removeEventListeners(document),this.onRemove(),delete dq.views[this.cid]),this.unmount(e),this}onRemove(){}setClass(e,t=this.container){t.classList.value=Array.isArray(e)?e.join(" "):e}addClass(e,t=this.container){return lQ(t,Array.isArray(e)?e.join(" "):e),this}removeClass(e,t=this.container){return lZ(t,Array.isArray(e)?e.join(" "):e),this}setStyle(e,t=this.container){return aU(t,e),this}setAttrs(e,t=this.container){return null!=e&&null!=t&&aC(t,e),this}findAttr(e,t=this.container){let n=t;for(;n&&1===n.nodeType;){let t=n.getAttribute(e);if(null!=t)return t;if(n===this.container)break;n=n.parentNode}return null}find(e,t=this.container,n=this.selectors){return dq.find(e,t,n).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((null!=t||n===this.container)&&"false"!==t)return n;n=n.parentNode}return null}getSelector(e,t){let n;if(e===this.container)return"string"==typeof t&&(n=`> ${t}`),n;if(e){let r=an(e)+1;n=`${e.tagName.toLowerCase()}:nth-child(${r})`,t&&(n+=` > ${t}`),n=this.getSelector(e.parentNode,n)}return n}prefixClassName(e){return dl.prefix(e)}delegateEvents(e,t){if(null==e)return this;t||this.undelegateEvents();let n=/^(\S+)\s*(.*)$/;return Object.keys(e).forEach(t=>{let r=t.match(n);if(null==r)return;let i=this.getEventHandler(e[t]);"function"==typeof i&&this.delegateEvent(r[1],r[2],i)}),this}undelegateEvents(){return te.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 te.on(this.container,e+this.getEventNamespace(),t,n),this}undelegateEvent(e,t,n){let r=e+this.getEventNamespace();return null==t?te.off(this.container,r):"string"==typeof t?te.off(this.container,r,t,n):te.off(this.container,r,t),this}addEventListeners(e,t,n){if(null==t)return this;let r=this.getEventNamespace();return Object.keys(t).forEach(i=>{let o=this.getEventHandler(t[i]);"function"==typeof o&&te.on(e,i+r,n,o)}),this}removeEventListeners(e){return null!=e&&te.off(e,this.getEventNamespace()),this}getEventNamespace(){return`.${dl.prefixCls}-event-${this.cid}`}getEventHandler(e){let t;if("string"==typeof e){let n=this[e];"function"==typeof n&&(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:o=0}=e;return t.fromPoint||"touchmove"===r||"touchend"===r?document.elementFromPoint(i,o):n}stopPropagation(e){return this.setEventData(e,{propagationStopped:!0}),this}isPropagationStopped(e){return!0===this.getEventData(e).propagationStopped}getEventData(e){return this.eventData(e)}setEventData(e,t){return this.eventData(e,t)}eventData(e,t){if(null==e)throw TypeError("Event object required");let n=e.data,r=`__${this.cid}__`;return null==t?null==n?{}:n[r]||{}:(null==n&&(n=e.data={}),null==n[r]?n[r]=Object.assign({},t):n[r]=Object.assign(Object.assign({},n[r]),t),n[r])}normalizeEvent(e){return dq.normalizeEvent(e)}}(es=dq||(dq={})).createElement=function(e,t){return t?l8(e||"g"):l9(e||"div")},es.find=function(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(dl.useCSSSelector){let n=e.includes(">")?`:scope ${e}`:e;return{isCSSSelector:!0,elems:Array.prototype.slice.call(t.querySelectorAll(n))}}return{elems:[]}},es.normalizeEvent=function(e){let t=e,n=e.originalEvent,r=n&&n.changedTouches&&n.changedTouches[0];if(r){for(let t in e)void 0===r[t]&&(r[t]=e[t]);t=r}return t},(el=dq||(dq={})).views={},el.getView=function(e){return el.views[e]||null},ea=tb||(tb={}),l=0,ea.uniqueId=function(){let e=`v${l}`;return l+=1,e};class dW{constructor(e){this.view=e,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new u5,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={}),t.data}getMatrix(e){let t=this.get(e);return null==t.matrix&&(t.matrix=uM(e,this.view.container)),uf(t.matrix)}getShape(e){let t=this.get(e);return null==t.shape&&(t.shape=tf.toGeometryShape(e)),t.shape.clone()}getBoundingRect(e){let t=this.get(e);return null==t.boundingRect&&(t.boundingRect=tf.getBBoxV2(e)),t.boundingRect.clone()}}!function(e){function t(e){return null!=e&&"string"==typeof e}function n(e,t={ns:l5.svg}){let r=document.createDocumentFragment(),i={},o={},s=[{markup:Array.isArray(e)?e:[e],parent:r,ns:t.ns}];for(;s.length>0;){let e=s.pop(),t=e.ns||l5.svg,n=e.markup,r=e.parent;n.forEach(e=>{let n=e.tagName;if(!n)throw TypeError("Invalid tagName");e.ns&&(t=e.ns);let l=t?l9(n,t):l4(n),a=e.attrs;a&&aC(l,aS(a));let u=e.style;u&&aU(l,u);let c=e.className;null!=c&&l.setAttribute("class",Array.isArray(c)?c.join(" "):c),e.textContent&&(l.textContent=e.textContent);let h=e.selector;if(null!=h){if(o[h])throw TypeError("Selector must be unique");o[h]=l}if(e.groupSelector){let t=e.groupSelector;Array.isArray(t)||(t=[t]),t.forEach(e=>{i[e]||(i[e]=[]),i[e].push(l)})}r.appendChild(l);let d=e.children;Array.isArray(d)&&s.push({ns:t,markup:d,parent:l})})}return Object.keys(i).forEach(e=>{if(o[e])throw Error("Ambiguous group selector");o[e]=i[e]}),{fragment:r,selectors:o,groups:i}}function r(e){return e instanceof SVGElement?l8("g"):l4("div")}e.isJSONMarkup=function(e){return null!=e&&!t(e)},e.isStringMarkup=t,e.clone=function(e){return null==e||t(e)?e:of(e)},e.sanitize=function(e){return`${e}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")},e.parseJSONMarkup=n,e.renderMarkup=function(e){if(t(e)){let t=aX.createVectors(e),n=t.length;if(1===n)return{elem:t[0].node};if(n>1){let e=r(t[0].node);return t.forEach(t=>{e.appendChild(t.node)}),{elem:e}}return{}}let i=n(e),o=i.fragment,s=null;return o.childNodes.length>1?(s=r(o.firstChild)).appendChild(o):s=o.firstChild,{elem:s,selectors:i.selectors}},e.parseLabelStringMarkup=function(e){let t=aX.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:{}}}}(tv||(tv={})),(tv||(tv={})).getSelector=function e(t,n,r){if(null!=t){let i,o=t.tagName.toLowerCase();if(t===n)return"string"==typeof r?`> ${o} > ${r}`:`> ${o}`;let s=t.parentNode;if(s&&s.childNodes.length>1){let e=an(t)+1;i=`${o}:nth-child(${e})`}else i=o;return r&&(i+=` > ${r}`),e(t.parentNode,n,i)}return r},(eu=tv||(tv={})).getPortContainerMarkup=function(){return"g"},eu.getPortMarkup=function(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}},eu.getPortLabelMarkup=function(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}},(tv||(tv={})).getEdgeMarkup=function(){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"}}]},(tv||(tv={})).getForeignObjectMarkup=function(e=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:l5.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:l5.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:e?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}};class dJ{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,o,s=[];return Object.keys(t).forEach(r=>{let i=t[r],o=this.getDefinition(r),l=nx(td.isValidDefinition,this.view,o,i,{elem:e,attrs:t,cell:this.cell,view:this.view});o&&l?"string"==typeof o?(null==n&&(n={}),n[o]=i):null!==i&&s.push({name:r,definition:o}):(null==n&&(n={}),n[ay.includes(r)?r:lp(r)]=i)}),s.forEach(({name:e,definition:n})=>{let s=t[e];"function"==typeof n.set&&(null==r&&(r={}),r[e]=s),"function"==typeof n.offset&&(null==i&&(i={}),i[e]=s),"function"==typeof n.position&&(null==o&&(o={}),o[e]=s)}),{raw:t,normal:n,set:r,offset:i,position:o}}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;null!=n&&t.normal&&(t.normal.transform=n),e.normal=t.normal}findAttrs(e,t,n,r){let i=[],o=new u5;return Object.keys(e).forEach(s=>{let l=e[s];if(!rj(l))return;let{isCSSSelector:a,elems:u}=dq.find(s,t,r);n[s]=u;for(let e=0,t=u.length;e<t;e+=1){let n=u[e],c=r&&r[s]===n,h=o.get(n);if(h){h.array||(i.push(n),h.array=!0,h.attrs=[h.attrs],h.priority=[h.priority]);let e=h.attrs,r=h.priority;if(c)e.unshift(l),r.unshift(-1);else{let n=o2(r,a?-1:t);e.splice(n,0,l),r.splice(n,0,t)}}else o.set(n,{elem:n,attrs:l,priority:c?-1:t,array:!1})}}),i.forEach(e=>{let t=o.get(e),n=t.attrs;t.attrs=n.reduceRight((e,t)=>r9(e,t),{})}),o}updateRelativeAttrs(e,t,n){let r=t.raw||{},i=t.normal||{},o=t.set,s=t.position,l=t.offset,a=()=>({elem:e,cell:this.cell,view:this.view,attrs:r,refBBox:n.clone()});if(null!=o&&Object.keys(o).forEach(e=>{let t=o[e],n=this.getDefinition(e);if(null!=n){let r=nx(n.set,this.view,t,a());"object"==typeof r?i=Object.assign(Object.assign({},i),r):null!=r&&(i[e]=r)}}),e instanceof HTMLElement)return void this.view.setAttrs(i,e);let u=i.transform,c=up(u?`${u}`:null),h=new ci(c.e,c.f);u&&(delete i.transform,c.e=0,c.f=0);let d=!1;null!=s&&Object.keys(s).forEach(e=>{let t=s[e],n=this.getDefinition(e);if(null!=n){let e=nx(n.position,this.view,t,a());null!=e&&(d=!0,h.translate(ci.create(e)))}}),this.view.setAttrs(i,e);let f=!1;if(null!=l){let t=this.view.getBoundingRectOfElement(e);if(t.width>0&&t.height>0){let n=tf.transformRectangle(t,c);Object.keys(l).forEach(t=>{let i=l[t],o=this.getDefinition(t);if(null!=o){let t=nx(o.offset,this.view,i,{elem:e,cell:this.cell,view:this.view,attrs:r,refBBox:n});null!=t&&(f=!0,h.translate(ci.create(t)))}})}}(null!=u||d||f)&&(h.round(1),c.e=h.x,c.f=h.y,e.setAttribute("transform",um(c)))}update(e,t,n){let r,i={},o=this.findAttrs(n.attrs||t,e,i,n.selectors),s=n.attrs?this.findAttrs(t,e,i,n.selectors):o,l=[];o.each(t=>{let r=t.elem,o=t.attrs,a=this.processAttrs(r,o);if(null==a.set&&null==a.position&&null==a.offset)this.view.setAttrs(a.normal,r);else{let t,u=s.get(r),c=u?u.attrs:null,h=c&&null==o.ref?c.ref:o.ref;if(h){if(!(t=(i[h]||this.view.find(h,e,n.selectors))[0]))throw Error(`"${h}" reference does not exist.`)}else t=null;let d={node:r,refNode:t,attributes:c,processedAttributes:a},f=l.findIndex(e=>e.refNode===r);f>-1?l.splice(f,0,d):l.push(d)}});let a=new u5;l.forEach(t=>{let i,o,s=t.node,l=t.refNode,u=null!=l&&null!=n.rotatableNode&&as(n.rotatableNode,l);if(l&&(i=a.get(l)),!i){let t=u?n.rotatableNode:e;i=l?tf.getBBox(l,{target:t}):n.rootBBox,l&&a.set(l,i)}n.attrs&&t.attributes?(o=this.processAttrs(s,t.attributes),this.mergeProcessedAttrs(o,t.processedAttributes)):o=t.processedAttributes;let c=i;u&&null!=n.rotatableNode&&!n.rotatableNode.contains(s)&&(r||(r=up(aC(n.rotatableNode,"transform"))),c=tf.transformRectangle(i,r)),this.updateRelativeAttrs(s,o,c)})}}class dX{get cell(){return this.view.cell}constructor(e,t,n=[]){this.view=e;let r={},i={},o=0;Object.keys(t).forEach(e=>{let n=t[e];Array.isArray(n)||(n=[n]),n.forEach(t=>{let n=r[t];n||(o+=1,n=r[t]=1<<o),i[e]|=n})});let s=n;if(Array.isArray(s)||(s=[s]),s.forEach(e=>{r[e]||(o+=1,r[e]=1<<o)}),o>25)throw Error("Maximum number of flags exceeded.");this.flags=r,this.attrs=i,this.bootstrap=n}getFlag(e){let t=this.flags;return null==t?0:Array.isArray(e)?e.reduce((e,n)=>e|t[n],0):0|t[e]}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}}var dY=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class dQ extends dq{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){let t=(e,t)=>null!=t?sk([...Array.isArray(e)?e:[e],...Array.isArray(t)?t:[t]]):Array.isArray(e)?[...e]:[e],n=of(this.getDefaults()),{bootstrap:r,actions:i,events:o,documentEvents:s}=e,l=dY(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))}),o&&(n.events=Object.assign(Object.assign({},n.events),o)),e.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),s)),r9(n,l)}get[Symbol.toStringTag](){return dQ.toStringTag}constructor(e,t={}){super(),this.cell=e,this.options=this.ensureOptions(t),this.graph=this.options.graph,this.attr=new dJ(this),this.flag=new dX(this,this.options.actions,this.options.bootstrap),this.cache=new dW(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 dq.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(e){if(this.container!==e){this.undelegateEvents(),this.container=e,null!=this.options.events&&this.delegateEvents(this.options.events);let t=this.getContainerAttrs();null!=t&&this.setAttrs(t,e);let n=this.getContainerStyle();null!=n&&this.setStyle(n,e);let r=this.getContainerClassName();null!=r&&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&&("string"==typeof r?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),null!=this.graph&&this.graph.renderer.requestViewUpdate(this,t,e))}parseJSONMarkup(e,t){let n=tv.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("function"==typeof t&&(t=nx(t,this.graph,this)),"object"==typeof t){let n=t[e];return"function"==typeof n&&(n=nx(n,this.graph,this)),!1!==n}return"boolean"==typeof t&&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 tf.transformRectangle(t,i.multiply(r).multiply(n))}getUnrotatedBBoxOfElement(e){let t=this.getBoundingRectOfElement(e),n=this.getMatrixOfElement(e),r=this.getRootTranslatedMatrix();return tf.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 uf().translate(t.x,t.y)}getRootRotatedMatrix(){let e=uf(),t=this.cell,n=t.isNode()?t.getAngle():0;if(n){let r=t.getBBox(),i=r.width/2,o=r.height/2;e=e.translate(i,o).rotate(n).translate(-i,-o)}return e}findMagnet(e=this.container){return this.findByAttr("magnet",e)}updateAttrs(e,t,n={}){null==n.rootBBox&&(n.rootBBox=new co),null==n.selectors&&(n.selectors=this.selectors),this.attr.update(e,t,n)}isEdgeElement(e){return this.cell.isEdge()&&(null==e||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 o=this.cell,s=this.findAttr("port",e),l=e.getAttribute("data-selector"),a={cell:o.id};return null!=l&&(a.magnet=l),null!=s?(a.port=s,o.isNode()&&!o.hasPort(s)&&null==l&&(a.selector=this.getSelector(e))):null==l&&this.container!==e&&(a.selector=this.getSelector(e)),a}getMagnetFromEdgeTerminal(e){let t,n=this.cell,r=this.container,i=e.port,o=e.magnet;return null!=i&&n.isNode()&&n.hasPort(i)?t=this.findPortElem(i,o)||r:(o||(o=e.selector),o||null==i||(o=`[port="${i}"]`),t=this.findOne(o,r,this.selectors)),t}hasTools(e){let t=this.tools;return null!=t&&(null==e||t.name===e)}addTools(e){if(this.removeTools(),e){if(!this.can("toolsAddable"))return this;let t=dZ.isToolsView(e)?e:new dZ(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(),this.tools=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.cell;return null==t||null==n?{e,view:this,cell:r}:{e,x:t,y:n,view:this,cell:r}}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}),this.cachedModelForMouseEvent=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)}}dQ.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([dQ.dispose()],dQ.prototype,"dispose",null),(ec=dQ||(dQ={})).Flag=dX,ec.Attr=dJ,(eh=dQ||(dQ={})).toStringTag=`X6.${eh.name}`,eh.isCellView=function(e){if(null==e)return!1;if(e instanceof eh)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eh.toStringTag)&&"function"==typeof e.isNodeView&&"function"==typeof e.isEdgeView&&"function"==typeof e.confirmUpdate},(ed=dQ||(dQ={})).priority=function(e){return function(t){t.config({priority:e})}},ed.bootstrap=function(e){return function(t){t.config({bootstrap:e})}},(dQ||(dQ={})).registry=cA.create({type:"view"});class dZ extends dq{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return dZ.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?dq.createElement("g",!0):dq.createElement("div",!1);return lQ(n,this.prefixClassName("cell-tools")),t.className&&lQ(n,t.className),n}config(e){if(this.options=Object.assign(Object.assign({},this.options),e),!dQ.isCellView(e.view)||e.view===this.cellView)return this;this.cellView=e.view,this.cell.isEdge()?(lQ(this.svgContainer,this.prefixClassName("edge-tools")),lQ(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(lQ(this.svgContainer,this.prefixClassName("node-tools")),lQ(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 t=this.options.items;if(!Array.isArray(t))return this;this.tools=[];let n=[];t.forEach(e=>{dZ.ToolItem.isToolItem(e)?"vertices"===e.name?n.unshift(e):n.push(e):"vertices"===("object"==typeof e?e.name:e)?n.unshift(e):n.push(e)});for(let e=0;e<n.length;e+=1){let t,r=n[e];if(dZ.ToolItem.isToolItem(r))t=r;else{let e="object"==typeof r?r.name:r,n="object"==typeof r&&r.args||{};if(e){if(this.cell.isNode()){let r=tw.registry.get(e);if(!r)return tw.registry.onNotFound(e);t=new r(n)}else if(this.cell.isEdge()){let r=tC.registry.get(e);if(!r)return tC.registry.onNotFound(e);t=new r(n)}}}t&&(t.config(this.cellView,this),t.render(),(!1!==t.options.isSVGElement?this.svgContainer:this.htmlContainer).appendChild(t.container),this.tools.push(t))}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),al(this.svgContainer),al(this.htmlContainer),super.remove()}mount(){let e=this.tools,t=this.cellView;if(t&&e){let n=e.some(e=>!1!==e.options.isSVGElement),r=e.some(e=>!1===e.options.isSVGElement);n&&(this.options.local?t.container:t.graph.view.decorator).appendChild(this.svgContainer),r&&this.graph.container.appendChild(this.htmlContainer)}return this}}(ef=dZ||(dZ={})).toStringTag=`X6.${ef.name}`,ef.isToolsView=function(e){if(null==e)return!1;if(e instanceof ef)return!0;let t=e[Symbol.toStringTag];return(null==t||t===ef.toStringTag)&&null!=e.graph&&null!=e.cell&&"function"==typeof e.config&&"function"==typeof e.update&&"function"==typeof e.focus&&"function"==typeof e.blur&&"function"==typeof e.show&&"function"==typeof e.hide||!1},function(e){var t,n;let r;class i extends dq{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){return r9(of(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 i.toStringTag}constructor(e={}){super(),this.visible=!0,this.options=this.getOptions(e),this.container=dq.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),lQ(this.container,this.prefixClassName("cell-tool")),"string"==typeof this.options.className&&lQ(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()?lQ(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&lQ(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=tv.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 null!=e&&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 null==this.graph||null==this.cellView||this.graph.view.guard(e,this.cellView)}}i.defaults={isSVGElement:!0,tagName:"g"},e.ToolItem=i,t=i=e.ToolItem||(e.ToolItem={}),r=0,t.define=function(e){var t;let n=o$((t=e.name)?lm(t):(r+=1,`CustomTool${r}`),this);return n.config(e),n},(n=i=e.ToolItem||(e.ToolItem={})).toStringTag=`X6.${n.name}`,n.isToolItem=function(e){if(null==e)return!1;if(e instanceof n)return!0;let t=e[Symbol.toStringTag];return(null==t||t===n.toStringTag)&&null!=e.graph&&null!=e.cell&&"function"==typeof e.config&&"function"==typeof e.update&&"function"==typeof e.focus&&"function"==typeof e.blur&&"function"==typeof e.show&&"function"==typeof e.hide&&"function"==typeof e.isVisible||!1}}(dZ||(dZ={}));let dK=e=>e;function d0(e,t){return 0===t?"0%":`${Math.round(e/t*100)}%`}function d1(e){return(t,n,r,i)=>n.isEdgeElement(r)?function(e,t,n,r,i){let o=n.getConnection();if(!o)return t;let s=o.closestPointLength(i);return e?t.anchor={name:"ratio",args:{ratio:s/o.length()}}:t.anchor={name:"length",args:{length:s}},t}(e,t,n,0,i):function(e,t,n,r,i){let o=n.cell,s=o.getAngle(),l=n.getUnrotatedBBoxOfElement(r),a=o.getBBox().getCenter(),u=ci.create(i).rotate(s,a),c=u.x-l.x,h=u.y-l.y;return e&&(c=d0(c,l.width),h=d0(h,l.height)),t.anchor={name:"topLeft",args:{dx:c,dy:h,rotate:!0}},t}(e,t,n,r,i)}let d2=d1(!0),d3=d1(!1);function d5(e,t,n,r){return nx(tx.presets.pinRelative,this.graph,{},t,n,e,this.cell,r,{}).anchor}function d6(e,t){return t?e.cell.getBBox():e.cell.isEdge()?e.getConnection().bbox():e.getUnrotatedBBoxOfElement(e.container)}(eg=tx||(tx={})).presets=tq,eg.registry=cA.create({type:"connection strategy"}),eg.registry.register(eg.presets,!0);class d4 extends dZ.ToolItem{onRender(){lQ(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();uE(this.container,e,{absolute:!0})}getNodeMatrix(){let e=this.cellView,t=this.options,{x:n=0,y:r=0}=t,{offset:i,useCellGeometry:o,rotate:s}=t,l=d6(e,o),a=e.cell.getAngle();s||(l=l.bbox(a));let u=0,c=0;"number"==typeof i?(u=i,c=i):"object"==typeof i&&(u=i.x,c=i.y),n=lS(n,l.width),r=lS(r,l.height);let h=uf().translate(l.x+l.width/2,l.y+l.height/2);return s&&(h=h.rotate(a)),h=h.translate(n+u-l.width/2,r+c-l.height/2)}getEdgeMatrix(){let e,t,n,r=this.cellView,{offset:i=0,distance:o=0,rotate:s}=this.options,l=lS(o,1);(e=l>=0&&l<=1?r.getTangentAtRatio(l):r.getTangentAtLength(l))?(t=e.start,n=e.vector().vectorAngle(new ci(1,0))||0):(t=r.getConnection().start,n=0);let a=uf().translate(t.x,t.y).rotate(n);return a="object"==typeof i?a.translate(i.x||0,i.y||0):a.translate(0,i),s||(a=a.rotate(-n)),a}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();let t=this.options.onClick;"function"==typeof t&&nx(t,this.cellView,{e,view:this.cellView,cell:this.cellView.cell,btn:this})}}(d4||(d4={})).config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}}),(ep=d4||(d4={})).Remove=ep.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})}});var d9=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class d8 extends dZ.ToolItem{onRender(){if(lQ(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){let e=this.options.attrs,{class:t}=e,n=d9(e,["class"]);aC(this.container,aS(n)),t&&lQ(this.container,t)}this.update()}update(){let e=this.cellView,t=this.options,{useCellGeometry:n,rotate:r}=t,i=lk(t.padding),o=d6(e,n).moveAndExpand({x:-i.left,y:-i.top,width:i.left+i.right,height:i.top+i.bottom}),s=e.cell;if(s.isNode()){let e=s.getAngle();if(e)if(r){let t=s.getBBox().getCenter();uP(this.container,e,t.x,t.y,{absolute:!0})}else o=o.bbox(e)}return aC(this.container,o.toJSON()),this}}(d8||(d8={})).config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}});class d7 extends dZ.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,o=r({index:t,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});i&&i(o),o.updatePosition(n.x,n.y),this.stamp(o.container),this.container.appendChild(o.container),this.handles.push(o),this.startHandleListening(o)}}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:ci.create(r),next:ci.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:o,y:s}=this.getMouseEventArgs(t),l={x:o,y:s};this.snapVertex(l,r),n.cell.setVertexAt(r,l,{ui:!0,toolId:this.cid}),e.updatePosition(l.x,l.y),this.options.stopPropagation||n.notifyMouseMove(i,o,s)}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)return void this.stopBatch(this.eventData(e).vertexAdded);n.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(e).vertexAdded);let{e:r,x:i,y:o}=this.getMouseEventArgs(e);if(!this.options.stopPropagation){n.notifyMouseUp(r,i,o);let{start:e}=this.eventData(r);if(e){let{x:t,y:s}=e;t===i&&s===o&&n.onClick(r,i,o)}}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,o=r.next;Math.abs(e.x-i.x)<n?e.x=i.x:Math.abs(e.x-o.x)<n&&(e.x=o.x),Math.abs(e.y-i.y)<n?e.y=r.prev.y:Math.abs(e.y-o.y)<n&&(e.y=o.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||ti.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 o=this.handles[i];this.eventData(n,{vertexAdded:!0}),o.onMouseDown(n)}onRemove(){this.resetHandles()}}(em=d7||(d7={})).Handle=class extends dq{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=dq.createElement("circle",!0);let e=this.options.attrs;if("function"==typeof e){let t=em.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);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:e,handle:this}))}onMouseMove(e){this.emit("changing",{e:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(e){this.emit("remove",{e:e,handle:this})}};var fe=d7||(d7={});let ft=dl.prefix("edge-tool-vertex-path");fe.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:e=>new fe.Handle(e),markup:[{tagName:"path",selector:"connection",className:ft,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${ft}`]:"onPathMouseDown",[`touchstart .${ft}`]:"onPathMouseDown"}});class fn extends dZ.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){lQ(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,o=this.cellView.cell.getVertices(),s=o[i-2]||n.sourceAnchor,l=o[i+1]||n.targetAnchor,a=this.options.snapRadius;return Math.abs(t[r]-s[r])<a?t[r]=s[r]:Math.abs(t[r]-l[r])<a&&(t[r]=l[r]),t}onHandleChanging({handle:e,e:t}){let n=this.graph,r=this.options,i=this.cellView,o=r.anchor,s=e.options.axis,l=e.options.index-1,a=this.getEventData(t),u=this.normalizeEvent(t),c=n.snapToGrid(u.clientX,u.clientY),h=this.snapHandle(e,c.clone(),a),d=of(this.vertices),f=d[l],g=d[l+1],p=i.sourceView,m=i.sourceBBox,y=!1,b=!1;if(f?0===l?m.containsPoint(f)?(d.shift(),this.shiftHandleIndexes(-1),y=!0):(f[s]=h[s],b=!0):f[s]=h[s]:((f=i.sourceAnchor.toJSON())[s]=h[s],m.containsPoint(f)?y=!0:(d.unshift(f),this.shiftHandleIndexes(1),b=!0)),"function"==typeof o&&p){if(y){let e=a.sourceAnchor.clone();e[s]=h[s];let t=nx(o,i,e,p,i.sourceMagnet||p.container,"source",i,this);this.resetAnchor("source",t)}b&&this.resetAnchor("source",a.sourceAnchorDef)}let v=i.targetView,x=i.targetBBox,w=!1,C=!1;if(g?l===d.length-2?x.containsPoint(g)?(d.pop(),w=!0):(g[s]=h[s],C=!0):g[s]=h[s]:((g=i.targetAnchor.toJSON())[s]=h[s],x.containsPoint(g)?w=!0:(d.push(g),C=!0)),"function"==typeof o&&v){if(w){let e=a.targetAnchor.clone();e[s]=h[s];let t=nx(o,i,e,v,i.targetMagnet||v.container,"target",i,this);this.resetAnchor("target",t)}C&&this.resetAnchor("target",a.targetAnchorDef)}ci.equalPoints(d,this.vertices)||this.cellView.cell.setVertices(d,{ui:!0,toolId:this.cid}),this.updateHandle(e,f,g,0),r.stopPropagation||i.notifyMouseMove(u,c.x,c.y)}onHandleChange({handle:e,e:t}){let n=this.options,r=this.handles,i=this.cellView,o=e.options.index;if(Array.isArray(r)){for(let e=0,t=r.length;e<t;e+=1)e!==o&&r[e].hide();if(this.focus(),this.setEventData(t,{sourceAnchor:i.sourceAnchor.clone(),targetAnchor:i.targetAnchor.clone(),sourceAnchorDef:of(this.cell.prop(["source","anchor"])),targetAnchorDef:of(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,o=Math.abs(t.x-n.x)<i,s=Math.abs(t.y-n.y)<i;if(o||s){let i=new ca(t,n);if(i.length()<this.options.threshold)e.hide();else{let t=i.getCenter(),n=o?"x":"y";t[n]+=r||0;let s=i.vector().vectorAngle(new ci(1,0));e.updatePosition(t.x,t.y,s,this.cellView),e.show(),e.options.axis=n}}else e.hide()}onRemove(){this.resetHandles()}}(ey=fn||(fn={})).Handle=class extends dq{constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=dq.createElement("rect",!0);let e=this.options.attrs;if("function"==typeof e){let t=ey.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(e,t,n,r){let i=r.getClosestPoint(new ci(e,t))||new ci(e,t),o=uf().translate(i.x,i.y);if(i.equals({x:e,y:t}))o=o.rotate(n);else{let n=new ca(e,t,i.x,i.y).vector().vectorAngle(new ci(1,0));0!==n&&(n+=90),o=o.rotate(n)}this.setAttrs({transform:um(o),cursor:n%180==0?"row-resize":"col-resize"})}onMouseDown(e){this.options.guard(e)||(this.trigger("change",{e: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:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}},(eb=fn||(fn={})).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:e=>new eb.Handle(e),anchor:d5});class fr extends dZ.ToolItem{get type(){return this.options.type}onRender(){lQ(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,o=r.getTerminalAnchor(n),s=r.cell.prop([n,"anchor"]);t.setAttribute("transform",`translate(${o.x}, ${o.y})`);let l=s?i.customAnchorAttrs:i.defaultAnchorAttrs;l&&Object.keys(l).forEach(e=>{t.setAttribute(e,l[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,o,s,l=i.cell,a=r.getTerminalMagnet(n),u=this.options.areaPadding||0;Number.isFinite(u)||(u=0),i.isEdgeElement(a)?(e=i.getBBox(),o=0,s=e.getCenter()):(e=i.getUnrotatedBBoxOfElement(a),o=l.getAngle(),s=e.getCenter(),o&&s.rotate(-o,l.getBBox().getCenter())),e.inflate(u),aC(t,{x:-e.width/2,y:-e.height/2,width:e.width,height:e.height,transform:`translate(${s.x}, ${s.y}) rotate(${o})`})}}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,n=this.type,r=this.cellView,i=r.getTerminalView(n);if(null==i)return;let o=this.normalizeEvent(e),s=i.cell,l=r.getTerminalMagnet(n),a=this.graph.coord.clientToLocalPoint(o.clientX,o.clientY),u=this.options.snap;if("function"==typeof u){let e=nx(u,r,a,i,l,n,r,this);a=ci.create(e)}if(this.options.restrictArea)if(i.isEdgeElement(l)){let e=i.getClosestPoint(a);e&&(a=e)}else{let e=i.getUnrotatedBBoxOfElement(l),t=s.getAngle(),n=s.getBBox().getCenter(),r=a.clone().rotate(t,n);e.containsPoint(r)||(a=e.getNearestPointToPoint(r).rotate(-t,n))}let c=this.options.anchor;"function"==typeof c&&(t=nx(c,r,a,i,l,n,r,this)),this.resetAnchor(t),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(!0===e?void 0:e),this.update()}}(fr||(fr={})).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:d5,snap(e,t,n,r,i,o){let s=o.options.snapRadius||0,l="source"===r,a=this.cell.getVertexAt(l?0:-1)||this.getTerminalAnchor(l?"target":"source");return a&&(Math.abs(a.x-e.x)<s&&(e.x=a.x),Math.abs(a.y-e.y)<s&&(e.y=a.y)),e}});let fi=fr.define({name:"source-anchor",type:"source"}),fo=fr.define({name:"target-anchor",type:"target"});var fs=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class fl extends dZ.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=fs(e,["class"]);this.setAttrs(n,this.container),t&&lQ(this.container,t)}}onRender(){lQ(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 ci(1,0))||0;if(!r)return this;let o=uf().translate(r.x,r.y).rotate(i);return uE(this.container,o,{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})}}(fl||(fl={})).config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}});let fa=fl.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"}}),fu=fl.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"}});class fc extends dZ.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=dZ.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),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=ci.create(),i=20,o="",{x:s,y:l}=this.options,{width:a,height:u}=this.options;if(void 0!==s&&void 0!==l){let e=t.getBBox();s=lS(s,e.width),l=lS(l,e.height),r=e.topLeft.translate(s,l),i=e.width-2*s}else{let e=t.getBBox();r=e.center,i=e.width-4,o="translate(-50%, -50%)"}let c=e.scale(),{style:h}=n;r=e.localToGraph(r),h.left=`${r.x}px`,h.top=`${r.y}px`,h.transform=`scale(${c.sx}, ${c.sy}) ${o}`,h.minWidth=`${i}px`,"number"==typeof a&&(h.width=`${a}px`),"number"==typeof u&&(h.height=`${u}px`)}updateEdgeEditorTransform(){if(!this.event)return;let{graph:e,editor:t}=this;if(!t)return;let n=ci.create(),r=20,{style:i}=t,o=this.event.target,s=o.parentElement;if(s&&lY(s,this.prefixClassName("edge-label"))){let e=s.getAttribute("data-index")||"0";this.labelIndex=parseInt(e,10);let{translation:t}=uy(s.getAttribute("transform"));n=new ci(t.tx,t.ty),r=tf.getBBox(o).width}else{if(!this.options.labelAddable)return this;n=e.clientToLocal(ci.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 l=e.scale();i.left=`${n.x}px`,i.top=`${n.y}px`,i.minWidth=`${r}px`,i.transform=`scale(${l.sx}, ${l.sy}) translate(-50%, -50%)`}onDocumentMouseUp(e){if(this.editor&&e.target!==this.editor){let e=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(""!==e?e:null),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("function"==typeof e)return nx(e,this.cellView,{cell:this.cell,index:this.labelIndex});if("string"==typeof e){if(this.cell.isNode())return this.cell.attr(e);if(this.cell.isEdge()&&-1!==this.labelIndex)return this.cell.prop(`labels/${this.labelIndex}/attrs/${e}`)}}setCellText(e){let t=this.options.setText;if("function"==typeof t)return void nx(t,this.cellView,{cell:this.cell,value:e,index:this.labelIndex,distance:this.distance});if("string"==typeof t){if(this.cell.isNode()){null!==e&&this.cell.attr(t,e);return}if(this.cell.isEdge()){let n=this.cell;if(-1===this.labelIndex){if(e){let r={position:{distance:this.distance},attrs:{}};oX(r,`attrs/${t}`,e),n.appendLabel(r)}}else null!==e?n.prop(`labels/${this.labelIndex}/attrs/${t}`,e):"number"==typeof this.labelIndex&&n.removeLabelAt(this.labelIndex)}}}onRemove(){let e=this.cellView;e&&e.off("cell:dblclick",this.dblClick),this.removeElement()}}(fc||(fc={})).config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}}),(ev=fc||(fc={})).NodeEditor=ev.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),ev.EdgeEditor=ev.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"});var fh=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};(ex=tw||(tw={})).presets={boundary:d8,button:d4,"button-remove":d4.Remove,"node-editor":fc.NodeEditor},ex.registry=cA.create({type:"node tool",process(e,t){if("function"==typeof t)return t;let n=dZ.ToolItem,{inherit:r}=t,i=fh(t,["inherit"]);if(r){let e=this.get(r);null==e?this.onNotFound(r,"inherited"):n=e}return null==i.name&&(i.name=e),n.define.call(n,i)}}),ex.registry.register(ex.presets,!0),(ew=tC||(tC={})).presets={boundary:d8,vertices:d7,segments:fn,button:d4,"button-remove":d4.Remove,"source-anchor":fi,"target-anchor":fo,"source-arrowhead":fa,"target-arrowhead":fu,"edge-editor":fc.EdgeEditor},ew.registry=cA.create({type:"edge tool",process(e,t){if("function"==typeof t)return t;let n=dZ.ToolItem,{inherit:r}=t,i=fh(t,["inherit"]);if(r){let e=this.get(r);null==e?this.onNotFound(r,"inherited"):n=e}return null==i.name&&(i.name=e),n.define.call(n,i)}}),ew.registry.register(ew.presets,!0);let fd=fw("center"),ff=fw("topCenter"),fg=fw("bottomCenter"),fp=fw("leftMiddle"),fm=fw("rightMiddle"),fy=fw("topLeft"),fb=fw("topRight"),fv=fw("bottomLeft"),fx=fw("bottomRight");function fw(e){return function(t,n,r,i={}){let o=i.rotate?t.getUnrotatedBBoxOfElement(n):t.getBBoxOfElement(n),s=o[e];s.x+=lS(i.dx,o.width),s.y+=lS(i.dy,o.height);let l=t.cell;return i.rotate?s.rotate(-l.getAngle(),l.getBBox().getCenter()):s}}function fC(e){return function(t,n,r,i){if(r instanceof Element){let o,s=this.graph.findViewByElem(r);return o=s?s.isEdgeElement(r)?fE(s,null!=i.fixedAt?i.fixedAt:"50%"):s.getBBoxOfElement(r).getCenter():new ci,e.call(this,t,n,o,i)}return e.apply(this,arguments)}}function fE(e,t){let n=lE(t),r="string"==typeof t?parseFloat(t):t;return n?e.getPointAtRatio(r/100):e.getPointAtLength(r)}let fS=fC(function(e,t,n,r){let i=e.cell.getAngle(),o=e.getBBoxOfElement(t),s=o.getCenter(),l=o.getTopLeft(),a=o.getBottomRight(),u=r.padding;if(Number.isFinite(u)||(u=0),l.y+u<=n.y&&n.y<=a.y-u){let e=n.y-s.y;s.x+=0===i||180===i?0:+e/Math.tan(tl.toRad(i)),s.y+=e}else if(l.x+u<=n.x&&n.x<=a.x-u){let e=n.x-s.x;s.y+=90===i||270===i?0:e*Math.tan(tl.toRad(i)),s.x+=e}return s}),fP=function(e,t,n,r,i){let o=e.cell.getConnectionPoint(this.cell,i);return(r.dx||r.dy)&&o.translate(r.dx||0,r.dy||0),o},fk=fC(function(e,t,n,r){let i,o,s,l=0,a=e.cell;r.rotate?(i=e.getUnrotatedBBoxOfElement(t),o=a.getBBox().getCenter(),l=a.getAngle()):i=e.getBBoxOfElement(t);let u=r.padding;null!=u&&Number.isFinite(u)&&i.inflate(u),r.rotate&&n.rotate(l,o);let c=i.getNearestSideToPoint(n);switch(c){case"left":s=i.getLeftMiddle();break;case"right":s=i.getRightMiddle();break;case"top":s=i.getTopCenter();break;case"bottom":s=i.getBottomCenter()}let h=r.direction;return"H"===h?("top"===c||"bottom"===c)&&(s=n.x<=i.x+i.width?i.getLeftMiddle():i.getRightMiddle()):"V"===h&&(s=n.y<=i.y+i.height?i.getTopCenter():i.getBottomCenter()),r.rotate?s.rotate(-l,o):s});(eC=tE||(tE={})).presets=tW,eC.registry=cA.create({type:"node endpoint"}),eC.registry.register(eC.presets,!0);let fO=function(e,t,n,r){let i=null!=r.ratio?r.ratio:.5;return i>1&&(i/=100),e.getPointAtRatio(i)},fM=function(e,t,n,r){let i=null!=r.length?r.length:20;return e.getPointAtLength(i)},fA=function(e,t,n,r){let i=e.getClosestPoint(n);return null!=i?i:new ci},fT=fC(fA),fN=fC(function(e,t,n,r){let i=e.getConnection(),o=e.getConnectionSubdivisions(),s=new ca(n.clone().translate(0,1e6),n.clone().translate(0,-1e6)),l=new ca(n.clone().translate(1e6,0),n.clone().translate(-1e6,0)),a=s.intersect(i,{segmentSubdivisions:o}),u=l.intersect(i,{segmentSubdivisions:o}),c=[];return(a&&c.push(...a),u&&c.push(...u),c.length>0)?n.closest(c):null!=r.fallbackAt?fE(e,r.fallbackAt):nx(fA,this,e,t,n,r)});function fj(e,t,n){let r;if("object"==typeof n){if(Number.isFinite(n.y)){let{start:r,end:i}=new ca(t,e).parallel(n.y);t=r,e=i}r=n.x}else r=n;if(null==r||!Number.isFinite(r))return e;let i=e.distance(t);return 0===r&&i>0?e:e.move(t,-Math.min(r,i-1))}function fL(e){let t=e.getAttribute("stroke-width");return null===t?0:parseFloat(t)||0}(eE=tS||(tS={})).presets=tJ,eE.registry=cA.create({type:"edge endpoint"}),eE.registry.register(eE.presets,!0);let fR=function(e,t,n,r){let i=t.getBBoxOfElement(n);r.stroked&&i.inflate(fL(n)/2);let o=e.intersect(i);return fj(o&&o.length?e.start.closest(o):e.end,e.start,r.offset)},fI=function(e,t,n,r,i){let o=t.cell,s=o.isNode()?o.getAngle():0;if(0===s)return nx(fR,this,e,t,n,r,i);let l=t.getUnrotatedBBoxOfElement(n);r.stroked&&l.inflate(fL(n)/2);let a=l.getCenter(),u=e.clone().rotate(s,a),c=u.setLength(1e6).intersect(l);return fj(c&&c.length?u.start.closest(c).rotate(-s,a):e.end,e.start,r.offset)},f_=function(e,t,n,r){let i,o,s,l=e.end,a=r.selector;if(!l3(i="string"==typeof a?t.findOne(a):Array.isArray(a)?oJ(n,a):function(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if("G"===(e=e.toUpperCase()))t=t.firstElementChild;else if("TITLE"===e)t=t.nextElementSibling;else break}while(t);return t}(n))){if(i===n||!l3(n))return l;i=n}let u=t.getShapeOfElement(i),c=t.getMatrixOfElement(i),h=t.getRootTranslatedMatrix(),d=t.getRootRotatedMatrix(),f=h.multiply(d).multiply(c),g=f.inverse(),p=tf.transformLine(e,g),m=p.start.clone(),y=t.getDataOfElement(i);if(!1===r.insideout){null==y.shapeBBox&&(y.shapeBBox=u.bbox());let e=y.shapeBBox;if(null!=e&&e.containsPoint(m))return l}if(!0===r.extrapolate&&p.setLength(1e6),ck.isPath(u)){let e=r.precision||2;null==y.segmentSubdivisions&&(y.segmentSubdivisions=u.getSegmentSubdivisions({precision:e})),s={precision:e,segmentSubdivisions:y.segmentSubdivisions},o=p.intersect(u,s)}else o=p.intersect(u);o?Array.isArray(o)&&(o=m.closest(o)):!0===r.sticky&&(o=co.isRectangle(u)?u.getNearestPointToPoint(m):cu.isEllipse(u)?u.intersectsWithLineFromCenterToPoint(m):u.closestPoint(m,s));let b=o?tf.transformPoint(o,f):l,v=r.offset||0;return!1!==r.stroked&&("object"==typeof v?(null==(v=Object.assign({},v)).x&&(v.x=0),v.x+=fL(i)/2):v+=fL(i)/2),fj(b,e.start,v)},fz=function(e,t,n,r){let{alignOffset:i,align:o}=r;return o&&function(e,t,n=0){let r,i,o,s,{start:l,end:a}=e;switch(t){case"left":s="x",r=a,i=l,o=-1;break;case"right":s="x",r=l,i=a,o=1;break;case"top":s="y",r=a,i=l,o=-1;break;case"bottom":s="y",r=l,i=a,o=1;break;default:return}l[s]<a[s]?r[s]=i[s]:i[s]=r[s],Number.isFinite(n)&&(r[s]+=o*n,i[s]+=o*n)}(e,o,i),fj(e.end,e.start,r.offset)};(eS=tP||(tP={})).presets=tX,eS.registry=cA.create({type:"connection point"}),eS.registry.register(eS.presets,!0);let fD=function(e){return[...e]},fB=function(e,t,n){let r,i,o,s=t.side||"bottom",l=lk(t.padding||40),a=n.sourceBBox,u=n.targetBBox,c=a.getCenter(),h=u.getCenter();switch(s){case"top":o=-1,r="y",i="height";break;case"left":o=-1,r="x",i="width";break;case"right":o=1,r="x",i="width";break;default:o=1,r="y",i="height"}return c[r]+=o*(a[i]/2+l[s]),h[r]+=o*(u[i]/2+l[s]),o*(c[r]-h[r])>0?h[r]=c[r]:c[r]=h[r],[c.toJSON(),...e,h.toJSON()]};function fV(e){return new co(e.x,e.y,0,0)}function fF(e={}){let t=lk(e.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function f$(e,t={}){return e.sourceBBox.clone().moveAndExpand(fF(t))}function fU(e,t={}){return e.targetBBox.clone().moveAndExpand(fF(t))}let fG=function(e,t,n){let r=f$(n,t),i=fU(n,t),o=function(e,t={}){return e.sourceAnchor?e.sourceAnchor:f$(e,t).getCenter()}(n,t),s=function(e,t={}){return e.targetAnchor?e.targetAnchor:fU(e,t).getCenter()}(n,t);r=r.union(fV(o)),i=i.union(fV(s));let l=e.map(e=>ci.create(e));l.unshift(o),l.push(s);let a=null,u=[];for(let e=0,n=l.length-1;e<n;e+=1){let o=null,s=l[e],c=l[e+1],h=null!=tk.getBearing(s,c);if(0===e)e+1===n?r.intersectsWithRect(i.clone().inflate(1))?o=tk.insideNode(s,c,r,i):h||(o=tk.nodeToNode(s,c,r,i)):r.containsPoint(c)?o=tk.insideNode(s,c,r,fV(c).moveAndExpand(fF(t))):h||(o=tk.nodeToVertex(s,c,r));else if(e+1===n){let e=h&&tk.getBearing(c,s)===a;i.containsPoint(s)||e?o=tk.insideNode(s,c,fV(s).moveAndExpand(fF(t)),i,a):h||(o=tk.vertexToNode(s,c,i,a))}else h||(o=tk.vertexToVertex(s,c,a));o?(u.push(...o.points),a=o.direction):a=tk.getBearing(s,c),e+1<n&&u.push(c)}return u};!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 ci(e.x,t.y);return n.containsPoint(r)&&(r=new ci(t.x,e.y)),r}function i(e,t){return e["W"===t||"E"===t?"width":"height"]}function o(e,t){return e.x===t.x?e.y>t.y?"N":"S":e.y===t.y?e.x>t.x?"W":"E":null}function s(e,n,r){let i=new ci(e.x,n.y),s=new ci(n.x,e.y),l=o(e,i),a=o(e,s),u=r?t[r]:null,c=l===r||l!==u&&(a===u||a!==r)?i:s;return{points:[c],direction:o(c,n)}}function l(e,t,n){let i=r(e,t,n);return{points:[i],direction:o(i,t)}}e.getBBoxSize=i,e.getBearing=o,e.vertexToVertex=s,e.nodeToVertex=l,e.vertexToNode=function(e,t,n,s){let l,a=[new ci(e.x,t.y),new ci(t.x,e.y)],u=a.filter(e=>!n.containsPoint(e)),c=u.filter(t=>o(t,e)!==s);if(c.length>0)return{points:[l=(l=c.filter(t=>o(e,t)===s).pop())||c[0]],direction:o(l,t)};{l=sv(a,u)[0];let c=ci.create(t).move(l,-i(n,s)/2);return{points:[r(c,e,n),c],direction:o(c,t)}}},e.nodeToNode=function(e,t,n,r){let a=l(t,e,r),u=a.points[0];if(n.containsPoint(u)){let c=(a=l(e,t,n)).points[0];if(r.containsPoint(c)){let h=ci.create(e).move(c,-i(n,o(e,c))/2),d=ci.create(t).move(u,-i(r,o(t,u))/2),f=new ca(h,d).getCenter(),g=l(e,f,n),p=s(f,t,g.direction);a.points=[g.points[0],p.points[0]],a.direction=p.direction}}return a},e.insideNode=function(e,t,i,s,l){let a,u,c,h,d=i.union(s).inflate(1),f=d.getCenter(),g=f.distance(t)>f.distance(e),p=g?t:e,m=g?e:t;return l?(a=ci.fromPolar(d.width+d.height,n[l],p),a=d.getNearestPointToPoint(a).move(a,-1)):a=d.getNearestPointToPoint(p).move(p,1),u=r(a,m,d),a.round().equals(u.round())?(u=ci.fromPolar(d.width+d.height,tl.toRad(a.theta(p))+Math.PI/2,m),c=r(a,u=d.getNearestPointToPoint(u).move(m,1).round(),d),h=g?[u,c,a]:[a,c,u]):h=g?[u,a]:[a,u],{points:h,direction:g?o(a,t):o(u,t)}}}(tk||(tk={}));let fH={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 fq(this.step,this)},directions(){let e=fq(this.step,this),t=fq(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=fq(this.step,this);return{0:0,45:e/2,90:e/2}},paddingBox(){let e=fq(this.step,this);return{x:-e,y:-e,width:2*e,height:2*e}},fallbackRouter:fG,draggingRouter:null,snapToGrid:!0};function fq(e,t){return"function"==typeof e?e.call(t):e}class fW{constructor(){this.items=[],this.hash={},this.values={}}add(e,t){this.hash[e]?this.items.splice(this.items.indexOf(e),1):this.hash[e]=1,this.values[e]=t;let n=su(this.items,e,e=>this.values[e]);this.items.splice(n,0,e)}pop(){let e=this.items.shift();return e&&(this.hash[e]=2),e}isOpen(e){return 1===this.hash[e]}isClose(e){return 2===this.hash[e]}isEmpty(){return 0===this.items.length}}class fJ{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=[],o=e.getCell(t.getSourceCellId());o&&(i=sy(i,o.getAncestors().map(e=>e.id)));let s=e.getCell(t.getTargetCellId());s&&(i=sy(i,s.getAncestors().map(e=>e.id)));let l=this.mapGridSize;return e.getNodes().reduce((e,t)=>{let o=r.some(e=>e.id===t.id),s=!!t.shape&&n.excludeShapes.includes(t.shape),a=n.excludeNodes.some(e=>"string"==typeof e?t.id===e:e===t),u=i.includes(t.id);if(t.isVisible()&&!(s||o||a||u)){let r=t.getBBox().moveAndExpand(n.paddingBox),i=r.getOrigin().snapToGrid(l),o=r.getCorner().snapToGrid(l);for(let t=i.x;t<=o.x;t+=l)for(let n=i.y;n<=o.y;n+=l){let i=new ci(t,n).toString();null==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 fX(e,t){let n=e.sourceBBox.clone();return t&&t.paddingBox?n.moveAndExpand(t.paddingBox):n}function fY(e,t){let n=e.targetBBox.clone();return t&&t.paddingBox?n.moveAndExpand(t.paddingBox):n}function fQ(e,t){return e.sourceAnchor?e.sourceAnchor:fX(e,t).getCenter()}function fZ(e,t,n,r,i){let o=360/n,s=e.theta(function(e,t,n,r){let i=r.step,o=t.x-e.x,s=t.y-e.y,l=o/n.x,a=s/n.y;return new ci(e.x+l*i,e.y+a*i)}(e,t,r,i)),l=tl.normalize(s+o/2);return o*Math.floor(l/o)}function fK(e,t){let n=Math.abs(e-t);return n>180?360-n:n}function f0(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 f1(e,t){return e.round(t)}function f2(e,t,n){return f1(function(e,t){let n=t.source,r=ta.snapToGrid(e.x-n.x,t.x)+n.x,i=ta.snapToGrid(e.y-n.y,t.y)+n.y;return new ci(r,i)}(e.clone(),t),n)}function f3(e){return e.toString()}function f5(e){return new ci(0===e.x?0:Math.abs(e.x)/e.x,0===e.y?0:Math.abs(e.y)/e.y)}function f6(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 f4(e,t,n,r,i){let o=i.precision,s=i.directionMap,l=e.diff(t.getCenter()),a=Object.keys(s).reduce((i,a)=>{if(n.includes(a)){let n,u=s[a],c=new ci(e.x+u.x*(Math.abs(l.x)+t.width),e.y+u.y*(Math.abs(l.y)+t.height)),h=new ca(e,c).intersect(t)||[],d=null;for(let t=0;t<h.length;t+=1){let r=h[t],i=e.squaredDistance(r);(null==n||i>n)&&(n=i,d=r)}if(d){let e=f2(d,r,o);t.containsPoint(e)&&(e=f2(e.translate(u.x*r.x,u.y*r.y),r,o)),i.push(e)}}return i},[]);return t.containsPoint(e)||a.push(f2(e,r,o)),a}let f9=function(e,t,n){let r,i,o=function(e){let t=Object.keys(e).reduce((t,n)=>("fallbackRouter"===n||"draggingRouter"===n||"fallbackRoute"===n?t[n]=e[n]:t[n]=fq(e[n],e),t),{});if(t.padding){let e=lk(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 ci(0,0),n=new ci(e.offsetX,e.offsetY);e.angle=tl.normalize(t.theta(n))}),t}(t),s=fX(n,o),l=fY(n,o),a=fQ(n,o),u=new fJ(o).build(n.graph.model,n.cell),c=e.map(e=>ci.create(e)),h=[],d=a;for(let t=0,f=c.length;t<=f;t+=1){let f=null;if(r=i||s,null==(i=c[t])){i=l;let e=n.cell;if((null==e.getSourceCellId()||null==e.getTargetCellId())&&"function"==typeof o.draggingRouter){let e=r===s?a:r,t=i.getOrigin();f=nx(o.draggingRouter,n,e,t,o)}}if(null==f&&(f=function(e,t,n,r,i){var o,s;let l,a,u,c,h=i.precision;l=co.isRectangle(t)?f1(fQ(e,i).clone(),h):f1(t.clone(),h),a=co.isRectangle(n)?f1((e.targetAnchor?e.targetAnchor:fY(e,i).getCenter()).clone(),h):f1(n.clone(),h);let d=(o=i.step,s=a,{source:l.clone(),x:f0(s.x-l.x,o),y:f0(s.y-l.y,o)}),f=a;if(u=co.isRectangle(t)?f4(l,t,i.startDirections,d,i):[l],c=co.isRectangle(n)?f4(a,n,i.endDirections,d,i):[f],u=u.filter(e=>r.isAccessible(e)),c=c.filter(e=>r.isAccessible(e)),u.length>0&&c.length>0){let e,t,n=new fW,o={},s={},a={};for(let e=0,t=u.length;e<t;e+=1){let t=u[e],r=f3(t);n.add(r,f6(t,c)),o[r]=t,a[r]=0}let g=i.previousDirectionAngle,p=void 0===g,m=function(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}(d,i),y=m.length,b=c.reduce((e,t)=>{let n=f3(t);return e.push(n),e},[]),v=ci.equalPoints(u,c),x=i.maxLoopCount;for(;!n.isEmpty()&&x>0;){let u,w=n.pop(),C=o[w],E=s[w],S=a[w],P=C.equals(l),k=null==E;if(u=k?p?P?null:fZ(l,C,y,d,i):g:fZ(E,C,y,d,i),!(k&&v)&&b.indexOf(w)>=0)return i.previousDirectionAngle=u,function(e,t,n,r,i){let o,s=[],l=f5(i.diff(n)),a=f3(n),u=e[a];for(;u;){let n=f5((o=t[a]).diff(u));n.equals(l)||(s.unshift(o),l=n),u=e[a=f3(u)]}let c=t[a];return f5(c.diff(r)).equals(l)||s.unshift(c),s}(s,o,C,l,f);for(let l=0;l<y;l+=1){let g=(e=m[l]).angle;if(t=fK(u,g),!(p&&P)&&t>i.maxDirectionChange)continue;let v=f2(C.clone().translate(e.gridOffsetX||0,e.gridOffsetY||0),d,h),x=f3(v);if(n.isClose(x)||!r.isAccessible(v)||b.indexOf(x)>=0&&!v.equals(f)&&fK(g,fZ(v,f,y,d,i))>i.maxDirectionChange)continue;let w=S+e.cost+(P?0:i.penalties[t]);(!n.isOpen(x)||w<a[x])&&(o[x]=v,s[x]=C,a[x]=w,n.add(x,w+f6(v,c)))}x-=1}}return i.fallbackRoute?nx(i.fallbackRoute,this,l,f,i):null}(n,r,i,u,o)),null===f)return console.warn("Unable to execute manhattan algorithm, use orth instead"),nx(o.fallbackRouter,this,e,o,n);let g=f[0];g&&g.equals(d)&&f.shift(),d=f[f.length-1]||d,h.push(...f)}return o.snapToGrid?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}(h,n.graph.grid.getGridSize()):h},f8=function(e,t,n){return nx(f9,this,e,Object.assign(Object.assign({},fH),t),n)},f7={maxDirectionChange:45,directions(){let e=fq(this.step,this),t=fq(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=[],o={x:t.x,y:e.y},s={x:e.x,y:t.y};if(r%180>90){let e=o;o=s,s=e}let l=r%90<45?o:s,a=new ca(e,l),u=90*Math.ceil(r/90),c=ci.fromPolar(a.squaredLength(),tl.toRad(u+135),l),h=new ca(t,c),d=a.intersectsWithLine(h),f=d||t,g=d?f:e,p=360/n.directions.length,m=g.theta(t),y=tl.normalize(m+p/2);return n.previousDirectionAngle=p*Math.floor(y/p),f&&i.push(f.round()),i.push(t),i}},ge=function(e,t,n){return nx(f8,this,e,Object.assign(Object.assign({},f7),t),n)},gt=function(e,t,n){let r,i,o,s=t.offset||32,l=null==t.min?16:t.min,a=0,u=t.direction,c=n.sourceBBox,h=n.targetBBox,d=c.getCenter(),f=h.getCenter();if("number"==typeof s&&(a=s),null==u){let e=h.left-c.right,t=h.top-c.bottom;e>=0&&t>=0?u=e>=t?"L":"T":e<=0&&t>=0?u=(e=c.left-h.right)>=0&&e>=t?"R":"T":e>=0&&t<=0?u=(t=c.top-h.bottom)>=0?e>=t?"L":"B":"L":(e=c.left-h.right,t=c.top-h.bottom,u=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")}"H"===u?u=f.x-d.x>=0?"L":"R":"V"===u&&(u=f.y-d.y>=0?"T":"B"),"center"===s&&("L"===u?a=(h.left-c.right)/2:"R"===u?a=(c.left-h.right)/2:"T"===u?a=(h.top-c.bottom)/2:"B"===u&&(a=(c.top-h.bottom)/2));let g="L"===u||"R"===u;if(g){if(f.y===d.y)return[...e];o="L"===u?1:-1,r="x",i="width"}else{if(f.x===d.x)return[...e];o="T"===u?1:-1,r="y",i="height"}let p=d.clone(),m=f.clone();if(p[r]+=o*(c[i]/2+a),m[r]-=o*(h[i]/2+a),g){let e=p.x,t=m.x,n=c.width/2+l,r=h.width/2+l;f.x>d.x?t<=e&&(p.x=Math.max(t,d.x+n),m.x=Math.min(e,f.x-r)):t>=e&&(p.x=Math.min(t,d.x-n),m.x=Math.max(e,f.x+r))}else{let e=p.y,t=m.y,n=c.height/2+l,r=h.height/2+l;f.y>d.y?t<=e&&(p.y=Math.max(t,d.y+n),m.y=Math.min(e,f.y-r)):t>=e&&(p.y=Math.min(t,d.y-n),m.y=Math.max(e,f.y+r))}return[p.toJSON(),...e,m.toJSON()]};function gn(e,t){if(null!=t&&!1!==t){let n="boolean"==typeof t?0:t;if(n>0){let t=ci.create(e[1]).move(e[2],n),r=ci.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}let gr=function(e,t,n){let r=t.width||50,i=(t.height||80)/2,o=t.angle||"auto",s=n.sourceAnchor,l=n.targetAnchor,a=n.sourceBBox,u=n.targetBBox;if(s.equals(l)){let e=e=>{let t=tl.toRad(e),n=Math.sin(t),o=Math.cos(t),l=new ci(s.x+o*r,s.y+n*r),a=new ci(l.x-o*i,l.y-n*i),u=a.clone().rotate(-90,l),c=a.clone().rotate(90,l);return[u.toJSON(),l.toJSON(),c.toJSON()]},n=e=>{let t=s.clone().move(e,-1),n=new ca(t,e);return!a.containsPoint(e)&&!a.intersectsWithLine(n)},l=[0,90,180,270,45,135,225,315];if("number"==typeof o)return gn(e(o),t.merge);let u=a.getCenter();if(u.equals(s))return gn(e(0),t.merge);let c=u.angleBetween(s,u.clone().translate(1,0)),h=e(c);if(n(h[1]))return gn(h,t.merge);for(let t=1,r=l.length;t<r&&!n((h=e(c+l[t]))[1]);t+=1);return gn(h,t.merge)}{let e=new ca(s,l),o=e.parallel(-r),c=o.getCenter(),h=o.start.clone().move(o.end,i),d=o.end.clone().move(o.start,i),f=e.parallel(-1),g=new ca(f.start,c),p=new ca(f.end,c);if((a.containsPoint(c)||u.containsPoint(c)||a.intersectsWithLine(g)||a.intersectsWithLine(p)||u.intersectsWithLine(g)||u.intersectsWithLine(p))&&(c=(o=e.parallel(r)).getCenter(),h=o.start.clone().move(o.end,i),d=o.end.clone().move(o.start,i)),t.merge){let e=new ca(s,l),t=new ca(c,e.center).setLength(Number.MAX_SAFE_INTEGER),r=a.intersectsWithLine(t),i=u.intersectsWithLine(t),o=r?Array.isArray(r)?r:[r]:[];i&&(Array.isArray(i)?o.push(...i):o.push(i));let h=e.center.closest(o);h?(n.sourceAnchor=h.clone(),n.targetAnchor=h.clone()):(n.sourceAnchor=e.center.clone(),n.targetAnchor=e.center.clone())}return gn([h.toJSON(),c.toJSON(),d.toJSON()],t.merge)}};(eP=tO||(tO={})).presets=tY,eP.registry=cA.create({type:"router"}),eP.registry.register(eP.presets,!0);let gi=function(e,t,n,r={}){let i=[e,...n,t],o=new cp(i),s=new ck(o);return r.raw?s:s.serialize()},go=function(e,t,n,r={}){let i=+(3!==n.length),o=ci.create(n[0+i]),s=ci.create(n[2+i]),l=ci.create(n[1+i]);if(!ci.equals(e,t)){let n=new ci((e.x+t.x)/2,(e.y+t.y)/2),r=n.angleBetween(ci.create(e).rotate(90,n),l);r>1&&(o.rotate(180-r,n),s.rotate(180-r,n),l.rotate(180-r,n))}let a=`
|
|
267
|
+
`.trim()}(K=tu||(tu={})).presets=Object.assign({},tB),K.presets["flip-x"]=cI,K.presets["flip-y"]=c_,K.presets["flip-xy"]=cz,K.registry=cA.create({type:"background pattern"}),K.registry.register(K.presets,!0),(ee=tc||(tc={})).presets=tV,ee.registry=cA.create({type:"filter"}),ee.registry.register(ee.presets,!0);let cZ={},cK={position:hd("x","width","origin")},c0={position:hd("y","height","origin")},c1={position:hd("x","width","corner")},c2={position:hd("y","height","corner")},c3={set:hf("width","width")},c5={set:hf("height","height")},c6={set:hf("rx","width")},c4={set:hf("ry","height")},c9={set:(e=>{let t=hf(e,"width"),n=hf(e,"height");return function(e,r){let i=r.refBBox;return nx(i.height>i.width?t:n,this,e,r)}})("r")},c8={set(e,{refBBox:t}){let n,r=parseFloat(e),i=lE(e);i&&(r/=100);let o=Math.sqrt(t.height*t.height+t.width*t.width);return Number.isFinite(r)&&(n=i||r>=0&&r<=1?r*o:Math.max(r+o,0)),{r:n}}},c7={set:hf("cx","width")},he={set:hf("cy","height")},ht={set:hp({resetOffset:!0})},hn={set:hp({resetOffset:!1})},hr={set:hm({resetOffset:!0})},hi={set:hm({resetOffset:!1})},ho=c9,hs=ht,hl=hr,ha=cK,hu=c0,hc=c3,hh=c5;function hd(e,t,n){return(r,{refBBox:i})=>{let o;if(null==r)return null;let s=parseFloat(r),l=lE(r);if(l&&(s/=100),Number.isFinite(s)){let r=i[n];o=l||s>0&&s<1?r[e]+i[t]*s:r[e]+s}let a=new ci;return a[e]=o||0,a}}function hf(e,t){return function(n,{refBBox:r}){let i=parseFloat(n),o=lE(n);o&&(i/=100);let s={};if(Number.isFinite(i)){let n=o||i>=0&&i<=1?i*r[t]:Math.max(i+r[t],0);s[e]=n}return s}}function hg(e,t){let n="x6-shape",r=t&&t.resetOffset;return function(t,{elem:i,refBBox:o}){let s=aW(i,n);if(!s||s.value!==t){let r=e(t);aW(i,n,s={value:t,shape:r,shapeBBox:r.bbox()})}let l=s.shape.clone(),a=s.shapeBBox.clone(),u=a.getOrigin(),c=o.getOrigin();a.x=c.x,a.y=c.y;let h=o.getMaxScaleToFit(a,c),d=0===a.width||0===o.width?1:h.sx,f=0===a.height||0===o.height?1:h.sy;return l.scale(d,f,u),r&&l.translate(-u.x,-u.y),l}}function hp(e){let t=hg(function(e){return ck.parse(e)},e);return(e,n)=>({d:t(e,n).serialize()})}function hm(e){let t=hg(e=>new cp(e),e);return(e,n)=>({points:t(e,n).serialize()})}let hy={qualify:rj,set:(e,{view:t})=>`url(#${t.graph.defineGradient(e)})`},hb={qualify:rj,set(e,{view:t}){let n=t.cell,r=Object.assign({},e);if(n.isEdge()&&"linearGradient"===r.type){let e=t.sourcePoint,i=t.targetPoint;r.id=`gradient-${r.type}-${n.id}`,r.attrs=Object.assign(Object.assign({},r.attrs),{x1:e.x,y1:e.y,x2:i.x,y2:i.y,gradientUnits:"userSpaceOnUse"}),t.graph.defs.remove(r.id)}return`url(#${t.graph.defineGradient(r)})`}},hv={qualify:(e,{attrs:t})=>null==t.textWrap||!rj(t.textWrap),set(e,{view:t,elem:n,attrs:r}){let i="x6-text",o=aW(n,i),s=e=>{try{return JSON.parse(e)}catch(t){return e}},l={x:r.x,eol:r.eol,annotations:s(r.annotations),textPath:s(r["text-path"]||r.textPath),textVerticalAnchor:r["text-vertical-anchor"]||r.textVerticalAnchor,displayEmpty:"true"===(r["display-empty"]||r.displayEmpty),lineHeight:r["line-height"]||r.lineHeight},a=r["font-size"]||r.fontSize,u=JSON.stringify([e,l]);if(a&&n.setAttribute("font-size",a),null==o||o!==u){let r=l.textPath;if(null!=r&&"object"==typeof r){let e=r.selector;if("string"==typeof e){let n=t.find(e)[0];n instanceof SVGPathElement&&(l2(n),l.textPath=Object.assign({"xlink:href":`#${n.id}`},r))}}aK(n,`${e}`,l),aW(n,i,u)}}},hx={qualify:rj,set(e,{view:t,elem:n,attrs:r,refBBox:i}){let o,s=e.width||0;lE(s)?i.width*=parseFloat(s)/100:s<=0?i.width+=s:i.width=s;let l=e.height||0;lE(l)?i.height*=parseFloat(l)/100:l<=0?i.height+=l:i.height=l;let a=e.text;null==a&&(a=r.text||(null==n?void 0:n.textContent)),o=null!=a?a2(`${a}`,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:e.ellipsis}):"",nx(hv.set,this,o,{view:t,elem:n,attrs:r,refBBox:i,cell:t.cell})}},hw=(e,{attrs:t})=>void 0!==t.text,hC={qualify:hw},hE={qualify:hw},hS={qualify:hw},hP={qualify:hw},hk={qualify:hw},hO={qualify:hw},hM={qualify:(e,{elem:t})=>t instanceof SVGElement,set(e,{elem:t}){let n="x6-title",r=`${e}`,i=aW(t,n);if(null==i||i!==r){aW(t,n,r);let e=t.firstChild;if(e&&"TITLE"===e.tagName.toUpperCase())e.textContent=r;else{let n=document.createElementNS(t.namespaceURI,"title");n.textContent=r,t.insertBefore(n,e)}}}},hA={offset:hj("x","width","right")},hT={offset:hj("y","height","bottom")},hN={offset:(e,{refBBox:t})=>e?{x:-t.x,y:-t.y}:{x:0,y:0}};function hj(e,t,n){return(r,{refBBox:i})=>{let o,s=new ci;return o="middle"===r?i[t]/2:r===n?i[t]:"number"==typeof r&&Number.isFinite(r)?r>-1&&r<1?-i[t]*r:-r:lE(r)?i[t]*parseFloat(r)/100:0,s[e]=-(i[e]+o),s}}let hL={qualify:rj,set(e,{elem:t}){aU(t,e)}},hR={set(e,{elem:t}){t.innerHTML=`${e}`}},hI={qualify:rj,set:(e,{view:t})=>`url(#${t.graph.defineFilter(e)})`},h_={set:e=>null!=e&&"object"==typeof e&&e.id?e.id:e};function hz(e,t,n){let r,i;"object"==typeof t?(r=t.x,i=t.y):(r=t,i=n);let o=ck.parse(e),s=o.bbox();if(s){let e=-s.height/2-s.y,t=-s.width/2-s.x;"number"==typeof r&&(t-=r),"number"==typeof i&&(e-=i),o.translate(t,e)}return o.serialize()}var hD=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hB=e=>{var{size:t,width:n,height:r,offset:i,open:o}=e;return hF({size:t,width:n,height:r,offset:i},!0===o,!0,void 0,hD(e,["size","width","height","offset","open"]))},hV=e=>{var{size:t,width:n,height:r,offset:i,factor:o}=e;return hF({size:t,width:n,height:r,offset:i},!1,!1,o,hD(e,["size","width","height","offset","factor"]))};function hF(e,t,n,r=3/4,i={}){let o=e.size||10,s=e.width||o,l=e.height||o,a=new ck,u={};if(t)a.moveTo(s,0).lineTo(0,l/2).lineTo(s,l),u.fill="none";else{if(a.moveTo(0,l/2),a.lineTo(s,0),!n){let e=lx(r,0,1);a.lineTo(s*e,l/2)}a.lineTo(s,l),a.close()}return Object.assign(Object.assign(Object.assign({},u),i),{tagName:"path",d:hz(a.serialize(),{x:null!=e.offset?e.offset:-s/2})})}var h$=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hU=e=>{var{size:t,width:n,height:r,offset:i}=e,o=h$(e,["size","width","height","offset"]);let s=t||10,l=n||s,a=r||s,u=new ck;return u.moveTo(0,a/2).lineTo(l/2,0).lineTo(l,a/2).lineTo(l/2,a).close(),Object.assign(Object.assign({},o),{tagName:"path",d:hz(u.serialize(),null==i?-l/2:i)})};var hG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hH=e=>{var{d:t,offsetX:n,offsetY:r}=e;return Object.assign(Object.assign({},hG(e,["d","offsetX","offsetY"])),{tagName:"path",d:hz(t,n,r)})};var hq=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hW=e=>{var{size:t,width:n,height:r,offset:i}=e,o=hq(e,["size","width","height","offset"]);let s=t||10,l=n||s,a=r||s,u=new ck;return u.moveTo(0,0).lineTo(l,a).moveTo(0,a).lineTo(l,0),Object.assign(Object.assign({},o),{tagName:"path",fill:"none",d:hz(u.serialize(),i||-l/2)})};var hJ=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hX=e=>{var{width:t,height:n,offset:r,open:i,flip:o}=e,s=hJ(e,["width","height","offset","open","flip"]);let l=n||6,a=t||10,u=Object.assign(Object.assign({},s),{tagName:"path"});!0===o&&(l=-l);let c=new ck;return c.moveTo(0,l).lineTo(a,0),!0===i?u.fill="none":(c.lineTo(a,l),c.close()),u.d=hz(c.serialize(),{x:r||-a/2,y:l/2}),u};var hY=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let hQ=e=>{var{r:t}=e,n=hY(e,["r"]);let r=t||5;return Object.assign(Object.assign({cx:r},n),{tagName:"circle",r:r})},hZ=e=>{var{r:t}=e,n=hY(e,["r"]);let r=t||5,i=new ck;return i.moveTo(r,0).lineTo(r,2*r),i.moveTo(0,r).lineTo(2*r,r),{children:[Object.assign(Object.assign({},hQ({r:r})),{fill:"none"}),Object.assign(Object.assign({},n),{tagName:"path",d:hz(i.serialize(),-r)})]}};var hK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let h0=e=>{var{rx:t,ry:n}=e,r=hK(e,["rx","ry"]);let i=t||5;return Object.assign(Object.assign({cx:i},r),{tagName:"ellipse",rx:i,ry:n||5})};(et=th||(th={})).presets=tF,et.registry=cA.create({type:"marker"}),et.registry.register(et.presets,!0),(th||(th={})).normalize=hz;var h1=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function h2(e){return"string"==typeof e||rj(e)}let h3={qualify:h2,set:(e,{view:t,attrs:n})=>h4("marker-start",e,t,n)},h5={qualify:h2,set:(e,{view:t,attrs:n})=>h4("marker-end",e,t,n,{transform:"rotate(180)"})},h6={qualify:h2,set:(e,{view:t,attrs:n})=>h4("marker-mid",e,t,n)};function h4(e,t,n,r,i={}){let o="string"==typeof t?{name:t}:t,{name:s,args:l}=o,a=h1(o,["name","args"]),u=a;if(s&&"string"==typeof s){let e=th.registry.get(s);if(!e)return th.registry.onNotFound(s);u=e(Object.assign(Object.assign({},a),l))}let c=Object.assign(Object.assign(Object.assign({},function(e,t){let n={},r=e.stroke;"string"==typeof r&&(n.stroke=r,n.fill=r);let i=e.strokeOpacity;if(null==i&&(i=e["stroke-opacity"]),null==i&&(i=e.opacity),null!=i&&(n["stroke-opacity"]=i,n["fill-opacity"]=i),"marker-mid"!==t){let r=parseFloat(e.strokeWidth||e["stroke-width"]);if(Number.isFinite(r)&&r>1){let e=Math.ceil(r/2);n.refX="marker-start"===t?e:-e}}return n}(r,e)),i),u);return{[e]:`url(#${n.graph.defineMarker(c)})`}}let h9=(e,{view:t})=>t.cell.isEdge(),h8={qualify:h9,set(e,t){var n,r,i,o;let s,l=t.view,a=e.reverse||!1,u=e.stubs||0;if(Number.isFinite(u)&&0!==u)if(a){let e,t,a=l.getConnectionLength()||0;u<0?(e=(a+u)/2,t=-u):(e=u,t=a-2*u);let c=l.getConnection();s=null==(o=null==(i=null==(r=null==(n=null==c?void 0:c.divideAtLength(e))?void 0:n[1])?void 0:r.divideAtLength(t))?void 0:i[0])?void 0:o.serialize()}else{let e;e=u<0?((l.getConnectionLength()||0)+u)/2:u;let t=l.getConnection();if(t){let n=t.divideAtLength(e),r=t.divideAtLength(-e);n&&r&&(s=`${n[0].serialize()} ${r[1].serialize()}`)}}return{d:s||l.getConnectionPathData()}}},h7={qualify:h9,set:ds("getTangentAtLength",{rotate:!0})},de={qualify:h9,set:ds("getTangentAtLength",{rotate:!1})},dt={qualify:h9,set:ds("getTangentAtRatio",{rotate:!0})},dn={qualify:h9,set:ds("getTangentAtRatio",{rotate:!1})},dr=h7,di=dt;function ds(e,t){let n={x:1,y:0};return(r,i)=>{let o,s,l=i.view,a=l[e](Number(r));return(a?(s=t.rotate?a.vector().vectorAngle(n):0,o=a.start):(o=l.path.start,s=0),0===s)?{transform:`translate(${o.x},${o.y}')`}:{transform:`translate(${o.x},${o.y}') rotate(${s})`}}}(td||(td={})).isValidDefinition=function(e,t,n){return!!(null!=e&&("string"==typeof e||"function"!=typeof e.qualify||nx(e.qualify,this,t,n)))||!1},(en=td||(td={})).presets=Object.assign(Object.assign({},{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"}),t$),en.registry=cA.create({type:"attribute definition"}),en.registry.register(en.presets,!0);let dl={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix:e=>`${dl.prefixCls}-${e}`},da=dl.prefix("highlighted"),du={highlight(e,t,n){lQ(t,n&&n.className||da)},unhighlight(e,t,n){lZ(t,n&&n.className||da)}},dc=dl.prefix("highlight-opacity"),dh={highlight(e,t){lQ(t,dc)},unhighlight(e,t){lZ(t,dc)}};!function(e){let t=l8("svg");function n(e,t){let n=ud(e.x,e.y).matrixTransform(t);return new ci(n.x,n.y)}function r(e,n){let r=t.createSVGPoint();r.x=e.x,r.y=e.y;let i=r.matrixTransform(n);r.x=e.x+e.width,r.y=e.y;let o=r.matrixTransform(n);r.x=e.x+e.width,r.y=e.y+e.height;let s=r.matrixTransform(n);r.x=e.x,r.y=e.y+e.height;let l=r.matrixTransform(n),a=Math.min(i.x,o.x,s.x,l.x),u=Math.max(i.x,o.x,s.x,l.x),c=Math.min(i.y,o.y,s.y,l.y),h=Math.max(i.y,o.y,s.y,l.y);return new co(a,c,u-a,h-c)}function i(e,t={}){let n;if(!e.ownerSVGElement||!l3(e)){if(ap(e)){let{left:t,top:n,width:r,height:i}=o(e);return new co(t,n,r,i)}return new co(0,0,0,0)}let s=t.target;if(!t.recursive){try{n=e.getBBox()}catch(t){n={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return s?r(n,uO(e,s)):co.create(n)}{let t=e.childNodes,r=t.length;if(0===r)return i(e,{target:s});s||(s=e);for(let e=0;e<r;e+=1){let r,o=t[e];r=0===o.childNodes.length?i(o,{target:s}):i(o,{target:s,recursive:!0}),n=n?n.union(r):r}return n}}function o(e){let t=0,n=0,r=0,i=0;if(e){let o=e;for(;o;)t+=o.offsetLeft,n+=o.offsetTop,(o=o.offsetParent)&&(t+=parseInt(a_(o,"borderLeft"),10),n+=parseInt(a_(o,"borderTop"),10));r=e.offsetWidth,i=e.offsetHeight}return{left:t,top:n,width:r,height:i}}function s(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 co(t("x"),t("y"),t("width"),t("height"));case"circle":return new cu(t("cx"),t("cy"),t("r"),t("r"));case"ellipse":return new cu(t("cx"),t("cy"),t("rx"),t("ry"));case"polyline":{let t=ue(e);return new cp(t)}case"polygon":{let t=ue(e);return t.length>1&&t.push(t[0]),new cp(t)}case"path":{let t=e.getAttribute("d");return ck.isValid(t)||(t=ck.normalize(t)),ck.parse(t)}case"line":return new ca(t("x1"),t("y1"),t("x2"),t("y2"))}return i(e)}function l(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if(e=e.toUpperCase(),lY(t,"x6-port"))t=t.nextElementSibling;else if("G"===e)t=t.firstElementChild;else if("TITLE"===e)t=t.nextElementSibling;else break}while(t);return t}e.normalizeMarker=hz,e.transformPoint=n,e.transformLine=function(e,t){return new ca(n(e.start,t),n(e.end,t))},e.transformPolyline=function(e,t){let r=e instanceof cp?e.points:e;return Array.isArray(r)||(r=[]),new cp(r.map(e=>n(e,t)))},e.transformRectangle=r,e.bbox=function(e,t,n){let i,o=e.ownerSVGElement;if(!o)return new co(0,0,0,0);try{i=e.getBBox()}catch(t){i={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return t?co.create(i):r(i,uO(e,n||o))},e.getBBox=i,e.getBoundingOffsetRect=o,e.toGeometryShape=s,e.translateAndAutoOrient=function(e,t,n,r){let o=ci.create(t),s=ci.create(n);r||(r=e instanceof SVGSVGElement?e:e.ownerSVGElement);let l=uk(e);e.setAttribute("transform","");let a=i(e,{target:r}).scale(l.sx,l.sy),u=ug();u.setTranslate(-a.x-a.width/2,-a.y-a.height/2);let c=ug(),h=o.angleBetween(s,o.clone().translate(1,0));h&&c.setRotate(h,0,0);let d=ug(),f=o.clone().move(s,a.width/2);d.setTranslate(2*o.x-f.x,2*o.y-f.y);let g=uO(e,r),p=ug();p.setMatrix(d.matrix.multiply(c.matrix.multiply(u.matrix.multiply(g.scale(l.sx,l.sy))))),e.setAttribute("transform",um(p.matrix))},e.findShapeNode=l,e.getBBoxV2=function(e){let t=l(e);if(!l3(t)){if(ap(e)){let{left:t,top:n,width:r,height:i}=o(e);return new co(t,n,r,i)}return new co(0,0,0,0)}return s(t).bbox()||co.create()}}(tf||(tf={}));let dd={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},df={highlight(e,t,n){let r,i,o=tg.getHighlighterId(t,n);if(tg.hasCache(o))return;n=r4({},n,dd);let s=aX.create(t);try{r=s.toPathData()}catch(e){i=tf.bbox(s.node,!0),r=ui(Object.assign(Object.assign({},n),i))}let l=l8("path");if(aC(l,Object.assign({d:r,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},n.attrs?aS(n.attrs):null)),e.isEdgeElement(t))aC(l,"d",e.getConnectionPathData());else{let t=s.getTransformToElement(e.container),r=n.padding;if(r){null==i&&(i=tf.bbox(s.node,!0));let e=i.x+i.width/2,n=i.y+i.height/2,o=Math.max((i=tf.transformRectangle(i,t)).width,1),l=Math.max(i.height,1),a=(o+r)/o,u=(l+r)/l,c=uf({a:a,b:0,c:0,d:u,e:e-a*e,f:n-u*n});t=t.multiply(c)}uE(l,t)}lQ(l,dl.prefix("highlight-stroke"));let a=e.cell,u=()=>tg.removeHighlighter(o);a.on("removed",u),a.model&&a.model.on("reseted",u),e.container.appendChild(l),tg.setCache(o,l)},unhighlight(e,t,n){tg.removeHighlighter(tg.getHighlighterId(t,n))}};var dg=tg||(tg={});dg.getHighlighterId=function(e,t){return l2(e),e.id+JSON.stringify(t)};let dp={};function dm(e,t={}){return new ci(lS(t.x,e.width),lS(t.y,e.height))}function dy(e,t,n){return Object.assign({angle:t,position:e.toJSON()},n)}dg.setCache=function(e,t){dp[e]=t},dg.hasCache=function(e){return null!=dp[e]},dg.removeHighlighter=function(e){let t=dp[e];t&&(al(t),delete dp[e])},(tp||(tp={})).check=function(e,t){if("function"!=typeof t.highlight)throw Error(`Highlighter '${e}' is missing required \`highlight()\` method`);if("function"!=typeof t.unhighlight)throw Error(`Highlighter '${e}' is missing required \`unhighlight()\` method`)},(er=tp||(tp={})).presets=tU,er.registry=cA.create({type:"highlighter"}),er.registry.register(er.presets,!0);let db=(e,t)=>e.map(({x:e,y:n,angle:r})=>dy(dm(t,{x:e,y:n}),r||0)),dv=(e,t,n)=>{let r=n.start||0,i=n.step||20;return dw(e,t,r,(e,t)=>(e+.5-t/2)*i)},dx=(e,t,n)=>{let r=n.start||0,i=n.step||360/e.length;return dw(e,t,r,e=>e*i)};function dw(e,t,n,r){let i=t.getCenter(),o=t.getTopCenter(),s=t.width/t.height,l=cu.fromRect(t),a=e.length;return e.map((e,t)=>{let u=n+r(t,a),c=o.clone().rotate(-u,i).scale(s,1,i),h=e.compensateRotate?-l.tangentTheta(c):0;return(e.dx||e.dy)&&c.translate(e.dx||0,e.dy||0),e.dr&&c.move(i,e.dr),dy(c.round(),h,e)})}var dC=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let dE=(e,t,n)=>dM(e,dm(t,n.start||t.getOrigin()),dm(t,n.end||t.getCorner()),n),dS=(e,t,n)=>dM(e,t.getTopLeft(),t.getBottomLeft(),n),dP=(e,t,n)=>dM(e,t.getTopRight(),t.getBottomRight(),n),dk=(e,t,n)=>dM(e,t.getTopLeft(),t.getTopRight(),n),dO=(e,t,n)=>dM(e,t.getBottomLeft(),t.getBottomRight(),n);function dM(e,t,n,r){let i=new ca(t,n),o=e.length;return e.map((e,t)=>{var{strict:n}=e,s=dC(e,["strict"]);let l=n||r.strict?(t+1)/(o+1):(t+.5)/o,a=i.pointAt(l);return(s.dx||s.dy)&&a.translate(s.dx||0,s.dy||0),dy(a.round(),0,s)})}(ei=tm||(tm={})).presets=tG,ei.registry=cA.create({type:"port layout"}),ei.registry.register(ei.presets,!0);let dA={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function dT(e,t){let{x:n,y:r,angle:i,attrs:o}=t||{};return r4({},{angle:i,attrs:o,position:{x:n,y:r}},e,dA)}let dN=(e,t,n)=>dT({position:t.getTopLeft()},n),dj=(e,t,n)=>dT({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},n),dL=(e,t,n)=>dT({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},n),dR=(e,t,n)=>dT({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},n),dI=(e,t,n)=>dT({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},n),d_=(e,t,n)=>dV(e,t,!1,n),dz=(e,t,n)=>dV(e,t,!0,n),dD=(e,t,n)=>dF(e,t,!1,n),dB=(e,t,n)=>dF(e,t,!0,n);function dV(e,t,n,r){let i,o,s,l,a=null!=r.offset?r.offset:15,u=t.getCenter().theta(e),c=d$(t),h=0;return u<c[1]||u>c[2]?(i=".3em",o=a,s=0,l="start"):u<c[0]?(i="0",o=0,s=-a,n?(h=-90,l="start"):l="middle"):u<c[3]?(i=".3em",o=-a,s=0,l="end"):(i=".6em",o=0,s=a,n?(h=90,l="start"):l="middle"),dT({position:{x:Math.round(o),y:Math.round(s)},angle:h,attrs:{".":{y:i,"text-anchor":l}}},r)}function dF(e,t,n,r){let i,o,s,l,a=null!=r.offset?r.offset:15,u=t.getCenter().theta(e),c=d$(t),h=0;return u<c[1]||u>c[2]?(i=".3em",o=-a,s=0,l="end"):u<c[0]?(i=".6em",o=0,s=a,n?(h=90,l="start"):l="middle"):u<c[3]?(i=".3em",o=a,s=0,l="start"):(i="0em",o=0,s=-a,n?(h=-90,l="start"):l="middle"),dT({position:{x:Math.round(o),y:Math.round(s)},angle:h,attrs:{".":{y:i,"text-anchor":l}}},r)}function d$(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]}let dU=(e,t,n)=>dH(e.diff(t.getCenter()),!1,n),dG=(e,t,n)=>dH(e.diff(t.getCenter()),!0,n);function dH(e,t,n){let r,i=null!=n.offset?n.offset:20,o=new ci(0,0),s=-e.theta(o),l=e.clone().move(o,i).diff(e).round(),a=".3em",u=s;return(s+90)%180==0?(r=t?"end":"middle",t||-270!==s||(a="0em")):s>-270&&s<-90?(r="start",u=s-180):r="end",dT({position:l.round().toJSON(),angle:t?u:0,attrs:{".":{y:a,"text-anchor":r}}},n)}(eo=ty||(ty={})).presets=tH,eo.registry=cA.create({type:"port label layout"}),eo.registry.register(eo.presets,!0);class dq extends oQ{get priority(){return 2}constructor(){super(),this.cid=tb.uniqueId(),dq.views[this.cid]=this}confirmUpdate(e,t){return 0}empty(e=this.container){return aa(e),this}unmount(e=this.container){return al(e),this}remove(e=this.container){return e===this.container&&(this.removeEventListeners(document),this.onRemove(),delete dq.views[this.cid]),this.unmount(e),this}onRemove(){}setClass(e,t=this.container){t.classList.value=Array.isArray(e)?e.join(" "):e}addClass(e,t=this.container){return lQ(t,Array.isArray(e)?e.join(" "):e),this}removeClass(e,t=this.container){return lZ(t,Array.isArray(e)?e.join(" "):e),this}setStyle(e,t=this.container){return aU(t,e),this}setAttrs(e,t=this.container){return null!=e&&null!=t&&aC(t,e),this}findAttr(e,t=this.container){let n=t;for(;n&&1===n.nodeType;){let t=n.getAttribute(e);if(null!=t)return t;if(n===this.container)break;n=n.parentNode}return null}find(e,t=this.container,n=this.selectors){return dq.find(e,t,n).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((null!=t||n===this.container)&&"false"!==t)return n;n=n.parentNode}return null}getSelector(e,t){let n;if(e===this.container)return"string"==typeof t&&(n=`> ${t}`),n;if(e){let r=an(e)+1;n=`${e.tagName.toLowerCase()}:nth-child(${r})`,t&&(n+=` > ${t}`),n=this.getSelector(e.parentNode,n)}return n}prefixClassName(e){return dl.prefix(e)}delegateEvents(e,t){if(null==e)return this;t||this.undelegateEvents();let n=/^(\S+)\s*(.*)$/;return Object.keys(e).forEach(t=>{let r=t.match(n);if(null==r)return;let i=this.getEventHandler(e[t]);"function"==typeof i&&this.delegateEvent(r[1],r[2],i)}),this}undelegateEvents(){return te.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 te.on(this.container,e+this.getEventNamespace(),t,n),this}undelegateEvent(e,t,n){let r=e+this.getEventNamespace();return null==t?te.off(this.container,r):"string"==typeof t?te.off(this.container,r,t,n):te.off(this.container,r,t),this}addEventListeners(e,t,n){if(null==t)return this;let r=this.getEventNamespace();return Object.keys(t).forEach(i=>{let o=this.getEventHandler(t[i]);"function"==typeof o&&te.on(e,i+r,n,o)}),this}removeEventListeners(e){return null!=e&&te.off(e,this.getEventNamespace()),this}getEventNamespace(){return`.${dl.prefixCls}-event-${this.cid}`}getEventHandler(e){let t;if("string"==typeof e){let n=this[e];"function"==typeof n&&(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:o=0}=e;return t.fromPoint||"touchmove"===r||"touchend"===r?document.elementFromPoint(i,o):n}stopPropagation(e){return this.setEventData(e,{propagationStopped:!0}),this}isPropagationStopped(e){return!0===this.getEventData(e).propagationStopped}getEventData(e){return this.eventData(e)}setEventData(e,t){return this.eventData(e,t)}eventData(e,t){if(null==e)throw TypeError("Event object required");let n=e.data,r=`__${this.cid}__`;return null==t?null==n?{}:n[r]||{}:(null==n&&(n=e.data={}),null==n[r]?n[r]=Object.assign({},t):n[r]=Object.assign(Object.assign({},n[r]),t),n[r])}normalizeEvent(e){return dq.normalizeEvent(e)}}(es=dq||(dq={})).createElement=function(e,t){return t?l8(e||"g"):l9(e||"div")},es.find=function(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(dl.useCSSSelector){let n=e.includes(">")?`:scope ${e}`:e;return{isCSSSelector:!0,elems:Array.prototype.slice.call(t.querySelectorAll(n))}}return{elems:[]}},es.normalizeEvent=function(e){let t=e,n=e.originalEvent,r=n&&n.changedTouches&&n.changedTouches[0];if(r){for(let t in e)void 0===r[t]&&(r[t]=e[t]);t=r}return t},(el=dq||(dq={})).views={},el.getView=function(e){return el.views[e]||null},ea=tb||(tb={}),l=0,ea.uniqueId=function(){let e=`v${l}`;return l+=1,e};class dW{constructor(e){this.view=e,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new u5,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={}),t.data}getMatrix(e){let t=this.get(e);return null==t.matrix&&(t.matrix=uM(e,this.view.container)),uf(t.matrix)}getShape(e){let t=this.get(e);return null==t.shape&&(t.shape=tf.toGeometryShape(e)),t.shape.clone()}getBoundingRect(e){let t=this.get(e);return null==t.boundingRect&&(t.boundingRect=tf.getBBoxV2(e)),t.boundingRect.clone()}}!function(e){function t(e){return null!=e&&"string"==typeof e}function n(e,t={ns:l5.svg}){let r=document.createDocumentFragment(),i={},o={},s=[{markup:Array.isArray(e)?e:[e],parent:r,ns:t.ns}];for(;s.length>0;){let e=s.pop(),t=e.ns||l5.svg,n=e.markup,r=e.parent;n.forEach(e=>{let n=e.tagName;if(!n)throw TypeError("Invalid tagName");e.ns&&(t=e.ns);let l=t?l9(n,t):l4(n),a=e.attrs;a&&aC(l,aS(a));let u=e.style;u&&aU(l,u);let c=e.className;null!=c&&l.setAttribute("class",Array.isArray(c)?c.join(" "):c),e.textContent&&(l.textContent=e.textContent);let h=e.selector;if(null!=h){if(o[h])throw TypeError("Selector must be unique");o[h]=l}if(e.groupSelector){let t=e.groupSelector;Array.isArray(t)||(t=[t]),t.forEach(e=>{i[e]||(i[e]=[]),i[e].push(l)})}r.appendChild(l);let d=e.children;Array.isArray(d)&&s.push({ns:t,markup:d,parent:l})})}return Object.keys(i).forEach(e=>{if(o[e])throw Error("Ambiguous group selector");o[e]=i[e]}),{fragment:r,selectors:o,groups:i}}function r(e){return e instanceof SVGElement?l8("g"):l4("div")}e.isJSONMarkup=function(e){return null!=e&&!t(e)},e.isStringMarkup=t,e.clone=function(e){return null==e||t(e)?e:of(e)},e.sanitize=function(e){return`${e}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")},e.parseJSONMarkup=n,e.renderMarkup=function(e){if(t(e)){let t=aX.createVectors(e),n=t.length;if(1===n)return{elem:t[0].node};if(n>1){let e=r(t[0].node);return t.forEach(t=>{e.appendChild(t.node)}),{elem:e}}return{}}let i=n(e),o=i.fragment,s=null;return o.childNodes.length>1?(s=r(o.firstChild)).appendChild(o):s=o.firstChild,{elem:s,selectors:i.selectors}},e.parseLabelStringMarkup=function(e){let t=aX.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:{}}}}(tv||(tv={})),(tv||(tv={})).getSelector=function e(t,n,r){if(null!=t){let i,o=t.tagName.toLowerCase();if(t===n)return"string"==typeof r?`> ${o} > ${r}`:`> ${o}`;let s=t.parentNode;if(s&&s.childNodes.length>1){let e=an(t)+1;i=`${o}:nth-child(${e})`}else i=o;return r&&(i+=` > ${r}`),e(t.parentNode,n,i)}return r},(eu=tv||(tv={})).getPortContainerMarkup=function(){return"g"},eu.getPortMarkup=function(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}},eu.getPortLabelMarkup=function(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}},(tv||(tv={})).getEdgeMarkup=function(){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"}}]},(tv||(tv={})).getForeignObjectMarkup=function(e=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:l5.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:l5.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:e?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}};class dJ{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,o,s=[];return Object.keys(t).forEach(r=>{let i=t[r],o=this.getDefinition(r),l=nx(td.isValidDefinition,this.view,o,i,{elem:e,attrs:t,cell:this.cell,view:this.view});o&&l?"string"==typeof o?(null==n&&(n={}),n[o]=i):null!==i&&s.push({name:r,definition:o}):(null==n&&(n={}),n[ay.includes(r)?r:lp(r)]=i)}),s.forEach(({name:e,definition:n})=>{let s=t[e];"function"==typeof n.set&&(null==r&&(r={}),r[e]=s),"function"==typeof n.offset&&(null==i&&(i={}),i[e]=s),"function"==typeof n.position&&(null==o&&(o={}),o[e]=s)}),{raw:t,normal:n,set:r,offset:i,position:o}}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;null!=n&&t.normal&&(t.normal.transform=n),e.normal=t.normal}findAttrs(e,t,n,r){let i=[],o=new u5;return Object.keys(e).forEach(s=>{let l=e[s];if(!rj(l))return;let{isCSSSelector:a,elems:u}=dq.find(s,t,r);n[s]=u;for(let e=0,t=u.length;e<t;e+=1){let n=u[e],c=r&&r[s]===n,h=o.get(n);if(h){h.array||(i.push(n),h.array=!0,h.attrs=[h.attrs],h.priority=[h.priority]);let e=h.attrs,r=h.priority;if(c)e.unshift(l),r.unshift(-1);else{let n=se(r,a?-1:t);e.splice(n,0,l),r.splice(n,0,t)}}else o.set(n,{elem:n,attrs:l,priority:c?-1:t,array:!1})}}),i.forEach(e=>{let t=o.get(e),n=t.attrs;t.attrs=n.reduceRight((e,t)=>r9(e,t),{})}),o}updateRelativeAttrs(e,t,n){let r=t.raw||{},i=t.normal||{},o=t.set,s=t.position,l=t.offset,a=()=>({elem:e,cell:this.cell,view:this.view,attrs:r,refBBox:n.clone()});if(null!=o&&Object.keys(o).forEach(e=>{let t=o[e],n=this.getDefinition(e);if(null!=n){let r=nx(n.set,this.view,t,a());"object"==typeof r?i=Object.assign(Object.assign({},i),r):null!=r&&(i[e]=r)}}),e instanceof HTMLElement)return void this.view.setAttrs(i,e);let u=i.transform,c=up(u?`${u}`:null),h=new ci(c.e,c.f);u&&(delete i.transform,c.e=0,c.f=0);let d=!1;null!=s&&Object.keys(s).forEach(e=>{let t=s[e],n=this.getDefinition(e);if(null!=n){let e=nx(n.position,this.view,t,a());null!=e&&(d=!0,h.translate(ci.create(e)))}}),this.view.setAttrs(i,e);let f=!1;if(null!=l){let t=this.view.getBoundingRectOfElement(e);if(t.width>0&&t.height>0){let n=tf.transformRectangle(t,c);Object.keys(l).forEach(t=>{let i=l[t],o=this.getDefinition(t);if(null!=o){let t=nx(o.offset,this.view,i,{elem:e,cell:this.cell,view:this.view,attrs:r,refBBox:n});null!=t&&(f=!0,h.translate(ci.create(t)))}})}}(null!=u||d||f)&&(h.round(1),c.e=h.x,c.f=h.y,e.setAttribute("transform",um(c)))}update(e,t,n){let r,i={},o=this.findAttrs(n.attrs||t,e,i,n.selectors),s=n.attrs?this.findAttrs(t,e,i,n.selectors):o,l=[];o.each(t=>{let r=t.elem,o=t.attrs,a=this.processAttrs(r,o);if(null==a.set&&null==a.position&&null==a.offset)this.view.setAttrs(a.normal,r);else{let t,u=s.get(r),c=u?u.attrs:null,h=c&&null==o.ref?c.ref:o.ref;if(h){if(!(t=(i[h]||this.view.find(h,e,n.selectors))[0]))throw Error(`"${h}" reference does not exist.`)}else t=null;let d={node:r,refNode:t,attributes:c,processedAttributes:a},f=l.findIndex(e=>e.refNode===r);f>-1?l.splice(f,0,d):l.push(d)}});let a=new u5;l.forEach(t=>{let i,o,s=t.node,l=t.refNode,u=null!=l&&null!=n.rotatableNode&&as(n.rotatableNode,l);if(l&&(i=a.get(l)),!i){let t=u?n.rotatableNode:e;i=l?tf.getBBox(l,{target:t}):n.rootBBox,l&&a.set(l,i)}n.attrs&&t.attributes?(o=this.processAttrs(s,t.attributes),this.mergeProcessedAttrs(o,t.processedAttributes)):o=t.processedAttributes;let c=i;u&&null!=n.rotatableNode&&!n.rotatableNode.contains(s)&&(r||(r=up(aC(n.rotatableNode,"transform"))),c=tf.transformRectangle(i,r)),this.updateRelativeAttrs(s,o,c)})}}class dX{get cell(){return this.view.cell}constructor(e,t,n=[]){this.view=e;let r={},i={},o=0;Object.keys(t).forEach(e=>{let n=t[e];Array.isArray(n)||(n=[n]),n.forEach(t=>{let n=r[t];n||(o+=1,n=r[t]=1<<o),i[e]|=n})});let s=n;if(Array.isArray(s)||(s=[s]),s.forEach(e=>{r[e]||(o+=1,r[e]=1<<o)}),o>25)throw Error("Maximum number of flags exceeded.");this.flags=r,this.attrs=i,this.bootstrap=n}getFlag(e){let t=this.flags;return null==t?0:Array.isArray(e)?e.reduce((e,n)=>e|t[n],0):0|t[e]}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}}var dY=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class dQ extends dq{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){let t=(e,t)=>null!=t?o6([...Array.isArray(e)?e:[e],...Array.isArray(t)?t:[t]]):Array.isArray(e)?[...e]:[e],n=of(this.getDefaults()),{bootstrap:r,actions:i,events:o,documentEvents:s}=e,l=dY(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))}),o&&(n.events=Object.assign(Object.assign({},n.events),o)),e.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),s)),r9(n,l)}get[Symbol.toStringTag](){return dQ.toStringTag}constructor(e,t={}){super(),this.cell=e,this.options=this.ensureOptions(t),this.graph=this.options.graph,this.attr=new dJ(this),this.flag=new dX(this,this.options.actions,this.options.bootstrap),this.cache=new dW(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 dq.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(e){if(this.container!==e){this.undelegateEvents(),this.container=e,null!=this.options.events&&this.delegateEvents(this.options.events);let t=this.getContainerAttrs();null!=t&&this.setAttrs(t,e);let n=this.getContainerStyle();null!=n&&this.setStyle(n,e);let r=this.getContainerClassName();null!=r&&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&&("string"==typeof r?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),null!=this.graph&&this.graph.renderer.requestViewUpdate(this,t,e))}parseJSONMarkup(e,t){let n=tv.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("function"==typeof t&&(t=nx(t,this.graph,this)),"object"==typeof t){let n=t[e];return"function"==typeof n&&(n=nx(n,this.graph,this)),!1!==n}return"boolean"==typeof t&&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 tf.transformRectangle(t,i.multiply(r).multiply(n))}getUnrotatedBBoxOfElement(e){let t=this.getBoundingRectOfElement(e),n=this.getMatrixOfElement(e),r=this.getRootTranslatedMatrix();return tf.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 uf().translate(t.x,t.y)}getRootRotatedMatrix(){let e=uf(),t=this.cell,n=t.isNode()?t.getAngle():0;if(n){let r=t.getBBox(),i=r.width/2,o=r.height/2;e=e.translate(i,o).rotate(n).translate(-i,-o)}return e}findMagnet(e=this.container){return this.findByAttr("magnet",e)}updateAttrs(e,t,n={}){null==n.rootBBox&&(n.rootBBox=new co),null==n.selectors&&(n.selectors=this.selectors),this.attr.update(e,t,n)}isEdgeElement(e){return this.cell.isEdge()&&(null==e||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 o=this.cell,s=this.findAttr("port",e),l=e.getAttribute("data-selector"),a={cell:o.id};return null!=l&&(a.magnet=l),null!=s?(a.port=s,o.isNode()&&!o.hasPort(s)&&null==l&&(a.selector=this.getSelector(e))):null==l&&this.container!==e&&(a.selector=this.getSelector(e)),a}getMagnetFromEdgeTerminal(e){let t,n=this.cell,r=this.container,i=e.port,o=e.magnet;return null!=i&&n.isNode()&&n.hasPort(i)?t=this.findPortElem(i,o)||r:(o||(o=e.selector),o||null==i||(o=`[port="${i}"]`),t=this.findOne(o,r,this.selectors)),t}hasTools(e){let t=this.tools;return null!=t&&(null==e||t.name===e)}addTools(e){if(this.removeTools(),e){if(!this.can("toolsAddable"))return this;let t=dZ.isToolsView(e)?e:new dZ(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(),this.tools=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.cell;return null==t||null==n?{e,view:this,cell:r}:{e,x:t,y:n,view:this,cell:r}}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}),this.cachedModelForMouseEvent=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)}}dQ.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([dQ.dispose()],dQ.prototype,"dispose",null),(ec=dQ||(dQ={})).Flag=dX,ec.Attr=dJ,(eh=dQ||(dQ={})).toStringTag=`X6.${eh.name}`,eh.isCellView=function(e){if(null==e)return!1;if(e instanceof eh)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eh.toStringTag)&&"function"==typeof e.isNodeView&&"function"==typeof e.isEdgeView&&"function"==typeof e.confirmUpdate},(ed=dQ||(dQ={})).priority=function(e){return function(t){t.config({priority:e})}},ed.bootstrap=function(e){return function(t){t.config({bootstrap:e})}},(dQ||(dQ={})).registry=cA.create({type:"view"});class dZ extends dq{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return dZ.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?dq.createElement("g",!0):dq.createElement("div",!1);return lQ(n,this.prefixClassName("cell-tools")),t.className&&lQ(n,t.className),n}config(e){if(this.options=Object.assign(Object.assign({},this.options),e),!dQ.isCellView(e.view)||e.view===this.cellView)return this;this.cellView=e.view,this.cell.isEdge()?(lQ(this.svgContainer,this.prefixClassName("edge-tools")),lQ(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(lQ(this.svgContainer,this.prefixClassName("node-tools")),lQ(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 t=this.options.items;if(!Array.isArray(t))return this;this.tools=[];let n=[];t.forEach(e=>{dZ.ToolItem.isToolItem(e)?"vertices"===e.name?n.unshift(e):n.push(e):"vertices"===("object"==typeof e?e.name:e)?n.unshift(e):n.push(e)});for(let e=0;e<n.length;e+=1){let t,r=n[e];if(dZ.ToolItem.isToolItem(r))t=r;else{let e="object"==typeof r?r.name:r,n="object"==typeof r&&r.args||{};if(e){if(this.cell.isNode()){let r=tw.registry.get(e);if(!r)return tw.registry.onNotFound(e);t=new r(n)}else if(this.cell.isEdge()){let r=tC.registry.get(e);if(!r)return tC.registry.onNotFound(e);t=new r(n)}}}t&&(t.config(this.cellView,this),t.render(),(!1!==t.options.isSVGElement?this.svgContainer:this.htmlContainer).appendChild(t.container),this.tools.push(t))}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),al(this.svgContainer),al(this.htmlContainer),super.remove()}mount(){let e=this.tools,t=this.cellView;if(t&&e){let n=e.some(e=>!1!==e.options.isSVGElement),r=e.some(e=>!1===e.options.isSVGElement);n&&(this.options.local?t.container:t.graph.view.decorator).appendChild(this.svgContainer),r&&this.graph.container.appendChild(this.htmlContainer)}return this}}(ef=dZ||(dZ={})).toStringTag=`X6.${ef.name}`,ef.isToolsView=function(e){if(null==e)return!1;if(e instanceof ef)return!0;let t=e[Symbol.toStringTag];return(null==t||t===ef.toStringTag)&&null!=e.graph&&null!=e.cell&&"function"==typeof e.config&&"function"==typeof e.update&&"function"==typeof e.focus&&"function"==typeof e.blur&&"function"==typeof e.show&&"function"==typeof e.hide||!1},function(e){var t,n;let r;class i extends dq{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){return r9(of(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 i.toStringTag}constructor(e={}){super(),this.visible=!0,this.options=this.getOptions(e),this.container=dq.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),lQ(this.container,this.prefixClassName("cell-tool")),"string"==typeof this.options.className&&lQ(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()?lQ(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&lQ(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=tv.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 null!=e&&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 null==this.graph||null==this.cellView||this.graph.view.guard(e,this.cellView)}}i.defaults={isSVGElement:!0,tagName:"g"},e.ToolItem=i,t=i=e.ToolItem||(e.ToolItem={}),r=0,t.define=function(e){var t;let n=o$((t=e.name)?lm(t):(r+=1,`CustomTool${r}`),this);return n.config(e),n},(n=i=e.ToolItem||(e.ToolItem={})).toStringTag=`X6.${n.name}`,n.isToolItem=function(e){if(null==e)return!1;if(e instanceof n)return!0;let t=e[Symbol.toStringTag];return(null==t||t===n.toStringTag)&&null!=e.graph&&null!=e.cell&&"function"==typeof e.config&&"function"==typeof e.update&&"function"==typeof e.focus&&"function"==typeof e.blur&&"function"==typeof e.show&&"function"==typeof e.hide&&"function"==typeof e.isVisible||!1}}(dZ||(dZ={}));let dK=e=>e;function d0(e,t){return 0===t?"0%":`${Math.round(e/t*100)}%`}function d1(e){return(t,n,r,i)=>n.isEdgeElement(r)?function(e,t,n,r,i){let o=n.getConnection();if(!o)return t;let s=o.closestPointLength(i);return e?t.anchor={name:"ratio",args:{ratio:s/o.length()}}:t.anchor={name:"length",args:{length:s}},t}(e,t,n,0,i):function(e,t,n,r,i){let o=n.cell,s=o.getAngle(),l=n.getUnrotatedBBoxOfElement(r),a=o.getBBox().getCenter(),u=ci.create(i).rotate(s,a),c=u.x-l.x,h=u.y-l.y;return e&&(c=d0(c,l.width),h=d0(h,l.height)),t.anchor={name:"topLeft",args:{dx:c,dy:h,rotate:!0}},t}(e,t,n,r,i)}let d2=d1(!0),d3=d1(!1);function d5(e,t,n,r){return nx(tx.presets.pinRelative,this.graph,{},t,n,e,this.cell,r,{}).anchor}function d6(e,t){return t?e.cell.getBBox():e.cell.isEdge()?e.getConnection().bbox():e.getUnrotatedBBoxOfElement(e.container)}(eg=tx||(tx={})).presets=tq,eg.registry=cA.create({type:"connection strategy"}),eg.registry.register(eg.presets,!0);class d4 extends dZ.ToolItem{onRender(){lQ(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();uE(this.container,e,{absolute:!0})}getNodeMatrix(){let e=this.cellView,t=this.options,{x:n=0,y:r=0}=t,{offset:i,useCellGeometry:o,rotate:s}=t,l=d6(e,o),a=e.cell.getAngle();s||(l=l.bbox(a));let u=0,c=0;"number"==typeof i?(u=i,c=i):"object"==typeof i&&(u=i.x,c=i.y),n=lS(n,l.width),r=lS(r,l.height);let h=uf().translate(l.x+l.width/2,l.y+l.height/2);return s&&(h=h.rotate(a)),h=h.translate(n+u-l.width/2,r+c-l.height/2)}getEdgeMatrix(){let e,t,n,r=this.cellView,{offset:i=0,distance:o=0,rotate:s}=this.options,l=lS(o,1);(e=l>=0&&l<=1?r.getTangentAtRatio(l):r.getTangentAtLength(l))?(t=e.start,n=e.vector().vectorAngle(new ci(1,0))||0):(t=r.getConnection().start,n=0);let a=uf().translate(t.x,t.y).rotate(n);return a="object"==typeof i?a.translate(i.x||0,i.y||0):a.translate(0,i),s||(a=a.rotate(-n)),a}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();let t=this.options.onClick;"function"==typeof t&&nx(t,this.cellView,{e,view:this.cellView,cell:this.cellView.cell,btn:this})}}(d4||(d4={})).config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}}),(ep=d4||(d4={})).Remove=ep.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})}});var d9=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class d8 extends dZ.ToolItem{onRender(){if(lQ(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){let e=this.options.attrs,{class:t}=e,n=d9(e,["class"]);aC(this.container,aS(n)),t&&lQ(this.container,t)}this.update()}update(){let e=this.cellView,t=this.options,{useCellGeometry:n,rotate:r}=t,i=lk(t.padding),o=d6(e,n).moveAndExpand({x:-i.left,y:-i.top,width:i.left+i.right,height:i.top+i.bottom}),s=e.cell;if(s.isNode()){let e=s.getAngle();if(e)if(r){let t=s.getBBox().getCenter();uP(this.container,e,t.x,t.y,{absolute:!0})}else o=o.bbox(e)}return aC(this.container,o.toJSON()),this}}(d8||(d8={})).config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}});class d7 extends dZ.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,o=r({index:t,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});i&&i(o),o.updatePosition(n.x,n.y),this.stamp(o.container),this.container.appendChild(o.container),this.handles.push(o),this.startHandleListening(o)}}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:ci.create(r),next:ci.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:o,y:s}=this.getMouseEventArgs(t),l={x:o,y:s};this.snapVertex(l,r),n.cell.setVertexAt(r,l,{ui:!0,toolId:this.cid}),e.updatePosition(l.x,l.y),this.options.stopPropagation||n.notifyMouseMove(i,o,s)}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)return void this.stopBatch(this.eventData(e).vertexAdded);n.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(e).vertexAdded);let{e:r,x:i,y:o}=this.getMouseEventArgs(e);if(!this.options.stopPropagation){n.notifyMouseUp(r,i,o);let{start:e}=this.eventData(r);if(e){let{x:t,y:s}=e;t===i&&s===o&&n.onClick(r,i,o)}}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,o=r.next;Math.abs(e.x-i.x)<n?e.x=i.x:Math.abs(e.x-o.x)<n&&(e.x=o.x),Math.abs(e.y-i.y)<n?e.y=r.prev.y:Math.abs(e.y-o.y)<n&&(e.y=o.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||ti.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 o=this.handles[i];this.eventData(n,{vertexAdded:!0}),o.onMouseDown(n)}onRemove(){this.resetHandles()}}(em=d7||(d7={})).Handle=class extends dq{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=dq.createElement("circle",!0);let e=this.options.attrs;if("function"==typeof e){let t=em.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);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:e,handle:this}))}onMouseMove(e){this.emit("changing",{e:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(e){this.emit("remove",{e:e,handle:this})}};var fe=d7||(d7={});let ft=dl.prefix("edge-tool-vertex-path");fe.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:e=>new fe.Handle(e),markup:[{tagName:"path",selector:"connection",className:ft,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${ft}`]:"onPathMouseDown",[`touchstart .${ft}`]:"onPathMouseDown"}});class fn extends dZ.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){lQ(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,o=this.cellView.cell.getVertices(),s=o[i-2]||n.sourceAnchor,l=o[i+1]||n.targetAnchor,a=this.options.snapRadius;return Math.abs(t[r]-s[r])<a?t[r]=s[r]:Math.abs(t[r]-l[r])<a&&(t[r]=l[r]),t}onHandleChanging({handle:e,e:t}){let n=this.graph,r=this.options,i=this.cellView,o=r.anchor,s=e.options.axis,l=e.options.index-1,a=this.getEventData(t),u=this.normalizeEvent(t),c=n.snapToGrid(u.clientX,u.clientY),h=this.snapHandle(e,c.clone(),a),d=of(this.vertices),f=d[l],g=d[l+1],p=i.sourceView,m=i.sourceBBox,y=!1,b=!1;if(f?0===l?m.containsPoint(f)?(d.shift(),this.shiftHandleIndexes(-1),y=!0):(f[s]=h[s],b=!0):f[s]=h[s]:((f=i.sourceAnchor.toJSON())[s]=h[s],m.containsPoint(f)?y=!0:(d.unshift(f),this.shiftHandleIndexes(1),b=!0)),"function"==typeof o&&p){if(y){let e=a.sourceAnchor.clone();e[s]=h[s];let t=nx(o,i,e,p,i.sourceMagnet||p.container,"source",i,this);this.resetAnchor("source",t)}b&&this.resetAnchor("source",a.sourceAnchorDef)}let v=i.targetView,x=i.targetBBox,w=!1,C=!1;if(g?l===d.length-2?x.containsPoint(g)?(d.pop(),w=!0):(g[s]=h[s],C=!0):g[s]=h[s]:((g=i.targetAnchor.toJSON())[s]=h[s],x.containsPoint(g)?w=!0:(d.push(g),C=!0)),"function"==typeof o&&v){if(w){let e=a.targetAnchor.clone();e[s]=h[s];let t=nx(o,i,e,v,i.targetMagnet||v.container,"target",i,this);this.resetAnchor("target",t)}C&&this.resetAnchor("target",a.targetAnchorDef)}ci.equalPoints(d,this.vertices)||this.cellView.cell.setVertices(d,{ui:!0,toolId:this.cid}),this.updateHandle(e,f,g,0),r.stopPropagation||i.notifyMouseMove(u,c.x,c.y)}onHandleChange({handle:e,e:t}){let n=this.options,r=this.handles,i=this.cellView,o=e.options.index;if(Array.isArray(r)){for(let e=0,t=r.length;e<t;e+=1)e!==o&&r[e].hide();if(this.focus(),this.setEventData(t,{sourceAnchor:i.sourceAnchor.clone(),targetAnchor:i.targetAnchor.clone(),sourceAnchorDef:of(this.cell.prop(["source","anchor"])),targetAnchorDef:of(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,o=Math.abs(t.x-n.x)<i,s=Math.abs(t.y-n.y)<i;if(o||s){let i=new ca(t,n);if(i.length()<this.options.threshold)e.hide();else{let t=i.getCenter(),n=o?"x":"y";t[n]+=r||0;let s=i.vector().vectorAngle(new ci(1,0));e.updatePosition(t.x,t.y,s,this.cellView),e.show(),e.options.axis=n}}else e.hide()}onRemove(){this.resetHandles()}}(ey=fn||(fn={})).Handle=class extends dq{constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=dq.createElement("rect",!0);let e=this.options.attrs;if("function"==typeof e){let t=ey.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(e,t,n,r){let i=r.getClosestPoint(new ci(e,t))||new ci(e,t),o=uf().translate(i.x,i.y);if(i.equals({x:e,y:t}))o=o.rotate(n);else{let n=new ca(e,t,i.x,i.y).vector().vectorAngle(new ci(1,0));0!==n&&(n+=90),o=o.rotate(n)}this.setAttrs({transform:um(o),cursor:n%180==0?"row-resize":"col-resize"})}onMouseDown(e){this.options.guard(e)||(this.trigger("change",{e: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:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}},(eb=fn||(fn={})).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:e=>new eb.Handle(e),anchor:d5});class fr extends dZ.ToolItem{get type(){return this.options.type}onRender(){lQ(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,o=r.getTerminalAnchor(n),s=r.cell.prop([n,"anchor"]);t.setAttribute("transform",`translate(${o.x}, ${o.y})`);let l=s?i.customAnchorAttrs:i.defaultAnchorAttrs;l&&Object.keys(l).forEach(e=>{t.setAttribute(e,l[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,o,s,l=i.cell,a=r.getTerminalMagnet(n),u=this.options.areaPadding||0;Number.isFinite(u)||(u=0),i.isEdgeElement(a)?(e=i.getBBox(),o=0,s=e.getCenter()):(e=i.getUnrotatedBBoxOfElement(a),o=l.getAngle(),s=e.getCenter(),o&&s.rotate(-o,l.getBBox().getCenter())),e.inflate(u),aC(t,{x:-e.width/2,y:-e.height/2,width:e.width,height:e.height,transform:`translate(${s.x}, ${s.y}) rotate(${o})`})}}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,n=this.type,r=this.cellView,i=r.getTerminalView(n);if(null==i)return;let o=this.normalizeEvent(e),s=i.cell,l=r.getTerminalMagnet(n),a=this.graph.coord.clientToLocalPoint(o.clientX,o.clientY),u=this.options.snap;if("function"==typeof u){let e=nx(u,r,a,i,l,n,r,this);a=ci.create(e)}if(this.options.restrictArea)if(i.isEdgeElement(l)){let e=i.getClosestPoint(a);e&&(a=e)}else{let e=i.getUnrotatedBBoxOfElement(l),t=s.getAngle(),n=s.getBBox().getCenter(),r=a.clone().rotate(t,n);e.containsPoint(r)||(a=e.getNearestPointToPoint(r).rotate(-t,n))}let c=this.options.anchor;"function"==typeof c&&(t=nx(c,r,a,i,l,n,r,this)),this.resetAnchor(t),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(!0===e?void 0:e),this.update()}}(fr||(fr={})).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:d5,snap(e,t,n,r,i,o){let s=o.options.snapRadius||0,l="source"===r,a=this.cell.getVertexAt(l?0:-1)||this.getTerminalAnchor(l?"target":"source");return a&&(Math.abs(a.x-e.x)<s&&(e.x=a.x),Math.abs(a.y-e.y)<s&&(e.y=a.y)),e}});let fi=fr.define({name:"source-anchor",type:"source"}),fo=fr.define({name:"target-anchor",type:"target"});var fs=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class fl extends dZ.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=fs(e,["class"]);this.setAttrs(n,this.container),t&&lQ(this.container,t)}}onRender(){lQ(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 ci(1,0))||0;if(!r)return this;let o=uf().translate(r.x,r.y).rotate(i);return uE(this.container,o,{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})}}(fl||(fl={})).config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}});let fa=fl.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"}}),fu=fl.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"}});class fc extends dZ.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=dZ.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),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=ci.create(),i=20,o="",{x:s,y:l}=this.options,{width:a,height:u}=this.options;if(void 0!==s&&void 0!==l){let e=t.getBBox();s=lS(s,e.width),l=lS(l,e.height),r=e.topLeft.translate(s,l),i=e.width-2*s}else{let e=t.getBBox();r=e.center,i=e.width-4,o="translate(-50%, -50%)"}let c=e.scale(),{style:h}=n;r=e.localToGraph(r),h.left=`${r.x}px`,h.top=`${r.y}px`,h.transform=`scale(${c.sx}, ${c.sy}) ${o}`,h.minWidth=`${i}px`,"number"==typeof a&&(h.width=`${a}px`),"number"==typeof u&&(h.height=`${u}px`)}updateEdgeEditorTransform(){if(!this.event)return;let{graph:e,editor:t}=this;if(!t)return;let n=ci.create(),r=20,{style:i}=t,o=this.event.target,s=o.parentElement;if(s&&lY(s,this.prefixClassName("edge-label"))){let e=s.getAttribute("data-index")||"0";this.labelIndex=parseInt(e,10);let{translation:t}=uy(s.getAttribute("transform"));n=new ci(t.tx,t.ty),r=tf.getBBox(o).width}else{if(!this.options.labelAddable)return this;n=e.clientToLocal(ci.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 l=e.scale();i.left=`${n.x}px`,i.top=`${n.y}px`,i.minWidth=`${r}px`,i.transform=`scale(${l.sx}, ${l.sy}) translate(-50%, -50%)`}onDocumentMouseUp(e){if(this.editor&&e.target!==this.editor){let e=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(""!==e?e:null),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("function"==typeof e)return nx(e,this.cellView,{cell:this.cell,index:this.labelIndex});if("string"==typeof e){if(this.cell.isNode())return this.cell.attr(e);if(this.cell.isEdge()&&-1!==this.labelIndex)return this.cell.prop(`labels/${this.labelIndex}/attrs/${e}`)}}setCellText(e){let t=this.options.setText;if("function"==typeof t)return void nx(t,this.cellView,{cell:this.cell,value:e,index:this.labelIndex,distance:this.distance});if("string"==typeof t){if(this.cell.isNode()){null!==e&&this.cell.attr(t,e);return}if(this.cell.isEdge()){let n=this.cell;if(-1===this.labelIndex){if(e){let r={position:{distance:this.distance},attrs:{}};oX(r,`attrs/${t}`,e),n.appendLabel(r)}}else null!==e?n.prop(`labels/${this.labelIndex}/attrs/${t}`,e):"number"==typeof this.labelIndex&&n.removeLabelAt(this.labelIndex)}}}onRemove(){let e=this.cellView;e&&e.off("cell:dblclick",this.dblClick),this.removeElement()}}(fc||(fc={})).config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}}),(ev=fc||(fc={})).NodeEditor=ev.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),ev.EdgeEditor=ev.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"});var fh=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};(ex=tw||(tw={})).presets={boundary:d8,button:d4,"button-remove":d4.Remove,"node-editor":fc.NodeEditor},ex.registry=cA.create({type:"node tool",process(e,t){if("function"==typeof t)return t;let n=dZ.ToolItem,{inherit:r}=t,i=fh(t,["inherit"]);if(r){let e=this.get(r);null==e?this.onNotFound(r,"inherited"):n=e}return null==i.name&&(i.name=e),n.define.call(n,i)}}),ex.registry.register(ex.presets,!0),(ew=tC||(tC={})).presets={boundary:d8,vertices:d7,segments:fn,button:d4,"button-remove":d4.Remove,"source-anchor":fi,"target-anchor":fo,"source-arrowhead":fa,"target-arrowhead":fu,"edge-editor":fc.EdgeEditor},ew.registry=cA.create({type:"edge tool",process(e,t){if("function"==typeof t)return t;let n=dZ.ToolItem,{inherit:r}=t,i=fh(t,["inherit"]);if(r){let e=this.get(r);null==e?this.onNotFound(r,"inherited"):n=e}return null==i.name&&(i.name=e),n.define.call(n,i)}}),ew.registry.register(ew.presets,!0);let fd=fw("center"),ff=fw("topCenter"),fg=fw("bottomCenter"),fp=fw("leftMiddle"),fm=fw("rightMiddle"),fy=fw("topLeft"),fb=fw("topRight"),fv=fw("bottomLeft"),fx=fw("bottomRight");function fw(e){return function(t,n,r,i={}){let o=i.rotate?t.getUnrotatedBBoxOfElement(n):t.getBBoxOfElement(n),s=o[e];s.x+=lS(i.dx,o.width),s.y+=lS(i.dy,o.height);let l=t.cell;return i.rotate?s.rotate(-l.getAngle(),l.getBBox().getCenter()):s}}function fC(e){return function(t,n,r,i){if(r instanceof Element){let o,s=this.graph.findViewByElem(r);return o=s?s.isEdgeElement(r)?fE(s,null!=i.fixedAt?i.fixedAt:"50%"):s.getBBoxOfElement(r).getCenter():new ci,e.call(this,t,n,o,i)}return e.apply(this,arguments)}}function fE(e,t){let n=lE(t),r="string"==typeof t?parseFloat(t):t;return n?e.getPointAtRatio(r/100):e.getPointAtLength(r)}let fS=fC(function(e,t,n,r){let i=e.cell.getAngle(),o=e.getBBoxOfElement(t),s=o.getCenter(),l=o.getTopLeft(),a=o.getBottomRight(),u=r.padding;if(Number.isFinite(u)||(u=0),l.y+u<=n.y&&n.y<=a.y-u){let e=n.y-s.y;s.x+=0===i||180===i?0:+e/Math.tan(tl.toRad(i)),s.y+=e}else if(l.x+u<=n.x&&n.x<=a.x-u){let e=n.x-s.x;s.y+=90===i||270===i?0:e*Math.tan(tl.toRad(i)),s.x+=e}return s}),fP=function(e,t,n,r,i){let o=e.cell.getConnectionPoint(this.cell,i);return(r.dx||r.dy)&&o.translate(r.dx||0,r.dy||0),o},fk=fC(function(e,t,n,r){let i,o,s,l=0,a=e.cell;r.rotate?(i=e.getUnrotatedBBoxOfElement(t),o=a.getBBox().getCenter(),l=a.getAngle()):i=e.getBBoxOfElement(t);let u=r.padding;null!=u&&Number.isFinite(u)&&i.inflate(u),r.rotate&&n.rotate(l,o);let c=i.getNearestSideToPoint(n);switch(c){case"left":s=i.getLeftMiddle();break;case"right":s=i.getRightMiddle();break;case"top":s=i.getTopCenter();break;case"bottom":s=i.getBottomCenter()}let h=r.direction;return"H"===h?("top"===c||"bottom"===c)&&(s=n.x<=i.x+i.width?i.getLeftMiddle():i.getRightMiddle()):"V"===h&&(s=n.y<=i.y+i.height?i.getTopCenter():i.getBottomCenter()),r.rotate?s.rotate(-l,o):s});(eC=tE||(tE={})).presets=tW,eC.registry=cA.create({type:"node endpoint"}),eC.registry.register(eC.presets,!0);let fO=function(e,t,n,r){let i=null!=r.ratio?r.ratio:.5;return i>1&&(i/=100),e.getPointAtRatio(i)},fM=function(e,t,n,r){let i=null!=r.length?r.length:20;return e.getPointAtLength(i)},fA=function(e,t,n,r){let i=e.getClosestPoint(n);return null!=i?i:new ci},fT=fC(fA),fN=fC(function(e,t,n,r){let i=e.getConnection(),o=e.getConnectionSubdivisions(),s=new ca(n.clone().translate(0,1e6),n.clone().translate(0,-1e6)),l=new ca(n.clone().translate(1e6,0),n.clone().translate(-1e6,0)),a=s.intersect(i,{segmentSubdivisions:o}),u=l.intersect(i,{segmentSubdivisions:o}),c=[];return(a&&c.push(...a),u&&c.push(...u),c.length>0)?n.closest(c):null!=r.fallbackAt?fE(e,r.fallbackAt):nx(fA,this,e,t,n,r)});function fj(e,t,n){let r;if("object"==typeof n){if(Number.isFinite(n.y)){let{start:r,end:i}=new ca(t,e).parallel(n.y);t=r,e=i}r=n.x}else r=n;if(null==r||!Number.isFinite(r))return e;let i=e.distance(t);return 0===r&&i>0?e:e.move(t,-Math.min(r,i-1))}function fL(e){let t=e.getAttribute("stroke-width");return null===t?0:parseFloat(t)||0}(eE=tS||(tS={})).presets=tJ,eE.registry=cA.create({type:"edge endpoint"}),eE.registry.register(eE.presets,!0);let fR=function(e,t,n,r){let i=t.getBBoxOfElement(n);r.stroked&&i.inflate(fL(n)/2);let o=e.intersect(i);return fj(o&&o.length?e.start.closest(o):e.end,e.start,r.offset)},fI=function(e,t,n,r,i){let o=t.cell,s=o.isNode()?o.getAngle():0;if(0===s)return nx(fR,this,e,t,n,r,i);let l=t.getUnrotatedBBoxOfElement(n);r.stroked&&l.inflate(fL(n)/2);let a=l.getCenter(),u=e.clone().rotate(s,a),c=u.setLength(1e6).intersect(l);return fj(c&&c.length?u.start.closest(c).rotate(-s,a):e.end,e.start,r.offset)},f_=function(e,t,n,r){let i,o,s,l=e.end,a=r.selector;if(!l3(i="string"==typeof a?t.findOne(a):Array.isArray(a)?oJ(n,a):function(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if("G"===(e=e.toUpperCase()))t=t.firstElementChild;else if("TITLE"===e)t=t.nextElementSibling;else break}while(t);return t}(n))){if(i===n||!l3(n))return l;i=n}let u=t.getShapeOfElement(i),c=t.getMatrixOfElement(i),h=t.getRootTranslatedMatrix(),d=t.getRootRotatedMatrix(),f=h.multiply(d).multiply(c),g=f.inverse(),p=tf.transformLine(e,g),m=p.start.clone(),y=t.getDataOfElement(i);if(!1===r.insideout){null==y.shapeBBox&&(y.shapeBBox=u.bbox());let e=y.shapeBBox;if(null!=e&&e.containsPoint(m))return l}if(!0===r.extrapolate&&p.setLength(1e6),ck.isPath(u)){let e=r.precision||2;null==y.segmentSubdivisions&&(y.segmentSubdivisions=u.getSegmentSubdivisions({precision:e})),s={precision:e,segmentSubdivisions:y.segmentSubdivisions},o=p.intersect(u,s)}else o=p.intersect(u);o?Array.isArray(o)&&(o=m.closest(o)):!0===r.sticky&&(o=co.isRectangle(u)?u.getNearestPointToPoint(m):cu.isEllipse(u)?u.intersectsWithLineFromCenterToPoint(m):u.closestPoint(m,s));let b=o?tf.transformPoint(o,f):l,v=r.offset||0;return!1!==r.stroked&&("object"==typeof v?(null==(v=Object.assign({},v)).x&&(v.x=0),v.x+=fL(i)/2):v+=fL(i)/2),fj(b,e.start,v)},fz=function(e,t,n,r){let{alignOffset:i,align:o}=r;return o&&function(e,t,n=0){let r,i,o,s,{start:l,end:a}=e;switch(t){case"left":s="x",r=a,i=l,o=-1;break;case"right":s="x",r=l,i=a,o=1;break;case"top":s="y",r=a,i=l,o=-1;break;case"bottom":s="y",r=l,i=a,o=1;break;default:return}l[s]<a[s]?r[s]=i[s]:i[s]=r[s],Number.isFinite(n)&&(r[s]+=o*n,i[s]+=o*n)}(e,o,i),fj(e.end,e.start,r.offset)};(eS=tP||(tP={})).presets=tX,eS.registry=cA.create({type:"connection point"}),eS.registry.register(eS.presets,!0);let fD=function(e){return[...e]},fB=function(e,t,n){let r,i,o,s=t.side||"bottom",l=lk(t.padding||40),a=n.sourceBBox,u=n.targetBBox,c=a.getCenter(),h=u.getCenter();switch(s){case"top":o=-1,r="y",i="height";break;case"left":o=-1,r="x",i="width";break;case"right":o=1,r="x",i="width";break;default:o=1,r="y",i="height"}return c[r]+=o*(a[i]/2+l[s]),h[r]+=o*(u[i]/2+l[s]),o*(c[r]-h[r])>0?h[r]=c[r]:c[r]=h[r],[c.toJSON(),...e,h.toJSON()]};function fV(e){return new co(e.x,e.y,0,0)}function fF(e={}){let t=lk(e.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function f$(e,t={}){return e.sourceBBox.clone().moveAndExpand(fF(t))}function fU(e,t={}){return e.targetBBox.clone().moveAndExpand(fF(t))}let fG=function(e,t,n){let r=f$(n,t),i=fU(n,t),o=function(e,t={}){return e.sourceAnchor?e.sourceAnchor:f$(e,t).getCenter()}(n,t),s=function(e,t={}){return e.targetAnchor?e.targetAnchor:fU(e,t).getCenter()}(n,t);r=r.union(fV(o)),i=i.union(fV(s));let l=e.map(e=>ci.create(e));l.unshift(o),l.push(s);let a=null,u=[];for(let e=0,n=l.length-1;e<n;e+=1){let o=null,s=l[e],c=l[e+1],h=null!=tk.getBearing(s,c);if(0===e)e+1===n?r.intersectsWithRect(i.clone().inflate(1))?o=tk.insideNode(s,c,r,i):h||(o=tk.nodeToNode(s,c,r,i)):r.containsPoint(c)?o=tk.insideNode(s,c,r,fV(c).moveAndExpand(fF(t))):h||(o=tk.nodeToVertex(s,c,r));else if(e+1===n){let e=h&&tk.getBearing(c,s)===a;i.containsPoint(s)||e?o=tk.insideNode(s,c,fV(s).moveAndExpand(fF(t)),i,a):h||(o=tk.vertexToNode(s,c,i,a))}else h||(o=tk.vertexToVertex(s,c,a));o?(u.push(...o.points),a=o.direction):a=tk.getBearing(s,c),e+1<n&&u.push(c)}return u};!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 ci(e.x,t.y);return n.containsPoint(r)&&(r=new ci(t.x,e.y)),r}function i(e,t){return e["W"===t||"E"===t?"width":"height"]}function o(e,t){return e.x===t.x?e.y>t.y?"N":"S":e.y===t.y?e.x>t.x?"W":"E":null}function s(e,n,r){let i=new ci(e.x,n.y),s=new ci(n.x,e.y),l=o(e,i),a=o(e,s),u=r?t[r]:null,c=l===r||l!==u&&(a===u||a!==r)?i:s;return{points:[c],direction:o(c,n)}}function l(e,t,n){let i=r(e,t,n);return{points:[i],direction:o(i,t)}}e.getBBoxSize=i,e.getBearing=o,e.vertexToVertex=s,e.nodeToVertex=l,e.vertexToNode=function(e,t,n,s){let l,a=[new ci(e.x,t.y),new ci(t.x,e.y)],u=a.filter(e=>!n.containsPoint(e)),c=u.filter(t=>o(t,e)!==s);if(c.length>0)return{points:[l=(l=c.filter(t=>o(e,t)===s).pop())||c[0]],direction:o(l,t)};{l=sx(a,u)[0];let c=ci.create(t).move(l,-i(n,s)/2);return{points:[r(c,e,n),c],direction:o(c,t)}}},e.nodeToNode=function(e,t,n,r){let a=l(t,e,r),u=a.points[0];if(n.containsPoint(u)){let c=(a=l(e,t,n)).points[0];if(r.containsPoint(c)){let h=ci.create(e).move(c,-i(n,o(e,c))/2),d=ci.create(t).move(u,-i(r,o(t,u))/2),f=new ca(h,d).getCenter(),g=l(e,f,n),p=s(f,t,g.direction);a.points=[g.points[0],p.points[0]],a.direction=p.direction}}return a},e.insideNode=function(e,t,i,s,l){let a,u,c,h,d=i.union(s).inflate(1),f=d.getCenter(),g=f.distance(t)>f.distance(e),p=g?t:e,m=g?e:t;return l?(a=ci.fromPolar(d.width+d.height,n[l],p),a=d.getNearestPointToPoint(a).move(a,-1)):a=d.getNearestPointToPoint(p).move(p,1),u=r(a,m,d),a.round().equals(u.round())?(u=ci.fromPolar(d.width+d.height,tl.toRad(a.theta(p))+Math.PI/2,m),c=r(a,u=d.getNearestPointToPoint(u).move(m,1).round(),d),h=g?[u,c,a]:[a,c,u]):h=g?[u,a]:[a,u],{points:h,direction:g?o(a,t):o(u,t)}}}(tk||(tk={}));let fH={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 fq(this.step,this)},directions(){let e=fq(this.step,this),t=fq(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=fq(this.step,this);return{0:0,45:e/2,90:e/2}},paddingBox(){let e=fq(this.step,this);return{x:-e,y:-e,width:2*e,height:2*e}},fallbackRouter:fG,draggingRouter:null,snapToGrid:!0};function fq(e,t){return"function"==typeof e?e.call(t):e}class fW{constructor(){this.items=[],this.hash={},this.values={}}add(e,t){this.hash[e]?this.items.splice(this.items.indexOf(e),1):this.hash[e]=1,this.values[e]=t;let n=sg(this.items,e,e=>this.values[e]);this.items.splice(n,0,e)}pop(){let e=this.items.shift();return e&&(this.hash[e]=2),e}isOpen(e){return 1===this.hash[e]}isClose(e){return 2===this.hash[e]}isEmpty(){return 0===this.items.length}}class fJ{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=[],o=e.getCell(t.getSourceCellId());o&&(i=sp(i,o.getAncestors().map(e=>e.id)));let s=e.getCell(t.getTargetCellId());s&&(i=sp(i,s.getAncestors().map(e=>e.id)));let l=this.mapGridSize;return e.getNodes().reduce((e,t)=>{let o=r.some(e=>e.id===t.id),s=!!t.shape&&n.excludeShapes.includes(t.shape),a=n.excludeNodes.some(e=>"string"==typeof e?t.id===e:e===t),u=i.includes(t.id);if(t.isVisible()&&!(s||o||a||u)){let r=t.getBBox().moveAndExpand(n.paddingBox),i=r.getOrigin().snapToGrid(l),o=r.getCorner().snapToGrid(l);for(let t=i.x;t<=o.x;t+=l)for(let n=i.y;n<=o.y;n+=l){let i=new ci(t,n).toString();null==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 fX(e,t){let n=e.sourceBBox.clone();return t&&t.paddingBox?n.moveAndExpand(t.paddingBox):n}function fY(e,t){let n=e.targetBBox.clone();return t&&t.paddingBox?n.moveAndExpand(t.paddingBox):n}function fQ(e,t){return e.sourceAnchor?e.sourceAnchor:fX(e,t).getCenter()}function fZ(e,t,n,r,i){let o=360/n,s=e.theta(function(e,t,n,r){let i=r.step,o=t.x-e.x,s=t.y-e.y,l=o/n.x,a=s/n.y;return new ci(e.x+l*i,e.y+a*i)}(e,t,r,i)),l=tl.normalize(s+o/2);return o*Math.floor(l/o)}function fK(e,t){let n=Math.abs(e-t);return n>180?360-n:n}function f0(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 f1(e,t){return e.round(t)}function f2(e,t,n){return f1(function(e,t){let n=t.source,r=ta.snapToGrid(e.x-n.x,t.x)+n.x,i=ta.snapToGrid(e.y-n.y,t.y)+n.y;return new ci(r,i)}(e.clone(),t),n)}function f3(e){return e.toString()}function f5(e){return new ci(0===e.x?0:Math.abs(e.x)/e.x,0===e.y?0:Math.abs(e.y)/e.y)}function f6(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 f4(e,t,n,r,i){let o=i.precision,s=i.directionMap,l=e.diff(t.getCenter()),a=Object.keys(s).reduce((i,a)=>{if(n.includes(a)){let n,u=s[a],c=new ci(e.x+u.x*(Math.abs(l.x)+t.width),e.y+u.y*(Math.abs(l.y)+t.height)),h=new ca(e,c).intersect(t)||[],d=null;for(let t=0;t<h.length;t+=1){let r=h[t],i=e.squaredDistance(r);(null==n||i>n)&&(n=i,d=r)}if(d){let e=f2(d,r,o);t.containsPoint(e)&&(e=f2(e.translate(u.x*r.x,u.y*r.y),r,o)),i.push(e)}}return i},[]);return t.containsPoint(e)||a.push(f2(e,r,o)),a}let f9=function(e,t,n){let r,i,o=function(e){let t=Object.keys(e).reduce((t,n)=>("fallbackRouter"===n||"draggingRouter"===n||"fallbackRoute"===n?t[n]=e[n]:t[n]=fq(e[n],e),t),{});if(t.padding){let e=lk(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 ci(0,0),n=new ci(e.offsetX,e.offsetY);e.angle=tl.normalize(t.theta(n))}),t}(t),s=fX(n,o),l=fY(n,o),a=fQ(n,o),u=new fJ(o).build(n.graph.model,n.cell),c=e.map(e=>ci.create(e)),h=[],d=a;for(let t=0,f=c.length;t<=f;t+=1){let f=null;if(r=i||s,null==(i=c[t])){i=l;let e=n.cell;if((null==e.getSourceCellId()||null==e.getTargetCellId())&&"function"==typeof o.draggingRouter){let e=r===s?a:r,t=i.getOrigin();f=nx(o.draggingRouter,n,e,t,o)}}if(null==f&&(f=function(e,t,n,r,i){var o,s;let l,a,u,c,h=i.precision;l=co.isRectangle(t)?f1(fQ(e,i).clone(),h):f1(t.clone(),h),a=co.isRectangle(n)?f1((e.targetAnchor?e.targetAnchor:fY(e,i).getCenter()).clone(),h):f1(n.clone(),h);let d=(o=i.step,s=a,{source:l.clone(),x:f0(s.x-l.x,o),y:f0(s.y-l.y,o)}),f=a;if(u=co.isRectangle(t)?f4(l,t,i.startDirections,d,i):[l],c=co.isRectangle(n)?f4(a,n,i.endDirections,d,i):[f],u=u.filter(e=>r.isAccessible(e)),c=c.filter(e=>r.isAccessible(e)),u.length>0&&c.length>0){let e,t,n=new fW,o={},s={},a={};for(let e=0,t=u.length;e<t;e+=1){let t=u[e],r=f3(t);n.add(r,f6(t,c)),o[r]=t,a[r]=0}let g=i.previousDirectionAngle,p=void 0===g,m=function(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}(d,i),y=m.length,b=c.reduce((e,t)=>{let n=f3(t);return e.push(n),e},[]),v=ci.equalPoints(u,c),x=i.maxLoopCount;for(;!n.isEmpty()&&x>0;){let u,w=n.pop(),C=o[w],E=s[w],S=a[w],P=C.equals(l),k=null==E;if(u=k?p?P?null:fZ(l,C,y,d,i):g:fZ(E,C,y,d,i),!(k&&v)&&b.indexOf(w)>=0)return i.previousDirectionAngle=u,function(e,t,n,r,i){let o,s=[],l=f5(i.diff(n)),a=f3(n),u=e[a];for(;u;){let n=f5((o=t[a]).diff(u));n.equals(l)||(s.unshift(o),l=n),u=e[a=f3(u)]}let c=t[a];return f5(c.diff(r)).equals(l)||s.unshift(c),s}(s,o,C,l,f);for(let l=0;l<y;l+=1){let g=(e=m[l]).angle;if(t=fK(u,g),!(p&&P)&&t>i.maxDirectionChange)continue;let v=f2(C.clone().translate(e.gridOffsetX||0,e.gridOffsetY||0),d,h),x=f3(v);if(n.isClose(x)||!r.isAccessible(v)||b.indexOf(x)>=0&&!v.equals(f)&&fK(g,fZ(v,f,y,d,i))>i.maxDirectionChange)continue;let w=S+e.cost+(P?0:i.penalties[t]);(!n.isOpen(x)||w<a[x])&&(o[x]=v,s[x]=C,a[x]=w,n.add(x,w+f6(v,c)))}x-=1}}return i.fallbackRoute?nx(i.fallbackRoute,this,l,f,i):null}(n,r,i,u,o)),null===f)return console.warn("Unable to execute manhattan algorithm, use orth instead"),nx(o.fallbackRouter,this,e,o,n);let g=f[0];g&&g.equals(d)&&f.shift(),d=f[f.length-1]||d,h.push(...f)}return o.snapToGrid?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}(h,n.graph.grid.getGridSize()):h},f8=function(e,t,n){return nx(f9,this,e,Object.assign(Object.assign({},fH),t),n)},f7={maxDirectionChange:45,directions(){let e=fq(this.step,this),t=fq(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=[],o={x:t.x,y:e.y},s={x:e.x,y:t.y};if(r%180>90){let e=o;o=s,s=e}let l=r%90<45?o:s,a=new ca(e,l),u=90*Math.ceil(r/90),c=ci.fromPolar(a.squaredLength(),tl.toRad(u+135),l),h=new ca(t,c),d=a.intersectsWithLine(h),f=d||t,g=d?f:e,p=360/n.directions.length,m=g.theta(t),y=tl.normalize(m+p/2);return n.previousDirectionAngle=p*Math.floor(y/p),f&&i.push(f.round()),i.push(t),i}},ge=function(e,t,n){return nx(f8,this,e,Object.assign(Object.assign({},f7),t),n)},gt=function(e,t,n){let r,i,o,s=t.offset||32,l=null==t.min?16:t.min,a=0,u=t.direction,c=n.sourceBBox,h=n.targetBBox,d=c.getCenter(),f=h.getCenter();if("number"==typeof s&&(a=s),null==u){let e=h.left-c.right,t=h.top-c.bottom;e>=0&&t>=0?u=e>=t?"L":"T":e<=0&&t>=0?u=(e=c.left-h.right)>=0&&e>=t?"R":"T":e>=0&&t<=0?u=(t=c.top-h.bottom)>=0?e>=t?"L":"B":"L":(e=c.left-h.right,t=c.top-h.bottom,u=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")}"H"===u?u=f.x-d.x>=0?"L":"R":"V"===u&&(u=f.y-d.y>=0?"T":"B"),"center"===s&&("L"===u?a=(h.left-c.right)/2:"R"===u?a=(c.left-h.right)/2:"T"===u?a=(h.top-c.bottom)/2:"B"===u&&(a=(c.top-h.bottom)/2));let g="L"===u||"R"===u;if(g){if(f.y===d.y)return[...e];o="L"===u?1:-1,r="x",i="width"}else{if(f.x===d.x)return[...e];o="T"===u?1:-1,r="y",i="height"}let p=d.clone(),m=f.clone();if(p[r]+=o*(c[i]/2+a),m[r]-=o*(h[i]/2+a),g){let e=p.x,t=m.x,n=c.width/2+l,r=h.width/2+l;f.x>d.x?t<=e&&(p.x=Math.max(t,d.x+n),m.x=Math.min(e,f.x-r)):t>=e&&(p.x=Math.min(t,d.x-n),m.x=Math.max(e,f.x+r))}else{let e=p.y,t=m.y,n=c.height/2+l,r=h.height/2+l;f.y>d.y?t<=e&&(p.y=Math.max(t,d.y+n),m.y=Math.min(e,f.y-r)):t>=e&&(p.y=Math.min(t,d.y-n),m.y=Math.max(e,f.y+r))}return[p.toJSON(),...e,m.toJSON()]};function gn(e,t){if(null!=t&&!1!==t){let n="boolean"==typeof t?0:t;if(n>0){let t=ci.create(e[1]).move(e[2],n),r=ci.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}let gr=function(e,t,n){let r=t.width||50,i=(t.height||80)/2,o=t.angle||"auto",s=n.sourceAnchor,l=n.targetAnchor,a=n.sourceBBox,u=n.targetBBox;if(s.equals(l)){let e=e=>{let t=tl.toRad(e),n=Math.sin(t),o=Math.cos(t),l=new ci(s.x+o*r,s.y+n*r),a=new ci(l.x-o*i,l.y-n*i),u=a.clone().rotate(-90,l),c=a.clone().rotate(90,l);return[u.toJSON(),l.toJSON(),c.toJSON()]},n=e=>{let t=s.clone().move(e,-1),n=new ca(t,e);return!a.containsPoint(e)&&!a.intersectsWithLine(n)},l=[0,90,180,270,45,135,225,315];if("number"==typeof o)return gn(e(o),t.merge);let u=a.getCenter();if(u.equals(s))return gn(e(0),t.merge);let c=u.angleBetween(s,u.clone().translate(1,0)),h=e(c);if(n(h[1]))return gn(h,t.merge);for(let t=1,r=l.length;t<r&&!n((h=e(c+l[t]))[1]);t+=1);return gn(h,t.merge)}{let e=new ca(s,l),o=e.parallel(-r),c=o.getCenter(),h=o.start.clone().move(o.end,i),d=o.end.clone().move(o.start,i),f=e.parallel(-1),g=new ca(f.start,c),p=new ca(f.end,c);if((a.containsPoint(c)||u.containsPoint(c)||a.intersectsWithLine(g)||a.intersectsWithLine(p)||u.intersectsWithLine(g)||u.intersectsWithLine(p))&&(c=(o=e.parallel(r)).getCenter(),h=o.start.clone().move(o.end,i),d=o.end.clone().move(o.start,i)),t.merge){let e=new ca(s,l),t=new ca(c,e.center).setLength(Number.MAX_SAFE_INTEGER),r=a.intersectsWithLine(t),i=u.intersectsWithLine(t),o=r?Array.isArray(r)?r:[r]:[];i&&(Array.isArray(i)?o.push(...i):o.push(i));let h=e.center.closest(o);h?(n.sourceAnchor=h.clone(),n.targetAnchor=h.clone()):(n.sourceAnchor=e.center.clone(),n.targetAnchor=e.center.clone())}return gn([h.toJSON(),c.toJSON(),d.toJSON()],t.merge)}};(eP=tO||(tO={})).presets=tY,eP.registry=cA.create({type:"router"}),eP.registry.register(eP.presets,!0);let gi=function(e,t,n,r={}){let i=[e,...n,t],o=new cp(i),s=new ck(o);return r.raw?s:s.serialize()},go=function(e,t,n,r={}){let i=+(3!==n.length),o=ci.create(n[0+i]),s=ci.create(n[2+i]),l=ci.create(n[1+i]);if(!ci.equals(e,t)){let n=new ci((e.x+t.x)/2,(e.y+t.y)/2),r=n.angleBetween(ci.create(e).rotate(90,n),l);r>1&&(o.rotate(180-r,n),s.rotate(180-r,n),l.rotate(180-r,n))}let a=`
|
|
268
268
|
M ${e.x} ${e.y}
|
|
269
269
|
Q ${o.x} ${o.y} ${l.x} ${l.y}
|
|
270
270
|
Q ${s.x} ${s.y} ${t.x} ${t.y}
|
|
271
|
-
`;return r.raw?ck.parse(a):a},gs=function(e,t,n,r={}){let i,o,s=new ck;s.appendSegment(ck.createSegment("M",e));let l=1/3,a=2/3,u=r.radius||10;for(let r=0,c=n.length;r<c;r+=1){let c=ci.create(n[r]),h=n[r-1]||e,d=n[r+1]||t;i=o||c.distance(h)/2,o=c.distance(d)/2;let f=-Math.min(u,i),g=-Math.min(u,o),p=c.clone().move(h,f).round(),m=c.clone().move(d,g).round(),y=new ci(l*p.x+a*c.x,a*c.y+l*p.y),b=new ci(l*m.x+a*c.x,a*c.y+l*m.y);s.appendSegment(ck.createSegment("L",p)),s.appendSegment(ck.createSegment("C",y,b,m))}return s.appendSegment(ck.createSegment("L",t)),r.raw?s:s.serialize()},gl=function(e,t,n,r={}){let i,o=r.direction;if(n&&0!==n.length){let r=[e,...n,t],o=cm.throughPoints(r);i=new ck(o)}else if((i=new ck).appendSegment(ck.createSegment("M",e)),o||(o=Math.abs(e.x-t.x)>=Math.abs(e.y-t.y)?"H":"V"),"H"===o){let n=(e.x+t.x)/2;i.appendSegment(ck.createSegment("C",n,e.y,n,t.y,t.x,t.y))}else{let n=(e.y+t.y)/2;i.appendSegment(ck.createSegment("C",e.x,n,t.x,n,t.x,t.y))}return r.raw?i:i.serialize()},ga=1/3,gu=2/3;function gc(e,t,n=[]){let r=[e,...n,t],i=[];return r.forEach((e,t)=>{let n=r[t+1];null!=n&&i.push(new ca(e,n))}),i}function gh(e,t){return new ca(e,t).squaredLength()}function gd(e,t,n,r){let o,s=new ck;return o=ck.createSegment("M",e[0].start),s.appendSegment(o),e.forEach((l,a)=>{if(i.includes(l)){let e,r,i,a;if("arc"===n){let t;e=-90,((r=l.start.diff(l.end)).x<0||0===r.x&&r.y<0)&&(e+=180);let n=l.getCenter(),u=new ca(n,l.end).rotate(e,n);i=(t=new ca(l.start,n)).pointAt(2/3).rotate(e,l.start),a=u.pointAt(1/3).rotate(-e,u.end),o=ck.createSegment("C",i,a,u.end),s.appendSegment(o),t=new ca(n,l.end),i=u.pointAt(1/3).rotate(e,u.end),a=t.pointAt(1/3).rotate(-e,l.end),o=ck.createSegment("C",i,a,l.end),s.appendSegment(o)}else if("gap"===n)o=ck.createSegment("M",l.end),s.appendSegment(o);else if("cubic"===n){e=l.start.theta(l.end);let n=.6*t,u=1.35*t;((r=l.start.diff(l.end)).x<0||0===r.x&&r.y<0)&&(u*=-1),i=new ci(l.start.x+n,l.start.y+u).rotate(e,l.start),a=new ci(l.end.x-n,l.end.y+u).rotate(e,l.end),o=ck.createSegment("C",i,a,l.end),s.appendSegment(o)}}else{let t=e[a+1];0===r||!t||i.includes(t)?(o=ck.createSegment("L",l.end),s.appendSegment(o)):function(e,t,n,r,i){let o,s=n.distance(r)/2,l=n.distance(i)/2,a=-Math.min(e,s),u=-Math.min(e,l),c=n.clone().move(r,a).round(),h=n.clone().move(i,u).round(),d=new ci(ga*c.x+gu*n.x,gu*n.y+ga*c.y),f=new ci(ga*h.x+gu*n.x,gu*n.y+ga*h.y);o=ck.createSegment("L",c),t.appendSegment(o),o=ck.createSegment("C",d,f,h),t.appendSegment(o)}(r,s,l.end,l.start,t.end)}}),s}let gf=function(e,t,n,r={}){i=[],o=[];var s=this;let l=s.graph._jumpOverUpdateList;if(null==l&&(l=s.graph._jumpOverUpdateList=[],s.graph.on("cell:mouseup",()=>{let e=s.graph._jumpOverUpdateList;setTimeout(()=>{for(let t=0;t<e.length;t+=1)e[t].update()})}),s.graph.on("model:reseted",()=>{l=s.graph._jumpOverUpdateList=[]})),0>l.indexOf(s)){l.push(s);let e=()=>l.splice(l.indexOf(s),1);s.cell.once("change:connector",e),s.cell.once("removed",e)}let a=r.size||5,u=r.type||"arc",c=r.radius||0,h=r.ignoreConnectors||["smooth"],d=this.graph,f=d.model.getEdges();if(1===f.length)return gd(gc(e,t,n),a,u,c);let g=this.cell,p=f.indexOf(g),m=d.options.connecting.connector||{},y=f.filter((e,t)=>{let n=e.getConnector()||m;return!h.includes(n.name)&&(!(t>p)||"jumpover"!==n.name)}),b=y.map(e=>d.findViewByCell(e)),v=gc(e,t,n),x=b.map(e=>null==e?[]:e===this?v:gc(e.sourcePoint,e.targetPoint,e.routePoints)),w=[];v.forEach(e=>{let t=y.reduce((t,n,r)=>{if(n!==g){let n=function(e,t){let n=[];return t.forEach(t=>{let r=e.intersectsWithLine(t);r&&n.push(r)}),n}(e,x[r]);t.push(...n)}return t},[]).sort((t,n)=>gh(e.start,t)-gh(e.start,n));if(t.length>0)w.push(...t.reduce((n,r,s)=>{if(o.includes(r))return n;let l=n.pop()||e,u=ci.create(r).move(l.start,-a),c=ci.create(r).move(l.start,+a),h=t[s+1];if(null!=h){let e=c.distance(h);e<=a&&(c=h.move(l.start,e),o.push(h))}else if(u.distance(l.end)<2*a+1)return n.push(l),n;if(c.distance(l.start)<2*a+1)return n.push(l),n;let d=new ca(u,c);return i.push(d),n.push(new ca(l.start,u),d,new ca(c,l.end)),n},[]));else w.push(e)});let C=gd(w,a,u,c);return i=[],o=[],r.raw?C:C.serialize()};(ek=tM||(tM={})).presets=tQ,ek.registry=cA.create({type:"connector"}),ek.registry.register(ek.presets,!0);class gg extends oQ{constructor(e={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(of(e)),this.changed={}}mutate(e,t={}){let n=!0===t.unset,r=!0===t.silent,i=[],o=this.changing;this.changing=!0,o||(this.previous=of(this.data),this.changed={});let s=this.data,l=this.previous,a=this.changed;if(Object.keys(e).forEach(t=>{let r=e[t];oz(s[t],r)||i.push(t),oz(l[t],r)?delete a[t]:a[t]=r,n?delete s[t]:s[t]=r}),!r&&i.length>0&&(this.pending=!0,this.pendingOptions=t,i.forEach(e=>{this.emit("change:*",{key:e,options:t,store:this,current:s[e],previous:l[e]})})),o)return this;if(!r)for(;this.pending;)this.pending=!1,this.emit("changed",{current:s,previous:l,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(e,t){if(null==e)return this.data;let n=this.data[e];return null==n?t:n}getPrevious(e){if(this.previous){let t=this.previous[e];return null==t?void 0:t}}set(e,t,n){return null!=e&&("object"==typeof e?this.mutate(e,t):this.mutate({[e]:t},n)),this}remove(e,t){let n,r=void 0,i={};if("string"==typeof e)i[e]=r,n=t;else if(Array.isArray(e))e.forEach(e=>i[e]=r),n=t;else{for(let e in this.data)i[e]=r;n=e}return this.mutate(i,Object.assign(Object.assign({},n),{unset:!0})),this}getByPath(e){return oJ(this.data,e,"/")}setByPath(e,t,n={}){let r=Array.isArray(e)?[...e]:e.split("/"),i=Array.isArray(e)?e.join("/"):e,o=r[0],s=r.length;if(n.propertyPath=i,n.propertyValue=t,n.propertyPathArray=r,1===s)this.set(o,t,n);else{let i={},l=i,a=o;for(let e=1;e<s;e+=1){let t=r[e],n=Number.isFinite(Number(t));l=l[a]=n?[]:{},a=t}oX(i,r,t,"/");let u=of(this.data);n.rewrite&&oY(u,e,"/");let c=r9(u,i);this.set(o,c[o],n)}return this}removeByPath(e,t){let n=Array.isArray(e)?e:e.split("/"),r=n[0];if(1===n.length)this.remove(r,t);else{let e=n.slice(1),i=of(this.get(r));i&&oY(i,e),this.set(r,i,t)}return this}hasChanged(e){return null==e?Object.keys(this.changed).length>0:e in this.changed}getChanges(e){let t;if(null==e)return this.hasChanged()?of(this.changed):null;let n=this.changing?this.previous:this.data,r={};for(let i in e){let o=e[i];oz(n[i],o)||(r[i]=o,t=!0)}return t?of(r):null}toJSON(){return of(this.data)}clone(){return new this.constructor(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})}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([oQ.dispose()],gg.prototype,"dispose",null);class gp{constructor(e){this.cell=e,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(e,t,n={},r="/"){let i=this.cell.getPropByPath(e),o=ie(n,gp.defaultOptions),s=this.getTiming(o.timing),l=this.getInterp(o.interp,i,t),a=0,u=Array.isArray(e)?e.join(r):e,c=Array.isArray(e)?e:e.split(r),h=()=>{let e=new Date().getTime();0===a&&(a=e);let t=(e-a)/o.duration;t<1?this.ids[u]=requestAnimationFrame(h):t=1;let r=l(s(t));this.cell.setPropByPath(c,r),n.progress&&n.progress(Object.assign({progress:t,currentValue:r},this.getArgs(u))),1===t&&(this.cell.notify("transition:complete",this.getArgs(u)),n.complete&&n.complete(this.getArgs(u)),this.cell.notify("transition:finish",this.getArgs(u)),n.finish&&n.finish(this.getArgs(u)),this.clean(u))};return setTimeout(()=>{this.stop(e,void 0,r),this.cache[u]={startValue:i,targetValue:t,options:o},this.ids[u]=requestAnimationFrame(h),this.cell.notify("transition:start",this.getArgs(u)),n.start&&n.start(this.getArgs(u))},n.delay),this.stop.bind(this,e,r,n)}stop(e,t={},n="/"){let r=Array.isArray(e)?e:e.split(n);return Object.keys(this.ids).filter(e=>oz(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),o=i.jumpedToEnd;o&&null!=n.targetValue&&(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 s=Object.assign({jumpedToEnd:o},r);this.cell.notify("transition:stop",Object.assign({},s)),i.stop&&i.stop(Object.assign({},s)),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"string"==typeof e?to[e]:e}getInterp(e,t,n){return e?e(t,n):"number"==typeof n?ts.number(t,n):"string"==typeof n?"#"===n[0]?ts.color(t,n):ts.unit(t,n):ts.object(t,n)}getArgs(e){let t=this.cache[e];return{path:e,startValue:t.startValue,targetValue:t.targetValue,cell:this.cell}}}(gp||(gp={})).defaultOptions={delay:10,duration:100,timing:"linear"};var gm=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gy extends oQ{static config(e){let{markup:t,propHooks:n,attrHooks:r}=e,i=gm(e,["markup","propHooks","attrHooks"]);null!=t&&(this.markup=t),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):"function"==typeof n?this.propHooks.push(n):Object.values(n).forEach(e=>{"function"==typeof e&&this.propHooks.push(e)})),r&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),r)),this.defaults=r9({},this.defaults,i)}static getMarkup(){return this.markup}static getDefaults(e){return e?this.defaults:of(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(e,t){return this.propHooks.reduce((t,n)=>n?nx(n,e,t):t,t)}get[Symbol.toStringTag](){return gy.toStringTag}constructor(e={}){super();let t=this.constructor.getDefaults(!0),n=r9({},this.preprocess(t),this.preprocess(e));this.id=n.id||lb(),this.store=new gg(n),this.animation=new gp(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 null==n&&!0!==t&&(r.id=lb()),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}),("source"===t||"target"===t)&&this.notify("change:terminal",{type:t,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 null==e?this.store.get():this.store.get(e,t)}setProp(e,t,n){if("string"==typeof e)this.store.set(e,t,n);else{let n=this.preprocess(e,!0);this.store.set(r9({},this.getProp(),n),t),this.postprocess(e)}return this}removeProp(e,t){return"string"==typeof e||Array.isArray(e)?this.store.removeByPath(e,t):this.store.remove(t),this}hasChanged(e){return null==e?this.store.hasChanged():this.store.hasChanged(e)}getPropByPath(e){return this.store.getByPath(e)}setPropByPath(e,t,n={}){return this.model&&("children"===e?this._children=t?t.map(e=>this.model.getCell(e)).filter(e=>null!=e):null:"parent"===e&&(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"attrs"===n[0]&&(t.dirty=!0),this.store.removeByPath(n,t),this}prop(e,t,n){return null==e?this.getProp():"string"==typeof e||Array.isArray(e)?1==arguments.length?this.getPropByPath(e):null==t?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){null==e?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,r=t.getMaxZIndex();e.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0})).unshift(this):n=[this],r=r-n.length+1;let i=t.total(),o=t.indexOf(this)!==i-n.length;o||(o=n.some((e,t)=>e.getZIndex()!==r+t)),o&&this.batchUpdate("to-front",()=>{r+=n.length,n.forEach((t,n)=>{t.setZIndex(r+n,e)})})}return this}toBack(e={}){let t=this.model;if(t){let n,r=t.getMinZIndex();e.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0})).unshift(this):n=[this];let i=0!==t.indexOf(this);i||(i=n.some((e,t)=>e.getZIndex()!==r+t)),i&&this.batchUpdate("to-back",()=>{r-=n.length,n.forEach((t,n)=>{t.setZIndex(r+n,e)})})}return this}get markup(){return this.getMarkup()}set markup(e){null==e?this.removeMarkup():this.setMarkup(e)}getMarkup(){let e=this.store.get("markup");return null==e&&(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){null==e?this.removeAttrs():this.setAttrs(e)}getAttrs(){let e=this.store.get("attrs");return e?Object.assign({},e):{}}setAttrs(e,t={}){if(null==e)this.removeAttrs(t);else{let n=e=>this.store.set("attrs",e,t);if(!0===t.overwrite)n(e);else{let r=this.getAttrs();n(!1===t.deep?Object.assign(Object.assign({},r),e):r9({},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]||td.registry.get(e);if(!n){let r=lc(e);n=t[r]||td.registry.get(r)}return n||null}getAttrByPath(e){return null==e||""===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 null==e?this.getAttrByPath():"string"==typeof e||Array.isArray(e)?1==arguments.length?this.getAttrByPath(e):null==t?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!1!==this.store.get("visible")}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="boolean"==typeof e?e:!this.isVisible(),r="boolean"==typeof e?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(null==e)this.removeData(t);else{let n=e=>this.store.set("data",e,t);if(!0===t.overwrite)n(e);else{let r=this.getData();n(!1===t.deep?"object"==typeof e?Object.assign(Object.assign({},r),e):e:r9({},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=>{var t;return null==(t=this.model)?void 0:t.getCell(e)}).filter(e=>null!=e);return this._children=t,[...t]}return null}hasParent(){return null!=this.parent}isParentOf(e){return null!=e&&e.getParent()===this}isChildOf(e){return null!=e&&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 null==this.children?0:this.children.length}getChildIndex(e){return null==this.children?-1:this.children.indexOf(e)}getChildAt(e){return null!=this.children&&e>=0?this.children[e]:null}getAncestors(e={}){let t=[],n=this.getParent();for(;n;)t.push(n),n=!1!==e.deep?n.getParent():null;return t}getDescendants(e={}){if(!1!==e.deep){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(null==e)return!1;if(!1!==t.deep){let t=this.getParent();for(;t;){if(t===e)return!0;t=t.getParent()}return!1}return this.isChildOf(e)}isAncestorOf(e,t={}){return null!=e&&e.isDescendantOf(this,t)}contains(e){return this.isAncestorOf(e)}getCommonAncestor(...e){return gy.getCommonAncestor(this,...e)}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,null!=e?this.store.set("children",e.map(e=>e.id),t):this.store.remove("children",t),this}unembed(e,t={}){let n=this.children;if(null!=n&&null!=e){let r=this.getChildIndex(e);-1!==r&&(n.splice(r,1),e.setParent(null,t),this.setChildren(n,t))}return this}embed(e,t={}){return e.addTo(this,t),this}addTo(e,t={}){return gy.isCell(e)?e.addChild(this,t):e.addCell(this,t),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(null!=e&&e!==this){let r=e.getParent(),i=this!==r,o=t;if(null==o&&(o=this.getChildCount(),i||(o-=1)),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 s=this.children;if(null==s?(s=[]).push(e):s.splice(o,0,e),e.setParent(this,n),this.setChildren(s,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(null!=t){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 null!=this.children&&null!=n&&(this.unembed(n,t),n.remove(t)),n}remove(e={}){return this.batchUpdate("remove",()=>{let t=this.getParent();t&&t.removeChild(this,e),!1!==e.deep&&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="string"==typeof t?t:null,o="object"==typeof t?t:"object"==typeof n?n:{};if(o.reset)return this.setTools({name:i,items:r,local:o.local},o);let s=of(this.getTools());if(null==s||null==i||s.name===i)return null==s&&(s={}),s.items||(s.items=[]),s.name=i,s.items=[...s.items,...r],this.setTools(Object.assign({},s),o)}setTools(e,t={}){return null==e?this.removeTools():this.store.set("tools",gy.normalizeTools(e),t),this}getTools(){return this.store.get("tools")}removeTools(e={}){return this.store.remove("tools",e),this}hasTools(e){let t=this.getTools();return null!=t&&(null==e||t.name===e)}hasTool(e){let t=this.getTools();return null!=t&&t.items.some(t=>"string"==typeof t?t===e:t.name===e)}removeTool(e,t={}){let n=of(this.getTools());if(n){let r=!1,i=n.items.slice(),o=e=>{i.splice(e,1),r=!0};if("number"==typeof e)o(e);else for(let t=i.length-1;t>=0;t-=1){let n=i[t];("string"==typeof n?n===e:n.name===e)&&o(t)}r&&(n.items=i,this.setTools(n,t))}return this}getBBox(e){return new co}getConnectionPoint(e,t){return new ci}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,o=!0===e.diff,s=t.attrs||{},l=i.getDefaults(!0),a=o?this.preprocess(l,!0):l,u=a.attrs||{},c={};Object.entries(t).forEach(([e,i])=>{if(null!=i&&!Array.isArray(i)&&"object"==typeof i&&!rj(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}"`);"attrs"!==e&&"shape"!==e&&o&&oz(i,a[e])&&delete t[e]}),Object.keys(s).forEach(e=>{let t=s[e],n=u[e];Object.keys(t).forEach(r=>{let i=t[r],o=n?n[r]:null;null==i||"object"!=typeof i||Array.isArray(i)?null!=n&&oz(o,i)||(null==c[e]&&(c[e]={}),c[e][r]=i):Object.keys(i).forEach(t=>{let s=i[t];null!=n&&null!=o&&t0(o)&&oz(o[t],s)||(null==c[e]&&(c[e]={}),null==c[e][r]&&(c[e][r]={}),c[e][r][t]=s)})})});let h=Object.assign(Object.assign({},t),{attrs:op(c)?void 0:c});return null==h.attrs&&delete h.attrs,0===h.angle&&delete h.angle,of(h)}clone(e={}){if(!e.deep){let t=Object.assign({},this.store.get());return e.keepId||delete t.id,delete t.parent,delete t.children,new this.constructor(t)}return gy.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()}}gy.defaults={},gy.attrHooks={},gy.propHooks=[],function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([oQ.dispose()],gy.prototype,"dispose",null),(gy||(gy={})).normalizeTools=function(e){return"string"==typeof e?{items:[e]}:Array.isArray(e)?{items:e}:e.items?e:{items:[e]}},(eO=gy||(gy={})).toStringTag=`X6.${eO.name}`,eO.isCell=function(e){if(null==e)return!1;if(e instanceof eO)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eO.toStringTag)&&"function"==typeof e.isNode&&"function"==typeof e.isEdge&&"function"==typeof e.prop&&"function"==typeof e.attr},(eM=gy||(gy={})).getCommonAncestor=function(...e){let t=e.filter(e=>null!=e).map(e=>e.getAncestors()).sort((e,t)=>e.length-t.length);return t.shift().find(e=>t.every(t=>t.includes(e)))||null},eM.getCellsBBox=function(e,t={}){let n=null;for(let r=0,i=e.length;r<i;r+=1){let i=e[r],o=i.getBBox(t);if(o){if(i.isNode()){let e=i.getAngle();null!=e&&0!==e&&(o=o.bbox(e))}n=null==n?o:n.union(o)}}return n},eM.deepClone=function(e){let t=[e,...e.getDescendants({deep:!0})];return eM.cloneCells(t)},eM.cloneCells=function(e){let t=sk(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},(eA=gy||(gy={})).config({propHooks(e){var{tools:t}=e,n=gm(e,["tools"]);return t&&(n.tools=eA.normalizeTools(t)),n}}),(eT=tA||(tA={})).exist=function(e,t){return t?null!=a&&a.exist(e):null!=u&&u.exist(e)},eT.setEdgeRegistry=function(e){a=e},eT.setNodeRegistry=function(e){u=e};class gb{constructor(e){this.ports=[],this.groups={},this.init(of(e))}getPorts(){return this.ports}getGroup(e){return null!=e?this.groups[e]:null}getPortsByGroup(e){return this.ports.filter(t=>t.group===e||null==t.group&&null==e)}getPortsLayoutByGroup(e,t){let n,r=this.getPortsByGroup(e),i=e?this.getGroup(e):null,o=i?i.position:null,s=o?o.name:null;if(null!=s){let e=tm.registry.get(s);if(null==e)return tm.registry.onNotFound(s);n=e}else n=tm.presets.left;return n(r.map(e=>e&&e.position&&e.position.args||{}),t,o&&o.args||{}).map((e,n)=>{let i=r[n];return{portLayout:e,portId:i.id,portSize:i.size,portAttrs:i.attrs,labelSize:i.label.size,labelLayout:this.getPortLabelLayout(i,ci.create(e.position),t)}})}init(e){let{groups:t,items:n}=e;null!=t&&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=r9({},n.attrs,t.attrs),t.position=this.createPosition(n,t),t.label=r9({},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"number"==typeof t.zIndex?t.zIndex:"number"==typeof e.zIndex||"auto"===e.zIndex?e.zIndex:"auto"}createPosition(e,t){return r9({name:"left",args:{}},e.position,{args:t.args})}getPortPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if(Array.isArray(e))return{name:"absolute",args:{x:e[0],y:e[1]}};if("object"==typeof e)return e}return{args:{}}}getPortLabelPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if("object"==typeof e)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||{},o=ty.registry.get(r)||ty.presets.left;return o?o(t,n,i):null}}var gv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gx extends gy{get[Symbol.toStringTag](){return gx.toStringTag}constructor(e={}){super(e),this.initPorts()}preprocess(e,t){let{x:n,y:r,width:i,height:o}=e,s=gv(e,["x","y","width","height"]);if(null!=n||null!=r){let e=s.position;s.position=Object.assign(Object.assign({},e),{x:null!=n?n:e?e.x:0,y:null!=r?r:e?e.y:0})}if(null!=i||null!=o){let e=s.size;s.size=Object.assign(Object.assign({},e),{width:null!=i?i:e?e.width:0,height:null!=o?o:e?e.height:0})}return super.preprocess(s,t)}isNode(){return!0}size(e,t,n){return void 0===e?this.getSize():"number"==typeof e?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"object"==typeof e?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,o=this.getSize();switch(r){case"left":case"right":t=o.height;break;case"top":case"bottom":e=o.width}let s={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[r],l=tl.normalize(this.getAngle()||0);n.absolute&&(s+=Math.floor((l+45)/90),s%=4);let a=this.getBBox(),u=(0===s?a.getBottomLeft():1===s?a.getCorner():2===s?a.getTopRight():a.getOrigin()).clone().rotate(-l,a.getCenter()),c=Math.sqrt(e*e+t*t)/2,h=s*Math.PI/2;h+=Math.atan(s%2==0?t/e:e/t),h-=tl.toRad(l);let d=ci.fromPolar(c,h,u).clone().translate(-(e/2),-(t/2));this.store.set("size",{width:e,height:t},n),this.setPosition(d.x,d.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,null==n?void 0:n);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"number"==typeof e?this.setPosition(e,t,n):this.getPosition(e)}getPosition(e={}){if(e.relative){let e=this.getParent();if(null!=e&&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,o;if("object"==typeof e?(r=e.x,i=e.y,o=t||{}):(r=e,i=t,o=n||{}),o.relative){let e=this.getParent();if(null!=e&&e.isNode()){let t=e.getPosition();r+=t.x,i+=t.y}}if(o.deep){let e=this.getPosition();this.translate(r-e.x,i-e.y,o)}else this.store.set("position",{x:r,y:i},o);return this}translate(e=0,t=0,n={}){if(0===e&&0===t)return this;n.translateBy=n.translateBy||this.id;let r=this.getPosition();if(null!=n.restrict&&n.translateBy===this.id){let i=this.getBBox({deep:!0}),o=n.restrict,s=r.x-i.x,l=r.y-i.y,a=Math.max(o.x+s,Math.min(o.x+o.width+s-i.width,r.x+e)),u=Math.max(o.y+l,Math.min(o.y+o.height+l-i.height,r.y+t));e=a-r.x,t=u-r.y}let i={x:r.x+e,y:r.y+t};return n.tx=e,n.ty=t,n.transition?("object"!=typeof n.transition&&(n.transition={}),this.transition("position",i,Object.assign(Object.assign({},n.transition),{interp:ts.object})),this.eachChild(r=>{var i;(null==(i=n.exclude)?void 0:i.includes(r))||r.translate(e,t,n)})):(this.startBatch("translate",n),this.store.set("position",i,n),this.eachChild(r=>{var i;(null==(i=n.exclude)?void 0:i.includes(r))||r.translate(e,t,n)}),this.stopBatch("translate",n)),this}angle(e,t){return null==e?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(),o=this.getBBox().getCenter();o.rotate(n-e,t.center);let s=o.x-r.width/2-i.x,l=o.y-r.height/2-i.y;this.startBatch("rotate",{angle:e,options:t}),this.setPosition(i.x+s,i.y+l,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),gy.getCellsBBox(e)}return co.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(e,t){let n=this.getBBox(),r=n.getCenter(),i=e.getTerminal(t);if(null==i)return r;let o=i.port;if(!o||!this.hasPort(o))return r;let s=this.getPort(o);if(!s||!s.group)return r;let l=this.getPortsPosition(s.group)[o].position,a=ci.create(l).translate(n.getOrigin()),u=this.getAngle();return u&&a.rotate(-u,r),a}fit(e={}){let t=(this.getChildren()||[]).filter(e=>e.isNode());if(0===t.length)return this;this.startBatch("fit-embeds",e),e.deep&&t.forEach(t=>t.fit(e));let{x:n,y:r,width:i,height:o}=gy.getCellsBBox(t),s=lk(e.padding);return n-=s.left,r-=s.top,i+=s.left+s.right,o+=s.bottom+s.top,this.store.set({position:{x:n,y:r},size:{width:i,height:o}},e),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(e){this.setPortContainerMarkup(e)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||tv.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(e,t={}){return this.store.set("portContainerMarkup",tv.clone(e),t),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(e){this.setPortMarkup(e)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||tv.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(e,t={}){return this.store.set("portMarkup",tv.clone(e),t),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(e){this.setPortLabelMarkup(e)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||tv.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(e,t={}){return this.store.set("portLabelMarkup",tv.clone(e),t),this}get ports(){let e=this.store.get("ports",{items:[]});return null==e.items&&(e.items=[]),e}getPorts(){return of(this.ports.items)}getPortsByGroup(e){return this.getPorts().filter(t=>t.group===e)}getPort(e){return of(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 -1!==this.getPortIndex(e)}getPortIndex(e){let t="string"==typeof e?e:e.id;return null!=t?this.ports.items.findIndex(e=>e.id===t):-1}getPortsPosition(e){let t=this.getSize();return this.port.getPortsLayoutByGroup(e,new co(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("string"==typeof t||Array.isArray(t)){let i=this.prefixPortPath(e,t);return this.setPropByPath(i,n,r)}let i=this.prefixPortPath(e);return this.setPropByPath(i,t,n)}removePortProp(e,t,n){return"string"==typeof t||Array.isArray(t)?this.removePropByPath(this.prefixPortPath(e,t),n):this.removePropByPath(this.prefixPortPath(e),t)}portProp(e,t,n,r){return null==t?this.getPortProp(e):"string"==typeof t||Array.isArray(t)?2==arguments.length?this.getPortProp(e,t):null==n?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(-1===n)throw Error(`Unable to find port with id: "${e}"`);return null==t||""===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="string"==typeof e?e:e.id;return t.id===n}));this.setPropByPath("ports/items",t,n)}}else(n=e||{}).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&&!op(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=>{"object"!=typeof n&&t.push(`Invalid port ${n}.`),null==n.id&&(n.id=this.generatePortId()),e[n.id]&&t.push("Duplicitied port id."),e[n.id]=!0}),t}generatePortId(){return lb()}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 gb(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})}}gx.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},(eN=gx||(gx={})).toStringTag=`X6.${eN.name}`,eN.isNode=function(e){if(null==e)return!1;if(e instanceof eN)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eN.toStringTag)&&"function"==typeof e.isNode&&"function"==typeof e.isEdge&&"function"==typeof e.prop&&"function"==typeof e.attr&&"function"==typeof e.size&&"function"==typeof e.position||!1},(gx||(gx={})).config({propHooks(e){var{ports:t}=e,n=gv(e,["ports"]);return t&&(n.ports=Array.isArray(t)?{items:t}:t),n}}),(ej=gx||(gx={})).registry=cA.create({type:"node",process(e,t){if(tA.exist(e,!0))throw Error(`Node with name '${e}' was registered by anthor Edge`);if("function"==typeof t)return t.config({shape:e}),t;let n=ej,{inherit:r}=t,i=gv(t,["inherit"]);if(r)if("string"==typeof r){let e=this.get(r);null==e?this.onNotFound(r,"inherited"):n=e}else n=r;null==i.constructorName&&(i.constructorName=e);let o=n.define.call(n,i);return o.config({shape:e}),o}}),tA.setNodeRegistry(ej.registry),eL=gx||(gx={}),c=0,eL.define=function(e){var t;let{constructorName:n,overwrite:r}=e,i=gv(e,["constructorName","overwrite"]),o=o$((t=n||i.shape)?lm(t):(c+=1,`CustomNode${c}`),this);return o.config(i),i.shape&&eL.registry.register(i.shape,o,r),o},eL.create=function(e){let t=e.shape||"rect",n=eL.registry.get(t);return n?new n(e):eL.registry.onNotFound(t)};var gw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gC extends gy{get[Symbol.toStringTag](){return gC.toStringTag}constructor(e={}){super(e)}preprocess(e,t){let{source:n,sourceCell:r,sourcePort:i,sourcePoint:o,target:s,targetCell:l,targetPort:a,targetPoint:u}=e,c=gw(e,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),h=e=>"string"==typeof e||"number"==typeof e;if(null!=n)if(gy.isCell(n))c.source={cell:n.id};else if(h(n))c.source={cell:n};else if(ci.isPoint(n))c.source=n.toJSON();else if(Array.isArray(n))c.source={x:n[0],y:n[1]};else{let e=n.cell;gy.isCell(e)?c.source=Object.assign(Object.assign({},n),{cell:e.id}):c.source=n}if(null!=r||null!=i){let e=c.source;if(null!=r){let t=h(r)?r:r.id;e?e.cell=t:e=c.source={cell:t}}null!=i&&e&&(e.port=i)}else null!=o&&(c.source=ci.create(o).toJSON());if(null!=s)if(gy.isCell(s))c.target={cell:s.id};else if(h(s))c.target={cell:s};else if(ci.isPoint(s))c.target=s.toJSON();else if(Array.isArray(s))c.target={x:s[0],y:s[1]};else{let e=s.cell;gy.isCell(e)?c.target=Object.assign(Object.assign({},s),{cell:e.id}):c.target=s}if(null!=l||null!=a){let e=c.target;if(null!=l){let t=h(l)?l:l.id;e?e.cell=t:e=c.target={cell:t}}null!=a&&e&&(e.port=a)}else null!=u&&(c.target=ci.create(u).toJSON());return super.preprocess(c,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={}){return gy.isCell(t)?this.store.set(e,r9({},n,{cell:t.id}),r):ci.isPoint(t)||null!=t.x&&null!=t.y?this.store.set(e,r9({},n,{x:t.x,y:t.y}),r):this.store.set(e,of(t),r),this}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(e){let t=this[e];if(ci.isPointLike(t))return ci.create(t);let n=this.getTerminalCell(e);return n?n.getConnectionPoint(this,e):new ci}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(e){if(this.model){let t="source"===e?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){null==e?this.removeRouter():this.setRouter(e)}getRouter(){return this.store.get("router")}setRouter(e,t,n){return"object"==typeof e?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){null==e?this.removeConnector():this.setConnector(e)}getConnector(){return this.store.get("connector")}setConnector(e,t,n){return"object"==typeof e?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 of(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,o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),r.splice(o,0,this.parseLabel(e)),this.setLabels(r,n)}appendLabel(e,t={}){return this.insertLabel(e,-1,t)}getLabelAt(e){let t=this.getLabels();return null!=e&&Number.isFinite(e)?this.parseLabel(t[e]):null}setLabelAt(e,t,n={}){if(null!=e&&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=null!=e&&Number.isFinite(e)?e:-1,i=n.splice(r,1);return this.setLabels(n,t),i.length?i[0]:null}parseLabel(e){return"string"==typeof e?this.constructor.parseStringLabel(e):e}onLabelsChanged({previous:e,current:t}){let n=e&&t?t.filter(t=>e.find(e=>t===e||oz(t,e))?null:t):t?[...t]:[],r=e&&t?e.filter(e=>t.find(t=>e===t||oz(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=>ci.toJSON(e)),t),this}insertVertex(e,t,n={}){let r=this.getVertices(),i=r.length,o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),r.splice(o,0,ci.toJSON(e)),this.setVertices(r,n)}appendVertex(e,t={}){return this.insertVertex(e,-1,t)}getVertexAt(e){return null!=e&&Number.isFinite(e)?this.getVertices()[e]:null}setVertexAt(e,t,n={}){if(null!=e&&Number.isFinite(e)){let r=this.getVertices();r[e]=t,this.setVertices(r,n)}return this}removeVertexAt(e,t={}){let n=this.getVertices(),r=null!=e&&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=>ci.equals(t,e))?null:t):t?[...t]:[],r=e&&t?e.filter(e=>t.find(t=>ci.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")||tv.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=>ci.create(r).scale(e,t,n).toJSON(),r)}applyToPoints(e,t={}){let n={},r=this.getSource(),i=this.getTarget();ci.isPointLike(r)&&(n.source=e(r)),ci.isPointLike(i)&&(n.target=e(i));let o=this.getVertices();return o.length>0&&(n.vertices=o.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=>ci.create(e)),this.getTargetPoint()];return new cp(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:gy.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 o=r===i;if(!o&&e.deep&&this._model){let t=this.getSourceCell(),n=this.getTargetCell();t&&n&&(o=t.isAncestorOf(n,e)||n.isAncestorOf(t,e))}return o}getFragmentAncestor(){let e=[this,this.getSourceNode(),this.getTargetNode()].filter(e=>null!=e);return this.getCommonAncestor(...e)}isFragmentDescendantOf(e){let t=this.getFragmentAncestor();return!!t&&(t.id===e.id||t.isDescendantOf(e))}}gC.defaults={},(gC||(gC={})).equalTerminals=function(e,t){return e.cell===t.cell&&(e.port===t.port||null==e.port&&null==t.port)},(eR=gC||(gC={})).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}},eR.parseStringLabel=function(e){return{attrs:{label:{text:e}}}},(eI=gC||(gC={})).toStringTag=`X6.${eI.name}`,eI.isEdge=function(e){if(null==e)return!1;if(e instanceof eI)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eI.toStringTag)&&"function"==typeof e.isNode&&"function"==typeof e.isEdge&&"function"==typeof e.prop&&"function"==typeof e.attr&&"function"==typeof e.disconnect&&"function"==typeof e.getSource&&"function"==typeof e.getTarget||!1},(e_=gC||(gC={})).registry=cA.create({type:"edge",process(e,t){if(tA.exist(e,!1))throw Error(`Edge with name '${e}' was registered by anthor Node`);if("function"==typeof t)return t.config({shape:e}),t;let n=e_,{inherit:r="edge"}=t,i=gw(t,["inherit"]);if("string"==typeof r){let e=this.get(r||"edge");null==e&&r?this.onNotFound(r,"inherited"):n=e}else n=r;null==i.constructorName&&(i.constructorName=e);let o=n.define.call(n,i);return o.config({shape:e}),o}}),tA.setEdgeRegistry(e_.registry),ez=gC||(gC={}),h=0,ez.define=function(e){var t;let{constructorName:n,overwrite:r}=e,i=gw(e,["constructorName","overwrite"]),o=o$((t=n||i.shape)?lm(t):(h+=1,`CustomEdge${h}`),this);return o.config(i),i.shape&&ez.registry.register(i.shape,o,r),o},ez.create=function(e){let t=e.shape||"edge",n=ez.registry.get(t);return n?new n(e):ez.registry.onNotFound(t)};var gE=gC||(gC={});let gS="basic.edge";gE.config({shape:gS,propHooks(e){let{label:t,vertices:n}=e,r=gw(e,["label","vertices"]);if(t){null==r.labels&&(r.labels=[]);let e="string"==typeof t?gE.parseStringLabel(t):t;r.labels.push(e)}return n&&Array.isArray(n)&&(r.vertices=n.map(e=>ci.create(e).toJSON())),r}}),gE.registry.register(gS,gE);class gP extends oQ{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;"number"==typeof t?(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 o=Array.isArray(e)?e:[e],s=this.comparator&&"number"!=typeof t&&!1!==i.sort,l=this.comparator||null,a=!1,u=[],c=[];return o.forEach(e=>{let t=this.get(e);t?i.merge&&!e.isSameStore(t)&&(t.setProp(e.getProp(),n),c.push(t),s&&!a&&(a=null==l||"function"==typeof l?t.hasChanged():"string"==typeof l?t.hasChanged(l):l.some(e=>t.hasChanged(e)))):(u.push(e),this.reference(e))}),u.length&&(s&&(a=!0),this.cells.splice(r,0,...u),this.length=this.cells.length),a&&this.sort({silent:!0}),!i.silent&&(u.forEach((e,t)=>{let n={cell:e,index:r+t,options:i};this.trigger("added",n),i.dryrun||e.notify("added",Object.assign({},n))}),a&&this.trigger("sorted"),(u.length||c.length)&&this.trigger("updated",{added:u,merged:c,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(null==i)continue;let o=this.cells.indexOf(i);this.cells.splice(o,1),this.length-=1,delete this.map[i.id],n.push(i),this.unreference(i),t.dryrun||i.remove(),!t.silent&&(this.trigger("removed",{cell:i,index:o,options:t}),t.dryrun||i.notify("removed",{cell:i,index:o,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(null==e)return null;let t="string"==typeof e||"number"==typeof e?e:e.id;return this.map[t]||null}has(e){return null!=this.get(e)}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 null!=this.comparator&&(this.cells=sP(this.cells,this.comparator),e.silent||this.trigger("sorted")),this}clone(){return new this.constructor(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([])}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([gP.dispose()],gP.prototype,"dispose",null);class gk extends oQ{get[Symbol.toStringTag](){return gk.toStringTag}constructor(e=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new gP(e),this.setup()}notify(e,t){this.trigger(e,t);let n=this.graph;return n&&("sorted"===e||"reseted"===e||"updated"===e?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),0===e.length&&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),0===e.length&&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="source"===t?this.outgoings:this.incomings,r=e.previous(t);if(r&&r.cell){let t=gy.isCell(r.cell)?r.cell.id:r.cell,i=n[t],o=i?i.indexOf(e.id):-1;o>=0&&(i.splice(o,1),0===i.length&&delete n[t])}let i=e.getTerminal(t);if(i&&i.cell){let t=gy.isCell(i.cell)?i.cell.id:i.cell,r=n[t]||[];-1===r.indexOf(e.id)&&r.push(e.id),n[t]=r}}prepareCell(e,t){return e.model||t&&t.dryrun||(e.model=this),null==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(0===t.length)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=gx.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 gx.create(e)}addEdge(e,t={}){let n=gC.isEdge(e)?e:this.createEdge(e);return this.addCell(n,t),n}createEdge(e){return gC.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(0===n)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-=1}),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)}removeCell(e,t={}){let n="string"==typeof e?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="string"==typeof e?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=>null!=e):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(e){let t="string"==typeof e?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="string"==typeof e?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="string"==typeof e?this.getCell(e):e;if(null==r)return n;let i={},o=t.indirect,s=t.incoming,l=t.outgoing;null==s&&null==l&&(s=l=!0);let a=(e,t)=>{let r=t?this.getOutgoingEdges(e):this.getIncomingEdges(e);if(null!=r&&r.forEach(e=>{!i[e.id]&&(n.push(e),i[e.id]=!0,o&&(s&&a(e,!1),l&&a(e,!0)))}),o&&e.isEdge()){let r=t?e.getTargetCell():e.getSourceCell();r&&r.isEdge()&&!i[r.id]&&(n.push(r),a(r,t))}};if(l&&a(r,!0),s&&a(r,!1),t.deep){let e=r.getDescendants({deep:!0}),o={};e.forEach(e=>{e.isNode()&&(o[e.id]=!0)});let a=(e,r)=>{let s=r?this.getOutgoingEdges(e.id):this.getIncomingEdges(e.id);null!=s&&s.forEach(e=>{if(!i[e.id]){let r=e.getSourceCell(),s=e.getTargetCell();!t.enclosed&&r&&o[r.id]&&s&&o[s.id]||(n.push(e),i[e.id]=!0)}})};e.forEach(e=>{!e.isEdge()&&(l&&a(e,!0),s&&a(e,!1))})}return n}isBoundary(e,t){let n="string"==typeof e?this.getCell(e):e,r=t?this.getIncomingEdges(n):this.getOutgoingEdges(n);return null==r||0===r.length}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;null==n&&null==r&&(n=r=!0);let i=this.getConnectedEdges(e,t).reduce((i,o)=>{let s=o.hasLoop(t),l=o.getSourceCell(),a=o.getTargetCell();return n&&l&&l.isNode()&&!i[l.id]&&(s||l!==e&&(!t.deep||!l.isDescendantOf(e)))&&(i[l.id]=l),r&&a&&a.isNode()&&!i[a.id]&&(s||a!==e&&(!t.deep||!a.isDescendantOf(e)))&&(i[a.id]=a),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 null==r&&null==i&&(r=i=!0),this.getConnectedEdges(e,n).some(e=>{let n=e.getSourceCell(),o=e.getTargetCell();return!!r&&!!n&&n.id===t.id||!!i&&!!o&&o.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,o)=>{if(i===t&&i!==e&&this.matchDistance(o,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,o)=>{if(i===t&&i!==e&&this.matchDistance(o,n.distance))return r=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),r}matchDistance(e,t){return null==t||("function"==typeof t?t(e):!!(Array.isArray(t)&&t.includes(e))||e===t)}getCommonAncestor(...e){let t=[];return e.forEach(e=>{e&&(Array.isArray(e)?t.push(...e):t.push(e))}),gy.getCommonAncestor(...t)}getSubGraph(e,t={}){let n=[],r={},i=[],o=[],s=e=>{!r[e.id]&&(n.push(e),r[e.id]=e,e.isEdge()&&o.push(e),e.isNode()&&i.push(e))};return e.forEach(e=>{s(e),t.deep&&e.getDescendants({deep:!0}).forEach(e=>s(e))}),o.forEach(e=>{let t=e.getSourceCell(),o=e.getTargetCell();t&&!r[t.id]&&(n.push(t),r[t.id]=t,t.isNode()&&i.push(t)),o&&!r[o.id]&&(n.push(o),r[o.id]=o,o.isNode()&&i.push(o))}),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 gy.cloneCells(e)}getNodesFromPoint(e,t){let n="number"==typeof e?{x:e,y:t||0}:e;return this.getNodes().filter(e=>e.getBBox().containsPoint(n))}getNodesInArea(e,t,n,r,i){let o="number"==typeof e?new co(e,t,n,r):co.create(e),s="number"==typeof e?i:t,l=s&&s.strict;return this.getNodes().filter(e=>{let t=e.getBBox();return l?o.containsRect(t):o.isIntersectWithRect(t)})}getEdgesInArea(e,t,n,r,i){let o="number"==typeof e?new co(e,t,n,r):co.create(e),s="number"==typeof e?i:t,l=s&&s.strict;return this.getEdges().filter(e=>{let t=e.getBBox();return 0===t.width?t.inflate(1,0):0===t.height&&t.inflate(0,1),l?o.containsRect(t):o.isIntersectWithRect(t)})}getNodesUnderNode(e,t={}){let n=e.getBBox();return(null==t.by||"bbox"===t.by?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 gy.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={},o={};for(r.push(e),o[e.id]=0;r.length>0;){let e=r.shift();if(null!=e&&!i[e.id])i[e.id]=!0,!1!==nx(t,this,e,o[e.id])&&this.getNeighbors(e,n).forEach(t=>{o[t.id]=o[e.id]+1,r.push(t)})}}depthFirstSearch(e,t,n={}){let r=[],i={},o={};for(r.push(e),o[e.id]=0;r.length>0;){let e=r.pop();if(null==e||i[e.id]||(i[e.id]=!0,!1===nx(t,this,e,o[e.id])))continue;let s=this.getNeighbors(e,n),l=r.length;s.forEach(t=>{o[t.id]=o[e.id]+1,r.splice(l,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="string"==typeof e?e:e.id,o=tr.run(r,i,n.weight),s=[],l="string"==typeof t?t:t.id;for(o[l]&&s.push(l);l=o[l];)s.unshift(l);return s}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 o=Math.max(e/i.width,0),s=Math.max(t/i.height,0),l=i.getOrigin();n.forEach(e=>e.scale(o,s,l,r))}return this}toJSON(e={}){return gk.toJSON(this.getCells(),e)}parseJSON(e){return gk.fromJSON(e)}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()}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([gk.dispose()],gk.prototype,"dispose",null),(eD=gk||(gk={})).toStringTag=`X6.${eD.name}`,eD.isModel=function(e){if(null==e)return!1;if(e instanceof eD)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eD.toStringTag)&&"function"==typeof e.addNode&&"function"==typeof e.addEdge&&null!=e.collection},(eB=gk||(gk={})).toJSON=function(e,t={}){return{cells:e.map(e=>e.toJSON(t))}},eB.fromJSON=function(e){let t=[];return Array.isArray(e)?t.push(...e):(e.cells&&t.push(...e.cells),e.nodes&&e.nodes.forEach(e=>{null==e.shape&&(e.shape="rect"),t.push(e)}),e.edges&&e.edges.forEach(e=>{null==e.shape&&(e.shape="edge"),t.push(e)})),t.map(e=>{let t=e.shape;if(t){if(gx.registry.exist(t))return gx.create(e);if(gC.registry.exist(t))return gC.create(e)}throw Error("The `shape` should be specified when creating a node/edge instance")})};var gO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gM extends gx{get label(){return this.getLabel()}set label(e){this.setLabel(e)}getLabel(){return this.getAttrByPath("text/text")}setLabel(e,t){return null==e?this.removeLabel():this.setAttrByPath("text/text",e,t),this}removeLabel(){return this.removeAttrByPath("text/text"),this}}(eV=gM||(gM={})).bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},eV.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},eV.config({attrs:{text:Object.assign({},eV.labelAttr)},propHooks(e){let{label:t}=e,n=gO(e,["label"]);return t&&oX(n,"attrs/text/text",t),n},visible:!0});var gA=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function gT(e,t,n={}){let r={constructorName:e,markup:function(e,t="body"){return[{tagName:e,selector:t},{tagName:"text",selector:"label"}]}(e,n.selector),attrs:{[e]:Object.assign({},gM.bodyAttr)}};return(n.parent||gM).define(r9(r,t,{shape:e}))}gT("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}});let gN=gC.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"}}});gT("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var gj=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gL extends gM{get points(){return this.getPoints()}set points(e){this.setPoints(e)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(e,t){return null==e?this.removePoints():this.setAttrByPath("body/refPoints",gL.pointsToString(e),t),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}var gR=gL||(gL={});function gI(e){return"string"==typeof e?e:e.map(e=>Array.isArray(e)?e.join(","):ci.isPointLike(e)?`${e.x}, ${e.y}`:"").join(" ")}gR.pointsToString=gI,gR.config({propHooks(e){let{points:t}=e,n=gj(e,["points"]);if(t){let e=gI(t);e&&oX(n,"attrs/body/refPoints",e)}return n}}),gT("polygon",{},{parent:gL}),gT("polyline",{},{parent:gL});var g_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};gM.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=g_(e,["path"]);return t&&oX(n,"attrs/body/refD",t),n}});var gz=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};gM.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},e2.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:l5.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({},gM.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(e){let{text:t}=e,n=gz(e,["text"]);return t&&oX(n,"attrs/label/text",t),n},attrHooks:{text:{set(e,{cell:t,view:n,refBBox:r,elem:i,attrs:o}){if(i instanceof HTMLElement)i.textContent=e;else{let s=o.style||{},l=Object.assign({textVerticalAnchor:"middle"},s);return nx(td.presets.textWrap.set,this,{text:e,width:-5,height:"100%"},{cell:t,view:n,elem:i,refBBox:r,attrs:l}),{fill:s.color||null}}},position(e,{refBBox:t,elem:n}){if(n instanceof SVGElement)return t.getCenter()}}}}),gT("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:function(e="xlink:href"){return t=>{let{imageUrl:n,imageWidth:r,imageHeight:i}=t,o=gA(t,["imageUrl","imageWidth","imageHeight"]);return(null!=n||null!=r||null!=i)&&(o.attrs?null==o.attrs.image&&(o.attrs.image={}):o.attrs={image:{}},(()=>{if(o.attrs){let t=o.attrs.image;null!=n&&(t[e]=n),null!=r&&(t.width=r),null!=i&&(t.height=i),o.attrs.image=t}})()),o}}()},{selector:"image"}),gT("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class gD extends dQ{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return gD.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")?lZ(t,e):lQ(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(),dl.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(),dl.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 co(0,0,n.width,n.height),selectors:this.selectors}),dl.useCSSSelector&&this.renderPorts()}renderMarkup(){let e=this.cell.markup;if(e){if("string"==typeof e)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(),dl.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=>{al(e.portElement)})}renderPorts(){let e=this.container,t=[];e.childNodes.forEach(e=>{t.push(e)});let n=sa(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?ah(n[Math.max(t,0)],r):au(this.container,r)}getPortElement(e){let t=this.portsCache[e.id];return t?t.portElement:this.createPortElement(e)}createPortElement(e){let t,n,r=tv.renderMarkup(this.cell.getPortContainerMarkup()),i=r.elem;if(null==i)throw Error("Invalid port container markup.");let o=(r=tv.renderMarkup(this.getPortMarkup(e))).elem,s=r.selectors;if(null==o)throw Error("Invalid port markup.");this.setAttrs({port:e.id,"port-group":e.group},o);let l="x6-port";e.group&&(l+=` x6-port-${e.group}`),lQ(i,l),lQ(i,"x6-port"),lQ(o,"x6-port-body"),i.appendChild(o);let a=s;if(this.existPortLabel(e)){if(t=(r=tv.renderMarkup(this.getPortLabelMarkup(e.label))).elem,n=r.selectors,null==t)throw Error("Invalid port label markup.");if(s&&n){for(let e in n)if(s[e]&&e!==this.rootSelector)throw Error("Selectors within port must be unique.");a=Object.assign(Object.assign({},s),n)}lQ(t,"x6-port-label"),i.appendChild(t)}return this.portsCache[e.id]={portElement:i,portSelectors:a,portLabelElement:t,portLabelSelectors:n,portContentElement:o,portContentSelectors:s},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:e,node:this.cell,container:i,selectors:a,labelContainer:t,labelSelectors:n,contentContainer:o,contentSelectors:s}),i}updatePorts(){let e=Object.keys(this.cell.getParsedGroups());0===e.length?this.updatePortGroup():e.forEach(e=>this.updatePortGroup(e))}updatePortGroup(e){let t=co.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]||{},o=t.portLayout;if(this.applyPortTransform(i.portElement,o),null!=t.portAttrs){let e={selectors:i.portSelectors||{}};t.portSize&&(e.rootBBox=co.fromSize(t.portSize)),this.updateAttrs(i.portElement,t.portAttrs,e)}let s=t.labelLayout;if(s&&i.portLabelElement&&(this.applyPortTransform(i.portLabelElement,s,-(o.angle||0)),s.attrs)){let e={selectors:i.portLabelSelectors||{}};t.labelSize&&(e.rootBBox=co.fromSize(t.labelSize)),this.updateAttrs(i.portLabelElement,s.attrs,e)}}}applyPortTransform(e,t,n=0){let r=t.angle,i=t.position;uE(e,uf().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.cell;return null==t||null==n?{e,view:this,node:r,cell:r}:{e,x:t,y:n,view:this,node:r,cell:r}}getPortEventArgs(e,t,n){let r=this.cell;return n?{e,x:n.x,y:n.y,view:this,node:r,cell:r,port:t}:{e,view:this,node:r,cell:r,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;"node:port:mouseenter"===e?t.type="mouseenter":"node:port:mouseleave"===e&&(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("magnet"===i)this.dragMagnet(e,t,n);else{if("move"===i){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;"magnet"===i?this.stopMagnetDragging(e,t,n):(this.notifyMouseUp(e,t,n),this.notifyPortEvent("node:port:mouseup",e,{x:t,y:n}),"move"===i&&(r.targetView||this).stopNodeDragging(e,t,n));let o=r.targetMagnet;o&&this.onMagnetClick(e,o,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,o=i.findParent,s="function"==typeof o?nx(o,r,{view:this,node:this.cell}).filter(e=>gy.isCell(e)&&this.cell.id!==e.id&&!e.isDescendantOf(this.cell)):r.model.getNodesUnderNode(n,{by:o});if(i.frontOnly&&s.length>0){let e=sa(s,"zIndex"),t=o6(Object.keys(e).map(e=>parseInt(e,10)));t&&(s=e[t])}s=s.filter(e=>e.visible);let l=null,a=t.candidateEmbedView,u=i.validate;for(let e=s.length-1;e>=0;e-=1){let t=s[e];if(a&&a.cell.id===t.id){l=a;break}{let e=t.findView(r);if(u&&nx(u,r,{child:this.cell,parent:e.cell,childView:this,parentView:e})){l=e;break}}}this.clearEmbedding(t),l&&l.highlight(null,{type:"embedding"}),t.candidateEmbedView=l;let c=r.snapToGrid(e.clientX,e.clientY);this.notify("node:embedding",{e,cell:n,node:n,view:r.findViewByCell(n),x:c.x,y:c.y,currentParent:n.getParent(),candidateParent:l?l.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),o=n.getParent(),s=t.candidateEmbedView;if(s?(s.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null,(null==o||o.id!==s.cell.id)&&s.cell.insertChild(n,void 0,{ui:!0})):o&&o.unembed(n,{ui:!0}),r.model.getConnectedEdges(n,{deep:!0}).forEach(e=>{e.updateParent({ui:!0})}),i&&s){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:o,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("passive"!==t.getAttribute("magnet")){let r=this.graph.options.connecting.validateMagnet;return!r||nx(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=nx(r,this.graph,{sourceMagnet:t,sourceView:e,sourceCell:e.cell})),n}createEdgeFromMagnet(e,t,n){let r=this.graph,i=r.model,o=this.getDefaultEdge(this,e);return o.setSource(Object.assign(Object.assign({},o.getSource()),this.getEdgeTerminal(e,t,n,o,"source"))),o.setTarget(Object.assign(Object.assign({},o.getTarget()),{x:t,y:n})),o.addTo(i,{async:!1,ui:!0}),o.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,o=i.options.magnetThreshold,s=this.getEventTarget(e),l=r.targetMagnet;if("onleave"===o){if(l===s||l.contains(s))return}else if(i.view.getMouseMovedCount(e)<=o)return;this.startConnectting(e,l,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 o=[i],s=this.graph.getPlugin("selection");if(s&&s.isSelectionMovable()){let e=s.getSelectedCells();e.includes(i)&&(o=e.filter(e=>e.isNode()))}o.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="function"==typeof t?nx(t,this.graph,e):t;return"number"==typeof n?this.graph.transform.getGraphArea().inflate(n):!0===n?this.graph.transform.getGraphArea():n||null}startNodeDragging(e,t,n){let r=this.getDelegatedView();if(null==r||!r.can("nodeMovable"))return this.notifyUnhandledMouseDown(e,t,n);this.setEventData(e,{targetView:r,action:"move"});let i=ci.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,o=i.getGridSize(),s=this.getEventData(e),l=s.offset,a=s.restrict;s.moving||(s.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",e,t,n,this.cell)),this.autoScrollGraph(e.clientX,e.clientY);let u=ta.snapToGrid(t+l.x,o),c=ta.snapToGrid(n+l.y,o);r.setPosition(u,c,{restrict:a,deep:!0,ui:!0}),i.options.embedding.enabled&&(s.embedding||(this.prepareEmbedding(e),s.embedding=!0),this.processEmbedding(e,s))}stopNodeDragging(e,t,n){let r=this.getEventData(e);r.embedding&&this.finalizeEmbedding(e,r),r.moving&&(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)}}(eF=gD||(gD={})).toStringTag=`X6.${eF.name}`,eF.isNodeView=function(e){if(null==e)return!1;if(e instanceof eF)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eF.toStringTag)&&"function"==typeof e.isNodeView&&"function"==typeof e.isEdgeView&&"function"==typeof e.confirmUpdate&&"function"==typeof e.update&&"function"==typeof e.findPortElem&&"function"==typeof e.resize&&"function"==typeof e.rotate&&"function"==typeof e.translate||!1},gD.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"]}}),gD.registry.register("node",gD,!0);class gB extends dQ{constructor(){super(...arguments),this.POINT_ROUNDING=2}get[Symbol.toStringTag](){return gB.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){let e=this.sourceView;if(!e){let e=this.cell.getSource();return new co(e.x,e.y)}let t=this.sourceMagnet;return e.isEdgeElement(t)?new co(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 co(e.x,e.y)}let t=this.targetMagnet;return e.isEdgeElement(t)?new co(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=this.handleAction(n,"update",()=>this.update(t)),n=this.handleAction(n,"labels",()=>this.onLabelsChange(t)),n=this.handleAction(n,"tools",()=>this.renderTools()))}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("string"==typeof e)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],o=this.labelSelectors[n],s=this.graph.options.onEdgeLabelRendered;s&&s({edge:e,label:r,container:i,selectors:o})}}}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=l8("g"),this.addClass(this.prefixClassName("edge-labels"),r),this.labelContainer=r);for(let n=0,i=t.length;n<i;n+=1){let i,o,s=t[n],l=this.normalizeLabelMarkup(this.parseLabelMarkup(s.markup));if(l)i=l.node,o=l.selectors;else{let t=e.getDefaultLabel(),n=this.normalizeLabelMarkup(this.parseLabelMarkup(t.markup));i=n.node,o=n.selectors}i.setAttribute("data-index",`${n}`),r.appendChild(i);let a=this.rootSelector;if(o[a])throw Error("Ambiguous label root selector.");o[a]=i,this.labelCache[n]=i,this.labelSelectors[n]=o}return null==r.parentNode&&this.container.appendChild(r),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(e={}){this.shouldRerenderLabels(e)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(e={}){let t=this.cell.previous("labels");if(null==t)return!0;if("propertyPathArray"in e&&"propertyValue"in e){let n=e.propertyPathArray||[],r=n.length;if(r>1&&t[n[1]]){if(2===r)return"object"==typeof e.propertyValue&&ob(e.propertyValue,"markup");if("markup"!==n[2])return!1}}return!0}parseLabelMarkup(e){return e?"string"==typeof e?this.parseLabelStringMarkup(e):this.parseJSONMarkup(e):null}parseLabelStringMarkup(e){let t=aX.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){let t;if(null==e)return;let n=e.fragment;if(!(n instanceof DocumentFragment)||!n.hasChildNodes())throw Error("Invalid label markup.");let r=n.childNodes;return(t=r.length>1||"G"!==r[0].nodeName.toUpperCase()?aX.create("g").append(n):aX.create(r[0])).addClass(this.prefixClassName("edge-label")),{node:t.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],o=this.labelSelectors[e];i.setAttribute("cursor",n?"move":"default");let s=t[e],l=r9({},r.attrs,s.attrs);this.updateAttrs(i,l,{selectors:o,rootBBox:s.size?co.fromSize(s.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();return null!=t&&this.updateAttrs(this.container,t,{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,o=new cp(r);o.simplify({threshold:.01});let s=o.points.map(e=>e.toJSON()),l=s.length;return i===l?0:(t.setVertices(s.slice(1,l-1),e),i-l)}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 ci.create(this.sourceAnchor);case"target":return ci.create(this.targetAnchor);default:throw Error(`Unknown terminal type '${e}'`)}}getTerminalConnectionPoint(e){switch(e){case"source":return ci.create(this.sourcePoint);case"target":return ci.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;if(!e)return null;return this.sourceMagnet||e.container}case"target":{if(t.raw)return this.targetMagnet;let e=this.targetView;if(!e)return null;return this.targetMagnet||e.container}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 cp(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],o=e[e.length-1];return r.priority&&!n.priority?this.findAnchorsOrdered("target",o,"source",i):this.findAnchorsOrdered("source",i,"target",o)}findAnchorsOrdered(e,t,n,r){let i,o,s=this.cell,l=s[e],a=s[n],u=this.getTerminalView(e),c=this.getTerminalView(n),h=this.getTerminalMagnet(e),d=this.getTerminalMagnet(n);if(u){let n;n=t?ci.create(t):c?d:ci.create(a),i=this.getAnchor(l.anchor,u,h,n,e)}else i=ci.create(l);if(c){let e=ci.create(r||i);o=this.getAnchor(a.anchor,c,d,e,n)}else o=ci.isPointLike(a)?ci.create(a):new ci;return{[e]:i,[n]:o}}getAnchor(e,t,n,r,i){let o,s=t.isEdgeElement(n),l=this.graph.options.connecting,a="string"==typeof e?{name:e}:e;if(!a){let e=s?("source"===i?l.sourceEdgeAnchor:l.targetEdgeAnchor)||l.edgeAnchor:("source"===i?l.sourceAnchor:l.targetAnchor)||l.anchor;a="string"==typeof e?{name:e}:e}if(!a)throw Error("Anchor should be specified.");let u=a.name;if(s){let e=tS.registry.get(u);if("function"!=typeof e)return tS.registry.onNotFound(u);o=nx(e,this,t,n,r,a.args||{},i)}else{let e=tE.registry.get(u);if("function"!=typeof e)return tE.registry.onNotFound(u);o=nx(e,this,t,n,r,a.args||{},i)}return o?o.round(this.POINT_ROUNDING):new ci}findRoutePoints(e=[]){let t,n=this.graph.options.connecting.router||tO.presets.normal,r=this.cell.getRouter()||n;if("function"==typeof r)t=nx(r,this,e,{},this);else{let n="string"==typeof r?r:r.name,i="string"==typeof r?{}:r.args||{},o=n?tO.registry.get(n):tO.presets.normal;if("function"!=typeof o)return tO.registry.onNotFound(n);t=nx(o,this,e,i,this)}return null==t?e.map(e=>ci.create(e)):t.map(e=>ci.create(e))}findConnectionPoints(e,t,n){let r,i,o=this.cell,s=this.graph.options.connecting,l=o.getSource(),a=o.getTarget(),u=this.sourceView,c=this.targetView,h=e[0],d=e[e.length-1];if(u&&!u.isEdgeElement(this.sourceMagnet)){let e=this.sourceMagnet||u.container,i=new ca(h||n,t),o=l.connectionPoint||s.sourceConnectionPoint||s.connectionPoint;r=this.getConnectionPoint(o,u,e,i,"source")}else r=t;if(c&&!c.isEdgeElement(this.targetMagnet)){let e=this.targetMagnet||c.container,r=a.connectionPoint||s.targetConnectionPoint||s.connectionPoint,o=new ca(d||t,n);i=this.getConnectionPoint(r,c,e,o,"target")}else i=n;return{source:r,target:i}}getConnectionPoint(e,t,n,r,i){let o=r.end;if(null==e)return o;let s="string"==typeof e?e:e.name,l="string"==typeof e?{}:e.args,a=tP.registry.get(s);if("function"!=typeof a)return tP.registry.onNotFound(s);let u=nx(a,this,r,t,n,l||{},i);return u?u.round(this.POINT_ROUNDING):o}findMarkerPoints(e,t,n){let r,i,o=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},s=e[0],l=e[e.length-1],a=o("source");a&&(r=t.clone().move(s||n,-a));let u=o("target");return u&&(i=n.clone().move(l||t,-u)),this.sourceMarkerPoint=r||t.clone(),this.targetMarkerPoint=i||n.clone(),{source:r,target:i}}findPath(e,t,n){let r,i,o,s=this.cell.getConnector()||this.graph.options.connecting.connector;if("string"==typeof s?r=s:(r=s.name,i=s.args),r){let e=tM.registry.get(r);if("function"!=typeof e)return tM.registry.onNotFound(r);o=e}else o=tM.presets.normal;let l=nx(o,this,t,n,e,Object.assign(Object.assign({},i),{raw:!0}),this);return"string"==typeof l?ck.parse(l):l}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(null==this.labelContainer||!this.path)return this;let e=this.cell,t=e.getLabels();if(0===t.length)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 o=r9({},r,this.normalizeLabelPosition(n.position)),s=this.getLabelTransformationMatrix(o);i.setAttribute("transform",um(s))}return this}updateTerminalProperties(e){let t=this.cell,n=this.graph,r=t[e],i=r&&r.cell,o=`${e}View`;if(!i)return this[o]=null,this.updateTerminalMagnet(e),!0;let s=n.getCellById(i);if(!s)throw Error(`Edge's ${e} node with id "${i}" not exists`);let l=s.findView(n);return!!l&&(this[o]=l,this.updateTerminalMagnet(e),!0)}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&&"object"==typeof t.position&&t.position.angle||0}getLabelPositionArgs(e){let t=this.cell.getLabelAt(e);if(t&&t.position&&"object"==typeof t.position)return t.position.options}getDefaultLabelPositionArgs(){let e=this.cell.getDefaultLabel();if(e&&e.position&&"object"==typeof e.position)return e.position.options}mergeLabelPositionArgs(e,t){return null===e?null:void 0===e?null===t?null:t:r9({},t,e)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";let e=this.cache.pathCache;return ob(e,"data")||(e.data=this.path.serialize()),e.data||""}getConnectionSubdivisions(){if(null==this.path)return null;let e=this.cache.pathCache;return ob(e,"segmentSubdivisions")||(e.segmentSubdivisions=this.path.getSegmentSubdivisions()),e.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;let e=this.cache.pathCache;return ob(e,"length")||(e.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),e.length}getPointAtLength(e){return null==this.path?null:this.path.pointAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(e){return null==this.path?null:(lE(e)&&(e=parseFloat(e)/100),this.path.pointAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(e){return null==this.path?null:this.path.tangentAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(e){return null==this.path?null:this.path.tangentAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(e){return null==this.path?null:this.path.closestPoint(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(e){return null==this.path?null:this.path.closestPointLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(e){return null==this.path?null:this.path.closestPointNormalizedLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(e,t,n,r){let i,o,s,l={distance:0},a=0;"number"==typeof n?(a=n,i=r):i=n,null!=i&&(l.options=i);let u=i&&i.absoluteOffset,c=!(i&&i.absoluteDistance),h=i&&i.absoluteDistance&&i.reverseDistance,d=this.path,f={segmentSubdivisions:this.getConnectionSubdivisions()},g=new ci(e,t),p=d.closestPointT(g,f),m=this.getConnectionLength()||0,y=d.lengthAtT(p,f);if(c&&(y=m>0?y/m:0),h&&(y=-1*(m-y)||1),l.distance=y,u||(o=d.tangentAtT(p)),o)s=o.pointOffset(g);else{let e=d.pointAtT(p),t=g.diff(e);s={x:t.x,y:t.y}}return l.offset=s,l.angle=a,l}normalizeLabelPosition(e){return"number"==typeof e?{distance:e}:e}getLabelTransformationMatrix(e){let t,n=this.normalizeLabelPosition(e),r=n.options||{},i=n.angle||0,o=n.distance,s=0,l={x:0,y:0},a=n.offset;a&&("number"==typeof a?s=a:(null!=a.x&&(l.x=a.x),null!=a.y&&(l.y=a.y)));let u=0!==l.x||0!==l.y||0===s,c=r.keepGradient,h=r.ensureLegibility,d=this.path,f={segmentSubdivisions:this.getConnectionSubdivisions()},g=o>0&&o<=1?o*this.getConnectionLength():o,p=d.tangentAtLength(g,f),m=i;if(p){if(u)(t=p.start).translate(l);else{let e=p.clone();e.rotate(-90,p.start),e.setLength(s),t=e.end}c&&(m=p.angle()+i,h&&(m=tl.normalize((m+90)%180-90)))}else t=d.start,u&&t.translate(l);return uf().translate(t.x,t.y).rotate(m)}getVertexIndex(e,t){let n=this.cell.getVertices(),r=this.getClosestPointLength(new ci(e,t)),i=0;if(null!=r)for(let e=n.length;i<e;i+=1){let e=n[i],t=this.getClosestPointLength(e);if(null!=t&&r<t)break}return i}getEventArgs(e,t,n){let r=this.cell;return null==t||null==n?{e,view:this,edge:r,cell:r}:{e,x:t,y:n,view:this,edge:r,cell:r}}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(ao(e.target,"edge-tool",this.container)){if(e.stopPropagation(),this.can("useEdgeTools")){if("edge:remove"===t)return void this.cell.remove({ui:!0});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){if(!this.can("edgeMovable"))return void this.notifyUnhandledMouseDown(e,t,n);this.setEventData(e,{x:t,y:n,moving:!1,action:"drag-edge"})}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:!0===t.isNewEdge,terminalType:e,initialMagnet:n,initialTerminal:ov(this.cell[e]),fallbackAction:t.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(e),options:t.options};return this.beforeArrowheadDragging(r),r}createValidateConnectionArgs(e){let t,n=[];n[4]=e,n[5]=this;let r=0,i=0;"source"===e?(r=2,t="target"):(i=2,t="source");let o=this.cell[t],s=o.cell;if(s){let e,t=n[r]=this.graph.findViewByCell(s);t&&(e=t.getMagnetFromEdgeTerminal(o))===t.container&&(e=void 0),n[r+1]=e}return(e,t)=>(n[i]=e,n[i+1]=e.container===t?void 0:t,n)}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){null!=e.zIndex&&(this.cell.setZIndex(e.zIndex,{ui:!0}),e.zIndex=null),this.container.style.pointerEvents=e.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(e)}validateConnection(e,t,n,r,i,o,s){let l=this.graph.options.connecting,a=l.allowLoop,u=l.allowNode,c=l.allowEdge,h=l.allowPort,d=l.allowMulti,f=l.validateConnection,g=o?o.cell:null,p="target"===i?n:e,m="target"===i?r:t,y=!0,b=l=>{let a="source"===i?s?s.port:null:g?g.getSourcePortId():null,u="target"===i?s?s.port:null:g?g.getTargetPortId():null;return nx(l,this.graph,{edge:g,edgeView:o,sourceView:e,targetView:n,sourcePort:a,targetPort:u,sourceMagnet:t,targetMagnet:r,sourceCell:e?e.cell:null,targetCell:n?n.cell:null,type:i})};if(null!=a&&("boolean"==typeof a?a||e!==n||(y=!1):y=b(a)),y&&null!=h&&("boolean"==typeof h?!h&&m&&(y=!1):y=b(h)),y&&null!=c&&("boolean"==typeof c?!c&&gB.isEdgeView(p)&&(y=!1):y=b(c)),y&&null!=u&&null==m&&("boolean"==typeof u?!u&&gD.isNodeView(p)&&(y=!1):y=b(u)),y&&null!=d&&o){let e=o.cell,t="source"===i?s:e.getSource(),n="target"===i?s:e.getTarget(),r=s?this.graph.getCellById(s.cell):null;if(t&&n&&t.cell&&n.cell&&r)if("function"==typeof d)y=b(d);else{let e=this.graph.model.getConnectedEdges(r,{outgoing:"source"===i,incoming:"target"===i});e.length&&("withPort"===d?e.some(e=>{let r=e.getSource(),i=e.getTarget();return r&&i&&r.cell===t.cell&&i.cell===n.cell&&null!=r.port&&r.port===t.port&&null!=i.port&&i.port===n.port})&&(y=!1):!d&&e.some(e=>{let r=e.getSource(),i=e.getTarget();return r&&i&&r.cell===t.cell&&i.cell===n.cell})&&(y=!1))}}return y&&null!=f&&(y=b(f)),y}allowConnectToBlank(e){let t=this.graph,n=t.options.connecting.allowBlank;if("function"!=typeof n)return!!n;let r=t.findViewByCell(e),i=e.getSourceCell(),o=e.getTargetCell(),s=t.findViewByCell(i),l=t.findViewByCell(o);return nx(n,t,{edge:e,edgeView:r,sourceCell:i,targetCell:o,sourceView:s,targetView:l,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||nx(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 o=e.terminalType,s=r.getEdgeTerminal(i,t,n,this.cell,o);this.cell.setTerminal(o,s,{ui:!0})}snapArrowhead(e,t,n){let r,i,o=this.graph,{snap:s,allowEdge:l}=o.options.connecting,a="object"==typeof s&&s.radius||50,u=o.renderer.findViewsInArea({x:e-a,y:t-a,width:2*a,height:2*a},{nodeOnly:!0});if(l){let n=o.renderer.findEdgeViewsFromPoint({x:e,y:t},a).filter(e=>e!==this);u.push(...n)}let c=n.closestView||null,h=n.closestMagnet||null;n.closestView=null,n.closestMagnet=null;let d=Number.MAX_SAFE_INTEGER,f=new ci(e,t);u.forEach(i=>{if("false"!==i.container.getAttribute("magnet")){if(i.isNodeView())r=i.cell.getBBox().getCenter().distance(f);else if(i.isEdgeView()){let e=i.getClosestPoint(f);r=e?e.distance(f):Number.MAX_SAFE_INTEGER}r<a&&r<d&&(h===i.container||this.validateConnection(...n.getValidateConnectionArgs(i,null),i.getEdgeTerminal(i.container,e,t,this.cell,n.terminalType)))&&(d=r,n.closestView=i,n.closestMagnet=i.container)}i.container.querySelectorAll("[magnet]").forEach(o=>{if("false"!==o.getAttribute("magnet")){let s=i.getBBoxOfElement(o);(r=f.distance(s.getCenter()))<a&&r<d&&(h===o||this.validateConnection(...n.getValidateConnectionArgs(i,o),i.getEdgeTerminal(o,e,t,this.cell,n.terminalType)))&&(d=r,n.closestView=i,n.closestMagnet=o)}})});let g=n.terminalType,p=n.closestView,m=n.closestMagnet,y=h!==m;if(c&&y&&c.unhighlight(h,{type:"magnetAdsorbed"}),p){if(!y)return;p.highlight(m,{type:"magnetAdsorbed"}),i=p.getEdgeTerminal(m,e,t,this.cell,g)}else i={x:e,y:t};this.cell.setTerminal(g,i,{},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){"remove"===e.fallbackAction?this.cell.remove({ui:!0}):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&&!gC.equalTerminals(r,i)){let o=this.graph,s=r.cell?o.getCellById(r.cell):null,l=r.port,a=s?o.findViewByCell(s):null,u=s||e.isNewEdge?null:ci.create(r).toJSON(),c=i.cell?o.getCellById(i.cell):null,h=i.port,d=c?o.findViewByCell(c):null,f=c?null:ci.create(i).toJSON();this.notify("edge:connected",{e:t,previousCell:s,previousPort:l,previousView:a,previousPoint:u,currentCell:c,currentView:d,currentPort:h,currentPoint:f,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 o=Array.prototype.slice.call(i.container.querySelectorAll("[magnet]"));"false"!==i.container.getAttribute("magnet")&&o.push(i.container);let s=o.filter(t=>this.validateConnection(...e.getValidateConnectionArgs(i,t),i.getEdgeTerminal(t,e.x,e.y,this.cell,e.terminalType)));if(s.length>0){for(let e=0,t=s.length;e<t;e+=1)i.highlight(s[e],{type:"magnetAvailable"});i.highlight(null,{type:"nodeAvailable"}),e.marked[i.cell.id]=s}}}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"))return void this.notifyUnhandledMouseDown(e,t,n);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=parseInt(e.currentTarget.getAttribute("data-index"),10),n=this.getLabelPositionAngle(t),r=this.getLabelPositionArgs(t),i=this.getDefaultLabelPositionArgs(),o=this.mergeLabelPositionArgs(r,i);this.setEventData(e,{index:t,positionAngle:n,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=r9({},this.cell.getLabelAt(r.index),{position:this.getLabelPosition(t,n,r.positionAngle,r.positionArgs)});this.cell.setLabelAt(r.index,i)}stopLabelDragging(e,t,n){}}(e$=gB||(gB={})).toStringTag=`X6.${e$.name}`,e$.isEdgeView=function(e){if(null==e)return!1;if(e instanceof e$)return!0;let t=e[Symbol.toStringTag];return(null==t||t===e$.toStringTag)&&"function"==typeof e.isNodeView&&"function"==typeof e.isEdgeView&&"function"==typeof e.confirmUpdate&&"function"==typeof e.update&&"function"==typeof e.getConnection||!1},gB.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"]}}),gB.registry.register("edge",gB,!0);class gV extends dq{get options(){return this.graph.options}constructor(e){super(),this.graph=e;let{selectors:t,fragment:n}=tv.parseJSONMarkup(gV.markup);this.background=t.background,this.grid=t.grid,this.svg=t.svg,this.defs=t.defs,this.viewport=t.viewport,this.primer=t.primer,this.stage=t.stage,this.decorator=t.decorator,this.overlay=t.overlay,this.container=this.options.container,this.restore=gV.snapshoot(this.container),lQ(this.container,this.prefixClassName("graph")),au(this.container,n),this.delegateEvents()}delegateEvents(){let e=this.constructor;return super.delegateEvents(e.events),this}guard(e,t){return!!("mousedown"===e.type&&2===e.button||this.options.guard&&this.options.guard(e,t))||(e.data&&void 0!==e.data.guarded?e.data.guarded:!(t&&t.cell&&gy.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"function"==typeof t&&(t=nx(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){null==e.data&&(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||(null==t.mouseMovedCount&&(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),o=t.currentView;o?o.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 uV(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),o=Math.max(-1,Math.min(1,r.wheelDelta||-r.detail));n?n.onMouseWheel(t,i.x,i.y,o):this.graph.trigger("blank:mousewheel",{e:t,delta:o,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&&"false"!==r.toLowerCase()){let r=this.findView(n);if(r){let i=this.normalizeEvent(e);if(this.guard(i,r))return;let o=this.graph.snapToGrid(i.clientX,i.clientY);nx(t,this.graph,r,i,n,o.x,o.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=()=>{}}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([dq.dispose()],gV.prototype,"dispose",null);var gF=gV||(gV={});let g$=`${dl.prefixCls}-graph`;gF.markup=[{ns:l5.xhtml,tagName:"div",selector:"background",className:`${g$}-background`},{ns:l5.xhtml,tagName:"div",selector:"grid",className:`${g$}-grid`},{ns:l5.svg,tagName:"svg",selector:"svg",className:`${g$}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":l5.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${g$}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${g$}-svg-primer`},{tagName:"g",selector:"stage",className:`${g$}-svg-stage`},{tagName:"g",selector:"decorator",className:`${g$}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${g$}-svg-overlay`}]}]}],gF.snapshoot=function(e){let t=e.cloneNode();return e.childNodes.forEach(e=>t.appendChild(e)),()=>{for(aa(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))}};var gU=gV||(gV={});let gG=dl.prefixCls;gU.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${gG}-cell`]:"onMouseEnter",[`mouseleave .${gG}-cell`]:"onMouseLeave",[`mouseenter .${gG}-cell-tools`]:"onMouseEnter",[`mouseleave .${gG}-cell-tools`]:"onMouseLeave",[`mousedown .${gG}-cell [event]`]:"onCustomEvent",[`touchstart .${gG}-cell [event]`]:"onCustomEvent",[`mousedown .${gG}-cell [data-event]`]:"onCustomEvent",[`touchstart .${gG}-cell [data-event]`]:"onCustomEvent",[`dblclick .${gG}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${gG}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${gG}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${gG}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${gG}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${gG}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${gG}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${gG}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${gG}-cell image`]:"onImageDragStart",[`mousedown .${gG}-edge .${gG}-edge-label`]:"onLabelMouseDown",[`touchstart .${gG}-edge .${gG}-edge-label`]:"onLabelMouseDown"},gU.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"};let gH=`.x6-graph {
|
|
271
|
+
`;return r.raw?ck.parse(a):a},gs=function(e,t,n,r={}){let i,o,s=new ck;s.appendSegment(ck.createSegment("M",e));let l=1/3,a=2/3,u=r.radius||10;for(let r=0,c=n.length;r<c;r+=1){let c=ci.create(n[r]),h=n[r-1]||e,d=n[r+1]||t;i=o||c.distance(h)/2,o=c.distance(d)/2;let f=-Math.min(u,i),g=-Math.min(u,o),p=c.clone().move(h,f).round(),m=c.clone().move(d,g).round(),y=new ci(l*p.x+a*c.x,a*c.y+l*p.y),b=new ci(l*m.x+a*c.x,a*c.y+l*m.y);s.appendSegment(ck.createSegment("L",p)),s.appendSegment(ck.createSegment("C",y,b,m))}return s.appendSegment(ck.createSegment("L",t)),r.raw?s:s.serialize()},gl=function(e,t,n,r={}){let i,o=r.direction;if(n&&0!==n.length){let r=[e,...n,t],o=cm.throughPoints(r);i=new ck(o)}else if((i=new ck).appendSegment(ck.createSegment("M",e)),o||(o=Math.abs(e.x-t.x)>=Math.abs(e.y-t.y)?"H":"V"),"H"===o){let n=(e.x+t.x)/2;i.appendSegment(ck.createSegment("C",n,e.y,n,t.y,t.x,t.y))}else{let n=(e.y+t.y)/2;i.appendSegment(ck.createSegment("C",e.x,n,t.x,n,t.x,t.y))}return r.raw?i:i.serialize()},ga=1/3,gu=2/3;function gc(e,t,n=[]){let r=[e,...n,t],i=[];return r.forEach((e,t)=>{let n=r[t+1];null!=n&&i.push(new ca(e,n))}),i}function gh(e,t){return new ca(e,t).squaredLength()}function gd(e,t,n,r){let o,s=new ck;return o=ck.createSegment("M",e[0].start),s.appendSegment(o),e.forEach((l,a)=>{if(i.includes(l)){let e,r,i,a;if("arc"===n){let t;e=-90,((r=l.start.diff(l.end)).x<0||0===r.x&&r.y<0)&&(e+=180);let n=l.getCenter(),u=new ca(n,l.end).rotate(e,n);i=(t=new ca(l.start,n)).pointAt(2/3).rotate(e,l.start),a=u.pointAt(1/3).rotate(-e,u.end),o=ck.createSegment("C",i,a,u.end),s.appendSegment(o),t=new ca(n,l.end),i=u.pointAt(1/3).rotate(e,u.end),a=t.pointAt(1/3).rotate(-e,l.end),o=ck.createSegment("C",i,a,l.end),s.appendSegment(o)}else if("gap"===n)o=ck.createSegment("M",l.end),s.appendSegment(o);else if("cubic"===n){e=l.start.theta(l.end);let n=.6*t,u=1.35*t;((r=l.start.diff(l.end)).x<0||0===r.x&&r.y<0)&&(u*=-1),i=new ci(l.start.x+n,l.start.y+u).rotate(e,l.start),a=new ci(l.end.x-n,l.end.y+u).rotate(e,l.end),o=ck.createSegment("C",i,a,l.end),s.appendSegment(o)}}else{let t=e[a+1];0===r||!t||i.includes(t)?(o=ck.createSegment("L",l.end),s.appendSegment(o)):function(e,t,n,r,i){let o,s=n.distance(r)/2,l=n.distance(i)/2,a=-Math.min(e,s),u=-Math.min(e,l),c=n.clone().move(r,a).round(),h=n.clone().move(i,u).round(),d=new ci(ga*c.x+gu*n.x,gu*n.y+ga*c.y),f=new ci(ga*h.x+gu*n.x,gu*n.y+ga*h.y);o=ck.createSegment("L",c),t.appendSegment(o),o=ck.createSegment("C",d,f,h),t.appendSegment(o)}(r,s,l.end,l.start,t.end)}}),s}let gf=function(e,t,n,r={}){i=[],o=[];var s=this;let l=s.graph._jumpOverUpdateList;if(null==l&&(l=s.graph._jumpOverUpdateList=[],s.graph.on("cell:mouseup",()=>{let e=s.graph._jumpOverUpdateList;setTimeout(()=>{for(let t=0;t<e.length;t+=1)e[t].update()})}),s.graph.on("model:reseted",()=>{l=s.graph._jumpOverUpdateList=[]})),0>l.indexOf(s)){l.push(s);let e=()=>l.splice(l.indexOf(s),1);s.cell.once("change:connector",e),s.cell.once("removed",e)}let a=r.size||5,u=r.type||"arc",c=r.radius||0,h=r.ignoreConnectors||["smooth"],d=this.graph,f=d.model.getEdges();if(1===f.length)return gd(gc(e,t,n),a,u,c);let g=this.cell,p=f.indexOf(g),m=d.options.connecting.connector||{},y=f.filter((e,t)=>{let n=e.getConnector()||m;return!h.includes(n.name)&&(!(t>p)||"jumpover"!==n.name)}),b=y.map(e=>d.findViewByCell(e)),v=gc(e,t,n),x=b.map(e=>null==e?[]:e===this?v:gc(e.sourcePoint,e.targetPoint,e.routePoints)),w=[];v.forEach(e=>{let t=y.reduce((t,n,r)=>{if(n!==g){let n=function(e,t){let n=[];return t.forEach(t=>{let r=e.intersectsWithLine(t);r&&n.push(r)}),n}(e,x[r]);t.push(...n)}return t},[]).sort((t,n)=>gh(e.start,t)-gh(e.start,n));if(t.length>0)w.push(...t.reduce((n,r,s)=>{if(o.includes(r))return n;let l=n.pop()||e,u=ci.create(r).move(l.start,-a),c=ci.create(r).move(l.start,+a),h=t[s+1];if(null!=h){let e=c.distance(h);e<=a&&(c=h.move(l.start,e),o.push(h))}else if(u.distance(l.end)<2*a+1)return n.push(l),n;if(c.distance(l.start)<2*a+1)return n.push(l),n;let d=new ca(u,c);return i.push(d),n.push(new ca(l.start,u),d,new ca(c,l.end)),n},[]));else w.push(e)});let C=gd(w,a,u,c);return i=[],o=[],r.raw?C:C.serialize()};(ek=tM||(tM={})).presets=tQ,ek.registry=cA.create({type:"connector"}),ek.registry.register(ek.presets,!0);class gg extends oQ{constructor(e={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(of(e)),this.changed={}}mutate(e,t={}){let n=!0===t.unset,r=!0===t.silent,i=[],o=this.changing;this.changing=!0,o||(this.previous=of(this.data),this.changed={});let s=this.data,l=this.previous,a=this.changed;if(Object.keys(e).forEach(t=>{let r=e[t];oz(s[t],r)||i.push(t),oz(l[t],r)?delete a[t]:a[t]=r,n?delete s[t]:s[t]=r}),!r&&i.length>0&&(this.pending=!0,this.pendingOptions=t,i.forEach(e=>{this.emit("change:*",{key:e,options:t,store:this,current:s[e],previous:l[e]})})),o)return this;if(!r)for(;this.pending;)this.pending=!1,this.emit("changed",{current:s,previous:l,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(e,t){if(null==e)return this.data;let n=this.data[e];return null==n?t:n}getPrevious(e){if(this.previous){let t=this.previous[e];return null==t?void 0:t}}set(e,t,n){return null!=e&&("object"==typeof e?this.mutate(e,t):this.mutate({[e]:t},n)),this}remove(e,t){let n,r=void 0,i={};if("string"==typeof e)i[e]=r,n=t;else if(Array.isArray(e))e.forEach(e=>i[e]=r),n=t;else{for(let e in this.data)i[e]=r;n=e}return this.mutate(i,Object.assign(Object.assign({},n),{unset:!0})),this}getByPath(e){return oJ(this.data,e,"/")}setByPath(e,t,n={}){let r=Array.isArray(e)?[...e]:e.split("/"),i=Array.isArray(e)?e.join("/"):e,o=r[0],s=r.length;if(n.propertyPath=i,n.propertyValue=t,n.propertyPathArray=r,1===s)this.set(o,t,n);else{let i={},l=i,a=o;for(let e=1;e<s;e+=1){let t=r[e],n=Number.isFinite(Number(t));l=l[a]=n?[]:{},a=t}oX(i,r,t,"/");let u=of(this.data);n.rewrite&&oY(u,e,"/");let c=r9(u,i);this.set(o,c[o],n)}return this}removeByPath(e,t){let n=Array.isArray(e)?e:e.split("/"),r=n[0];if(1===n.length)this.remove(r,t);else{let e=n.slice(1),i=of(this.get(r));i&&oY(i,e),this.set(r,i,t)}return this}hasChanged(e){return null==e?Object.keys(this.changed).length>0:e in this.changed}getChanges(e){let t;if(null==e)return this.hasChanged()?of(this.changed):null;let n=this.changing?this.previous:this.data,r={};for(let i in e){let o=e[i];oz(n[i],o)||(r[i]=o,t=!0)}return t?of(r):null}toJSON(){return of(this.data)}clone(){return new this.constructor(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})}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([oQ.dispose()],gg.prototype,"dispose",null);class gp{constructor(e){this.cell=e,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(e,t,n={},r="/"){let i=this.cell.getPropByPath(e),o=ie(n,gp.defaultOptions),s=this.getTiming(o.timing),l=this.getInterp(o.interp,i,t),a=0,u=Array.isArray(e)?e.join(r):e,c=Array.isArray(e)?e:e.split(r),h=()=>{let e=new Date().getTime();0===a&&(a=e);let t=(e-a)/o.duration;t<1?this.ids[u]=requestAnimationFrame(h):t=1;let r=l(s(t));this.cell.setPropByPath(c,r),n.progress&&n.progress(Object.assign({progress:t,currentValue:r},this.getArgs(u))),1===t&&(this.cell.notify("transition:complete",this.getArgs(u)),n.complete&&n.complete(this.getArgs(u)),this.cell.notify("transition:finish",this.getArgs(u)),n.finish&&n.finish(this.getArgs(u)),this.clean(u))};return setTimeout(()=>{this.stop(e,void 0,r),this.cache[u]={startValue:i,targetValue:t,options:o},this.ids[u]=requestAnimationFrame(h),this.cell.notify("transition:start",this.getArgs(u)),n.start&&n.start(this.getArgs(u))},n.delay),this.stop.bind(this,e,r,n)}stop(e,t={},n="/"){let r=Array.isArray(e)?e:e.split(n);return Object.keys(this.ids).filter(e=>oz(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),o=i.jumpedToEnd;o&&null!=n.targetValue&&(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 s=Object.assign({jumpedToEnd:o},r);this.cell.notify("transition:stop",Object.assign({},s)),i.stop&&i.stop(Object.assign({},s)),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"string"==typeof e?to[e]:e}getInterp(e,t,n){return e?e(t,n):"number"==typeof n?ts.number(t,n):"string"==typeof n?"#"===n[0]?ts.color(t,n):ts.unit(t,n):ts.object(t,n)}getArgs(e){let t=this.cache[e];return{path:e,startValue:t.startValue,targetValue:t.targetValue,cell:this.cell}}}(gp||(gp={})).defaultOptions={delay:10,duration:100,timing:"linear"};var gm=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gy extends oQ{static config(e){let{markup:t,propHooks:n,attrHooks:r}=e,i=gm(e,["markup","propHooks","attrHooks"]);null!=t&&(this.markup=t),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):"function"==typeof n?this.propHooks.push(n):Object.values(n).forEach(e=>{"function"==typeof e&&this.propHooks.push(e)})),r&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),r)),this.defaults=r9({},this.defaults,i)}static getMarkup(){return this.markup}static getDefaults(e){return e?this.defaults:of(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(e,t){return this.propHooks.reduce((t,n)=>n?nx(n,e,t):t,t)}get[Symbol.toStringTag](){return gy.toStringTag}constructor(e={}){super();let t=this.constructor.getDefaults(!0),n=r9({},this.preprocess(t),this.preprocess(e));this.id=n.id||lb(),this.store=new gg(n),this.animation=new gp(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 null==n&&!0!==t&&(r.id=lb()),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}),("source"===t||"target"===t)&&this.notify("change:terminal",{type:t,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 null==e?this.store.get():this.store.get(e,t)}setProp(e,t,n){if("string"==typeof e)this.store.set(e,t,n);else{let n=this.preprocess(e,!0);this.store.set(r9({},this.getProp(),n),t),this.postprocess(e)}return this}removeProp(e,t){return"string"==typeof e||Array.isArray(e)?this.store.removeByPath(e,t):this.store.remove(t),this}hasChanged(e){return null==e?this.store.hasChanged():this.store.hasChanged(e)}getPropByPath(e){return this.store.getByPath(e)}setPropByPath(e,t,n={}){return this.model&&("children"===e?this._children=t?t.map(e=>this.model.getCell(e)).filter(e=>null!=e):null:"parent"===e&&(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"attrs"===n[0]&&(t.dirty=!0),this.store.removeByPath(n,t),this}prop(e,t,n){return null==e?this.getProp():"string"==typeof e||Array.isArray(e)?1==arguments.length?this.getPropByPath(e):null==t?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){null==e?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,r=t.getMaxZIndex();e.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0})).unshift(this):n=[this],r=r-n.length+1;let i=t.total(),o=t.indexOf(this)!==i-n.length;o||(o=n.some((e,t)=>e.getZIndex()!==r+t)),o&&this.batchUpdate("to-front",()=>{r+=n.length,n.forEach((t,n)=>{t.setZIndex(r+n,e)})})}return this}toBack(e={}){let t=this.model;if(t){let n,r=t.getMinZIndex();e.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0})).unshift(this):n=[this];let i=0!==t.indexOf(this);i||(i=n.some((e,t)=>e.getZIndex()!==r+t)),i&&this.batchUpdate("to-back",()=>{r-=n.length,n.forEach((t,n)=>{t.setZIndex(r+n,e)})})}return this}get markup(){return this.getMarkup()}set markup(e){null==e?this.removeMarkup():this.setMarkup(e)}getMarkup(){let e=this.store.get("markup");return null==e&&(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){null==e?this.removeAttrs():this.setAttrs(e)}getAttrs(){let e=this.store.get("attrs");return e?Object.assign({},e):{}}setAttrs(e,t={}){if(null==e)this.removeAttrs(t);else{let n=e=>this.store.set("attrs",e,t);if(!0===t.overwrite)n(e);else{let r=this.getAttrs();n(!1===t.deep?Object.assign(Object.assign({},r),e):r9({},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]||td.registry.get(e);if(!n){let r=lc(e);n=t[r]||td.registry.get(r)}return n||null}getAttrByPath(e){return null==e||""===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 null==e?this.getAttrByPath():"string"==typeof e||Array.isArray(e)?1==arguments.length?this.getAttrByPath(e):null==t?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!1!==this.store.get("visible")}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="boolean"==typeof e?e:!this.isVisible(),r="boolean"==typeof e?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(null==e)this.removeData(t);else{let n=e=>this.store.set("data",e,t);if(!0===t.overwrite)n(e);else{let r=this.getData();n(!1===t.deep?"object"==typeof e?Object.assign(Object.assign({},r),e):e:r9({},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=>{var t;return null==(t=this.model)?void 0:t.getCell(e)}).filter(e=>null!=e);return this._children=t,[...t]}return null}hasParent(){return null!=this.parent}isParentOf(e){return null!=e&&e.getParent()===this}isChildOf(e){return null!=e&&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 null==this.children?0:this.children.length}getChildIndex(e){return null==this.children?-1:this.children.indexOf(e)}getChildAt(e){return null!=this.children&&e>=0?this.children[e]:null}getAncestors(e={}){let t=[],n=this.getParent();for(;n;)t.push(n),n=!1!==e.deep?n.getParent():null;return t}getDescendants(e={}){if(!1!==e.deep){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(null==e)return!1;if(!1!==t.deep){let t=this.getParent();for(;t;){if(t===e)return!0;t=t.getParent()}return!1}return this.isChildOf(e)}isAncestorOf(e,t={}){return null!=e&&e.isDescendantOf(this,t)}contains(e){return this.isAncestorOf(e)}getCommonAncestor(...e){return gy.getCommonAncestor(this,...e)}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,null!=e?this.store.set("children",e.map(e=>e.id),t):this.store.remove("children",t),this}unembed(e,t={}){let n=this.children;if(null!=n&&null!=e){let r=this.getChildIndex(e);-1!==r&&(n.splice(r,1),e.setParent(null,t),this.setChildren(n,t))}return this}embed(e,t={}){return e.addTo(this,t),this}addTo(e,t={}){return gy.isCell(e)?e.addChild(this,t):e.addCell(this,t),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(null!=e&&e!==this){let r=e.getParent(),i=this!==r,o=t;if(null==o&&(o=this.getChildCount(),i||(o-=1)),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 s=this.children;if(null==s?(s=[]).push(e):s.splice(o,0,e),e.setParent(this,n),this.setChildren(s,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(null!=t){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 null!=this.children&&null!=n&&(this.unembed(n,t),n.remove(t)),n}remove(e={}){return this.batchUpdate("remove",()=>{let t=this.getParent();t&&t.removeChild(this,e),!1!==e.deep&&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="string"==typeof t?t:null,o="object"==typeof t?t:"object"==typeof n?n:{};if(o.reset)return this.setTools({name:i,items:r,local:o.local},o);let s=of(this.getTools());if(null==s||null==i||s.name===i)return null==s&&(s={}),s.items||(s.items=[]),s.name=i,s.items=[...s.items,...r],this.setTools(Object.assign({},s),o)}setTools(e,t={}){return null==e?this.removeTools():this.store.set("tools",gy.normalizeTools(e),t),this}getTools(){return this.store.get("tools")}removeTools(e={}){return this.store.remove("tools",e),this}hasTools(e){let t=this.getTools();return null!=t&&(null==e||t.name===e)}hasTool(e){let t=this.getTools();return null!=t&&t.items.some(t=>"string"==typeof t?t===e:t.name===e)}removeTool(e,t={}){let n=of(this.getTools());if(n){let r=!1,i=n.items.slice(),o=e=>{i.splice(e,1),r=!0};if("number"==typeof e)o(e);else for(let t=i.length-1;t>=0;t-=1){let n=i[t];("string"==typeof n?n===e:n.name===e)&&o(t)}r&&(n.items=i,this.setTools(n,t))}return this}getBBox(e){return new co}getConnectionPoint(e,t){return new ci}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,o=!0===e.diff,s=t.attrs||{},l=i.getDefaults(!0),a=o?this.preprocess(l,!0):l,u=a.attrs||{},c={};Object.entries(t).forEach(([e,i])=>{if(null!=i&&!Array.isArray(i)&&"object"==typeof i&&!rj(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}"`);"attrs"!==e&&"shape"!==e&&o&&oz(i,a[e])&&delete t[e]}),Object.keys(s).forEach(e=>{let t=s[e],n=u[e];Object.keys(t).forEach(r=>{let i=t[r],o=n?n[r]:null;null==i||"object"!=typeof i||Array.isArray(i)?null!=n&&oz(o,i)||(null==c[e]&&(c[e]={}),c[e][r]=i):Object.keys(i).forEach(t=>{let s=i[t];null!=n&&null!=o&&t0(o)&&oz(o[t],s)||(null==c[e]&&(c[e]={}),null==c[e][r]&&(c[e][r]={}),c[e][r][t]=s)})})});let h=Object.assign(Object.assign({},t),{attrs:op(c)?void 0:c});return null==h.attrs&&delete h.attrs,0===h.angle&&delete h.angle,of(h)}clone(e={}){if(!e.deep){let t=Object.assign({},this.store.get());return e.keepId||delete t.id,delete t.parent,delete t.children,new this.constructor(t)}return gy.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()}}gy.defaults={},gy.attrHooks={},gy.propHooks=[],function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([oQ.dispose()],gy.prototype,"dispose",null),(gy||(gy={})).normalizeTools=function(e){return"string"==typeof e?{items:[e]}:Array.isArray(e)?{items:e}:e.items?e:{items:[e]}},(eO=gy||(gy={})).toStringTag=`X6.${eO.name}`,eO.isCell=function(e){if(null==e)return!1;if(e instanceof eO)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eO.toStringTag)&&"function"==typeof e.isNode&&"function"==typeof e.isEdge&&"function"==typeof e.prop&&"function"==typeof e.attr},(eM=gy||(gy={})).getCommonAncestor=function(...e){let t=e.filter(e=>null!=e).map(e=>e.getAncestors()).sort((e,t)=>e.length-t.length);return t.shift().find(e=>t.every(t=>t.includes(e)))||null},eM.getCellsBBox=function(e,t={}){let n=null;for(let r=0,i=e.length;r<i;r+=1){let i=e[r],o=i.getBBox(t);if(o){if(i.isNode()){let e=i.getAngle();null!=e&&0!==e&&(o=o.bbox(e))}n=null==n?o:n.union(o)}}return n},eM.deepClone=function(e){let t=[e,...e.getDescendants({deep:!0})];return eM.cloneCells(t)},eM.cloneCells=function(e){let t=o6(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},(eA=gy||(gy={})).config({propHooks(e){var{tools:t}=e,n=gm(e,["tools"]);return t&&(n.tools=eA.normalizeTools(t)),n}}),(eT=tA||(tA={})).exist=function(e,t){return t?null!=a&&a.exist(e):null!=u&&u.exist(e)},eT.setEdgeRegistry=function(e){a=e},eT.setNodeRegistry=function(e){u=e};class gb{constructor(e){this.ports=[],this.groups={},this.init(of(e))}getPorts(){return this.ports}getGroup(e){return null!=e?this.groups[e]:null}getPortsByGroup(e){return this.ports.filter(t=>t.group===e||null==t.group&&null==e)}getPortsLayoutByGroup(e,t){let n,r=this.getPortsByGroup(e),i=e?this.getGroup(e):null,o=i?i.position:null,s=o?o.name:null;if(null!=s){let e=tm.registry.get(s);if(null==e)return tm.registry.onNotFound(s);n=e}else n=tm.presets.left;return n(r.map(e=>e&&e.position&&e.position.args||{}),t,o&&o.args||{}).map((e,n)=>{let i=r[n];return{portLayout:e,portId:i.id,portSize:i.size,portAttrs:i.attrs,labelSize:i.label.size,labelLayout:this.getPortLabelLayout(i,ci.create(e.position),t)}})}init(e){let{groups:t,items:n}=e;null!=t&&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=r9({},n.attrs,t.attrs),t.position=this.createPosition(n,t),t.label=r9({},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"number"==typeof t.zIndex?t.zIndex:"number"==typeof e.zIndex||"auto"===e.zIndex?e.zIndex:"auto"}createPosition(e,t){return r9({name:"left",args:{}},e.position,{args:t.args})}getPortPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if(Array.isArray(e))return{name:"absolute",args:{x:e[0],y:e[1]}};if("object"==typeof e)return e}return{args:{}}}getPortLabelPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if("object"==typeof e)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||{},o=ty.registry.get(r)||ty.presets.left;return o?o(t,n,i):null}}var gv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gx extends gy{get[Symbol.toStringTag](){return gx.toStringTag}constructor(e={}){super(e),this.initPorts()}preprocess(e,t){let{x:n,y:r,width:i,height:o}=e,s=gv(e,["x","y","width","height"]);if(null!=n||null!=r){let e=s.position;s.position=Object.assign(Object.assign({},e),{x:null!=n?n:e?e.x:0,y:null!=r?r:e?e.y:0})}if(null!=i||null!=o){let e=s.size;s.size=Object.assign(Object.assign({},e),{width:null!=i?i:e?e.width:0,height:null!=o?o:e?e.height:0})}return super.preprocess(s,t)}isNode(){return!0}size(e,t,n){return void 0===e?this.getSize():"number"==typeof e?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"object"==typeof e?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,o=this.getSize();switch(r){case"left":case"right":t=o.height;break;case"top":case"bottom":e=o.width}let s={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[r],l=tl.normalize(this.getAngle()||0);n.absolute&&(s+=Math.floor((l+45)/90),s%=4);let a=this.getBBox(),u=(0===s?a.getBottomLeft():1===s?a.getCorner():2===s?a.getTopRight():a.getOrigin()).clone().rotate(-l,a.getCenter()),c=Math.sqrt(e*e+t*t)/2,h=s*Math.PI/2;h+=Math.atan(s%2==0?t/e:e/t),h-=tl.toRad(l);let d=ci.fromPolar(c,h,u).clone().translate(-(e/2),-(t/2));this.store.set("size",{width:e,height:t},n),this.setPosition(d.x,d.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,null==n?void 0:n);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"number"==typeof e?this.setPosition(e,t,n):this.getPosition(e)}getPosition(e={}){if(e.relative){let e=this.getParent();if(null!=e&&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,o;if("object"==typeof e?(r=e.x,i=e.y,o=t||{}):(r=e,i=t,o=n||{}),o.relative){let e=this.getParent();if(null!=e&&e.isNode()){let t=e.getPosition();r+=t.x,i+=t.y}}if(o.deep){let e=this.getPosition();this.translate(r-e.x,i-e.y,o)}else this.store.set("position",{x:r,y:i},o);return this}translate(e=0,t=0,n={}){if(0===e&&0===t)return this;n.translateBy=n.translateBy||this.id;let r=this.getPosition();if(null!=n.restrict&&n.translateBy===this.id){let i=this.getBBox({deep:!0}),o=n.restrict,s=r.x-i.x,l=r.y-i.y,a=Math.max(o.x+s,Math.min(o.x+o.width+s-i.width,r.x+e)),u=Math.max(o.y+l,Math.min(o.y+o.height+l-i.height,r.y+t));e=a-r.x,t=u-r.y}let i={x:r.x+e,y:r.y+t};return n.tx=e,n.ty=t,n.transition?("object"!=typeof n.transition&&(n.transition={}),this.transition("position",i,Object.assign(Object.assign({},n.transition),{interp:ts.object})),this.eachChild(r=>{var i;(null==(i=n.exclude)?void 0:i.includes(r))||r.translate(e,t,n)})):(this.startBatch("translate",n),this.store.set("position",i,n),this.eachChild(r=>{var i;(null==(i=n.exclude)?void 0:i.includes(r))||r.translate(e,t,n)}),this.stopBatch("translate",n)),this}angle(e,t){return null==e?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(),o=this.getBBox().getCenter();o.rotate(n-e,t.center);let s=o.x-r.width/2-i.x,l=o.y-r.height/2-i.y;this.startBatch("rotate",{angle:e,options:t}),this.setPosition(i.x+s,i.y+l,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),gy.getCellsBBox(e)}return co.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(e,t){let n=this.getBBox(),r=n.getCenter(),i=e.getTerminal(t);if(null==i)return r;let o=i.port;if(!o||!this.hasPort(o))return r;let s=this.getPort(o);if(!s||!s.group)return r;let l=this.getPortsPosition(s.group)[o].position,a=ci.create(l).translate(n.getOrigin()),u=this.getAngle();return u&&a.rotate(-u,r),a}fit(e={}){let t=(this.getChildren()||[]).filter(e=>e.isNode());if(0===t.length)return this;this.startBatch("fit-embeds",e),e.deep&&t.forEach(t=>t.fit(e));let{x:n,y:r,width:i,height:o}=gy.getCellsBBox(t),s=lk(e.padding);return n-=s.left,r-=s.top,i+=s.left+s.right,o+=s.bottom+s.top,this.store.set({position:{x:n,y:r},size:{width:i,height:o}},e),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(e){this.setPortContainerMarkup(e)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||tv.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(e,t={}){return this.store.set("portContainerMarkup",tv.clone(e),t),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(e){this.setPortMarkup(e)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||tv.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(e,t={}){return this.store.set("portMarkup",tv.clone(e),t),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(e){this.setPortLabelMarkup(e)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||tv.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(e,t={}){return this.store.set("portLabelMarkup",tv.clone(e),t),this}get ports(){let e=this.store.get("ports",{items:[]});return null==e.items&&(e.items=[]),e}getPorts(){return of(this.ports.items)}getPortsByGroup(e){return this.getPorts().filter(t=>t.group===e)}getPort(e){return of(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 -1!==this.getPortIndex(e)}getPortIndex(e){let t="string"==typeof e?e:e.id;return null!=t?this.ports.items.findIndex(e=>e.id===t):-1}getPortsPosition(e){let t=this.getSize();return this.port.getPortsLayoutByGroup(e,new co(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("string"==typeof t||Array.isArray(t)){let i=this.prefixPortPath(e,t);return this.setPropByPath(i,n,r)}let i=this.prefixPortPath(e);return this.setPropByPath(i,t,n)}removePortProp(e,t,n){return"string"==typeof t||Array.isArray(t)?this.removePropByPath(this.prefixPortPath(e,t),n):this.removePropByPath(this.prefixPortPath(e),t)}portProp(e,t,n,r){return null==t?this.getPortProp(e):"string"==typeof t||Array.isArray(t)?2==arguments.length?this.getPortProp(e,t):null==n?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(-1===n)throw Error(`Unable to find port with id: "${e}"`);return null==t||""===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="string"==typeof e?e:e.id;return t.id===n}));this.setPropByPath("ports/items",t,n)}}else(n=e||{}).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&&!op(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=>{"object"!=typeof n&&t.push(`Invalid port ${n}.`),null==n.id&&(n.id=this.generatePortId()),e[n.id]&&t.push("Duplicitied port id."),e[n.id]=!0}),t}generatePortId(){return lb()}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 gb(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})}}gx.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},(eN=gx||(gx={})).toStringTag=`X6.${eN.name}`,eN.isNode=function(e){if(null==e)return!1;if(e instanceof eN)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eN.toStringTag)&&"function"==typeof e.isNode&&"function"==typeof e.isEdge&&"function"==typeof e.prop&&"function"==typeof e.attr&&"function"==typeof e.size&&"function"==typeof e.position||!1},(gx||(gx={})).config({propHooks(e){var{ports:t}=e,n=gv(e,["ports"]);return t&&(n.ports=Array.isArray(t)?{items:t}:t),n}}),(ej=gx||(gx={})).registry=cA.create({type:"node",process(e,t){if(tA.exist(e,!0))throw Error(`Node with name '${e}' was registered by anthor Edge`);if("function"==typeof t)return t.config({shape:e}),t;let n=ej,{inherit:r}=t,i=gv(t,["inherit"]);if(r)if("string"==typeof r){let e=this.get(r);null==e?this.onNotFound(r,"inherited"):n=e}else n=r;null==i.constructorName&&(i.constructorName=e);let o=n.define.call(n,i);return o.config({shape:e}),o}}),tA.setNodeRegistry(ej.registry),eL=gx||(gx={}),c=0,eL.define=function(e){var t;let{constructorName:n,overwrite:r}=e,i=gv(e,["constructorName","overwrite"]),o=o$((t=n||i.shape)?lm(t):(c+=1,`CustomNode${c}`),this);return o.config(i),i.shape&&eL.registry.register(i.shape,o,r),o},eL.create=function(e){let t=e.shape||"rect",n=eL.registry.get(t);return n?new n(e):eL.registry.onNotFound(t)};var gw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gC extends gy{get[Symbol.toStringTag](){return gC.toStringTag}constructor(e={}){super(e)}preprocess(e,t){let{source:n,sourceCell:r,sourcePort:i,sourcePoint:o,target:s,targetCell:l,targetPort:a,targetPoint:u}=e,c=gw(e,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),h=e=>"string"==typeof e||"number"==typeof e;if(null!=n)if(gy.isCell(n))c.source={cell:n.id};else if(h(n))c.source={cell:n};else if(ci.isPoint(n))c.source=n.toJSON();else if(Array.isArray(n))c.source={x:n[0],y:n[1]};else{let e=n.cell;gy.isCell(e)?c.source=Object.assign(Object.assign({},n),{cell:e.id}):c.source=n}if(null!=r||null!=i){let e=c.source;if(null!=r){let t=h(r)?r:r.id;e?e.cell=t:e=c.source={cell:t}}null!=i&&e&&(e.port=i)}else null!=o&&(c.source=ci.create(o).toJSON());if(null!=s)if(gy.isCell(s))c.target={cell:s.id};else if(h(s))c.target={cell:s};else if(ci.isPoint(s))c.target=s.toJSON();else if(Array.isArray(s))c.target={x:s[0],y:s[1]};else{let e=s.cell;gy.isCell(e)?c.target=Object.assign(Object.assign({},s),{cell:e.id}):c.target=s}if(null!=l||null!=a){let e=c.target;if(null!=l){let t=h(l)?l:l.id;e?e.cell=t:e=c.target={cell:t}}null!=a&&e&&(e.port=a)}else null!=u&&(c.target=ci.create(u).toJSON());return super.preprocess(c,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={}){return gy.isCell(t)?this.store.set(e,r9({},n,{cell:t.id}),r):ci.isPoint(t)||null!=t.x&&null!=t.y?this.store.set(e,r9({},n,{x:t.x,y:t.y}),r):this.store.set(e,of(t),r),this}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(e){let t=this[e];if(ci.isPointLike(t))return ci.create(t);let n=this.getTerminalCell(e);return n?n.getConnectionPoint(this,e):new ci}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(e){if(this.model){let t="source"===e?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){null==e?this.removeRouter():this.setRouter(e)}getRouter(){return this.store.get("router")}setRouter(e,t,n){return"object"==typeof e?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){null==e?this.removeConnector():this.setConnector(e)}getConnector(){return this.store.get("connector")}setConnector(e,t,n){return"object"==typeof e?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 of(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,o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),r.splice(o,0,this.parseLabel(e)),this.setLabels(r,n)}appendLabel(e,t={}){return this.insertLabel(e,-1,t)}getLabelAt(e){let t=this.getLabels();return null!=e&&Number.isFinite(e)?this.parseLabel(t[e]):null}setLabelAt(e,t,n={}){if(null!=e&&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=null!=e&&Number.isFinite(e)?e:-1,i=n.splice(r,1);return this.setLabels(n,t),i.length?i[0]:null}parseLabel(e){return"string"==typeof e?this.constructor.parseStringLabel(e):e}onLabelsChanged({previous:e,current:t}){let n=e&&t?t.filter(t=>e.find(e=>t===e||oz(t,e))?null:t):t?[...t]:[],r=e&&t?e.filter(e=>t.find(t=>e===t||oz(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=>ci.toJSON(e)),t),this}insertVertex(e,t,n={}){let r=this.getVertices(),i=r.length,o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),r.splice(o,0,ci.toJSON(e)),this.setVertices(r,n)}appendVertex(e,t={}){return this.insertVertex(e,-1,t)}getVertexAt(e){return null!=e&&Number.isFinite(e)?this.getVertices()[e]:null}setVertexAt(e,t,n={}){if(null!=e&&Number.isFinite(e)){let r=this.getVertices();r[e]=t,this.setVertices(r,n)}return this}removeVertexAt(e,t={}){let n=this.getVertices(),r=null!=e&&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=>ci.equals(t,e))?null:t):t?[...t]:[],r=e&&t?e.filter(e=>t.find(t=>ci.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")||tv.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=>ci.create(r).scale(e,t,n).toJSON(),r)}applyToPoints(e,t={}){let n={},r=this.getSource(),i=this.getTarget();ci.isPointLike(r)&&(n.source=e(r)),ci.isPointLike(i)&&(n.target=e(i));let o=this.getVertices();return o.length>0&&(n.vertices=o.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=>ci.create(e)),this.getTargetPoint()];return new cp(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:gy.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 o=r===i;if(!o&&e.deep&&this._model){let t=this.getSourceCell(),n=this.getTargetCell();t&&n&&(o=t.isAncestorOf(n,e)||n.isAncestorOf(t,e))}return o}getFragmentAncestor(){let e=[this,this.getSourceNode(),this.getTargetNode()].filter(e=>null!=e);return this.getCommonAncestor(...e)}isFragmentDescendantOf(e){let t=this.getFragmentAncestor();return!!t&&(t.id===e.id||t.isDescendantOf(e))}}gC.defaults={},(gC||(gC={})).equalTerminals=function(e,t){return e.cell===t.cell&&(e.port===t.port||null==e.port&&null==t.port)},(eR=gC||(gC={})).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}},eR.parseStringLabel=function(e){return{attrs:{label:{text:e}}}},(eI=gC||(gC={})).toStringTag=`X6.${eI.name}`,eI.isEdge=function(e){if(null==e)return!1;if(e instanceof eI)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eI.toStringTag)&&"function"==typeof e.isNode&&"function"==typeof e.isEdge&&"function"==typeof e.prop&&"function"==typeof e.attr&&"function"==typeof e.disconnect&&"function"==typeof e.getSource&&"function"==typeof e.getTarget||!1},(e_=gC||(gC={})).registry=cA.create({type:"edge",process(e,t){if(tA.exist(e,!1))throw Error(`Edge with name '${e}' was registered by anthor Node`);if("function"==typeof t)return t.config({shape:e}),t;let n=e_,{inherit:r="edge"}=t,i=gw(t,["inherit"]);if("string"==typeof r){let e=this.get(r||"edge");null==e&&r?this.onNotFound(r,"inherited"):n=e}else n=r;null==i.constructorName&&(i.constructorName=e);let o=n.define.call(n,i);return o.config({shape:e}),o}}),tA.setEdgeRegistry(e_.registry),ez=gC||(gC={}),h=0,ez.define=function(e){var t;let{constructorName:n,overwrite:r}=e,i=gw(e,["constructorName","overwrite"]),o=o$((t=n||i.shape)?lm(t):(h+=1,`CustomEdge${h}`),this);return o.config(i),i.shape&&ez.registry.register(i.shape,o,r),o},ez.create=function(e){let t=e.shape||"edge",n=ez.registry.get(t);return n?new n(e):ez.registry.onNotFound(t)};var gE=gC||(gC={});let gS="basic.edge";gE.config({shape:gS,propHooks(e){let{label:t,vertices:n}=e,r=gw(e,["label","vertices"]);if(t){null==r.labels&&(r.labels=[]);let e="string"==typeof t?gE.parseStringLabel(t):t;r.labels.push(e)}return n&&Array.isArray(n)&&(r.vertices=n.map(e=>ci.create(e).toJSON())),r}}),gE.registry.register(gS,gE);class gP extends oQ{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;"number"==typeof t?(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 o=Array.isArray(e)?e:[e],s=this.comparator&&"number"!=typeof t&&!1!==i.sort,l=this.comparator||null,a=!1,u=[],c=[];return o.forEach(e=>{let t=this.get(e);t?i.merge&&!e.isSameStore(t)&&(t.setProp(e.getProp(),n),c.push(t),s&&!a&&(a=null==l||"function"==typeof l?t.hasChanged():"string"==typeof l?t.hasChanged(l):l.some(e=>t.hasChanged(e)))):(u.push(e),this.reference(e))}),u.length&&(s&&(a=!0),this.cells.splice(r,0,...u),this.length=this.cells.length),a&&this.sort({silent:!0}),!i.silent&&(u.forEach((e,t)=>{let n={cell:e,index:r+t,options:i};this.trigger("added",n),i.dryrun||e.notify("added",Object.assign({},n))}),a&&this.trigger("sorted"),(u.length||c.length)&&this.trigger("updated",{added:u,merged:c,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(null==i)continue;let o=this.cells.indexOf(i);this.cells.splice(o,1),this.length-=1,delete this.map[i.id],n.push(i),this.unreference(i),t.dryrun||i.remove(),!t.silent&&(this.trigger("removed",{cell:i,index:o,options:t}),t.dryrun||i.notify("removed",{cell:i,index:o,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(null==e)return null;let t="string"==typeof e||"number"==typeof e?e:e.id;return this.map[t]||null}has(e){return null!=this.get(e)}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 null!=this.comparator&&(this.cells=sk(this.cells,this.comparator),e.silent||this.trigger("sorted")),this}clone(){return new this.constructor(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([])}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([gP.dispose()],gP.prototype,"dispose",null);class gk extends oQ{get[Symbol.toStringTag](){return gk.toStringTag}constructor(e=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new gP(e),this.setup()}notify(e,t){this.trigger(e,t);let n=this.graph;return n&&("sorted"===e||"reseted"===e||"updated"===e?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),0===e.length&&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),0===e.length&&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="source"===t?this.outgoings:this.incomings,r=e.previous(t);if(r&&r.cell){let t=gy.isCell(r.cell)?r.cell.id:r.cell,i=n[t],o=i?i.indexOf(e.id):-1;o>=0&&(i.splice(o,1),0===i.length&&delete n[t])}let i=e.getTerminal(t);if(i&&i.cell){let t=gy.isCell(i.cell)?i.cell.id:i.cell,r=n[t]||[];-1===r.indexOf(e.id)&&r.push(e.id),n[t]=r}}prepareCell(e,t){return e.model||t&&t.dryrun||(e.model=this),null==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(0===t.length)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=gx.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 gx.create(e)}addEdge(e,t={}){let n=gC.isEdge(e)?e:this.createEdge(e);return this.addCell(n,t),n}createEdge(e){return gC.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(0===n)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-=1}),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)}removeCell(e,t={}){let n="string"==typeof e?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="string"==typeof e?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=>null!=e):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(e){let t="string"==typeof e?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="string"==typeof e?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="string"==typeof e?this.getCell(e):e;if(null==r)return n;let i={},o=t.indirect,s=t.incoming,l=t.outgoing;null==s&&null==l&&(s=l=!0);let a=(e,t)=>{let r=t?this.getOutgoingEdges(e):this.getIncomingEdges(e);if(null!=r&&r.forEach(e=>{!i[e.id]&&(n.push(e),i[e.id]=!0,o&&(s&&a(e,!1),l&&a(e,!0)))}),o&&e.isEdge()){let r=t?e.getTargetCell():e.getSourceCell();r&&r.isEdge()&&!i[r.id]&&(n.push(r),a(r,t))}};if(l&&a(r,!0),s&&a(r,!1),t.deep){let e=r.getDescendants({deep:!0}),o={};e.forEach(e=>{e.isNode()&&(o[e.id]=!0)});let a=(e,r)=>{let s=r?this.getOutgoingEdges(e.id):this.getIncomingEdges(e.id);null!=s&&s.forEach(e=>{if(!i[e.id]){let r=e.getSourceCell(),s=e.getTargetCell();!t.enclosed&&r&&o[r.id]&&s&&o[s.id]||(n.push(e),i[e.id]=!0)}})};e.forEach(e=>{!e.isEdge()&&(l&&a(e,!0),s&&a(e,!1))})}return n}isBoundary(e,t){let n="string"==typeof e?this.getCell(e):e,r=t?this.getIncomingEdges(n):this.getOutgoingEdges(n);return null==r||0===r.length}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;null==n&&null==r&&(n=r=!0);let i=this.getConnectedEdges(e,t).reduce((i,o)=>{let s=o.hasLoop(t),l=o.getSourceCell(),a=o.getTargetCell();return n&&l&&l.isNode()&&!i[l.id]&&(s||l!==e&&(!t.deep||!l.isDescendantOf(e)))&&(i[l.id]=l),r&&a&&a.isNode()&&!i[a.id]&&(s||a!==e&&(!t.deep||!a.isDescendantOf(e)))&&(i[a.id]=a),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 null==r&&null==i&&(r=i=!0),this.getConnectedEdges(e,n).some(e=>{let n=e.getSourceCell(),o=e.getTargetCell();return!!r&&!!n&&n.id===t.id||!!i&&!!o&&o.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,o)=>{if(i===t&&i!==e&&this.matchDistance(o,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,o)=>{if(i===t&&i!==e&&this.matchDistance(o,n.distance))return r=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),r}matchDistance(e,t){return null==t||("function"==typeof t?t(e):!!(Array.isArray(t)&&t.includes(e))||e===t)}getCommonAncestor(...e){let t=[];return e.forEach(e=>{e&&(Array.isArray(e)?t.push(...e):t.push(e))}),gy.getCommonAncestor(...t)}getSubGraph(e,t={}){let n=[],r={},i=[],o=[],s=e=>{!r[e.id]&&(n.push(e),r[e.id]=e,e.isEdge()&&o.push(e),e.isNode()&&i.push(e))};return e.forEach(e=>{s(e),t.deep&&e.getDescendants({deep:!0}).forEach(e=>s(e))}),o.forEach(e=>{let t=e.getSourceCell(),o=e.getTargetCell();t&&!r[t.id]&&(n.push(t),r[t.id]=t,t.isNode()&&i.push(t)),o&&!r[o.id]&&(n.push(o),r[o.id]=o,o.isNode()&&i.push(o))}),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 gy.cloneCells(e)}getNodesFromPoint(e,t){let n="number"==typeof e?{x:e,y:t||0}:e;return this.getNodes().filter(e=>e.getBBox().containsPoint(n))}getNodesInArea(e,t,n,r,i){let o="number"==typeof e?new co(e,t,n,r):co.create(e),s="number"==typeof e?i:t,l=s&&s.strict;return this.getNodes().filter(e=>{let t=e.getBBox();return l?o.containsRect(t):o.isIntersectWithRect(t)})}getEdgesInArea(e,t,n,r,i){let o="number"==typeof e?new co(e,t,n,r):co.create(e),s="number"==typeof e?i:t,l=s&&s.strict;return this.getEdges().filter(e=>{let t=e.getBBox();return 0===t.width?t.inflate(1,0):0===t.height&&t.inflate(0,1),l?o.containsRect(t):o.isIntersectWithRect(t)})}getNodesUnderNode(e,t={}){let n=e.getBBox();return(null==t.by||"bbox"===t.by?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 gy.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={},o={};for(r.push(e),o[e.id]=0;r.length>0;){let e=r.shift();if(null!=e&&!i[e.id])i[e.id]=!0,!1!==nx(t,this,e,o[e.id])&&this.getNeighbors(e,n).forEach(t=>{o[t.id]=o[e.id]+1,r.push(t)})}}depthFirstSearch(e,t,n={}){let r=[],i={},o={};for(r.push(e),o[e.id]=0;r.length>0;){let e=r.pop();if(null==e||i[e.id]||(i[e.id]=!0,!1===nx(t,this,e,o[e.id])))continue;let s=this.getNeighbors(e,n),l=r.length;s.forEach(t=>{o[t.id]=o[e.id]+1,r.splice(l,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="string"==typeof e?e:e.id,o=tr.run(r,i,n.weight),s=[],l="string"==typeof t?t:t.id;for(o[l]&&s.push(l);l=o[l];)s.unshift(l);return s}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 o=Math.max(e/i.width,0),s=Math.max(t/i.height,0),l=i.getOrigin();n.forEach(e=>e.scale(o,s,l,r))}return this}toJSON(e={}){return gk.toJSON(this.getCells(),e)}parseJSON(e){return gk.fromJSON(e)}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()}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([gk.dispose()],gk.prototype,"dispose",null),(eD=gk||(gk={})).toStringTag=`X6.${eD.name}`,eD.isModel=function(e){if(null==e)return!1;if(e instanceof eD)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eD.toStringTag)&&"function"==typeof e.addNode&&"function"==typeof e.addEdge&&null!=e.collection},(eB=gk||(gk={})).toJSON=function(e,t={}){return{cells:e.map(e=>e.toJSON(t))}},eB.fromJSON=function(e){let t=[];return Array.isArray(e)?t.push(...e):(e.cells&&t.push(...e.cells),e.nodes&&e.nodes.forEach(e=>{null==e.shape&&(e.shape="rect"),t.push(e)}),e.edges&&e.edges.forEach(e=>{null==e.shape&&(e.shape="edge"),t.push(e)})),t.map(e=>{let t=e.shape;if(t){if(gx.registry.exist(t))return gx.create(e);if(gC.registry.exist(t))return gC.create(e)}throw Error("The `shape` should be specified when creating a node/edge instance")})};var gO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gM extends gx{get label(){return this.getLabel()}set label(e){this.setLabel(e)}getLabel(){return this.getAttrByPath("text/text")}setLabel(e,t){return null==e?this.removeLabel():this.setAttrByPath("text/text",e,t),this}removeLabel(){return this.removeAttrByPath("text/text"),this}}(eV=gM||(gM={})).bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},eV.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},eV.config({attrs:{text:Object.assign({},eV.labelAttr)},propHooks(e){let{label:t}=e,n=gO(e,["label"]);return t&&oX(n,"attrs/text/text",t),n},visible:!0});var gA=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function gT(e,t,n={}){let r={constructorName:e,markup:function(e,t="body"){return[{tagName:e,selector:t},{tagName:"text",selector:"label"}]}(e,n.selector),attrs:{[e]:Object.assign({},gM.bodyAttr)}};return(n.parent||gM).define(r9(r,t,{shape:e}))}gT("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}});let gN=gC.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"}}});gT("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var gj=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class gL extends gM{get points(){return this.getPoints()}set points(e){this.setPoints(e)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(e,t){return null==e?this.removePoints():this.setAttrByPath("body/refPoints",gL.pointsToString(e),t),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}var gR=gL||(gL={});function gI(e){return"string"==typeof e?e:e.map(e=>Array.isArray(e)?e.join(","):ci.isPointLike(e)?`${e.x}, ${e.y}`:"").join(" ")}gR.pointsToString=gI,gR.config({propHooks(e){let{points:t}=e,n=gj(e,["points"]);if(t){let e=gI(t);e&&oX(n,"attrs/body/refPoints",e)}return n}}),gT("polygon",{},{parent:gL}),gT("polyline",{},{parent:gL});var g_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};gM.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=g_(e,["path"]);return t&&oX(n,"attrs/body/refD",t),n}});var gz=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};gM.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},e2.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:l5.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({},gM.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(e){let{text:t}=e,n=gz(e,["text"]);return t&&oX(n,"attrs/label/text",t),n},attrHooks:{text:{set(e,{cell:t,view:n,refBBox:r,elem:i,attrs:o}){if(i instanceof HTMLElement)i.textContent=e;else{let s=o.style||{},l=Object.assign({textVerticalAnchor:"middle"},s);return nx(td.presets.textWrap.set,this,{text:e,width:-5,height:"100%"},{cell:t,view:n,elem:i,refBBox:r,attrs:l}),{fill:s.color||null}}},position(e,{refBBox:t,elem:n}){if(n instanceof SVGElement)return t.getCenter()}}}}),gT("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:function(e="xlink:href"){return t=>{let{imageUrl:n,imageWidth:r,imageHeight:i}=t,o=gA(t,["imageUrl","imageWidth","imageHeight"]);return(null!=n||null!=r||null!=i)&&(o.attrs?null==o.attrs.image&&(o.attrs.image={}):o.attrs={image:{}},(()=>{if(o.attrs){let t=o.attrs.image;null!=n&&(t[e]=n),null!=r&&(t.width=r),null!=i&&(t.height=i),o.attrs.image=t}})()),o}}()},{selector:"image"}),gT("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class gD extends dQ{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return gD.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")?lZ(t,e):lQ(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(),dl.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(),dl.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 co(0,0,n.width,n.height),selectors:this.selectors}),dl.useCSSSelector&&this.renderPorts()}renderMarkup(){let e=this.cell.markup;if(e){if("string"==typeof e)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(),dl.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=>{al(e.portElement)})}renderPorts(){let e=this.container,t=[];e.childNodes.forEach(e=>{t.push(e)});let n=sf(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?ah(n[Math.max(t,0)],r):au(this.container,r)}getPortElement(e){let t=this.portsCache[e.id];return t?t.portElement:this.createPortElement(e)}createPortElement(e){let t,n,r=tv.renderMarkup(this.cell.getPortContainerMarkup()),i=r.elem;if(null==i)throw Error("Invalid port container markup.");let o=(r=tv.renderMarkup(this.getPortMarkup(e))).elem,s=r.selectors;if(null==o)throw Error("Invalid port markup.");this.setAttrs({port:e.id,"port-group":e.group},o);let l="x6-port";e.group&&(l+=` x6-port-${e.group}`),lQ(i,l),lQ(i,"x6-port"),lQ(o,"x6-port-body"),i.appendChild(o);let a=s;if(this.existPortLabel(e)){if(t=(r=tv.renderMarkup(this.getPortLabelMarkup(e.label))).elem,n=r.selectors,null==t)throw Error("Invalid port label markup.");if(s&&n){for(let e in n)if(s[e]&&e!==this.rootSelector)throw Error("Selectors within port must be unique.");a=Object.assign(Object.assign({},s),n)}lQ(t,"x6-port-label"),i.appendChild(t)}return this.portsCache[e.id]={portElement:i,portSelectors:a,portLabelElement:t,portLabelSelectors:n,portContentElement:o,portContentSelectors:s},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:e,node:this.cell,container:i,selectors:a,labelContainer:t,labelSelectors:n,contentContainer:o,contentSelectors:s}),i}updatePorts(){let e=Object.keys(this.cell.getParsedGroups());0===e.length?this.updatePortGroup():e.forEach(e=>this.updatePortGroup(e))}updatePortGroup(e){let t=co.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]||{},o=t.portLayout;if(this.applyPortTransform(i.portElement,o),null!=t.portAttrs){let e={selectors:i.portSelectors||{}};t.portSize&&(e.rootBBox=co.fromSize(t.portSize)),this.updateAttrs(i.portElement,t.portAttrs,e)}let s=t.labelLayout;if(s&&i.portLabelElement&&(this.applyPortTransform(i.portLabelElement,s,-(o.angle||0)),s.attrs)){let e={selectors:i.portLabelSelectors||{}};t.labelSize&&(e.rootBBox=co.fromSize(t.labelSize)),this.updateAttrs(i.portLabelElement,s.attrs,e)}}}applyPortTransform(e,t,n=0){let r=t.angle,i=t.position;uE(e,uf().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.cell;return null==t||null==n?{e,view:this,node:r,cell:r}:{e,x:t,y:n,view:this,node:r,cell:r}}getPortEventArgs(e,t,n){let r=this.cell;return n?{e,x:n.x,y:n.y,view:this,node:r,cell:r,port:t}:{e,view:this,node:r,cell:r,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;"node:port:mouseenter"===e?t.type="mouseenter":"node:port:mouseleave"===e&&(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("magnet"===i)this.dragMagnet(e,t,n);else{if("move"===i){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;"magnet"===i?this.stopMagnetDragging(e,t,n):(this.notifyMouseUp(e,t,n),this.notifyPortEvent("node:port:mouseup",e,{x:t,y:n}),"move"===i&&(r.targetView||this).stopNodeDragging(e,t,n));let o=r.targetMagnet;o&&this.onMagnetClick(e,o,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,o=i.findParent,s="function"==typeof o?nx(o,r,{view:this,node:this.cell}).filter(e=>gy.isCell(e)&&this.cell.id!==e.id&&!e.isDescendantOf(this.cell)):r.model.getNodesUnderNode(n,{by:o});if(i.frontOnly&&s.length>0){let e=sf(s,"zIndex"),t=sb(Object.keys(e).map(e=>parseInt(e,10)));t&&(s=e[t])}s=s.filter(e=>e.visible);let l=null,a=t.candidateEmbedView,u=i.validate;for(let e=s.length-1;e>=0;e-=1){let t=s[e];if(a&&a.cell.id===t.id){l=a;break}{let e=t.findView(r);if(u&&nx(u,r,{child:this.cell,parent:e.cell,childView:this,parentView:e})){l=e;break}}}this.clearEmbedding(t),l&&l.highlight(null,{type:"embedding"}),t.candidateEmbedView=l;let c=r.snapToGrid(e.clientX,e.clientY);this.notify("node:embedding",{e,cell:n,node:n,view:r.findViewByCell(n),x:c.x,y:c.y,currentParent:n.getParent(),candidateParent:l?l.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),o=n.getParent(),s=t.candidateEmbedView;if(s?(s.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null,(null==o||o.id!==s.cell.id)&&s.cell.insertChild(n,void 0,{ui:!0})):o&&o.unembed(n,{ui:!0}),r.model.getConnectedEdges(n,{deep:!0}).forEach(e=>{e.updateParent({ui:!0})}),i&&s){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:o,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("passive"!==t.getAttribute("magnet")){let r=this.graph.options.connecting.validateMagnet;return!r||nx(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=nx(r,this.graph,{sourceMagnet:t,sourceView:e,sourceCell:e.cell})),n}createEdgeFromMagnet(e,t,n){let r=this.graph,i=r.model,o=this.getDefaultEdge(this,e);return o.setSource(Object.assign(Object.assign({},o.getSource()),this.getEdgeTerminal(e,t,n,o,"source"))),o.setTarget(Object.assign(Object.assign({},o.getTarget()),{x:t,y:n})),o.addTo(i,{async:!1,ui:!0}),o.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,o=i.options.magnetThreshold,s=this.getEventTarget(e),l=r.targetMagnet;if("onleave"===o){if(l===s||l.contains(s))return}else if(i.view.getMouseMovedCount(e)<=o)return;this.startConnectting(e,l,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 o=[i],s=this.graph.getPlugin("selection");if(s&&s.isSelectionMovable()){let e=s.getSelectedCells();e.includes(i)&&(o=e.filter(e=>e.isNode()))}o.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="function"==typeof t?nx(t,this.graph,e):t;return"number"==typeof n?this.graph.transform.getGraphArea().inflate(n):!0===n?this.graph.transform.getGraphArea():n||null}startNodeDragging(e,t,n){let r=this.getDelegatedView();if(null==r||!r.can("nodeMovable"))return this.notifyUnhandledMouseDown(e,t,n);this.setEventData(e,{targetView:r,action:"move"});let i=ci.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,o=i.getGridSize(),s=this.getEventData(e),l=s.offset,a=s.restrict;s.moving||(s.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",e,t,n,this.cell)),this.autoScrollGraph(e.clientX,e.clientY);let u=ta.snapToGrid(t+l.x,o),c=ta.snapToGrid(n+l.y,o);r.setPosition(u,c,{restrict:a,deep:!0,ui:!0}),i.options.embedding.enabled&&(s.embedding||(this.prepareEmbedding(e),s.embedding=!0),this.processEmbedding(e,s))}stopNodeDragging(e,t,n){let r=this.getEventData(e);r.embedding&&this.finalizeEmbedding(e,r),r.moving&&(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)}}(eF=gD||(gD={})).toStringTag=`X6.${eF.name}`,eF.isNodeView=function(e){if(null==e)return!1;if(e instanceof eF)return!0;let t=e[Symbol.toStringTag];return(null==t||t===eF.toStringTag)&&"function"==typeof e.isNodeView&&"function"==typeof e.isEdgeView&&"function"==typeof e.confirmUpdate&&"function"==typeof e.update&&"function"==typeof e.findPortElem&&"function"==typeof e.resize&&"function"==typeof e.rotate&&"function"==typeof e.translate||!1},gD.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"]}}),gD.registry.register("node",gD,!0);class gB extends dQ{constructor(){super(...arguments),this.POINT_ROUNDING=2}get[Symbol.toStringTag](){return gB.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){let e=this.sourceView;if(!e){let e=this.cell.getSource();return new co(e.x,e.y)}let t=this.sourceMagnet;return e.isEdgeElement(t)?new co(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 co(e.x,e.y)}let t=this.targetMagnet;return e.isEdgeElement(t)?new co(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=this.handleAction(n,"update",()=>this.update(t)),n=this.handleAction(n,"labels",()=>this.onLabelsChange(t)),n=this.handleAction(n,"tools",()=>this.renderTools()))}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("string"==typeof e)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],o=this.labelSelectors[n],s=this.graph.options.onEdgeLabelRendered;s&&s({edge:e,label:r,container:i,selectors:o})}}}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=l8("g"),this.addClass(this.prefixClassName("edge-labels"),r),this.labelContainer=r);for(let n=0,i=t.length;n<i;n+=1){let i,o,s=t[n],l=this.normalizeLabelMarkup(this.parseLabelMarkup(s.markup));if(l)i=l.node,o=l.selectors;else{let t=e.getDefaultLabel(),n=this.normalizeLabelMarkup(this.parseLabelMarkup(t.markup));i=n.node,o=n.selectors}i.setAttribute("data-index",`${n}`),r.appendChild(i);let a=this.rootSelector;if(o[a])throw Error("Ambiguous label root selector.");o[a]=i,this.labelCache[n]=i,this.labelSelectors[n]=o}return null==r.parentNode&&this.container.appendChild(r),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(e={}){this.shouldRerenderLabels(e)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(e={}){let t=this.cell.previous("labels");if(null==t)return!0;if("propertyPathArray"in e&&"propertyValue"in e){let n=e.propertyPathArray||[],r=n.length;if(r>1&&t[n[1]]){if(2===r)return"object"==typeof e.propertyValue&&ob(e.propertyValue,"markup");if("markup"!==n[2])return!1}}return!0}parseLabelMarkup(e){return e?"string"==typeof e?this.parseLabelStringMarkup(e):this.parseJSONMarkup(e):null}parseLabelStringMarkup(e){let t=aX.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){let t;if(null==e)return;let n=e.fragment;if(!(n instanceof DocumentFragment)||!n.hasChildNodes())throw Error("Invalid label markup.");let r=n.childNodes;return(t=r.length>1||"G"!==r[0].nodeName.toUpperCase()?aX.create("g").append(n):aX.create(r[0])).addClass(this.prefixClassName("edge-label")),{node:t.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],o=this.labelSelectors[e];i.setAttribute("cursor",n?"move":"default");let s=t[e],l=r9({},r.attrs,s.attrs);this.updateAttrs(i,l,{selectors:o,rootBBox:s.size?co.fromSize(s.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();return null!=t&&this.updateAttrs(this.container,t,{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,o=new cp(r);o.simplify({threshold:.01});let s=o.points.map(e=>e.toJSON()),l=s.length;return i===l?0:(t.setVertices(s.slice(1,l-1),e),i-l)}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 ci.create(this.sourceAnchor);case"target":return ci.create(this.targetAnchor);default:throw Error(`Unknown terminal type '${e}'`)}}getTerminalConnectionPoint(e){switch(e){case"source":return ci.create(this.sourcePoint);case"target":return ci.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;if(!e)return null;return this.sourceMagnet||e.container}case"target":{if(t.raw)return this.targetMagnet;let e=this.targetView;if(!e)return null;return this.targetMagnet||e.container}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 cp(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],o=e[e.length-1];return r.priority&&!n.priority?this.findAnchorsOrdered("target",o,"source",i):this.findAnchorsOrdered("source",i,"target",o)}findAnchorsOrdered(e,t,n,r){let i,o,s=this.cell,l=s[e],a=s[n],u=this.getTerminalView(e),c=this.getTerminalView(n),h=this.getTerminalMagnet(e),d=this.getTerminalMagnet(n);if(u){let n;n=t?ci.create(t):c?d:ci.create(a),i=this.getAnchor(l.anchor,u,h,n,e)}else i=ci.create(l);if(c){let e=ci.create(r||i);o=this.getAnchor(a.anchor,c,d,e,n)}else o=ci.isPointLike(a)?ci.create(a):new ci;return{[e]:i,[n]:o}}getAnchor(e,t,n,r,i){let o,s=t.isEdgeElement(n),l=this.graph.options.connecting,a="string"==typeof e?{name:e}:e;if(!a){let e=s?("source"===i?l.sourceEdgeAnchor:l.targetEdgeAnchor)||l.edgeAnchor:("source"===i?l.sourceAnchor:l.targetAnchor)||l.anchor;a="string"==typeof e?{name:e}:e}if(!a)throw Error("Anchor should be specified.");let u=a.name;if(s){let e=tS.registry.get(u);if("function"!=typeof e)return tS.registry.onNotFound(u);o=nx(e,this,t,n,r,a.args||{},i)}else{let e=tE.registry.get(u);if("function"!=typeof e)return tE.registry.onNotFound(u);o=nx(e,this,t,n,r,a.args||{},i)}return o?o.round(this.POINT_ROUNDING):new ci}findRoutePoints(e=[]){let t,n=this.graph.options.connecting.router||tO.presets.normal,r=this.cell.getRouter()||n;if("function"==typeof r)t=nx(r,this,e,{},this);else{let n="string"==typeof r?r:r.name,i="string"==typeof r?{}:r.args||{},o=n?tO.registry.get(n):tO.presets.normal;if("function"!=typeof o)return tO.registry.onNotFound(n);t=nx(o,this,e,i,this)}return null==t?e.map(e=>ci.create(e)):t.map(e=>ci.create(e))}findConnectionPoints(e,t,n){let r,i,o=this.cell,s=this.graph.options.connecting,l=o.getSource(),a=o.getTarget(),u=this.sourceView,c=this.targetView,h=e[0],d=e[e.length-1];if(u&&!u.isEdgeElement(this.sourceMagnet)){let e=this.sourceMagnet||u.container,i=new ca(h||n,t),o=l.connectionPoint||s.sourceConnectionPoint||s.connectionPoint;r=this.getConnectionPoint(o,u,e,i,"source")}else r=t;if(c&&!c.isEdgeElement(this.targetMagnet)){let e=this.targetMagnet||c.container,r=a.connectionPoint||s.targetConnectionPoint||s.connectionPoint,o=new ca(d||t,n);i=this.getConnectionPoint(r,c,e,o,"target")}else i=n;return{source:r,target:i}}getConnectionPoint(e,t,n,r,i){let o=r.end;if(null==e)return o;let s="string"==typeof e?e:e.name,l="string"==typeof e?{}:e.args,a=tP.registry.get(s);if("function"!=typeof a)return tP.registry.onNotFound(s);let u=nx(a,this,r,t,n,l||{},i);return u?u.round(this.POINT_ROUNDING):o}findMarkerPoints(e,t,n){let r,i,o=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},s=e[0],l=e[e.length-1],a=o("source");a&&(r=t.clone().move(s||n,-a));let u=o("target");return u&&(i=n.clone().move(l||t,-u)),this.sourceMarkerPoint=r||t.clone(),this.targetMarkerPoint=i||n.clone(),{source:r,target:i}}findPath(e,t,n){let r,i,o,s=this.cell.getConnector()||this.graph.options.connecting.connector;if("string"==typeof s?r=s:(r=s.name,i=s.args),r){let e=tM.registry.get(r);if("function"!=typeof e)return tM.registry.onNotFound(r);o=e}else o=tM.presets.normal;let l=nx(o,this,t,n,e,Object.assign(Object.assign({},i),{raw:!0}),this);return"string"==typeof l?ck.parse(l):l}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(null==this.labelContainer||!this.path)return this;let e=this.cell,t=e.getLabels();if(0===t.length)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 o=r9({},r,this.normalizeLabelPosition(n.position)),s=this.getLabelTransformationMatrix(o);i.setAttribute("transform",um(s))}return this}updateTerminalProperties(e){let t=this.cell,n=this.graph,r=t[e],i=r&&r.cell,o=`${e}View`;if(!i)return this[o]=null,this.updateTerminalMagnet(e),!0;let s=n.getCellById(i);if(!s)throw Error(`Edge's ${e} node with id "${i}" not exists`);let l=s.findView(n);return!!l&&(this[o]=l,this.updateTerminalMagnet(e),!0)}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&&"object"==typeof t.position&&t.position.angle||0}getLabelPositionArgs(e){let t=this.cell.getLabelAt(e);if(t&&t.position&&"object"==typeof t.position)return t.position.options}getDefaultLabelPositionArgs(){let e=this.cell.getDefaultLabel();if(e&&e.position&&"object"==typeof e.position)return e.position.options}mergeLabelPositionArgs(e,t){return null===e?null:void 0===e?null===t?null:t:r9({},t,e)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";let e=this.cache.pathCache;return ob(e,"data")||(e.data=this.path.serialize()),e.data||""}getConnectionSubdivisions(){if(null==this.path)return null;let e=this.cache.pathCache;return ob(e,"segmentSubdivisions")||(e.segmentSubdivisions=this.path.getSegmentSubdivisions()),e.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;let e=this.cache.pathCache;return ob(e,"length")||(e.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),e.length}getPointAtLength(e){return null==this.path?null:this.path.pointAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(e){return null==this.path?null:(lE(e)&&(e=parseFloat(e)/100),this.path.pointAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(e){return null==this.path?null:this.path.tangentAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(e){return null==this.path?null:this.path.tangentAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(e){return null==this.path?null:this.path.closestPoint(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(e){return null==this.path?null:this.path.closestPointLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(e){return null==this.path?null:this.path.closestPointNormalizedLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(e,t,n,r){let i,o,s,l={distance:0},a=0;"number"==typeof n?(a=n,i=r):i=n,null!=i&&(l.options=i);let u=i&&i.absoluteOffset,c=!(i&&i.absoluteDistance),h=i&&i.absoluteDistance&&i.reverseDistance,d=this.path,f={segmentSubdivisions:this.getConnectionSubdivisions()},g=new ci(e,t),p=d.closestPointT(g,f),m=this.getConnectionLength()||0,y=d.lengthAtT(p,f);if(c&&(y=m>0?y/m:0),h&&(y=-1*(m-y)||1),l.distance=y,u||(o=d.tangentAtT(p)),o)s=o.pointOffset(g);else{let e=d.pointAtT(p),t=g.diff(e);s={x:t.x,y:t.y}}return l.offset=s,l.angle=a,l}normalizeLabelPosition(e){return"number"==typeof e?{distance:e}:e}getLabelTransformationMatrix(e){let t,n=this.normalizeLabelPosition(e),r=n.options||{},i=n.angle||0,o=n.distance,s=0,l={x:0,y:0},a=n.offset;a&&("number"==typeof a?s=a:(null!=a.x&&(l.x=a.x),null!=a.y&&(l.y=a.y)));let u=0!==l.x||0!==l.y||0===s,c=r.keepGradient,h=r.ensureLegibility,d=this.path,f={segmentSubdivisions:this.getConnectionSubdivisions()},g=o>0&&o<=1?o*this.getConnectionLength():o,p=d.tangentAtLength(g,f),m=i;if(p){if(u)(t=p.start).translate(l);else{let e=p.clone();e.rotate(-90,p.start),e.setLength(s),t=e.end}c&&(m=p.angle()+i,h&&(m=tl.normalize((m+90)%180-90)))}else t=d.start,u&&t.translate(l);return uf().translate(t.x,t.y).rotate(m)}getVertexIndex(e,t){let n=this.cell.getVertices(),r=this.getClosestPointLength(new ci(e,t)),i=0;if(null!=r)for(let e=n.length;i<e;i+=1){let e=n[i],t=this.getClosestPointLength(e);if(null!=t&&r<t)break}return i}getEventArgs(e,t,n){let r=this.cell;return null==t||null==n?{e,view:this,edge:r,cell:r}:{e,x:t,y:n,view:this,edge:r,cell:r}}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(ao(e.target,"edge-tool",this.container)){if(e.stopPropagation(),this.can("useEdgeTools")){if("edge:remove"===t)return void this.cell.remove({ui:!0});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){if(!this.can("edgeMovable"))return void this.notifyUnhandledMouseDown(e,t,n);this.setEventData(e,{x:t,y:n,moving:!1,action:"drag-edge"})}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:!0===t.isNewEdge,terminalType:e,initialMagnet:n,initialTerminal:ov(this.cell[e]),fallbackAction:t.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(e),options:t.options};return this.beforeArrowheadDragging(r),r}createValidateConnectionArgs(e){let t,n=[];n[4]=e,n[5]=this;let r=0,i=0;"source"===e?(r=2,t="target"):(i=2,t="source");let o=this.cell[t],s=o.cell;if(s){let e,t=n[r]=this.graph.findViewByCell(s);t&&(e=t.getMagnetFromEdgeTerminal(o))===t.container&&(e=void 0),n[r+1]=e}return(e,t)=>(n[i]=e,n[i+1]=e.container===t?void 0:t,n)}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){null!=e.zIndex&&(this.cell.setZIndex(e.zIndex,{ui:!0}),e.zIndex=null),this.container.style.pointerEvents=e.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(e)}validateConnection(e,t,n,r,i,o,s){let l=this.graph.options.connecting,a=l.allowLoop,u=l.allowNode,c=l.allowEdge,h=l.allowPort,d=l.allowMulti,f=l.validateConnection,g=o?o.cell:null,p="target"===i?n:e,m="target"===i?r:t,y=!0,b=l=>{let a="source"===i?s?s.port:null:g?g.getSourcePortId():null,u="target"===i?s?s.port:null:g?g.getTargetPortId():null;return nx(l,this.graph,{edge:g,edgeView:o,sourceView:e,targetView:n,sourcePort:a,targetPort:u,sourceMagnet:t,targetMagnet:r,sourceCell:e?e.cell:null,targetCell:n?n.cell:null,type:i})};if(null!=a&&("boolean"==typeof a?a||e!==n||(y=!1):y=b(a)),y&&null!=h&&("boolean"==typeof h?!h&&m&&(y=!1):y=b(h)),y&&null!=c&&("boolean"==typeof c?!c&&gB.isEdgeView(p)&&(y=!1):y=b(c)),y&&null!=u&&null==m&&("boolean"==typeof u?!u&&gD.isNodeView(p)&&(y=!1):y=b(u)),y&&null!=d&&o){let e=o.cell,t="source"===i?s:e.getSource(),n="target"===i?s:e.getTarget(),r=s?this.graph.getCellById(s.cell):null;if(t&&n&&t.cell&&n.cell&&r)if("function"==typeof d)y=b(d);else{let e=this.graph.model.getConnectedEdges(r,{outgoing:"source"===i,incoming:"target"===i});e.length&&("withPort"===d?e.some(e=>{let r=e.getSource(),i=e.getTarget();return r&&i&&r.cell===t.cell&&i.cell===n.cell&&null!=r.port&&r.port===t.port&&null!=i.port&&i.port===n.port})&&(y=!1):!d&&e.some(e=>{let r=e.getSource(),i=e.getTarget();return r&&i&&r.cell===t.cell&&i.cell===n.cell})&&(y=!1))}}return y&&null!=f&&(y=b(f)),y}allowConnectToBlank(e){let t=this.graph,n=t.options.connecting.allowBlank;if("function"!=typeof n)return!!n;let r=t.findViewByCell(e),i=e.getSourceCell(),o=e.getTargetCell(),s=t.findViewByCell(i),l=t.findViewByCell(o);return nx(n,t,{edge:e,edgeView:r,sourceCell:i,targetCell:o,sourceView:s,targetView:l,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||nx(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 o=e.terminalType,s=r.getEdgeTerminal(i,t,n,this.cell,o);this.cell.setTerminal(o,s,{ui:!0})}snapArrowhead(e,t,n){let r,i,o=this.graph,{snap:s,allowEdge:l}=o.options.connecting,a="object"==typeof s&&s.radius||50,u=o.renderer.findViewsInArea({x:e-a,y:t-a,width:2*a,height:2*a},{nodeOnly:!0});if(l){let n=o.renderer.findEdgeViewsFromPoint({x:e,y:t},a).filter(e=>e!==this);u.push(...n)}let c=n.closestView||null,h=n.closestMagnet||null;n.closestView=null,n.closestMagnet=null;let d=Number.MAX_SAFE_INTEGER,f=new ci(e,t);u.forEach(i=>{if("false"!==i.container.getAttribute("magnet")){if(i.isNodeView())r=i.cell.getBBox().getCenter().distance(f);else if(i.isEdgeView()){let e=i.getClosestPoint(f);r=e?e.distance(f):Number.MAX_SAFE_INTEGER}r<a&&r<d&&(h===i.container||this.validateConnection(...n.getValidateConnectionArgs(i,null),i.getEdgeTerminal(i.container,e,t,this.cell,n.terminalType)))&&(d=r,n.closestView=i,n.closestMagnet=i.container)}i.container.querySelectorAll("[magnet]").forEach(o=>{if("false"!==o.getAttribute("magnet")){let s=i.getBBoxOfElement(o);(r=f.distance(s.getCenter()))<a&&r<d&&(h===o||this.validateConnection(...n.getValidateConnectionArgs(i,o),i.getEdgeTerminal(o,e,t,this.cell,n.terminalType)))&&(d=r,n.closestView=i,n.closestMagnet=o)}})});let g=n.terminalType,p=n.closestView,m=n.closestMagnet,y=h!==m;if(c&&y&&c.unhighlight(h,{type:"magnetAdsorbed"}),p){if(!y)return;p.highlight(m,{type:"magnetAdsorbed"}),i=p.getEdgeTerminal(m,e,t,this.cell,g)}else i={x:e,y:t};this.cell.setTerminal(g,i,{},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){"remove"===e.fallbackAction?this.cell.remove({ui:!0}):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&&!gC.equalTerminals(r,i)){let o=this.graph,s=r.cell?o.getCellById(r.cell):null,l=r.port,a=s?o.findViewByCell(s):null,u=s||e.isNewEdge?null:ci.create(r).toJSON(),c=i.cell?o.getCellById(i.cell):null,h=i.port,d=c?o.findViewByCell(c):null,f=c?null:ci.create(i).toJSON();this.notify("edge:connected",{e:t,previousCell:s,previousPort:l,previousView:a,previousPoint:u,currentCell:c,currentView:d,currentPort:h,currentPoint:f,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 o=Array.prototype.slice.call(i.container.querySelectorAll("[magnet]"));"false"!==i.container.getAttribute("magnet")&&o.push(i.container);let s=o.filter(t=>this.validateConnection(...e.getValidateConnectionArgs(i,t),i.getEdgeTerminal(t,e.x,e.y,this.cell,e.terminalType)));if(s.length>0){for(let e=0,t=s.length;e<t;e+=1)i.highlight(s[e],{type:"magnetAvailable"});i.highlight(null,{type:"nodeAvailable"}),e.marked[i.cell.id]=s}}}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"))return void this.notifyUnhandledMouseDown(e,t,n);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=parseInt(e.currentTarget.getAttribute("data-index"),10),n=this.getLabelPositionAngle(t),r=this.getLabelPositionArgs(t),i=this.getDefaultLabelPositionArgs(),o=this.mergeLabelPositionArgs(r,i);this.setEventData(e,{index:t,positionAngle:n,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=r9({},this.cell.getLabelAt(r.index),{position:this.getLabelPosition(t,n,r.positionAngle,r.positionArgs)});this.cell.setLabelAt(r.index,i)}stopLabelDragging(e,t,n){}}(e$=gB||(gB={})).toStringTag=`X6.${e$.name}`,e$.isEdgeView=function(e){if(null==e)return!1;if(e instanceof e$)return!0;let t=e[Symbol.toStringTag];return(null==t||t===e$.toStringTag)&&"function"==typeof e.isNodeView&&"function"==typeof e.isEdgeView&&"function"==typeof e.confirmUpdate&&"function"==typeof e.update&&"function"==typeof e.getConnection||!1},gB.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"]}}),gB.registry.register("edge",gB,!0);class gV extends dq{get options(){return this.graph.options}constructor(e){super(),this.graph=e;let{selectors:t,fragment:n}=tv.parseJSONMarkup(gV.markup);this.background=t.background,this.grid=t.grid,this.svg=t.svg,this.defs=t.defs,this.viewport=t.viewport,this.primer=t.primer,this.stage=t.stage,this.decorator=t.decorator,this.overlay=t.overlay,this.container=this.options.container,this.restore=gV.snapshoot(this.container),lQ(this.container,this.prefixClassName("graph")),au(this.container,n),this.delegateEvents()}delegateEvents(){let e=this.constructor;return super.delegateEvents(e.events),this}guard(e,t){return!!("mousedown"===e.type&&2===e.button||this.options.guard&&this.options.guard(e,t))||(e.data&&void 0!==e.data.guarded?e.data.guarded:!(t&&t.cell&&gy.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"function"==typeof t&&(t=nx(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){null==e.data&&(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||(null==t.mouseMovedCount&&(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),o=t.currentView;o?o.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 uV(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),o=Math.max(-1,Math.min(1,r.wheelDelta||-r.detail));n?n.onMouseWheel(t,i.x,i.y,o):this.graph.trigger("blank:mousewheel",{e:t,delta:o,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&&"false"!==r.toLowerCase()){let r=this.findView(n);if(r){let i=this.normalizeEvent(e);if(this.guard(i,r))return;let o=this.graph.snapToGrid(i.clientX,i.clientY);nx(t,this.graph,r,i,n,o.x,o.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=()=>{}}}!function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);o>3&&s&&Object.defineProperty(t,n,s)}([dq.dispose()],gV.prototype,"dispose",null);var gF=gV||(gV={});let g$=`${dl.prefixCls}-graph`;gF.markup=[{ns:l5.xhtml,tagName:"div",selector:"background",className:`${g$}-background`},{ns:l5.xhtml,tagName:"div",selector:"grid",className:`${g$}-grid`},{ns:l5.svg,tagName:"svg",selector:"svg",className:`${g$}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":l5.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${g$}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${g$}-svg-primer`},{tagName:"g",selector:"stage",className:`${g$}-svg-stage`},{tagName:"g",selector:"decorator",className:`${g$}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${g$}-svg-overlay`}]}]}],gF.snapshoot=function(e){let t=e.cloneNode();return e.childNodes.forEach(e=>t.appendChild(e)),()=>{for(aa(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))}};var gU=gV||(gV={});let gG=dl.prefixCls;gU.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${gG}-cell`]:"onMouseEnter",[`mouseleave .${gG}-cell`]:"onMouseLeave",[`mouseenter .${gG}-cell-tools`]:"onMouseEnter",[`mouseleave .${gG}-cell-tools`]:"onMouseLeave",[`mousedown .${gG}-cell [event]`]:"onCustomEvent",[`touchstart .${gG}-cell [event]`]:"onCustomEvent",[`mousedown .${gG}-cell [data-event]`]:"onCustomEvent",[`touchstart .${gG}-cell [data-event]`]:"onCustomEvent",[`dblclick .${gG}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${gG}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${gG}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${gG}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${gG}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${gG}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${gG}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${gG}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${gG}-cell image`]:"onImageDragStart",[`mousedown .${gG}-edge .${gG}-edge-label`]:"onLabelMouseDown",[`touchstart .${gG}-edge .${gG}-edge-label`]:"onLabelMouseDown"},gU.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"};let gH=`.x6-graph {
|
|
272
272
|
position: relative;
|
|
273
273
|
overflow: hidden;
|
|
274
274
|
outline: none;
|