@antv/g6 5.0.5 → 5.0.6
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.
- package/dist/g6.min.js +1 -1
- package/dist/lib/runtime/graph.d.ts +2 -1
- package/dist/lib/version.d.ts +1 -1
- package/esm/runtime/graph.d.ts +2 -1
- package/esm/runtime/graph.js +3 -2
- package/esm/runtime/graph.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/runtime/graph.d.ts +2 -1
- package/lib/runtime/graph.js +3 -2
- package/lib/runtime/graph.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/runtime/graph.ts +3 -2
- package/src/version.ts +1 -1
package/dist/g6.min.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
*/const _D=Symbol("Comlink.proxy"),DD=Symbol("Comlink.endpoint"),LD=Symbol("Comlink.releaseProxy"),ID=Symbol("Comlink.finalizer"),jD=Symbol("Comlink.thrown"),BD=t=>"object"==typeof t&&null!==t||"function"==typeof t,FD=new Map([["proxy",{canHandle:t=>BD(t)&&t[_D],serialize(t){const{port1:e,port2:n}=new MessageChannel;return zD(t,e),[n,[n]]},deserialize:t=>(t.start(),VD(t))}],["throw",{canHandle:t=>BD(t)&&jD in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function zD(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(ZD);let u;try{const e=s.slice(0,-1).reduce(((t,e)=>t[e]),t),n=s.reduce(((t,e)=>t[e]),t);switch(a){case"GET":u=n;break;case"SET":e[s.slice(-1)[0]]=ZD(i.data.value),u=!0;break;case"APPLY":u=n.apply(e,c);break;case"CONSTRUCT":u=function(t){return Object.assign(t,{[_D]:!0})}(new n(...c));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;zD(t,n),u=function(t,e){return KD.set(t,e),t}(e,[e])}break;case"RELEASE":u=void 0;break;default:return}}catch(t){u={value:t,[jD]:0}}Promise.resolve(u).catch((t=>({value:t,[jD]:0}))).then((n=>{const[i,s]=XD(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),GD(e),ID in t&&"function"==typeof t[ID]&&t[ID]())})).catch((t=>{const[n,r]=XD({value:new TypeError("Unserializable return value"),[jD]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function GD(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function VD(t,e){return YD(t,[],e)}function WD(t){if(t)throw new Error("Proxy has been released and is not useable")}function HD(t){return QD(t,{type:"RELEASE"}).then((()=>{GD(t)}))}const $D=new WeakMap,UD="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=($D.get(t)||0)-1;$D.set(t,e),0===e&&HD(t)}));function YD(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(n,o){if(WD(r),o===LD)return()=>{!function(t){UD&&UD.unregister(t)}(i),HD(t),r=!0};if("then"===o){if(0===e.length)return{then:()=>i};const n=QD(t,{type:"GET",path:e.map((t=>t.toString()))}).then(ZD);return n.then.bind(n)}return YD(t,[...e,o])},set(n,i,o){WD(r);const[a,s]=XD(o);return QD(t,{type:"SET",path:[...e,i].map((t=>t.toString())),value:a},s).then(ZD)},apply(n,i,o){WD(r);const a=e[e.length-1];if(a===DD)return QD(t,{type:"ENDPOINT"}).then(ZD);if("bind"===a)return YD(t,e.slice(0,-1));const[s,c]=qD(o);return QD(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:s},c).then(ZD)},construct(n,i){WD(r);const[o,a]=qD(i);return QD(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:o},a).then(ZD)}});return function(t,e){const n=($D.get(e)||0)+1;$D.set(e,n),UD&&UD.register(t,e,t)}(i,t),i}function qD(t){const e=t.map(XD);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const KD=new WeakMap;function XD(t){for(const[e,n]of FD)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},KD.get(t)||[]]}function ZD(t){switch(t.type){case"HANDLER":return FD.get(t.name).deserialize(t.value);case"RAW":return t.value}}function QD(t,e,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(n){n.data&&n.data.id&&n.data.id===i&&(t.removeEventListener("message",e),r(n.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),n)}))}class JD extends Ud{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=VD(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&e.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return s(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=o(this.layout.options,["onTick"]),n={};Object.keys(e).forEach((t=>{Rt(e[t])||(n[t]=e[t])}));const r={layout:{id:this.layout.id,options:n,iterations:null===(t=this.options)||void 0===t?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},i=new Float32Array([0]),[a]=yield this.proxy.calculateLayout(r,[i]);return a}))}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[LD]()}isRunning(){return this.running}}const tL=t=>t?parseInt(t):0;function eL(t){let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||tL(e.width),r=t.clientHeight||tL(e.height);return[n-(tL(e.paddingLeft)+tL(e.paddingRight)),r-(tL(e.paddingTop)+tL(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(Yt(e)?e:1,1),Math.max(Yt(n)?n:1,1)]}function nL(t,e=!0){const n=document.createElement("div");return n.setAttribute("class",`g6-${t}`),n.style.position="absolute",n.style.display="block",e&&(n.style.inset="0px",n.style.height="100%",n.style.width="100%",n.style.overflow="hidden",n.style.pointerEvents="none"),n}function rL(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const a=document.createElement(e);return a.innerHTML=r,a.id=t,Object.assign(a.style,n),i.appendChild(a),a}class iL extends el{}class oL extends iL{static defaultOptions={transition:"background 0.5s",backgroundSize:"cover"};$element=nL("background");constructor(t,e){super(t,Object.assign({},oL.defaultOptions,e));this.context.canvas.getContainer().prepend(this.$element),this.update(e)}async update(t){super.update(t),Object.assign(this.$element.style,ve(this.options,["key","type"]))}destroy(){super.destroy(),this.$element.remove()}}function aL(t,e,n,r,i,o){const a=n-t,s=r-e;let c=i-t,u=o-e,l=c*a+u*s,h=0;l<=0?h=0:(c=a-c,u=s-u,l=c*a+u*s,h=l<=0?0:l*l/(a*a+s*s));const d=c*c+u*u-h;return d<0?0:d}function sL(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)}function cL(t,e,n,r,i){return sL(t,e,n,r)<i*i}function uL(t){const e=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2);return{x:e,y:r,x2:n,y2:i,width:n-e,height:i-r}}class lL{constructor(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new lL(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2)return!1;if(e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2)return!1;if(t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;return t<=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1)}distSquare(t,e){return aL(this.x1,this.y1,this.x2,this.y2,t,e)}ptClose(t,e,n){if(this.x1<this.x2){if(t<this.x1-n||t>this.x2+n)return!1}else if(t<this.x2-n||t>this.x1+n)return!1;if(this.y1<this.y2){if(e<this.y1-n||e>this.y2+n)return!1}else if(e<this.y2-n||e>this.y1+n)return!1;return!0}}var hL,dL;!function(t){t[t.POINT=1]="POINT",t[t.PARALLEL=2]="PARALLEL",t[t.COINCIDENT=3]="COINCIDENT",t[t.NONE=4]="NONE"}(hL||(hL={}));class fL{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function pL(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const e=n/i,o=r/i;return 0<=e&&e<=1&&0<=o&&o<=1?new fL(hL.POINT,t.x1+e*(t.x2-t.x1),t.y1+e*(t.y2-t.y1)):new fL(hL.NONE)}return new fL(0===n||0===r?hL.COINCIDENT:hL.PARALLEL)}function gL(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const t=n/i,e=r/i;if(0<=t&&t<=1&&0<=e&&e<=1)return t}return Number.POSITIVE_INFINITY}function mL(t,e,n){const r=new Set;return t.width<=0?(r.add(dL.LEFT),r.add(dL.RIGHT)):e<t.x?r.add(dL.LEFT):e>t.x+t.width&&r.add(dL.RIGHT),t.height<=0?(r.add(dL.TOP),r.add(dL.BOTTOM)):n<t.y?r.add(dL.TOP):n>t.y+t.height&&r.add(dL.BOTTOM),r}function yL(t,e){let n=e.x1,r=e.y1;const i=e.x2,o=e.y2,a=Array.from(mL(t,i,o));if(0===a.length)return!0;let s=mL(t,n,r);for(;0!==s.size;){for(const t of a)if(s.has(t))return!1;if(s.has(dL.RIGHT)||s.has(dL.LEFT)){let e=t.x;s.has(dL.RIGHT)&&(e+=t.width),r+=(e-n)*(o-r)/(i-n),n=e}else{let e=t.y;s.has(dL.BOTTOM)&&(e+=t.height),n+=(e-r)*(i-n)/(o-r),r=e}s=mL(t,n,r)}return!0}function vL(t,e){let n=Number.POSITIVE_INFINITY,r=0;function i(t,i,o,a){let s=gL(e,new lL(t,i,o,a));s=Math.abs(s-.5),s>=0&&s<=1&&(r++,s<n&&(n=s))}return i(t.x,t.y,t.x2,t.y),i(t.x,t.y,t.x,t.y2),r>1?n:(i(t.x,t.y2,t.x2,t.y2),r>1?n:(i(t.x2,t.y,t.x2,t.y2),0===r?-1:n))}function bL(t,e){let n=0;const r=pL(t,new lL(e.x,e.y,e.x2,e.y));n+=r.state===hL.POINT?1:0;const i=pL(t,new lL(e.x,e.y,e.x,e.y2));n+=i.state===hL.POINT?1:0;const o=pL(t,new lL(e.x,e.y2,e.x2,e.y2));n+=o.state===hL.POINT?1:0;const a=pL(t,new lL(e.x2,e.y,e.x2,e.y2));return n+=a.state===hL.POINT?1:0,{top:r,left:i,bottom:o,right:a,count:n}}!function(t){t[t.LEFT=0]="LEFT",t[t.TOP=1]="TOP",t[t.RIGHT=2]="RIGHT",t[t.BOTTOM=3]="BOTTOM"}(dL||(dL={}));class xL{constructor(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new xL(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new xL(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x+t.width),i=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=r-e,this.height=i-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x),i=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=r-e,this.height=i-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return!(this.area<=0||t.width<=0||t.height<=0)&&(t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2)}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=mL(this,t,e);return n.has(dL.TOP)?n.has(dL.LEFT)?sL(t,e,this.x,this.y):n.has(dL.RIGHT)?sL(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(dL.BOTTOM)?n.has(dL.LEFT)?sL(t,e,this.x,this.y2):n.has(dL.RIGHT)?sL(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(dL.LEFT)?(this.x-t)*(this.x-t):n.has(dL.RIGHT)?(t-this.x2)*(t-this.x2):0}}class wL{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return 2*this.radius}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return 2*this.radius}static from(t){return new wL(t.cx,t.cy,t.radius)}containsPt(t,e){return sL(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=sL(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const r=Math.sqrt(n)-this.radius;return r*r}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,2*Math.PI)}}class EL{constructor(t,e=0,n=0,r=0,i=0,o=10,a=10,s=new Float32Array(Math.max(0,o*a)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=r,this.pixelY=i,this.width=o,this.height=a,this.area=s}createSub(t,e){return new EL(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new EL(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new EL(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),r=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),i=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup));return new xL(e,n,r-e,i-n)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),r=this.boundX(t.x-n),i=this.boundY(t.y-n),o=this.boundX(t.x2+n),a=this.boundY(t.y2+n);return new xL(r,i,o-r,a-i)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||0===e)return;const n=this.width,r=t.width,i=Math.max(0,t.i),o=Math.max(0,t.j),a=Math.min(t.i+t.width,n),s=Math.min(t.j+t.height,this.height);if(!(s<=0||a<=0||i>=n||s>=this.height))for(let c=o;c<s;c++){const o=(c-t.j)*r,s=c*n;for(let n=i;n<a;n++){const r=t.area[n-t.i+o];0!==r&&(this.area[n+s]+=e*r)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let r=0;r<t.height;r++){const i=n+r*this.width;this.area.fill(e,i,i+t.width)}}fillHorizontalLine(t,e,n,r){const i=t+e*this.width;this.area.fill(r,i,i+n)}fillVerticalLine(t,e,n,r){const i=t+e*this.width;for(let t=0;t<n;t++)this.area[i+t*this.width]=r}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let e=0;e<this.width;e++){t+=this.area[n+e].toFixed(1).padStart(6),t+=" "}t+="\n"}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce(((t,e)=>Math.min(t,e)),Number.POSITIVE_INFINITY),r=this.area.reduce(((t,e)=>Math.max(t,e)),Number.NEGATIVE_INFINITY),i=t=>(t-n)/(r-n);t.scale(this.pixelGroup,this.pixelGroup);for(let e=0;e<this.width;e++)for(let n=0;n<this.height;n++){const r=this.area[e+n*this.width];t.fillStyle=`rgba(0, 0, 0, ${i(r)})`,t.fillRect(e,n,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let n=0;n<this.width;n++)for(let r=0;r<this.height;r++){const i=this.area[n+r*this.width];t.fillStyle=i>e?"black":"white",t.fillRect(n,r,1,1)}t.restore()}}}function ML(t,e){const n=t=>({x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e});return Array.isArray(t)?t.map(n):n(t)}function SL(t,e,n){return NL(Object.assign(uL(t),{distSquare:(e,n)=>aL(t.x1,t.y1,t.x2,t.y2,e,n)}),e,n)}function NL(t,e,n){const r=ML(t,n),i=e.scale(r),o=e.createSub(i,r);return function(t,e,n,r){const i=n*n;for(let o=0;o<t.height;o++)for(let a=0;a<t.width;a++){const s=r(e.invertScaleX(t.i+a),e.invertScaleY(t.j+o));if(0!==s){if(s<i){const e=n-Math.sqrt(s);t.set(a,o,e*e)}}else t.set(a,o,i)}}(o,e,n,((e,n)=>t.distSquare(e,n))),o}function kL(t,e){return{x:t,y:e}}function CL(t,e,n,r){if(0===t.length)return[];const i=function(t){if(t.length<2)return t;let e=0,n=0;return t.forEach((t=>{e+=t.cx,n+=t.cy})),e/=t.length,n/=t.length,t.map((t=>{const r=e-t.cx,i=n-t.cy;return[t,r*r+i*i]})).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]))}(t);return i.map(((t,o)=>{const a=i.slice(0,o);return function(t,e,n,r,i){const o=kL(e.cx,e.cy),a=function(t,e,n){let r=Number.POSITIVE_INFINITY;return e.reduce(((e,i)=>{const o=sL(t.x,t.y,i.cx,i.cy);if(o>r)return e;const a=new lL(t.x,t.y,i.cx,i.cy),s=function(t,e){return t.reduce(((t,n)=>yL(n,e)&&function(t,e){function n(t,n,r,i){let o=gL(e,new lL(t,n,r,i));return o=Math.abs(o-.5),o>=0&&o<=1?1:0}let r=n(t.x,t.y,t.x2,t.y);return r+=n(t.x,t.y,t.x,t.y2),r>1||(r+=n(t.x,t.y2,t.x2,t.y2),r>1||(r+=n(t.x2,t.y,t.x2,t.y2),r>0))}(n,e)?t+1:t),0)}(n,a);return o*(s+1)*(s+1)<r&&(e=i,r=o*(s+1)*(s+1)),e}),null)}(o,n,t);if(null==a)return[];const s=function(t,e,n,r){const i=[],o=[];o.push(t);let a=!0;for(let t=0;t<n&&a;t++)for(a=!1;!a&&o.length>0;){const t=o.pop(),n=PL(e,t),s=n?bL(t,n):null;if(!n||!s||2!==s.count){a||i.push(t);continue}let c=r,u=OL(n,c,s,!0),l=AL(u,o)||AL(u,i),h=TL(u,e);for(;!l&&h&&c>=1;)c/=1.5,u=OL(n,c,s,!0),l=AL(u,o)||AL(u,i),h=TL(u,e);if(!u||l||h||(o.push(new lL(t.x1,t.y1,u.x,u.y)),o.push(new lL(u.x,u.y,t.x2,t.y2)),a=!0),a)continue;c=r,u=OL(n,c,s,!1);let d=AL(u,o)||AL(u,i);for(h=TL(u,e);!d&&h&&c>=1;)c/=1.5,u=OL(n,c,s,!1),d=AL(u,o)||AL(u,i),h=TL(u,e);u&&!d&&(o.push(new lL(t.x1,t.y1,u.x,u.y)),o.push(new lL(u.x,u.y,t.x2,t.y2)),a=!0),a||i.push(t)}for(;o.length>0;)i.push(o.pop());return i}(new lL(o.x,o.y,a.cx,a.cy),t,r,i);return function(t,e){const n=[];for(;t.length>0;){const r=t.pop();if(0===t.length){n.push(r);break}const i=t.pop(),o=new lL(r.x1,r.y1,i.x2,i.y2);PL(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(s,t)}(e,t,a,n,r)})).flat()}function TL(t,e){return e.some((e=>e.containsPt(t.x,t.y)))}function AL(t,e){return e.some((e=>!!cL(e.x1,e.y1,t.x,t.y,.001)||!!cL(e.x2,e.y2,t.x,t.y,.001)))}function PL(t,e){let n=Number.POSITIVE_INFINITY,r=null;for(const i of t){if(!yL(i,e))continue;const t=vL(i,e);t>=0&&t<n&&(r=i,n=t)}return r}function OL(t,e,n,r){const i=n.top,o=n.left,a=n.bottom,s=n.right;if(r){if(o.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x-e,t.y-e);if(a.state===hL.POINT)return kL(t.x-e,t.y2+e);const n=t.width*t.height;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?kL(t.x-e,t.y-e):kL(t.x2+e,t.y-e):o.y<s.y?kL(t.x-e,t.y2+e):kL(t.x2+e,t.y2+e)}if(s.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x2+e,t.y-e);if(a.state===hL.POINT)return kL(t.x2+e,t.y2+e)}const n=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*n?i.x>a.x?kL(t.x-e,t.y-e):kL(t.x-e,t.y2+e):i.x<a.x?kL(t.x2+e,t.y-e):kL(t.x2+e,t.y2+e)}if(o.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x2+e,t.y2+e);if(a.state===hL.POINT)return kL(t.x2+e,t.y-e);const n=t.height*t.width;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?kL(t.x2+e,t.y2+e):kL(t.x-e,t.y2+e):o.y<s.y?kL(t.x2+e,t.y-e):kL(t.x-e,t.y-e)}if(s.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x-e,t.y2+e);if(a.state===hL.POINT)return kL(t.x-e,t.y-e)}const c=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*c?i.x>a.x?kL(t.x2+e,t.y2+e):kL(t.x2+e,t.y-e):i.x<a.x?kL(t.x-e,t.y2+e):kL(t.x-e,t.y-e)}function RL(t,e,n,r){if(!(t.closed?n<t.length:n<t.length-1))return!1;const i=t.get(e),o=t.get(n+1);for(let a=e+1;a<=n;a++){const e=t.get(a);if(aL(i.x,i.y,o.x,o.y,e.x,e.y)>r)return!1}return!0}function _L(t,e){switch(t){case-2:return(((3-e)*e-3)*e+1)/6;case-1:return((3*e-6)*e*e+4)/6;case 0:return(((-3*e+3)*e+3)*e+1)/6;case 1:return e*e*e/6;default:throw new Error("unknown error")}}class DL{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(0===e.length)return"";const n="function"==typeof t?t:function(t){if(!Number.isFinite(t))return t=>t;if(0===t)return Math.round;const e=Math.pow(10,t);return t=>Math.round(t*e)/e}(t);let r="M";for(const t of e)r+=`${n(t.x)},${n(t.y)} L`;return r=r.slice(0,-1),this.closed&&(r+=" Z"),r}draw(t){const e=this.points;if(0!==e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return function(t=8){return e=>{let n=t,r=e.length;if(n>1)for(r=Math.floor(e.length/n);r<3&&n>1;)n-=1,r=Math.floor(e.length/n);const i=[];for(let t=0,o=0;o<r;o++,t+=n)i.push(e.get(t));return new DL(i)}}(t)(this)}simplify(t){return function(t=0){return e=>{if(t<0||e.length<3)return e;const n=[];let r=0;const i=t*t;for(;r<e.length;){let t=r+1;for(;RL(e,r,t,i);)t++;n.push(e.get(r)),r=t}return new DL(n)}}(t)(this)}bSplines(t){return function(t=6){function e(t,e,n){let r=0,i=0;for(let o=-2;o<=1;o++){const a=t.get(e+o),s=_L(o,n);r+=s*a.x,i+=s*a.y}return{x:r,y:i}}return n=>{if(n.length<3)return n;const r=[],i=n.closed,o=n.length+3-1+(i?0:2);r.push(e(n,2-(i?0:2),0));for(let a=2-(i?0:2);a<o;a++)for(let i=1;i<=t;i++)r.push(e(n,a,i/t));return new DL(r)}}(t)(this)}apply(t){return t(this)}containsElements(t){const e=function(t){if(0===t.length)return null;const e=t[0],n=new xL(e.x,e.y,0,0);for(const e of t)n.addPoint(e);return n}(this.points);return!!e&&t.every((t=>e.containsPt(t.cx,t.cy)&&this.withinArea(t.cx,t.cy)))}withinArea(t,e){if(0===this.length)return!1;let n=0;const r=this.points[0],i=new lL(r.x,r.y,r.x,r.y);for(let r=1;r<this.points.length;r++){const o=this.points[r];i.x1=i.x2,i.y1=i.y2,i.x2=o.x,i.y2=o.y,i.cuts(t,e)&&n++}return i.x1=i.x2,i.y1=i.y2,i.x2=r.x,i.y2=r.y,i.cuts(t,e)&&n++,n%2==1}}class LL{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(0===this.count)return!1;const e=this.arr[0];return null!=e&&e.x===t.x&&e.y===t.y}path(){return new DL(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}const IL=0,jL=1,BL=2,FL=3;function zL(t,e){const n=2*(Math.floor(t.width)+Math.floor(t.height)),r=new LL(n);function i(n,r,i,o){const a=t.get(n,r);return Number.isNaN(a)?Number.NaN:a>e?i+o:i}function o(t,e){let n=IL;return n=i(t,e,n,1),n=i(t+1,e,n,2),n=i(t,e+1,n,4),n=i(t+1,e+1,n,8),Number.isNaN(n)?-1:n}let a=jL;function s(e,n){let i=e,s=n,c=t.invertScaleX(i),u=t.invertScaleY(s);for(let e=0;e<t.width*t.height;e++){const e={x:c,y:u};if(r.contains(e)){if(r.isFirst(e))return!0}else r.add(e);const n=o(i,s);switch(n){case-1:return!0;case 0:case 3:case 2:case 7:a=BL;break;case 12:case 14:case 4:a=FL;break;case 6:a=a===IL?FL:BL;break;case 1:case 13:case 5:a=IL;break;case 9:a=a===BL?IL:jL;break;case 10:case 8:case 11:a=jL;break;default:return console.warn("Marching squares invalid state: "+n),!0}switch(a){case IL:s--,u-=t.pixelGroup;break;case jL:s++,u+=t.pixelGroup;break;case FL:i--,c-=t.pixelGroup;break;case BL:i++,c+=t.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+n),!0}}return!0}for(let n=0;n<t.width;n++)for(let i=0;i<t.height;i++){if(t.get(n,i)<=e)continue;const a=o(n,i);if(!(a<0||15===a)&&s(n,i))return r.path()}return null}const GL={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function VL(t){return null!=t&&"number"==typeof t.radius}function WL(t,e){if(VL(t)!==VL(e))return!1;if(VL(t)){const n=e;return t.cx===n.cx&&t.cy===n.cy&&t.radius===n.radius}const n=e;return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}var HL;!function(t){t[t.MEMBERS=0]="MEMBERS",t[t.NON_MEMBERS=1]="NON_MEMBERS",t[t.EDGES=2]="EDGES"}(HL||(HL={}));let $L=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new xL(0,0,0,0),this.potentialArea=new EL(1,0,0,0,0,0,0),this.o=Object.assign({},GL,t)}pushMember(...t){if(0!==t.length){this.dirty.add(HL.MEMBERS);for(const e of t)this.members.push({raw:e,obj:VL(e)?wL.from(e):xL.from(e),area:null})}}removeMember(t){const e=this.members.findIndex((e=>WL(e.raw,t)));return!(e<0)&&(this.members.splice(e,1),this.dirty.add(HL.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex((e=>WL(e.raw,t)));return!(e<0)&&(this.nonMembers.splice(e,1),this.dirty.add(HL.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex((e=>e.obj.equals(t)));return!(e<0)&&(this.edges.splice(e,1),this.dirty.add(HL.NON_MEMBERS),!0)}pushNonMember(...t){if(0!==t.length){this.dirty.add(HL.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:VL(e)?wL.from(e):xL.from(e),area:null})}}pushEdge(...t){if(0!==t.length){this.dirty.add(HL.EDGES);for(const e of t)this.edges.push({raw:e,obj:lL.from(e),area:null})}}update(){const t=this.dirty.has(HL.MEMBERS),e=this.dirty.has(HL.NON_MEMBERS);let n=this.dirty.has(HL.EDGES);this.dirty.clear();const r=this.members.map((t=>t.obj));if(this.o.virtualEdges&&(t||e)){const t=CL(r,this.nonMembers.map((t=>t.obj)),this.o.maxRoutingIterations,this.o.morphBuffer),e=new Map(this.virtualEdges.map((t=>[t.obj.toString(),t.area])));this.virtualEdges=t.map((t=>{var n;return{raw:t,obj:t,area:null!==(n=e.get(t.toString()))&&void 0!==n?n:null}})),n=!0}let i=!1;if(t||n){const t=function(t,e){if(0===t.length)return new xL(0,0,0,0);const n=xL.from(t[0]);for(const e of t)n.add(e);for(const t of e)n.add(uL(t));return n}(r,this.virtualEdges.concat(this.edges).map((t=>t.obj))),e=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,n=xL.from(ML(t,e));n.equals(this.activeRegion)||(i=!0,this.activeRegion=n)}if(i){const t=Math.ceil(this.activeRegion.width/this.o.pixelGroup),e=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=EL.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach((t=>t.area=null)),this.nonMembers.forEach((t=>t.area=null)),this.edges.forEach((t=>t.area=null)),this.virtualEdges.forEach((t=>t.area=null))):t===this.potentialArea.width&&e===this.potentialArea.height||(this.potentialArea=EL.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const o=new Map,a=t=>{if(t.area){const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof xL?"R":"C"}`;o.set(e,t.area)}},s=t=>{if(t.area)return;const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof xL?"R":"C"}`;if(o.has(e)){const n=o.get(e);return void(t.area=this.potentialArea.copy(n,{x:t.obj.x-this.o.nodeR1,y:t.obj.y-this.o.nodeR1}))}const n=t.obj instanceof xL?function(t,e,n){const r=e.scale(t),i=e.addPadding(r,n),o=e.createSub(i,{x:t.x-n,y:t.y-n}),a=r.x-i.x,s=r.y-i.y,c=i.x2-r.x2,u=i.y2-r.y2,l=i.width-a-c,h=i.height-s-u,d=n*n;o.fillArea({x:a,y:s,width:l+1,height:h+1},d);const f=[0],p=Math.max(s,a,c,u);{const i=e.invertScaleX(r.x+r.width/2);for(let o=1;o<p;o++){const a=e.invertScaleY(r.y-o),s=t.distSquare(i,a);if(!(s<d))break;{const t=n-Math.sqrt(s);f.push(t*t)}}}const g=[],m=Math.max(a,c),y=Math.max(s,c);for(let i=1;i<m;i++){const o=e.invertScaleX(r.x-i),a=[];for(let i=1;i<y;i++){const s=e.invertScaleY(r.y-i),c=t.distSquare(o,s);if(c<d){const t=n-Math.sqrt(c);a.push(t*t)}else a.push(0)}g.push(a)}for(let t=1;t<Math.min(s,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s-t,l+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s+h+t,l+1,e)}for(let t=1;t<Math.min(a,f.length);t++){const e=f[t];o.fillVerticalLine(a-t,s,h+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillVerticalLine(a+l+t,s,h+1,e)}for(let t=1;t<a;t++){const e=g[t-1],n=a-t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}for(let t=1;t<c;t++){const e=g[t-1],n=a+l+t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}return o}(t.obj,this.potentialArea,this.o.nodeR1):NL(t.obj,this.potentialArea,this.o.nodeR1);t.area=n,o.set(e,n)};this.members.forEach(a),this.nonMembers.forEach(a),this.members.forEach(s),this.nonMembers.forEach((t=>{this.activeRegion.intersects(t.obj)?s(t):t.area=null})),this.edges.forEach((t=>{t.area||(t.area=SL(t.obj,this.potentialArea,this.o.edgeR1))})),this.virtualEdges.forEach((t=>{t.area||(t.area=SL(t.obj,this.potentialArea,this.o.edgeR1))}))}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(0===this.members.length)return new DL([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map((t=>t.area)),r=this.virtualEdges.concat(this.edges).map((t=>t.area)),i=this.nonMembers.filter((t=>null!=t.area)).map((t=>t.area)),o=this.members.map((t=>t.obj));return function(t,e,n,r,i,o={}){const a=Object.assign({},GL,o);let s=a.threshold,c=a.memberInfluenceFactor,u=a.edgeInfluenceFactor,l=a.nonMemberInfluenceFactor;const h=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),d=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1);for(let o=0;o<a.maxMarchingIterations;o++){if(t.clear(),0!==c){const n=c/h;for(const r of e)t.incArea(r,n)}if(0!==u){const e=u/d;for(const r of n)t.incArea(r,e)}if(0!==l){const e=l/h;for(const n of r)t.incArea(n,e)}const f=zL(t,s);if(f&&i(f))return f;if(s*=.95,o<=.5*a.maxMarchingIterations)c*=1.2,u*=1.2;else{if(!(0!==l&&r.length>0))break;l*=.8}}return new DL([])}(e,n,r,i,(t=>t.containsElements(o)),t)}};class UL extends iL{shape;bubbleSets;path;members=new Map;avoidMembers=new Map;bubbleSetOptions={};static defaultOptions={members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2,...GL};constructor(t,e){super(t,le({},UL.defaultOptions,e)),this.bindEvents(),this.bubbleSets=new $L(this.options)}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new $L(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const{type:t,key:e,members:n,avoidMembers:r,...i}=this.options,o=Object.keys(i).reduce(((t,e)=>(e in GL?t.bubbleSetOptions[e]=i[e]:t.style[e]=i[e],t)),{style:{},bubbleSetOptions:{}});return{type:t,key:e,members:n,avoidMembers:r,...o}}drawBubbleSets=()=>{const{style:t,bubbleSetOptions:e}=this.parseOptions();fe(this.bubbleSetOptions,e)||this.init(),this.bubbleSetOptions={...e};const n={...t,d:this.getPath()};this.shape?this.shape.update(n):(this.shape=new Ah({style:n}),this.context.canvas.appendChild(this.shape))};updateBubbleSetsPath=t=>{if(!this.shape)return;const e=Gu(t.data);[...this.options.members,...this.options.avoidMembers].includes(e)&&this.shape.update({...this.parseOptions().style,d:this.getPath(e)})};getPath=t=>{const{graph:e}=this.context,n=this.options.members,r=[...this.members.keys()],i=this.options.avoidMembers,o=[...this.avoidMembers.keys()];if(!t&&fe(n,r)&&fe(i,o))return this.path;const{enter:a=[],exit:s=[]}=Ju(r,n,(t=>t)),{enter:c=[],exit:u=[]}=Ju(o,i,(t=>t));t&&(s.push(t),a.push(t));const l=(t,n,r)=>{t.forEach((t=>{const i=r?this.members:this.avoidMembers,o=r?"pushMember":"pushNonMember",a=r?"removeMember":"removeNonMember";if(n){let n;"edge"===e.getElementType(t)?([n]=qL(e,t),this.bubbleSets.pushEdge(n)):([n]=YL(e,t),this.bubbleSets[o](n)),i.set(t,n)}else{const n=i.get(t);n&&("edge"===e.getElementType(t)?this.bubbleSets.removeEdge(n):this.bubbleSets[a](n),i.delete(t))}}))};l(s,!1,!0),l(a,!0,!0),l(u,!1,!1),l(c,!0,!1);const h=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=Th(h.points.map(Rl)),this.path};addMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.avoidMembers.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t)))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),this.drawBubbleSets()}updateMember(t){this.options.members=Rt(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.members.includes(t)))&&(this.options.members=this.options.members.filter((t=>!e.includes(t)))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some((t=>e.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t))),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}const YL=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getElementRenderBounds(e);return new xL(n.min[0],n.min[1],al(n),sl(n))})),qL=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getEdgeData(e),r=t.getElementPosition(n.source),i=t.getElementPosition(n.target);return lL.from({x1:r[0],y1:r[1],x2:i[0],y2:i[1]})}));class KL extends iL{static defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};$element;constructor(t,e){super(t,Object.assign({},KL.defaultOptions,e)),this.initElement(),this.update(e)}initElement(){this.$element=nL("contextmenu",!1);const{className:t}=this.options;t&&this.$element.classList.add(t);this.context.canvas.getContainer().appendChild(this.$element),rL("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow: hidden;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head)}async show(t){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hide();const r=await this.getDOMContent(t);r instanceof HTMLElement?this.$element.appendChild(r):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-i.left+n[0]}px`,this.$element.style.top=`${t.client.y-i.top+n[1]}px`,this.$element.style.display="block"}hide(){this.$element.style.display="none"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}async getDOMContent(t){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(await n(t)).map((t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`)).join("")}\n </ul>\n `:await e(t)}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}onTriggerEvent=t=>{t.preventDefault?.(),this.show(t)};onMenuItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof HTMLElement&&t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");e?.(n,t.target)}this.hide()}}class XL extends iL{static defaultOptions={trigger:{},autoFit:!0};shortcut;$el=this.context.canvas.getContainer();graphSize=[0,0];constructor(t,e){super(t,Object.assign({},XL.defaultOptions,e)),this.shortcut=new Hl(t.graph),this.bindEvents(),this.$el.style.backgroundColor=this.context.graph.getBackground()}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit);["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.addEventListener(t,this.onFullscreenChange,!1)}))}unbindEvents(){this.shortcut.unbindAll();["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.removeEventListener(t,this.onFullscreenChange,!1)}))}setGraphSize(t=!0){let e,n;t?(e=window.screen.width,n=window.screen.height,this.graphSize=this.context.graph.getSize()):[e,n]=this.graphSize,this.context.graph.setSize(e,n),this.context.graph.render()}onFullscreenChange=()=>{const t=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(t),t?this.options.onEnter?.():this.options.onExit?.()};request(){!document.fullscreenElement&&(document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled"))&&this.$el.requestFullscreen().catch((t=>{console.debug(`Error attempting to enable full-screen: ${t.message} (${t.name})`)}))}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}}class ZL extends iL{static defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};$element=nL("grid-line");offset=[0,0];constructor(t,e){super(t,Object.assign({},ZL.defaultOptions,e));!function(t,e){const n=t.firstChild;n?t.insertBefore(e,n):t.appendChild(e)}(this.context.canvas.getContainer(),this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:r,borderLineWidth:i,borderStroke:o,borderStyle:a}=this.options;Object.assign(this.$element.style,{border:r?`${i}px ${a} ${o}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`})}updateOffset(t){this.offset=function(t,e){return t.map((t=>t%e))}(ml(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}onTransform=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)};destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}function QL(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach((t=>{const{type:n,value:r}=t,i=Gu(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Removed.has(i)||e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)?e.Added.delete(i):e.Updated.has(i)?(e.Updated.delete(i),e.Removed.set(i,t)):e.Removed.set(i,t))})),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}function JL(t){const{NodeAdded:e=[],NodeUpdated:n=[],NodeRemoved:r=[],EdgeAdded:i=[],EdgeUpdated:o=[],EdgeRemoved:a=[],ComboAdded:s=[],ComboUpdated:c=[],ComboRemoved:u=[]}=$t(t,(t=>t.type));return{add:{nodes:e,edges:i,combos:s},update:{nodes:n,edges:o,combos:c},remove:{nodes:r,edges:a,combos:u}}}function tI(t,e){for(const n in t)jt(t[n])&&!Array.isArray(t[n])&&null!==t[n]?(e[n]||(e[n]={}),tI(t[n],e[n])):e[n]||(e[n]=Bu(n))}function eI(t,e=!1,n){const r={animation:e,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:o,remove:a}=JL(QL(t));return["nodes","edges","combos"].forEach((t=>{o[t]&&o[t].forEach((e=>{const i={...e.value};let o={...e.original};if(n){const t=n.graph.getElementType(Gu(e.original)),r="edge"===t?"stroke":"fill",i=n.element.getElementComputedStyle(t,e.original);o={...e.original,style:{[r]:i[r],...e.original.style}}}tI(i,o),r.current.update[t]||=[],r.current.update[t].push(i),r.original.update[t]||=[],r.original.update[t].push(o)})),i[t]&&i[t].forEach((e=>{const n={...e.value};r.current.add[t]||=[],r.current.add[t].push(n),r.original.remove[t]||=[],r.original.remove[t].push(n)})),a[t]&&a[t].forEach((e=>{const n={...e.value};r.current.remove[t]||=[],r.current.remove[t].push(n),r.original.add[t]||=[],r.original.add[t].push(n)}))})),r}class nI extends iL{static defaultOptions={stackSize:0};emitter;batchChanges=null;batchAnimation=!1;undoStack=[];redoStack=[];isFirstDraw=!0;freezed=!1;constructor(e,n){super(e,Object.assign({},nI.defaultOptions,n)),this.emitter=new Ud;const{graph:r}=this.context;r.on(t.GraphEvent.AFTER_DRAW,this.addCommand),r.on(t.GraphEvent.BATCH_START,this.initBatchCommand),r.on(t.GraphEvent.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){const e=this.undoStack.pop();return e&&(this.executeCommand(e),this.options.beforeAddCommand?.(e,!1),this.redoStack.push(e),this.options.afterAddCommand?.(e,!1),this.notify(t.HistoryEvent.UNDO,e)),this}redo(){const e=this.redoStack.pop();return e&&(this.executeCommand(e,!1),this.undoStackPush(e),this.notify(t.HistoryEvent.REDO,e)),this}undoAndCancel(){const e=this.undoStack.pop();return e&&(this.executeCommand(e,!1),this.redoStack=[],this.notify(t.HistoryEvent.CANCEL,e)),this}executeCommand=(t,e=!0)=>{this.freezed=!0,this.options.executeCommand?.(t);const n=e?t.original:t.current;this.context.graph.addData(n.add),this.context.graph.updateData(n.update),this.context.graph.removeData(Wu(n.remove,!1)),this.context.element?.draw({silence:!0,animation:t.animation}),this.freezed=!1};addCommand=e=>{if(this.isFirstDraw)this.isFirstDraw=!1;else if(!this.freezed){if(e.type===t.GraphEvent.AFTER_DRAW){const{dataChanges:t=[],animation:n=!0}=e.data;if(this.context.batch?.isBatching){if(!this.batchChanges)return;return this.batchChanges.push(t),void(this.batchAnimation&&=n)}this.batchChanges=[t],this.batchAnimation=n}this.undoStackPush(eI(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(t.HistoryEvent.ADD,this.undoStack[this.undoStack.length-1])}};initBatchCommand=t=>{const{initiate:e}=t.data;if(this.batchAnimation=!1,e)this.batchChanges=[];else{this.undoStack.pop()||(this.batchChanges=null)}};undoStackPush(t){const{stackSize:e}=this.options;0!==e&&this.undoStack.length>=e&&this.undoStack.shift(),this.options.beforeAddCommand?.(t,!0),this.undoStack.push(t),this.options.afterAddCommand?.(t,!0)}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(t.HistoryEvent.CLEAR,null)}notify(e,n){this.emitter.emit(e,{cmd:n}),this.emitter.emit(t.HistoryEvent.CHANGE,{cmd:n})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.addCommand),e.off(t.GraphEvent.BATCH_START,this.initBatchCommand),e.off(t.GraphEvent.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}function rI(t,e,n,r,i,o){const a=(o-e)*(n-t)-(r-e)*(i-t);return a>0||!(a<0)}var iI=function(t,e){const n=t[0][0],r=t[0][1],i=t[1][0],o=t[1][1],a=e[0][0],s=e[0][1],c=e[1][0],u=e[1][1];return rI(n,r,a,s,c,u)!==rI(i,o,a,s,c,u)&&rI(n,r,i,o,a,s)!==rI(n,r,i,o,c,u)};function oI(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(let e=0;e<t.length;e++){const n=t[e],r=this.coordToCellNum(n[0]),i=this.coordToCellNum(n[1]);if(this._cells[r])this._cells[r][i]?this._cells[r][i].push(n):this._cells[r][i]=[n];else{const t=[];t[i]=[n],this._cells[r]=t}}}function aI(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}oI.prototype={cellPoints:function(t,e){return void 0!==this._cells[t]&&void 0!==this._cells[t][e]?this._cells[t][e]:[]},rangePoints:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this.coordToCellNum(t[2]),i=this.coordToCellNum(t[3]),o=[];for(let t=e;t<=r;t++)for(let e=n;e<=i;e++)for(let n=0;n<this.cellPoints(t,e).length;n++)o.push(this.cellPoints(t,e)[n]);return o},removePoint:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this._cells[e][n];let i;for(let e=0;e<r.length;e++)if(r[e][0]===t[0]&&r[e][1]===t[1]){i=e;break}return r.splice(i,1),r},trunc:Math.trunc||function(t){return t-t%1},coordToCellNum:function(t){return this.trunc(t*this._reverseCellSize)},extendBbox:function(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}};var sI=function(t){const e=function(t){const e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&aI(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}(t),n=function(t){const e=t.reverse(),n=[];for(let t=0;t<e.length;t++){for(;n.length>=2&&aI(n[n.length-2],n[n.length-1],e[t])<=0;)n.pop();n.push(e[t])}return n.pop(),n}(t).concat(e);return n.push(t[0]),n};const cI=iI,uI=function(t,e){return new oI(t,e)},lI={toXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","return [pt"+e[0]+",pt"+e[1]+"];")(t)}))},fromXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","const o = {}; o"+e[0]+"= pt[0]; o"+e[1]+"= pt[1]; return o;")(t)}))}},hI=sI;function dI(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function fI(t,e,n){const r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],o=dI(t,e),a=dI(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(o*a)}function pI(t,e){for(let n=0;n<e.length-1;n++){const r=[e[n],e[n+1]];if(!(t[0][0]===r[0][0]&&t[0][1]===r[0][1]||t[0][0]===r[1][0]&&t[0][1]===r[1][1])&&cI(t,r))return!0}return!1}function gI(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function mI(t,e,n){let r,i,o=null,a=vI,s=vI;for(let c=0;c<e.length;c++)r=fI(t[0],t[1],e[c]),i=fI(t[1],t[0],e[c]),r>a&&i>s&&!pI([t[0],e[c]],n)&&!pI([t[1],e[c]],n)&&(a=r,s=i,o=e[c]);return o}function yI(t,e,n,r,i){let o=!1;for(let a=0;a<t.length-1;a++){const s=[t[a],t[a+1]],c=s[0][0]+","+s[0][1]+","+s[1][0]+","+s[1][1];if(dI(s[0],s[1])<e||i.has(c))continue;let u,l,h,d=0,f=gI(s);do{f=r.extendBbox(f,d),u=f[2]-f[0],l=f[3]-f[1],h=mI(s,r.rangePoints(f),t),d++}while(null===h&&(n[0]>u||n[1]>l));u>=n[0]&&l>=n[1]&&i.add(c),null!==h&&(t.splice(a+1,0,h),r.removePoint(h),o=!0)}return o?yI(t,e,n,r,i):t}const vI=Math.cos(90/(180/Math.PI)),bI=.6;var xI=function(t,e,n){let r=e||20;const i=function(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];n[0]===i[0]&&n[1]===i[1]||e.push(i),n=i}return e}(function(t){return t.sort((function(t,e){return t[0]-e[0]||t[1]-e[1]}))}(lI.toXy(t,n)));if(i.length<4){const t=i.concat([i[0]]);return n?lI.fromXy(t,n):t}const o=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<n&&(n=t[o][1]),t[o][0]>r&&(r=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[r-e,i-n]}(i),a=[o[0]*bI,o[1]*bI],s=hI(i),c=i.filter((function(t){return s.indexOf(t)<0})),u=Math.ceil(1/(i.length/(o[0]*o[1]))),l=yI(s,Math.pow(r,2),a,uI(c,u),new Set);return n?lI.fromXy(l,n):l},wI=p(xI);const EI=(t,e,n)=>{if("sharp"===n)return[["M",t[0]-e,t[1]-e],["L",t[0]+e,t[1]-e],["L",t[0]+e,t[1]+e],["L",t[0]-e,t[1]+e],["Z"]];const r=[e,e,0,0,0];return[["M",t[0],t[1]-e],["A",...r,t[0],t[1]+e],["A",...r,t[0],t[1]-e]]},MI=(t,e,n)=>{const r=[e,e,0,0,0],i="sharp"===n?ml(t[0],xl(Ml(yl(t[0],t[1])),e)):t[0],o="sharp"===n?ml(t[1],xl(Ml(yl(t[1],t[0])),e)):t[1],a=xl(Ml(Nl(yl(i,o),!1)),e),s=xl(a,-1),c=ml(i,a),u=ml(o,a),l=ml(o,s),h=ml(i,s);return"sharp"===n?[["M",c[0],c[1]],["L",u[0],u[1]],["L",l[0],l[1]],["L",h[0],h[1]],["Z"]]:[["M",c[0],c[1]],["L",u[0],u[1]],["A",...r,l[0],l[1]],["L",h[0],h[1]],["A",...r,c[0],c[1]]]},SI=(t,e)=>{const n=Gl(t).map(((n,r)=>{const i=(r-2+t.length)%t.length,o=(r-1+t.length)%t.length,a=(r+1)%t.length,s=t[i],c=t[o],u=t[a],l=yl(s,c),h=yl(c,n),d=yl(n,u),f=(t,e)=>Sl(t,e,!0)<Math.PI,p=f(l,h),g=f(h,d),m=t=>xl(Ml(Nl(t,!1)),e),y=m(h);return[{p:kl(ml(c,p?m(l):y)),concave:p&&c},{p:kl(ml(n,g?m(d):y)),concave:g&&n}]})),r=[e,e,0,0,0],i=n.findIndex(((t,e)=>!(n[(e-1+n.length)%n.length][0].concave||n[(e-1+n.length)%n.length][1].concave||t[0].concave||t[0].concave||t[1].concave))),o=n.slice(i).concat(n.slice(0,i));let a=[];return o.flatMap(((t,e)=>{const i=[],s=o[n.length-1];return 0===e&&i.push(["M",...s[1].p]),t[0].concave?a.push(t[0].p,t[1].p):i.push(["A",...r,...t[0].p]),t[1].concave?a.unshift(t[1].p):i.push(["L",...t[1].p]),3===a.length&&(i.pop(),i.push(["C",...a.flat()]),a=[]),i}))},NI=(t,e)=>{const n=Gl(t).map(((e,n)=>({p:e,v:Ml(yl(t[(n+1)%t.length],e))})));return n.forEach(((r,i)=>{const o=i>0?i-1:t.length-1,a=n[o].v,s=Ml(ml(a,xl(r.v,Sl(a,r.v,!0)<Math.PI?1:-1)));r.p=ml(r.p,xl(s,e))})),Th(n.map((t=>t.p)))},kI=(t,e)=>{const n=t.map(((n,r)=>{const i=t[0===r?t.length-1:r-1],o=Cl(xl(Ml(Nl(yl(i,n),!1)),e));return[ml(i,o),ml(n,o)]})).flat();return n.map(((t,e)=>{if(e%2==0)return null;return Al([n[(e-1)%n.length],n[e%n.length]],[n[(e+1)%n.length],n[(e+2)%n.length]],!0)})).filter(Boolean).map(((t,e)=>[0===e?"M":"L",t[0],t[1]])).concat([["Z"]])};class CI extends iL{shape;hullMemberIds=[];path;optionsCache;static defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};constructor(t,e){super(t,Object.assign({},CI.defaultOptions,e)),this.bindEvents()}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const{members:e,padding:n,corner:r,...i}=this.options;return{...i,d:this.getHullPath(t)}}drawHull=()=>{if(this.shape){const t=!fe(this.optionsCache,this.options);this.shape.update(this.getHullStyle(t))}else this.shape=new Ah({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);this.optionsCache={...this.options}};updateHullPath=t=>{this.shape&&this.options.members.includes(Gu(t.data))&&this.shape.update({d:this.getHullPath(!0)})};getHullPath=(t=!1)=>{const{graph:e}=this.context,n=this.getMember();if(0===n.length)return"";const r=n.map((t=>e.getNodeData(t))),i=wI(r.map(Pl),this.options.concavity).slice(1).reverse(),o=i.flatMap((t=>r.filter((e=>fe(Pl(e),t))).map(Gu)));return fe(o,this.hullMemberIds)&&!t||(this.hullMemberIds=o,this.path=function(t,e,n){if(1===t.length)return EI(t[0],e,n);if(2===t.length)return MI(t,e,n);switch(n){case"smooth":return NI(t,e);case"sharp":return kI(t,e);default:return SI(t,e)}}(i,this.getPadding(),this.options.corner)),this.path};getPadding(){const{graph:t}=this.context,e=this.hullMemberIds.reduce(((e,n)=>{const{halfExtents:r}=t.getElementRenderBounds(n),i=Math.max(r[0],r[1]);return Math.max(e,i)}),0);return e+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),e.some((t=>this.hullMemberIds.includes(t)))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Rt(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}function TI(t,e){e(t),t.children&&t.children.forEach((function(t){t&&TI(t,e)}))}function AI(t){OI(t,!0)}function PI(t){OI(t,!1)}function OI(t,e){var n=e?"visible":"hidden";TI(t,(function(t){t.attr("visibility",n)}))}var RI=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,h([],l(e),!1))||this;return r.isMutationObserved=!0,r.addEventListener(hs.INSERTED,(function(){PI(r)})),r}return r(e,t),e}(Ys);function _I(t){var e=t.appendChild(new RI({class:"offscreen"}));return PI(e),e}var DI=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({style:i({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=_I(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(ec);function LI(t){return t*Math.PI/180}function II(t){return Number((180*t/Math.PI).toPrecision(5))}var jI=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();function BI(t,e){return Rt(t)?t.apply(void 0,h([],l(e),!1)):t}var FI,zI=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map((function(t){var e=l(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]})));return Object.assign(r,{prefix:n}),r},GI=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach((function(i){var o=l(i,2),a=o[0],s=o[1],c=t;Object.prototype.hasOwnProperty.call(e,a)&&(s?zt(s)?(zt(t[a])||(c[a]={}),n<r?GI(t[a],s,n+1,r):c[a]=e[a]):It(s)?(c[a]=[],c[a]=c[a].concat(s)):c[a]=s:c[a]=s)}))},VI=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)GI(t,e[r]);return t},WI=function(t){return void 0!==t&&null!=t&&!Number.isNaN(t)},HI=function(t,e,n){if(!Rt(t))throw new TypeError("Expected a function");var r=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=t.apply(this,n);return a.set(o,s),s};return r.cache=function(t){var e,n,r,i=t;function o(t,o){++e>i&&(r=n,a(1),++e),n[t]=o}function a(t){e=0,n=Object.create(null),t||(r=Object.create(null))}return a(),{clear:a,has:function(t){return void 0!==n[t]||void 0!==r[t]},get:function(t){var e=n[t];return void 0!==e?e:void 0!==(e=r[t])?(o(t,e),e):void 0},set:function(t,e){void 0!==n[t]?n[t]=e:o(t,e)}}}(n),r}((function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return FI||(FI=Cs.offscreenCanvasCreator.getOrCreateContext(void 0)),FI.font=[o,a,i,"".concat(n,"px"),r].join(" "),FI.measureText(t).width}),(function(t,e){return[t,Object.values(e||$I(t)).join()].join("")}),4096),$I=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function UI(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}function YI(t,e){var n=UI(t);n&&n.attr(e)}function qI(t,e,n){void 0===n&&(n="..."),YI(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function KI(t){var e=t.canvas,n=t.touches,r=t.offsetX,i=t.offsetY;if(e)return[e.x,e.y];if(n){var o=n[0];return[o.clientX,o.clientY]}return r&&i?[r,i]:[0,0]}function XI(t){return"function"==typeof t?t():Wt(t)||Yt(t)?new DI({style:{text:String(t)}}):t}function ZI(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function QI(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=!1),!!(r&&t===e||i&&t===n)||t>e&&t<n}var JI=function(t,e){return function(n){return t*(1-n)+e*n}};function tj(t,e){return"number"==typeof t&&"number"==typeof e?JI(t,e):Array.isArray(t)&&Array.isArray(e)?function(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0;return function(i){var o=new Array(r),a=new Array(n),s=0;for(s=0;s<r;++s)o[s]=tj(t[s],e[s]);for(;s<n;++s)a[s]=e[s];for(s=0;s<r;++s)a[s]=o[s](i);return a}}(t,e):"object"==typeof t&&"object"==typeof e?function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n={},r={};return Object.entries(e).forEach((function(e){var i=l(e,2),o=i[0],a=i[1];o in t?n[o]=tj(t[o],a):r[o]=a})),function(t){return Object.entries(n).forEach((function(e){var n=l(e,2),i=n[0],o=n[1];return r[i]=o(t)})),r}}(t,e):function(e){return t}}function ej(t){for(var e=1/0,n=1/0,r=-1/0,i=-1/0,o=0;o<t.length;o++){var a=t[o],s=a.x,c=a.y,u=l([s+a.width,c+a.height],2),h=u[0],d=u[1];s<e&&(e=s),c<n&&(n=c),h>r&&(r=h),d>i&&(i=d)}return new jI(e,n,r-e,i-n)}var nj=function(t,e,n){var r=t.width,i=t.height,o=n.flexDirection,a=void 0===o?"row":o;n.flexWrap;var s=n.justifyContent,c=void 0===s?"flex-start":s;n.alignContent;var u=n.alignItems,h=void 0===u?"flex-start":u,d="row"===a,f="row"===a||"column"===a,p=d?f?[1,0]:[-1,0]:f?[0,1]:[0,-1],g=l([0,0],2),m=g[0],y=g[1],v=e.map((function(t){var e,n=t.width,r=t.height,i=l([m,y],2),o=i[0],a=i[1];return e=l([m+n*p[0],y+r*p[1]],2),m=e[0],y=e[1],new jI(o,a,n,r)})),b=ej(v),x={"flex-start":0,"flex-end":d?r-b.width:i-b.height,center:d?(r-b.width)/2:(i-b.height)/2},w=v.map((function(t){var e=t.x,n=t.y,r=jI.fromRect(t);return r.x=d?e+x[c]:e,r.y=d?n:n+x[c],r}));ej(w);var E=function(t){var e=l(d?["height",i]:["width",r],2),n=e[0],o=e[1];switch(h){case"flex-start":default:return 0;case"flex-end":return o-t[n];case"center":return o/2-t[n]/2}},M=w.map((function(t){var e=t.x,n=t.y,r=jI.fromRect(t);return r.x=d?e:e+E(r),r.y=d?n+E(r):n,r})),S=M.map((function(e){var n,r,i=jI.fromRect(e);return i.x+=null!==(n=t.x)&&void 0!==n?n:0,i.y+=null!==(r=t.y)&&void 0!==r?r:0,i}));return S},rj=function(t,e,n){return[]};function ij(t,e){return[t[0]*e,t[1]*e]}function oj(t,e){return[t[0]+e[0],t[1]+e[1]]}function aj(t,e){return[t[0]-e[0],t[1]-e[1]]}function sj(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1])]}function cj(t,e){return[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}function uj(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function lj(t){if(0===t[0]&&0===t[1])return[0,0];var e=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2));return[t[0]/e,t[1]/e]}function hj(t,e){return+t.toPrecision(e)}function dj(t,e){var n={},r=Array.isArray(e)?e:[e];for(var i in t)r.includes(i)||(n[i]=t[i]);return n}function fj(t,e,n){void 0===n&&(n=[[0,0],[1,1]]);for(var r=!!e,i=[],o=0,a=t.length;o<a;o+=2)i.push([t[o],t[o+1]]);var s,c,u,h=function(t,e,n,r){var i,o,a,s,c,u,h=[],d=!!r,f=[1/0,1/0],p=[-1/0,-1/0];if(d){f=(i=l(r,2))[0],p=i[1];for(var g=0,m=t.length;g<m;g+=1)f=sj(f,v=t[g]),p=cj(p,v)}g=0;for(var y=t.length;g<y;g+=1){var v=t[g];if(0!==g||n)if(g!==y-1||n){o=t[g-1];var b=[0,0];b=ij(b=aj(a=t[g+1],o),e);var x=uj(v,o),w=uj(v,a),E=x+w;0!==E&&(x/=E,w/=E);var M=ij(b,-x),S=ij(b,w);c=oj(v,M),s=sj(s=oj(v,S),cj(a,v)),s=cj(s,sj(a,v)),c=sj(c=oj(v,M=ij(M=aj(s,v),-x/w)),cj(o,v)),s=oj(v,S=ij(S=aj(v,c=cj(c,sj(o,v))),w/x)),d&&(c=sj(c=cj(c,f),p),s=sj(s=cj(s,f),p)),h.push(u),h.push(c),u=s}else c=v,h.push(u),h.push(c);else u=v}return h}(i,.4,r,n),d=i.length,f=[];for(o=0;o<d-1;o+=1)s=h[2*o],c=h[2*o+1],u=i[o+1],f.push(["C",s[0],s[1],c[0],c[1],u[0],u[1]]);return f}var pj=["$el","cx","cy","d","dx","dy","fill","fillOpacity","filter","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","height","img","increasedLineWidthForHitTesting","innerHTML","isBillboard","billboardRotation","isSizeAttenuation","isClosed","isOverflowing","leading","letterSpacing","lineDash","lineHeight","lineWidth","markerEnd","markerEndOffset","markerMid","markerStart","markerStartOffset","maxLines","metrics","miterLimit","offsetX","offsetY","opacity","path","points","r","radius","rx","ry","shadowColor","src","stroke","strokeOpacity","text","textAlign","textBaseline","textDecorationColor","textDecorationLine","textDecorationStyle","textOverflow","textPath","textPathSide","textPathStartOffset","transform","transformOrigin","visibility","width","wordWrap","wordWrapWidth","x","x1","x2","y","y1","y2","z1","z2","zIndex"];function gj(t){return pj.includes(t)}function mj(t){var e={};for(var n in t)gj(n)&&(e[n]=t[n]);return e}function yj(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=e/Math.max(i,o);return t.style.transform="scale(".concat(a,")"),a}var vj=function(){function t(t,n,r,i,o,a,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===a&&(a=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=a,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var a=this._data[o],s=l(Array.isArray(a)?a:[a,null],2),c=s[0],u=s[1];(d=r(c,o)).__data__=c,null!==u&&(d.__fromElements__=u),this._parent.appendChild(d),i.push(d)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var h=this._elements[o],d=r(c=h.__data__,o);h.appendChild(d),i.push(d)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=d(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=d(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=d(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var a,s,c,l=[],h=[],d=new Set(this._elements),f=[],p=new Set,g=new Map(this._elements.map((function(t,n){return[e(t.__data__,n),t]}))),m=new Map(this._facetElements.map((function(t,n){return[e(t.__data__,n),t]}))),y=(a=this._elements,s=function(t){return r(t.__data__)},c=new Map,a.forEach((function(t){var e=s(t);c.has(e)||c.set(e,[]),c.get(e).push(t)})),c),v=0;v<t.length;v++){var b=t[v],x=e(b,v),w=r(b,v);if(g.has(x))(N=g.get(x)).__data__=b,N.__facet__=!1,h.push(N),d.delete(N),g.delete(x);else if(m.has(x)){(N=m.get(x)).__data__=b,N.__facet__=!0,h.push(N),m.delete(x)}else if(y.has(x)){var E=y.get(x);f.push([b,E]);try{for(var M=(i=void 0,u(E)),S=M.next();!S.done;S=M.next()){var N=S.value;d.delete(N)}}catch(t){i={error:t}}finally{try{S&&!S.done&&(o=M.return)&&o.call(M)}finally{if(i)throw i.error}}y.delete(x)}else if(g.has(w)){(N=g.get(w)).__toData__?N.__toData__.push(b):N.__toData__=[b],p.add(N),d.delete(N)}else l.push(b)}var k=[new n([],l,this._parent,this._document),new n(h,null,this._parent,this._document),new n(d,null,this._parent,this._document),new n([],f,this._parent,this._document),new n(p,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,k)},t.prototype.merge=function(t){var e=h(h([],l(this._elements),!1),l(t._elements),!1),r=h(h([],l(this._transitions),!1),l(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),a=e(this._update),s=n(this._exit),c=r(this._merge),u=i(this._split);return a.merge(o).merge(s).merge(c).merge(u)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then((function(){return n.remove()})):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each((function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))}))},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each((function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))}))},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each((function(n,r){var i=this;Object.entries(t).forEach((function(t){var o=l(t,2),a=o[0],s=o[1],c="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(a,c.call(i,n,r))}))}))},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.transition=function(t){var e=this._transitions;return this.each((function(n,r){e[r]=t.call(this,n,r)}))},t.prototype.on=function(t,e){return this.each((function(){this.addEventListener(t,e)})),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,h([this._parent,this],l(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter((function(t){return!!t}))},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:Ys,rect:tc,circle:Hs,path:Zs,text:DI,ellipse:Us,image:Ks,line:Xs,polygon:Qs,polyline:Js,html:qs},t}();function bj(t){return new vj([t],null,t,t.ownerDocument)}function xj(t){if(Yt(t))return[t,t,t,t];if(It(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function wj(t){var e=t.getLocalBounds(),n=l([e.min,e.max],2),r=l(n[0],2),i=r[0],o=r[1],a=l(n[1],2),s=a[0],c=a[1];return{x:i,y:o,width:s-i,height:c-o,left:i,bottom:c,top:o,right:s}}function Ej(t,e){var n=l(t,2),r=n[0],i=n[1],o=l(e,2),a=o[0],s=o[1];return r!==a&&i===s}function Mj(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Sj(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var Nj=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function kj(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach((function(t){var i=l(t,2),o=i[0],a=i[1];if("className"===o||"class"===o);else if(Nj(o,"show")&&Nj(Sj(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(Mj(t))}(e,"show")?r[o]=a:r[o.replace(new RegExp(Mj(e)),"")]=a;else if(!Nj(o,"show")&&Nj(o,e)!==n){var s=Sj(o,e);"filter"===s&&"function"==typeof a||(r[s]=a)}})),r}function Cj(t,e){return Object.entries(t).reduce((function(t,n){var r=l(n,2),i=r[0],o=r[1];return i.startsWith("show")?t["show".concat(e).concat(i.slice(4))]=o:t["".concat(e).concat(Mj(i))]=o,t}),{})}function Tj(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach((function(t){var o=l(t,2),a=o[0],s=o[1];e.includes(a)||(-1!==n.indexOf(a)?i[a]=s:r[a]=s)})),[r,i]}function Aj(t,e){var n={YYYY:t.getFullYear(),MM:t.getMonth()+1,DD:t.getDate(),HH:t.getHours(),mm:t.getMinutes(),ss:t.getSeconds()},r=e;return Object.keys(n).forEach((function(t){var e=n[t];r=r.replace(t,"YYYY"===t?"".concat(e):"".concat(e).padStart(2,"0"))})),r}function Pj(t,e){if(e)try{var n=e.replace(/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,(function(e,n,r){return"translate(".concat(function(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=l([e,n].map((function(t,e){var n;return t.includes("%")?parseFloat((null===(n=t.match(/[+-]?([0-9]*[.])?[0-9]+/))||void 0===n?void 0:n[0])||"0")/100*(0===e?i:o):t})),2);return[a[0],a[1]]}(t,n,r),")")}));t.attr("transform",n)}catch(t){}}function Oj(){OI(this,"hidden"!==this.attributes.visibility)}var Rj=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,VI({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=_I(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&Oj.call(this)},e.prototype.update=function(t,e){var n;return this.attr(VI({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,o(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}($s),_j=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},Dj=_j,Lj=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},Ij=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},jj=Ij;var Bj=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function Fj(t){var e=function(t){var e="default";if(jt(t)&&t instanceof Image)e="image";else if(Rt(t))e="symbol";else if(Wt(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var zj=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,n){var r=t.x,a=void 0===r?0:r,s=t.y,c=void 0===s?0:s,u=this.getSubShapeStyle(t),l=u.symbol,h=u.size,d=void 0===h?16:h,f=o(u,["symbol","size"]),p=Fj(l);ZI(!!p,bj(n),(function(t){t.maybeAppendByClassName("marker",p).attr("className","marker ".concat(p,"-marker")).call((function(t){if("image"===p){var n=2*d;t.styles({img:l,width:n,height:n,x:a-d,y:c-d})}else{n=d/2;var r=Rt(l)?l:e.getSymbol(l);t.styles(i({d:null==r?void 0:r(a,c,n)},f))}}))}))},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(Rj);function Gj(t,...e){return e.reduce(((t,e)=>n=>t(e(n))),t)}function Vj(t,e){return e-t?n=>(n-t)/(e-t):t=>.5}zj.registerSymbol("cross",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]})),zj.registerSymbol("hyphen",(function(t,e,n){return[["M",t-n,e],["L",t+n,e]]})),zj.registerSymbol("line",Lj),zj.registerSymbol("plus",(function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]})),zj.registerSymbol("tick",(function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]})),zj.registerSymbol("circle",_j),zj.registerSymbol("point",Dj),zj.registerSymbol("bowtie",(function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]})),zj.registerSymbol("hexagon",(function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]})),zj.registerSymbol("square",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]})),zj.registerSymbol("diamond",(function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]})),zj.registerSymbol("triangle",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]})),zj.registerSymbol("triangle-down",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]})),zj.registerSymbol("line",Lj),zj.registerSymbol("dot",Ij),zj.registerSymbol("dash",jj),zj.registerSymbol("smooth",(function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]})),zj.registerSymbol("hv",(function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]})),zj.registerSymbol("vh",(function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]})),zj.registerSymbol("hvh",(function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]})),zj.registerSymbol("vhv",(function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}));const Wj=Math.sqrt(50),Hj=Math.sqrt(10),$j=Math.sqrt(2);function Uj(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/10**i;return i>=0?(o>=Wj?10:o>=Hj?5:o>=$j?2:1)*10**i:-(10**-i)/(o>=Wj?10:o>=Hj?5:o>=$j?2:1)}const Yj=(t,e,n=5)=>{const r=[t,e];let i,o=0,a=r.length-1,s=r[o],c=r[a];return c<s&&([s,c]=[c,s],[o,a]=[a,o]),i=Uj(s,c,n),i>0?(s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i,i=Uj(s,c,n)):i<0&&(s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i,i=Uj(s,c,n)),i>0?(r[o]=Math.floor(s/i)*i,r[a]=Math.ceil(c/i)*i):i<0&&(r[o]=Math.ceil(s*i)/i,r[a]=Math.floor(c*i)/i),r};function qj(t){return!(oe(t)||(e=t,null===e)||Number.isNaN(t));var e}var Kj={exports:{}},Xj={exports:{}},Zj=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},Qj=Array.prototype.concat,Jj=Array.prototype.slice,tB=Xj.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];Zj(i)?e=Qj.call(e,Jj.call(i)):e.push(i)}return e};tB.wrap=function(t){return function(){return t(tB(arguments))}};var eB=Xj.exports,nB={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},rB=eB,iB=Object.hasOwnProperty,oB=Object.create(null);for(var aB in nB)iB.call(nB,aB)&&(oB[nB[aB]]=aB);var sB=Kj.exports={to:{},get:{}};function cB(t,e,n){return Math.min(Math.max(e,t),n)}function uB(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}sB.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=sB.get.hsl(t),n="hsl";break;case"hwb":e=sB.get.hwb(t),n="hwb";break;default:e=sB.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},sB.get.rgb=function(t){if(!t)return null;var e,n,r,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var o=2*n;i[n]=parseInt(e.slice(o,o+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)i[n]=parseInt(e[n]+e[n],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)i[n]=parseInt(e[n+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:iB.call(nB,e[1])?((i=nB[e[1]])[3]=1,i):null:null;for(n=0;n<3;n++)i[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(n=0;n<3;n++)i[n]=cB(i[n],0,255);return i[3]=cB(i[3],0,1),i},sB.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,cB(parseFloat(e[2]),0,100),cB(parseFloat(e[3]),0,100),cB(isNaN(n)?1:n,0,1)]}return null},sB.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,cB(parseFloat(e[2]),0,100),cB(parseFloat(e[3]),0,100),cB(isNaN(n)?1:n,0,1)]}return null},sB.to.hex=function(){var t=rB(arguments);return"#"+uB(t[0])+uB(t[1])+uB(t[2])+(t[3]<1?uB(Math.round(255*t[3])):"")},sB.to.rgb=function(){var t=rB(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},sB.to.rgb.percent=function(){var t=rB(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},sB.to.hsl=function(){var t=rB(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},sB.to.hwb=function(){var t=rB(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},sB.to.keyword=function(t){return oB[t.slice(0,3)]};var lB=p(Kj.exports);function hB(t,e,n){let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function dB(t){const e=lB.get(t);if(!e)return null;const{model:n,value:r}=e;return"rgb"===n?r:"hsl"===n?function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100,i=t[3];if(0===n)return[255*r,255*r,255*r,i];const o=r<.5?r*(1+n):r+n-r*n,a=2*r-o;return[255*hB(a,o,e+1/3),255*hB(a,o,e),255*hB(a,o,e-1/3),i]}(r):null}const fB=(t,e)=>n=>t*(1-n)+e*n,pB=(t,e)=>"number"==typeof t&&"number"==typeof e?fB(t,e):"string"==typeof t&&"string"==typeof e?((t,e)=>{const n=dB(t),r=dB(e);return null===n||null===r?n?()=>t:()=>e:t=>{const e=new Array(4);for(let i=0;i<4;i+=1){const o=n[i],a=r[i];e[i]=o*(1-t)+a*t}const[i,o,a,s]=e;return`rgba(${Math.round(i)}, ${Math.round(o)}, ${Math.round(a)}, ${s})`}})(t,e):()=>t,gB=(t,e)=>{const n=fB(t,e);return t=>Math.round(n(t))};function mB({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):n}function yB(t){return"object"==typeof t?t.valueOf():t}class vB extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=yB,null!==t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(mB({map:this.map,initKey:this.initKey},t))}has(t){return super.has(mB({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(function({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(function({map:t,initKey:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}({map:this.map,initKey:this.initKey},t))}}class bB{constructor(t){this.options=le({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=le({},this.options,t),this.rescale(t)}rescale(t){}}const xB=Symbol("defaultUnknown");function wB(t,e,n){for(let r=0;r<e.length;r+=1)t.has(e[r])||t.set(n(e[r]),r)}function EB(t){const{value:e,from:n,to:r,mapper:i,notFoundReturn:o}=t;let a=i.get(e);if(void 0===a){if(o!==xB)return o;a=n.push(e)-1,i.set(e,a)}return r[a%r.length]}function MB(t){return t instanceof Date?t=>`${t}`:"object"==typeof t?t=>JSON.stringify(t):t=>t}class SB extends bB{getDefaultOptions(){return{domain:[],range:[],unknown:xB}}constructor(t){super(t)}map(t){return 0===this.domainIndexMap.size&&wB(this.domainIndexMap,this.getDomain(),this.domainKey),EB({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&wB(this.rangeIndexMap,this.getRange(),this.rangeKey),EB({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){const[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=MB(e),this.rangeKey=MB(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new SB(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function NB(t){return Math.round(1e12*t)/1e12}function kB(t){const{domain:e,range:n,paddingOuter:r,paddingInner:i,flex:o,round:a,align:s}=t,c=e.length,u=function(t,e){const n=e-t.length;return n>0?[...t,...new Array(n).fill(1)]:n<0?t.slice(0,e):t}(o,c),[l,h]=n,d=h-l,f=d/(2/c*r+1-1/c*i),p=f*i/c,g=f-c*p,m=function(t){const e=Math.min(...t);return t.map((t=>t/e))}(u),y=g/m.reduce(((t,e)=>t+e)),v=new vB(e.map(((t,e)=>{const n=m[e]*y;return[t,a?Math.floor(n):n]}))),b=new vB(e.map(((t,e)=>{const n=m[e]*y+p;return[t,a?Math.floor(n):n]}))),x=Array.from(b.values()).reduce(((t,e)=>t+e)),w=l+(d-(x-x/c*i))*s;let E=a?Math.round(w):w;const M=new Array(c);for(let t=0;t<c;t+=1){M[t]=NB(E);const n=e[t];E+=b.get(n)}return{valueBandWidth:v,valueStep:b,adjustedRange:M}}class CB extends SB{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:xB,flex:[]}}constructor(t){super(t)}clone(){return new CB(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:r,flex:i}=this.options,{adjustedRange:o,valueBandWidth:a,valueStep:s}=function(t){var e;const{domain:n}=t,r=n.length;if(0===r)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(null===(e=t.flex)||void 0===e?void 0:e.length)return kB(t);const{range:i,paddingOuter:o,paddingInner:a,round:s,align:c}=t;let u,l,h=i[0];const d=i[1]-h,f=2*o,p=r-a;u=d/Math.max(1,f+p),s&&(u=Math.floor(u)),h+=(d-u*(r-a))*c,l=u*(1-a),s&&(h=Math.round(h),l=Math.round(l));const g=new Array(r).fill(0).map(((t,e)=>h+e*u));return{valueStep:u,valueBandWidth:l,adjustedRange:g}}({align:t,range:n,round:r,flex:i,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=s,this.valueBandWidth=a,this.adjustedRange=o}}const TB=(t,e,n)=>{let r,i,o=t,a=e;if(o===a&&n>0)return[o];let s=Uj(o,a,n);if(0===s||!Number.isFinite(s))return[];if(s>0){o=Math.ceil(o/s),a=Math.floor(a/s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)*s}else{s=-s,o=Math.ceil(o*s),a=Math.floor(a*s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)/s}return i},AB=(t,e,n)=>{const[r,i]=t,[o,a]=e;let s,c;return r<i?(s=Vj(r,i),c=n(o,a)):(s=Vj(i,r),c=n(a,o)),Gj(c,s)},PB=(t,e,n)=>{const r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=t[0]>t[r],s=a?[...t].reverse():t,c=a?[...e].reverse():e;for(let t=0;t<r;t+=1)i[t]=Vj(s[t],s[t+1]),o[t]=n(c[t],c[t+1]);return e=>{const n=function(t,e,n,r,i){let o=n||0,a=r||t.length;for(;o<a;){const n=Math.floor((o+a)/2);t[n]>e?a=n:o=n+1}return o}(t,e,1,r)-1,a=i[n];return Gj(o[n],a)(e)}},OB=(t,e,n,r)=>(Math.min(t.length,e.length)>2?PB:AB)(t,e,r?gB:n);class RB extends bB{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:fB,tickCount:5}}map(t){return qj(t)?this.output(t):this.options.unknown}invert(t){return qj(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...r]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...r)}getTicks(){const{tickMethod:t}=this.options,[e,n,r,...i]=this.getTickMethodOptions();return t(e,n,r,...i)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return Yj}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,r=this.options.domain.map(t),i=Math.min(r.length,n.length);return e?function(t,e){const n=e<t?e:t,r=t>e?t:e;return t=>Math.min(Math.max(n,t),r)}(r[0],r[i-1]):we}composeOutput(t,e){const{domain:n,range:r,round:i,interpolate:o}=this.options,a=OB(n.map(t),r,o,i);this.output=Gj(a,e,t)}composeInput(t,e,n){const{domain:r,range:i}=this.options,o=OB(i,r.map(t),fB);this.input=Gj(e,n,o)}}class _B extends RB{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:pB,tickMethod:TB,tickCount:5}}chooseTransforms(){return[we,we]}clone(){return new _B(this.options)}}var DB=function(t){function e(e){var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,le({},{type:"column"},i({style:r},a)))||this).columnsGroup=new Ys({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return r(e,t),e.prototype.render=function(){var t=this.attributes,e=t.columns,n=t.x,r=t.y;this.columnsGroup.style.transform="translate(".concat(n,", ").concat(r,")"),bj(this.columnsGroup).selectAll(".column").data(e.flat()).join((function(t){return t.append("rect").attr("className","column").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.update=function(t){this.attr(VI({},this.attributes,t)),this.render()},e.prototype.clear=function(){this.removeChildren()},e}(Ws),LB=function(t){function e(e){var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,le({},{type:"lines"},i({style:r},a)))||this).linesGroup=n.appendChild(new Ys),n.areasGroup=n.appendChild(new Ys),n.render(),n}return r(e,t),e.prototype.render=function(){var t=this.attributes,e=t.lines,n=t.areas,r=t.x,i=t.y;this.style.transform="translate(".concat(r,", ").concat(i,")"),e&&this.renderLines(e),n&&this.renderAreas(n)},e.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},e.prototype.update=function(t){this.attr(VI({},this.attributes,t)),this.render()},e.prototype.renderLines=function(t){bj(this.linesGroup).selectAll(".line").data(t).join((function(t){return t.append("path").attr("className","line").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.renderAreas=function(t){bj(this.linesGroup).selectAll(".area").data(t).join((function(t){return t.append("path").attr("className","area").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.style(t)}))}),(function(t){return t.remove()}))},e}(Ws);function IB(t,e){void 0===e&&(e=!1);var n=e?t.length-1:0,r=t.map((function(t,e){return h([e===n?"M":"L"],l(t),!1)}));return e?r.reverse():r}function jB(t,e){if(void 0===e&&(e=!1),t.length<=2)return IB(t);for(var n=[],r=t.length,i=0;i<r;i+=1){var o=e?t[r-i-1]:t[i];fe(o,n.slice(-2))||n.push.apply(n,h([],l(o),!1))}var a=fj(n,!1);return e?a.unshift(h(["M"],l(t[r-1]),!1)):a.unshift(h(["M"],l(t[0]),!1)),a}function BB(t,e,n){var r=ae(t);return r.push(["L",e,n],["L",0,n],["Z"]),r}function FB(t){return 0===t.length?[0,0]:[Vt(Zt(t,(function(t){return Vt(t)||0}))),Gt(Xt(t,(function(t){return Gt(t)||0})))]}function zB(t){for(var e=ae(t),n=e[0].length,r=l([Array(n).fill(0),Array(n).fill(0)],2),i=r[0],o=r[1],a=0;a<e.length;a+=1)for(var s=e[a],c=0;c<n;c+=1)s[c]>=0?(s[c]+=i[c],i[c]=s[c]):(s[c]+=o[c],o[c]=s[c]);return e}var GB=function(t){function e(e){return t.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return r(e,t),Object.defineProperty(e.prototype,"rawData",{get:function(){var t=this.attributes.data;if(!t||0===(null==t?void 0:t.length))return[[]];var e=ae(t);return Yt(e[0])?[e]:e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.isStack?zB(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){var t=this.scales.y,e=l(t.getOptions().domain||[0,0],2),n=e[0],r=e[1];return r<0?t.map(r):t.map(n<0?0:n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"containerShape",{get:function(){var t=this.attributes;return{width:t.width,height:t.height}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linesStyle",{get:function(){var t=this,e=this.attributes,n=e.type,r=e.isStack,o=e.smooth;if("line"!==n)throw new Error("linesStyle can only be used in line type");var a=kj(this.attributes,"area"),s=kj(this.attributes,"line"),c=this.containerShape.width,u=this.data;if(0===u[0].length)return{lines:[],areas:[]};var d=this.scales,f=function(t,e){var n,r=e.x,i=e.y,o=l(i.getOptions().range||[0,0],2),a=o[0],s=o[1];return s>a&&(n=l([a,s],2),s=n[0],a=n[1]),t.map((function(t){return t.map((function(t,e){return[r.map(e),Ut(i.map(t),s,a)]}))}))}(u,{type:"line",x:d.x,y:d.y}),p=[];if(a){var g=this.baseline;p=r?o?function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=t[i],a=jB(o),s=void 0;if(0===i)s=BB(a,e,n);else{var c=jB(t[i-1],!0),u=o[0];c[0][0]="L",s=h(h(h([],l(a),!1),l(c),!1),[h(["M"],l(u),!1),["Z"]],!1)}r.push(s)}return r}(f,c,g):function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=IB(t[i]),a=void 0;if(0===i)a=BB(o,e,n);else{var s=IB(t[i-1],!0);s[0][0]="L",a=h(h(h([],l(o),!1),l(s),!1),[["Z"]],!1)}r.push(a)}return r}(f,c,g):function(t,e,n,r){return t.map((function(t){return BB(e?jB(t):IB(t),n,r)}))}(f,o,c,g)}return{lines:f.map((function(e,n){return i({stroke:t.getColor(n),d:o?jB(e):IB(e)},s)})),areas:p.map((function(e,n){return i({d:e,fill:t.getColor(n)},a)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnsStyle",{get:function(){var t=this,e=kj(this.attributes,"column"),n=this.attributes,r=n.isStack,o=n.type,a=n.scale;if("column"!==o)throw new Error("columnsStyle can only be used in column type");var s=this.containerShape.height,c=this.rawData;if(!c)return{columns:[]};r&&(c=zB(c));var u=this.createScales(c),h=u.x,d=u.y,f=l(FB(c),2),p=f[0],g=f[1],m=new _B({domain:[0,g-(p>0?0:p)],range:[0,s*a]}),y=h.getBandWidth(),v=this.rawData;return{columns:c.map((function(n,o){return n.map((function(n,a){var s=y/c.length;return i(i({fill:t.getColor(o)},e),r?{x:h.map(a),y:d.map(n),width:y,height:m.map(v[o][a])}:{x:h.map(a)+s*o,y:n>=0?d.map(n):d.map(0),width:s,height:m.map(Math.abs(n))})}))}))}},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){var n,r,o;(n=e,r=".container",o="rect",n.querySelector(r)?bj(n).select(r):bj(n).append(o)).attr("className","container").node();var a=t.type,s=t.x,c=t.y,u="spark".concat(a),l=i({x:s,y:c},"line"===a?this.linesStyle:this.columnsStyle);bj(e).selectAll(".spark").data([a]).join((function(t){return t.append((function(t){return"line"===t?new LB({className:u,style:l}):new DB({className:u,style:l})})).attr("className","spark ".concat(u))}),(function(t){return t.update(l)}),(function(t){return t.remove()}))},e.prototype.getColor=function(t){var e=this.attributes.color;return It(e)?e[t%e.length]:Rt(e)?e.call(null,t):e},e.prototype.createScales=function(t){var e,n,r=this.attributes,i=r.type,o=r.scale,a=r.range,s=void 0===a?[]:a,c=r.spacing,u=this.containerShape,h=u.width,d=u.height,f=l(FB(t),2),p=f[0],g=f[1],m=new _B({domain:[null!==(e=s[0])&&void 0!==e?e:p,null!==(n=s[1])&&void 0!==n?n:g],range:[d,d*(1-o)]});return"line"===i?{type:i,x:new _B({domain:[0,t[0].length-1],range:[0,h]}),y:m}:{type:i,x:new CB({domain:t[0].map((function(t,e){return e})),range:[0,h],paddingInner:c,paddingOuter:c/2,align:.5}),y:m}},e.tag="sparkline",e}(Rj);function VB(t){if(!t)return{enter:!1,update:!1,exit:!1};var e=["enter","update","exit"],n=Object.fromEntries(Object.entries(t).filter((function(t){var n=l(t,1)[0];return!e.includes(n)})));return Object.fromEntries(e.map((function(e){return function(t){return"boolean"!=typeof t&&"enter"in t&&"update"in t&&"exit"in t}(t)?!1===t[e]?[e,!1]:[e,i(i({},t[e]),n)]:[e,n]})))}function WB(t,e){t?t.finished.then(e):e()}function HB(t,e){"update"in t?t.update(e):t.attr(e)}function $B(t,e,n){return 0===e.length?null:n?t.animate(e,n):(HB(t,{style:e.slice(-1)[0]}),null)}function UB(t,e,n){var r={},o={};return Object.entries(e).forEach((function(e){var n=l(e,2),i=n[0],a=n[1];if(!_t(a)){var s=t.style[i]||t.parsedStyle[i]||0;s!==a&&(r[i]=s,o[i]=a)}})),n?$B(t,[r,o],i({fill:"both"},n)):(HB(t,o),null)}function YB(t,e){return t.style.opacity||(t.style.opacity=1),UB(t,{opacity:0},e)}var qB={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},KB={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},XB={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},ZB=zI({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),QB=zI({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),JB=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,e){var n=t.x,r=t.y,a=t.size,s=void 0===a?10:a,c=t.radius,u=void 0===c?s/4:c,l=t.orientation,h=o(t,["x","y","size","radius","orientation"]),d=s,f=2.4*d,p=bj(e).maybeAppendByClassName(QB.iconRect,"rect").styles(i(i({},h),{width:d,height:f,radius:u,x:n-d/2,y:r-f/2,transformOrigin:"center"})),g=n+1/3*d-d/2,m=n+2/3*d-d/2,y=r+1/4*f-f/2,v=r+3/4*f-f/2;p.maybeAppendByClassName("".concat(QB.iconLine,"-1"),"line").styles(i({x1:g,x2:g,y1:y,y2:v},h)),p.maybeAppendByClassName("".concat(QB.iconLine,"-2"),"line").styles(i({x1:m,x2:m,y1:y,y2:v},h)),"vertical"===l&&(p.node().style.transform="rotate(90)")},e}(Rj),tF=function(t){function e(e){return t.call(this,e,XB)||this}return r(e,t),e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.x,a=n.y,s=n.showLabel,c=kj(this.attributes,"label"),u=c.x,h=void 0===u?0:u,d=c.y,f=void 0===d?0:d,p=c.transform,g=c.transformOrigin,m=l(Tj(o(c,["x","y","transform","transformOrigin"]),[]),2),y=m[0],v=m[1],b=bj(t).maybeAppendByClassName(QB.labelGroup,"g").styles(v),x=i(i({},KB),y),w=x.text,E=o(x,["text"]);ZI(!!s,b,(function(t){e.label=t.maybeAppendByClassName(QB.label,"text").styles(i(i({},E),{x:r+h,y:a+f,transform:p,transformOrigin:g,text:"".concat(w)})),e.label.on("mousedown",(function(t){t.stopPropagation()})),e.label.on("touchstart",(function(t){t.stopPropagation()}))}))},e.prototype.renderIcon=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.orientation,a=e.type,s=i(i({x:n,y:r,orientation:o},qB),kj(this.attributes,"icon")),c=this.attributes.iconShape,u=void 0===c?function(){return new JB({style:s})}:c;bj(t).maybeAppendByClassName(QB.iconGroup,"g").selectAll(QB.icon.class).data([u]).join((function(t){return t.append("string"==typeof u?u:function(){return u(a)}).attr("className",QB.icon.name)}),(function(t){return t.update(s)}),(function(t){return t.remove()}))},e.prototype.render=function(t,e){this.renderIcon(e),this.renderLabel(e)},e}(Rj),eF=function(t){function e(e){var n=t.call(this,e,i(i(i({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(t){return t.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},Cj(XB,"handle")),Cj(qB,"handleIcon")),Cj(KB,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(t){return function(e){e.stopPropagation(),n.target=t,n.prevPos=n.getOrientVal(KI(e));var r=n.availableSpace,i=r.x,o=r.y,a=n.getBBox(),s=a.x,c=a.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([i,o])-n.getOrientVal([+s,+c])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(t){var e=n.attributes,r=e.slidable,i=e.brushable,o=e.type;t.stopPropagation();var a=n.getOrientVal(KI(t)),s=a-n.prevPos;if(s){var c=n.getRatio(s);switch(n.target){case"start":r&&n.setValuesOffset(c);break;case"end":r&&n.setValuesOffset(0,c);break;case"selection":r&&n.setValuesOffset(c,c);break;case"track":if(!i)return;n.selectionWidth+=c,"range"===o?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0)}n.prevPos=a}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(t){var e=n.attributes,r=e.onChange,i=e.type,o="range"===i?t:t[1],a="range"===i?n.getValues():n.getValues()[1],s=new as("valuechange",{detail:{oldValue:o,value:a}});n.dispatchEvent(s),null==r||r(a)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return r(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return this.attributes.values},set:function(t){this.attributes.values=this.clampValues(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sparklineStyle",{get:function(){if("horizontal"!==this.attributes.orientation)return null;var t=kj(this.attributes,"sparkline");return i(i({zIndex:0},this.availableSpace),t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t=this.attributes,e=t.trackLength,n=t.trackSize,r=l(this.getOrientVal([[e,n],[n,e]]),2);return{width:r[0],height:r[1]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes;t.x,t.y;var e=l(xj(t.padding),4),n=e[0],r=e[1],i=e[2],o=e[3],a=this.shape;return{x:o,y:n,width:a.width-(o+r),height:a.height-(n+i)}},enumerable:!1,configurable:!0}),e.prototype.getValues=function(){return this.values},e.prototype.setValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1),this.attributes.values=t;var n=!1!==e&&this.attributes.animate;this.updateSelectionArea(n),this.updateHandlesPosition(n)},e.prototype.updateSelectionArea=function(t){var e=this.calcSelectionArea();this.foregroundGroup.selectAll(ZB.selection.class).each((function(n,r){UB(this,e[r],t)}))},e.prototype.updateHandlesPosition=function(t){this.attributes.showHandle&&(this.startHandle&&UB(this.startHandle,this.getHandleStyle("start"),t),this.endHandle&&UB(this.endHandle,this.getHandleStyle("end"),t))},e.prototype.innerSetValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1);var n=this.values,r=this.clampValues(t);this.attributes.values=r,this.setValues(r),e&&this.onValueChange(n)},e.prototype.renderTrack=function(t){var e=this.attributes,n=e.x,r=e.y,o=kj(this.attributes,"track");this.trackShape=bj(t).maybeAppendByClassName(ZB.track,"rect").styles(i(i({x:n,y:r},this.shape),o))},e.prototype.renderBrushArea=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.brushable;this.brushArea=bj(t).maybeAppendByClassName(ZB.brushArea,"rect").styles(i({x:n,y:r,fill:"transparent",cursor:o?"crosshair":"default"},this.shape))},e.prototype.renderSparkline=function(t){var e=this,n=this.attributes,r=n.x,o=n.y;ZI("horizontal"===n.orientation,bj(t).maybeAppendByClassName(ZB.sparklineGroup,"g"),(function(t){var n=i(i({},e.sparklineStyle),{x:r,y:o});t.maybeAppendByClassName(ZB.sparkline,(function(){return new GB({style:n})})).update(n)}))},e.prototype.renderHandles=function(){var t,e=this,n=this.attributes,r=n.showHandle,i=n.type,o=r?"range"===i?["start","end"]:["end"]:[],a=this;null===(t=this.foregroundGroup)||void 0===t||t.selectAll(ZB.handle.class).data(o.map((function(t){return{type:t}})),(function(t){return t.type})).join((function(t){return t.append((function(t){var n=t.type;return new tF({style:e.getHandleStyle(n)})})).each((function(t){var e=t.type;this.attr("class","".concat(ZB.handle.name," ").concat(e,"-handle"));var n="".concat(e,"Handle");a[n]=this,this.addEventListener("pointerdown",a.onDragStart(e))}))}),(function(t){return t.each((function(t){var e=t.type;this.update(a.getHandleStyle(e))}))}),(function(t){return t.each((function(t){var e=t.type,n="".concat(e,"Handle");a[n]=void 0})).remove()}))},e.prototype.renderSelection=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.type,a=e.selectionType;this.foregroundGroup=bj(t).maybeAppendByClassName(ZB.foreground,"g");var s=kj(this.attributes,"selection"),c=function(t){return t.style("visibility",(function(t){return t.show?"visible":"hidden"})).style("cursor",(function(t){return"select"===a?"grab":"invert"===a?"crosshair":"default"})).styles(i(i({},s),{transform:"translate(".concat(n,", ").concat(r,")")}))},u=this;this.foregroundGroup.selectAll(ZB.selection.class).data("value"===o?[]:this.calcSelectionArea().map((function(t,e){return{style:i({},t),index:e,show:"select"===a?1===e:1!==e}})),(function(t){return t.index})).join((function(t){return t.append("rect").attr("className",ZB.selection.name).call(c).each((function(t,e){var n=this;1===e?(u.selectionShape=bj(this),this.on("pointerdown",(function(t){n.attr("cursor","grabbing"),u.onDragStart("selection")(t)})),u.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),u.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),u.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",(function(){n.attr("cursor","grabbing")})),this.addEventListener("pointerup",(function(){n.attr("cursor","pointer")})),this.addEventListener("pointerover",(function(){n.attr("cursor","pointer")}))):this.on("pointerdown",u.onDragStart("track"))}))}),(function(t){return t.call(c)}),(function(t){return t.remove()})),this.updateSelectionArea(!1),this.renderHandles()},e.prototype.render=function(t,e){this.renderTrack(e),this.renderSparkline(e),this.renderBrushArea(e),this.renderSelection(e)},e.prototype.clampValues=function(t,e){var n;void 0===e&&(e=4);var r=l(this.range,2),i=r[0],o=r[1],a=l(this.getValues().map((function(t){return hj(t,e)})),2),s=a[0],c=a[1],u=l(((Array.isArray(t)?t:[s,null!=t?t:c])||[s,c]).map((function(t){return hj(t,e)})),2),h=u[0],d=u[1];if("value"===this.attributes.type)return[0,Ut(d,i,o)];h>d&&(h=(n=l([d,h],2))[0],d=n[1]);var f=d-h;return f>o-i?[i,o]:h<i?s===i&&c===d?[i,d]:[i,f+i]:d>o?c===o&&s===h?[h,o]:[o-f,o]:[h,d]},e.prototype.calcSelectionArea=function(t){var e=l(this.clampValues(t),2),n=e[0],r=e[1],i=this.availableSpace,o=i.x,a=i.y,s=i.width,c=i.height;return this.getOrientVal([[{y:a,height:c,x:o,width:n*s},{y:a,height:c,x:n*s+o,width:(r-n)*s},{y:a,height:c,x:r*s,width:(1-r)*s}],[{x:o,width:s,y:a,height:n*c},{x:o,width:s,y:n*c+a,height:(r-n)*c},{x:o,width:s,y:r*c,height:(1-r)*c}]])},e.prototype.calcHandlePosition=function(t){var e=this.attributes.handleIconOffset,n=this.availableSpace,r=n.x,i=n.y,o=n.width,a=n.height,s=l(this.clampValues(),2),c=s[0],u=s[1],h="start"===t?-e:e,d=("start"===t?c:u)*this.getOrientVal([o,a])+h;return{x:r+this.getOrientVal([d,o/2]),y:i+this.getOrientVal([a/2,d])}},e.prototype.inferTextStyle=function(t){return"horizontal"===this.attributes.orientation?{}:"start"===t?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:"end"===t?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},e.prototype.calcHandleText=function(t){var e,n=this.attributes,r=n.type,o=n.orientation,a=n.formatter,s=n.autoFitLabel,c=kj(this.attributes,"handle"),u=kj(c,"label"),l=c.spacing,h=this.getHandleSize(),d=this.clampValues(),f=a("start"===t?d[0]:d[1]),p=new DI({style:i(i(i({},u),this.inferTextStyle(t)),{text:f})}),g=p.getBBox(),m=g.width,y=g.height;if(p.destroy(),!s){if("value"===r)return{text:f,x:0,y:-y-l};var v=l+h+("horizontal"===o?m/2:0);return(e={text:f})["horizontal"===o?"x":"y"]="start"===t?-v:v,e}var b=0,x=0,w=this.availableSpace,E=w.width,M=w.height,S=this.calcSelectionArea()[1],N=S.x,k=S.y,C=S.width,T=S.height,A=l+h;if("horizontal"===o){var P=A+m/2;if("start"===t)b=N-A-m>0?-P:P;else b=E-N-C-A>m?P:-P}else{var O=y+A;x="start"===t?k-h>y?-O:A:M-(k+T)-h>y?O:-A}return{x:b,y:x,text:f}},e.prototype.getHandleLabelStyle=function(t){var e=kj(this.attributes,"handleLabel");return i(i(i({},e),this.calcHandleText(t)),this.inferTextStyle(t))},e.prototype.getHandleIconStyle=function(){var t=this.attributes.handleIconShape,e=kj(this.attributes,"handleIcon"),n=this.getOrientVal(["ew-resize","ns-resize"]),r=this.getHandleSize();return i({cursor:n,shape:t,size:r},e)},e.prototype.getHandleStyle=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.showLabel,a=e.showLabelOnInteraction,s=e.orientation,c=this.calcHandlePosition(t),u=c.x,l=c.y,h=this.calcHandleText(t),d=o;return!o&&a&&(d=!!this.target),i(i(i({},Cj(this.getHandleIconStyle(),"icon")),Cj(i(i({},this.getHandleLabelStyle(t)),h),"label")),{transform:"translate(".concat(u+n,", ").concat(l+r,")"),orientation:s,showLabel:d,type:t,zIndex:3})},e.prototype.getHandleSize=function(){var t=this.attributes,e=t.handleIconSize,n=t.width,r=t.height;return e||Math.floor((this.getOrientVal([+r,+n])+4)/2.4)},e.prototype.getOrientVal=function(t){var e=l(t,2),n=e[0],r=e[1];return"horizontal"===this.attributes.orientation?n:r},e.prototype.setValuesOffset=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=!1);var r=this.attributes.type,i=l(this.getValues(),2),o=[i[0]+("range"===r?t:0),i[1]+e].sort();n?this.setValues(o):this.innerSetValues(o,!0)},e.prototype.getRatio=function(t){var e=this.availableSpace,n=e.width,r=e.height;return t/this.getOrientVal([n,r])},e.prototype.dispatchCustomEvent=function(t,e,n){var r=this;t.on(e,(function(t){t.stopPropagation(),r.dispatchEvent(new as(n,{detail:t}))}))},e.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var t=this.brushArea;this.dispatchCustomEvent(t,"click","trackClick"),this.dispatchCustomEvent(t,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(t,"pointerleave","trackMouseleave"),t.on("pointerdown",this.onDragStart("track"))},e.prototype.onScroll=function(t){if(this.attributes.scrollable){var e=t.deltaX,n=t.deltaY||e,r=this.getRatio(n);this.setValuesOffset(r,r,!0)}},e.tag="slider",e}(Rj),nF={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new Zs({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};le({},nF,{style:{type:"arc"}}),le({},nF,{style:{}});var rF=zI({mainGroup:"main-group",gridGroup:"grid-group",grid:"grid",lineGroup:"line-group",line:"line",tickGroup:"tick-group",tick:"tick",tickItem:"tick-item",labelGroup:"label-group",label:"label",labelItem:"label-item",titleGroup:"title-group",title:"title",lineFirst:"line-first",lineSecond:"line-second"},"axis"),iF=zI({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function oF(t){return t.reduce((function(t,e,n){return t.push(h([0===n?"M":"L"],l(e),!1)),t}),[])}function aF(t,e,n){return"surround"===e.type?function(t,e,n){var r=e.connect,i=void 0===r?"line":r,o=e.center;if("line"===i)return oF(t);if(!o)return[];var a=uj(t[0],o),s=n?0:1;return t.reduce((function(t,e,n){return 0===n?t.push(h(["M"],l(e),!1)):t.push(h(["A",a,a,0,0,s],l(e),!1)),t}),[])}(t,e,n):oF(t)}function sF(t,e,n){var r=n.type,i=n.connect,o=n.center,a=n.closed?[["Z"]]:[],s=l([aF(t,n),aF(e.slice().reverse(),n,!0)],2),c=s[0],u=s[1],d=l([t[0],e.slice(-1)[0]],2),f=d[0],p=d[1],g=function(t,e){return[c,t,u,e,a].flat()};if("line"===i||"surround"===r)return g([h(["L"],l(p),!1)],[h(["L"],l(f),!1)]);if(!o)throw new Error("Arc grid need to specified center");var m=l([uj(p,o),uj(f,o)],2),y=m[0],v=m[1];return g([h(["A",y,y,0,0,1],l(p),!1),h(["L"],l(p),!1)],[h(["A",v,v,0,0,0],l(f),!1),h(["L"],l(f),!1)])}var cF=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,e){t.type,t.center,t.areaFill,t.closed;var n=o(t,["type","center","areaFill","closed"]),r=function(t){var e=t.data,n=void 0===e?[]:e;return t.closed?n.map((function(t){var e=t.points,n=l(e,1)[0];return i(i({},t),{points:h(h([],l(e),!1),[n],!1)})})):n}(t),a=bj(e).maybeAppendByClassName(iF.lineGroup,"g"),s=bj(e).maybeAppendByClassName(iF.regionGroup,"g"),c=function(t,e,n,r){var o=n.animate,a=n.isBillboard,s=e.map((function(t,e){return{id:t.id||"grid-line-".concat(e),d:aF(t.points,n)}}));return t.selectAll(iF.line.class).data(s,(function(t){return t.id})).join((function(t){return t.append("path").each((function(t,e){var n=BI(mj(i({d:t.d},r)),[t,e,s]);this.attr(i({class:iF.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},n))}))}),(function(t){return t.transition((function(t,e){return UB(this,BI(mj(i({d:t.d},r)),[t,e,s]),o.update)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this,o.exit);return WB(e,(function(){return t.remove()})),e}))})).transitions()}(a,r,t,n),u=function(t,e,n){var r=n.animate,i=n.connect,o=n.areaFill;if(e.length<2||!o||!i)return[];for(var a=Array.isArray(o)?o:[o,"transparent"],s=function(t){return a[t%a.length]},c=[],u=0;u<e.length-1;u++){var h=l([e[u].points,e[u+1].points],2),d=sF(h[0],h[1],n);c.push({d:d,fill:s(u)})}return t.selectAll(iF.region.class).data(c,(function(t,e){return e})).join((function(t){return t.append("path").each((function(t,e){var n=BI(t,[t,e,c]);this.attr(n)})).attr("className",iF.region.name)}),(function(t){return t.transition((function(t,e){return UB(this,BI(t,[t,e,c]),r.update)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this,r.exit);return WB(e,(function(){return t.remove()})),e}))})).transitions()}(s,r,t);return h(h([],l(c),!1),l(u),!1)},e}(Rj);function uF(t,e){return Object.fromEntries(Object.entries(t).map((function(t){var n=l(t,2);return[n[0],BI(n[1],e)]})))}function lF(t,e){return e&&Rt(e)?t.filter(e):t}function hF(t,e){var n=e.startAngle;return(e.endAngle-n)*t+n}function dF(t,e){if("linear"===e.type){var n=l(e.startPos,2),r=n[0],i=n[1],o=l(e.endPos,2),a=l([o[0]-r,o[1]-i],2);return lj([a[0],a[1]])}var s=LI(hF(t,e));return[-Math.sin(s),Math.cos(s)]}function fF(t,e,n){return function(t,e){return e?[t[1],-t[0]]:[-t[1],t[0]]}(dF(t,n),"positive"!==e)}function pF(t,e){return fF(t,e.labelDirection,e)}function gF(t,e){return"linear"===e.type?function(t,e){var n=l(e.startPos,2),r=n[0],i=n[1],o=l(e.endPos,2),a=l([o[0]-r,o[1]-i],2);return[r+a[0]*t,i+a[1]*t]}(t,e):function(t,e){var n=e.radius,r=l(e.center,2),i=r[0],o=r[1],a=LI(hF(t,e));return[i+n*Math.cos(a),o+n*Math.sin(a)]}(t,e)}function mF(t){return 0===dF(0,t)[1]}function yF(t){return 0===dF(0,t)[0]}function vF(t,e){return e-t==360}function bF(t,e,n,r,i){var o=e-t,a=l([i,i],2),s=a[0],c=a[1],u=l([LI(t),LI(e)],2),h=u[0],d=u[1],f=function(t){return[n+i*Math.cos(t),r+i*Math.sin(t)]},p=l(f(h),2),g=p[0],m=p[1],y=l(f(d),2),v=y[0],b=y[1];if(vF(t,e)){var x=l(f((d+h)/2),2);return[["M",g,m],["A",s,c,0,1,0,x[0],x[1]],["A",s,c,0,1,0,v,b]]}var w=o>180?1:0,E=t>e?0:1;return"M".concat(g,",").concat(m,",A").concat(s,",").concat(c,",0,").concat(w,",").concat(E,",").concat(v,",").concat(b)}function xF(t,e,n,r){var o=e.startAngle,a=e.endAngle,s=e.center,c=e.radius;return t.selectAll(rF.line.class).data([{d:bF.apply(void 0,h(h([o,a],l(s),!1),[c],!1))}],(function(t,e){return e})).join((function(t){return t.append("path").attr("className",rF.line.name).styles(e).styles({d:function(t){return t.d}})}),(function(t){return t.transition((function(){var t=this,e=function(t,e,n,r){if(!r)return t.attr("__keyframe_data__",n),null;var o=r.duration,a=void 0===o?0:o,s=tj(e,n),c=Math.ceil(+a/16),u=new Array(c).fill(0).map((function(t,e,n){return{__keyframe_data__:s(e/(n.length-1))}}));return t.animate(u,i({fill:"both"},r))}(this,function(t){var e=t.attributes,n=e.startAngle,r=e.endAngle,i=e.center,o=e.radius;return h(h([n,r],l(i),!1),[o],!1)}(this),h(h([o,a],l(s),!1),[c],!1),r.update);if(e){var n=function(){var e=pe(t.attributes,"__keyframe_data__");t.style.d=bF.apply(void 0,h([],l(e),!1))};e.onframe=n,e.onfinish=n}return e})).styles(e)}),(function(t){return t.remove()})).styles(n).transitions()}function wF(t){var e=l(t,2),n=l(e[0],2),r=n[0],i=n[1],o=l(e[1],2);return{x1:r,y1:i,x2:o[0],y2:o[1]}}function EF(t,e,n,r){var i=e.showTrunc,o=e.startPos,a=e.endPos,s=e.truncRange,c=e.lineExtension,u=l([o,a],2),h=l(u[0],2),d=h[0],f=h[1],p=l(u[1],2),g=p[0],m=p[1],y=l(c?function(t,e,n){void 0===n&&(n=[0,0]);var r=l([t,e,n],3),i=l(r[0],2),o=i[0],a=i[1],s=l(r[1],2),c=s[0],u=s[1],h=l(r[2],2),d=h[0],f=h[1],p=l([c-o,u-a],2),g=p[0],m=p[1],y=Math.sqrt(Math.pow(g,2)+Math.pow(m,2)),v=l([-d/y,f/y],2),b=v[0],x=v[1];return[b*g,b*m,x*g,x*m]}(o,a,c):new Array(4).fill(0),4),v=y[0],b=y[1],x=y[2],w=y[3],E=function(e){return t.selectAll(rF.line.class).data(e,(function(t,e){return e})).join((function(t){return t.append("line").attr("className",(function(t){return"".concat(rF.line.name," ").concat(t.className)})).styles(n).transition((function(t){return UB(this,wF(t.line),!1)}))}),(function(t){return t.styles(n).transition((function(t){return UB(this,wF(t.line),r.update)}))}),(function(t){return t.remove()})).transitions()};if(!i||!s)return E([{line:[[d+v,f+b],[g+x,m+w]],className:rF.line.name}]);var M=l(s,2),S=M[0],N=M[1],k=g-d,C=m-f,T=l([d+k*S,f+C*S],2),A=T[0],P=T[1],O=l([d+k*N,f+C*N],2),R=O[0],_=O[1],D=E([{line:[[d+v,f+b],[A,P]],className:rF.lineFirst.name},{line:[[R,_],[g+x,m+w]],className:rF.lineSecond.name}]);return function(t,e){e.truncRange,e.truncShape,e.lineExtension}(0,e),D}function MF(t,e,n){var r,i=e.type,o=kj(e,"line");return r="linear"===i?EF(t,e,dj(o,"arrow"),n):xF(t,e,dj(o,"arrow"),n),function(t,e,n,r){var i,o=n.showArrow,a=n.showTrunc,s=n.lineArrow,c=n.lineArrowOffset,u=n.lineArrowSize;if(i="arc"===e?t.select(rF.line.class):a?t.select(rF.lineSecond.class):t.select(rF.line.class),!o||!s||"arc"===n.type&&vF(n.startAngle,n.endAngle)){var l=i.node();l&&(l.style.markerEnd=void 0)}else{var h=XI(s);h.attr(r),yj(h,u),i.style("markerEnd",h).style("markerEndOffset",-c)}}(t,i,e,o),r}function SF(t){var e=t.type,n=t.gridCenter;return"linear"===e?n:n||t.center}function NF(t,e){var n=e.gridLength;return t.map((function(t,r){var i=t.value,o=l(gF(i,e),2),a=o[0],s=o[1],c=l(ij(function(t,e){return fF(t,e.gridDirection,e)}(i,e),n),2);return{id:r,points:[[a,s],[a+c[0],s+c[1]]]}}))}function kF(t,e,n,r){var o=kj(n,"grid"),a=o.type,s=o.areaFill,c=SF(n),u=lF(e,n.gridFilter),h="segment"===a?NF(u,n):function(t,e){var n=e.gridControlAngles,r=SF(e);if(!r)throw new Error("grid center is not provide");if(t.length<2)throw new Error("Invalid grid data");if(!n||0===n.length)throw new Error("Invalid gridControlAngles");var i=l(r,2),o=i[0],a=i[1];return t.map((function(t,r){var i=l(gF(t.value,e),2),s=i[0],c=i[1],u=l([s-o,c-a],2),h=u[0],d=u[1],f=[];return n.forEach((function(t){var e=LI(t),n=l([Math.cos(e),Math.sin(e)],2),r=n[0],i=n[1],s=h*r-d*i+o,c=h*i+d*r+a;f.push([s,c])})),{points:f,id:r}}))}(u,n),d=i(i({},o),{center:c,areaFill:Rt(s)?u.map((function(t,e){return BI(s,[t,e,u])})):s,animate:r,data:h});return t.selectAll(rF.grid.class).data([1]).join((function(t){return t.append((function(){return new cF({style:d})})).attr("className",rF.grid.name)}),(function(t){return t.transition((function(){return this.update(d)}))}),(function(t){return t.remove()})).transitions()}var CF=function(){function t(t,e,n,r){this.set(t,e,n,r)}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),t.prototype.rotatedPoints=function(t,e,n){var r=this,i=r.x1,o=r.y1,a=r.x2,s=r.y2,c=Math.cos(t),u=Math.sin(t),l=e-e*c+n*u,h=n-e*u-n*c;return[[c*i-u*s+l,u*i+c*s+h],[c*a-u*s+l,u*a+c*s+h],[c*i-u*o+l,u*i+c*o+h],[c*a-u*o+l,u*a+c*o+h]]},t.prototype.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},t.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},t}();function TF(t,e){var n=t.getEulerAngles()||0;t.setEulerAngles(0);var r=t.getBounds(),i=l(r.min,2),o=i[0],a=i[1],s=l(r.max,2),c=s[0],u=s[1],h=t.getBBox(),d=h.width,f=h.height,p=0,g=0,m=o,y=a,v=UI(t);if(v){f-=1.5;var b=v.style.textAlign,x=v.style.textBaseline;"center"===b?m=(o+c)/2:"right"!==b&&"end"!==b||(m=c),"middle"===x?y=(a+u)/2:"bottom"===x&&(y=u)}var w=l(xj(e),4),E=w[0],M=void 0===E?0:E,S=w[1],N=void 0===S?0:S,k=w[2],C=void 0===k?M:k,T=w[3],A=new CF((p+=o)-(void 0===T?N:T),(g+=a)-M,p+d+N,g+f+C);return t.setEulerAngles(n),A.rotatedPoints(LI(n),m,y)}function AF(t,e){return e[0]<=Math.max(t[0][0],t[1][0])&&e[0]<=Math.min(t[0][0],t[1][0])&&e[1]<=Math.max(t[0][1],t[1][1])&&e[1]<=Math.min(t[0][1],t[1][1])}function PF(t,e,n){var r=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return 0===r?0:r<0?2:1}function OF(t,e){return e.every((function(e){return function(t,e){var n=t.length;if(n<3)return!1;var r,i,o,a,s,c,u=[e,[9999,e[1]]],l=0,h=0;do{var d=[t[h],t[(h+1)%n]];if(i=u,o=void 0,a=void 0,s=void 0,c=void 0,o=PF((r=d)[0],r[1],i[0]),a=PF(r[0],r[1],i[1]),s=PF(i[0],i[1],r[0]),c=PF(i[0],i[1],r[1]),o!==a&&s!==c||0===o&&AF(r,i[0])||0===a&&AF(r,i[1])||0===s&&AF(i,r[0])||0===c&&AF(i,r[1])){if(0===PF(d[0],e,d[1]))return AF(d,e);l++}h=(h+1)%n}while(0!==h);return!!(1&l)}(t,e)}))}function RF(t,e){return[[t[0],t[1],t[2],t[3]],[t[2],t[3],t[4],t[5]],[t[4],t[5],t[6],t[7]],[t[6],t[7],t[0],t[1]]].some((function(t){return function(t,e){var n=l(t,4),r=n[0],i=n[1],o=n[2],a=n[3],s=l(e,4),c=s[0],u=s[1],h=o-r,d=a-i,f=s[2]-c,p=s[3]-u,g=h*p-f*d;if(0===g)return!1;var m=g>0,y=r-c,v=i-u,b=h*v-d*y;if(b<0===m)return!1;var x=f*v-p*y;return x<0!==m&&b>g!==m&&x>g!==m}(e,t)}))}function _F(t,e,n){var r,i,o=e.crossPadding,a=new Set,s=null,c=function(t,e){var n=t.type,r=t.labelDirection,i=t.crossSize;if(!i)return!1;if("arc"===n){var o=t.center,a=t.radius,s=l(o,2),c=s[0],u=s[1],h="negative"===r?0:i,d=-a-h,f=a+h,p=l(xj(e),4),g=p[0],m=p[1],y=p[2],v=p[3];return new CF(c+d-v,u+d-g,c+f+m,u+f+y)}var b=l(t.startPos,2),x=b[0],w=b[1],E=l(t.endPos,2),M=E[0],S=E[1],N=l(yF(t)?[-e,0,e,0]:[0,e,0,-e],4),k=N[0],C=N[1],T=N[2],A=N[3],P=ij(pF(0,t),i),O=new CF(x,w,M,S);return O.x1+=A,O.y1+=k,O.x2+=C+P[0],O.y2+=T+P[1],O}(e,o),h=function(t){return!c||function(t,e,n){var r=t.x1,i=t.x2,o=t.y1,a=t.y2;return OF([[r,o],[i,o],[i,a],[r,a]],TF(e,n))}(c,t)},d=function(t,e){return!t||!t.firstChild||!function(t,e,n){var r,i,o=TF(t,n).flat(1),a=TF(e,n).flat(1),s=[[o[0],o[1],o[2],o[3]],[o[0],o[1],o[4],o[5]],[o[4],o[5],o[6],o[7]],[o[2],o[3],o[6],o[7]]];try{for(var c=u(s),l=c.next();!l.done;l=c.next())if(RF(a,l.value))return!0}catch(t){r={error:t}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return!1}(t.firstChild,e.firstChild,xj(n))};try{for(var f=u(t),p=f.next();!p.done;p=f.next()){var g=p.value;h(g)?!s||d(s,g)?s=g:(a.add(s),a.add(g)):a.add(g)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}return Array.from(a)}function DF(t,e){return void 0===e&&(e={}),_t(t)?0:"number"==typeof t?t:Math.floor(HI(t,e))}var LF=function(t,e){var n=e.seq,r=void 0===n?2:n;return t.filter((function(t,e){return!(e%r)||(PI(t),!1)}))};var IF=new Map([["hide",function(t,e,n,r){var i=t.length,o=e.keepHeader,a=e.keepTail;if(!(i<=1||2===i&&o&&a)){var s,c,u,d=LF,f=function(t){return t.forEach(r.show),t},p=2,g=t.slice(),m=t.slice(),y=Math.min.apply(Math,h([1],l(t.map((function(t){return t.getBBox().width}))),!1));if("linear"===n.type&&(mF(n)||yF(n))){var v=wj(t[0]).left,b=wj(t[i-1]).right,x=Math.abs(b-v)||1;p=Math.max(Math.floor(i*y/x),p)}for(o&&(s=g.splice(0,1)[0]),a&&(c=g.splice(-1,1)[0],g.reverse()),f(g);p<t.length&&_F((u=c?h(h([c],l(m),!1),[s],!1):h([s],l(m),!1),u.filter(WI)),n,null==e?void 0:e.margin).length;){if(c&&!s&&p%2==0)g.splice(0,1).forEach(r.hide);else if(c&&s){g.splice(0,1).forEach(r.hide)}m=d(f(g),{seq:p}),p++}}}],["rotate",function(t,e,n,r){var i,o,a=e.optionalAngles,s=void 0===a?[0,45,90]:a,c=e.margin,l=e.recoverWhenFailed,h=void 0===l||l,d=t.map((function(t){return t.getLocalEulerAngles()})),f=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.rotate(t,+i)}))};try{for(var p=u(s),g=p.next();!g.done;g=p.next()){if(f(g.value),_F(t,n,c).length<1)return}}catch(t){i={error:t}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}h&&f(d)}],["ellipsis",function(t,e,n,r){if(!(t.length<=1)){var i=e.suffix,o=void 0===i?"...":i,a=e.minLength,s=e.maxLength,c=void 0===s?1/0:s,u=e.step,h=void 0===u?" ":u,d=e.margin,f=void 0===d?[0,0,0,0]:d,p=$I(r.getTextShape(t[0])),g=DF(h,p),m=a?DF(a,p):g,y=DF(c,p);(_t(y)||y===1/0)&&(y=Math.max.apply(null,t.map((function(t){return t.getBBox().width}))));var v=t.slice(),b=l(f,4);b[0],b[1],b[2],b[3];for(var x=function(e){if(v.forEach((function(t){r.ellipsis(r.getTextShape(t),e,o)})),(v=_F(t,n,f)).length<1)return{value:void 0}},w=y;w>m+g;w-=g){var E=x(w);if("object"==typeof E)return E.value}}}],["wrap",function(t,e,n,r){var i=e.wordWrapWidth,o=void 0===i?50:i,a=e.maxLines,s=void 0===a?3:a,c=e.recoverWhenFailed,u=void 0===c||c,d=e.margin,f=void 0===d?[0,0,0,0]:d,p=t.map((function(t){return t.attr("maxLines")||1})),g=Math.min.apply(Math,h([],l(p),!1)),m=function(t){var e=t.type,n=t.labelDirection;return"linear"===e&&mF(t)?"negative"===n?"bottom":"top":"middle"}(n),y=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.wrap(t,o,i,m)}))};if(!(g>s)){for(var v=g;v<=s;v++)if(y(v),_F(t,n,f).length<1)return;u&&y(p)}}]]);function jF(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t*function(t){return"positive"===t?-1:1}(e)}),1)}function BF(t){for(var e=t;e<0;)e+=360;return Math.round(e%360)}function FF(t,e){var n=l(t,2),r=n[0],i=n[1],o=l(e,2),a=o[0],s=o[1],c=l([r*a+i*s,r*s-i*a],2),u=c[0],h=c[1];return Math.atan2(h,u)}function zF(t,e,n){var r,i=n.labelAlign;if(null===(r=e.style.transform)||void 0===r?void 0:r.includes("rotate"))return e.getLocalEulerAngles();var o=pF(t.value,n),a=dF(t.value,n);return"horizontal"===i?0:function(t){var e=(t+360)%180;return QI(e,-90,90)||(e+=180),e}(II("perpendicular"===i?FF([1,0],o):FF([a[0]<0?-1:1,0],a)))}function GF(t,e,n){var r=n.type,i=n.labelAlign,o=pF(t,n),a=BF(e),s=BF(II(FF([1,0],o))),c="center",u="middle";return"linear"===r?[90,270].includes(s)&&0===a?(c="center",u=1===o[1]?"top":"bottom"):s%180||![90,270].includes(a)?0===s?(QI(a,0,90,!1,!0)||QI(a,0,90)||QI(a,270,360))&&(c="start"):90===s?QI(a,0,90,!1,!0)?c="start":(QI(a,90,180)||QI(a,270,360))&&(c="end"):270===s?QI(a,0,90,!1,!0)?c="end":(QI(a,90,180)||QI(a,270,360))&&(c="start"):180===s&&(90===a?c="start":(QI(a,0,90)||QI(a,270,360))&&(c="end")):c="center":"parallel"===i?u=QI(s,0,180,!0)?"top":"bottom":"horizontal"===i?QI(s,90,270,!1)?c="end":(QI(s,270,360,!1)||QI(s,0,90))&&(c="start"):"perpendicular"===i&&(c=QI(s,90,270)?"end":"start"),{textAlign:c,textBaseline:u}}function VF(t,e,n){var r=n.showTick,i=n.tickLength,o=n.tickDirection,a=n.labelDirection,s=n.labelSpacing,c=e.indexOf(t),u=BI(s,[t,c,e]),h=l([pF(t.value,n),jF(a,o)],2),d=l(oj(ij(h[0],u+(1===h[1]?BI(r?i:0,[t,c,e]):0)),gF(t.value,n)),2);return{x:d[0],y:d[1]}}function WF(t,e){"text"===t.nodeName&&t.attr(e)}function HF(t){!function(t,e,n){var r=e.labelOverlap,i=void 0===r?[]:r;i.length&&i.forEach((function(r){var i=r.type,o=IF.get(i);(function(t,e,n){return!(e.labelOverlap.length<1)&&("hide"===n?!function(t){for(var e=t;e;){if("offscreen"===e.className)return!0;e=e.parent}return!1}(t[0]):"rotate"===n?!t.some((function(t){var e;return!!(null===(e=t.attr("transform"))||void 0===e?void 0:e.includes("rotate"))})):"ellipsis"!==n&&"wrap"!==n||t.filter((function(t){return t.querySelector("text")})).length>1)})(t,e,i)&&(null==o||o(t,r,e,n))}))}(this.node().childNodes,t,{hide:PI,show:AI,rotate:function(e,n){!function(t,e,n){e.setLocalEulerAngles(t);var r=GF(e.__data__.value,t,n),i=e.querySelector(rF.labelItem.class);i&&WF(i,r)}(+n,e,t)},ellipsis:function(t,e,n){t&&qI(t,e||1/0,n)},wrap:function(t,e,n){var r,i;t&&(void 0===(r=n)&&(r=2),void 0===i&&(i="top"),YI(t,{wordWrap:!0,wordWrapWidth:e,maxLines:r,textBaseline:i}))},getTextShape:function(t){return t.querySelector("text")}})}function $F(t,e,n,r,a){var s=n.indexOf(e),c=bj(t).append(function(t,e,n,r){var i=r.labelFormatter;return Rt(i)?function(){return XI(BI(i,[t,e,n,pF(t.value,r)]))}:function(){return XI(t.label||"")}}(e,s,n,a)).attr("className",rF.labelItem.name).node(),u=l(Tj(uF(r,[e,s,n])),2),h=u[0],d=u[1],f=d.transform,p=o(d,["transform"]);Pj(c,f);var g=zF(e,c,a);return c.getLocalEulerAngles()||c.setLocalEulerAngles(g),WF(c,i(i({},GF(e.value,g,a)),h)),t.attr(p),c}function UF(t,e,n,r){var o=lF(e,n.labelFilter),a=kj(n,"label");return t.selectAll(rF.label.class).data(o,(function(t,e){return e})).join((function(r){return r.append("g").attr("className",rF.label.name).transition((function(t){$F(this,t,e,a,n);var r=VF(t,e,n),i=r.x,o=r.y;return this.style.transform="translate(".concat(i,", ").concat(o,")"),null})).call((function(){HF.call(t,n)}))}),(function(o){return o.transition((function(t){var o=function(t,e,n,r){if(void 0===r&&(r="destroy"),function(t,e){return"text"===t.nodeName&&"text"===e.nodeName&&t.attributes.text===e.attributes.text}(t,e))return t.remove(),[null];var o=function(){"destroy"===r?t.destroy():"hide"===r&&PI(t),e.isVisible()&&AI(e)};if(!n)return o(),[null];var a=n.duration,s=void 0===a?0:a,c=n.delay,u=void 0===c?0:c,h=Math.ceil(+s/2),d=+s/4,f=l(t.getGeometryBounds().center,2),p=f[0],g=f[1],m=l(e.getGeometryBounds().center,2),y=l([(p+m[0])/2-p,(g+m[1])/2-g],2),v=y[0],b=y[1],x=t.style.opacity,w=void 0===x?1:x,E=e.style.opacity,M=void 0===E?1:E,S=t.style.transform||"",N=e.style.transform||"",k=t.animate([{opacity:w,transform:"translate(0, 0) ".concat(S)},{opacity:0,transform:"translate(".concat(v,", ").concat(b,") ").concat(S)}],i(i({fill:"both"},n),{duration:u+h+d})),C=e.animate([{opacity:0,transform:"translate(".concat(-v,", ").concat(-b,") ").concat(N),offset:.01},{opacity:M,transform:"translate(0, 0) ".concat(N)}],i(i({fill:"both"},n),{duration:h+d,delay:u+h-d}));return WB(C,o),[k,C]}(this.querySelector(rF.labelItem.class),$F(this,t,e,a,n),r.update),s=VF(t,e,n),c=s.x,u=s.y,d=UB(this,{transform:"translate(".concat(c,", ").concat(u,")")},r.update);return h(h([],l(o),!1),[d],!1)})).call((function(e){var r,i,o=pe(e,"_transitions").flat().filter(WI);i=function(){HF.call(t,n)},0===(r=o).length?i():Promise.all(r.map((function(t){return null==t?void 0:t.finished}))).then(i)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this.childNodes[0],r.exit);return WB(e,(function(){return bj(t).remove()})),e}))})).transitions()}function YF(t,e){return fF(t,e.tickDirection,e)}function qF(t,e,n,r,i){var o=l(function(t,e){var n=l(t,2);return[[0,0],[n[0]*e,n[1]*e]]}(r,BI(i.tickLength,[t,e,n])),2),a=l(o[0],2),s=a[0],c=a[1],u=l(o[1],2);return{x1:s,x2:u[0],y1:c,y2:u[1]}}function KF(t,e,n,r,o,a){var s=function(t,e,n,r,i){var o=i.tickFormatter,a=YF(e.value,i),s="line";return Rt(o)&&(s=function(){return BI(o,[e,n,r,a])}),t.append(s).attr("className",rF.tickItem.name)}(bj(this),t,e,n,r);!function(t,e,n,r,o,a,s){var c=YF(t.value,a),u=qF(t,e,n,c,a),h=u.x1,d=u.x2,f=u.y1,p=u.y2,g=l(Tj(uF(s,[t,e,n,c])),2),m=g[0],y=g[1];"line"===r.node().nodeName&&r.styles(i({x1:h,x2:d,y1:f,y2:p},m)),o.attr(y),r.styles(m)}(t,e,n,s,this,r,o);var c=l(gF(t.value,r),2),u=c[0],h=c[1];return UB(this,{transform:"translate(".concat(u,", ").concat(h,")")},a)}var XF=zI({text:"text"},"title");function ZF(t){return/\S+-\S+/g.test(t)?t.split("-").map((function(t){return t[0]})):t.length>2?[t[0]]:t.split("")}function QF(t,e){var n=Object.entries(e).reduce((function(e,n){var r=l(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e}),{});t.styles(n)}var JF=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return r(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,a=this.querySelector(XF.text.class);if(!a)return new jI(0,0,+e,+n);var s=a.getBBox(),c=s.width,u=s.height,h=l(xj(i),4),d=h[0],f=h[1],p=h[2],g=h[3],m=l([0,0,+e,+n],4),y=m[0],v=m[1],b=m[2],x=m[3],w=ZF(r);if(w.includes("i"))return new jI(y,v,b,x);w.forEach((function(t,r){var i,o,a,s;"t"===t&&(i=l(0===r?[u+p,+n-u-p]:[0,+n],2),v=i[0],x=i[1]),"r"===t&&(o=l([+e-c-g],1),b=o[0]),"b"===t&&(a=l([+n-u-d],1),x=a[0]),"l"===t&&(s=l(0===r?[c+f,+e-c-f]:[0,+e],2),y=s[0],b=s[1])}));var E=l(xj(o),4),M=E[0],S=E[1],N=E[2],k=E[3],C=l([k+S,M+N],2),T=C[0],A=C[1];return new jI(y+k,v+M,b-T,x-A)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new jI(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=o(t,["width","height","position","spacing"]),i=l(Tj(r),1)[0],a=function(t){var e,n,r,i,o=t,a=o.width,s=o.height,c=o.position,u=l([+a/2,+s/2],2),h=l([+u[0],+u[1],"center","middle"],4),d=h[0],f=h[1],p=h[2],g=h[3],m=ZF(c);return m.includes("l")&&(d=(e=l([0,"start"],2))[0],p=e[1]),m.includes("r")&&(d=(n=l([+a,"end"],2))[0],p=n[1]),m.includes("t")&&(f=(r=l([0,"top"],2))[0],g=r[1]),m.includes("b")&&(f=(i=l([+s,"bottom"],2))[0],g=i[1]),{x:d,y:f,textAlign:p,textBaseline:g}}(t),s=a.x,c=a.y,u=a.textAlign,h=a.textBaseline;ZI(!!r.text,bj(e),(function(t){n.title=t.maybeAppendByClassName(XF.text,"text").styles(i).call(QF,{x:s,y:c,textAlign:u,textBaseline:h}).node()}))},e}(Rj);function tz(t,e,n,r,a){var s=l(Tj(kj(r,"title")),2),c=s[0],u=s[1],h=u.transform,d=u.transformOrigin,f=o(u,["transform","transformOrigin"]);e.styles(f);var p=h||function(t,e,n){var r=2*t.getGeometryBounds().halfExtents[1];if("vertical"===e){if("left"===n)return"rotate(-90) translate(0, ".concat(r/2,")");if("right"===n)return"rotate(-90) translate(0, -".concat(r/2,")")}return""}(t.node(),c.direction,c.position);t.styles(i(i({},c),{transformOrigin:d})),Pj(t.node(),p);var g=function(t,e,n){var r=n.titlePosition,i=void 0===r?"lb":r,o=n.titleSpacing,a=ZF(i),s=t.node().getLocalBounds(),c=l(s.min,2),u=c[0],h=c[1],d=l(s.halfExtents,2),f=d[0],p=d[1],g=l(e.node().getLocalBounds().halfExtents,2),m=g[0],y=g[1],v=l([u+f,h+p],2),b=v[0],x=v[1],w=l(xj(o),4),E=w[0],M=w[1],S=w[2],N=w[3];if(["start","end"].includes(i)&&"linear"===n.type){var k=n.startPos,C=n.endPos,T=l("start"===i?[k,C]:[C,k],2),A=T[0],P=T[1],O=l(ij(lj([-P[0]+A[0],-P[1]+A[1]]),E),2),R=O[0],_=O[1];return{x:A[0]+R,y:A[1]+_}}return a.includes("t")&&(x-=p+y+E),a.includes("r")&&(b+=f+m+M),a.includes("l")&&(b-=f+m+N),a.includes("b")&&(x+=p+y+S),{x:b,y:x}}(bj(n._offscreen||n.querySelector(rF.mainGroup.class)),e,r),m=g.x,y=g.y;return UB(e.node(),{transform:"translate(".concat(m,", ").concat(y,")")},a)}function ez(t,e,n,r){var i=t.showLine,o=t.showTick,a=t.showLabel,s=ZI(i,e.maybeAppendByClassName(rF.lineGroup,"g"),(function(e){return MF(e,t,r)}))||[],c=ZI(o,e.maybeAppendByClassName(rF.tickGroup,"g"),(function(e){return function(t,e,n,r){var i=lF(e,n.tickFilter),o=kj(n,"tick");return t.selectAll(rF.tick.class).data(i,(function(t){return t.id||t.label})).join((function(t){return t.append("g").attr("className",rF.tick.name).transition((function(t,e){return KF.call(this,t,e,i,n,o,!1)}))}),(function(t){return t.transition((function(t,e){return this.removeChildren(),KF.call(this,t,e,i,n,o,r.update)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this.childNodes[0],r.exit);return WB(e,(function(){return t.remove()})),e}))})).transitions()}(e,n,t,r)}))||[],u=ZI(a,e.maybeAppendByClassName(rF.labelGroup,"g"),(function(e){return UF(e,n,t,r)}))||[];return h(h(h([],l(s),!1),l(c),!1),l(u),!1).filter((function(t){return!!t}))}var nz=function(t){function e(e){return t.call(this,e,nF)||this}return r(e,t),e.prototype.render=function(t,e,n){var r=this,i=t.titleText,o=t.data,a=t.animate,s=t.showTitle,c=t.showGrid,u=t.dataThreshold,d=t.truncRange,f=function(t,e){if(t.length<=e)return t;for(var n=Math.floor(t.length/e),r=[],i=0;i<t.length;i+=n)r.push(t[i]);return r}(o,u).filter((function(t){var e=t.value;return!(d&&e>d[0]&&e<d[1])})),p=VB(void 0===n?a:n),g=ZI(c,bj(e).maybeAppendByClassName(rF.gridGroup,"g"),(function(e){return kF(e,f,t,p)}))||[],m=bj(e).maybeAppendByClassName(rF.mainGroup,"g");i&&(!this.initialized&&p.enter||this.initialized&&p.update)&&ez(t,bj(this.offscreenGroup),f,VB(!1));var y=ez(t,bj(m.node()),f,p),v=ZI(s,bj(e).maybeAppendByClassName(rF.titleGroup,"g"),(function(e){return function(t,e,n,r){var i=n.titleText;return t.selectAll(rF.title.class).data([{title:i}].filter((function(t){return!!t.title})),(function(t,e){return t.title})).join((function(o){return o.append((function(){return XI(i)})).attr("className",rF.title.name).transition((function(){return tz(bj(this),t,e,n,r.enter)}))}),(function(i){return i.transition((function(){return tz(bj(this),t,e,n,r.update)}))}),(function(t){return t.remove()})).transitions()}(e,r,t,p)}))||[];return h(h(h([],l(g),!1),l(y),!1),l(v),!1).flat().filter((function(t){return!!t}))},e}(Rj),rz=zI({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),iz=function(t){function e(e){var n=t.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:Bj(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new Ys({class:rz.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Ys({class:rz.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return r(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return Ut(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=l(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map((function(e,n){return t.map((function(t){return t[n]}))})))||[]}(this.pageViews.map((function(t){var e=t.getBBox();return[e.width,e.height]}))).map((function(t){return Math.max.apply(Math,h([],l(t),!1))})),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,a=r.pageHeight;return{pageWidth:o,pageHeight:void 0===a?n:a}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,a=o.pageWidth,s=o.pageHeight;return new jI(n,r,a+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,a=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var c=l(this.getFollowingPageDiff(t),2),u=c[0],h=c[1];this.playState="running";var d=$B(a,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-u,", ").concat(-h,")")}],n);return WB(d,(function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()})),d},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:Ut(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:Ut(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(rz.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach((function(e,n){t.includes(n)?AI(e):PI(e)}))},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,a=i.controllerPadding,s=r.getBBox(),c=s.width;s.height;var u=l("horizontal"===o?[-180,0]:[-90,90],2),h=u[0],d=u[1];e.setLocalEulerAngles(h),n.setLocalEulerAngles(d);var f=e.getBBox(),p=f.width,g=f.height,m=n.getBBox(),y=m.width,v=m.height,b=Math.max(p,c,y),x="horizontal"===o?{offset:[[0,0],[p/2+a,0],[p+c+2*a,0]],textAlign:"start"}:{offset:[[b/2,-g-a],[b/2,0],[b/2,v+a]],textAlign:"center"},w=l(x.offset,3),E=l(w[0],2),M=E[0],S=E[1],N=l(w[1],2),k=N[0],C=N[1],T=l(w[2],2),A=T[0],P=T[1],O=x.textAlign,R=r.querySelector("text");R&&(R.style.textAlign=O),e.setLocalPosition(M,S),r.setLocalPosition(k,C),n.setLocalPosition(A,P)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(rz.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=t<e?-1:1;return"horizontal"===n?[a*i,0]:[0,a*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=l(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes.controllerSpacing,r=this.pageShape,a=r.pageWidth,s=r.pageHeight,c=this.pageViews.length>=2,u=t.maybeAppendByClassName(rz.controller,"g");if(OI(u.node(),c),c){var h=kj(this.attributes,"button"),d=kj(this.attributes,"pageNum"),f=l(Tj(h),2),p=f[0],g=f[1],m=p.size,y=o(p,["size"]),v=!u.select(rz.prevBtnGroup.class).node(),b=u.maybeAppendByClassName(rz.prevBtnGroup,"g").styles(g);this.prevBtnGroup=b.node();var x=b.maybeAppendByClassName(rz.prevBtn,"path"),w=u.maybeAppendByClassName(rz.nextBtnGroup,"g").styles(g);this.nextBtnGroup=w.node(),[x,w.maybeAppendByClassName(rz.nextBtn,"path")].forEach((function(t){t.styles(i(i({},y),{transformOrigin:"center"})),yj(t.node(),m)}));var E=u.maybeAppendByClassName(rz.pageInfoGroup,"g");this.pageInfoGroup=E.node(),E.maybeAppendByClassName(rz.pageInfo,"text").styles(d),this.updatePageInfo(),u.node().setLocalPosition(a+n,s/2),v&&(this.prevBtnGroup.addEventListener("click",(function(){e.prev()})),this.nextBtnGroup.addEventListener("click",(function(){e.next()})))}},e.prototype.render=function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i;this.attr("transform","translate(".concat(r,", ").concat(o,")"));var a=bj(e);this.renderClipPath(a),this.renderController(a),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=se((function(){return t.render(t.attributes,t)}),50);this.playWindow.addEventListener(hs.INSERTED,e),this.playWindow.addEventListener(hs.REMOVED,e)},e}(Rj);function oz(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}zj.registerSymbol("hiddenHandle",(function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]})),zj.registerSymbol("verticalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=t+.4*r;return[["M",t,e],["L",a,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",a,e-i],["Z"],["M",a,e+o],["L",t+r-2,e+o],["M",a,e-o],["L",t+r-2,e-o]]})),zj.registerSymbol("horizontalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=e+.4*r;return[["M",t,e],["L",t-i,a],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,a],["Z"],["M",t-o,a],["L",t-o,e+r-2],["M",t+o,a],["L",t+o,e+r-2]]}));var az=zI({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");var sz=function(t){function e(e){return t.call(this,e,{span:[1,1],marker:function(){return new Hs({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return r(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes.markerSize,r=t.node().getBBox(),i=r.width,o=r.height,a=e.node().getBBox(),s=a.width,c=a.height;return{markerWidth:n,labelWidth:i,valueWidth:s,height:Math.max(n,o,c)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=l(xj(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,a=i.height,s=this.actualSpace,c=s.labelWidth,u=s.valueWidth,h=l(this.spacing,2),d=h[0],f=h[1];if(r){var p=r-n-d-f,g=l(this.span,2);c=(t=l([g[0]*p,g[1]*p],2))[0],u=t[1]}return{width:o+c+u+d+f,height:a,markerWidth:o,labelWidth:c,valueWidth:u}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes.spacing;if(!t)return[0,0];var e=l(xj(t),2),n=e[0],r=e[1];return this.showValue?[n,r]:[n,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.width,o=t.height,a=l(this.spacing,2),s=a[0];return{height:o,width:i,markerWidth:e,labelWidth:n,valueWidth:r,position:[e/2,e+s,e+n+s+a[1]]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(az.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,a=void 0===o?t.lineWidth:o,s=e.markerStroke,c=void 0===s?t.stroke:s,u=+(i||a||(c?1:0))*Math.sqrt(2),l=this.markerGroup.node().getBBox(),h=l.width,d=l.height;return(1-u/Math.max(h,d))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes.marker,r=kj(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(az.markerGroup,"g").style("zIndex",0),ZI(!!n,this.markerGroup,(function(){var t,o=e.markerGroup.node(),a=null===(t=o.childNodes)||void 0===t?void 0:t[0],s="string"==typeof n?new zj({style:{symbol:n},className:az.marker.name}):n();a?s.nodeName===a.nodeName?a instanceof zj?a.update(i(i({},r),{symbol:n})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=u(Object.entries(i)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),c=s[0],h=s[1];"id"!==c&&"className"!==c&&t.attr(c,h)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(a,s),bj(a).styles(r)):(a.remove(),bj(s).attr("className",az.marker.name).styles(r),o.appendChild(s)):(s instanceof zj||bj(s).attr("className",az.marker.name).styles(r),o.appendChild(s)),e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]);var c=yj(e.markerGroup.node(),e.scaleSize);e.markerGroup.node().style._transform="scale(".concat(c,")")}))},e.prototype.renderLabel=function(t){var e=kj(this.attributes,"label"),n=e.text,r=o(e,["text"]);this.labelGroup=t.maybeAppendByClassName(az.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(az.label,(function(){return XI(n)})).styles(r)},e.prototype.renderValue=function(t){var e=this,n=kj(this.attributes,"value"),r=n.text,i=o(n,["text"]);this.valueGroup=t.maybeAppendByClassName(az.valueGroup,"g").style("zIndex",0),ZI(this.showValue,this.valueGroup,(function(){e.valueGroup.maybeAppendByClassName(az.value,(function(){return XI(r)})).styles(i)}))},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,o=kj(this.attributes,"background");this.background=t.maybeAppendByClassName(az.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(az.background,"rect").styles(i({width:n,height:r},o))},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=l(t.position,3),o=i[0],a=i[1],s=i[2],c=r/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(a,", ").concat(c,")")}),qI(this.labelGroup.select(az.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(s,", ").concat(c,")")}),qI(this.valueGroup.select(az.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=bj(e),r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o;n.styles({transform:"translate(".concat(i,", ").concat(a,")")}),this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.adjustLayout()},e}(Rj),cz=zI({page:"item-page",navigator:"navigator",item:"item"},"items"),uz=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},lz=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:xe,mouseenter:xe,mouseleave:xe})||this;return n.navigatorShape=[0,0],n}return r(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=kj(this.attributes,"item"),o=e.map((function(t,o){var a=t.id,s=void 0===a?o:a,c=t.label,u=t.value;return{id:"".concat(s),index:o,style:i({layout:n,labelText:c,valueText:u},Object.fromEntries(Object.entries(r).map((function(n){var r=l(n,2);return[r[0],BI(r[1],[t,o,e])]}))))}}));return o},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,a=l(this.navigatorShape,1)[0],s=l(this.grid,2),c=s[0],u=s[1],h=u*c,d=0;return this.pageViews.children.map((function(e,s){var f,p,g=Math.floor(s/h),m=s%h,y=t.ifHorizontal(u,c),v=[Math.floor(m/y),m%y];"vertical"===n&&v.reverse();var b=l(v,2),x=b[0],w=b[1],E=(r-a-(u-1)*o)/u,M=e.getBBox().height,S=l([0,0],2),N=S[0],k=S[1];return"horizontal"===n?(N=(f=l([d,x*(M+i)],2))[0],k=f[1],d=w===u-1?0:d+E+o):(N=(p=l([w*(E+o),d],2))[0],k=p[1],d=x===c-1?0:d+M+i),{page:g,index:s,row:x,col:w,pageIndex:m,width:E,height:M,x:N,y:k}}))},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=l(this.navigatorShape,1)[0],a=l(this.grid,2),s=a[0],c=a[1],u=l([e-o,n],2),h=u[0],d=u[1],f=l([0,0,0,0,0,0,0,0],8),p=f[0],g=f[1],m=f[2],y=f[3],v=f[4],b=f[5],x=f[6],w=f[7];return this.pageViews.children.map((function(t,e){var n,o,a,u,f=t.getBBox(),E=f.width,M=f.height,S=0===x?0:i,N=x+S+E;return N<=h&&uz(v,(function(t){return t<c}))?(n=l([x+S,w,N],3),p=n[0],g=n[1],x=n[2],{width:E,height:M,x:p,y:g,page:m,index:e,pageIndex:y++,row:b,col:v++}):(o=l([b+1,0,0,w+M+r],4),b=o[0],v=o[1],x=o[2],(w=o[3])+M<=d&&uz(b,(function(t){return t<s}))?(a=l([x,w,E],3),p=a[0],g=a[1],x=a[2],{width:E,height:M,x:p,y:g,page:m,index:e,pageIndex:y++,row:b,col:v++}):(u=l([0,0,E,0,m+1,0,0,0],8),p=u[0],g=u[1],x=u[2],w=u[3],m=u[4],y=u[5],b=u[6],v=u[7],{width:E,height:M,x:p,y:g,page:m,index:e,pageIndex:y++,row:b,col:v++}))}))},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return oz(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(cz.item.class).forEach((function(e){t.appendChild(e)})),t.querySelectorAll(cz.page.class).forEach((function(e){t.removeChild(e).destroy()}))},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave;this.flattenPage(t);var o=this.dispatchCustomEvent.bind(this);bj(t).selectAll(cz.item.class).data(this.renderData,(function(t){return t.id})).join((function(t){return t.append((function(t){var e=t.style;return new sz({style:e})})).attr("className",cz.item.name).on("click",(function(){null==n||n(this),o("itemClick",{item:this})})).on("pointerenter",(function(){null==r||r(this),o("itemMouseenter",{item:this})})).on("pointerleave",(function(){null==i||i(this),o("itemMouseleave",{item:this})}))}),(function(t){return t.each((function(t){var e=t.style;this.update(e)}))}),(function(t){return t.remove()}))},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=l(this.navigatorShape,2),a=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-a,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{}))).map((function(t){var e=l(t,2);return{page:e[0],layouts:e[1]}})),i=h([],l(this.navigator.getContainer().children),!1);r.forEach((function(t){var e=t.layouts,r=n.pageViews.appendChild(new Ys({className:cz.page.name}));e.forEach((function(t){var e=t.x,n=t.y,o=t.index,a=t.width,s=t.height,c=i[o];r.appendChild(c),ge(c,"__layout__",t),c.update({x:e,y:n,width:a,height:s})}))})),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes.orientation,n=kj(this.attributes,"nav"),r=VI({orientation:e},n),i=this;return t.selectAll(cz.navigator.class).data(["nav"]).join((function(t){return t.append((function(){return new iz({style:r})})).attr("className",cz.navigator.name).each((function(){i.navigator=this}))}),(function(t){return t.each((function(){this.update(r)}))}),(function(t){return t.remove()})),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator(bj(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new as(t,{detail:e});this.dispatchEvent(n)},e}(Rj),hz=zI({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),dz={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,dz)||this}r(e,t),e.prototype.render=function(t,e){var n=bj(e).maybeAppendByClassName(hz.markerGroup,"g");this.renderMarker(n);var r=bj(e).maybeAppendByClassName(hz.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,o=n.markerSymbol,a=void 0===o?oz(r,"horizontalHandle","verticalHandle"):o;ZI(!!a,t,(function(t){var n=kj(e.attributes,"marker"),r=i({symbol:a},n);e.marker=t.maybeAppendByClassName(hz.marker,(function(){return new zj({style:r})})).update(r)}))},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,a=n.orientation,s=n.spacing,c=void 0===s?0:s,u=n.formatter;ZI(r,t,(function(t){var n,r=kj(e.attributes,"label"),s=r.text,h=o(r,["text"]),d=(null===(n=t.select(hz.marker.class))||void 0===n?void 0:n.node().getBBox())||{},f=d.width,p=void 0===f?0:f,g=d.height,m=l(oz(a,[0,(void 0===g?0:g)+c,"center","top"],[p+c,0,"start","middle"]),4),y=m[0],v=m[1],b=m[2],x=m[3];t.maybeAppendByClassName(hz.label,"text").styles(i(i({},h),{x:y,y:v,text:u(s).toString(),textAlign:b,textBaseline:x}))}))}}(Rj);var fz={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},pz=VI({},fz,{});VI({},fz,Cj(dz,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var gz=zI({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),mz=function(t){function e(e){return t.call(this,e,pz)||this}return r(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,o=r.showTitle,a=r.titleText,s=l(Tj(kj(this.attributes,"title")),2),c=s[0],u=s[1];this.titleGroup=t.maybeAppendByClassName(gz.titleGroup,"g").styles(u);var h=i(i({width:e,height:n},c),{text:o?a:""});this.title=this.titleGroup.maybeAppendByClassName(gz.title,(function(){return new JF({style:h})})).update(h)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,o=e.width,a=e.height,s=l(Tj(kj(this.attributes,"title",!0)),2),c=s[0],u=s[1],h=i(i({},c),{width:o,height:a,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName(gz.itemsGroup,"g").styles(i(i({},u),{transform:"translate(".concat(n,", ").concat(r,")")}));var d=this;this.itemsGroup.selectAll(gz.items.class).data(["items"]).join((function(t){return t.append((function(){return new lz({style:h})})).attr("className",gz.items.name).each((function(){d.items=bj(this)}))}),(function(t){return t.update(h)}),(function(t){return t.remove()}))},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().style.transform="translate(".concat(e,", ").concat(n,")")}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new jI(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,a=n.text,s=t.getBBox(),c=e.getBBox(),u=ZF(r),h=l(xj(a?i:0),4),d=h[0],f=h[1],p=h[2],g=h[3],m=l(xj(o),4),y=m[0],v=m[1],b=m[2],x=m[3],w=l([g+f,d+p],2),E=w[0],M=w[1],S=l([x+v,y+b],2),N=S[0],k=S[1];if("l"===u[0])return new jI(s.x,s.y,c.width+s.width+E+N,Math.max(c.height+k,s.height));if("t"===u[0])return new jI(s.x,s.y,Math.max(c.width+N,s.width),c.height+s.height+M+k);var C=l([e.attributes.width||c.width,e.attributes.height||c.height],2),T=C[0],A=C[1];return new jI(c.x,c.y,T+s.width+E+N,A+s.height+M+k)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=this.attributes,r=n.width,i=n.height,o=n.x,a=void 0===o?0:o,s=n.y,c=void 0===s?0:s,u=bj(e);e.style.transform="translate(".concat(a,", ").concat(c,")"),this.renderTitle(u,r,i),this.renderItems(u,this.availableSpace),this.adjustLayout()},e}(Rj),yz={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(t){return t.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},vz=zI({background:"background",labelGroup:"label-group",label:"label"},"indicator"),bz=function(t){function e(e){var n=t.call(this,e,yz)||this;return n.point=[0,0],n.group=n.appendChild(new Ys({})),n.isMutationObserved=!0,n}return r(e,t),e.prototype.renderBackground=function(){if(this.label){var t=this.attributes,e=t.position,n=l(xj(t.padding),4),r=n[0],o=n[1],a=n[2],s=n[3],c=this.label.node().getLocalBounds(),u=c.min,h=c.max,d=new jI(u[0]-s,u[1]-r,h[0]+o-u[0]+s,h[1]+a-u[1]+r),f=this.getPath(e,d),p=kj(this.attributes,"background");this.background=bj(this.group).maybeAppendByClassName(vz.background,"path").styles(i(i({},p),{d:f})),this.group.appendChild(this.label.node())}},e.prototype.renderLabel=function(){var t=this.attributes,e=t.formatter,n=t.labelText,r=l(Tj(kj(this.attributes,"label")),2),i=r[0],a=r[1];i.text;var s=o(i,["text"]);(this.label=bj(this.group).maybeAppendByClassName(vz.labelGroup,"g").styles(a),n)&&this.label.maybeAppendByClassName(vz.label,(function(){return XI(e(n))})).style("text",e(n).toString()).selectAll("text").styles(s)},e.prototype.adjustLayout=function(){var t=l(this.point,2),e=t[0],n=t[1],r=this.attributes,i=r.x,o=r.y;this.group.attr("transform","translate(".concat(i-e,", ").concat(o-n,")"))},e.prototype.getPath=function(t,e){var n=this.attributes.radius,r=e.x,i=e.y,o=e.width,a=e.height,s=[["M",r+n,i],["L",r+o-n,i],["A",n,n,0,0,1,r+o,i+n],["L",r+o,i+a-n],["A",n,n,0,0,1,r+o-n,i+a],["L",r+n,i+a],["A",n,n,0,0,1,r,i+a-n],["L",r,i+n],["A",n,n,0,0,1,r+n,i],["Z"]],c={top:4,right:6,bottom:0,left:2}[t],u=this.createCorner([s[c].slice(-2),s[c+1].slice(-2)]);return s.splice.apply(s,h([c+1,1],l(u),!1)),s[0][0]="M",s},e.prototype.createCorner=function(t,e){void 0===e&&(e=10);var n=Ej.apply(void 0,h([],l(t),!1)),r=l(t,2),i=l(r[0],2),o=i[0],a=i[1],s=l(r[1],2),c=s[0],u=s[1],d=l(n?[c-o,[o,c]]:[u-a,[a,u]],2),f=d[0],p=l(d[1],2),g=p[0],m=p[1],y=f/2,v=e*(f/Math.abs(f)),b=v/2,x=v*Math.sqrt(3)/2*.8,w=l([g,g+y-b,g+y,g+y+b,m],5),E=w[0],M=w[1],S=w[2],N=w[3],k=w[4];return n?(this.point=[S,a-x],[["L",E,a],["L",M,a],["L",S,a-x],["L",N,a],["L",k,a]]):(this.point=[o+x,S],[["L",o,E],["L",o,M],["L",o+x,S],["L",o,N],["L",o,k]])},e.prototype.applyVisibility=function(){"hidden"===this.attributes.visibility?PI(this):AI(this)},e.prototype.bindEvents=function(){this.label.on(hs.BOUNDS_CHANGED,this.renderBackground)},e.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},e}(Rj);function xz(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var wz={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function Ez(t){var e;void 0===t&&(t="");var n=xz(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=i({flex:1},wz),e[".".concat(n.VALUE)]=i({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},wz),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var Mz=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,a=xz(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(a.CONTAINER,'"></div>'),title:'<div class="'.concat(a.TITLE,'"></div>'),item:'<li class="'.concat(a.LIST_ITEM,'" data-index={index}>\n <span class="').concat(a.NAME,'">\n <span class="').concat(a.MARKER,'" style="background:{color}"></span>\n <span class="').concat(a.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(a.VALUE,'" title="{value}">{value}</span>\n </li>')},style:Ez(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return r(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map((function(t,e){var r=t.name,a=void 0===r?"":r,s=t.color,c=void 0===s?"black":s,u=t.index,l=o(t,["name","color","index"]),h=i({name:a,color:c,index:null!=u?u:e},l);return an(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t}(n.item,h))}))},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=an(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:this.element.replaceChildren(t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,a=n.style,s=n.content,c=xz(r.prefixCls),u=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(u.innerHTML=r.title,u.getElementsByClassName(c.TITLE)[0].innerHTML=i):null===(e=null===(t=u.getElementsByClassName(c.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=c.LIST,f.replaceChildren.apply(f,h([],l(d),!1));var p=this.element.querySelector(".".concat(c.LIST));p?p.replaceWith(f):u.appendChild(f)}!function(t,e){Object.entries(e).forEach((function(e){var n=l(e,2),r=n[0],i=n[1];h([t],l(t.querySelectorAll(r)),!1).filter((function(t){return t.matches(r)})).forEach((function(t){t&&(t.style.cssText+=Object.entries(i).reduce((function(t,e){return"".concat(t).concat(e.join(":"),";")}),""))}))}))}(u,a)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},a=this.elementSize,s=a.width,c=a.height,u=[-s/2,-c/2];return i.forEach((function(t){var e=l(u,2),n=e[0],i=e[1],a=l(o[t],2),h=a[0],d=a[1];u=[n+(s/2+r[0])*h,i+(c/2+r[1])*d]})),u},e.prototype.setOffsetPosition=function(t){var e=l(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=void 0===o?0:o,s=i.y,c=void 0===s?0:s,u=i.container,h=u.x,d=u.y;this.element.style.left="".concat(+a+h+n,"px"),this.element.style.top="".concat(+c+d+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=l(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=i.y,s=i.bounding,c=i.position;if(!s)return[n,r];var u=this.element,h=u.offsetWidth,d=u.offsetHeight,f=l([+o+n,+a+r],2),p=f[0],g=f[1],m={left:"right",right:"left",top:"bottom",bottom:"top"},y=s.x,v=s.y,b={left:p<y,right:p+h>y+s.width,top:g<v,bottom:g+d>v+s.height},x=[];c.split("-").forEach((function(t){b[t]?x.push(m[t]):x.push(t)}));var w=x.join("-");return this.getRelativeOffsetFromCursor(w)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height;return new jI(r,i,o,a).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout((function(){e.element.style.transition=n}),10)},e.tag="tooltip",e}(Rj),Sz=function(t){function e(e){var n=t.call(this,e)||this;n.layoutEvents=[hs.BOUNDS_CHANGED,hs.INSERTED,hs.REMOVED],n.$margin=xj(0),n.$padding=xj(0);var r=e.style||{},i=r.margin,o=void 0===i?0:i,a=r.padding,s=void 0===a?0:a;return n.margin=o,n.padding=s,n.isMutationObserved=!0,n.bindEvents(),n}return r(e,t),Object.defineProperty(e.prototype,"margin",{get:function(){return this.$margin},set:function(t){this.$margin=xj(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return this.$padding},set:function(t){this.$padding=xj(t)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var t=this.attributes,e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.width,a=t.height,s=l(this.$margin,4),c=s[0],u=s[1],h=s[2],d=s[3];return new jI(n-d,i-c,o+d+u,a+c+h)},e.prototype.appendChild=function(e,n){return e.isMutationObserved=!0,t.prototype.appendChild.call(this,e,n),e},e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=l(this.$padding,4),i=r[0],o=r[1],a=r[2],s=r[3],c=l(this.$margin,4),u=c[0],h=c[3];return new jI(s+h,i+u,e-s-o,n-i-a)},e.prototype.layout=function(){if(this.attributes.display&&this.isConnected&&!this.children.some((function(t){return!t.isConnected})))try{var t=this.attributes,e=t.x,n=t.y;this.style.transform="translate(".concat(e,", ").concat(n,")");var r=function(t,e,n){if(0===e.length)return[];var r={flex:nj,grid:rj},i=n.display in r?r[n.display]:null;return(null==i?void 0:i.call(null,t,e,n))||[]}(this.getAvailableSpace(),this.children.map((function(t){return t.getBBox()})),this.attributes);this.children.forEach((function(t,e){var n=r[e],i=n.x,o=n.y;t.style.transform="translate(".concat(i,", ").concat(o,")")}))}catch(t){}},e.prototype.bindEvents=function(){var t=this;this.layoutEvents.forEach((function(e){t.addEventListener(e,(function(e){e.target.isMutationObserved=!0,t.layout()}))}))},e.prototype.attributeChangedCallback=function(t,e,n){"margin"===t?this.margin=n:"padding"===t&&(this.padding=n),this.layout()},e}(Ys),Nz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;return r.hoverColor="#f5f5f5",r.selectedColor="#e6f7ff",r.background=r.appendChild(new tc({})),r.label=r.background.appendChild(new Ys({})),r}return r(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(this.style.padding)},enumerable:!1,configurable:!0}),e.prototype.renderLabel=function(){var t=this.style,e=t.label,n=t.value,r=kj(this.attributes,"label");bj(this.label).maybeAppend(".label",(function(){return XI(e)})).attr("className","label").styles(r),this.label.attr("__data__",n)},e.prototype.renderBackground=function(){var t=this.label.getBBox(),e=l(this.padding,4),n=e[0],r=e[1],o=e[2],a=e[3],s=t.width,c=t.height,u=s+a+r,h=c+n+o,d=kj(this.attributes,"background"),f=this.style,p=f.width,g=void 0===p?0:p,m=f.height,y=void 0===m?0:m,v=f.selected;this.background.attr(i(i({},d),{width:Math.max(u,g),height:Math.max(h,y),fill:v?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(a,", ").concat((h-c)/2,")")})},e.prototype.render=function(){this.renderLabel(),this.renderBackground()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("pointerenter",(function(){t.style.selected||t.background.attr("fill",t.hoverColor)})),this.addEventListener("pointerleave",(function(){t.style.selected||t.background.attr("fill",t.style.backgroundFill)}));var e=this;this.addEventListener("click",(function(){var n=t.style,r=n.label,i=n.value,o=n.onClick;null==o||o(i,{label:r,value:i},e)}))},e.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},e}(Rj),kz=function(t){function e(n){var r,i,o=t.call(this,VI({},e.defaultOptions,n))||this;o.currentValue=null===(r=e.defaultOptions.style)||void 0===r?void 0:r.defaultValue,o.isPointerInSelect=!1,o.select=o.appendChild(new tc({className:"select",style:{cursor:"pointer",width:0,height:0}})),o.dropdown=o.appendChild(new tc({className:"dropdown"}));var a=o.style.defaultValue;return a&&(null===(i=o.style.options)||void 0===i?void 0:i.some((function(t){return t.value===a})))&&(o.currentValue=a),o}return r(e,t),e.prototype.setValue=function(t){this.currentValue=t,this.render()},e.prototype.getValue=function(){return this.currentValue},Object.defineProperty(e.prototype,"dropdownPadding",{get:function(){return xj(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),e.prototype.renderSelect=function(){var t,e=this,n=this.style,r=n.x,o=n.y,a=n.width,s=n.height,c=n.bordered,u=n.showDropdownIcon,l=kj(this.attributes,"select"),h=kj(this.attributes,"placeholder");this.select.attr(i(i({x:r,y:o,width:a,height:s},l),{fill:"#fff",strokeWidth:c?1:0}));var d=this.dropdownPadding;u&&bj(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(r+a-10-d[1]-d[3],", ").concat(o+s/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var f=null===(t=this.style.options)||void 0===t?void 0:t.find((function(t){return t.value===e.currentValue})),p=i({x:r+d[3]},h);bj(this.select).selectAll(".placeholder").data(f?[]:[1]).join((function(t){return t.append("text").attr("className","placeholder").styles(p).style("y",(function(){var t=this.getBBox();return o+(s-t.height)/2}))}),(function(t){return t.styles(p)}),(function(t){return t.remove()}));var g=kj(this.attributes,"optionLabel"),m=i({x:r+d[3]},g);bj(this.select).selectAll(".value").data(f?[f]:[]).join((function(t){return t.append((function(t){return XI(t.label)})).attr("className","value").styles(m).style("y",(function(){var t=this.getBBox();return o+(s-t.height)/2}))}),(function(t){return t.styles(m)}),(function(t){return t.remove()}))},e.prototype.renderDropdown=function(){var t,e,n=this,r=this.style,o=r.x,a=r.y,s=r.width,c=r.height,u=r.options,l=r.onSelect,h=r.open,d=kj(this.attributes,"dropdown"),f=kj(this.attributes,"option"),p=this.dropdownPadding;bj(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(u,(function(t){return t.value})).join((function(t){return t.append((function(t){return new Nz({className:"dropdown-item",style:i(i(i({},t),f),{width:s-p[1]-p[3],selected:t.value===n.currentValue,onClick:function(t,e,r){n.setValue(t),null==l||l(t,e,r),n.dispatchEvent(new as("change",{detail:{value:t,option:e,item:r}})),PI(n.dropdown)}})})})).each((function(t,e){var n,r=(null===(n=this.parentNode)||void 0===n?void 0:n.children).reduce((function(t,n,r){return r<e&&(t+=n.getBBox().height),t}),0);this.attr("transform","translate(".concat(p[3],", ").concat(p[0]+r,")"))}))}),(function(t){return t.update((function(t){return{selected:t.value===n.currentValue}}))}),(function(t){return t.remove()}));var g=null===(e=null===(t=this.dropdown.getElementsByClassName("dropdown-container"))||void 0===t?void 0:t[0])||void 0===e?void 0:e.getBBox(),m=d.spacing;this.dropdown.attr(i({transform:"translate(".concat(o,", ").concat(a+c+m,")"),width:g.width+p[1]+p[3],height:g.height+p[0]+p[2]},d)),!h&&PI(this.dropdown)},e.prototype.render=function(){this.renderSelect(),this.renderDropdown()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("click",(function(t){t.stopPropagation()})),this.select.addEventListener("click",(function(){"visible"===t.dropdown.style.visibility?PI(t.dropdown):AI(t.dropdown)})),this.addEventListener("pointerenter",(function(){t.isPointerInSelect=!0})),this.addEventListener("pointerleave",(function(){t.isPointerInSelect=!1})),null===document||void 0===document||document.addEventListener("click",(function(){t.isPointerInSelect||PI(t.dropdown)}))},e.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},e}(Rj),Cz=function(t){function e(n){var r=t.call(this,VI({},{style:{backgroundOpacity:e.backgroundOpacities.default}},e.defaultOptions,n))||this;return r.showBackground=!0,r.background=r.appendChild(new tc({})),r.icon=r.appendChild(new Ys({})),r}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"iconSize",{get:function(){var t=this.attributes.size,e=l(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3];return Math.max(t-Math.max(o+r,n+i),2*this.lineWidth+1)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.size,o=r/2,a=kj(this.attributes,"background");this.background.attr(i({x:e-o,y:n-o,width:r,height:r},a))},e.prototype.showIndicator=function(){if(this.label){var t=this.attributes.size,e=this.background.getBBox(),n=e.x,r=e.y;this.indicator.update({x:n+t/2,y:r-5,labelText:this.label,visibility:"visible"})}},e.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},e.prototype.connectedCallback=function(){var e;t.prototype.connectedCallback.call(this);var n=this.attributes.size,r=this.background.getBBox(),i=r.x,o=r.y,a=null===(e=this.ownerDocument)||void 0===e?void 0:e.defaultView;a&&(this.indicator=a.appendChild(new bz({style:{x:i+n/2,y:o-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},e.prototype.disconnectedCallback=function(){this.indicator.destroy()},e.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},e.prototype.bindEvents=function(){var t=this,n=this.attributes.onClick;if(this.addEventListener("click",(function(){null==n||n(t)})),this.showBackground){var r=function(){return t.background.attr({opacity:e.backgroundOpacities.default})};this.addEventListener("pointerenter",(function(){t.background.attr({opacity:e.backgroundOpacities.hover}),t.showIndicator()})),this.addEventListener("pointerleave",(function(){r(),t.hideIndicator()})),this.addEventListener("pointerdown",(function(){t.background.attr({opacity:e.backgroundOpacities.active})})),this.addEventListener("pointerup",(function(){r()}))}},e.tag="IconBase",e.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},e.backgroundOpacities={default:0,hover:.8,active:1},e}(Rj),Tz=function(t,e){return void 0===e&&(e="#565758"),new Zs({style:{fill:e,d:"M ".concat(t,",").concat(t," L -").concat(t,",0 L ").concat(t,",-").concat(t," Z"),transformOrigin:"center"}})},Az=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.arcPath=function(t,e,n){var r=l([n,n],2),i=r[0],o=r[1],a=function(r){return[t+n*Math.cos(r),e+n*Math.sin(r)]},s=l(a(-5/4*Math.PI),2),c=s[0],u=s[1],h=l(a(1/4*Math.PI),2),d=h[0],f=h[1];return"M".concat(c,",").concat(u,",A").concat(i,",").concat(o,",0,1,1,").concat(d,",").concat(f)},Object.defineProperty(e.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o+.5;bj(this.icon).maybeAppend(".reset","path").styles({stroke:r,lineWidth:o,d:this.arcPath(e,n,i/2-o),markerStart:Tz(a,r)})},e}(Cz),Pz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e-o,n],[e,n+a],[e,n],[e+o,n-a],[e+o,n+a],[e,n]];bj(this.icon).maybeAppend(".backward","polygon").styles({points:s,fill:r})},e}(Cz),Oz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e+o,n],[e,n+a],[e,n],[e-o,n-a],[e-o,n+a],[e,n]];bj(this.icon).maybeAppend(".forward","polygon").styles({points:s,fill:r})},e}(Cz),Rz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3*Math.pow(3,.5)*.8,a=[[e+o,n],[e-o/2,n-i/2*.8],[e-o/2,n+i/2*.8],[e+o,n]];bj(this.icon).maybeAppend(".play","polygon").styles({points:a,fill:r})},e}(Cz),_z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3,a=[[e-o,n-i/2],[e-o,n+i/2],[e-o/2,n+i/2],[e-o/2,n-i/2],[e-o,n-i/2],[e+o/2,n-i/2],[e+o/2,n+i/2],[e+o,n+i/2],[e+o,n-i/2]];bj(this.icon).maybeAppend(".pause","polygon").styles({points:a,fill:r})},e}(Cz),Dz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o;bj(this.icon).maybeAppend(".left-line","line").styles({x1:e-i/2,y1:n-i/2,x2:e-i/2,y2:n+i/2,stroke:r,lineWidth:o}),bj(this.icon).maybeAppend(".right-line","line").styles({x1:e+i/2,y1:n-i/2,x2:e+i/2,y2:n+i/2,stroke:r,lineWidth:o}),bj(this.icon).maybeAppend(".left-arrow","line").styles({x1:e,y1:n,x2:e-i/2+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)}),bj(this.icon).maybeAppend(".right-arrow","line").styles({x1:e,y1:n,x2:e+i/2-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)})},e}(Cz),Lz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;bj(this.icon).maybeAppend(".line","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o});var a=o;bj(this.icon).maybeAppend(".left-arrow","line").styles({x1:e-i/2-2*a,y1:n,x2:e-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)}),bj(this.icon).maybeAppend(".right-arrow","line").styles({x1:e+i/2+2*a,y1:n,x2:e+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)})},e}(Cz),Iz=function(t){return[[-t/2,-t/2],[-t/2,t/2],[t/2,t/2]]},jz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=(i-2*o-o)/4,s=(i-2*o-o)/2,c=l([e-i/2+o,n+i/2-2*o],2),u=c[0],h=c[1];bj(this.icon).maybeAppend(".coordinate","polyline").styles({points:Iz(i).map((function(t){var r=l(t,2),i=r[0],o=r[1];return[i+e,o+n]})),stroke:r,lineWidth:o}),bj(this.icon).maybeAppend(".line","polyline").styles({points:[[u,h],[u+a,h-s],[u+2*a,h],[u+4*a,h-2*s]],stroke:r,lineWidth:o})},e}(Cz),Bz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.data,e=this.attributes,n=e.x,r=e.y,i=e.color,o=this.iconSize,a=this.lineWidth,s=a,c=(o-s)/t.length,u=(o-2*s)/4,h=l([n-o/2+2*s,r+o/2-s],2),d=h[0],f=h[1];bj(this.icon).maybeAppend(".coordinate","polyline").styles({points:Iz(o).map((function(t){var e=l(t,2),i=e[0],o=e[1];return[i+n,o+r]})),stroke:i,lineWidth:a}),bj(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map((function(t,e){return{value:t,index:e}}))).join((function(t){return t.append("line").attr("className","column").style("x1",(function(t){var e=t.index;return d+c*e})).style("y1",f).style("x2",(function(t){var e=t.index;return d+c*e})).style("y2",(function(t){var e=t.value;return f-u*e})).styles({y1:f,stroke:i,lineWidth:a})}))},e}(Cz),Fz=function(t){function e(e){var n=t.call(this,VI({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return r(e,t),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;bj(this.icon).maybeAppend(".split","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o})},e}(Cz),zz=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.showBackground=!1,e}return r(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(0)},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.iconSize,e=this.attributes,n=e.x,r=e.y,o=e.speed,a=void 0===o?1:o,s=ve(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),c=Ut(t,20,1/0),u=i(i({},s),{x:n-c/2,y:r-10,width:c,height:20,defaultValue:a,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:t/5,placeholderFontSize:t/2,optionPadding:0,optionLabelFontSize:t/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});bj(this.icon).maybeAppend(".speed",(function(){return new kz({style:u})})).attr("className","speed").each((function(){this.update(u)}))},e.tag="SpeedSelect",e}(Cz),Gz=function(t){function e(e){var n=t.call(this,e)||this;return n.icon=n.appendChild(new Ys({})),n.currentType=n.attributes.type,n}return r(e,t),e.prototype.getType=function(){return this.currentType},e.prototype.render=function(){var t=this,e=this.attributes;e.onChange;var n=o(e,["onChange"]);bj(this.icon).selectAll(".icon").data([this.currentType]).join((function(e){return e.append((function(e){var n,r=null===(n=t.toggles.find((function(t){return l(t,1)[0]===e})))||void 0===n?void 0:n[1];if(!r)throw new Error("Invalid type: ".concat(e));return new r({})})).attr("className","icon").styles(n,!1).update({})}),(function(t){return t.styles({restStyles:n}).update({})}),(function(t){return t.remove()}))},e.prototype.bindEvents=function(){var t=this,e=this.attributes.onChange;this.addEventListener("click",(function(n){n.preventDefault(),n.stopPropagation();var r=(t.toggles.findIndex((function(e){return l(e,1)[0]===t.currentType}))+1)%t.toggles.length,i=t.toggles[r][0];null==e||e(t.currentType),t.currentType=i,t.render()}))},e.tag="ToggleIcon",e}(Rj),Vz=function(t){function e(e){var n=t.call(this,VI({},{style:{type:"play"}},e))||this;return n.toggles=[["play",Rz],["pause",_z]],n}return r(e,t),e}(Gz),Wz=function(t){function e(e){var n=t.call(this,VI({},{style:{type:"range"}},e))||this;return n.toggles=[["range",Dz],["value",Lz]],n}return r(e,t),e}(Gz),Hz=function(t){function e(e){var n=t.call(this,VI({},{style:{type:"column"}},e))||this;return n.toggles=[["line",jz],["column",Bz]],n}return r(e,t),e}(Gz),$z={reset:Az,speed:zz,backward:Pz,playPause:Vz,forward:Oz,selectionType:Wz,chartType:Hz,split:Fz},Uz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;return r.background=r.appendChild(new tc({})),r.functions=r.appendChild(new Ys({})),r}return r(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(this.attributes.padding)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.style,e=t.x,n=t.y,r=t.width,o=t.height,a=kj(this.attributes,"background");this.background.attr(i({x:e,y:n,width:r,height:o},a))},e.prototype.renderFunctions=function(){var t,e=this,n=this.attributes,r=n.functions,o=n.iconSize,a=n.iconSpacing,s=n.x,c=n.y,u=n.width,d=n.height,f=n.align,p=l(this.padding,4),g=p[1],m=p[3],y=r.reduce((function(t,e){return t.length&&e.length?t.concat.apply(t,h(["split"],l(e),!1)):t.concat.apply(t,h([],l(e),!1))}),[]),v=y.length*(o+a)-a,b={left:m+o/2,center:(u-v)/2+o/2,right:u-v-m-g+o/2}[f]||0;null===(t=this.speedSelect)||void 0===t||t.destroy(),this.functions.removeChildren(),y.forEach((function(t,n){var r,u=$z[t],l={x:s+n*(o+a)+b,y:c+d/2,size:o};if(u===zz?(l.speed=e.attributes.speed,l.onSelect=function(n){return e.handleFunctionChange(t,{value:n})}):[Vz,Wz,Hz].includes(u)?(l.onChange=function(n){return e.handleFunctionChange(t,{value:n})},u===Vz&&(l.type="play"===e.attributes.state?"pause":"play"),u===Wz&&(l.type="range"===e.attributes.selectionType?"value":"range"),u===Hz&&(l.type="line"===e.attributes.chartType?"column":"line")):l.onClick=function(){return e.handleFunctionChange(t,{value:t})},u===zz){var h=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView;h&&(e.speedSelect=new u({style:i(i({},l),{zIndex:100})}),h.appendChild(e.speedSelect))}else e.functions.appendChild(new u({style:l}))}))},e.prototype.disconnectedCallback=function(){var e;t.prototype.disconnectedCallback.call(this),null===(e=this.speedSelect)||void 0===e||e.destroy()},e.prototype.render=function(){this.renderBackground(),this.renderFunctions()},e.prototype.handleFunctionChange=function(t,e){var n=this.attributes.onChange;null==n||n(t,e)},e.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},e}(Rj),Yz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;return r.bindEvents(),r}return r(e,t),e.prototype.bindEvents=function(){var t=this;this.addEventListener("mouseenter",(function(){t.attr("lineWidth",Math.ceil(+(t.style.r||0)/2))})),this.addEventListener("mouseleave",(function(){t.attr("lineWidth",0)}))},e.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},e}(Hs),qz=function(t){function e(n){return t.call(this,VI({},e.defaultOptions,n))||this}return r(e,t),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,o=t.height,a=kj(this.attributes,"background");bj(this).maybeAppend("background","rect").attr("className","background").styles(i({x:e-r/2,y:n-o/2,width:r,height:o},a))},e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.iconSize,o=kj(this.attributes,"icon"),a=r/2;bj(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(i({x1:e-1,y1:n-a,x2:e-1,y2:n+a},o)),bj(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(i({x1:e+1,y1:n-a,x2:e+1,y2:n+a},o))},e.prototype.renderBorder=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,o=t.height,a=t.type,s=kj(this.attributes,"border"),c="start"===a?+r/2:-r/2;bj(this).maybeAppend("border","line").attr("className","border").styles(i({x1:c+e,y1:n-o/2,x2:c+e,y2:n+o/2},s))},e.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},e.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},e}(Rj);function Kz(t,e){return"number"==typeof t?Xz(t):function(t,e){var n=new Date(t);switch(e){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(n.getHours())&&0===n.getMinutes()?Aj(n,"HH:mm\nYYYY-MM-DD"):Aj(n,"HH:mm");case"half-day":return n.getHours()<12?"AM\n".concat(Aj(n,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(n.getDate())?Aj(n,"DD\nYYYY-MM"):Aj(n,"DD");case"week":return n.getDate()<=7?Aj(n,"DD\nYYYY-MM"):Aj(n,"DD");case"month":return[0,6].includes(n.getMonth())?Aj(n,"MM月\nYYYY"):Aj(n,"MM月");case"season":return[0].includes(n.getMonth())?Aj(n,"MM月\nYYYY"):Aj(n,"MM月");case"year":return Aj(n,"YYYY");default:return Aj(n,"YYYY-MM-DD HH:mm")}}(t,e)}function Xz(t){var e=String(Math.floor(t/3600)).padStart(2,"0"),n=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(Math.floor(t%60)).padStart(2,"0");return t<3600?"".concat(n,":").concat(r):"".concat(e,":").concat(n,":").concat(r)}var Zz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;r.axis=r.appendChild(new nz({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),r.timeline=r.appendChild(new eF({style:{onChange:function(t){r.handleSliderChange(t)}}})),r.controller=r.appendChild(new Uz({})),r.states={},r.handleSliderChange=function(t){var e,n=(e=r.states.values,Array.isArray(e)?h([],l(e),!1):e);r.setBySliderValues(t),r.dispatchOnChange(n)};var i=r.attributes,o=i.selectionType,a=i.chartType,s=i.speed,c=i.state,u=i.playMode,d=i.values;return r.states={chartType:a,playMode:u,selectionType:o,speed:s,state:c},r.setByTimebarValues(d),r}return r(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.data.sort((function(t,e){return t.time<e.time?-1:t.time>e.time?1:0}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"space",{get:function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=t.controllerHeight,s=Ut(+i-a,0,+i),c=new jI(e,n+ +i-a,+r,a),u=0,l="time"===o?10:s;return{axisBBox:"chart"===o?new jI(e,n+s-(u=35),+r,u):new jI,controllerBBox:c,timelineBBox:new jI(e,n+("time"===o?s:s-l),+r,l-u)}},enumerable:!1,configurable:!0}),e.prototype.setBySliderValues=function(t){var e,n,r=this.data,i=l(Array.isArray(t)?t:[0,t],2),o=i[0],a=i[1],s=r.length,c=r[Math.floor(o*s)],u=r[Math.ceil(a*s)-(Array.isArray(t)?0:1)];this.states.values=[null!==(e=null==c?void 0:c.time)&&void 0!==e?e:r[0].time,null!==(n=null==u?void 0:u.time)&&void 0!==n?n:1/0]},e.prototype.setByTimebarValues=function(t){var e,n,r,i=this.data,o=l(Array.isArray(t)?t:[void 0,t],2),a=o[0],s=o[1],c=i.find((function(t){return t.time===a})),u=i.find((function(t){return t.time===s}));this.states.values=[null!==(e=null==c?void 0:c.time)&&void 0!==e?e:null===(n=i[0])||void 0===n?void 0:n.time,null!==(r=null==u?void 0:u.time)&&void 0!==r?r:1/0]},e.prototype.setByIndex=function(t){var e,n,r,i,o=this.data,a=l(t,2),s=a[0],c=a[1];this.states.values=[null!==(n=null===(e=o[s])||void 0===e?void 0:e.time)&&void 0!==n?n:o[0].time,null!==(i=null===(r=this.data[c])||void 0===r?void 0:r.time)&&void 0!==i?i:1/0]},Object.defineProperty(e.prototype,"sliderValues",{get:function(){var t,e=this.states,n=e.values,r=e.selectionType,i=l(Array.isArray(n)?n:[void 0,n],2),o=i[0],a=i[1],s=this.data,c=s.length,u="value"===r;return[(t=s.findIndex((function(t){return t.time===o})),u?0:t>-1?t/c:0),function(){if(a===1/0)return 1;var t=s.findIndex((function(t){return t.time===a}));return t>-1?t/c:u?.5:1}()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){var t=this.states,e=t.values,n=t.selectionType,r=l(Array.isArray(e)?e:[this.data[0].time,e],2),i=r[0],o=r[1];return"value"===n?o:[i,o]},enumerable:!1,configurable:!0}),e.prototype.getDatumByRatio=function(t){var e=this.data,n=e.length;return e[Math.floor(t*(n-1))]},Object.defineProperty(e.prototype,"chartHandleIconShape",{get:function(){var t=this.states.selectionType,e=this.space.timelineBBox.height;return"range"===t?function(t){return new qz({style:{type:t,height:e,iconSize:e/6}})}:function(){return new Xs({style:{x1:0,y1:-e/2,x2:0,y2:e/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),e.prototype.getChartStyle=function(t){var e=this,n=t.x,r=t.y,a=t.width,s=t.height,c=this.states,u=c.selectionType,l=c.chartType,h=this.data,d=this.attributes,f=d.type,p=d.labelFormatter,g=kj(this.attributes,"chart");g.type;var m=o(g,["type"]),y="range"===u;if("time"===f)return i({handleIconShape:function(){return new Yz({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:y?-15:0,autoFitLabel:y,handleSpacing:y?-15:0,trackFill:"#edeeef",trackLength:a,trackOpacity:.5,trackRadius:s/2,trackSize:s/2,type:u,values:this.sliderValues,formatter:function(t){if(p)return p(t);var n=e.getDatumByRatio(t).time;return"number"==typeof n?Xz(n):Aj(n,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},m);var v="range"===u?5:0,b=h.map((function(t){return t.value}));return i({handleIconOffset:v,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:b,sparklineType:l,sparklineScale:.8,trackLength:a,trackSize:s,type:u,values:this.sliderValues,transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},m)},e.prototype.renderChart=function(t){void 0===t&&(t=this.space.timelineBBox),this.timeline.update(this.getChartStyle(t))},e.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},e.prototype.getAxisStyle=function(t){var e=this.data,n=this.attributes,r=n.interval,o=n.labelFormatter,a=kj(this.attributes,"axis"),s=t.x,c=t.y,u=t.width,d=h(h([],l(e),!1),[{time:0}],!1).map((function(t,e,n){var r=t.time;return{label:"".concat(r),value:e/(n.length-1),time:r}})),f=i({startPos:[s,c],endPos:[s+u,c],data:d,labelFilter:function(t,e){return e<d.length-1},labelFormatter:function(t){var e=t.time;return o?o(e):Kz(e,r)}},a);return f},e.prototype.renderAxis=function(t){void 0===t&&(t=this.space.axisBBox),"chart"===this.attributes.type&&this.axis.update(this.getAxisStyle(t))},e.prototype.renderController=function(t){void 0===t&&(t=this.space.controllerBBox);var e=this.attributes.type,n=this.states,r=n.state,o=n.speed,a=n.selectionType,s=n.chartType,c=kj(this.attributes,"controller"),u=this,l=i(i(i({},t),{iconSize:20,speed:o,state:r,selectionType:a,chartType:s,onChange:function(t,e){var n=e.value;switch(t){case"reset":u.internalReset();break;case"speed":u.handleSpeedChange(n);break;case"backward":u.internalBackward();break;case"playPause":"play"===n?u.internalPlay():u.internalPause();break;case"forward":u.internalForward();break;case"selectionType":u.handleSelectionTypeChange(n);break;case"chartType":u.handleChartTypeChange(n)}}}),c);"time"===e&&(l.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(l)},e.prototype.dispatchOnChange=function(t){var e=this.data,n=this.attributes.onChange,r=this.states,i=r.values,o=r.selectionType,a=l(i,2),s=a[0],c=a[1],u=c===1/0?e.at(-1).time:c;t&&function(t,e){if(Array.isArray(t)){if(!Array.isArray(e))return!1;if(t[0]===e[0]){if(t[1]===e[1])return!0;if(t[1]===1/0||e[1]===1/0)return!0}return!1}return!Array.isArray(e)&&t===e}(t,"range"===o?[s,u]:u)||null==n||n("range"===o?[s,u]:u)},e.prototype.internalReset=function(t){var e,n,r=this.states.selectionType;this.internalPause(),this.setBySliderValues("range"===r?[0,1]:[0,0]),this.renderController(),this.updateSelection(),t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onReset)||void 0===n||n.call(e),this.dispatchOnChange())},e.prototype.reset=function(){this.internalReset()},e.prototype.moveSelection=function(t,e){var n=this.data,r=n.length,i=this.states,o=i.values,a=i.selectionType,s=i.playMode,c=l(o,2),u=c[0],h=c[1],d=n.findIndex((function(t){return t.time===u})),f=n.findIndex((function(t){return t.time===h}));-1===f&&(f=r);var p,g="backward"===t?-1:1;"range"===a?"acc"===s?(p=[d,f+g],-1===g&&d===f&&(p=[d,r])):p=[d+g,f+g]:p=[d,f+g];var m=function(t){var e=l(t.sort((function(t,e){return t-e})),2),n=e[0],i=e[1],o=function(t){return Ut(t,0,r)};return i>r?"value"===a?[0,0]:"acc"===s?[o(n),o(n)]:[0,o(i-n)]:n<0?"acc"===s?[0,o(i)]:[o(n+r-i),r]:[o(n),o(i)]}(p);return this.setByIndex(m),this.updateSelection(),m},e.prototype.internalBackward=function(t){var e,n,r=this.moveSelection("backward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onBackward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.backward=function(){this.internalBackward()},e.prototype.internalPlay=function(t){var e,n,r=this,i=this.data,o=this.attributes.loop,a=this.states.speed,s=void 0===a?1:a;this.playInterval=window.setInterval((function(){r.internalForward()[1]!==i.length||o||(r.internalPause(),r.renderController())}),1e3/s),this.states.state="play",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPlay)||void 0===n||n.call(e))},e.prototype.play=function(){this.internalPlay()},e.prototype.internalPause=function(t){var e,n;clearInterval(this.playInterval),this.states.state="pause",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPause)||void 0===n||n.call(e))},e.prototype.pause=function(){this.internalPause()},e.prototype.internalForward=function(t){var e,n,r=this.moveSelection("forward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onForward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.forward=function(){this.internalForward()},e.prototype.handleSpeedChange=function(t){var e,n;this.states.speed=t,"play"===this.states.state&&(this.internalPause(!0),this.internalPlay(!0)),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSpeedChange)||void 0===n||n.call(e,t)},e.prototype.handleSelectionTypeChange=function(t){var e,n;this.states.selectionType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSelectionTypeChange)||void 0===n||n.call(e,t)},e.prototype.handleChartTypeChange=function(t){var e,n;this.states.chartType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onChartTypeChange)||void 0===n||n.call(e,t)},e.prototype.render=function(){var t=this.space,e=t.axisBBox,n=t.controllerBBox,r=t.timelineBBox;this.renderController(n),this.renderAxis(e),this.renderChart(r),"play"===this.states.state&&this.internalPlay()},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.internalPause(!0)},e.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},e}(Rj);class Qz extends iL{static defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16};typePrefix="__data__";element=null;draw=!1;fieldMap={node:new Map,edge:new Map,combo:new Map};selectedItems=[];constructor(t,e){super(t,Object.assign({},Qz.defaultOptions,e)),this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){this.element?.destroy(),this.element=null,this.draw=!1}bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)};changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=pe(t,[r,"id"]),o=pe(t,[r,"style","labelText"]),[a]=i.split("__"),s=this.fieldMap[a].get(o)||[];n.setElementState(Object.fromEntries(s?.map((t=>[t,e]))))};click=t=>{if("hover"===this.options.trigger)return;const e=pe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter((t=>t!==e)),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))};mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))};mouseenter=t=>{if("click"===this.options.trigger)return;const e=pe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter((t=>t!==e)):(this.selectedItems.push(e),this.changeState(t,"active"))};updateElement(){if(!this.element)return;this.element.getChildByIndex(0).update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])};getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click});getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r,graph:i}=this.context,{nodes:o,edges:a,combos:s}=n.getData(),c={},u=e=>Rt(t)?t(e):t,l={node:"circle",edge:"line",combo:"rect"},h={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},d=(t,e)=>{t.forEach((t=>{const{id:n}=t,i=pe(t,["data",u(t)]),o=r?.getElementType(e,t)||"circle",a=((t,e)=>{const n=r?.getElementComputedStyle(t,e);return n})(e,t),s=("edge"===e?a?.stroke:a?.fill)||"#1783ff";n&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),c[i]||(c[i]={id:`${e}__${n}`,label:i,marker:h[o]||l[e],elementType:e,lineWidth:1,stroke:s,fill:s}))}))};switch(e){case"node":d(o,"node");break;case"edge":d(a,"edge");break;case"combo":d(s,"combo");break;default:return[]}return Object.values(c)};layout=t=>{let{flexDirection:e,alignItems:n,justifyContent:r}={flexDirection:"row",alignItems:"flex-end",justifyContent:"center"};const i={top:["row","flex-start","center"],bottom:["row","flex-end","center"],left:["column","flex-start","center"],right:["column","flex-end","center"]};return t in i&&([e,n,r]=i[t]),{display:"flex",flexDirection:e,justifyContent:r,alignItems:n}};createElement=()=>{if(this.draw)return void this.updateElement();const{canvas:t}=this.context,[e,n]=t.getSize(),{width:r=e,height:i=n,nodeField:o,edgeField:a,comboField:s,trigger:c,position:u,...l}=this.options,h=this.getMarkerData(o,"node"),d=this.getMarkerData(a,"edge"),f=this.getMarkerData(s,"combo"),p=[...h,...f,...d],g=this.layout(u),m=new Sz({style:{width:r,height:i,...g}}),y=Object.assign({width:r,height:i,data:p,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:h.length},l,this.getEvents()),v=new mz({className:"legend",style:y});m.appendChild(v),t.appendChild(m),this.element=m,this.draw=!0};destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}function Jz(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,a=e.r;t.arc(r,o,a,0,2*Math.PI,!1)}function tG(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,a=e.rx,s=e.ry;if(t.ellipse)t.ellipse(r,o,a,s,0,0,2*Math.PI,!1);else{var c=a>s?a:s,u=a>s?1:a/s,l=a>s?s/a:1;t.save(),t.scale(u,l),t.arc(r,o,c,0,2*Math.PI)}}function eG(t,e){var n,r,i=e.x1,o=e.y1,a=e.x2,s=e.y2,c=e.markerStart,u=e.markerEnd,l=e.markerStartOffset,h=e.markerEndOffset,d=0,f=0,p=0,g=0,m=0;c&&Ls(c)&&l&&(n=a-i,r=s-o,m=Math.atan2(r,n),d=Math.cos(m)*(l||0),f=Math.sin(m)*(l||0)),u&&Ls(u)&&h&&(n=i-a,r=o-s,m=Math.atan2(r,n),p=Math.cos(m)*(h||0),g=Math.sin(m)*(h||0)),t.moveTo(i+d,o+f),t.lineTo(a+p,s+g)}function nG(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,c=e.d,u=c.absolutePath,h=c.segments,d=0,f=0,p=0,g=0,m=0;if(i&&Ls(i)&&a){var y=l(i.parentNode.getStartTangent(),2),v=y[0],b=y[1];n=v[0]-b[0],r=v[1]-b[1],m=Math.atan2(r,n),d=Math.cos(m)*(a||0),f=Math.sin(m)*(a||0)}if(o&&Ls(o)&&s){var x=l(o.parentNode.getEndTangent(),2);v=x[0],b=x[1];n=v[0]-b[0],r=v[1]-b[1],m=Math.atan2(r,n),p=Math.cos(m)*(s||0),g=Math.sin(m)*(s||0)}for(var w=0;w<u.length;w++){var E=u[w],M=E[0],S=u[w+1],N=0===w&&(0!==d||0!==f),k=(w===u.length-1||S&&("M"===S[0]||"Z"===S[0]))&&0!==p&&0!==g;switch(M){case"M":N?(t.moveTo(E[1]+d,E[2]+f),t.lineTo(E[1],E[2])):t.moveTo(E[1],E[2]);break;case"L":k?t.lineTo(E[1]+p,E[2]+g):t.lineTo(E[1],E[2]);break;case"Q":t.quadraticCurveTo(E[1],E[2],E[3],E[4]),k&&t.lineTo(E[3]+p,E[4]+g);break;case"C":t.bezierCurveTo(E[1],E[2],E[3],E[4],E[5],E[6]),k&&t.lineTo(E[5]+p,E[6]+g);break;case"A":var C=h[w].arcParams,T=C.cx,A=C.cy,P=C.rx,O=C.ry,R=C.startAngle,_=C.endAngle,D=C.xRotation,L=C.sweepFlag;if(t.ellipse)t.ellipse(T,A,P,O,D,R,_,!!(1-L));else{var I=P>O?P:O,j=P>O?1:P/O,B=P>O?O/P:1;t.translate(T,A),t.rotate(D),t.scale(j,B),t.arc(0,0,I,R,_,!!(1-L)),t.scale(1/j,1/B),t.rotate(-D),t.translate(-T,-A)}k&&t.lineTo(E[6]+p,E[7]+g);break;case"Z":t.closePath()}}}function rG(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,c=e.points.points,u=c.length,l=c[0][0],h=c[0][1],d=c[u-1][0],f=c[u-1][1],p=0,g=0,m=0,y=0,v=0;i&&Ls(i)&&a&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],v=Math.atan2(r,n),p=Math.cos(v)*(a||0),g=Math.sin(v)*(a||0)),o&&Ls(o)&&s&&(n=c[u-1][0]-c[0][0],r=c[u-1][1]-c[0][1],v=Math.atan2(r,n),m=Math.cos(v)*(s||0),y=Math.sin(v)*(s||0)),t.moveTo(l+(p||m),h+(g||y));for(var b=1;b<u-1;b++){var x=c[b];t.lineTo(x[0],x[1])}t.lineTo(d,f)}function iG(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,c=e.points.points,u=c.length,l=c[0][0],h=c[0][1],d=c[u-1][0],f=c[u-1][1],p=0,g=0,m=0,y=0,v=0;i&&Ls(i)&&a&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],v=Math.atan2(r,n),p=Math.cos(v)*(a||0),g=Math.sin(v)*(a||0)),o&&Ls(o)&&s&&(n=c[u-2][0]-c[u-1][0],r=c[u-2][1]-c[u-1][1],v=Math.atan2(r,n),m=Math.cos(v)*(s||0),y=Math.sin(v)*(s||0)),t.moveTo(l+p,h+g);for(var b=1;b<u-1;b++){var x=c[b];t.lineTo(x[0],x[1])}t.lineTo(d+m,f+y)}function oG(t,e){var n=e.x,r=void 0===n?0:n,i=e.y,o=void 0===i?0:i,a=e.radius,s=e.width,c=e.height,u=s,h=c;if(a&&a.some((function(t){return 0!==t}))){var d=s>0?1:-1,f=c>0?1:-1,p=d+f===0,g=l(a.map((function(t){return Ut(t,0,Math.min(Math.abs(u)/2,Math.abs(h)/2))})),4),m=g[0],y=g[1],v=g[2],b=g[3];t.moveTo(d*m+r,o),t.lineTo(u-d*y+r,o),0!==y&&t.arc(u-d*y+r,f*y+o,y,-f*Math.PI/2,d>0?0:Math.PI,p),t.lineTo(u+r,h-f*v+o),0!==v&&t.arc(u-d*v+r,h-f*v+o,v,d>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,p),t.lineTo(d*b+r,h+o),0!==b&&t.arc(d*b+r,h-f*b+o,b,f>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,p),t.lineTo(r,f*m+o),0!==m&&t.arc(d*m+r,f*m+o,m,d>0?Math.PI:0,f>0?1.5*Math.PI:Math.PI/2,p)}else t.rect(r,o,u,h)}var aG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="canvas-path-generator",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[ar.CIRCLE]=Jz,t[ar.ELLIPSE]=tG,t[ar.RECT]=oG,t[ar.LINE]=eG,t[ar.POLYLINE]=iG,t[ar.POLYGON]=rG,t[ar.PATH]=nG,t[ar.TEXT]=void 0,t[ar.GROUP]=void 0,t[ar.IMAGE]=void 0,t[ar.HTML]=void 0,t[ar.MESH]=void 0,t);this.context.pathGeneratorFactory=e},e.prototype.destroy=function(){delete this.context.pathGeneratorFactory},e}(ur),sG=nt(),cG=nt(),uG=nt(),lG=w(),hG=function(){function t(){var t=this;this.isHit=function(e,n,r,i){var o=t.context.pointInPathPickerFactory[e.nodeName];if(o){var a=C(lG,r),s=gt(cG,st(uG,n[0],n[1],0),a);if(o(e,new Lr(s[0],s[1]),i,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var r=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),i=t.context.pathGeneratorFactory[e.nodeName];return i&&(r.beginPath(),i(r,e.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(e,n){var r,i=this,o=e.renderingService,a=e.renderingContext;this.context=e,this.runtime=n;var u=null===(r=a.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,(function(t){return s(i,void 0,void 0,(function(){return c(this,(function(e){return[2,this.pick(u,t)]}))}))})),o.hooks.pickSync.tap(t.tag,(function(t){return i.pick(u,t)}))},t.prototype.pick=function(t,e){var n,r,i=e.topmost,o=e.position,a=o.x,s=o.y,c=st(sG,a,s,0),l=t.elementsFromBBox(c[0],c[1],c[0],c[1]),h=[];try{for(var d=u(l),f=d.next();!f.done;f=d.next()){var p=f.value,g=p.getWorldTransform();if(this.isHit(p,c,g,!1)){var m=ya(p);if(m){var y=m.parsedStyle.clipPath;if(this.isHit(y,c,y.getWorldTransform(),!0)){if(i)return e.picked=[p],e;h.push(p)}}else{if(i)return e.picked=[p],e;h.push(p)}}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return e.picked=h,e},t.tag="CanvasPicker",t}();function dG(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,a=r.cy,s=void 0===a?0:a,c=r.r,u=r.fill,h=r.stroke,d=r.lineWidth,f=void 0===d?1:d,p=r.increasedLineWidthForHitTesting,g=void 0===p?0:p,m=r.pointerEvents,y=void 0===m?"auto":m,v=(f+g)/2,b=zn(o,s,e.x,e.y),x=l(wa(y,u,h),2),w=x[0],E=x[1];return w&&E||n?b<=c+v:w?b<=c:!!E&&(b>=c-v&&b<=c+v)}function fG(t,e,n,r){return t/(n*n)+e/(r*r)}function pG(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,a=r.cy,s=void 0===a?0:a,c=r.rx,u=r.ry,h=r.fill,d=r.stroke,f=r.lineWidth,p=void 0===f?1:f,g=r.increasedLineWidthForHitTesting,m=void 0===g?0:g,y=r.pointerEvents,v=void 0===y?"auto":y,b=e.x,x=e.y,w=l(wa(v,h,d),2),E=w[0],M=w[1],S=(p+m)/2,N=(b-o)*(b-o),k=(x-s)*(x-s);return E&&M||n?fG(N,k,c+S,u+S)<=1:E?fG(N,k,c,u)<=1:!!M&&(fG(N,k,c-S,u-S)>=1&&fG(N,k,c+S,u+S)<=1)}function gG(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function mG(t,e,n,r,i,o,a,s){var c=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI),u={x:t+n*Math.cos(c),y:e+n*Math.sin(c)};return zn(u.x,u.y,a,s)<=o/2}function yG(t,e,n,r,i,o,a){var s=Math.min(t,n),c=Math.max(t,n),u=Math.min(e,r),l=Math.max(e,r),h=i/2;return o>=s-h&&o<=c+h&&a>=u-h&&a<=l+h&&Kn(t,e,n,r,o,a)<=i/2}function vG(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var a=0;a<o-1;a++){if(yG(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(i){var s=t[0],c=t[o-1];if(yG(s[0],s[1],c[0],c[1],e,n,r))return!0}return!1}var bG=1e-6;function xG(t){return Math.abs(t)<bG?0:t<0?-1:1}function wG(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function EG(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o<i;o++){var a=t[o],s=t[(o+1)%i];if(wG(a,s,[e,n]))return!0;xG(a[1]-n)>0!=xG(s[1]-n)>0&&xG(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}function MG(t,e,n){for(var r=!1,i=0;i<t.length;i++){if(r=EG(t[i],e,n))break}return r}function SG(t,e,n){var r=t.parsedStyle,i=r.x1,o=r.y1,a=r.x2,s=r.y2,c=r.lineWidth,u=void 0===c?1:c,h=r.increasedLineWidthForHitTesting,d=void 0===h?0:h,f=r.pointerEvents;return!(!l(wa(void 0===f?"auto":f,r.fill,r.stroke),2)[1]&&!n||!u)&&yG(i,o,a,s,u+d,e.x,e.y)}function NG(t,e,n,r,i,o){var a=t.parsedStyle,s=a.lineWidth,c=void 0===s?1:s,u=a.increasedLineWidthForHitTesting,h=void 0===u?0:u,d=a.stroke,f=a.fill,p=a.d,g=a.pointerEvents,m=void 0===g?"auto":g,y=p.segments,v=p.hasArc,b=p.polylines,x=p.polygons,w=l(wa(m,(null==x?void 0:x.length)&&f,d),2),E=w[0],M=w[1],S=co(t),N=!1;return E||n?N=v?r(t,e):MG(x,e.x,e.y)||MG(b,e.x,e.y):((M||n)&&(N=function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;s<t.length;s++){var c=t[s],u=c.currentPoint,l=c.params,h=c.prePoint,d=c.box;if(!d||gG(d.x-a,d.y-a,d.width+e,d.height+e,n,r))switch(c.command){case"L":case"Z":if(o=yG(h[0],h[1],u[0],u[1],e,n,r))return!0;break;case"Q":if(o=ir(h[0],h[1],l[1],l[2],l[3],l[4],n,r)<=e/2)return!0;break;case"C":if(o=Jn(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],n,r,i)<=e/2)return!0;break;case"A":c.cubicParams||(c.cubicParams=ze(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],l[7],void 0));for(var f=c.cubicParams,p=h,g=0;g<f.length;g+=6){var m=Jn(p[0],p[1],f[g],f[g+1],f[g+2],f[g+3],f[g+4],f[g+5],n,r,i);if(p=[f[g+4],f[g+5]],o=m<=e/2)return!0}}}return o}(y,c+h,e.x,e.y,S)),N)}function kG(t,e,n){var r=t.parsedStyle,i=r.stroke,o=r.fill,a=r.lineWidth,s=void 0===a?1:a,c=r.increasedLineWidthForHitTesting,u=void 0===c?0:c,h=r.points,d=r.pointerEvents,f=l(wa(void 0===d?"auto":d,o,i),2),p=f[0],g=!1;return(f[1]||n)&&(g=vG(h.points,s+u,e.x,e.y,!0)),g||!p&&!n||(g=EG(h.points,e.x,e.y)),g}function CG(t,e,n){var r=t.parsedStyle,i=r.lineWidth,o=void 0===i?1:i,a=r.increasedLineWidthForHitTesting,s=void 0===a?0:a,c=r.points,u=r.pointerEvents;return!(!l(wa(void 0===u?"auto":u,r.fill,r.stroke),2)[1]&&!n||!o)&&vG(c.points,o+s,e.x,e.y,!1)}function TG(t,e,n,r,i){var o=t.parsedStyle,a=o.radius,s=o.fill,c=o.stroke,u=o.lineWidth,h=void 0===u?1:u,d=o.increasedLineWidthForHitTesting,f=void 0===d?0:d,p=o.x,g=void 0===p?0:p,m=o.y,y=void 0===m?0:m,v=o.width,b=o.height,x=o.pointerEvents,w=l(wa(void 0===x?"auto":x,s,c),2),E=w[0],M=w[1],S=h+f;if(a&&a.some((function(t){return 0!==t}))){var N=!1;return(M||n)&&(N=function(t,e,n,r,i,o,a,s){var c=l(i,4),u=c[0],h=c[1],d=c[2],f=c[3];return yG(t+u,e,t+n-h,e,o,a,s)||yG(t+n,e+h,t+n,e+r-d,o,a,s)||yG(t+n-d,e+r,t+f,e+r,o,a,s)||yG(t,e+r-f,t,e+u,o,a,s)||mG(t+n-h,e+h,h,Math.PI,Math.PI,o,a,s)||mG(t+n-d,e+r-d,d,0,Math.PI,o,a,s)||mG(t+f,e+r-f,f,Math.PI,Math.PI,o,a,s)||mG(t+u,e+u,u,Math.PI,Math.PI,o,a,s)}(g,y,v,b,a.map((function(t){return Ut(t,0,Math.min(Math.abs(v)/2,Math.abs(b)/2))})),S,e.x,e.y)),N||!E&&!n||(N=r(t,e)),N}var k=S/2;return E&&M||n?gG(g-k,y-k,v+k,b+k,e.x,e.y):E?gG(g,y,v,b,e.x,e.y):!!M&&function(t,e,n,r,i,o,a){var s=i/2;return gG(t-s,e-s,n,i,o,a)||gG(t+n-s,e-s,i,r,o,a)||gG(t+s,e+r-s,n,i,o,a)||gG(t-s,e+s,i,r,o,a)}(g,y,v,b,S,e.x,e.y)}function AG(t,e,n,r,o,a){var s=t.parsedStyle,c=s.pointerEvents,u=void 0===c?"auto":c,l=s.x,h=void 0===l?0:l,d=s.y,f=void 0===d?0:d,p=s.width,g=s.height;if("non-transparent-pixel"===u){var m=o.config.offscreenCanvas,y=a.offscreenCanvasCreator.getOrCreateCanvas(m),v=a.offscreenCanvasCreator.getOrCreateContext(m,{willReadFrequently:!0});return y.width=p,y.height=g,o.defaultStyleRendererFactory[ar.IMAGE].render(v,i(i({},t.parsedStyle),{x:0,y:0}),t,void 0,void 0,void 0),v.getImageData(e.x-h,e.y-f,1,1).data.every((function(t){return 0!==t}))}return!0}var PG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="canvas-picker",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[ar.CIRCLE]=dG,t[ar.ELLIPSE]=pG,t[ar.RECT]=TG,t[ar.LINE]=SG,t[ar.POLYLINE]=CG,t[ar.POLYGON]=kG,t[ar.PATH]=NG,t[ar.TEXT]=function(){return!0},t[ar.GROUP]=null,t[ar.IMAGE]=AG,t[ar.HTML]=null,t[ar.MESH]=null,t);this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new hG)},e.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},e}(ur),OG=function(){function t(t){this.canvasRendererPluginOptions=t,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=w(),this.dprMatrix=w(),this.tmpMat4=w(),this.vec3a=nt(),this.vec3b=nt(),this.vec3c=nt(),this.vec3d=nt()}return t.prototype.apply=function(e,n){var r=this;this.context=e;var i=e.config,o=e.camera,a=e.renderingService,s=e.renderingContext,c=e.rBushRoot,u=e.pathGeneratorFactory;this.rBush=c,this.pathGeneratorFactory=u;var d=e.contextService,f=s.root.ownerDocument.defaultView,p=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)},g=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)};a.hooks.init.tap(t.tag,(function(){f.addEventListener(hs.UNMOUNTED,p),f.addEventListener(hs.CULLED,g);var t=d.getDPR(),e=i.width,n=i.height,o=d.getContext();r.clearRect(o,0,0,e*t,n*t,i.background)})),a.hooks.destroy.tap(t.tag,(function(){f.removeEventListener(hs.UNMOUNTED,p),f.removeEventListener(hs.CULLED,g),r.renderQueue=[],r.removedRBushNodeAABBs=[],r.restoreStack=[]})),a.hooks.beginFrame.tap(t.tag,(function(){var t,e=d.getContext(),n=d.getDPR(),o=i.width,s=i.height,c=r.canvasRendererPluginOptions,u=c.dirtyObjectNumThreshold,l=c.dirtyObjectRatioThreshold,h=a.getStats(),p=h.total,g=h.rendered,m=g/p;r.clearFullScreen=r.clearFullScreenLastFrame||!(null===(t=f.context.renderingPlugins[1])||void 0===t?void 0:t.isFirstTimeRenderingFinished)||a.disableDirtyRectangleRendering()||g>u&&m>l,e&&(e.resetTransform?e.resetTransform():e.setTransform(1,0,0,1,0,0),r.clearFullScreen&&r.clearRect(e,0,0,o*n,s*n,i.background))}));var m=function(t,e){t.isVisible()&&!t.isCulled()&&r.renderDisplayObject(t,e,r.context,r.restoreStack,n),(t.sortable.sorted||t.childNodes).forEach((function(t){m(t,e)}))};a.hooks.endFrame.tap(t.tag,(function(){if(0!==s.root.childNodes.length){r.clearFullScreenLastFrame=!1;var t=d.getContext(),e=d.getDPR();if(L(r.dprMatrix,[e,e,1]),A(r.vpMatrix,r.dprMatrix,o.getOrthoMatrix()),r.clearFullScreen)m(s.root,t);else{var a=r.safeMergeAABB.apply(r,h([r.mergeDirtyAABBs(r.renderQueue)],l(r.removedRBushNodeAABBs.map((function(t){var e=t.minX,n=t.minY,r=t.maxX,i=t.maxY,o=new Ar;return o.setMinMax([e,n,0],[r,i,0]),o}))),!1));if(r.removedRBushNodeAABBs=[],Ar.isEmpty(a))return void(r.renderQueue=[]);var c=r.convertAABB2Rect(a),u=c.x,p=c.y,g=c.width,y=c.height,v=gt(r.vec3a,[u,p,0],r.vpMatrix),b=gt(r.vec3b,[u+g,p,0],r.vpMatrix),x=gt(r.vec3c,[u,p+y,0],r.vpMatrix),w=gt(r.vec3d,[u+g,p+y,0],r.vpMatrix),E=Math.min(v[0],b[0],w[0],x[0]),M=Math.min(v[1],b[1],w[1],x[1]),S=Math.max(v[0],b[0],w[0],x[0]),N=Math.max(v[1],b[1],w[1],x[1]),k=Math.floor(E),C=Math.floor(M),T=Math.ceil(S-E),P=Math.ceil(N-M);t.save(),r.clearRect(t,k,C,T,P,i.background),t.beginPath(),t.rect(k,C,T,P),t.clip(),t.setTransform(r.vpMatrix[0],r.vpMatrix[1],r.vpMatrix[4],r.vpMatrix[5],r.vpMatrix[12],r.vpMatrix[13]),i.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new as(Is.DIRTY_RECTANGLE,{dirtyRect:{x:k,y:C,width:T,height:P}})),r.searchDirtyObjects(a).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t,r.context,r.restoreStack,n)})),t.restore(),r.renderQueue.forEach((function(t){r.saveDirtyAABB(t)})),r.renderQueue=[]}r.restoreStack.forEach((function(){t.restore()})),r.restoreStack=[]}else r.clearFullScreenLastFrame=!0})),a.hooks.render.tap(t.tag,(function(t){r.clearFullScreen||r.renderQueue.push(t)}))},t.prototype.clearRect=function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))},t.prototype.renderDisplayObject=function(t,e,n,r,i){var o=t.nodeName,a=r[r.length-1];!a||t.compareDocumentPosition(a)&cs.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.pop());var s=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],u=t.parsedStyle.clipPath;if(u){this.applyWorldTransform(e,u);var l=this.pathGeneratorFactory[u.nodeName];l&&(e.save(),r.push(t),e.beginPath(),l(e,u.parsedStyle),e.closePath(),e.clip())}s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),c&&(e.beginPath(),c(e,t.parsedStyle),t.nodeName!==ar.LINE&&t.nodeName!==ar.PATH&&t.nodeName!==ar.POLYLINE&&e.closePath()),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.renderable.dirty=!1},t.prototype.convertAABB2Rect=function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},t.prototype.mergeDirtyAABBs=function(t){var e=new Ar;return t.forEach((function(t){var n=t.getRenderBounds();e.add(n);var r=t.renderable.dirtyRenderBounds;r&&e.add(r)})),e},t.prototype.searchDirtyObjects=function(t){var e=l(t.getMin(),2),n=e[0],r=e[1],i=l(t.getMax(),2),o=i[0],a=i[1];return this.rBush.search({minX:n,minY:r,maxX:o,maxY:a}).map((function(t){return t.displayObject}))},t.prototype.saveDirtyAABB=function(t){var e=t.renderable;e.dirtyRenderBounds||(e.dirtyRenderBounds=new Ar);var n=t.getRenderBounds();n&&e.dirtyRenderBounds.update(n.center,n.halfExtents)},t.prototype.applyAttributesToContext=function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,a=n.lineDash,s=n.lineDashOffset;a&&t.setLineDash(a),_t(s)||(t.lineDashOffset=s),_t(o)||(t.globalAlpha*=o),_t(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),_t(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},t.prototype.applyWorldTransform=function(t,e,n){n?(M(this.tmpMat4,e.getLocalTransform()),A(this.tmpMat4,n,this.tmpMat4),A(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(M(this.tmpMat4,e.getWorldTransform()),A(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.prototype.safeMergeAABB=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=new Ar;return t.forEach((function(t){n.add(t)})),n},t.tag="CanvasRenderer",t}(),RG=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n,r,i,o){var a=e.fill,s=e.fillRule,c=e.opacity,u=void 0===c?1:c,l=e.fillOpacity,h=void 0===l?1:l,d=e.stroke,f=e.strokeOpacity,p=void 0===f?1:f,g=e.lineWidth,m=void 0===g?1:g,y=e.lineCap,v=e.lineJoin,b=e.shadowType,x=e.shadowColor,w=e.shadowBlur,E=e.filter,M=e.miterLimit,S=a&&!a.isNone,N=d&&!d.isNone&&m>0,k=0===(null==a?void 0:a.alpha),C=!(!E||!E.length),T=!_t(x)&&w>0,A=n.nodeName,P="inner"===b,O=N&&T&&(A===ar.PATH||A===ar.LINE||A===ar.POLYLINE||k||P);S&&(t.globalAlpha=u*h,O||_G(n,t,T),IG(t,n,a,s,r,i,o,this.imagePool),O||this.clearShadowAndFilter(t,C,T)),N&&(t.globalAlpha=u*p,t.lineWidth=m,_t(M)||(t.miterLimit=M),_t(y)||(t.lineCap=y),_t(v)||(t.lineJoin=v),O&&(P&&(t.globalCompositeOperation="source-atop"),_G(n,t,!0),P&&(jG(t,n,d,r,i,o,this.imagePool),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,C,!0))),jG(t,n,d,r,i,o,this.imagePool))},t.prototype.clearShadowAndFilter=function(t,e,n){if(n&&(t.shadowColor="transparent",t.shadowBlur=0),e){var r=t.filter;!_t(r)&&r.indexOf("drop-shadow")>-1&&(t.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},t}();function _G(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,a=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=c||0)}function DG(t,e,n,r,i,o,a){var s,c;if("rect"===t.image.nodeName){var u=t.image.parsedStyle,l=u.width,h=u.height;c=r.contextService.getDPR();var d=r.config.offscreenCanvas;(s=o.offscreenCanvasCreator.getOrCreateCanvas(d)).width=l*c,s.height=h*c;var f=o.offscreenCanvasCreator.getOrCreateContext(d),p=[];t.image.forEach((function(t){i.renderDisplayObject(t,f,r,p,o)})),p.forEach((function(){f.restore()}))}return a.getOrCreatePatternSync(t,n,s,c,e.getGeometryBounds().min,(function(){e.renderable.dirty=!0,r.renderingService.dirtify()}))}function LG(t,e,n,r){var o;if(t.type===Xr.LinearGradient||t.type===Xr.RadialGradient){var a=e.getGeometryBounds(),s=a&&2*a.halfExtents[0]||1,c=a&&2*a.halfExtents[1]||1,u=a&&a.min||[0,0];o=r.getOrCreateGradient(i(i({type:t.type},t.value),{min:u,width:s,height:c}),n)}return o}function IG(t,e,n,r,i,o,a,s,c){void 0===c&&(c=!1),Array.isArray(n)?n.forEach((function(n){t.fillStyle=LG(n,e,t,s),c||(r?t.fill(r):t.fill())})):(Bi(n)&&(t.fillStyle=DG(n,e,t,i,o,a,s)),c||(r?t.fill(r):t.fill()))}function jG(t,e,n,r,i,o,a,s){void 0===s&&(s=!1),Array.isArray(n)?n.forEach((function(n){t.strokeStyle=LG(n,e,t,a),s||t.stroke()})):(Bi(n)&&(t.strokeStyle=DG(n,e,t,r,i,o,a)),s||t.stroke())}var BG=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n){var r,i=e.x,o=void 0===i?0:i,a=e.y,s=void 0===a?0:a,c=e.width,u=e.height,l=e.src,h=e.shadowColor,d=e.shadowBlur,f=c,p=u;if(Wt(l)?r=this.imagePool.getImageSync(l):(f||(f=l.width),p||(p=l.height),r=l),r){_G(n,t,!_t(h)&&d>0);try{t.drawImage(r,o,s,f,p)}catch(t){}}},t}(),FG=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n,r,i,o){n.getBounds();var a=e,s=a.lineWidth,c=void 0===s?1:s,u=a.textAlign,l=void 0===u?"start":u,h=a.textBaseline,d=void 0===h?"alphabetic":h,f=a.lineJoin,p=void 0===f?"miter":f,g=a.miterLimit,m=void 0===g?10:g,y=a.letterSpacing,v=void 0===y?0:y,b=a.stroke,x=a.fill,w=a.fillRule,E=a.fillOpacity,M=void 0===E?1:E,S=a.strokeOpacity,N=void 0===S?1:S,k=a.opacity,C=void 0===k?1:k,T=a.metrics,A=a.x,P=void 0===A?0:A,O=a.y,R=void 0===O?0:O,_=a.dx,D=a.dy,L=a.shadowColor,I=a.shadowBlur,j=T.font,B=T.lines,F=T.height,z=T.lineHeight,G=T.lineMetrics;t.font=j,t.lineWidth=c,t.textAlign="middle"===l?"center":l;var V=d;o.enableCSSParsing||"alphabetic"!==V||(V="bottom"),t.lineJoin=p,_t(m)||(t.miterLimit=m);var W=R;"middle"===d?W+=-F/2-z/2:"bottom"===d||"alphabetic"===d||"ideographic"===d?W+=-F:"top"!==d&&"hanging"!==d||(W+=-z);var H=P+(_||0);W+=D||0,1===B.length&&("bottom"===V?(V="middle",W-=.5*F):"top"===V&&(V="middle",W+=.5*F)),t.textBaseline=V,_G(n,t,!_t(L)&&I>0);for(var $=0;$<B.length;$++){var U=c/2+H;W+=z,_t(b)||b.isNone||!c||this.drawLetterSpacing(t,n,B[$],G[$],l,U,W,v,x,w,M,b,N,C,!0,r,i,o),_t(x)||this.drawLetterSpacing(t,n,B[$],G[$],l,U,W,v,x,w,M,b,N,C,!1,r,i,o)}},t.prototype.drawLetterSpacing=function(t,e,n,r,i,o,a,s,c,u,l,h,d,f,p,g,m,y){if(0!==s){var v=t.textAlign;t.textAlign="left";var b=o;"center"===i||"middle"===i?b=o-r.width/2:"right"!==i&&"end"!==i||(b=o-r.width);for(var x=Array.from(n),w=t.measureText(n).width,E=0,M=0;M<x.length;++M){var S=x[M];p?this.strokeText(t,e,S,b,a,h,d,g,m,y):this.fillText(t,e,S,b,a,c,u,l,f,g,m,y),b+=w-(E=t.measureText(n.substring(M+1)).width)+s,w=E}t.textAlign=v}else p?this.strokeText(t,e,n,o,a,h,d,g,m,y):this.fillText(t,e,n,o,a,c,u,l,f,g,m,y)},t.prototype.fillText=function(t,e,n,r,i,o,a,s,c,u,l,h){var d;IG(t,e,o,a,u,l,h,this.imagePool,!0);var f=!_t(s)&&1!==s;f&&(d=t.globalAlpha,t.globalAlpha=s*c),t.fillText(n,r,i),f&&(t.globalAlpha=d)},t.prototype.strokeText=function(t,e,n,r,i,o,a,s,c,u){var l;jG(t,e,o,s,c,u,this.imagePool,!0);var h=!_t(a)&&1!==a;h&&(l=t.globalAlpha,t.globalAlpha=a),t.strokeText(n,r,i),h&&(t.globalAlpha=l)},t}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG);var zG=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="canvas-renderer",n}return r(e,t),e.prototype.init=function(){var t,e=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,r=new RG(n),o=((t={})[ar.CIRCLE]=r,t[ar.ELLIPSE]=r,t[ar.RECT]=r,t[ar.IMAGE]=new BG(n),t[ar.TEXT]=new FG(n),t[ar.LINE]=r,t[ar.POLYLINE]=r,t[ar.POLYGON]=r,t[ar.PATH]=r,t[ar.GROUP]=void 0,t[ar.HTML]=void 0,t[ar.MESH]=void 0,t);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new OG(e))},e.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},e}(ur),GG=function(){function t(){}return t.prototype.apply=function(e,n){var r=this,i=e.renderingService,o=e.renderingContext,a=e.config;this.context=e;var s=o.root.ownerDocument.defaultView,c=function(t){i.hooks.pointerMove.call(t)},u=function(t){i.hooks.pointerUp.call(t)},l=function(t){i.hooks.pointerDown.call(t)},h=function(t){i.hooks.pointerOver.call(t)},d=function(t){i.hooks.pointerOut.call(t)},f=function(t){i.hooks.pointerCancel.call(t)},p=function(t){i.hooks.pointerWheel.call(t)},g=function(t){i.hooks.click.call(t)};i.hooks.init.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="none",t.style.msTouchAction="none"):s.supportsPointerEvents&&(t.style.touchAction="none"),s.supportsPointerEvents?function(t){n.globalThis.document.addEventListener("pointermove",c,!0),t.addEventListener("pointerdown",l,!0),t.addEventListener("pointerleave",d,!0),t.addEventListener("pointerover",h,!0),n.globalThis.addEventListener("pointerup",u,!0),n.globalThis.addEventListener("pointercancel",f,!0)}(t):function(t){n.globalThis.document.addEventListener("mousemove",c,!0),t.addEventListener("mousedown",l,!0),t.addEventListener("mouseout",d,!0),t.addEventListener("mouseover",h,!0),n.globalThis.addEventListener("mouseup",u,!0)}(t),s.supportsTouchEvents&&function(t){t.addEventListener("touchstart",l,!0),t.addEventListener("touchend",u,!0),t.addEventListener("touchmove",c,!0),t.addEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.addEventListener("click",g,!0),t.addEventListener("wheel",p,{passive:!0,capture:!0})})),i.hooks.destroy.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):s.supportsPointerEvents&&(t.style.touchAction=""),s.supportsPointerEvents?function(t){n.globalThis.document.removeEventListener("pointermove",c,!0),t.removeEventListener("pointerdown",l,!0),t.removeEventListener("pointerleave",d,!0),t.removeEventListener("pointerover",h,!0),n.globalThis.removeEventListener("pointerup",u,!0)}(t):function(t){n.globalThis.document.removeEventListener("mousemove",c,!0),t.removeEventListener("mousedown",l,!0),t.removeEventListener("mouseout",d,!0),t.removeEventListener("mouseover",h,!0),n.globalThis.removeEventListener("mouseup",u,!0)}(t),s.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",l,!0),t.removeEventListener("touchend",u,!0),t.removeEventListener("touchmove",c,!0),t.removeEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.removeEventListener("click",g,!0),t.removeEventListener("wheel",p,!0)}))},t.tag="DOMInteraction",t}(),VG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="dom-interaction",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new GG)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(ur),WG=function(){function t(){this.displayObjectHTMLElementMap=new WeakMap}return t.prototype.joinTransformMatrix=function(t){return"matrix(".concat([t[0],t[1],t[4],t[5],t[12],t[13]].join(","),")")},t.prototype.apply=function(e,n){var r=this,i=e.camera,o=e.renderingContext,a=e.renderingService;this.context=e;var s=o.root.ownerDocument.defaultView,c=s.context.eventService.nativeHTMLMap,u=function(t,e){e.style.transform=r.joinTransformMatrix(t.getWorldTransform())},l=function(t){var e=t.target;if(e.nodeName===ar.HTML){r.$camera||(r.$camera=r.createCamera(i));var o=r.getOrCreateEl(e);if(r.$camera.appendChild(o),n.enableCSSParsing){var a=e.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(t){o.style[t]=a[t]}))}Object.keys(e.attributes).forEach((function(t){r.updateAttribute(t,e)})),u(e,o),c.set(o,e)}},h=function(t){var e=t.target;if(e.nodeName===ar.HTML&&r.$camera){var n=r.getOrCreateEl(e);n&&(n.remove(),c.delete(n))}},d=function(t){var e=t.target;if(e.nodeName===ar.HTML){var n=t.attrName;r.updateAttribute(n,e)}},f=function(t){var e=t.target;if(e.nodeName===ar.HTML){var n=r.getOrCreateEl(e);u(e,n)}},p=function(){if(r.$camera){var t=r.context.config,e=t.width,n=t.height;r.$camera.style.width="".concat(e||0,"px"),r.$camera.style.height="".concat(n||0,"px")}};a.hooks.init.tap(t.tag,(function(){s.addEventListener(Is.RESIZE,p),s.addEventListener(hs.MOUNTED,l),s.addEventListener(hs.UNMOUNTED,h),s.addEventListener(hs.ATTR_MODIFIED,d),s.addEventListener(hs.BOUNDS_CHANGED,f)})),a.hooks.endFrame.tap(t.tag,(function(){r.$camera&&o.renderReasons.has(es.CAMERA_CHANGED)&&(r.$camera.style.transform=r.joinTransformMatrix(i.getOrthoMatrix()))})),a.hooks.destroy.tap(t.tag,(function(){r.$camera&&r.$camera.remove(),s.removeEventListener(Is.RESIZE,p),s.removeEventListener(hs.MOUNTED,l),s.removeEventListener(hs.UNMOUNTED,h),s.removeEventListener(hs.ATTR_MODIFIED,d),s.removeEventListener(hs.BOUNDS_CHANGED,f)}))},t.prototype.createCamera=function(t){var e=this.context.config,n=e.document,r=e.width,i=e.height,o=this.context.contextService.getDomElement(),a=o.parentNode;if(a){var s="g-canvas-camera",c=a.querySelector("#"+s);if(!c){var u=(n||document).createElement("div");c=u,u.id=s,u.style.position="absolute",u.style.left="".concat(o.offsetLeft||0,"px"),u.style.top="".concat(o.offsetTop||0,"px"),u.style.transformOrigin="left top",u.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),u.style.overflow="hidden",u.style.pointerEvents="none",u.style.width="".concat(r||0,"px"),u.style.height="".concat(i||0,"px"),a.appendChild(u)}return c}return null},t.prototype.getOrCreateEl=function(t){var e=this.context.config.document,n=this.displayObjectHTMLElementMap.get(t);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(t,n),t.id&&(n.id=t.id),t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform())),n},t.prototype.updateAttribute=function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;Wt(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"x":n.style.left="".concat(e.parsedStyle.x,"px");break;case"y":n.style.top="".concat(e.parsedStyle.y,"px");break;case"transformOrigin":var i=e.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);break;case"width":if(this.context.enableCSSParsing){var o=e.computedStyleMap().get("width");n.style.width=o.toString()}else{o=e.parsedStyle.width;n.style.width=Yt(o)?"".concat(o,"px"):o.toString()}break;case"height":if(this.context.enableCSSParsing){var a=e.computedStyleMap().get("height");n.style.height=a.toString()}else{a=e.parsedStyle.height;n.style.height=Yt(a)?"".concat(a,"px"):a.toString()}break;case"zIndex":var s=e.parsedStyle.zIndex;n.style["z-index"]="".concat(s);break;case"visibility":var c=e.parsedStyle.visibility;n.style.visibility=c;break;case"pointerEvents":var u=e.parsedStyle.pointerEvents,l=void 0===u?"auto":u;n.style.pointerEvents=l;break;case"opacity":var h=e.parsedStyle.opacity;n.style.opacity="".concat(h);break;case"fill":var d=e.parsedStyle.fill,f="";Fi(d)?f=d.isNone?"transparent":e.getAttribute("fill"):Array.isArray(d)?f=e.getAttribute("fill"):Bi(d),n.style.background=f;break;case"stroke":var p=e.parsedStyle.stroke,g="";Fi(p)?g=p.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(p)?g=e.getAttribute("stroke"):Bi(p),n.style["border-color"]=g,n.style["border-style"]="solid";break;case"lineWidth":var m=e.parsedStyle.lineWidth;n.style["border-width"]="".concat(m||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":var y=e.style.filter;n.style.filter=y;break;default:_t(e.style[t])||""===e.style[t]||(n.style[t]=e.style[t])}},t.tag="HTMLRendering",t}(),HG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="html-renderer",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new WG)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(ur),$G=function(){function t(t){this.canvasConfig=t,this.imageCache={},this.gradientCache={},this.patternCache={}}return t.prototype.getImageSync=function(t,e){return this.imageCache[t]?e&&e(this.imageCache[t]):this.getOrCreateImage(t).then((function(t){e&&e(t)})),this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var e=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(r,i){var o;n?o=n(t):pa&&(o=new window.Image),o&&(o.onload=function(){e.imageCache[t]=o,r(o)},o.onerror=function(t){i(t)},o.crossOrigin="Anonymous",o.src=t)}))},t.prototype.getOrCreatePatternSync=function(t,e,n,r,i,o){var a=this.generatePatternKey(t);if(a&&this.patternCache[a])return this.patternCache[a];var s,c=t.image,u=t.repetition,l=t.transform,h=!1;Wt(c)?s=this.getImageSync(c,o):n?(s=n,h=!0):s=c;var d=s&&e.createPattern(s,u);if(d){var f=void 0;f=l?Wa(Po(l),new Ws({})):N(w()),h&&O(f,f,[1/r,1/r,1]),d.setTransform({a:f[0],b:f[1],c:f[4],d:f[5],e:f[12]+i[0],f:f[13]+i[1]})}return a&&d&&(this.patternCache[a]=d),d},t.prototype.getOrCreateGradient=function(t,e){var n=this.generateGradientKey(t),r=t.type,i=t.steps,o=t.min,a=t.width,s=t.height,c=t.angle,u=t.cx,l=t.cy,h=t.size;if(this.gradientCache[n])return this.gradientCache[n];var d=null;if(r===Xr.LinearGradient){var f=function(t,e,n,r){var i=yr(r.value),o=0+e/2,a=0+n/2,s=Math.abs(e*Math.cos(i))+Math.abs(n*Math.sin(i));return{x1:t[0]+o-Math.cos(i)*s/2,y1:t[1]+a-Math.sin(i)*s/2,x2:t[0]+o+Math.cos(i)*s/2,y2:t[1]+a+Math.sin(i)*s/2}}(o,a,s,c),p=f.x1,g=f.y1,m=f.x2,y=f.y2;d=e.createLinearGradient(p,g,m,y)}else if(r===Xr.RadialGradient){var v=function(t,e,n,r,i,o){var a=r.value,s=i.value;r.unit===Fr.kPercentage&&(a=r.value/100*e),i.unit===Fr.kPercentage&&(s=i.value/100*n);var c=Math.max($e([0,0],[a,s]),$e([0,n],[a,s]),$e([e,n],[a,s]),$e([e,0],[a,s]));return o&&(o instanceof hi?c=o.value:o instanceof ri&&("closest-side"===o.value?c=Math.min(a,e-a,s,n-s):"farthest-side"===o.value?c=Math.max(a,e-a,s,n-s):"closest-corner"===o.value&&(c=Math.min($e([0,0],[a,s]),$e([0,n],[a,s]),$e([e,n],[a,s]),$e([e,0],[a,s]))))),{x:a+t[0],y:s+t[1],r:c}}(o,a,s,u,l,h),b=v.x,x=v.y,w=v.r;d=e.createRadialGradient(b,x,0,b,x,w)}return d&&(i.forEach((function(t){var e=t.offset,n=t.color;e.unit===Fr.kPercentage&&(null==d||d.addColorStop(e.value/100,n.toString()))})),this.gradientCache[n]=d),this.gradientCache[n]},t.prototype.generateGradientKey=function(t){var e=t.type,n=t.min,r=t.width,i=t.height,o=t.steps,a=t.angle,s=t.cx,c=t.cy,u=t.size;return"gradient-".concat(e,"-").concat((null==a?void 0:a.toString())||0,"-").concat((null==s?void 0:s.toString())||0,"-").concat((null==c?void 0:c.toString())||0,"-").concat((null==u?void 0:u.toString())||0,"-").concat(n[0],"-").concat(n[1],"-").concat(r,"-").concat(i,"-").concat(o.map((function(t){var e=t.offset,n=t.color;return"".concat(e).concat(n)})).join("-"))},t.prototype.generatePatternKey=function(t){var e=t.image,n=t.repetition;return Wt(e)?"pattern-".concat(e,"-").concat(n):"rect"===e.nodeName?"pattern-".concat(e.entity,"-").concat(n):void 0},t}(),UG=function(){function t(){}return t.prototype.apply=function(e){var n=e.renderingService,r=e.renderingContext,i=e.imagePool,o=r.root.ownerDocument.defaultView,a=function(t,e,n){var r=t.parsedStyle,i=r.width,o=r.height;i&&!o?t.setAttribute("height",n/e*i):!i&&o&&t.setAttribute("width",e/n*o)},s=function(t){var e=t.target,r=e.nodeName,o=e.attributes;if(r===ar.IMAGE){var s=o.src,c=o.keepAspectRatio;Wt(s)&&i.getImageSync(s,(function(t){var r=t.width,i=t.height;c&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))}},c=function(t){var e=t.target,r=t.attrName,o=t.newValue;e.nodeName===ar.IMAGE&&"src"===r&&Wt(o)&&i.getOrCreateImage(o).then((function(t){var r=t.width,i=t.height;e.attributes.keepAspectRatio&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))};n.hooks.init.tap(t.tag,(function(){o.addEventListener(hs.MOUNTED,s),o.addEventListener(hs.ATTR_MODIFIED,c)})),n.hooks.destroy.tap(t.tag,(function(){o.removeEventListener(hs.MOUNTED,s),o.removeEventListener(hs.ATTR_MODIFIED,c)}))},t.tag="LoadImage",t}(),YG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="image-loader",e}return r(e,t),e.prototype.init=function(){this.context.imagePool=new $G(this.context.config),this.addRenderingPlugin(new UG)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(ur),qG=function(){function t(t){this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return t.prototype.init=function(){var t=this.canvasConfig,e=t.container,n=t.canvas;if(n)this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(e&&(this.$container=Wt(e)?document.getElementById(e):e,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},t.prototype.getContext=function(){return this.context},t.prototype.getDomElement=function(){return this.$canvas},t.prototype.getDPR=function(){return this.dpr},t.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},t.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},t.prototype.resize=function(t,e){var n=this.canvasConfig.devicePixelRatio||pa&&window.devicePixelRatio||1;n=n>=1?Math.ceil(n):1,this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,function(t,e,n){pa&&t.style&&(t.style.width=e+"px",t.style.height=n+"px")}(this.$canvas,t,e)),this.renderingContext.renderReasons.add(es.CAMERA_CHANGED)},t.prototype.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},t.prototype.toDataURL=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return c(this,(function(r){return e=t.type,n=t.encoderOptions,[2,this.context.canvas.toDataURL(e,n)]}))}))},t}(),KG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="canvas-context-register",e}return r(e,t),e.prototype.init=function(){this.context.ContextService=qG},e.prototype.destroy=function(){delete this.context.ContextService},e}(ur),XG=function(t){function e(e){var n=t.call(this,e)||this;return n.registerPlugin(new KG),n.registerPlugin(new YG),n.registerPlugin(new aG),n.registerPlugin(new zG),n.registerPlugin(new VG),n.registerPlugin(new PG),n.registerPlugin(new HG),n}return r(e,t),e}(lr);const ZG=["timestamp","time","date","datetime"];class QG extends iL{static defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:t=>eV(t,ZG,void 0),loop:!1};timebar;canvas;wrapper;originalData;get padding(){return ol(this.options.padding)}constructor(t,e){super(t,Object.assign({},QG.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){this.timebar?.play()}pause(){this.timebar?.pause()}forward(){this.timebar?.forward()}backward(){this.timebar?.backward()}reset(){this.timebar?.reset()}update(t){super.update(t),this.backup(),Object.keys(t).forEach((t=>{if("position"===t)this.upsertWrapper();else this.upsertTimebar()}))}backup(){this.originalData=JG(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,{onChange:e,timebarType:n,data:r,x:i,y:o,width:a,height:s,mode:c,...u}=this.options,l=t.getSize(),[h]=this.padding;this.upsertCanvas().ready.then((()=>{const t={x:l[0]/2-a/2,y:h,onChange:t=>{const n=(It(t)?t:[t,t]).map((t=>function(t){return Lt(t,"Date")}(t)?t.getTime():t));"modify"===this.options.mode?this.filterElements(n):this.hiddenElements(n),e?.(n)},...u,data:r.map((t=>Yt(t)?{time:t,value:0}:t)),width:a,height:s,type:n};this.timebar?this.timebar.update(t):(this.timebar=new Zz({style:t}),this.canvas?.appendChild(this.timebar))}))}upsertWrapper(){if(!this.wrapper){const t=document.createElement("div");t.style.position="absolute",this.wrapper=t}const{x:t,y:e,className:n,position:r}=this.options;return n&&(this.wrapper.className=n),Yt(t)||Yt(e)?Object.assign(this.wrapper.style,{left:`${t??0}px`,top:`${e??0}px`}):Object.assign(this.wrapper.style,{["top"===r?"bottom":"top"]:"unset",["top"===r?"top":"bottom"]:"0px"}),this.context.canvas.getContainer()?.appendChild(this.wrapper),this.wrapper}upsertCanvas(){const t=this.upsertWrapper();if(this.canvas)return this.canvas;const{height:e}=this.options,[n]=this.context.canvas.getSize(),[r,,i]=this.padding;return this.canvas=new pc({container:t,width:n,height:e+r+i,renderer:this.context.options.renderer?.("main")||new XG,supportsMutipleCanvasesInOneContainer:!0}),this.canvas}async filterElements(t){if(!this.originalData)return;const{elementTypes:e,getTime:n}=this.options,{graph:r,element:i}=this.context,o=JG(this.originalData);e.forEach((e=>{const r=`${e}s`;o[r]=(this.originalData[r]||[]).filter((e=>{const r=n(e);return!!tV(r,t)}))}));const a=[...o.nodes,...o.combos].map((t=>Gu(t)));o.edges=o.edges.filter((t=>{const e=t.source,n=t.target;return a.includes(e)&&a.includes(n)})),r.setData(o),await(i.draw({animation:!1,silence:!0})?.finished)}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:r}=this.options,i=[],o=[];n.forEach((e=>{const n=`${e}s`;(this.originalData?.[n]||[]).forEach((e=>{const n=Gu(e),a=r(e);tV(a,t)?o.push(n):i.push(n)}))})),e.hideElement(i,!1),e.showElement(o,!1)}destroy(){const{graph:t}=this.context;this.originalData&&t.setData({...this.originalData}),this.timebar?.destroy(),this.canvas?.destroy(),this.wrapper?.remove(),this.originalData=void 0,this.wrapper=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}const JG=t=>{const{nodes:e=[],edges:n=[],combos:r=[]}=t;return{nodes:[...e],edges:[...n],combos:[...r]}},tV=(t,e)=>{if(Yt(e))return t===e;const[n,r]=e;return t>=n&&t<=r},eV=(t,e,n)=>{for(let n=0;n<e.length;n++){const r=e[n],i=t.data?.[r];if(i)return i}return n};class nV extends iL{static defaultOptions={position:"top-left"};$element=nL("toolbar",!1);constructor(t,e){super(t,Object.assign({},nV.defaultOptions,e));const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),rL("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n }\n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),rL("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">\n <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>\n <symbol id="request-fullscreen" viewBox="0 0 1024 1024">\n <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}async update(t){super.update(t);const{className:e,position:n,style:r}=this.options;this.$element.className=`g6-toolbar ${e||""}`,Object.assign(this.$element.style,r,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach((t=>{e[t]="8px"})),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(n)),this.$element.innerHTML=await this.getDOMContent()}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}async getDOMContent(){return(await this.options.getItems()).map((t=>`\n <div class="g6-toolbar-item" value="${t.value}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`)).join("")}onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");e?.(n,t.target)}}}class rV extends iL{static defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};currentTarget=null;tooltipElement=null;container=null;constructor(t,e){super(t,Object.assign({},rV.defaultOptions,e)),this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){this.unbindEvents(),super.update(t),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.off(n,e[n])}))}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.on(n,e[n])}))}isEnable=t=>{const{enable:e}=this.options;return"function"==typeof e?e(t):e};onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?(this.currentTarget=null,this.hide(t)):(this.currentTarget=e,this.show(t))};onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.show(t)};onPointerLeave=t=>{this.hide(t),this.currentTarget=null};onCanvasMove=t=>{this.hide(t),this.currentTarget=null};onPointerEnter=t=>{this.show(t)};showById=t=>{const e={target:{id:t}};this.show(e)};getElementData=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}};show=t=>{const{client:e,target:{id:n}}=t,r=this.context.graph.getElementType(n);if(!this.tooltipElement||!this.isEnable(t))return;const{getContent:i,title:o}=this.options;this.currentTarget=n;const a=this.getElementData(n,r);let s,c;if(e)s=e.x,c=e.y;else{const t=pe(a,"0.style",{x:0,y:0});s=t.x,c=t.y}let u={};if(i)u.content=i(t,a);else{const t=this.context.graph.getElementRenderStyle(n),e="node"===r?t.fill:t.stroke;u={title:o||r,data:a.map((t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:e})))}}this.tooltipElement.update({x:s,y:c,style:{".tooltip":{visibility:"visible"}},...u})};hide=t=>{if(!t)return void this.tooltipElement?.hide();if(!this.tooltipElement||!this.isEnable(t))return;const{client:{x:e,y:n}}=t;this.tooltipElement.hide(e,n)};initTooltip=()=>{const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:a,enterable:s,container:c={x:-i,y:-r},title:u,offset:l}=this.options,[h,d]=e,[f,p]=t.getSize(),g=new Mz({className:"tooltip",style:{x:h,y:d,container:c,title:u,bounding:{x:0,y:0,width:f,height:p},position:a,enterable:s,offset:l,style:o}});return this.container?.appendChild(g.HTMLTooltipElement),g};destroy(){this.unbindEvents(),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),super.destroy()}}let iV;function oV(t,e){iV||(iV=document.createElement("canvas")),iV.width=t,iV.height=e;return iV.getContext("2d").clearRect(0,0,t,e),iV}class aV extends iL{static defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};$element=nL("watermark");constructor(t,e){super(t,Object.assign({},aV.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}async update(t){super.update(t);const{width:e,height:n,text:r,imageURL:i,...o}=this.options;Object.keys(o).forEach((e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])}));const a=i?await async function(t,e,n,r){const i=oV(t,e),o=i.getContext("2d"),{rotate:a,opacity:s}=r;a&&o.rotate(a),s&&(o.globalAlpha=s);const c=new Image;return c.crossOrigin="anonymous",c.src=n,new Promise((n=>{c.onload=function(){const r=t>c.width?(t-c.width)/2:0,a=e>c.height?(e-c.height)/2:0;o.drawImage(c,0,0,c.width,c.height,r,a,t-2*r,e-2*a),n(i.toDataURL())}}))}(e,n,i,o):await async function(t,e,n,r){const i=oV(t,e),o=i.getContext("2d"),{rotate:a,opacity:s,textFill:c,textFontSize:u,textFontFamily:l,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:p}=r;return o.textAlign=f,o.textBaseline=p,o.translate(t/2,e/2),o.font=`${u}px ${l} ${h} ${d}`,a&&o.rotate(a),s&&(o.globalAlpha=s),c&&(o.fillStyle=c,o.fillText(`${n}`,0,0)),i.toDataURL()}(e,n,r,o);this.$element.style.backgroundImage=`url(${a})`}destroy(){super.destroy(),this.$element.remove()}}const sV=["#7E92B5","#F4664A","#FFBE3A"],cV={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},uV={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function lV(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeHaloStrokeOpacityActive:a=.15,nodeHaloStrokeOpacitySelected:s=.25,nodeOpacityDisabled:c=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:l=.25,nodeBadgePalette:h=sV,nodePaletteOptions:d=cV,edgeColor:f,edgeColorDisabled:p,edgePaletteOptions:g=uV,comboColor:m,comboColorDisabled:y,comboStroke:v,comboStrokeDisabled:b,edgeColorInactive:x}=t;return{background:e,node:{palette:d,style:{badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:r,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:n,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65,size:32,stroke:o,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:s,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:o},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:a},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:o,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:l,donutOpacity:l,fillOpacity:l,iconOpacity:u,labelFill:n,labelFillOpacity:l,strokeOpacity:l},disabled:{badgeBackgroundOpacity:.25,donutOpacity:c,fill:i,fillOpacity:c,iconFill:i,iconOpacity:.25,labelFill:n,labelFillOpacity:.25,strokeOpacity:c}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:f,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:f,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:x,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:p,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:e,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:m,halo:!1,haloLineWidth:12,haloStroke:v,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:v},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:y,fillOpacity:.25,labelOpacity:.25,stroke:b,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const hV=lV({bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:{type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"}),dV=lV({bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"});class fV extends el{beforeDraw(t,e){return t}}function pV(t,e,n,r,i){const o=Gu(r),a=`${n}s`,s=t.add[a].get(o)||t.update[a].get(o)||t.remove[a].get(o)||r;Object.entries(t).forEach((([t,n])=>{e===t?n[a].set(o,s):n[a].delete(o)}))}const gV=(t,e,n,r)=>{const i=`${n}s`,o=Gu(r);t.add[i].has(o)||t.update[i].has(o)||t[e][i].set(Gu(r),r)};class mV{type;constructor(t){this.type=t}}class yV extends mV{data;constructor(t,e){super(t),this.data=e}}class vV extends mV{animationType;animation;data;constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class bV extends mV{elementType;data;constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class xV extends mV{data;constructor(t,e){super(t),this.data=e}}function wV(t,e){t.emit(e.type,e)}class EV{context;constructor(t){this.context=t}tasks=[];animations=new Set;getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){e?.before?.();const r=this.getTasks().map((([e,r])=>{const{element:i,elementType:o,stage:a}=e,s=zu(this.context.options,o,a,t);r?.before?.();const c=Uu(i,this.inferStyle(e,n),s);return c?(r?.beforeAnimate?.(c),c.finished.then((()=>{r?.afterAnimate?.(c),r?.after?.()}))):r?.after?.(),c})).filter(Boolean);r.forEach((t=>this.animations.add(t)));const i=Iu(r);return i?(e?.beforeAnimate?.(i),i.finished.then((()=>{e?.afterAnimate?.(i),e?.after?.()}))):e?.after?.(),i}inferStyle(t,e){const{element:n,elementType:r,stage:i,originalStyle:o,modifiedStyle:a}=t,s={...o},c={...a},u=()=>dh(n,"opacity")??Bu("opacity");if("enter"===i)Object.assign(s,{opacity:0});else if("exit"===i)Object.assign(c,{opacity:0});else if("show"===i)Object.assign(s,{opacity:0}),Object.assign(c,{opacity:u()});else if("hide"===i)Object.assign(s,{opacity:u()}),Object.assign(c,{opacity:0});else if("collapse"===i){const{collapse:t}=e||{},{target:i,descendants:o,position:a}=t;if("node"===r){if(o.includes(n.id)){const[t,e,n]=a;Object.assign(c,{x:t,y:e,z:n})}}else if("combo"===r){if(n.id===i||o.includes(n.id)){const[t,e]=a;Object.assign(c,{x:t,y:e,childrenNode:s.childrenNode})}}else"edge"===r&&Object.assign(c,{sourceNode:s.sourceNode,targetNode:s.targetNode})}else if("expand"===i){const{expand:t}=e||{},{target:i,descendants:o,position:a}=t;if("node"===r){if(n.id===i||o.includes(n.id)){const[t,e,n]=a;Object.assign(s,{x:t,y:e,z:n})}}else if("combo"===r){if(n.id===i||o.includes(n.id)){const[t,e,n]=a;Object.assign(s,{x:t,y:e,z:n,childrenNode:c.childrenNode})}}else"edge"===r&&Object.assign(s,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[s,c]}stop(){this.animations.forEach((t=>t.cancel()))}clear(){this.tasks=[]}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class MV{context;batchCount=0;constructor(t){this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(e=!0){this.batchCount++,1===this.batchCount&&this.emit(new yV(t.GraphEvent.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,0===this.batchCount&&this.emit(new yV(t.GraphEvent.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class SV extends tl{currentTarget=null;currentTargetType=null;category="behavior";constructor(t){super(t),this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.addEventListener(t,this.forwardContainerEvents)}));const n=this.context.canvas.document;n&&[t.CommonEvent.CLICK,t.CommonEvent.DBLCLICK,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE,t.CommonEvent.POINTER_ENTER,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_OUT,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_UP,t.CommonEvent.CONTEXT_MENU,t.CommonEvent.DRAG_START,t.CommonEvent.DRAG,t.CommonEvent.DRAG_END,t.CommonEvent.DRAG_ENTER,t.CommonEvent.DRAG_OVER,t.CommonEvent.DRAG_LEAVE,t.CommonEvent.DROP,t.CommonEvent.WHEEL].forEach((t=>{n.addEventListener(t,this.forwardCanvasEvents)}))}forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof rc)return{type:"canvas",element:t};let e=t;for(;e;){if(Nd(e))return{type:"node",element:e};if(kd(e))return{type:"edge",element:e};if(Cd(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:a,element:s}=r;if("destroyed"in s&&(zd(s)||s.destroyed))return;const{type:c,detail:u,button:l}=e,h={...e,target:s,targetType:a,originalTarget:n};c===t.CommonEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${this.currentTargetType}:${t.CommonEvent.POINTER_LEAVE}`,{...h,type:t.CommonEvent.POINTER_LEAVE,target:this.currentTarget}),s&&(Object.assign(h,{type:t.CommonEvent.POINTER_ENTER}),i.emit(`${a}:${t.CommonEvent.POINTER_ENTER}`,h))),this.currentTarget=s,this.currentTargetType=a),c===t.CommonEvent.CLICK&&2===l||(i.emit(`${a}:${c}`,h),i.emit(c,h)),c===t.CommonEvent.CLICK&&2===u&&(Object.assign(h,{type:t.CommonEvent.DBLCLICK}),i.emit(`${a}:${t.CommonEvent.DBLCLICK}`,h),i.emit(t.CommonEvent.DBLCLICK,h)),c===t.CommonEvent.POINTER_DOWN&&2===l&&(Object.assign(h,{type:t.CommonEvent.CONTEXT_MENU,preventDefault:()=>{o.getContainer()?.addEventListener(t.CommonEvent.CONTEXT_MENU,(t=>t.preventDefault()),{once:!0})}}),i.emit(`${a}:${t.CommonEvent.CONTEXT_MENU}`,h),i.emit(t.CommonEvent.CONTEXT_MENU,h))};forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)};destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.removeEventListener(t,this.forwardContainerEvents)})),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var NV=function(){function t(t){this.dragndropPluginOptions=t}return t.prototype.apply=function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,a=function(t){var e=t.target,r=e===i,a=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(a){var u=!1,l=t.timeStamp,h=[t.clientX,t.clientY],d=null,f=[t.clientX,t.clientY],p=function(t){return s(n,void 0,void 0,(function(){var n,o,s,p,g,m;return c(this,(function(c){switch(c.label){case 0:if(!u){if(n=t.timeStamp-l,o=$e([t.clientX,t.clientY],h),n<=this.dragndropPluginOptions.dragstartTimeThreshold||o<=this.dragndropPluginOptions.dragstartDistanceThreshold)return[2];t.type="dragstart",a.dispatchEvent(t),u=!0}return t.type="drag",t.dx=t.clientX-f[0],t.dy=t.clientY-f[1],a.dispatchEvent(t),f=[t.clientX,t.clientY],r?[3,2]:(s="pointer"===this.dragndropPluginOptions.overlap?[t.canvasX,t.canvasY]:e.getBounds().center,[4,i.elementsFromPoint(s[0],s[1])]);case 1:p=c.sent(),g=p[p.indexOf(e)+1],m=(null==g?void 0:g.closest("[droppable=true]"))||(this.dragndropPluginOptions.isDocumentDroppable?i:null),d!==m&&(d&&(t.type="dragleave",t.target=d,d.dispatchEvent(t)),m&&(t.type="dragenter",t.target=m,m.dispatchEvent(t)),(d=m)&&(t.type="dragover",t.target=d,d.dispatchEvent(t))),c.label=2;case 2:return[2]}}))}))};o.addEventListener("pointermove",p);var g=function(t){if(u){t.detail={preventClick:!0};var e=t.clone();d&&(e.type="drop",e.target=d,d.dispatchEvent(e)),e.type="dragend",a.dispatchEvent(e),u=!1}o.removeEventListener("pointermove",p)};e.addEventListener("pointerup",g,{once:!0}),e.addEventListener("pointerupoutside",g,{once:!0})}};r.hooks.init.tap(t.tag,(function(){o.addEventListener("pointerdown",a)})),r.hooks.destroy.tap(t.tag,(function(){o.removeEventListener("pointerdown",a)}))},t.tag="Dragndrop",t}(),kV=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="dragndrop",n}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new NV(i({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e.prototype.setOptions=function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)},e}(ur);class CV{config;background;main;label;transient;get canvas(){return{main:this.main,label:this.label,transient:this.transient,background:this.background}}get document(){return this.main.document}renderers;initialized=!1;constructor(t){this.config=t}async init(){if(this.initialized)return;const{renderer:t,background:e,...n}=this.config,{renderers:r,canvas:i}=["main","label","transient","background"].reduce(((e,r)=>{const i=Rt(t)?t?.(r):new XG;"main"===r?i.registerPlugin(new kV({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):i.unregisterPlugin(i.getPlugin("dom-interaction"));const o=new pc({renderer:i,supportsMutipleCanvasesInOneContainer:!0,...n});return e.renderers[r]=i,e.canvas[r]=o,this[r]=o,e}),{renderers:{},canvas:{}});this.renderers=r,Object.entries(i).forEach((([t,e])=>{const n=e.getContextService().getDomElement();n.style.position="absolute",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")})),this.setBackground(),await Promise.all(Object.values(this.canvas).map((t=>t.ready))),this.initialized=!0}getRendererType(t="main"){const e=this.renderers[t].getPlugins();for(const t of e){if("canvas-renderer"===t.name)return"canvas";if("svg-renderer"===t.name)return"svg";if("device-renderer"===t.name)return"gpu"}return"unknown"}get context(){return this.main.context}getDevice(){return this.main.context?.deviceRendererPlugin?.getDevice()}getConfig(){return this.config}setBackground(t=this.config.background){this.config.background=t}setCursor(t){this.config.cursor=t,Object.values(this.canvas).forEach((e=>{e.setCursor(t)}))}getSize(){return[this.config.width||0,this.config.height||0]}resize(t,e){this.config.width=t,this.config.height=e,Object.values(this.canvas).forEach((n=>{n.resize(t,e)}))}getCamera(){return this.main.getCamera()}getBounds(){return hl(Object.values(this.canvas).map((t=>t.document.documentElement)).filter((t=>t.childNodes.length>0)).map((t=>t.getBounds())))}getContainer(){const t=this.config.container;return Wt(t)?document.getElementById(t):t}appendChild(t){return this[t.style?.$layer||"main"].appendChild(t)}getContextService(){return this.main.getContextService()}viewport2Client(t){return this.main.viewport2Client(t)}viewport2Canvas(t){return this.main.viewport2Canvas(t)}client2Viewport(t){return this.main.client2Viewport(t)}canvas2Viewport(t){return this.main.canvas2Viewport(t)}async toDataURL(t={}){const e=window.devicePixelRatio||1,{mode:n="viewport",...r}=t;let i=0,o=0,a=0,s=0;if("viewport"===n)[a,s]=[this.config.width||0,this.config.height||0];else if("overall"===n){const t=this.getBounds(),e=cl(t);[i,o]=t.min,[a,s]=e}const c=an('<div id="virtual-image"></div>'),u=new pc({width:a,height:s,renderer:new XG,devicePixelRatio:e,container:c,background:this.config.background});await u.ready,u.appendChild(this.background.getRoot().cloneNode(!0)),u.appendChild(this.main.getRoot().cloneNode(!0));const l=this.label.getRoot().cloneNode(!0),h=u.viewport2Canvas({x:0,y:0}),d=this.main.viewport2Canvas({x:0,y:0});l.translate([d.x-h.x,d.y-h.y]),l.scale(1/this.main.getCamera().getZoom()),u.appendChild(l),u.appendChild(this.transient.getRoot().cloneNode(!0));const f=this.main.getCamera(),p=u.getCamera();if("viewport"===n)p.setZoom(f.getZoom()),p.setPosition(f.getPosition()),p.setFocalPoint(f.getFocalPoint());else if("overall"===n){const[t,e,n]=p.getPosition(),[r,a,s]=p.getFocalPoint();p.setPosition([t+i,e+o,n]),p.setFocalPoint([r+i,a+o,s])}const g=u.getContextService();return new Promise((t=>{u.on(Is.RERENDER,(async()=>{await new Promise((t=>setTimeout(t,300)));const e=await g.toDataURL(r);t(e)}))}))}destroy(){this.config={},this.renderers={},Object.entries(this.canvas).forEach((([t,e])=>{const n=e.getCamera();n.landmarks?.length&&n.cancelLandmarkAnimation(),function(t){t.destroy();const e=t.getCamera();e.eventEmitter.removeAllListeners(),t.document.timeline.destroy();const{animationsWithPromises:n}=t.document.timeline;n.forEach((t=>{t.effect.target&&(t.effect.target=null),t.effect.computedTiming&&(t.effect.computedTiming=null)})),t.document.timeline.animationsWithPromises=[],t.document.timeline.rafCallbacks=[],t.document.timeline=null}(e),this[t]=void 0}))}}function TV(t,e){const{data:n,style:r,...i}=t,{data:o,style:a,...s}=e,c={...i,...s};return(n||o)&&Object.assign(c,{data:{...n,...o}}),(r||a)&&Object.assign(c,{style:{...r,...a}}),c}function AV(t){const{data:e,style:n,...r}=t,i=r;return e&&(i.data={...e}),n&&(i.style={...n}),i}function PV(t){const{id:e=Gu(t),style:n,data:r,...i}=t,o={...t,style:{...n},data:{...r}};return function(t){return"source"in t&&"target"in t}(t)?{id:e,data:o,...i}:{id:e,data:o}}function OV(t){return t.data}class RV{model;latestRemovedComboIds=new Set;comboIds=new Set;changes=[];batchCount=0;isTraceless=!1;constructor(){this.model=new Zd}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Mu.NodeUpdated||e===Mu.EdgeUpdated||e===Mu.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:AV(n),original:AV(r),type:e})}else this.changes.push({value:AV(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=OV(n);return this.isCombo(Gu(r))||(void 0===t||t.includes(Gu(r)))&&e.push(r),e}),[])}getEdgeDatum(t){return OV(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce(((e,n)=>{const r=OV(n);return(void 0===t||t.includes(Gu(r)))&&e.push(r),e}),[])}getComboData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=OV(n);return this.isCombo(Gu(r))?((void 0===t||t.includes(Gu(r)))&&e.push(r),e):e}),[])}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(OV):[]}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Kl(e,(t=>{t!==e&&n.push(t)}),(t=>this.getChildrenData(Gu(t))),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e)return void console.error("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?OV(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?_u:Ru,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(OV):[]}getElementsDataByType(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementDataById(t){return"edge"===this.getElementType(t)?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){return OV(this.model.getNode(t))}getNodeLikeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=OV(n);return t?t.includes(Gu(r))&&e.push(r):e.push(r),e}),[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter((t=>t.states?.includes(e)))}getElementState(t){return this.getElementDataById(t)?.states||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(OV)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(OV)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i=[],edges:o=[],combos:a=[]}=this.getData(),s=Ju(i,e,(t=>Gu(t))),c=Ju(o,n,(t=>Gu(t))),u=Ju(a,r,(t=>Gu(t)));this.batch((()=>{this.addData({nodes:s.enter,edges:c.enter,combos:u.enter}),this.updateData({nodes:s.update,edges:c.update,combos:u.update}),this.removeData({nodes:s.exit.map(Gu),edges:c.exit.map(Gu),combos:u.exit.map(Gu)})}))}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)}))}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map((t=>(this.pushChange({value:t,type:Mu.NodeAdded}),PV(t))))),this.updateNodeLikeHierarchy(t))}addEdgeData(t=[]){t.length&&this.model.addEdges(t.map((t=>(this.pushChange({value:t,type:Mu.EdgeAdded}),PV(t)))))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(Ru)||e.attachTreeStructure(Ru),e.addNodes(t.map((t=>(this.comboIds.add(Gu(t)),this.pushChange({value:t,type:Mu.ComboAdded}),PV(t))))),this.updateNodeLikeHierarchy(t)}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),r=e.map(Gu);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...r]}]),this.addEdgeData(r.map((e=>({source:t,target:e}))))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach((t=>{const n=Gu(t);e.attachTreeStructure(Ru),this.setParent(n,Vu(t),Ru);const r=t.children;if(void 0!==r){e.attachTreeStructure(_u);const t=r.filter((t=>e.hasNode(t)));t.forEach((t=>this.setParent(t,n,_u))),t.length!==r.length&&this.updateNodeData([{id:n,children:t}])}}))}enableUpdateNodeLikeHierarchy=!0;preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)}))}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{const n=[];t.forEach((t=>{const r=Gu(t),i=OV(e.getNode(r));if(fe(i,t))return;const o=TV(i,t);this.pushChange({value:o,original:i,type:Mu.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.NodeUpdated})})),e.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.EdgeUpdated})})),n.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.ComboUpdated})}))}syncNodeDatum(t){const{model:e}=this,n=Gu(t),r=TV(OV(e.getNode(n)),t);e.mergeNodeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{t.forEach((t=>{const n=Gu(t),r=OV(e.getEdge(n));if(fe(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=TV(r,t);this.pushChange({value:i,original:r,type:Mu.EdgeUpdated}),e.mergeEdgeData(n,i)}))}))}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch((()=>{const n=[];t.forEach((t=>{const r=Gu(t),i=OV(e.getNode(r));if(fe(i,t))return;const o=TV(i,t);this.pushChange({value:o,original:i,type:Mu.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}setParent(t,e,n,r=!0){if(t===e)return;const i=Vu(this.getNodeLikeDatum(t));if(i!==e&&n===Ru){const n={id:t,combo:e};this.isCombo(t)?this.syncComboDatum(n):this.syncNodeDatum(n)}this.model.setParent(t,e,n),r&&n===Ru&&function(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}([i,e]).forEach((t=>{void 0!==t&&this.refreshComboData(t)}))}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,Ru);e&&this.pushChange({value:e,original:e,type:Mu.ComboUpdated}),n.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.ComboUpdated})}))}syncComboDatum(t){const{model:e}=this,n=Gu(t);if(!e.hasNode(n))return;const r=TV(OV(e.getNode(n)),t);e.mergeNodeData(n,r)}getElementPosition(t){return Pl(this.getElementDataById(t))}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=ml(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])}))}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every((t=>0===t)))return;const o=this.getComboData([t])[0];o&&Kl(o,(t=>{const e=Gu(t),[o,a,s]=Pl(t),c=TV(t,{style:{x:o+n,y:a+r,z:s+i}});this.pushChange({value:c,original:t,type:this.isCombo(e)?Mu.ComboUpdated:Mu.NodeUpdated}),this.model.mergeNodeData(e,c)}),(t=>this.getChildrenData(Gu(t))),"BT")}translateComboTo(t,e){if(e.some(isNaN))return;const[n=0,r=0,i=0]=e,o=this.getComboData([t])?.[0];if(!o)return;const[a,s,c]=Pl(o),u=n-a,l=r-s,h=i-c;Kl(o,(t=>{const e=Gu(t),[n,r,i]=Pl(t),o=TV(t,{style:{x:n+u,y:r+l,z:i+h}});this.pushChange({value:o,original:t,type:this.isCombo(e)?Mu.ComboUpdated:Mu.NodeUpdated}),this.model.mergeNodeData(e,o)}),(t=>this.getChildrenData(Gu(t))),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)}))}removeNodeData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(Gu)),this.pushChange({value:this.getNodeData([t])[0],type:Mu.NodeRemoved}),this.removeNodeLikeHierarchy(t)})),this.model.removeNodes(t)}))}removeEdgeData(t=[]){t.length&&(t.forEach((t=>this.pushChange({value:this.getEdgeData([t])[0],type:Mu.EdgeRemoved}))),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.pushChange({value:this.getComboData([t])[0],type:Mu.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)})),this.model.removeNodes(t)}))}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(Ru)){const e=Vu(this.getNodeLikeDatum(t));this.setParent(t,void 0,Ru,!1),this.model.getChildren(t,Ru).forEach((t=>{const n=OV(t),r=Gu(n);this.setParent(Gu(n),e,Ru,!1);const i=TV(n,{id:Gu(n),combo:e});this.pushChange({value:i,original:n,type:this.isCombo(r)?Mu.ComboUpdated:Mu.NodeUpdated}),this.model.mergeNodeData(Gu(n),i)})),oe(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(`Unknown element type of id: ${t}`)}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map((t=>t.id))),t.removeNodes(e.map((t=>t.id))),this.context={}}}class _V{context;container;elementMap={};shapeTypeMap={};constructor(t){this.context=t}init(){if(!this.container){const{canvas:t}=this.context;this.container=t.appendChild(new Ys)}}emit(t,e){e.silence||wV(this.context.graph,t)}forEachElementData(t){ql.forEach((e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)}))}getElementType(t,e){const{options:n,graph:r}=this.context,i=n[t]?.type||e.type;return i?"string"==typeof i?i:i.call(r,e):"edge"===t?"line":"circle"}getTheme(t){return Lu(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map((t=>n[t]||{})))}paletteStyle={};computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData(((e,n)=>{const r=Object.assign({},yh(this.getTheme(e)?.palette),yh(t[e]?.palette));r?.field&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,a=t=>{const e="string"==typeof r?KV("palette",r):r;if("function"==typeof e){const n={};return t.forEach((([t,r])=>{n[t]=e(o?1-r:r)})),n}if(Array.isArray(e)){const n=o?[...e].reverse():e,r={};return t.forEach((([t,i])=>{r[t]=n[i%e.length]})),r}return{}},s=(t,e)=>"string"==typeof t?e.data?.[t]:t?.(e);if("group"===n){const e=$t(t,(t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"})),n=a(Object.keys(e).map(((t,e)=>[t,e]))),r={};return Object.entries(e).forEach((([t,e])=>{e.forEach((e=>{r[Gu(e)]=n[t]}))})),r}if("value"===n){const[e,n]=t.reduce((([t,e],n)=>{const r=s(i,n);if("number"!=typeof r)throw new Error(`Palette field ${i} is not a number`);return[Math.min(t,r),Math.max(e,r)]}),[1/0,-1/0]),r=n-e;return a(t.map((t=>[t.id,(s(i,t)-e)/r])))}}(n,r))}))}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?"edge"===t?{stroke:n}:{fill:n}:{}}defaultStyle={};computeElementDefaultStyle(t,e){const{options:n}=this.context,r=n[t]?.style||{};this.defaultStyle[Gu(e.datum)]=sh(r,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];(void 0===t||t.includes(Gu(i)))&&this.computeElementDefaultStyle(n,{datum:i,graph:e})}}))}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}stateStyle={};getElementStateStyle(t,e,n){const{options:r}=this.context;return sh(r[t]?.state?.[e]||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[Gu(n.datum)]=Object.assign({},...e.map((e=>this.getElementStateStyle(t,e,n))))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];if(void 0===t||t.includes(Gu(i))){const t=this.getElementState(Gu(i));this.computeElementStatesStyle(n,t,{datum:i,graph:e})}}}))}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getElementZIndex(t){const e=this.getElement(t);return e?e.style.zIndex??0:0}getNodes(){return this.context.model.getNodeData().map((({id:t})=>this.elementMap[t]))}getEdges(){return this.context.model.getEdgeData().map((t=>this.elementMap[Gu(t)]))}getCombos(){return this.context.model.getComboData().map((({id:t})=>this.elementMap[t]))}getElementComputedStyle(t,e){const n=Gu(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(t,n),o=e.style||{},a=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},r,i,o,a,s,c);if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!u.collapsed?[]:t.map(Gu).filter((t=>this.getElement(t)));Object.assign(u,{childrenNode:e,childrenData:t})}return u}draw(e={animation:!0}){this.init();const n=this.computeChangesAndDrawData(e);if(!n)return null;const{dataChanges:r,drawData:i}=n;this.markDestroyElement(i),this.computeStyle(e.stage);const{add:o,update:a,remove:s}=i;this.destroyElements(s,e),this.createElements(o,e),this.updateElements(a,e);const{animation:c,silence:u}=e;return this.context.animation.animate(c,u?{}:{before:()=>this.emit(new yV(t.GraphEvent.BEFORE_DRAW,{dataChanges:r,animation:c}),e),beforeAnimate:n=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.DRAW,n,i),e),afterAnimate:n=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.DRAW,n,i),e),after:()=>this.emit(new yV(t.GraphEvent.AFTER_DRAW,{dataChanges:r,animation:c}),e)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),r=QL(n);if(0===r.length)return null;const{NodeAdded:i=[],NodeUpdated:o=[],NodeRemoved:a=[],EdgeAdded:s=[],EdgeUpdated:c=[],EdgeRemoved:u=[],ComboAdded:l=[],ComboUpdated:h=[],ComboRemoved:d=[]}=$t(r,(t=>t.type)),f=t=>new Map(t.map((t=>{const e=t.value;return[Gu(e),e]}))),p={add:{nodes:f(i),edges:f(s),combos:f(l)},update:{nodes:f(o),edges:f(c),combos:f(h)},remove:{nodes:f(a),edges:f(u),combos:f(d)}},g=this.transformData(p,t);return e.clearChanges(),{dataChanges:n,drawData:g}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce(((t,n)=>n.beforeDraw(t,e)),t)}createElement(e,n,r){const i=Gu(n);if(this.getElement(i))return;const o=this.getElementType(e,n),a=this.getElementComputedStyle(e,n),s=KV(e,o);if(!s)return;this.emit(new bV(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n),r);const c=this.container.appendChild(new s({id:i,style:{context:this.context,...a}}));this.shapeTypeMap[i]=o,this.elementMap[i]=c;const{stage:u="enter"}=r;this.context.animation?.add({element:c,elementType:e,stage:u,originalStyle:{...c.attributes},modifiedStyle:{...c.attributes,...a}},{after:()=>{this.emit(new bV(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n),r),c.onCreate?.()}})}createElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.createElement(t,n,e)))}))}updateElement(e,n,r){const i=Gu(n),o=this.getElement(i);if(!o)return()=>null;this.emit(new bV(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n),r);const a=this.getElementType(e,n),s=this.getElementComputedStyle(e,n);this.shapeTypeMap[i]!==a&&(o.destroy(),delete this.shapeTypeMap[i],delete this.elementMap[i],this.createElement(e,n,{animation:!1,silence:!0}));const{stage:c="update"}=r,u="visibility"!==c?c:"hidden"===s.visibility?"hide":"show";this.context.animation?.add({element:o,elementType:e,stage:u,originalStyle:{...o.attributes},modifiedStyle:{...o.attributes,...s}},{before:()=>{"collapse"!==c&&Fd(o,s),"visibility"===c&&(fh(o,"opacity")||hh(o,"opacity"),ph(o,"visibility","show"===u?"visible":"hidden"),"show"===u&&Fd(o,{visibility:"visible"}))},after:()=>{"collapse"===c&&Fd(o,s),"hide"===u&&Fd(o,{visibility:dh(o,"visibility")}),this.emit(new bV(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n),r),o.onUpdate?.()}})}updateElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.updateElement(t,n,e)))}))}markDestroyElement(t){Object.values(t.remove).forEach((t=>{t.forEach((t=>{const e=Gu(t),n=this.getElement(e);n&&function(t){ge(t,"__to_be_destroyed__",!0)}(n)}))}))}destroyElement(e,n,r){const{stage:i="exit"}=r,o=Gu(n),a=this.elementMap[o];if(!a)return()=>null;this.emit(new bV(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n),r),this.context.animation?.add({element:a,elementType:e,stage:i,originalStyle:{...a.attributes},modifiedStyle:{...a.attributes}},{after:()=>{this.clearElement(o),a.destroy(),a.onDestroy?.(),this.emit(new bV(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n),r)}})}destroyElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["combo",i],["edge",r],["node",n]].forEach((([t,n])=>{n.forEach((n=>this.destroyElement(t,n,e)))}))}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}async collapseNode(e,n){const{model:r,layout:i}=this.context,o=this.computeChangesAndDrawData({stage:"collapse",animation:n});this.markDestroyElement(o.drawData);const a=await i.simulate();r.updateData(a);const{drawData:s}=this.computeChangesAndDrawData({stage:"collapse",animation:n}),{add:c,remove:u,update:l}=s;this.markDestroyElement(s);const h={animation:n,stage:"collapse",data:s};this.destroyElements(u,h),this.createElements(c,h),this.updateElements(l,h),await(this.context.animation.animate(n,{beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.COLLAPSE,e,s),h),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.COLLAPSE,e,s),h)},{collapse:{target:e,descendants:Array.from(u.nodes).map((([,t])=>Gu(t))),position:Pl(l.nodes.get(e))}})?.finished)}async expandNode(e,n){const{model:r,layout:i}=this.context;if(!r.getAncestorsData(e,Ru).every((t=>th(t))))return;const o=Pl(r.getNodeData([e])[0]),{drawData:{add:a}}=this.computeChangesAndDrawData({stage:"collapse",animation:n});this.createElements(a,{animation:!1,stage:"expand"}),this.context.animation.clear();const s=await i.simulate();r.updateData(s),this.computeStyle("expand");const{drawData:c}=this.computeChangesAndDrawData({stage:"collapse",animation:n}),{update:u}=c,l={animation:n,stage:"expand",data:c};a.edges.forEach((t=>{const e=Gu(t);u.edges.has(e)||u.edges.set(e,t)})),this.updateElements(u,l),await(this.context.animation.animate(n,{beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.EXPAND,e,c),l),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.EXPAND,e,c),l)},{expand:{target:e,descendants:Array.from(a.nodes).map((([,t])=>Gu(t))),position:o}})?.finished)}async collapseCombo(e,n){const{model:r,element:i}=this.context;if(r.getAncestorsData(e,Ru).some((t=>th(t))))return;const o=i.getElement(e),a=o.getComboPosition({...o.attributes,collapsed:!0}),{dataChanges:s,drawData:c}=this.computeChangesAndDrawData({stage:"collapse",animation:n});this.markDestroyElement(c);const{update:u,remove:l}=c,h={animation:n,stage:"collapse",data:c};this.destroyElements(l,h),this.updateElements(u,h);const d=t=>Array.from(t).map((([,t])=>Gu(t)));await(this.context.animation.animate(n,{before:()=>this.emit(new yV(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:n}),h),beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.COLLAPSE,e,c),h),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.COLLAPSE,e,c),h),after:()=>this.emit(new yV(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:n}),h)},{collapse:{target:e,descendants:[...d(l.nodes),...d(l.combos)],position:a}})?.finished)}async expandCombo(e,n){const{model:r}=this.context,i=Pl(r.getComboData([e])[0]);this.computeStyle("expand");const{dataChanges:o,drawData:a}=this.computeChangesAndDrawData({stage:"expand",animation:n}),{add:s,update:c}=a,u={animation:n,stage:"expand",data:a};this.createElements(s,u),this.updateElements(c,u);const l=t=>Array.from(t).map((([,t])=>Gu(t)));await(this.context.animation.animate(n,{before:()=>this.emit(new yV(t.GraphEvent.BEFORE_DRAW,{dataChanges:o,animation:n}),u),beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.EXPAND,e,a),u),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.EXPAND,e,a),u),after:()=>this.emit(new yV(t.GraphEvent.AFTER_DRAW,{dataChanges:o,animation:n}),u)},{expand:{target:e,descendants:[...l(s.nodes),...l(s.combos)],position:i}})?.finished)}getFrontZIndex(t){const{model:e}=this.context,n=e.getElementType(t),r=e.getElementDataById(t),i=e.getData();if(Object.assign(i,{[`${n}s`]:i[`${n}s`].filter((e=>Gu(e)!==t))}),"combo"===n&&!th(r)){const n=e.getAncestorsData(t,Ru).map(Gu);i.nodes=i.nodes.filter((t=>!n.includes(Gu(t)))),i.combos=i.combos.filter((t=>!n.includes(Gu(t)))),i.edges=i.edges.filter((({source:t,target:e})=>n.includes(t)&&n.includes(e)))}return Math.max(0,...Object.values(i).flat().map((t=>{const e=Gu(t);return this.getElementZIndex(e)})))+1}destroy(){this.container.destroy(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={},this.context={}}}class DV{context;supervisor;instance;instances=[];animationResult;get presetOptions(){return{animation:!!Fu(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.context=t}getLayoutInstance(){return this.instances}async layout(){if(!this.options)return;const e=Array.isArray(this.options)?this.options:[this.options],{graph:n}=this.context;wV(n,new yV(t.GraphEvent.BEFORE_LAYOUT));for(const r of e){const i=e.indexOf(r),o=this.getLayoutData(r),a={...this.presetOptions,...r};wV(n,new yV(t.GraphEvent.BEFORE_STAGE_LAYOUT,{options:a,index:i}));const s=await this.stepLayout(o,a,i);wV(n,new yV(t.GraphEvent.AFTER_STAGE_LAYOUT,{options:a,index:i})),r.animation||this.updateElementPosition(s,!1)}wV(n,new yV(t.GraphEvent.AFTER_LAYOUT))}async simulate(){if(!this.options)return{};const t=Array.isArray(this.options)?this.options:[this.options];let e={};for(const n of t){const r=t.indexOf(n),i=this.getLayoutData(n);e=await this.stepLayout(i,{...this.presetOptions,...n,animation:!1},r)}return e}async stepLayout(t,e,n){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?await this.treeLayout(t,e,n):await this.graphLayout(t,e,n)}async graphLayout(t,e,n){const{animation:r,enableWorker:i,iterations:o=300}=e,a=this.initGraphLayout(e);if(this.instances[n]=a,this.instance=a,i){const e=a;return this.supervisor=new JD(e.graphData2LayoutModel(t),e.instance,{iterations:o}),Jd(await this.supervisor.execute())}if(RD(a))return r?await a.execute(t,{onTick:t=>{this.updateElementPosition(t,!1)}}):(a.execute(t),a.stop(),a.tick(o));const s=await a.execute(t);return r&&this.updateElementPosition(s,r),s}async treeLayout(t,e,n){const{type:r,animation:i}=e,o=KV("layout",r);if(!o)throw new Error(`The layout type ${r} is not found`);const{nodes:a=[],edges:s=[]}=t,c=new Zd({nodes:a.map((t=>({id:Gu(t),data:t.data||{}}))),edges:s.map((t=>({id:Gu(t),source:t.source,target:t.target,data:t.data||{}})))});!function(t){if(t.hasTreeStructure(_u))return;t.attachTreeStructure(_u);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,_u)}}(c);const u={nodes:[],edges:[]};return c.getRoots(_u).forEach((t=>{Kl(t,(t=>{t.children=c.getSuccessors(t.id)}),(t=>c.getSuccessors(t.id)),"TB");Kl(o(t,e),(t=>{const{id:e,x:n,y:r,z:i=0}=t;u.nodes.push({id:e,style:{x:n,y:r,z:i}})}),(t=>t.children),"TB")})),i&&this.updateElementPosition(u,i),u}stopLayout(){this.instance&&RD(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=(()=>!0)}=t,{nodes:n,edges:r,combos:i}=this.context.model.getData(),o=t=>this.context.element.getElement(t),a=n.filter((t=>{const n=Gu(t),r=o(n);return!!r&&(!zd(r)&&e(t))})),s=new Map(a.map((t=>[Gu(t),t])));return{nodes:a,edges:r.filter((t=>{const{source:e,target:n}=t;return!(!s.has(e)||!s.has(n))})),combos:i}}initGraphLayout(t){const{element:e,viewport:n}=this.context,{type:r,enableWorker:i,animation:o,iterations:a,...s}=t,[c,u]=n.getCanvasSize(),l=[c/2,u/2],h=t?.nodeSize??(t=>{const n=e?.getElement(t.id),{size:r}=n?.attributes||{};return Math.max(...ah(r))}),d=KV("layout",r);if(!d)throw new Error(`The layout type ${r} is not found`);const f=Object.getPrototypeOf(d.prototype)===Qd.prototype?d:function(t,e){return class extends Qd{instance;id;constructor(e,n){if(super(e,n),this.instance=new t({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const t=this.instance;this.stop=t.stop.bind(t),this.tick=e=>Jd(t.tick(e))}}async execute(t,e){return Jd(await this.instance.execute(this.graphData2LayoutModel(t),this.transformOptions(le({},this.options,e))))}transformOptions(t){const{onTick:e}=t;return e?(t.onTick=t=>e(Jd(t)),t):t}graphData2LayoutModel(t){const{nodes:n=[],edges:r=[],combos:i=[]}=t,o=n.map((t=>{const e=Gu(t),{data:n,style:r,combo:i}=t;return{id:e,data:{...n,...i?{parentId:i}:{}},style:{...r}}})),a=new Map(o.map((t=>[t.id,t]))),s=r.filter((t=>{const{source:e,target:n}=t;return a.has(e)&&a.has(n)})).map((t=>{const{source:e,target:n,data:r,style:i}=t;return{id:Gu(t),source:e,target:n,data:{...r},style:{...i}}})),c=i.map((t=>({id:Gu(t),data:{_isCombo:!0,...t.data},style:{...t.style}}))),u=new Zd({nodes:[...o,...c],edges:s});return e.model.model.hasTreeStructure(Ru)&&(u.attachTreeStructure(Ru),o.forEach((t=>{const n=e.model.model.getParent(t.id,Ru);n&&u.hasNode(n.id)&&u.setParent(t.id,n.id,Ru)}))),u}}}(d,this.context),p=new f(this.context),g={nodeSize:h,width:c,height:u,center:l};switch(p.id){case"d3-force":case"d3-force-3d":Object.assign(g,{center:{x:c/2,y:u/2,z:0}})}return le(p.options,g,s),p}updateElementPosition(t,e){const{model:n,element:r}=this.context;return r?(n.updateData(t),r.draw({animation:e,silence:!0})):null}destroy(){this.stopLayout(),this.context={},this.supervisor?.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}class LV extends tl{category="plugin";constructor(t){super(t),this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){return this.extensionMap[t]}}const IV=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class jV extends tl{category="transform";constructor(t){super(t),this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...IV.slice(0,IV.length-1),...t,IV[IV.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}class BV{context;get padding(){return ol(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,a]=[(r-e)/2,(t-n)/2,0];return[i,o,a]}constructor(t){this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:a=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,a],rotate:i},!1)}get camera(){return this.context.canvas.getCamera()}landmarkCounter=0;createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=Fu(this.context.options,t);return!!e&&ye({...e},["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),a=e.getFocalPoint(),[s,c]=this.getCanvasCenter(),[u=0,l=0,h=0]=r,d=bl([-u,-l,-h],i);return"relative"===n?{position:ml(o,d),focalPoint:ml(a,d)}:{position:ml([s,c,o[2]],d),focalPoint:ml([s,c,a[2]],d)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return Ut("relative"===r?n*i:i,...e)}async transform(e,n){const{graph:r}=this.context,{translate:i,rotate:o,scale:a}=e;this.cancelAnimation(),wV(r,new xV(t.GraphEvent.BEFORE_TRANSFORM,e));const s=this.getAnimation(n),c={};if(i&&Object.assign(c,this.getTranslateOptions(e)),Yt(o)&&Object.assign(c,this.getRotateOptions(e)),Yt(a)&&Object.assign(c,{zoom:this.getZoomOptions(e)}),s)return wV(r,new vV(t.GraphEvent.BEFORE_ANIMATE,Su.TRANSFORM,null,e)),new Promise((n=>{this.camera.gotoLandmark(this.createLandmark(c),{...s,onfinish:()=>{wV(r,new vV(t.GraphEvent.AFTER_ANIMATE,Su.TRANSFORM,null,e)),wV(r,new xV(t.GraphEvent.AFTER_TRANSFORM,e)),n()}})}));this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),wV(r,new xV(t.GraphEvent.AFTER_TRANSFORM,e))}async fitView(t,e){const[n,r,i,o]=this.padding,{when:a="always",direction:s="both"}=t||{},[c,u]=this.context.canvas.getSize(),l=c-o-r,h=u-n-i,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[p,g]=cl(f);if("overflow"===a&&!("x"===s&&p>=l||"y"===s&&g>=h||"both"===s&&p>=l&&g>=h))return await this.fitCenter(e);const m=l/p,y=h/g,v="x"===s?m:"y"===s?y:Math.min(m,y),b=this.getAnimation(e);await this.transform({mode:"relative",scale:v,translate:ml(yl(this.getCanvasCenter(),this.getBBoxInViewport(d).center),bl(this.paddingOffset,v))},b)}async fitCenter(t){const e=this.context.canvas.getBounds();await this.focus(e,t)}async focusElements(t,e){const{element:n}=this.context;if(!n)return;const r=hl(t.map((t=>n.getElement(t).getRenderBounds())));await this.focus(r,e)}async focus(t,e){const{center:n}=this.getBBoxInViewport(t),r=yl(this.getCanvasCenter(),n);await this.transform({mode:"relative",translate:ml(r,this.paddingOffset)},e)}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[a,s]=r.getViewportByCanvas(n),c=new Ar;return c.setMinMax([i,o,0],[a,s,0]),c}cancelAnimation(){this.camera.landmarks?.length&&this.camera.cancelLandmarkAnimation()}}class FV extends Ud{options;static defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};destroyed=!1;context={model:new RV};constructor(t){super(),this.options=Object.assign({},FV.defaultOptions,t),this.setOptions(this.options),this.context.graph=this,this.options.autoResize&&window.addEventListener("resize",this.onResize)}getOptions(){return this.options}setOptions(t){const{background:e,behaviors:n,combo:r,data:i,edge:o,height:a,layout:s,node:c,plugins:u,theme:l,transforms:h,width:d}=t;Object.assign(this.options,t),e&&this.setBackground(e),n&&this.setBehaviors(n),r&&this.setCombo(r),i&&this.setData(i),o&&this.setEdge(o),s&&this.setLayout(s),c&&this.setNode(c),l&&this.setTheme(l),u&&this.setPlugins(u),h&&this.setTransforms(h),(Yt(d)||Yt(a))&&this.setSize(d??this.options.width??0,a??this.options.height??0)}setBackground(t){this.options.background=t,this.context.canvas?.setBackground(t)}getBackground(){return this.options.background}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){Object.assign(this.options,{width:t,height:e}),this.context.canvas?.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Rt(t)?t(this.getTheme()):t;const{background:e}=KV("theme",this.options.theme)||{};e&&!this.options.background&&this.setBackground(e)}setLayout(t){this.options.layout=Rt(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){this.options.behaviors=Rt(t)?t(this.getBehaviors()):t,this.context.behavior?.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors((e=>e.map((e=>"object"==typeof e&&e.key===t.key?{...e,...t}:e))))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){this.options.plugins=Rt(t)?t(this.getPlugins()):t,this.context.plugin?.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins((e=>e.map((e=>"object"==typeof e&&e.key===t.key?{...e,...t}:e))))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){this.options.transforms=Rt(t)?t(this.getTransforms()):t,this.context.transform?.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms((e=>e.map((e=>"object"==typeof e&&e.key===t.key?{...e,...t}:e)))),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map((t=>this.context.model.getElementDataById(t))):this.context.model.getElementDataById(t)}getNodeData(t){return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):this.context.model.getNodeData([t])?.[0]}getEdgeData(t){return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):this.context.model.getEdgeData([t])?.[0]}getComboData(t){return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):this.context.model.getComboData([t])?.[0]}setData(t){this.context.model.setData(Rt(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Rt(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Rt(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Rt(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Rt(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Rt(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Rt(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Rt(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Rt(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Rt(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Rt(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Rt(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Rt(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}async initCanvas(){if(this.context.canvas)return await this.context.canvas.init();const{container:e="container",width:n,height:r,renderer:i,background:o}=this.options;if(e instanceof CV)this.context.canvas=e,e.setBackground(o),await e.init();else{const a=Wt(e)?document.getElementById(e):e,s=eL(a);this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:a,width:n,height:r});const c=new CV({container:a,width:n||s[0],height:r||s[1],background:o,renderer:i});this.context.canvas=c,await c.init(),this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:c})}}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new MV(this.context)),this.context.plugin||(this.context.plugin=new LV(this.context)),this.context.viewport||(this.context.viewport=new BV(this.context)),this.context.transform||(this.context.transform=new jV(this.context)),this.context.element||(this.context.element=new _V(this.context)),this.context.animation||(this.context.animation=new EV(this.context)),this.context.layout||(this.context.layout=new DV(this.context)),this.context.behavior||(this.context.behavior=new SV(this.context))}async prepare(){if(await Promise.resolve(),this.destroyed)throw new Error("Graph has been destroyed");await this.initCanvas(),this.initRuntime()}async render(){await this.prepare(),wV(this,new yV(t.GraphEvent.BEFORE_RENDER));const e=this.context.element.draw();await Promise.all([e?.finished,this.context.layout.layout()]),await this.autoFit(),wV(this,new yV(t.GraphEvent.AFTER_RENDER))}async draw(){await this.prepare(),await(this.context.element.draw()?.finished),await this.autoFit()}async layout(){await this.context.layout.layout()}stopLayout(){this.context.layout.stopLayout()}async clear(){this.context.model.setData({}),await this.draw()}destroy(){wV(this,new yV(t.GraphEvent.BEFORE_DESTROY));const{layout:e,animation:n,element:r,model:i,canvas:o,behavior:a,plugin:s}=this.context;s?.destroy(),a?.destroy(),e?.destroy(),n?.destroy(),r?.destroy(),i.destroy(),o?.destroy(),this.options={},this.context={},this.off(),window.removeEventListener("resize",this.onResize),this.destroyed=!0,wV(this,new yV(t.GraphEvent.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,n){const r=e&&n?[e,n]:eL(this.context.canvas.getContainer());fe(r,this.getSize())||(wV(this,new yV(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:r})),this.context.canvas.resize(...r),wV(this,new yV(t.GraphEvent.AFTER_SIZE_CHANGE,{size:r})))}async fitView(t,e){await(this.context.viewport?.fitView(t,e))}async fitCenter(t){await(this.context.viewport?.fitCenter(t))}async autoFit(){const{autoFit:t}=this.context.options;if(t)if(Wt(t))"view"===t?await this.fitView():"center"===t&&await this.fitCenter();else{const{type:e,animation:n}=t;"view"===e?await this.fitView(t.options,n):"center"===e&&await this.fitCenter(n)}}async focusElement(t,e){await(this.context.viewport?.focusElements(Array.isArray(t)?t:[t],e))}async zoomBy(t,e,n){await this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)}async zoomTo(t,e,n){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)}getZoom(){return this.context.viewport.getZoom()}async rotateBy(t,e,n){await this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)}async rotateTo(t,e,n){await this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)}getRotation(){return this.context.viewport.getRotation()}async translateBy(t,e){await this.context.viewport.transform({mode:"relative",translate:t},e)}async translateTo(t,e){await this.context.viewport.transform({mode:"absolute",translate:t},e)}getPosition(){return yl([0,0],this.getCanvasByViewport([0,0]))}async translateElementBy(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeLikeBy(t,e))),await(this.context.element.draw({animation:i,stage:"translate"})?.finished)}async translateElementTo(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeLikeTo(t,e))),await(this.context.element.draw({animation:i,stage:"translate"})?.finished)}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return ve(this.context.element.getElement(t).attributes,["context"])}async setElementVisibility(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);o[`${n}s`].push({id:t,style:{visibility:e}})}));const{model:a,element:s}=this.context;a.preventUpdateNodeLikeHierarchy((()=>{a.updateData(o)})),await(s.draw({animation:i,stage:"visibility"})?.finished)}async showElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"visible"]))),e)}async hideElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"hidden"]))),e)}getElementVisibility(t){const e=this.context.element.getElement(t);return e?.style?.visibility??"visible"}async setElementZIndex(t,e){const n={nodes:[],edges:[],combos:[]},r=jt(t)?t:{[t]:e};Object.entries(r).forEach((([t,e])=>{const r=this.getElementType(t);n[`${r}s`].push({id:t,style:{zIndex:e}})}));const{model:i,element:o}=this.context;i.preventUpdateNodeLikeHierarchy((()=>i.updateData(n))),await(o.draw({animation:!1,stage:"zIndex"})?.finished)}async frontElement(t){const e=Array.isArray(t)?t:[t],{model:n,element:r}=this.context,i={};e.map((t=>{const e=r.getFrontZIndex(t);if("combo"===n.getElementType(t)){const o=n.getAncestorsData(t,Ru).at(-1)||this.getComboData(t),a=[o,...n.getDescendantsData(Gu(o))],s=e-r.getElementZIndex(t);a.forEach((t=>{i[Gu(t)]=this.getElementZIndex(Gu(t))+s}))}else i[t]=e})),await this.setElementZIndex(i)}getElementZIndex(t){const{model:e,element:n}=this.context;return e.getElementDataById(t)?.style?.zIndex??n.getElementZIndex(t)}async setElementState(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);var r;o[`${n}s`].push({id:t,states:(r=e,r?Array.isArray(r)?r:[r]:[])})})),this.updateData(o),await(this.context.element.draw({animation:i})?.finished)}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}isCollapsingExpanding=!1;async collapseElement(t,e=!0){const{model:n,element:r}=this.context;if(th(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;const i=n.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!0),"node"===i?await r.collapseNode(t,e):"combo"===i&&await r.collapseCombo(t,e),this.isCollapsingExpanding=!1}async expandElement(t,e=!0){const{model:n,element:r}=this.context;if(!th(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;const i=n.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!1),"node"===i?await r.expandNode(t,e):"combo"===i&&await r.expandCombo(t,e),this.isCollapsingExpanding=!1}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}async toDataURL(t={}){return this.context.canvas.toDataURL(t)}getCanvasByViewport(t){return Rl(this.context.canvas.viewport2Canvas(_l(t)))}getViewportByCanvas(t){return Rl(this.context.canvas.canvas2Viewport(_l(t)))}getClientByCanvas(t){const e=this.context.canvas.canvas2Viewport(_l(t));return Rl(this.context.canvas.viewport2Canvas(e))}getCanvasByClient(t){const e=this.context.canvas.client2Viewport(_l(t));return Rl(this.context.canvas.viewport2Canvas(e))}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}onResize=se((()=>{this.resize()}),300);on(t,e){return super.on(t,e)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}const zV=(t,e)=>{const{source:n,target:r}=e,i=t.getElementDataById(n),o=t.getElementDataById(r),a=gd(i,(e=>t.getParentData(e,Ru))),s=gd(o,(e=>t.getParentData(e,Ru))),c={sourceNode:Gu(a),targetNode:Gu(s)};return e.style?Object.assign(e.style,c):e.style=c,e},GV=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class VV extends fV{static defaultOptions={mode:"bundle",edges:void 0,distance:15};cacheMergeStyle=new Map;constructor(t,e){super(t,Object.assign({},VV.defaultOptions,e))}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return 0===e.size||("bundle"===this.options.mode?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}getAffectedParallelEdges=t=>{const{add:{edges:e},update:{nodes:n,edges:r,combos:i},remove:{edges:o}}=t,{model:a}=this.context,s=new Map,c=(t,e)=>{a.getRelatedEdgesData(e).forEach((t=>!s.has(Gu(t))&&s.set(Gu(t),t)))};n.forEach(c),i.forEach(c);const u=t=>{const e=a.getEdgeData().map((t=>zV(a,t)));HV(t,e).forEach((t=>!s.has(Gu(t))&&s.set(Gu(t),t)))};if(o.size&&o.forEach(u),e.size&&e.forEach(u),r.size){const t=JL(QL(a.getChanges())).update.edges;r.forEach((e=>{u(e);const n=t.find((t=>Gu(t.value)===Gu(e)))?.original;n&&!$V(e,n)&&u(n)}))}de(this.options.edges)||s.forEach(((t,e)=>!this.options.edges.includes(e)&&s.delete(e)));const l=a.getEdgeData().map(Gu);return new Map([...s].sort(((t,e)=>l.indexOf(t[0])-l.indexOf(e[0]))))};applyBundlingStyle=(t,e,n)=>{const{edgeMap:r,reverses:i}=WV(e);r.forEach((e=>{e.forEach(((e,r,o)=>{const a=Object.assign(e,{type:"quadratic",style:(()=>{const t=o.length,a={};if(e.source===e.target){const t=GV.length;a.loopPlacement=GV[r%t],a.loopDist=Math.floor(r/t)*n+50}else if(1===t)a.curveOffset=0;else{const o=(r%2==0?1:-1)*(i[`${e.source}|${e.target}|${r}`]?-1:1);a.curveOffset=t%2==1?o*Math.ceil(r/2)*n*2:o*(Math.floor(r/2)*n*2+n)}return Object.assign({},e.style,a)})()}),s=this.context.element?.getElement(Gu(e));$u(t,s?"update":"add","edge",a,!0)}))}))};resetEdgeStyle=t=>{const e=t.style||{},n=this.cacheMergeStyle.get(Gu(t))||{};return Object.keys(n).forEach((r=>{fe(e[r],n[r])&&(t[r]?e[r]=t[r]:delete e[r])})),Object.assign(t,{style:e})};applyMergingStyle=(t,e)=>{const{edgeMap:n,reverses:r}=WV(e);n.forEach((e=>{if(1===e.length){const n=e[0],r=this.context.element?.getElement(Gu(n));return void $u(t,r?"update":"add","edge",this.resetEdgeStyle(n),!0)}const n=e.map((({source:t,target:e,style:n={}},i)=>{const{startArrow:o,endArrow:a}=n,s={},[c,u]=r[`${t}|${e}|${i}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return re(o)&&(s[c]=o),re(a)&&(s[u]=a),s})).reduce(((t,e)=>({...t,...e})),{});e.forEach(((e,r,i)=>{if(0===r){const r=Object.assign({},Rt(this.options.style)?this.options.style(i):this.options.style,{childrenData:i});this.cacheMergeStyle.set(Gu(e),r);const o={...e,type:"line",style:{...n,...r}},a=this.context.element?.getElement(Gu(e));$u(t,a?"update":"add","edge",o,!0)}else $u(t,"remove","edge",e)}))}))}}const WV=t=>{const e=new Map,n=new Set,r={};for(const[i,o]of t){if(n.has(i))continue;const{source:a,target:s}=o,c=`${a}-${s}`;e.has(c)||e.set(c,[]),e.get(c).push(o),n.add(i);for(const[i,u]of t)n.has(i)||$V(o,u)&&(e.get(c).push(u),n.add(i),a===u.target&&s===u.source&&(r[`${u.source}|${u.target}|${e.get(c).length-1}`]=!0))}return{edgeMap:e,reverses:r}},HV=(t,e,n)=>e.filter((e=>$V(e,t))),$V=(t,e)=>{const{sourceNode:n,targetNode:r}=t.style||{},{sourceNode:i,targetNode:o}=e.style||{};return n===i&&r===o||n===o&&r===i};const UV={animation:{"combo-collapse":Zu,"combo-expand":Qu,"node-collapse":Yu,"node-expand":qu,"path-in":Ku,"path-out":Xu,fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}]},behavior:{"zoom-canvas":cf,"drag-canvas":Hd,"drag-element":$d,"drag-element-force":nf,"scroll-canvas":sf,"collapse-expand":Gd,"click-select":Ql,"hover-activate":of,"focus-element":rf,"create-edge":Wd,"brush-select":$l,"lasso-select":af},combo:{circle:Yh,rect:qh},edge:{cubic:bd,line:Ed,polyline:Md,quadratic:Sd,"cubic-horizontal":xd,"cubic-vertical":wd},layout:{"antv-dagre":xm,"combo-combined":nv,"compact-box":mp.compactBox,"force-atlas2":uD,circular:Sm,concentric:Tm,"d3-force":Uv,dagre:iD,dendrogram:mp.dendrogram,force:Xm,fruchterman:hD,grid:fD,indented:mp.indented,mds:Zy,mindmap:mp.mindmap,radial:SD,random:OD},node:{circle:_h,diamond:Lh,ellipse:Fh,hexagon:zh,html:Gh,image:Vh,rect:Wh,star:Hh,donut:Ih,triangle:$h},palette:{spectral:["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],tableau:["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],oranges:["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],greens:["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],blues:["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"]},theme:{dark:hV,light:dV},plugin:{"bubble-sets":UL,"grid-line":ZL,background:oL,contextmenu:KL,fullscreen:XL,history:nI,hull:CI,legend:Qz,timebar:QG,toolbar:nV,tooltip:rV,watermark:aV},transform:{"update-related-edges":class extends fV{beforeDraw(t,e){const{stage:n}=e;if("visibility"===n)return t;const{model:r}=this.context,{update:{nodes:i,edges:o,combos:a}}=t,s=(t,e)=>{r.getRelatedEdgesData(e).forEach((t=>!o.has(Gu(t))&&o.set(Gu(t),t)))};return i.forEach(s),a.forEach(s),t}},"arrange-draw-order":class extends fV{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,r=t=>{const n=[];return t.forEach(((t,r)=>{const i=e.getAncestorsData(r,"combo").map((t=>Gu(t))).reverse();n.push([r,t,i.length])})),new Map(n.sort((([,,t],[,,e])=>e-t)).map((([t,e])=>[t,e])))};return t.add.combos=r(n),t.update.combos=r(t.update.combos),t}},"collapse-expand-combo":class extends fV{beforeDraw(t,e){if("visibility"===e.stage)return t;const{model:n}=this.context,{add:r,update:i}=t,o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[e,a]=o.pop();if(th(a)){const a=n.getDescendantsData(e),s=a.map(Gu),{internal:c,external:u}=pd(s,(t=>n.getRelatedEdgesData(t)));a.forEach((e=>{const r=Gu(e),i=o.findIndex((([t])=>t===r));-1!==i&&o.splice(i,1);const a=n.getElementType(r);pV(t,"remove",a,e)})),c.forEach((e=>pV(t,"remove","edge",e))),u.forEach((t=>{const e=Gu(t),n=this.context.element?.getElement(e);n?i.edges.set(e,t):r.edges.set(e,t)}))}else{const r=n.getChildrenData(e),i=r.map(Gu),{edges:a}=pd(i,(t=>n.getRelatedEdgesData(t)));[...r,...a].forEach((e=>{const r=Gu(e),i=n.getElementType(r),a=this.context.element?.getElement(r);pV(t,a?"update":"add",i,e),"combo"===i&&o.push([r,e])}))}}return t}},"collapse-expand-node":class extends fV{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(gV(e,"add","node",t),th(t))return;const n=Gu(t);gV(e,"add","node",t);this.context.model.getRelatedEdgesData(n,"out").forEach((t=>{pV(e,"add","edge",t)}));this.context.model.getChildrenData(n).forEach((t=>{this.handleExpand(t,e)}))}beforeDraw(t){const{graph:e,model:n}=this.context,{add:{nodes:r,edges:i},update:{nodes:o}}=t,a=new Map,s=new Map;r.forEach(((t,e)=>{th(t)&&a.set(e,t)})),i.forEach((t=>{if("node"!==e.getElementType(t.source))return;const n=e.getNodeData(t.source);th(n)&&a.set(t.source,n)})),o.forEach(((t,e)=>{const n=this.getElement(e);if(!n)return;const r=n.attributes.collapsed;th(t)?r||a.set(e,t):r&&s.set(e,t)}));const c=new Set;return a.forEach(((e,r)=>{n.getDescendantsData(r).forEach((e=>{const r=Gu(e);if(c.has(r))return;pV(t,"remove","node",e);n.getRelatedEdgesData(r).forEach((e=>{pV(t,"remove","edge",e)})),c.add(r)}))})),s.forEach(((e,r)=>{n.getAncestorsData(r,_u).some(th)?pV(t,"remove","node",e):this.handleExpand(e,t)})),t}},"process-parallel-edges":VV,"get-edge-actual-ends":class extends fV{beforeDraw(t){const{add:e,update:n}=t,{model:r}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach((([,t])=>{zV(r,t)})),t}}}},YV={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{}};function qV(t,e,n){const r=YV[t][e];r?r!==n&&console.error(`The extension ${e} of ${t} has been registered before.`):Object.assign(YV[t],{[e]:n})}function KV(t,e){const n=YV[t]?.[e];if(n)return n}Cs.enableCSSParsing=!1,Object.entries(UV).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{qV(t,e,n)}))}));t.AntVDagreLayout=xm,t.Badge=Nh,t.BaseBehavior=nl,t.BaseCombo=Uh,t.BaseEdge=vd,t.BaseLayout=Qd,t.BaseNode=Rh,t.BasePlugin=iL,t.BaseShape=Mh,t.BaseTransform=fV,t.BrushSelect=$l,t.BubbleSets=UL,t.CameraSetting=class extends iL{constructor(t,e){super(t,e),this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,(()=>this.setOptions(this.options)))}setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach((([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}}))};getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Circle=_h,t.CircleCombo=Yh,t.CircularLayout=Sm,t.ClickSelect=Ql,t.CollapseExpand=Gd,t.ComboCombinedLayout=nv,t.ConcentricLayout=Tm,t.Contextmenu=KL,t.CreateEdge=Wd,t.Cubic=bd,t.CubicHorizontal=xd,t.CubicVertical=wd,t.D3ForceLayout=Uv,t.DagreLayout=iD,t.Diamond=Lh,t.Donut=Ih,t.DragCanvas=Hd,t.DragElement=$d,t.DragElementForce=nf,t.Ellipse=Fh,t.FocusElement=rf,t.ForceAtlas2Layout=uD,t.ForceLayout=Xm,t.FruchtermanLayout=hD,t.Fullscreen=XL,t.Graph=FV,t.GridLayout=fD,t.GridLine=ZL,t.HTML=Gh,t.Hexagon=zh,t.History=nI,t.HoverActivate=of,t.Hull=CI,t.Icon=Ph,t.Image=Vh,t.Label=Sh,t.LassoSelect=af,t.Legend=Qz,t.Line=Ed,t.MDSLayout=Zy,t.Polyline=Md,t.Quadratic=Sd,t.RadialLayout=SD,t.RandomLayout=OD,t.Rect=Wh,t.RectCombo=qh,t.ScrollCanvas=sf,t.Shortcut=Hl,t.Star=Hh,t.Timebar=QG,t.Toolbar=nV,t.Tooltip=rV,t.Triangle=$h,t.Watermark=aV,t.ZoomCanvas=cf,t.compactBox=mp.compactBox,t.dendrogram=mp.dendrogram,t.getExtension=KV,t.getExtensions=function(t){return YV[t]},t.iconfont={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"},t.idOf=Gu,t.indented=mp.indented,t.invokeLayoutMethod=tf,t.isCollapsed=th,t.mindmap=mp.mindmap,t.omitStyleProps=oh,t.parseSize=ah,t.register=qV,t.subStyleProps=rh,t.treeToGraphData=function(t,e){const{getNodeData:n=(t=>{if(!t.children)return t;const{children:e,...n}=t;return{...n,children:e.map((t=>t.id))}}),getEdgeData:r=((t,e)=>({source:t.id,target:e.id})),getChildren:i=(t=>t.children||[])}=e||{},o=[],a=[];return Kl(t,(t=>{o.push(n(t));const e=i(t);for(const n of e)a.push(r(t,n))}),(t=>i(t)),"TB"),{nodes:o,edges:a}},t.version="5.0.5"}));
|
|
6
|
+
*/const _D=Symbol("Comlink.proxy"),DD=Symbol("Comlink.endpoint"),LD=Symbol("Comlink.releaseProxy"),ID=Symbol("Comlink.finalizer"),jD=Symbol("Comlink.thrown"),BD=t=>"object"==typeof t&&null!==t||"function"==typeof t,FD=new Map([["proxy",{canHandle:t=>BD(t)&&t[_D],serialize(t){const{port1:e,port2:n}=new MessageChannel;return zD(t,e),[n,[n]]},deserialize:t=>(t.start(),VD(t))}],["throw",{canHandle:t=>BD(t)&&jD in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function zD(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(ZD);let u;try{const e=s.slice(0,-1).reduce(((t,e)=>t[e]),t),n=s.reduce(((t,e)=>t[e]),t);switch(a){case"GET":u=n;break;case"SET":e[s.slice(-1)[0]]=ZD(i.data.value),u=!0;break;case"APPLY":u=n.apply(e,c);break;case"CONSTRUCT":u=function(t){return Object.assign(t,{[_D]:!0})}(new n(...c));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;zD(t,n),u=function(t,e){return KD.set(t,e),t}(e,[e])}break;case"RELEASE":u=void 0;break;default:return}}catch(t){u={value:t,[jD]:0}}Promise.resolve(u).catch((t=>({value:t,[jD]:0}))).then((n=>{const[i,s]=XD(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),GD(e),ID in t&&"function"==typeof t[ID]&&t[ID]())})).catch((t=>{const[n,r]=XD({value:new TypeError("Unserializable return value"),[jD]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function GD(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function VD(t,e){return YD(t,[],e)}function WD(t){if(t)throw new Error("Proxy has been released and is not useable")}function HD(t){return QD(t,{type:"RELEASE"}).then((()=>{GD(t)}))}const $D=new WeakMap,UD="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=($D.get(t)||0)-1;$D.set(t,e),0===e&&HD(t)}));function YD(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(n,o){if(WD(r),o===LD)return()=>{!function(t){UD&&UD.unregister(t)}(i),HD(t),r=!0};if("then"===o){if(0===e.length)return{then:()=>i};const n=QD(t,{type:"GET",path:e.map((t=>t.toString()))}).then(ZD);return n.then.bind(n)}return YD(t,[...e,o])},set(n,i,o){WD(r);const[a,s]=XD(o);return QD(t,{type:"SET",path:[...e,i].map((t=>t.toString())),value:a},s).then(ZD)},apply(n,i,o){WD(r);const a=e[e.length-1];if(a===DD)return QD(t,{type:"ENDPOINT"}).then(ZD);if("bind"===a)return YD(t,e.slice(0,-1));const[s,c]=qD(o);return QD(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:s},c).then(ZD)},construct(n,i){WD(r);const[o,a]=qD(i);return QD(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:o},a).then(ZD)}});return function(t,e){const n=($D.get(e)||0)+1;$D.set(e,n),UD&&UD.register(t,e,t)}(i,t),i}function qD(t){const e=t.map(XD);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const KD=new WeakMap;function XD(t){for(const[e,n]of FD)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},KD.get(t)||[]]}function ZD(t){switch(t.type){case"HANDLER":return FD.get(t.name).deserialize(t.value);case"RAW":return t.value}}function QD(t,e,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(n){n.data&&n.data.id&&n.data.id===i&&(t.removeEventListener("message",e),r(n.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),n)}))}class JD extends Ud{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=VD(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&e.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return s(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=o(this.layout.options,["onTick"]),n={};Object.keys(e).forEach((t=>{Rt(e[t])||(n[t]=e[t])}));const r={layout:{id:this.layout.id,options:n,iterations:null===(t=this.options)||void 0===t?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},i=new Float32Array([0]),[a]=yield this.proxy.calculateLayout(r,[i]);return a}))}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[LD]()}isRunning(){return this.running}}const tL=t=>t?parseInt(t):0;function eL(t){let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||tL(e.width),r=t.clientHeight||tL(e.height);return[n-(tL(e.paddingLeft)+tL(e.paddingRight)),r-(tL(e.paddingTop)+tL(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(Yt(e)?e:1,1),Math.max(Yt(n)?n:1,1)]}function nL(t,e=!0){const n=document.createElement("div");return n.setAttribute("class",`g6-${t}`),n.style.position="absolute",n.style.display="block",e&&(n.style.inset="0px",n.style.height="100%",n.style.width="100%",n.style.overflow="hidden",n.style.pointerEvents="none"),n}function rL(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const a=document.createElement(e);return a.innerHTML=r,a.id=t,Object.assign(a.style,n),i.appendChild(a),a}class iL extends el{}class oL extends iL{static defaultOptions={transition:"background 0.5s",backgroundSize:"cover"};$element=nL("background");constructor(t,e){super(t,Object.assign({},oL.defaultOptions,e));this.context.canvas.getContainer().prepend(this.$element),this.update(e)}async update(t){super.update(t),Object.assign(this.$element.style,ve(this.options,["key","type"]))}destroy(){super.destroy(),this.$element.remove()}}function aL(t,e,n,r,i,o){const a=n-t,s=r-e;let c=i-t,u=o-e,l=c*a+u*s,h=0;l<=0?h=0:(c=a-c,u=s-u,l=c*a+u*s,h=l<=0?0:l*l/(a*a+s*s));const d=c*c+u*u-h;return d<0?0:d}function sL(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)}function cL(t,e,n,r,i){return sL(t,e,n,r)<i*i}function uL(t){const e=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2);return{x:e,y:r,x2:n,y2:i,width:n-e,height:i-r}}class lL{constructor(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new lL(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2)return!1;if(e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2)return!1;if(t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;return t<=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1)}distSquare(t,e){return aL(this.x1,this.y1,this.x2,this.y2,t,e)}ptClose(t,e,n){if(this.x1<this.x2){if(t<this.x1-n||t>this.x2+n)return!1}else if(t<this.x2-n||t>this.x1+n)return!1;if(this.y1<this.y2){if(e<this.y1-n||e>this.y2+n)return!1}else if(e<this.y2-n||e>this.y1+n)return!1;return!0}}var hL,dL;!function(t){t[t.POINT=1]="POINT",t[t.PARALLEL=2]="PARALLEL",t[t.COINCIDENT=3]="COINCIDENT",t[t.NONE=4]="NONE"}(hL||(hL={}));class fL{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function pL(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const e=n/i,o=r/i;return 0<=e&&e<=1&&0<=o&&o<=1?new fL(hL.POINT,t.x1+e*(t.x2-t.x1),t.y1+e*(t.y2-t.y1)):new fL(hL.NONE)}return new fL(0===n||0===r?hL.COINCIDENT:hL.PARALLEL)}function gL(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const t=n/i,e=r/i;if(0<=t&&t<=1&&0<=e&&e<=1)return t}return Number.POSITIVE_INFINITY}function mL(t,e,n){const r=new Set;return t.width<=0?(r.add(dL.LEFT),r.add(dL.RIGHT)):e<t.x?r.add(dL.LEFT):e>t.x+t.width&&r.add(dL.RIGHT),t.height<=0?(r.add(dL.TOP),r.add(dL.BOTTOM)):n<t.y?r.add(dL.TOP):n>t.y+t.height&&r.add(dL.BOTTOM),r}function yL(t,e){let n=e.x1,r=e.y1;const i=e.x2,o=e.y2,a=Array.from(mL(t,i,o));if(0===a.length)return!0;let s=mL(t,n,r);for(;0!==s.size;){for(const t of a)if(s.has(t))return!1;if(s.has(dL.RIGHT)||s.has(dL.LEFT)){let e=t.x;s.has(dL.RIGHT)&&(e+=t.width),r+=(e-n)*(o-r)/(i-n),n=e}else{let e=t.y;s.has(dL.BOTTOM)&&(e+=t.height),n+=(e-r)*(i-n)/(o-r),r=e}s=mL(t,n,r)}return!0}function vL(t,e){let n=Number.POSITIVE_INFINITY,r=0;function i(t,i,o,a){let s=gL(e,new lL(t,i,o,a));s=Math.abs(s-.5),s>=0&&s<=1&&(r++,s<n&&(n=s))}return i(t.x,t.y,t.x2,t.y),i(t.x,t.y,t.x,t.y2),r>1?n:(i(t.x,t.y2,t.x2,t.y2),r>1?n:(i(t.x2,t.y,t.x2,t.y2),0===r?-1:n))}function bL(t,e){let n=0;const r=pL(t,new lL(e.x,e.y,e.x2,e.y));n+=r.state===hL.POINT?1:0;const i=pL(t,new lL(e.x,e.y,e.x,e.y2));n+=i.state===hL.POINT?1:0;const o=pL(t,new lL(e.x,e.y2,e.x2,e.y2));n+=o.state===hL.POINT?1:0;const a=pL(t,new lL(e.x2,e.y,e.x2,e.y2));return n+=a.state===hL.POINT?1:0,{top:r,left:i,bottom:o,right:a,count:n}}!function(t){t[t.LEFT=0]="LEFT",t[t.TOP=1]="TOP",t[t.RIGHT=2]="RIGHT",t[t.BOTTOM=3]="BOTTOM"}(dL||(dL={}));class xL{constructor(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new xL(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new xL(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x+t.width),i=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=r-e,this.height=i-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x),i=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=r-e,this.height=i-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return!(this.area<=0||t.width<=0||t.height<=0)&&(t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2)}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=mL(this,t,e);return n.has(dL.TOP)?n.has(dL.LEFT)?sL(t,e,this.x,this.y):n.has(dL.RIGHT)?sL(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(dL.BOTTOM)?n.has(dL.LEFT)?sL(t,e,this.x,this.y2):n.has(dL.RIGHT)?sL(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(dL.LEFT)?(this.x-t)*(this.x-t):n.has(dL.RIGHT)?(t-this.x2)*(t-this.x2):0}}class wL{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return 2*this.radius}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return 2*this.radius}static from(t){return new wL(t.cx,t.cy,t.radius)}containsPt(t,e){return sL(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=sL(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const r=Math.sqrt(n)-this.radius;return r*r}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,2*Math.PI)}}class EL{constructor(t,e=0,n=0,r=0,i=0,o=10,a=10,s=new Float32Array(Math.max(0,o*a)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=r,this.pixelY=i,this.width=o,this.height=a,this.area=s}createSub(t,e){return new EL(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new EL(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new EL(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),r=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),i=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup));return new xL(e,n,r-e,i-n)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),r=this.boundX(t.x-n),i=this.boundY(t.y-n),o=this.boundX(t.x2+n),a=this.boundY(t.y2+n);return new xL(r,i,o-r,a-i)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||0===e)return;const n=this.width,r=t.width,i=Math.max(0,t.i),o=Math.max(0,t.j),a=Math.min(t.i+t.width,n),s=Math.min(t.j+t.height,this.height);if(!(s<=0||a<=0||i>=n||s>=this.height))for(let c=o;c<s;c++){const o=(c-t.j)*r,s=c*n;for(let n=i;n<a;n++){const r=t.area[n-t.i+o];0!==r&&(this.area[n+s]+=e*r)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let r=0;r<t.height;r++){const i=n+r*this.width;this.area.fill(e,i,i+t.width)}}fillHorizontalLine(t,e,n,r){const i=t+e*this.width;this.area.fill(r,i,i+n)}fillVerticalLine(t,e,n,r){const i=t+e*this.width;for(let t=0;t<n;t++)this.area[i+t*this.width]=r}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let e=0;e<this.width;e++){t+=this.area[n+e].toFixed(1).padStart(6),t+=" "}t+="\n"}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce(((t,e)=>Math.min(t,e)),Number.POSITIVE_INFINITY),r=this.area.reduce(((t,e)=>Math.max(t,e)),Number.NEGATIVE_INFINITY),i=t=>(t-n)/(r-n);t.scale(this.pixelGroup,this.pixelGroup);for(let e=0;e<this.width;e++)for(let n=0;n<this.height;n++){const r=this.area[e+n*this.width];t.fillStyle=`rgba(0, 0, 0, ${i(r)})`,t.fillRect(e,n,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let n=0;n<this.width;n++)for(let r=0;r<this.height;r++){const i=this.area[n+r*this.width];t.fillStyle=i>e?"black":"white",t.fillRect(n,r,1,1)}t.restore()}}}function ML(t,e){const n=t=>({x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e});return Array.isArray(t)?t.map(n):n(t)}function SL(t,e,n){return NL(Object.assign(uL(t),{distSquare:(e,n)=>aL(t.x1,t.y1,t.x2,t.y2,e,n)}),e,n)}function NL(t,e,n){const r=ML(t,n),i=e.scale(r),o=e.createSub(i,r);return function(t,e,n,r){const i=n*n;for(let o=0;o<t.height;o++)for(let a=0;a<t.width;a++){const s=r(e.invertScaleX(t.i+a),e.invertScaleY(t.j+o));if(0!==s){if(s<i){const e=n-Math.sqrt(s);t.set(a,o,e*e)}}else t.set(a,o,i)}}(o,e,n,((e,n)=>t.distSquare(e,n))),o}function kL(t,e){return{x:t,y:e}}function CL(t,e,n,r){if(0===t.length)return[];const i=function(t){if(t.length<2)return t;let e=0,n=0;return t.forEach((t=>{e+=t.cx,n+=t.cy})),e/=t.length,n/=t.length,t.map((t=>{const r=e-t.cx,i=n-t.cy;return[t,r*r+i*i]})).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]))}(t);return i.map(((t,o)=>{const a=i.slice(0,o);return function(t,e,n,r,i){const o=kL(e.cx,e.cy),a=function(t,e,n){let r=Number.POSITIVE_INFINITY;return e.reduce(((e,i)=>{const o=sL(t.x,t.y,i.cx,i.cy);if(o>r)return e;const a=new lL(t.x,t.y,i.cx,i.cy),s=function(t,e){return t.reduce(((t,n)=>yL(n,e)&&function(t,e){function n(t,n,r,i){let o=gL(e,new lL(t,n,r,i));return o=Math.abs(o-.5),o>=0&&o<=1?1:0}let r=n(t.x,t.y,t.x2,t.y);return r+=n(t.x,t.y,t.x,t.y2),r>1||(r+=n(t.x,t.y2,t.x2,t.y2),r>1||(r+=n(t.x2,t.y,t.x2,t.y2),r>0))}(n,e)?t+1:t),0)}(n,a);return o*(s+1)*(s+1)<r&&(e=i,r=o*(s+1)*(s+1)),e}),null)}(o,n,t);if(null==a)return[];const s=function(t,e,n,r){const i=[],o=[];o.push(t);let a=!0;for(let t=0;t<n&&a;t++)for(a=!1;!a&&o.length>0;){const t=o.pop(),n=PL(e,t),s=n?bL(t,n):null;if(!n||!s||2!==s.count){a||i.push(t);continue}let c=r,u=OL(n,c,s,!0),l=AL(u,o)||AL(u,i),h=TL(u,e);for(;!l&&h&&c>=1;)c/=1.5,u=OL(n,c,s,!0),l=AL(u,o)||AL(u,i),h=TL(u,e);if(!u||l||h||(o.push(new lL(t.x1,t.y1,u.x,u.y)),o.push(new lL(u.x,u.y,t.x2,t.y2)),a=!0),a)continue;c=r,u=OL(n,c,s,!1);let d=AL(u,o)||AL(u,i);for(h=TL(u,e);!d&&h&&c>=1;)c/=1.5,u=OL(n,c,s,!1),d=AL(u,o)||AL(u,i),h=TL(u,e);u&&!d&&(o.push(new lL(t.x1,t.y1,u.x,u.y)),o.push(new lL(u.x,u.y,t.x2,t.y2)),a=!0),a||i.push(t)}for(;o.length>0;)i.push(o.pop());return i}(new lL(o.x,o.y,a.cx,a.cy),t,r,i);return function(t,e){const n=[];for(;t.length>0;){const r=t.pop();if(0===t.length){n.push(r);break}const i=t.pop(),o=new lL(r.x1,r.y1,i.x2,i.y2);PL(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(s,t)}(e,t,a,n,r)})).flat()}function TL(t,e){return e.some((e=>e.containsPt(t.x,t.y)))}function AL(t,e){return e.some((e=>!!cL(e.x1,e.y1,t.x,t.y,.001)||!!cL(e.x2,e.y2,t.x,t.y,.001)))}function PL(t,e){let n=Number.POSITIVE_INFINITY,r=null;for(const i of t){if(!yL(i,e))continue;const t=vL(i,e);t>=0&&t<n&&(r=i,n=t)}return r}function OL(t,e,n,r){const i=n.top,o=n.left,a=n.bottom,s=n.right;if(r){if(o.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x-e,t.y-e);if(a.state===hL.POINT)return kL(t.x-e,t.y2+e);const n=t.width*t.height;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?kL(t.x-e,t.y-e):kL(t.x2+e,t.y-e):o.y<s.y?kL(t.x-e,t.y2+e):kL(t.x2+e,t.y2+e)}if(s.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x2+e,t.y-e);if(a.state===hL.POINT)return kL(t.x2+e,t.y2+e)}const n=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*n?i.x>a.x?kL(t.x-e,t.y-e):kL(t.x-e,t.y2+e):i.x<a.x?kL(t.x2+e,t.y-e):kL(t.x2+e,t.y2+e)}if(o.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x2+e,t.y2+e);if(a.state===hL.POINT)return kL(t.x2+e,t.y-e);const n=t.height*t.width;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?kL(t.x2+e,t.y2+e):kL(t.x-e,t.y2+e):o.y<s.y?kL(t.x2+e,t.y-e):kL(t.x-e,t.y-e)}if(s.state===hL.POINT){if(i.state===hL.POINT)return kL(t.x-e,t.y2+e);if(a.state===hL.POINT)return kL(t.x-e,t.y-e)}const c=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*c?i.x>a.x?kL(t.x2+e,t.y2+e):kL(t.x2+e,t.y-e):i.x<a.x?kL(t.x-e,t.y2+e):kL(t.x-e,t.y-e)}function RL(t,e,n,r){if(!(t.closed?n<t.length:n<t.length-1))return!1;const i=t.get(e),o=t.get(n+1);for(let a=e+1;a<=n;a++){const e=t.get(a);if(aL(i.x,i.y,o.x,o.y,e.x,e.y)>r)return!1}return!0}function _L(t,e){switch(t){case-2:return(((3-e)*e-3)*e+1)/6;case-1:return((3*e-6)*e*e+4)/6;case 0:return(((-3*e+3)*e+3)*e+1)/6;case 1:return e*e*e/6;default:throw new Error("unknown error")}}class DL{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(0===e.length)return"";const n="function"==typeof t?t:function(t){if(!Number.isFinite(t))return t=>t;if(0===t)return Math.round;const e=Math.pow(10,t);return t=>Math.round(t*e)/e}(t);let r="M";for(const t of e)r+=`${n(t.x)},${n(t.y)} L`;return r=r.slice(0,-1),this.closed&&(r+=" Z"),r}draw(t){const e=this.points;if(0!==e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return function(t=8){return e=>{let n=t,r=e.length;if(n>1)for(r=Math.floor(e.length/n);r<3&&n>1;)n-=1,r=Math.floor(e.length/n);const i=[];for(let t=0,o=0;o<r;o++,t+=n)i.push(e.get(t));return new DL(i)}}(t)(this)}simplify(t){return function(t=0){return e=>{if(t<0||e.length<3)return e;const n=[];let r=0;const i=t*t;for(;r<e.length;){let t=r+1;for(;RL(e,r,t,i);)t++;n.push(e.get(r)),r=t}return new DL(n)}}(t)(this)}bSplines(t){return function(t=6){function e(t,e,n){let r=0,i=0;for(let o=-2;o<=1;o++){const a=t.get(e+o),s=_L(o,n);r+=s*a.x,i+=s*a.y}return{x:r,y:i}}return n=>{if(n.length<3)return n;const r=[],i=n.closed,o=n.length+3-1+(i?0:2);r.push(e(n,2-(i?0:2),0));for(let a=2-(i?0:2);a<o;a++)for(let i=1;i<=t;i++)r.push(e(n,a,i/t));return new DL(r)}}(t)(this)}apply(t){return t(this)}containsElements(t){const e=function(t){if(0===t.length)return null;const e=t[0],n=new xL(e.x,e.y,0,0);for(const e of t)n.addPoint(e);return n}(this.points);return!!e&&t.every((t=>e.containsPt(t.cx,t.cy)&&this.withinArea(t.cx,t.cy)))}withinArea(t,e){if(0===this.length)return!1;let n=0;const r=this.points[0],i=new lL(r.x,r.y,r.x,r.y);for(let r=1;r<this.points.length;r++){const o=this.points[r];i.x1=i.x2,i.y1=i.y2,i.x2=o.x,i.y2=o.y,i.cuts(t,e)&&n++}return i.x1=i.x2,i.y1=i.y2,i.x2=r.x,i.y2=r.y,i.cuts(t,e)&&n++,n%2==1}}class LL{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(0===this.count)return!1;const e=this.arr[0];return null!=e&&e.x===t.x&&e.y===t.y}path(){return new DL(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}const IL=0,jL=1,BL=2,FL=3;function zL(t,e){const n=2*(Math.floor(t.width)+Math.floor(t.height)),r=new LL(n);function i(n,r,i,o){const a=t.get(n,r);return Number.isNaN(a)?Number.NaN:a>e?i+o:i}function o(t,e){let n=IL;return n=i(t,e,n,1),n=i(t+1,e,n,2),n=i(t,e+1,n,4),n=i(t+1,e+1,n,8),Number.isNaN(n)?-1:n}let a=jL;function s(e,n){let i=e,s=n,c=t.invertScaleX(i),u=t.invertScaleY(s);for(let e=0;e<t.width*t.height;e++){const e={x:c,y:u};if(r.contains(e)){if(r.isFirst(e))return!0}else r.add(e);const n=o(i,s);switch(n){case-1:return!0;case 0:case 3:case 2:case 7:a=BL;break;case 12:case 14:case 4:a=FL;break;case 6:a=a===IL?FL:BL;break;case 1:case 13:case 5:a=IL;break;case 9:a=a===BL?IL:jL;break;case 10:case 8:case 11:a=jL;break;default:return console.warn("Marching squares invalid state: "+n),!0}switch(a){case IL:s--,u-=t.pixelGroup;break;case jL:s++,u+=t.pixelGroup;break;case FL:i--,c-=t.pixelGroup;break;case BL:i++,c+=t.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+n),!0}}return!0}for(let n=0;n<t.width;n++)for(let i=0;i<t.height;i++){if(t.get(n,i)<=e)continue;const a=o(n,i);if(!(a<0||15===a)&&s(n,i))return r.path()}return null}const GL={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function VL(t){return null!=t&&"number"==typeof t.radius}function WL(t,e){if(VL(t)!==VL(e))return!1;if(VL(t)){const n=e;return t.cx===n.cx&&t.cy===n.cy&&t.radius===n.radius}const n=e;return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}var HL;!function(t){t[t.MEMBERS=0]="MEMBERS",t[t.NON_MEMBERS=1]="NON_MEMBERS",t[t.EDGES=2]="EDGES"}(HL||(HL={}));let $L=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new xL(0,0,0,0),this.potentialArea=new EL(1,0,0,0,0,0,0),this.o=Object.assign({},GL,t)}pushMember(...t){if(0!==t.length){this.dirty.add(HL.MEMBERS);for(const e of t)this.members.push({raw:e,obj:VL(e)?wL.from(e):xL.from(e),area:null})}}removeMember(t){const e=this.members.findIndex((e=>WL(e.raw,t)));return!(e<0)&&(this.members.splice(e,1),this.dirty.add(HL.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex((e=>WL(e.raw,t)));return!(e<0)&&(this.nonMembers.splice(e,1),this.dirty.add(HL.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex((e=>e.obj.equals(t)));return!(e<0)&&(this.edges.splice(e,1),this.dirty.add(HL.NON_MEMBERS),!0)}pushNonMember(...t){if(0!==t.length){this.dirty.add(HL.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:VL(e)?wL.from(e):xL.from(e),area:null})}}pushEdge(...t){if(0!==t.length){this.dirty.add(HL.EDGES);for(const e of t)this.edges.push({raw:e,obj:lL.from(e),area:null})}}update(){const t=this.dirty.has(HL.MEMBERS),e=this.dirty.has(HL.NON_MEMBERS);let n=this.dirty.has(HL.EDGES);this.dirty.clear();const r=this.members.map((t=>t.obj));if(this.o.virtualEdges&&(t||e)){const t=CL(r,this.nonMembers.map((t=>t.obj)),this.o.maxRoutingIterations,this.o.morphBuffer),e=new Map(this.virtualEdges.map((t=>[t.obj.toString(),t.area])));this.virtualEdges=t.map((t=>{var n;return{raw:t,obj:t,area:null!==(n=e.get(t.toString()))&&void 0!==n?n:null}})),n=!0}let i=!1;if(t||n){const t=function(t,e){if(0===t.length)return new xL(0,0,0,0);const n=xL.from(t[0]);for(const e of t)n.add(e);for(const t of e)n.add(uL(t));return n}(r,this.virtualEdges.concat(this.edges).map((t=>t.obj))),e=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,n=xL.from(ML(t,e));n.equals(this.activeRegion)||(i=!0,this.activeRegion=n)}if(i){const t=Math.ceil(this.activeRegion.width/this.o.pixelGroup),e=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=EL.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach((t=>t.area=null)),this.nonMembers.forEach((t=>t.area=null)),this.edges.forEach((t=>t.area=null)),this.virtualEdges.forEach((t=>t.area=null))):t===this.potentialArea.width&&e===this.potentialArea.height||(this.potentialArea=EL.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const o=new Map,a=t=>{if(t.area){const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof xL?"R":"C"}`;o.set(e,t.area)}},s=t=>{if(t.area)return;const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof xL?"R":"C"}`;if(o.has(e)){const n=o.get(e);return void(t.area=this.potentialArea.copy(n,{x:t.obj.x-this.o.nodeR1,y:t.obj.y-this.o.nodeR1}))}const n=t.obj instanceof xL?function(t,e,n){const r=e.scale(t),i=e.addPadding(r,n),o=e.createSub(i,{x:t.x-n,y:t.y-n}),a=r.x-i.x,s=r.y-i.y,c=i.x2-r.x2,u=i.y2-r.y2,l=i.width-a-c,h=i.height-s-u,d=n*n;o.fillArea({x:a,y:s,width:l+1,height:h+1},d);const f=[0],p=Math.max(s,a,c,u);{const i=e.invertScaleX(r.x+r.width/2);for(let o=1;o<p;o++){const a=e.invertScaleY(r.y-o),s=t.distSquare(i,a);if(!(s<d))break;{const t=n-Math.sqrt(s);f.push(t*t)}}}const g=[],m=Math.max(a,c),y=Math.max(s,c);for(let i=1;i<m;i++){const o=e.invertScaleX(r.x-i),a=[];for(let i=1;i<y;i++){const s=e.invertScaleY(r.y-i),c=t.distSquare(o,s);if(c<d){const t=n-Math.sqrt(c);a.push(t*t)}else a.push(0)}g.push(a)}for(let t=1;t<Math.min(s,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s-t,l+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillHorizontalLine(a,s+h+t,l+1,e)}for(let t=1;t<Math.min(a,f.length);t++){const e=f[t];o.fillVerticalLine(a-t,s,h+1,e)}for(let t=1;t<Math.min(u,f.length);t++){const e=f[t];o.fillVerticalLine(a+l+t,s,h+1,e)}for(let t=1;t<a;t++){const e=g[t-1],n=a-t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}for(let t=1;t<c;t++){const e=g[t-1],n=a+l+t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<u;t++)o.set(n,s+h+t,e[t-1])}return o}(t.obj,this.potentialArea,this.o.nodeR1):NL(t.obj,this.potentialArea,this.o.nodeR1);t.area=n,o.set(e,n)};this.members.forEach(a),this.nonMembers.forEach(a),this.members.forEach(s),this.nonMembers.forEach((t=>{this.activeRegion.intersects(t.obj)?s(t):t.area=null})),this.edges.forEach((t=>{t.area||(t.area=SL(t.obj,this.potentialArea,this.o.edgeR1))})),this.virtualEdges.forEach((t=>{t.area||(t.area=SL(t.obj,this.potentialArea,this.o.edgeR1))}))}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(0===this.members.length)return new DL([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map((t=>t.area)),r=this.virtualEdges.concat(this.edges).map((t=>t.area)),i=this.nonMembers.filter((t=>null!=t.area)).map((t=>t.area)),o=this.members.map((t=>t.obj));return function(t,e,n,r,i,o={}){const a=Object.assign({},GL,o);let s=a.threshold,c=a.memberInfluenceFactor,u=a.edgeInfluenceFactor,l=a.nonMemberInfluenceFactor;const h=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),d=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1);for(let o=0;o<a.maxMarchingIterations;o++){if(t.clear(),0!==c){const n=c/h;for(const r of e)t.incArea(r,n)}if(0!==u){const e=u/d;for(const r of n)t.incArea(r,e)}if(0!==l){const e=l/h;for(const n of r)t.incArea(n,e)}const f=zL(t,s);if(f&&i(f))return f;if(s*=.95,o<=.5*a.maxMarchingIterations)c*=1.2,u*=1.2;else{if(!(0!==l&&r.length>0))break;l*=.8}}return new DL([])}(e,n,r,i,(t=>t.containsElements(o)),t)}};class UL extends iL{shape;bubbleSets;path;members=new Map;avoidMembers=new Map;bubbleSetOptions={};static defaultOptions={members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2,...GL};constructor(t,e){super(t,le({},UL.defaultOptions,e)),this.bindEvents(),this.bubbleSets=new $L(this.options)}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new $L(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const{type:t,key:e,members:n,avoidMembers:r,...i}=this.options,o=Object.keys(i).reduce(((t,e)=>(e in GL?t.bubbleSetOptions[e]=i[e]:t.style[e]=i[e],t)),{style:{},bubbleSetOptions:{}});return{type:t,key:e,members:n,avoidMembers:r,...o}}drawBubbleSets=()=>{const{style:t,bubbleSetOptions:e}=this.parseOptions();fe(this.bubbleSetOptions,e)||this.init(),this.bubbleSetOptions={...e};const n={...t,d:this.getPath()};this.shape?this.shape.update(n):(this.shape=new Ah({style:n}),this.context.canvas.appendChild(this.shape))};updateBubbleSetsPath=t=>{if(!this.shape)return;const e=Gu(t.data);[...this.options.members,...this.options.avoidMembers].includes(e)&&this.shape.update({...this.parseOptions().style,d:this.getPath(e)})};getPath=t=>{const{graph:e}=this.context,n=this.options.members,r=[...this.members.keys()],i=this.options.avoidMembers,o=[...this.avoidMembers.keys()];if(!t&&fe(n,r)&&fe(i,o))return this.path;const{enter:a=[],exit:s=[]}=Ju(r,n,(t=>t)),{enter:c=[],exit:u=[]}=Ju(o,i,(t=>t));t&&(s.push(t),a.push(t));const l=(t,n,r)=>{t.forEach((t=>{const i=r?this.members:this.avoidMembers,o=r?"pushMember":"pushNonMember",a=r?"removeMember":"removeNonMember";if(n){let n;"edge"===e.getElementType(t)?([n]=qL(e,t),this.bubbleSets.pushEdge(n)):([n]=YL(e,t),this.bubbleSets[o](n)),i.set(t,n)}else{const n=i.get(t);n&&("edge"===e.getElementType(t)?this.bubbleSets.removeEdge(n):this.bubbleSets[a](n),i.delete(t))}}))};l(s,!1,!0),l(a,!0,!0),l(u,!1,!1),l(c,!0,!1);const h=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=Th(h.points.map(Rl)),this.path};addMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.avoidMembers.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t)))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),this.drawBubbleSets()}updateMember(t){this.options.members=Rt(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some((t=>this.options.members.includes(t)))&&(this.options.members=this.options.members.filter((t=>!e.includes(t)))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some((t=>e.includes(t)))&&(this.options.avoidMembers=this.options.avoidMembers.filter((t=>!e.includes(t))),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}const YL=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getElementRenderBounds(e);return new xL(n.min[0],n.min[1],al(n),sl(n))})),qL=(t,e)=>(Array.isArray(e)?e:[e]).map((e=>{const n=t.getEdgeData(e),r=t.getElementPosition(n.source),i=t.getElementPosition(n.target);return lL.from({x1:r[0],y1:r[1],x2:i[0],y2:i[1]})}));class KL extends iL{static defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};$element;constructor(t,e){super(t,Object.assign({},KL.defaultOptions,e)),this.initElement(),this.update(e)}initElement(){this.$element=nL("contextmenu",!1);const{className:t}=this.options;t&&this.$element.classList.add(t);this.context.canvas.getContainer().appendChild(this.$element),rL("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow: hidden;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head)}async show(t){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hide();const r=await this.getDOMContent(t);r instanceof HTMLElement?this.$element.appendChild(r):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-i.left+n[0]}px`,this.$element.style.top=`${t.client.y-i.top+n[1]}px`,this.$element.style.display="block"}hide(){this.$element.style.display="none"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}async getDOMContent(t){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(await n(t)).map((t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`)).join("")}\n </ul>\n `:await e(t)}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}onTriggerEvent=t=>{t.preventDefault?.(),this.show(t)};onMenuItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof HTMLElement&&t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");e?.(n,t.target)}this.hide()}}class XL extends iL{static defaultOptions={trigger:{},autoFit:!0};shortcut;$el=this.context.canvas.getContainer();graphSize=[0,0];constructor(t,e){super(t,Object.assign({},XL.defaultOptions,e)),this.shortcut=new Hl(t.graph),this.bindEvents(),this.$el.style.backgroundColor=this.context.graph.getBackground()}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit);["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.addEventListener(t,this.onFullscreenChange,!1)}))}unbindEvents(){this.shortcut.unbindAll();["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach((t=>{document.removeEventListener(t,this.onFullscreenChange,!1)}))}setGraphSize(t=!0){let e,n;t?(e=window.screen.width,n=window.screen.height,this.graphSize=this.context.graph.getSize()):[e,n]=this.graphSize,this.context.graph.setSize(e,n),this.context.graph.render()}onFullscreenChange=()=>{const t=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(t),t?this.options.onEnter?.():this.options.onExit?.()};request(){!document.fullscreenElement&&(document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled"))&&this.$el.requestFullscreen().catch((t=>{console.debug(`Error attempting to enable full-screen: ${t.message} (${t.name})`)}))}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}}class ZL extends iL{static defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};$element=nL("grid-line");offset=[0,0];constructor(t,e){super(t,Object.assign({},ZL.defaultOptions,e));!function(t,e){const n=t.firstChild;n?t.insertBefore(e,n):t.appendChild(e)}(this.context.canvas.getContainer(),this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:r,borderLineWidth:i,borderStroke:o,borderStyle:a}=this.options;Object.assign(this.$element.style,{border:r?`${i}px ${a} ${o}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`})}updateOffset(t){this.offset=function(t,e){return t.map((t=>t%e))}(ml(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}onTransform=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)};destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}function QL(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach((t=>{const{type:n,value:r}=t,i=Gu(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Removed.has(i)||e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)?e.Added.delete(i):e.Updated.has(i)?(e.Updated.delete(i),e.Removed.set(i,t)):e.Removed.set(i,t))})),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}function JL(t){const{NodeAdded:e=[],NodeUpdated:n=[],NodeRemoved:r=[],EdgeAdded:i=[],EdgeUpdated:o=[],EdgeRemoved:a=[],ComboAdded:s=[],ComboUpdated:c=[],ComboRemoved:u=[]}=$t(t,(t=>t.type));return{add:{nodes:e,edges:i,combos:s},update:{nodes:n,edges:o,combos:c},remove:{nodes:r,edges:a,combos:u}}}function tI(t,e){for(const n in t)jt(t[n])&&!Array.isArray(t[n])&&null!==t[n]?(e[n]||(e[n]={}),tI(t[n],e[n])):e[n]||(e[n]=Bu(n))}function eI(t,e=!1,n){const r={animation:e,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:o,remove:a}=JL(QL(t));return["nodes","edges","combos"].forEach((t=>{o[t]&&o[t].forEach((e=>{const i={...e.value};let o={...e.original};if(n){const t=n.graph.getElementType(Gu(e.original)),r="edge"===t?"stroke":"fill",i=n.element.getElementComputedStyle(t,e.original);o={...e.original,style:{[r]:i[r],...e.original.style}}}tI(i,o),r.current.update[t]||=[],r.current.update[t].push(i),r.original.update[t]||=[],r.original.update[t].push(o)})),i[t]&&i[t].forEach((e=>{const n={...e.value};r.current.add[t]||=[],r.current.add[t].push(n),r.original.remove[t]||=[],r.original.remove[t].push(n)})),a[t]&&a[t].forEach((e=>{const n={...e.value};r.current.remove[t]||=[],r.current.remove[t].push(n),r.original.add[t]||=[],r.original.add[t].push(n)}))})),r}class nI extends iL{static defaultOptions={stackSize:0};emitter;batchChanges=null;batchAnimation=!1;undoStack=[];redoStack=[];isFirstDraw=!0;freezed=!1;constructor(e,n){super(e,Object.assign({},nI.defaultOptions,n)),this.emitter=new Ud;const{graph:r}=this.context;r.on(t.GraphEvent.AFTER_DRAW,this.addCommand),r.on(t.GraphEvent.BATCH_START,this.initBatchCommand),r.on(t.GraphEvent.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){const e=this.undoStack.pop();return e&&(this.executeCommand(e),this.options.beforeAddCommand?.(e,!1),this.redoStack.push(e),this.options.afterAddCommand?.(e,!1),this.notify(t.HistoryEvent.UNDO,e)),this}redo(){const e=this.redoStack.pop();return e&&(this.executeCommand(e,!1),this.undoStackPush(e),this.notify(t.HistoryEvent.REDO,e)),this}undoAndCancel(){const e=this.undoStack.pop();return e&&(this.executeCommand(e,!1),this.redoStack=[],this.notify(t.HistoryEvent.CANCEL,e)),this}executeCommand=(t,e=!0)=>{this.freezed=!0,this.options.executeCommand?.(t);const n=e?t.original:t.current;this.context.graph.addData(n.add),this.context.graph.updateData(n.update),this.context.graph.removeData(Wu(n.remove,!1)),this.context.element?.draw({silence:!0,animation:t.animation}),this.freezed=!1};addCommand=e=>{if(this.isFirstDraw)this.isFirstDraw=!1;else if(!this.freezed){if(e.type===t.GraphEvent.AFTER_DRAW){const{dataChanges:t=[],animation:n=!0}=e.data;if(this.context.batch?.isBatching){if(!this.batchChanges)return;return this.batchChanges.push(t),void(this.batchAnimation&&=n)}this.batchChanges=[t],this.batchAnimation=n}this.undoStackPush(eI(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(t.HistoryEvent.ADD,this.undoStack[this.undoStack.length-1])}};initBatchCommand=t=>{const{initiate:e}=t.data;if(this.batchAnimation=!1,e)this.batchChanges=[];else{this.undoStack.pop()||(this.batchChanges=null)}};undoStackPush(t){const{stackSize:e}=this.options;0!==e&&this.undoStack.length>=e&&this.undoStack.shift(),this.options.beforeAddCommand?.(t,!0),this.undoStack.push(t),this.options.afterAddCommand?.(t,!0)}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(t.HistoryEvent.CLEAR,null)}notify(e,n){this.emitter.emit(e,{cmd:n}),this.emitter.emit(t.HistoryEvent.CHANGE,{cmd:n})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.addCommand),e.off(t.GraphEvent.BATCH_START,this.initBatchCommand),e.off(t.GraphEvent.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}function rI(t,e,n,r,i,o){const a=(o-e)*(n-t)-(r-e)*(i-t);return a>0||!(a<0)}var iI=function(t,e){const n=t[0][0],r=t[0][1],i=t[1][0],o=t[1][1],a=e[0][0],s=e[0][1],c=e[1][0],u=e[1][1];return rI(n,r,a,s,c,u)!==rI(i,o,a,s,c,u)&&rI(n,r,i,o,a,s)!==rI(n,r,i,o,c,u)};function oI(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(let e=0;e<t.length;e++){const n=t[e],r=this.coordToCellNum(n[0]),i=this.coordToCellNum(n[1]);if(this._cells[r])this._cells[r][i]?this._cells[r][i].push(n):this._cells[r][i]=[n];else{const t=[];t[i]=[n],this._cells[r]=t}}}function aI(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}oI.prototype={cellPoints:function(t,e){return void 0!==this._cells[t]&&void 0!==this._cells[t][e]?this._cells[t][e]:[]},rangePoints:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this.coordToCellNum(t[2]),i=this.coordToCellNum(t[3]),o=[];for(let t=e;t<=r;t++)for(let e=n;e<=i;e++)for(let n=0;n<this.cellPoints(t,e).length;n++)o.push(this.cellPoints(t,e)[n]);return o},removePoint:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this._cells[e][n];let i;for(let e=0;e<r.length;e++)if(r[e][0]===t[0]&&r[e][1]===t[1]){i=e;break}return r.splice(i,1),r},trunc:Math.trunc||function(t){return t-t%1},coordToCellNum:function(t){return this.trunc(t*this._reverseCellSize)},extendBbox:function(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}};var sI=function(t){const e=function(t){const e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&aI(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}(t),n=function(t){const e=t.reverse(),n=[];for(let t=0;t<e.length;t++){for(;n.length>=2&&aI(n[n.length-2],n[n.length-1],e[t])<=0;)n.pop();n.push(e[t])}return n.pop(),n}(t).concat(e);return n.push(t[0]),n};const cI=iI,uI=function(t,e){return new oI(t,e)},lI={toXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","return [pt"+e[0]+",pt"+e[1]+"];")(t)}))},fromXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","const o = {}; o"+e[0]+"= pt[0]; o"+e[1]+"= pt[1]; return o;")(t)}))}},hI=sI;function dI(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function fI(t,e,n){const r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],o=dI(t,e),a=dI(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(o*a)}function pI(t,e){for(let n=0;n<e.length-1;n++){const r=[e[n],e[n+1]];if(!(t[0][0]===r[0][0]&&t[0][1]===r[0][1]||t[0][0]===r[1][0]&&t[0][1]===r[1][1])&&cI(t,r))return!0}return!1}function gI(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function mI(t,e,n){let r,i,o=null,a=vI,s=vI;for(let c=0;c<e.length;c++)r=fI(t[0],t[1],e[c]),i=fI(t[1],t[0],e[c]),r>a&&i>s&&!pI([t[0],e[c]],n)&&!pI([t[1],e[c]],n)&&(a=r,s=i,o=e[c]);return o}function yI(t,e,n,r,i){let o=!1;for(let a=0;a<t.length-1;a++){const s=[t[a],t[a+1]],c=s[0][0]+","+s[0][1]+","+s[1][0]+","+s[1][1];if(dI(s[0],s[1])<e||i.has(c))continue;let u,l,h,d=0,f=gI(s);do{f=r.extendBbox(f,d),u=f[2]-f[0],l=f[3]-f[1],h=mI(s,r.rangePoints(f),t),d++}while(null===h&&(n[0]>u||n[1]>l));u>=n[0]&&l>=n[1]&&i.add(c),null!==h&&(t.splice(a+1,0,h),r.removePoint(h),o=!0)}return o?yI(t,e,n,r,i):t}const vI=Math.cos(90/(180/Math.PI)),bI=.6;var xI=function(t,e,n){let r=e||20;const i=function(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];n[0]===i[0]&&n[1]===i[1]||e.push(i),n=i}return e}(function(t){return t.sort((function(t,e){return t[0]-e[0]||t[1]-e[1]}))}(lI.toXy(t,n)));if(i.length<4){const t=i.concat([i[0]]);return n?lI.fromXy(t,n):t}const o=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<n&&(n=t[o][1]),t[o][0]>r&&(r=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[r-e,i-n]}(i),a=[o[0]*bI,o[1]*bI],s=hI(i),c=i.filter((function(t){return s.indexOf(t)<0})),u=Math.ceil(1/(i.length/(o[0]*o[1]))),l=yI(s,Math.pow(r,2),a,uI(c,u),new Set);return n?lI.fromXy(l,n):l},wI=p(xI);const EI=(t,e,n)=>{if("sharp"===n)return[["M",t[0]-e,t[1]-e],["L",t[0]+e,t[1]-e],["L",t[0]+e,t[1]+e],["L",t[0]-e,t[1]+e],["Z"]];const r=[e,e,0,0,0];return[["M",t[0],t[1]-e],["A",...r,t[0],t[1]+e],["A",...r,t[0],t[1]-e]]},MI=(t,e,n)=>{const r=[e,e,0,0,0],i="sharp"===n?ml(t[0],xl(Ml(yl(t[0],t[1])),e)):t[0],o="sharp"===n?ml(t[1],xl(Ml(yl(t[1],t[0])),e)):t[1],a=xl(Ml(Nl(yl(i,o),!1)),e),s=xl(a,-1),c=ml(i,a),u=ml(o,a),l=ml(o,s),h=ml(i,s);return"sharp"===n?[["M",c[0],c[1]],["L",u[0],u[1]],["L",l[0],l[1]],["L",h[0],h[1]],["Z"]]:[["M",c[0],c[1]],["L",u[0],u[1]],["A",...r,l[0],l[1]],["L",h[0],h[1]],["A",...r,c[0],c[1]]]},SI=(t,e)=>{const n=Gl(t).map(((n,r)=>{const i=(r-2+t.length)%t.length,o=(r-1+t.length)%t.length,a=(r+1)%t.length,s=t[i],c=t[o],u=t[a],l=yl(s,c),h=yl(c,n),d=yl(n,u),f=(t,e)=>Sl(t,e,!0)<Math.PI,p=f(l,h),g=f(h,d),m=t=>xl(Ml(Nl(t,!1)),e),y=m(h);return[{p:kl(ml(c,p?m(l):y)),concave:p&&c},{p:kl(ml(n,g?m(d):y)),concave:g&&n}]})),r=[e,e,0,0,0],i=n.findIndex(((t,e)=>!(n[(e-1+n.length)%n.length][0].concave||n[(e-1+n.length)%n.length][1].concave||t[0].concave||t[0].concave||t[1].concave))),o=n.slice(i).concat(n.slice(0,i));let a=[];return o.flatMap(((t,e)=>{const i=[],s=o[n.length-1];return 0===e&&i.push(["M",...s[1].p]),t[0].concave?a.push(t[0].p,t[1].p):i.push(["A",...r,...t[0].p]),t[1].concave?a.unshift(t[1].p):i.push(["L",...t[1].p]),3===a.length&&(i.pop(),i.push(["C",...a.flat()]),a=[]),i}))},NI=(t,e)=>{const n=Gl(t).map(((e,n)=>({p:e,v:Ml(yl(t[(n+1)%t.length],e))})));return n.forEach(((r,i)=>{const o=i>0?i-1:t.length-1,a=n[o].v,s=Ml(ml(a,xl(r.v,Sl(a,r.v,!0)<Math.PI?1:-1)));r.p=ml(r.p,xl(s,e))})),Th(n.map((t=>t.p)))},kI=(t,e)=>{const n=t.map(((n,r)=>{const i=t[0===r?t.length-1:r-1],o=Cl(xl(Ml(Nl(yl(i,n),!1)),e));return[ml(i,o),ml(n,o)]})).flat();return n.map(((t,e)=>{if(e%2==0)return null;return Al([n[(e-1)%n.length],n[e%n.length]],[n[(e+1)%n.length],n[(e+2)%n.length]],!0)})).filter(Boolean).map(((t,e)=>[0===e?"M":"L",t[0],t[1]])).concat([["Z"]])};class CI extends iL{shape;hullMemberIds=[];path;optionsCache;static defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};constructor(t,e){super(t,Object.assign({},CI.defaultOptions,e)),this.bindEvents()}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const{members:e,padding:n,corner:r,...i}=this.options;return{...i,d:this.getHullPath(t)}}drawHull=()=>{if(this.shape){const t=!fe(this.optionsCache,this.options);this.shape.update(this.getHullStyle(t))}else this.shape=new Ah({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);this.optionsCache={...this.options}};updateHullPath=t=>{this.shape&&this.options.members.includes(Gu(t.data))&&this.shape.update({d:this.getHullPath(!0)})};getHullPath=(t=!1)=>{const{graph:e}=this.context,n=this.getMember();if(0===n.length)return"";const r=n.map((t=>e.getNodeData(t))),i=wI(r.map(Pl),this.options.concavity).slice(1).reverse(),o=i.flatMap((t=>r.filter((e=>fe(Pl(e),t))).map(Gu)));return fe(o,this.hullMemberIds)&&!t||(this.hullMemberIds=o,this.path=function(t,e,n){if(1===t.length)return EI(t[0],e,n);if(2===t.length)return MI(t,e,n);switch(n){case"smooth":return NI(t,e);case"sharp":return kI(t,e);default:return SI(t,e)}}(i,this.getPadding(),this.options.corner)),this.path};getPadding(){const{graph:t}=this.context,e=this.hullMemberIds.reduce(((e,n)=>{const{halfExtents:r}=t.getElementRenderBounds(n),i=Math.max(r[0],r[1]);return Math.max(e,i)}),0);return e+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),e.some((t=>this.hullMemberIds.includes(t)))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Rt(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}function TI(t,e){e(t),t.children&&t.children.forEach((function(t){t&&TI(t,e)}))}function AI(t){OI(t,!0)}function PI(t){OI(t,!1)}function OI(t,e){var n=e?"visible":"hidden";TI(t,(function(t){t.attr("visibility",n)}))}var RI=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,h([],l(e),!1))||this;return r.isMutationObserved=!0,r.addEventListener(hs.INSERTED,(function(){PI(r)})),r}return r(e,t),e}(Ys);function _I(t){var e=t.appendChild(new RI({class:"offscreen"}));return PI(e),e}var DI=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({style:i({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=_I(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(ec);function LI(t){return t*Math.PI/180}function II(t){return Number((180*t/Math.PI).toPrecision(5))}var jI=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();function BI(t,e){return Rt(t)?t.apply(void 0,h([],l(e),!1)):t}var FI,zI=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map((function(t){var e=l(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]})));return Object.assign(r,{prefix:n}),r},GI=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach((function(i){var o=l(i,2),a=o[0],s=o[1],c=t;Object.prototype.hasOwnProperty.call(e,a)&&(s?zt(s)?(zt(t[a])||(c[a]={}),n<r?GI(t[a],s,n+1,r):c[a]=e[a]):It(s)?(c[a]=[],c[a]=c[a].concat(s)):c[a]=s:c[a]=s)}))},VI=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)GI(t,e[r]);return t},WI=function(t){return void 0!==t&&null!=t&&!Number.isNaN(t)},HI=function(t,e,n){if(!Rt(t))throw new TypeError("Expected a function");var r=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=t.apply(this,n);return a.set(o,s),s};return r.cache=function(t){var e,n,r,i=t;function o(t,o){++e>i&&(r=n,a(1),++e),n[t]=o}function a(t){e=0,n=Object.create(null),t||(r=Object.create(null))}return a(),{clear:a,has:function(t){return void 0!==n[t]||void 0!==r[t]},get:function(t){var e=n[t];return void 0!==e?e:void 0!==(e=r[t])?(o(t,e),e):void 0},set:function(t,e){void 0!==n[t]?n[t]=e:o(t,e)}}}(n),r}((function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return FI||(FI=Cs.offscreenCanvasCreator.getOrCreateContext(void 0)),FI.font=[o,a,i,"".concat(n,"px"),r].join(" "),FI.measureText(t).width}),(function(t,e){return[t,Object.values(e||$I(t)).join()].join("")}),4096),$I=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function UI(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}function YI(t,e){var n=UI(t);n&&n.attr(e)}function qI(t,e,n){void 0===n&&(n="..."),YI(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function KI(t){var e=t.canvas,n=t.touches,r=t.offsetX,i=t.offsetY;if(e)return[e.x,e.y];if(n){var o=n[0];return[o.clientX,o.clientY]}return r&&i?[r,i]:[0,0]}function XI(t){return"function"==typeof t?t():Wt(t)||Yt(t)?new DI({style:{text:String(t)}}):t}function ZI(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function QI(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=!1),!!(r&&t===e||i&&t===n)||t>e&&t<n}var JI=function(t,e){return function(n){return t*(1-n)+e*n}};function tj(t,e){return"number"==typeof t&&"number"==typeof e?JI(t,e):Array.isArray(t)&&Array.isArray(e)?function(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0;return function(i){var o=new Array(r),a=new Array(n),s=0;for(s=0;s<r;++s)o[s]=tj(t[s],e[s]);for(;s<n;++s)a[s]=e[s];for(s=0;s<r;++s)a[s]=o[s](i);return a}}(t,e):"object"==typeof t&&"object"==typeof e?function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n={},r={};return Object.entries(e).forEach((function(e){var i=l(e,2),o=i[0],a=i[1];o in t?n[o]=tj(t[o],a):r[o]=a})),function(t){return Object.entries(n).forEach((function(e){var n=l(e,2),i=n[0],o=n[1];return r[i]=o(t)})),r}}(t,e):function(e){return t}}function ej(t){for(var e=1/0,n=1/0,r=-1/0,i=-1/0,o=0;o<t.length;o++){var a=t[o],s=a.x,c=a.y,u=l([s+a.width,c+a.height],2),h=u[0],d=u[1];s<e&&(e=s),c<n&&(n=c),h>r&&(r=h),d>i&&(i=d)}return new jI(e,n,r-e,i-n)}var nj=function(t,e,n){var r=t.width,i=t.height,o=n.flexDirection,a=void 0===o?"row":o;n.flexWrap;var s=n.justifyContent,c=void 0===s?"flex-start":s;n.alignContent;var u=n.alignItems,h=void 0===u?"flex-start":u,d="row"===a,f="row"===a||"column"===a,p=d?f?[1,0]:[-1,0]:f?[0,1]:[0,-1],g=l([0,0],2),m=g[0],y=g[1],v=e.map((function(t){var e,n=t.width,r=t.height,i=l([m,y],2),o=i[0],a=i[1];return e=l([m+n*p[0],y+r*p[1]],2),m=e[0],y=e[1],new jI(o,a,n,r)})),b=ej(v),x={"flex-start":0,"flex-end":d?r-b.width:i-b.height,center:d?(r-b.width)/2:(i-b.height)/2},w=v.map((function(t){var e=t.x,n=t.y,r=jI.fromRect(t);return r.x=d?e+x[c]:e,r.y=d?n:n+x[c],r}));ej(w);var E=function(t){var e=l(d?["height",i]:["width",r],2),n=e[0],o=e[1];switch(h){case"flex-start":default:return 0;case"flex-end":return o-t[n];case"center":return o/2-t[n]/2}},M=w.map((function(t){var e=t.x,n=t.y,r=jI.fromRect(t);return r.x=d?e:e+E(r),r.y=d?n+E(r):n,r})),S=M.map((function(e){var n,r,i=jI.fromRect(e);return i.x+=null!==(n=t.x)&&void 0!==n?n:0,i.y+=null!==(r=t.y)&&void 0!==r?r:0,i}));return S},rj=function(t,e,n){return[]};function ij(t,e){return[t[0]*e,t[1]*e]}function oj(t,e){return[t[0]+e[0],t[1]+e[1]]}function aj(t,e){return[t[0]-e[0],t[1]-e[1]]}function sj(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1])]}function cj(t,e){return[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}function uj(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function lj(t){if(0===t[0]&&0===t[1])return[0,0];var e=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2));return[t[0]/e,t[1]/e]}function hj(t,e){return+t.toPrecision(e)}function dj(t,e){var n={},r=Array.isArray(e)?e:[e];for(var i in t)r.includes(i)||(n[i]=t[i]);return n}function fj(t,e,n){void 0===n&&(n=[[0,0],[1,1]]);for(var r=!!e,i=[],o=0,a=t.length;o<a;o+=2)i.push([t[o],t[o+1]]);var s,c,u,h=function(t,e,n,r){var i,o,a,s,c,u,h=[],d=!!r,f=[1/0,1/0],p=[-1/0,-1/0];if(d){f=(i=l(r,2))[0],p=i[1];for(var g=0,m=t.length;g<m;g+=1)f=sj(f,v=t[g]),p=cj(p,v)}g=0;for(var y=t.length;g<y;g+=1){var v=t[g];if(0!==g||n)if(g!==y-1||n){o=t[g-1];var b=[0,0];b=ij(b=aj(a=t[g+1],o),e);var x=uj(v,o),w=uj(v,a),E=x+w;0!==E&&(x/=E,w/=E);var M=ij(b,-x),S=ij(b,w);c=oj(v,M),s=sj(s=oj(v,S),cj(a,v)),s=cj(s,sj(a,v)),c=sj(c=oj(v,M=ij(M=aj(s,v),-x/w)),cj(o,v)),s=oj(v,S=ij(S=aj(v,c=cj(c,sj(o,v))),w/x)),d&&(c=sj(c=cj(c,f),p),s=sj(s=cj(s,f),p)),h.push(u),h.push(c),u=s}else c=v,h.push(u),h.push(c);else u=v}return h}(i,.4,r,n),d=i.length,f=[];for(o=0;o<d-1;o+=1)s=h[2*o],c=h[2*o+1],u=i[o+1],f.push(["C",s[0],s[1],c[0],c[1],u[0],u[1]]);return f}var pj=["$el","cx","cy","d","dx","dy","fill","fillOpacity","filter","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","height","img","increasedLineWidthForHitTesting","innerHTML","isBillboard","billboardRotation","isSizeAttenuation","isClosed","isOverflowing","leading","letterSpacing","lineDash","lineHeight","lineWidth","markerEnd","markerEndOffset","markerMid","markerStart","markerStartOffset","maxLines","metrics","miterLimit","offsetX","offsetY","opacity","path","points","r","radius","rx","ry","shadowColor","src","stroke","strokeOpacity","text","textAlign","textBaseline","textDecorationColor","textDecorationLine","textDecorationStyle","textOverflow","textPath","textPathSide","textPathStartOffset","transform","transformOrigin","visibility","width","wordWrap","wordWrapWidth","x","x1","x2","y","y1","y2","z1","z2","zIndex"];function gj(t){return pj.includes(t)}function mj(t){var e={};for(var n in t)gj(n)&&(e[n]=t[n]);return e}function yj(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=e/Math.max(i,o);return t.style.transform="scale(".concat(a,")"),a}var vj=function(){function t(t,n,r,i,o,a,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===a&&(a=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=a,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var a=this._data[o],s=l(Array.isArray(a)?a:[a,null],2),c=s[0],u=s[1];(d=r(c,o)).__data__=c,null!==u&&(d.__fromElements__=u),this._parent.appendChild(d),i.push(d)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var h=this._elements[o],d=r(c=h.__data__,o);h.appendChild(d),i.push(d)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=d(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=d(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=d(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var a,s,c,l=[],h=[],d=new Set(this._elements),f=[],p=new Set,g=new Map(this._elements.map((function(t,n){return[e(t.__data__,n),t]}))),m=new Map(this._facetElements.map((function(t,n){return[e(t.__data__,n),t]}))),y=(a=this._elements,s=function(t){return r(t.__data__)},c=new Map,a.forEach((function(t){var e=s(t);c.has(e)||c.set(e,[]),c.get(e).push(t)})),c),v=0;v<t.length;v++){var b=t[v],x=e(b,v),w=r(b,v);if(g.has(x))(N=g.get(x)).__data__=b,N.__facet__=!1,h.push(N),d.delete(N),g.delete(x);else if(m.has(x)){(N=m.get(x)).__data__=b,N.__facet__=!0,h.push(N),m.delete(x)}else if(y.has(x)){var E=y.get(x);f.push([b,E]);try{for(var M=(i=void 0,u(E)),S=M.next();!S.done;S=M.next()){var N=S.value;d.delete(N)}}catch(t){i={error:t}}finally{try{S&&!S.done&&(o=M.return)&&o.call(M)}finally{if(i)throw i.error}}y.delete(x)}else if(g.has(w)){(N=g.get(w)).__toData__?N.__toData__.push(b):N.__toData__=[b],p.add(N),d.delete(N)}else l.push(b)}var k=[new n([],l,this._parent,this._document),new n(h,null,this._parent,this._document),new n(d,null,this._parent,this._document),new n([],f,this._parent,this._document),new n(p,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,k)},t.prototype.merge=function(t){var e=h(h([],l(this._elements),!1),l(t._elements),!1),r=h(h([],l(this._transitions),!1),l(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),a=e(this._update),s=n(this._exit),c=r(this._merge),u=i(this._split);return a.merge(o).merge(s).merge(c).merge(u)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then((function(){return n.remove()})):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each((function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))}))},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each((function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))}))},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each((function(n,r){var i=this;Object.entries(t).forEach((function(t){var o=l(t,2),a=o[0],s=o[1],c="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(a,c.call(i,n,r))}))}))},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.transition=function(t){var e=this._transitions;return this.each((function(n,r){e[r]=t.call(this,n,r)}))},t.prototype.on=function(t,e){return this.each((function(){this.addEventListener(t,e)})),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,h([this._parent,this],l(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter((function(t){return!!t}))},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:Ys,rect:tc,circle:Hs,path:Zs,text:DI,ellipse:Us,image:Ks,line:Xs,polygon:Qs,polyline:Js,html:qs},t}();function bj(t){return new vj([t],null,t,t.ownerDocument)}function xj(t){if(Yt(t))return[t,t,t,t];if(It(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function wj(t){var e=t.getLocalBounds(),n=l([e.min,e.max],2),r=l(n[0],2),i=r[0],o=r[1],a=l(n[1],2),s=a[0],c=a[1];return{x:i,y:o,width:s-i,height:c-o,left:i,bottom:c,top:o,right:s}}function Ej(t,e){var n=l(t,2),r=n[0],i=n[1],o=l(e,2),a=o[0],s=o[1];return r!==a&&i===s}function Mj(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Sj(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var Nj=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function kj(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach((function(t){var i=l(t,2),o=i[0],a=i[1];if("className"===o||"class"===o);else if(Nj(o,"show")&&Nj(Sj(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(Mj(t))}(e,"show")?r[o]=a:r[o.replace(new RegExp(Mj(e)),"")]=a;else if(!Nj(o,"show")&&Nj(o,e)!==n){var s=Sj(o,e);"filter"===s&&"function"==typeof a||(r[s]=a)}})),r}function Cj(t,e){return Object.entries(t).reduce((function(t,n){var r=l(n,2),i=r[0],o=r[1];return i.startsWith("show")?t["show".concat(e).concat(i.slice(4))]=o:t["".concat(e).concat(Mj(i))]=o,t}),{})}function Tj(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach((function(t){var o=l(t,2),a=o[0],s=o[1];e.includes(a)||(-1!==n.indexOf(a)?i[a]=s:r[a]=s)})),[r,i]}function Aj(t,e){var n={YYYY:t.getFullYear(),MM:t.getMonth()+1,DD:t.getDate(),HH:t.getHours(),mm:t.getMinutes(),ss:t.getSeconds()},r=e;return Object.keys(n).forEach((function(t){var e=n[t];r=r.replace(t,"YYYY"===t?"".concat(e):"".concat(e).padStart(2,"0"))})),r}function Pj(t,e){if(e)try{var n=e.replace(/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,(function(e,n,r){return"translate(".concat(function(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,a=l([e,n].map((function(t,e){var n;return t.includes("%")?parseFloat((null===(n=t.match(/[+-]?([0-9]*[.])?[0-9]+/))||void 0===n?void 0:n[0])||"0")/100*(0===e?i:o):t})),2);return[a[0],a[1]]}(t,n,r),")")}));t.attr("transform",n)}catch(t){}}function Oj(){OI(this,"hidden"!==this.attributes.visibility)}var Rj=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,VI({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=_I(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&Oj.call(this)},e.prototype.update=function(t,e){var n;return this.attr(VI({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,o(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}($s),_j=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},Dj=_j,Lj=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},Ij=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},jj=Ij;var Bj=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function Fj(t){var e=function(t){var e="default";if(jt(t)&&t instanceof Image)e="image";else if(Rt(t))e="symbol";else if(Wt(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var zj=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,n){var r=t.x,a=void 0===r?0:r,s=t.y,c=void 0===s?0:s,u=this.getSubShapeStyle(t),l=u.symbol,h=u.size,d=void 0===h?16:h,f=o(u,["symbol","size"]),p=Fj(l);ZI(!!p,bj(n),(function(t){t.maybeAppendByClassName("marker",p).attr("className","marker ".concat(p,"-marker")).call((function(t){if("image"===p){var n=2*d;t.styles({img:l,width:n,height:n,x:a-d,y:c-d})}else{n=d/2;var r=Rt(l)?l:e.getSymbol(l);t.styles(i({d:null==r?void 0:r(a,c,n)},f))}}))}))},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(Rj);function Gj(t,...e){return e.reduce(((t,e)=>n=>t(e(n))),t)}function Vj(t,e){return e-t?n=>(n-t)/(e-t):t=>.5}zj.registerSymbol("cross",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]})),zj.registerSymbol("hyphen",(function(t,e,n){return[["M",t-n,e],["L",t+n,e]]})),zj.registerSymbol("line",Lj),zj.registerSymbol("plus",(function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]})),zj.registerSymbol("tick",(function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]})),zj.registerSymbol("circle",_j),zj.registerSymbol("point",Dj),zj.registerSymbol("bowtie",(function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]})),zj.registerSymbol("hexagon",(function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]})),zj.registerSymbol("square",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]})),zj.registerSymbol("diamond",(function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]})),zj.registerSymbol("triangle",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]})),zj.registerSymbol("triangle-down",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]})),zj.registerSymbol("line",Lj),zj.registerSymbol("dot",Ij),zj.registerSymbol("dash",jj),zj.registerSymbol("smooth",(function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]})),zj.registerSymbol("hv",(function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]})),zj.registerSymbol("vh",(function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]})),zj.registerSymbol("hvh",(function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]})),zj.registerSymbol("vhv",(function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}));const Wj=Math.sqrt(50),Hj=Math.sqrt(10),$j=Math.sqrt(2);function Uj(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/10**i;return i>=0?(o>=Wj?10:o>=Hj?5:o>=$j?2:1)*10**i:-(10**-i)/(o>=Wj?10:o>=Hj?5:o>=$j?2:1)}const Yj=(t,e,n=5)=>{const r=[t,e];let i,o=0,a=r.length-1,s=r[o],c=r[a];return c<s&&([s,c]=[c,s],[o,a]=[a,o]),i=Uj(s,c,n),i>0?(s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i,i=Uj(s,c,n)):i<0&&(s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i,i=Uj(s,c,n)),i>0?(r[o]=Math.floor(s/i)*i,r[a]=Math.ceil(c/i)*i):i<0&&(r[o]=Math.ceil(s*i)/i,r[a]=Math.floor(c*i)/i),r};function qj(t){return!(oe(t)||(e=t,null===e)||Number.isNaN(t));var e}var Kj={exports:{}},Xj={exports:{}},Zj=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},Qj=Array.prototype.concat,Jj=Array.prototype.slice,tB=Xj.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];Zj(i)?e=Qj.call(e,Jj.call(i)):e.push(i)}return e};tB.wrap=function(t){return function(){return t(tB(arguments))}};var eB=Xj.exports,nB={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},rB=eB,iB=Object.hasOwnProperty,oB=Object.create(null);for(var aB in nB)iB.call(nB,aB)&&(oB[nB[aB]]=aB);var sB=Kj.exports={to:{},get:{}};function cB(t,e,n){return Math.min(Math.max(e,t),n)}function uB(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}sB.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=sB.get.hsl(t),n="hsl";break;case"hwb":e=sB.get.hwb(t),n="hwb";break;default:e=sB.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},sB.get.rgb=function(t){if(!t)return null;var e,n,r,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var o=2*n;i[n]=parseInt(e.slice(o,o+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)i[n]=parseInt(e[n]+e[n],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)i[n]=parseInt(e[n+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:iB.call(nB,e[1])?((i=nB[e[1]])[3]=1,i):null:null;for(n=0;n<3;n++)i[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(n=0;n<3;n++)i[n]=cB(i[n],0,255);return i[3]=cB(i[3],0,1),i},sB.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,cB(parseFloat(e[2]),0,100),cB(parseFloat(e[3]),0,100),cB(isNaN(n)?1:n,0,1)]}return null},sB.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,cB(parseFloat(e[2]),0,100),cB(parseFloat(e[3]),0,100),cB(isNaN(n)?1:n,0,1)]}return null},sB.to.hex=function(){var t=rB(arguments);return"#"+uB(t[0])+uB(t[1])+uB(t[2])+(t[3]<1?uB(Math.round(255*t[3])):"")},sB.to.rgb=function(){var t=rB(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},sB.to.rgb.percent=function(){var t=rB(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},sB.to.hsl=function(){var t=rB(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},sB.to.hwb=function(){var t=rB(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},sB.to.keyword=function(t){return oB[t.slice(0,3)]};var lB=p(Kj.exports);function hB(t,e,n){let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function dB(t){const e=lB.get(t);if(!e)return null;const{model:n,value:r}=e;return"rgb"===n?r:"hsl"===n?function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100,i=t[3];if(0===n)return[255*r,255*r,255*r,i];const o=r<.5?r*(1+n):r+n-r*n,a=2*r-o;return[255*hB(a,o,e+1/3),255*hB(a,o,e),255*hB(a,o,e-1/3),i]}(r):null}const fB=(t,e)=>n=>t*(1-n)+e*n,pB=(t,e)=>"number"==typeof t&&"number"==typeof e?fB(t,e):"string"==typeof t&&"string"==typeof e?((t,e)=>{const n=dB(t),r=dB(e);return null===n||null===r?n?()=>t:()=>e:t=>{const e=new Array(4);for(let i=0;i<4;i+=1){const o=n[i],a=r[i];e[i]=o*(1-t)+a*t}const[i,o,a,s]=e;return`rgba(${Math.round(i)}, ${Math.round(o)}, ${Math.round(a)}, ${s})`}})(t,e):()=>t,gB=(t,e)=>{const n=fB(t,e);return t=>Math.round(n(t))};function mB({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):n}function yB(t){return"object"==typeof t?t.valueOf():t}class vB extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=yB,null!==t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(mB({map:this.map,initKey:this.initKey},t))}has(t){return super.has(mB({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(function({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(function({map:t,initKey:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}({map:this.map,initKey:this.initKey},t))}}class bB{constructor(t){this.options=le({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=le({},this.options,t),this.rescale(t)}rescale(t){}}const xB=Symbol("defaultUnknown");function wB(t,e,n){for(let r=0;r<e.length;r+=1)t.has(e[r])||t.set(n(e[r]),r)}function EB(t){const{value:e,from:n,to:r,mapper:i,notFoundReturn:o}=t;let a=i.get(e);if(void 0===a){if(o!==xB)return o;a=n.push(e)-1,i.set(e,a)}return r[a%r.length]}function MB(t){return t instanceof Date?t=>`${t}`:"object"==typeof t?t=>JSON.stringify(t):t=>t}class SB extends bB{getDefaultOptions(){return{domain:[],range:[],unknown:xB}}constructor(t){super(t)}map(t){return 0===this.domainIndexMap.size&&wB(this.domainIndexMap,this.getDomain(),this.domainKey),EB({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&wB(this.rangeIndexMap,this.getRange(),this.rangeKey),EB({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){const[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=MB(e),this.rangeKey=MB(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new SB(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function NB(t){return Math.round(1e12*t)/1e12}function kB(t){const{domain:e,range:n,paddingOuter:r,paddingInner:i,flex:o,round:a,align:s}=t,c=e.length,u=function(t,e){const n=e-t.length;return n>0?[...t,...new Array(n).fill(1)]:n<0?t.slice(0,e):t}(o,c),[l,h]=n,d=h-l,f=d/(2/c*r+1-1/c*i),p=f*i/c,g=f-c*p,m=function(t){const e=Math.min(...t);return t.map((t=>t/e))}(u),y=g/m.reduce(((t,e)=>t+e)),v=new vB(e.map(((t,e)=>{const n=m[e]*y;return[t,a?Math.floor(n):n]}))),b=new vB(e.map(((t,e)=>{const n=m[e]*y+p;return[t,a?Math.floor(n):n]}))),x=Array.from(b.values()).reduce(((t,e)=>t+e)),w=l+(d-(x-x/c*i))*s;let E=a?Math.round(w):w;const M=new Array(c);for(let t=0;t<c;t+=1){M[t]=NB(E);const n=e[t];E+=b.get(n)}return{valueBandWidth:v,valueStep:b,adjustedRange:M}}class CB extends SB{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:xB,flex:[]}}constructor(t){super(t)}clone(){return new CB(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:r,flex:i}=this.options,{adjustedRange:o,valueBandWidth:a,valueStep:s}=function(t){var e;const{domain:n}=t,r=n.length;if(0===r)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(null===(e=t.flex)||void 0===e?void 0:e.length)return kB(t);const{range:i,paddingOuter:o,paddingInner:a,round:s,align:c}=t;let u,l,h=i[0];const d=i[1]-h,f=2*o,p=r-a;u=d/Math.max(1,f+p),s&&(u=Math.floor(u)),h+=(d-u*(r-a))*c,l=u*(1-a),s&&(h=Math.round(h),l=Math.round(l));const g=new Array(r).fill(0).map(((t,e)=>h+e*u));return{valueStep:u,valueBandWidth:l,adjustedRange:g}}({align:t,range:n,round:r,flex:i,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=s,this.valueBandWidth=a,this.adjustedRange=o}}const TB=(t,e,n)=>{let r,i,o=t,a=e;if(o===a&&n>0)return[o];let s=Uj(o,a,n);if(0===s||!Number.isFinite(s))return[];if(s>0){o=Math.ceil(o/s),a=Math.floor(a/s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)*s}else{s=-s,o=Math.ceil(o*s),a=Math.floor(a*s),i=new Array(r=Math.ceil(a-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)/s}return i},AB=(t,e,n)=>{const[r,i]=t,[o,a]=e;let s,c;return r<i?(s=Vj(r,i),c=n(o,a)):(s=Vj(i,r),c=n(a,o)),Gj(c,s)},PB=(t,e,n)=>{const r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=t[0]>t[r],s=a?[...t].reverse():t,c=a?[...e].reverse():e;for(let t=0;t<r;t+=1)i[t]=Vj(s[t],s[t+1]),o[t]=n(c[t],c[t+1]);return e=>{const n=function(t,e,n,r,i){let o=n||0,a=r||t.length;for(;o<a;){const n=Math.floor((o+a)/2);t[n]>e?a=n:o=n+1}return o}(t,e,1,r)-1,a=i[n];return Gj(o[n],a)(e)}},OB=(t,e,n,r)=>(Math.min(t.length,e.length)>2?PB:AB)(t,e,r?gB:n);class RB extends bB{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:fB,tickCount:5}}map(t){return qj(t)?this.output(t):this.options.unknown}invert(t){return qj(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...r]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...r)}getTicks(){const{tickMethod:t}=this.options,[e,n,r,...i]=this.getTickMethodOptions();return t(e,n,r,...i)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return Yj}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,r=this.options.domain.map(t),i=Math.min(r.length,n.length);return e?function(t,e){const n=e<t?e:t,r=t>e?t:e;return t=>Math.min(Math.max(n,t),r)}(r[0],r[i-1]):we}composeOutput(t,e){const{domain:n,range:r,round:i,interpolate:o}=this.options,a=OB(n.map(t),r,o,i);this.output=Gj(a,e,t)}composeInput(t,e,n){const{domain:r,range:i}=this.options,o=OB(i,r.map(t),fB);this.input=Gj(e,n,o)}}class _B extends RB{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:pB,tickMethod:TB,tickCount:5}}chooseTransforms(){return[we,we]}clone(){return new _B(this.options)}}var DB=function(t){function e(e){var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,le({},{type:"column"},i({style:r},a)))||this).columnsGroup=new Ys({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return r(e,t),e.prototype.render=function(){var t=this.attributes,e=t.columns,n=t.x,r=t.y;this.columnsGroup.style.transform="translate(".concat(n,", ").concat(r,")"),bj(this.columnsGroup).selectAll(".column").data(e.flat()).join((function(t){return t.append("rect").attr("className","column").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.update=function(t){this.attr(VI({},this.attributes,t)),this.render()},e.prototype.clear=function(){this.removeChildren()},e}(Ws),LB=function(t){function e(e){var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,le({},{type:"lines"},i({style:r},a)))||this).linesGroup=n.appendChild(new Ys),n.areasGroup=n.appendChild(new Ys),n.render(),n}return r(e,t),e.prototype.render=function(){var t=this.attributes,e=t.lines,n=t.areas,r=t.x,i=t.y;this.style.transform="translate(".concat(r,", ").concat(i,")"),e&&this.renderLines(e),n&&this.renderAreas(n)},e.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},e.prototype.update=function(t){this.attr(VI({},this.attributes,t)),this.render()},e.prototype.renderLines=function(t){bj(this.linesGroup).selectAll(".line").data(t).join((function(t){return t.append("path").attr("className","line").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.attr(t)}))}),(function(t){return t.remove()}))},e.prototype.renderAreas=function(t){bj(this.linesGroup).selectAll(".area").data(t).join((function(t){return t.append("path").attr("className","area").each((function(t){this.attr(t)}))}),(function(t){return t.each((function(t){this.style(t)}))}),(function(t){return t.remove()}))},e}(Ws);function IB(t,e){void 0===e&&(e=!1);var n=e?t.length-1:0,r=t.map((function(t,e){return h([e===n?"M":"L"],l(t),!1)}));return e?r.reverse():r}function jB(t,e){if(void 0===e&&(e=!1),t.length<=2)return IB(t);for(var n=[],r=t.length,i=0;i<r;i+=1){var o=e?t[r-i-1]:t[i];fe(o,n.slice(-2))||n.push.apply(n,h([],l(o),!1))}var a=fj(n,!1);return e?a.unshift(h(["M"],l(t[r-1]),!1)):a.unshift(h(["M"],l(t[0]),!1)),a}function BB(t,e,n){var r=ae(t);return r.push(["L",e,n],["L",0,n],["Z"]),r}function FB(t){return 0===t.length?[0,0]:[Vt(Zt(t,(function(t){return Vt(t)||0}))),Gt(Xt(t,(function(t){return Gt(t)||0})))]}function zB(t){for(var e=ae(t),n=e[0].length,r=l([Array(n).fill(0),Array(n).fill(0)],2),i=r[0],o=r[1],a=0;a<e.length;a+=1)for(var s=e[a],c=0;c<n;c+=1)s[c]>=0?(s[c]+=i[c],i[c]=s[c]):(s[c]+=o[c],o[c]=s[c]);return e}var GB=function(t){function e(e){return t.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return r(e,t),Object.defineProperty(e.prototype,"rawData",{get:function(){var t=this.attributes.data;if(!t||0===(null==t?void 0:t.length))return[[]];var e=ae(t);return Yt(e[0])?[e]:e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.isStack?zB(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){var t=this.scales.y,e=l(t.getOptions().domain||[0,0],2),n=e[0],r=e[1];return r<0?t.map(r):t.map(n<0?0:n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"containerShape",{get:function(){var t=this.attributes;return{width:t.width,height:t.height}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linesStyle",{get:function(){var t=this,e=this.attributes,n=e.type,r=e.isStack,o=e.smooth;if("line"!==n)throw new Error("linesStyle can only be used in line type");var a=kj(this.attributes,"area"),s=kj(this.attributes,"line"),c=this.containerShape.width,u=this.data;if(0===u[0].length)return{lines:[],areas:[]};var d=this.scales,f=function(t,e){var n,r=e.x,i=e.y,o=l(i.getOptions().range||[0,0],2),a=o[0],s=o[1];return s>a&&(n=l([a,s],2),s=n[0],a=n[1]),t.map((function(t){return t.map((function(t,e){return[r.map(e),Ut(i.map(t),s,a)]}))}))}(u,{type:"line",x:d.x,y:d.y}),p=[];if(a){var g=this.baseline;p=r?o?function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=t[i],a=jB(o),s=void 0;if(0===i)s=BB(a,e,n);else{var c=jB(t[i-1],!0),u=o[0];c[0][0]="L",s=h(h(h([],l(a),!1),l(c),!1),[h(["M"],l(u),!1),["Z"]],!1)}r.push(s)}return r}(f,c,g):function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=IB(t[i]),a=void 0;if(0===i)a=BB(o,e,n);else{var s=IB(t[i-1],!0);s[0][0]="L",a=h(h(h([],l(o),!1),l(s),!1),[["Z"]],!1)}r.push(a)}return r}(f,c,g):function(t,e,n,r){return t.map((function(t){return BB(e?jB(t):IB(t),n,r)}))}(f,o,c,g)}return{lines:f.map((function(e,n){return i({stroke:t.getColor(n),d:o?jB(e):IB(e)},s)})),areas:p.map((function(e,n){return i({d:e,fill:t.getColor(n)},a)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnsStyle",{get:function(){var t=this,e=kj(this.attributes,"column"),n=this.attributes,r=n.isStack,o=n.type,a=n.scale;if("column"!==o)throw new Error("columnsStyle can only be used in column type");var s=this.containerShape.height,c=this.rawData;if(!c)return{columns:[]};r&&(c=zB(c));var u=this.createScales(c),h=u.x,d=u.y,f=l(FB(c),2),p=f[0],g=f[1],m=new _B({domain:[0,g-(p>0?0:p)],range:[0,s*a]}),y=h.getBandWidth(),v=this.rawData;return{columns:c.map((function(n,o){return n.map((function(n,a){var s=y/c.length;return i(i({fill:t.getColor(o)},e),r?{x:h.map(a),y:d.map(n),width:y,height:m.map(v[o][a])}:{x:h.map(a)+s*o,y:n>=0?d.map(n):d.map(0),width:s,height:m.map(Math.abs(n))})}))}))}},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){var n,r,o;(n=e,r=".container",o="rect",n.querySelector(r)?bj(n).select(r):bj(n).append(o)).attr("className","container").node();var a=t.type,s=t.x,c=t.y,u="spark".concat(a),l=i({x:s,y:c},"line"===a?this.linesStyle:this.columnsStyle);bj(e).selectAll(".spark").data([a]).join((function(t){return t.append((function(t){return"line"===t?new LB({className:u,style:l}):new DB({className:u,style:l})})).attr("className","spark ".concat(u))}),(function(t){return t.update(l)}),(function(t){return t.remove()}))},e.prototype.getColor=function(t){var e=this.attributes.color;return It(e)?e[t%e.length]:Rt(e)?e.call(null,t):e},e.prototype.createScales=function(t){var e,n,r=this.attributes,i=r.type,o=r.scale,a=r.range,s=void 0===a?[]:a,c=r.spacing,u=this.containerShape,h=u.width,d=u.height,f=l(FB(t),2),p=f[0],g=f[1],m=new _B({domain:[null!==(e=s[0])&&void 0!==e?e:p,null!==(n=s[1])&&void 0!==n?n:g],range:[d,d*(1-o)]});return"line"===i?{type:i,x:new _B({domain:[0,t[0].length-1],range:[0,h]}),y:m}:{type:i,x:new CB({domain:t[0].map((function(t,e){return e})),range:[0,h],paddingInner:c,paddingOuter:c/2,align:.5}),y:m}},e.tag="sparkline",e}(Rj);function VB(t){if(!t)return{enter:!1,update:!1,exit:!1};var e=["enter","update","exit"],n=Object.fromEntries(Object.entries(t).filter((function(t){var n=l(t,1)[0];return!e.includes(n)})));return Object.fromEntries(e.map((function(e){return function(t){return"boolean"!=typeof t&&"enter"in t&&"update"in t&&"exit"in t}(t)?!1===t[e]?[e,!1]:[e,i(i({},t[e]),n)]:[e,n]})))}function WB(t,e){t?t.finished.then(e):e()}function HB(t,e){"update"in t?t.update(e):t.attr(e)}function $B(t,e,n){return 0===e.length?null:n?t.animate(e,n):(HB(t,{style:e.slice(-1)[0]}),null)}function UB(t,e,n){var r={},o={};return Object.entries(e).forEach((function(e){var n=l(e,2),i=n[0],a=n[1];if(!_t(a)){var s=t.style[i]||t.parsedStyle[i]||0;s!==a&&(r[i]=s,o[i]=a)}})),n?$B(t,[r,o],i({fill:"both"},n)):(HB(t,o),null)}function YB(t,e){return t.style.opacity||(t.style.opacity=1),UB(t,{opacity:0},e)}var qB={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},KB={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},XB={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},ZB=zI({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),QB=zI({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),JB=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,e){var n=t.x,r=t.y,a=t.size,s=void 0===a?10:a,c=t.radius,u=void 0===c?s/4:c,l=t.orientation,h=o(t,["x","y","size","radius","orientation"]),d=s,f=2.4*d,p=bj(e).maybeAppendByClassName(QB.iconRect,"rect").styles(i(i({},h),{width:d,height:f,radius:u,x:n-d/2,y:r-f/2,transformOrigin:"center"})),g=n+1/3*d-d/2,m=n+2/3*d-d/2,y=r+1/4*f-f/2,v=r+3/4*f-f/2;p.maybeAppendByClassName("".concat(QB.iconLine,"-1"),"line").styles(i({x1:g,x2:g,y1:y,y2:v},h)),p.maybeAppendByClassName("".concat(QB.iconLine,"-2"),"line").styles(i({x1:m,x2:m,y1:y,y2:v},h)),"vertical"===l&&(p.node().style.transform="rotate(90)")},e}(Rj),tF=function(t){function e(e){return t.call(this,e,XB)||this}return r(e,t),e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.x,a=n.y,s=n.showLabel,c=kj(this.attributes,"label"),u=c.x,h=void 0===u?0:u,d=c.y,f=void 0===d?0:d,p=c.transform,g=c.transformOrigin,m=l(Tj(o(c,["x","y","transform","transformOrigin"]),[]),2),y=m[0],v=m[1],b=bj(t).maybeAppendByClassName(QB.labelGroup,"g").styles(v),x=i(i({},KB),y),w=x.text,E=o(x,["text"]);ZI(!!s,b,(function(t){e.label=t.maybeAppendByClassName(QB.label,"text").styles(i(i({},E),{x:r+h,y:a+f,transform:p,transformOrigin:g,text:"".concat(w)})),e.label.on("mousedown",(function(t){t.stopPropagation()})),e.label.on("touchstart",(function(t){t.stopPropagation()}))}))},e.prototype.renderIcon=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.orientation,a=e.type,s=i(i({x:n,y:r,orientation:o},qB),kj(this.attributes,"icon")),c=this.attributes.iconShape,u=void 0===c?function(){return new JB({style:s})}:c;bj(t).maybeAppendByClassName(QB.iconGroup,"g").selectAll(QB.icon.class).data([u]).join((function(t){return t.append("string"==typeof u?u:function(){return u(a)}).attr("className",QB.icon.name)}),(function(t){return t.update(s)}),(function(t){return t.remove()}))},e.prototype.render=function(t,e){this.renderIcon(e),this.renderLabel(e)},e}(Rj),eF=function(t){function e(e){var n=t.call(this,e,i(i(i({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(t){return t.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},Cj(XB,"handle")),Cj(qB,"handleIcon")),Cj(KB,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(t){return function(e){e.stopPropagation(),n.target=t,n.prevPos=n.getOrientVal(KI(e));var r=n.availableSpace,i=r.x,o=r.y,a=n.getBBox(),s=a.x,c=a.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([i,o])-n.getOrientVal([+s,+c])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(t){var e=n.attributes,r=e.slidable,i=e.brushable,o=e.type;t.stopPropagation();var a=n.getOrientVal(KI(t)),s=a-n.prevPos;if(s){var c=n.getRatio(s);switch(n.target){case"start":r&&n.setValuesOffset(c);break;case"end":r&&n.setValuesOffset(0,c);break;case"selection":r&&n.setValuesOffset(c,c);break;case"track":if(!i)return;n.selectionWidth+=c,"range"===o?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0)}n.prevPos=a}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(t){var e=n.attributes,r=e.onChange,i=e.type,o="range"===i?t:t[1],a="range"===i?n.getValues():n.getValues()[1],s=new as("valuechange",{detail:{oldValue:o,value:a}});n.dispatchEvent(s),null==r||r(a)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return r(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return this.attributes.values},set:function(t){this.attributes.values=this.clampValues(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sparklineStyle",{get:function(){if("horizontal"!==this.attributes.orientation)return null;var t=kj(this.attributes,"sparkline");return i(i({zIndex:0},this.availableSpace),t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t=this.attributes,e=t.trackLength,n=t.trackSize,r=l(this.getOrientVal([[e,n],[n,e]]),2);return{width:r[0],height:r[1]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes;t.x,t.y;var e=l(xj(t.padding),4),n=e[0],r=e[1],i=e[2],o=e[3],a=this.shape;return{x:o,y:n,width:a.width-(o+r),height:a.height-(n+i)}},enumerable:!1,configurable:!0}),e.prototype.getValues=function(){return this.values},e.prototype.setValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1),this.attributes.values=t;var n=!1!==e&&this.attributes.animate;this.updateSelectionArea(n),this.updateHandlesPosition(n)},e.prototype.updateSelectionArea=function(t){var e=this.calcSelectionArea();this.foregroundGroup.selectAll(ZB.selection.class).each((function(n,r){UB(this,e[r],t)}))},e.prototype.updateHandlesPosition=function(t){this.attributes.showHandle&&(this.startHandle&&UB(this.startHandle,this.getHandleStyle("start"),t),this.endHandle&&UB(this.endHandle,this.getHandleStyle("end"),t))},e.prototype.innerSetValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1);var n=this.values,r=this.clampValues(t);this.attributes.values=r,this.setValues(r),e&&this.onValueChange(n)},e.prototype.renderTrack=function(t){var e=this.attributes,n=e.x,r=e.y,o=kj(this.attributes,"track");this.trackShape=bj(t).maybeAppendByClassName(ZB.track,"rect").styles(i(i({x:n,y:r},this.shape),o))},e.prototype.renderBrushArea=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.brushable;this.brushArea=bj(t).maybeAppendByClassName(ZB.brushArea,"rect").styles(i({x:n,y:r,fill:"transparent",cursor:o?"crosshair":"default"},this.shape))},e.prototype.renderSparkline=function(t){var e=this,n=this.attributes,r=n.x,o=n.y;ZI("horizontal"===n.orientation,bj(t).maybeAppendByClassName(ZB.sparklineGroup,"g"),(function(t){var n=i(i({},e.sparklineStyle),{x:r,y:o});t.maybeAppendByClassName(ZB.sparkline,(function(){return new GB({style:n})})).update(n)}))},e.prototype.renderHandles=function(){var t,e=this,n=this.attributes,r=n.showHandle,i=n.type,o=r?"range"===i?["start","end"]:["end"]:[],a=this;null===(t=this.foregroundGroup)||void 0===t||t.selectAll(ZB.handle.class).data(o.map((function(t){return{type:t}})),(function(t){return t.type})).join((function(t){return t.append((function(t){var n=t.type;return new tF({style:e.getHandleStyle(n)})})).each((function(t){var e=t.type;this.attr("class","".concat(ZB.handle.name," ").concat(e,"-handle"));var n="".concat(e,"Handle");a[n]=this,this.addEventListener("pointerdown",a.onDragStart(e))}))}),(function(t){return t.each((function(t){var e=t.type;this.update(a.getHandleStyle(e))}))}),(function(t){return t.each((function(t){var e=t.type,n="".concat(e,"Handle");a[n]=void 0})).remove()}))},e.prototype.renderSelection=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.type,a=e.selectionType;this.foregroundGroup=bj(t).maybeAppendByClassName(ZB.foreground,"g");var s=kj(this.attributes,"selection"),c=function(t){return t.style("visibility",(function(t){return t.show?"visible":"hidden"})).style("cursor",(function(t){return"select"===a?"grab":"invert"===a?"crosshair":"default"})).styles(i(i({},s),{transform:"translate(".concat(n,", ").concat(r,")")}))},u=this;this.foregroundGroup.selectAll(ZB.selection.class).data("value"===o?[]:this.calcSelectionArea().map((function(t,e){return{style:i({},t),index:e,show:"select"===a?1===e:1!==e}})),(function(t){return t.index})).join((function(t){return t.append("rect").attr("className",ZB.selection.name).call(c).each((function(t,e){var n=this;1===e?(u.selectionShape=bj(this),this.on("pointerdown",(function(t){n.attr("cursor","grabbing"),u.onDragStart("selection")(t)})),u.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),u.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),u.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",(function(){n.attr("cursor","grabbing")})),this.addEventListener("pointerup",(function(){n.attr("cursor","pointer")})),this.addEventListener("pointerover",(function(){n.attr("cursor","pointer")}))):this.on("pointerdown",u.onDragStart("track"))}))}),(function(t){return t.call(c)}),(function(t){return t.remove()})),this.updateSelectionArea(!1),this.renderHandles()},e.prototype.render=function(t,e){this.renderTrack(e),this.renderSparkline(e),this.renderBrushArea(e),this.renderSelection(e)},e.prototype.clampValues=function(t,e){var n;void 0===e&&(e=4);var r=l(this.range,2),i=r[0],o=r[1],a=l(this.getValues().map((function(t){return hj(t,e)})),2),s=a[0],c=a[1],u=l(((Array.isArray(t)?t:[s,null!=t?t:c])||[s,c]).map((function(t){return hj(t,e)})),2),h=u[0],d=u[1];if("value"===this.attributes.type)return[0,Ut(d,i,o)];h>d&&(h=(n=l([d,h],2))[0],d=n[1]);var f=d-h;return f>o-i?[i,o]:h<i?s===i&&c===d?[i,d]:[i,f+i]:d>o?c===o&&s===h?[h,o]:[o-f,o]:[h,d]},e.prototype.calcSelectionArea=function(t){var e=l(this.clampValues(t),2),n=e[0],r=e[1],i=this.availableSpace,o=i.x,a=i.y,s=i.width,c=i.height;return this.getOrientVal([[{y:a,height:c,x:o,width:n*s},{y:a,height:c,x:n*s+o,width:(r-n)*s},{y:a,height:c,x:r*s,width:(1-r)*s}],[{x:o,width:s,y:a,height:n*c},{x:o,width:s,y:n*c+a,height:(r-n)*c},{x:o,width:s,y:r*c,height:(1-r)*c}]])},e.prototype.calcHandlePosition=function(t){var e=this.attributes.handleIconOffset,n=this.availableSpace,r=n.x,i=n.y,o=n.width,a=n.height,s=l(this.clampValues(),2),c=s[0],u=s[1],h="start"===t?-e:e,d=("start"===t?c:u)*this.getOrientVal([o,a])+h;return{x:r+this.getOrientVal([d,o/2]),y:i+this.getOrientVal([a/2,d])}},e.prototype.inferTextStyle=function(t){return"horizontal"===this.attributes.orientation?{}:"start"===t?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:"end"===t?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},e.prototype.calcHandleText=function(t){var e,n=this.attributes,r=n.type,o=n.orientation,a=n.formatter,s=n.autoFitLabel,c=kj(this.attributes,"handle"),u=kj(c,"label"),l=c.spacing,h=this.getHandleSize(),d=this.clampValues(),f=a("start"===t?d[0]:d[1]),p=new DI({style:i(i(i({},u),this.inferTextStyle(t)),{text:f})}),g=p.getBBox(),m=g.width,y=g.height;if(p.destroy(),!s){if("value"===r)return{text:f,x:0,y:-y-l};var v=l+h+("horizontal"===o?m/2:0);return(e={text:f})["horizontal"===o?"x":"y"]="start"===t?-v:v,e}var b=0,x=0,w=this.availableSpace,E=w.width,M=w.height,S=this.calcSelectionArea()[1],N=S.x,k=S.y,C=S.width,T=S.height,A=l+h;if("horizontal"===o){var P=A+m/2;if("start"===t)b=N-A-m>0?-P:P;else b=E-N-C-A>m?P:-P}else{var O=y+A;x="start"===t?k-h>y?-O:A:M-(k+T)-h>y?O:-A}return{x:b,y:x,text:f}},e.prototype.getHandleLabelStyle=function(t){var e=kj(this.attributes,"handleLabel");return i(i(i({},e),this.calcHandleText(t)),this.inferTextStyle(t))},e.prototype.getHandleIconStyle=function(){var t=this.attributes.handleIconShape,e=kj(this.attributes,"handleIcon"),n=this.getOrientVal(["ew-resize","ns-resize"]),r=this.getHandleSize();return i({cursor:n,shape:t,size:r},e)},e.prototype.getHandleStyle=function(t){var e=this.attributes,n=e.x,r=e.y,o=e.showLabel,a=e.showLabelOnInteraction,s=e.orientation,c=this.calcHandlePosition(t),u=c.x,l=c.y,h=this.calcHandleText(t),d=o;return!o&&a&&(d=!!this.target),i(i(i({},Cj(this.getHandleIconStyle(),"icon")),Cj(i(i({},this.getHandleLabelStyle(t)),h),"label")),{transform:"translate(".concat(u+n,", ").concat(l+r,")"),orientation:s,showLabel:d,type:t,zIndex:3})},e.prototype.getHandleSize=function(){var t=this.attributes,e=t.handleIconSize,n=t.width,r=t.height;return e||Math.floor((this.getOrientVal([+r,+n])+4)/2.4)},e.prototype.getOrientVal=function(t){var e=l(t,2),n=e[0],r=e[1];return"horizontal"===this.attributes.orientation?n:r},e.prototype.setValuesOffset=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=!1);var r=this.attributes.type,i=l(this.getValues(),2),o=[i[0]+("range"===r?t:0),i[1]+e].sort();n?this.setValues(o):this.innerSetValues(o,!0)},e.prototype.getRatio=function(t){var e=this.availableSpace,n=e.width,r=e.height;return t/this.getOrientVal([n,r])},e.prototype.dispatchCustomEvent=function(t,e,n){var r=this;t.on(e,(function(t){t.stopPropagation(),r.dispatchEvent(new as(n,{detail:t}))}))},e.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var t=this.brushArea;this.dispatchCustomEvent(t,"click","trackClick"),this.dispatchCustomEvent(t,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(t,"pointerleave","trackMouseleave"),t.on("pointerdown",this.onDragStart("track"))},e.prototype.onScroll=function(t){if(this.attributes.scrollable){var e=t.deltaX,n=t.deltaY||e,r=this.getRatio(n);this.setValuesOffset(r,r,!0)}},e.tag="slider",e}(Rj),nF={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new Zs({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};le({},nF,{style:{type:"arc"}}),le({},nF,{style:{}});var rF=zI({mainGroup:"main-group",gridGroup:"grid-group",grid:"grid",lineGroup:"line-group",line:"line",tickGroup:"tick-group",tick:"tick",tickItem:"tick-item",labelGroup:"label-group",label:"label",labelItem:"label-item",titleGroup:"title-group",title:"title",lineFirst:"line-first",lineSecond:"line-second"},"axis"),iF=zI({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function oF(t){return t.reduce((function(t,e,n){return t.push(h([0===n?"M":"L"],l(e),!1)),t}),[])}function aF(t,e,n){return"surround"===e.type?function(t,e,n){var r=e.connect,i=void 0===r?"line":r,o=e.center;if("line"===i)return oF(t);if(!o)return[];var a=uj(t[0],o),s=n?0:1;return t.reduce((function(t,e,n){return 0===n?t.push(h(["M"],l(e),!1)):t.push(h(["A",a,a,0,0,s],l(e),!1)),t}),[])}(t,e,n):oF(t)}function sF(t,e,n){var r=n.type,i=n.connect,o=n.center,a=n.closed?[["Z"]]:[],s=l([aF(t,n),aF(e.slice().reverse(),n,!0)],2),c=s[0],u=s[1],d=l([t[0],e.slice(-1)[0]],2),f=d[0],p=d[1],g=function(t,e){return[c,t,u,e,a].flat()};if("line"===i||"surround"===r)return g([h(["L"],l(p),!1)],[h(["L"],l(f),!1)]);if(!o)throw new Error("Arc grid need to specified center");var m=l([uj(p,o),uj(f,o)],2),y=m[0],v=m[1];return g([h(["A",y,y,0,0,1],l(p),!1),h(["L"],l(p),!1)],[h(["A",v,v,0,0,0],l(f),!1),h(["L"],l(f),!1)])}var cF=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,e){t.type,t.center,t.areaFill,t.closed;var n=o(t,["type","center","areaFill","closed"]),r=function(t){var e=t.data,n=void 0===e?[]:e;return t.closed?n.map((function(t){var e=t.points,n=l(e,1)[0];return i(i({},t),{points:h(h([],l(e),!1),[n],!1)})})):n}(t),a=bj(e).maybeAppendByClassName(iF.lineGroup,"g"),s=bj(e).maybeAppendByClassName(iF.regionGroup,"g"),c=function(t,e,n,r){var o=n.animate,a=n.isBillboard,s=e.map((function(t,e){return{id:t.id||"grid-line-".concat(e),d:aF(t.points,n)}}));return t.selectAll(iF.line.class).data(s,(function(t){return t.id})).join((function(t){return t.append("path").each((function(t,e){var n=BI(mj(i({d:t.d},r)),[t,e,s]);this.attr(i({class:iF.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},n))}))}),(function(t){return t.transition((function(t,e){return UB(this,BI(mj(i({d:t.d},r)),[t,e,s]),o.update)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this,o.exit);return WB(e,(function(){return t.remove()})),e}))})).transitions()}(a,r,t,n),u=function(t,e,n){var r=n.animate,i=n.connect,o=n.areaFill;if(e.length<2||!o||!i)return[];for(var a=Array.isArray(o)?o:[o,"transparent"],s=function(t){return a[t%a.length]},c=[],u=0;u<e.length-1;u++){var h=l([e[u].points,e[u+1].points],2),d=sF(h[0],h[1],n);c.push({d:d,fill:s(u)})}return t.selectAll(iF.region.class).data(c,(function(t,e){return e})).join((function(t){return t.append("path").each((function(t,e){var n=BI(t,[t,e,c]);this.attr(n)})).attr("className",iF.region.name)}),(function(t){return t.transition((function(t,e){return UB(this,BI(t,[t,e,c]),r.update)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this,r.exit);return WB(e,(function(){return t.remove()})),e}))})).transitions()}(s,r,t);return h(h([],l(c),!1),l(u),!1)},e}(Rj);function uF(t,e){return Object.fromEntries(Object.entries(t).map((function(t){var n=l(t,2);return[n[0],BI(n[1],e)]})))}function lF(t,e){return e&&Rt(e)?t.filter(e):t}function hF(t,e){var n=e.startAngle;return(e.endAngle-n)*t+n}function dF(t,e){if("linear"===e.type){var n=l(e.startPos,2),r=n[0],i=n[1],o=l(e.endPos,2),a=l([o[0]-r,o[1]-i],2);return lj([a[0],a[1]])}var s=LI(hF(t,e));return[-Math.sin(s),Math.cos(s)]}function fF(t,e,n){return function(t,e){return e?[t[1],-t[0]]:[-t[1],t[0]]}(dF(t,n),"positive"!==e)}function pF(t,e){return fF(t,e.labelDirection,e)}function gF(t,e){return"linear"===e.type?function(t,e){var n=l(e.startPos,2),r=n[0],i=n[1],o=l(e.endPos,2),a=l([o[0]-r,o[1]-i],2);return[r+a[0]*t,i+a[1]*t]}(t,e):function(t,e){var n=e.radius,r=l(e.center,2),i=r[0],o=r[1],a=LI(hF(t,e));return[i+n*Math.cos(a),o+n*Math.sin(a)]}(t,e)}function mF(t){return 0===dF(0,t)[1]}function yF(t){return 0===dF(0,t)[0]}function vF(t,e){return e-t==360}function bF(t,e,n,r,i){var o=e-t,a=l([i,i],2),s=a[0],c=a[1],u=l([LI(t),LI(e)],2),h=u[0],d=u[1],f=function(t){return[n+i*Math.cos(t),r+i*Math.sin(t)]},p=l(f(h),2),g=p[0],m=p[1],y=l(f(d),2),v=y[0],b=y[1];if(vF(t,e)){var x=l(f((d+h)/2),2);return[["M",g,m],["A",s,c,0,1,0,x[0],x[1]],["A",s,c,0,1,0,v,b]]}var w=o>180?1:0,E=t>e?0:1;return"M".concat(g,",").concat(m,",A").concat(s,",").concat(c,",0,").concat(w,",").concat(E,",").concat(v,",").concat(b)}function xF(t,e,n,r){var o=e.startAngle,a=e.endAngle,s=e.center,c=e.radius;return t.selectAll(rF.line.class).data([{d:bF.apply(void 0,h(h([o,a],l(s),!1),[c],!1))}],(function(t,e){return e})).join((function(t){return t.append("path").attr("className",rF.line.name).styles(e).styles({d:function(t){return t.d}})}),(function(t){return t.transition((function(){var t=this,e=function(t,e,n,r){if(!r)return t.attr("__keyframe_data__",n),null;var o=r.duration,a=void 0===o?0:o,s=tj(e,n),c=Math.ceil(+a/16),u=new Array(c).fill(0).map((function(t,e,n){return{__keyframe_data__:s(e/(n.length-1))}}));return t.animate(u,i({fill:"both"},r))}(this,function(t){var e=t.attributes,n=e.startAngle,r=e.endAngle,i=e.center,o=e.radius;return h(h([n,r],l(i),!1),[o],!1)}(this),h(h([o,a],l(s),!1),[c],!1),r.update);if(e){var n=function(){var e=pe(t.attributes,"__keyframe_data__");t.style.d=bF.apply(void 0,h([],l(e),!1))};e.onframe=n,e.onfinish=n}return e})).styles(e)}),(function(t){return t.remove()})).styles(n).transitions()}function wF(t){var e=l(t,2),n=l(e[0],2),r=n[0],i=n[1],o=l(e[1],2);return{x1:r,y1:i,x2:o[0],y2:o[1]}}function EF(t,e,n,r){var i=e.showTrunc,o=e.startPos,a=e.endPos,s=e.truncRange,c=e.lineExtension,u=l([o,a],2),h=l(u[0],2),d=h[0],f=h[1],p=l(u[1],2),g=p[0],m=p[1],y=l(c?function(t,e,n){void 0===n&&(n=[0,0]);var r=l([t,e,n],3),i=l(r[0],2),o=i[0],a=i[1],s=l(r[1],2),c=s[0],u=s[1],h=l(r[2],2),d=h[0],f=h[1],p=l([c-o,u-a],2),g=p[0],m=p[1],y=Math.sqrt(Math.pow(g,2)+Math.pow(m,2)),v=l([-d/y,f/y],2),b=v[0],x=v[1];return[b*g,b*m,x*g,x*m]}(o,a,c):new Array(4).fill(0),4),v=y[0],b=y[1],x=y[2],w=y[3],E=function(e){return t.selectAll(rF.line.class).data(e,(function(t,e){return e})).join((function(t){return t.append("line").attr("className",(function(t){return"".concat(rF.line.name," ").concat(t.className)})).styles(n).transition((function(t){return UB(this,wF(t.line),!1)}))}),(function(t){return t.styles(n).transition((function(t){return UB(this,wF(t.line),r.update)}))}),(function(t){return t.remove()})).transitions()};if(!i||!s)return E([{line:[[d+v,f+b],[g+x,m+w]],className:rF.line.name}]);var M=l(s,2),S=M[0],N=M[1],k=g-d,C=m-f,T=l([d+k*S,f+C*S],2),A=T[0],P=T[1],O=l([d+k*N,f+C*N],2),R=O[0],_=O[1],D=E([{line:[[d+v,f+b],[A,P]],className:rF.lineFirst.name},{line:[[R,_],[g+x,m+w]],className:rF.lineSecond.name}]);return function(t,e){e.truncRange,e.truncShape,e.lineExtension}(0,e),D}function MF(t,e,n){var r,i=e.type,o=kj(e,"line");return r="linear"===i?EF(t,e,dj(o,"arrow"),n):xF(t,e,dj(o,"arrow"),n),function(t,e,n,r){var i,o=n.showArrow,a=n.showTrunc,s=n.lineArrow,c=n.lineArrowOffset,u=n.lineArrowSize;if(i="arc"===e?t.select(rF.line.class):a?t.select(rF.lineSecond.class):t.select(rF.line.class),!o||!s||"arc"===n.type&&vF(n.startAngle,n.endAngle)){var l=i.node();l&&(l.style.markerEnd=void 0)}else{var h=XI(s);h.attr(r),yj(h,u),i.style("markerEnd",h).style("markerEndOffset",-c)}}(t,i,e,o),r}function SF(t){var e=t.type,n=t.gridCenter;return"linear"===e?n:n||t.center}function NF(t,e){var n=e.gridLength;return t.map((function(t,r){var i=t.value,o=l(gF(i,e),2),a=o[0],s=o[1],c=l(ij(function(t,e){return fF(t,e.gridDirection,e)}(i,e),n),2);return{id:r,points:[[a,s],[a+c[0],s+c[1]]]}}))}function kF(t,e,n,r){var o=kj(n,"grid"),a=o.type,s=o.areaFill,c=SF(n),u=lF(e,n.gridFilter),h="segment"===a?NF(u,n):function(t,e){var n=e.gridControlAngles,r=SF(e);if(!r)throw new Error("grid center is not provide");if(t.length<2)throw new Error("Invalid grid data");if(!n||0===n.length)throw new Error("Invalid gridControlAngles");var i=l(r,2),o=i[0],a=i[1];return t.map((function(t,r){var i=l(gF(t.value,e),2),s=i[0],c=i[1],u=l([s-o,c-a],2),h=u[0],d=u[1],f=[];return n.forEach((function(t){var e=LI(t),n=l([Math.cos(e),Math.sin(e)],2),r=n[0],i=n[1],s=h*r-d*i+o,c=h*i+d*r+a;f.push([s,c])})),{points:f,id:r}}))}(u,n),d=i(i({},o),{center:c,areaFill:Rt(s)?u.map((function(t,e){return BI(s,[t,e,u])})):s,animate:r,data:h});return t.selectAll(rF.grid.class).data([1]).join((function(t){return t.append((function(){return new cF({style:d})})).attr("className",rF.grid.name)}),(function(t){return t.transition((function(){return this.update(d)}))}),(function(t){return t.remove()})).transitions()}var CF=function(){function t(t,e,n,r){this.set(t,e,n,r)}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),t.prototype.rotatedPoints=function(t,e,n){var r=this,i=r.x1,o=r.y1,a=r.x2,s=r.y2,c=Math.cos(t),u=Math.sin(t),l=e-e*c+n*u,h=n-e*u-n*c;return[[c*i-u*s+l,u*i+c*s+h],[c*a-u*s+l,u*a+c*s+h],[c*i-u*o+l,u*i+c*o+h],[c*a-u*o+l,u*a+c*o+h]]},t.prototype.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},t.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},t}();function TF(t,e){var n=t.getEulerAngles()||0;t.setEulerAngles(0);var r=t.getBounds(),i=l(r.min,2),o=i[0],a=i[1],s=l(r.max,2),c=s[0],u=s[1],h=t.getBBox(),d=h.width,f=h.height,p=0,g=0,m=o,y=a,v=UI(t);if(v){f-=1.5;var b=v.style.textAlign,x=v.style.textBaseline;"center"===b?m=(o+c)/2:"right"!==b&&"end"!==b||(m=c),"middle"===x?y=(a+u)/2:"bottom"===x&&(y=u)}var w=l(xj(e),4),E=w[0],M=void 0===E?0:E,S=w[1],N=void 0===S?0:S,k=w[2],C=void 0===k?M:k,T=w[3],A=new CF((p+=o)-(void 0===T?N:T),(g+=a)-M,p+d+N,g+f+C);return t.setEulerAngles(n),A.rotatedPoints(LI(n),m,y)}function AF(t,e){return e[0]<=Math.max(t[0][0],t[1][0])&&e[0]<=Math.min(t[0][0],t[1][0])&&e[1]<=Math.max(t[0][1],t[1][1])&&e[1]<=Math.min(t[0][1],t[1][1])}function PF(t,e,n){var r=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return 0===r?0:r<0?2:1}function OF(t,e){return e.every((function(e){return function(t,e){var n=t.length;if(n<3)return!1;var r,i,o,a,s,c,u=[e,[9999,e[1]]],l=0,h=0;do{var d=[t[h],t[(h+1)%n]];if(i=u,o=void 0,a=void 0,s=void 0,c=void 0,o=PF((r=d)[0],r[1],i[0]),a=PF(r[0],r[1],i[1]),s=PF(i[0],i[1],r[0]),c=PF(i[0],i[1],r[1]),o!==a&&s!==c||0===o&&AF(r,i[0])||0===a&&AF(r,i[1])||0===s&&AF(i,r[0])||0===c&&AF(i,r[1])){if(0===PF(d[0],e,d[1]))return AF(d,e);l++}h=(h+1)%n}while(0!==h);return!!(1&l)}(t,e)}))}function RF(t,e){return[[t[0],t[1],t[2],t[3]],[t[2],t[3],t[4],t[5]],[t[4],t[5],t[6],t[7]],[t[6],t[7],t[0],t[1]]].some((function(t){return function(t,e){var n=l(t,4),r=n[0],i=n[1],o=n[2],a=n[3],s=l(e,4),c=s[0],u=s[1],h=o-r,d=a-i,f=s[2]-c,p=s[3]-u,g=h*p-f*d;if(0===g)return!1;var m=g>0,y=r-c,v=i-u,b=h*v-d*y;if(b<0===m)return!1;var x=f*v-p*y;return x<0!==m&&b>g!==m&&x>g!==m}(e,t)}))}function _F(t,e,n){var r,i,o=e.crossPadding,a=new Set,s=null,c=function(t,e){var n=t.type,r=t.labelDirection,i=t.crossSize;if(!i)return!1;if("arc"===n){var o=t.center,a=t.radius,s=l(o,2),c=s[0],u=s[1],h="negative"===r?0:i,d=-a-h,f=a+h,p=l(xj(e),4),g=p[0],m=p[1],y=p[2],v=p[3];return new CF(c+d-v,u+d-g,c+f+m,u+f+y)}var b=l(t.startPos,2),x=b[0],w=b[1],E=l(t.endPos,2),M=E[0],S=E[1],N=l(yF(t)?[-e,0,e,0]:[0,e,0,-e],4),k=N[0],C=N[1],T=N[2],A=N[3],P=ij(pF(0,t),i),O=new CF(x,w,M,S);return O.x1+=A,O.y1+=k,O.x2+=C+P[0],O.y2+=T+P[1],O}(e,o),h=function(t){return!c||function(t,e,n){var r=t.x1,i=t.x2,o=t.y1,a=t.y2;return OF([[r,o],[i,o],[i,a],[r,a]],TF(e,n))}(c,t)},d=function(t,e){return!t||!t.firstChild||!function(t,e,n){var r,i,o=TF(t,n).flat(1),a=TF(e,n).flat(1),s=[[o[0],o[1],o[2],o[3]],[o[0],o[1],o[4],o[5]],[o[4],o[5],o[6],o[7]],[o[2],o[3],o[6],o[7]]];try{for(var c=u(s),l=c.next();!l.done;l=c.next())if(RF(a,l.value))return!0}catch(t){r={error:t}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return!1}(t.firstChild,e.firstChild,xj(n))};try{for(var f=u(t),p=f.next();!p.done;p=f.next()){var g=p.value;h(g)?!s||d(s,g)?s=g:(a.add(s),a.add(g)):a.add(g)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}return Array.from(a)}function DF(t,e){return void 0===e&&(e={}),_t(t)?0:"number"==typeof t?t:Math.floor(HI(t,e))}var LF=function(t,e){var n=e.seq,r=void 0===n?2:n;return t.filter((function(t,e){return!(e%r)||(PI(t),!1)}))};var IF=new Map([["hide",function(t,e,n,r){var i=t.length,o=e.keepHeader,a=e.keepTail;if(!(i<=1||2===i&&o&&a)){var s,c,u,d=LF,f=function(t){return t.forEach(r.show),t},p=2,g=t.slice(),m=t.slice(),y=Math.min.apply(Math,h([1],l(t.map((function(t){return t.getBBox().width}))),!1));if("linear"===n.type&&(mF(n)||yF(n))){var v=wj(t[0]).left,b=wj(t[i-1]).right,x=Math.abs(b-v)||1;p=Math.max(Math.floor(i*y/x),p)}for(o&&(s=g.splice(0,1)[0]),a&&(c=g.splice(-1,1)[0],g.reverse()),f(g);p<t.length&&_F((u=c?h(h([c],l(m),!1),[s],!1):h([s],l(m),!1),u.filter(WI)),n,null==e?void 0:e.margin).length;){if(c&&!s&&p%2==0)g.splice(0,1).forEach(r.hide);else if(c&&s){g.splice(0,1).forEach(r.hide)}m=d(f(g),{seq:p}),p++}}}],["rotate",function(t,e,n,r){var i,o,a=e.optionalAngles,s=void 0===a?[0,45,90]:a,c=e.margin,l=e.recoverWhenFailed,h=void 0===l||l,d=t.map((function(t){return t.getLocalEulerAngles()})),f=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.rotate(t,+i)}))};try{for(var p=u(s),g=p.next();!g.done;g=p.next()){if(f(g.value),_F(t,n,c).length<1)return}}catch(t){i={error:t}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}h&&f(d)}],["ellipsis",function(t,e,n,r){if(!(t.length<=1)){var i=e.suffix,o=void 0===i?"...":i,a=e.minLength,s=e.maxLength,c=void 0===s?1/0:s,u=e.step,h=void 0===u?" ":u,d=e.margin,f=void 0===d?[0,0,0,0]:d,p=$I(r.getTextShape(t[0])),g=DF(h,p),m=a?DF(a,p):g,y=DF(c,p);(_t(y)||y===1/0)&&(y=Math.max.apply(null,t.map((function(t){return t.getBBox().width}))));var v=t.slice(),b=l(f,4);b[0],b[1],b[2],b[3];for(var x=function(e){if(v.forEach((function(t){r.ellipsis(r.getTextShape(t),e,o)})),(v=_F(t,n,f)).length<1)return{value:void 0}},w=y;w>m+g;w-=g){var E=x(w);if("object"==typeof E)return E.value}}}],["wrap",function(t,e,n,r){var i=e.wordWrapWidth,o=void 0===i?50:i,a=e.maxLines,s=void 0===a?3:a,c=e.recoverWhenFailed,u=void 0===c||c,d=e.margin,f=void 0===d?[0,0,0,0]:d,p=t.map((function(t){return t.attr("maxLines")||1})),g=Math.min.apply(Math,h([],l(p),!1)),m=function(t){var e=t.type,n=t.labelDirection;return"linear"===e&&mF(t)?"negative"===n?"bottom":"top":"middle"}(n),y=function(e){return t.forEach((function(t,n){var i=Array.isArray(e)?e[n]:e;r.wrap(t,o,i,m)}))};if(!(g>s)){for(var v=g;v<=s;v++)if(y(v),_F(t,n,f).length<1)return;u&&y(p)}}]]);function jF(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t*function(t){return"positive"===t?-1:1}(e)}),1)}function BF(t){for(var e=t;e<0;)e+=360;return Math.round(e%360)}function FF(t,e){var n=l(t,2),r=n[0],i=n[1],o=l(e,2),a=o[0],s=o[1],c=l([r*a+i*s,r*s-i*a],2),u=c[0],h=c[1];return Math.atan2(h,u)}function zF(t,e,n){var r,i=n.labelAlign;if(null===(r=e.style.transform)||void 0===r?void 0:r.includes("rotate"))return e.getLocalEulerAngles();var o=pF(t.value,n),a=dF(t.value,n);return"horizontal"===i?0:function(t){var e=(t+360)%180;return QI(e,-90,90)||(e+=180),e}(II("perpendicular"===i?FF([1,0],o):FF([a[0]<0?-1:1,0],a)))}function GF(t,e,n){var r=n.type,i=n.labelAlign,o=pF(t,n),a=BF(e),s=BF(II(FF([1,0],o))),c="center",u="middle";return"linear"===r?[90,270].includes(s)&&0===a?(c="center",u=1===o[1]?"top":"bottom"):s%180||![90,270].includes(a)?0===s?(QI(a,0,90,!1,!0)||QI(a,0,90)||QI(a,270,360))&&(c="start"):90===s?QI(a,0,90,!1,!0)?c="start":(QI(a,90,180)||QI(a,270,360))&&(c="end"):270===s?QI(a,0,90,!1,!0)?c="end":(QI(a,90,180)||QI(a,270,360))&&(c="start"):180===s&&(90===a?c="start":(QI(a,0,90)||QI(a,270,360))&&(c="end")):c="center":"parallel"===i?u=QI(s,0,180,!0)?"top":"bottom":"horizontal"===i?QI(s,90,270,!1)?c="end":(QI(s,270,360,!1)||QI(s,0,90))&&(c="start"):"perpendicular"===i&&(c=QI(s,90,270)?"end":"start"),{textAlign:c,textBaseline:u}}function VF(t,e,n){var r=n.showTick,i=n.tickLength,o=n.tickDirection,a=n.labelDirection,s=n.labelSpacing,c=e.indexOf(t),u=BI(s,[t,c,e]),h=l([pF(t.value,n),jF(a,o)],2),d=l(oj(ij(h[0],u+(1===h[1]?BI(r?i:0,[t,c,e]):0)),gF(t.value,n)),2);return{x:d[0],y:d[1]}}function WF(t,e){"text"===t.nodeName&&t.attr(e)}function HF(t){!function(t,e,n){var r=e.labelOverlap,i=void 0===r?[]:r;i.length&&i.forEach((function(r){var i=r.type,o=IF.get(i);(function(t,e,n){return!(e.labelOverlap.length<1)&&("hide"===n?!function(t){for(var e=t;e;){if("offscreen"===e.className)return!0;e=e.parent}return!1}(t[0]):"rotate"===n?!t.some((function(t){var e;return!!(null===(e=t.attr("transform"))||void 0===e?void 0:e.includes("rotate"))})):"ellipsis"!==n&&"wrap"!==n||t.filter((function(t){return t.querySelector("text")})).length>1)})(t,e,i)&&(null==o||o(t,r,e,n))}))}(this.node().childNodes,t,{hide:PI,show:AI,rotate:function(e,n){!function(t,e,n){e.setLocalEulerAngles(t);var r=GF(e.__data__.value,t,n),i=e.querySelector(rF.labelItem.class);i&&WF(i,r)}(+n,e,t)},ellipsis:function(t,e,n){t&&qI(t,e||1/0,n)},wrap:function(t,e,n){var r,i;t&&(void 0===(r=n)&&(r=2),void 0===i&&(i="top"),YI(t,{wordWrap:!0,wordWrapWidth:e,maxLines:r,textBaseline:i}))},getTextShape:function(t){return t.querySelector("text")}})}function $F(t,e,n,r,a){var s=n.indexOf(e),c=bj(t).append(function(t,e,n,r){var i=r.labelFormatter;return Rt(i)?function(){return XI(BI(i,[t,e,n,pF(t.value,r)]))}:function(){return XI(t.label||"")}}(e,s,n,a)).attr("className",rF.labelItem.name).node(),u=l(Tj(uF(r,[e,s,n])),2),h=u[0],d=u[1],f=d.transform,p=o(d,["transform"]);Pj(c,f);var g=zF(e,c,a);return c.getLocalEulerAngles()||c.setLocalEulerAngles(g),WF(c,i(i({},GF(e.value,g,a)),h)),t.attr(p),c}function UF(t,e,n,r){var o=lF(e,n.labelFilter),a=kj(n,"label");return t.selectAll(rF.label.class).data(o,(function(t,e){return e})).join((function(r){return r.append("g").attr("className",rF.label.name).transition((function(t){$F(this,t,e,a,n);var r=VF(t,e,n),i=r.x,o=r.y;return this.style.transform="translate(".concat(i,", ").concat(o,")"),null})).call((function(){HF.call(t,n)}))}),(function(o){return o.transition((function(t){var o=function(t,e,n,r){if(void 0===r&&(r="destroy"),function(t,e){return"text"===t.nodeName&&"text"===e.nodeName&&t.attributes.text===e.attributes.text}(t,e))return t.remove(),[null];var o=function(){"destroy"===r?t.destroy():"hide"===r&&PI(t),e.isVisible()&&AI(e)};if(!n)return o(),[null];var a=n.duration,s=void 0===a?0:a,c=n.delay,u=void 0===c?0:c,h=Math.ceil(+s/2),d=+s/4,f=l(t.getGeometryBounds().center,2),p=f[0],g=f[1],m=l(e.getGeometryBounds().center,2),y=l([(p+m[0])/2-p,(g+m[1])/2-g],2),v=y[0],b=y[1],x=t.style.opacity,w=void 0===x?1:x,E=e.style.opacity,M=void 0===E?1:E,S=t.style.transform||"",N=e.style.transform||"",k=t.animate([{opacity:w,transform:"translate(0, 0) ".concat(S)},{opacity:0,transform:"translate(".concat(v,", ").concat(b,") ").concat(S)}],i(i({fill:"both"},n),{duration:u+h+d})),C=e.animate([{opacity:0,transform:"translate(".concat(-v,", ").concat(-b,") ").concat(N),offset:.01},{opacity:M,transform:"translate(0, 0) ".concat(N)}],i(i({fill:"both"},n),{duration:h+d,delay:u+h-d}));return WB(C,o),[k,C]}(this.querySelector(rF.labelItem.class),$F(this,t,e,a,n),r.update),s=VF(t,e,n),c=s.x,u=s.y,d=UB(this,{transform:"translate(".concat(c,", ").concat(u,")")},r.update);return h(h([],l(o),!1),[d],!1)})).call((function(e){var r,i,o=pe(e,"_transitions").flat().filter(WI);i=function(){HF.call(t,n)},0===(r=o).length?i():Promise.all(r.map((function(t){return null==t?void 0:t.finished}))).then(i)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this.childNodes[0],r.exit);return WB(e,(function(){return bj(t).remove()})),e}))})).transitions()}function YF(t,e){return fF(t,e.tickDirection,e)}function qF(t,e,n,r,i){var o=l(function(t,e){var n=l(t,2);return[[0,0],[n[0]*e,n[1]*e]]}(r,BI(i.tickLength,[t,e,n])),2),a=l(o[0],2),s=a[0],c=a[1],u=l(o[1],2);return{x1:s,x2:u[0],y1:c,y2:u[1]}}function KF(t,e,n,r,o,a){var s=function(t,e,n,r,i){var o=i.tickFormatter,a=YF(e.value,i),s="line";return Rt(o)&&(s=function(){return BI(o,[e,n,r,a])}),t.append(s).attr("className",rF.tickItem.name)}(bj(this),t,e,n,r);!function(t,e,n,r,o,a,s){var c=YF(t.value,a),u=qF(t,e,n,c,a),h=u.x1,d=u.x2,f=u.y1,p=u.y2,g=l(Tj(uF(s,[t,e,n,c])),2),m=g[0],y=g[1];"line"===r.node().nodeName&&r.styles(i({x1:h,x2:d,y1:f,y2:p},m)),o.attr(y),r.styles(m)}(t,e,n,s,this,r,o);var c=l(gF(t.value,r),2),u=c[0],h=c[1];return UB(this,{transform:"translate(".concat(u,", ").concat(h,")")},a)}var XF=zI({text:"text"},"title");function ZF(t){return/\S+-\S+/g.test(t)?t.split("-").map((function(t){return t[0]})):t.length>2?[t[0]]:t.split("")}function QF(t,e){var n=Object.entries(e).reduce((function(e,n){var r=l(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e}),{});t.styles(n)}var JF=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return r(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,a=this.querySelector(XF.text.class);if(!a)return new jI(0,0,+e,+n);var s=a.getBBox(),c=s.width,u=s.height,h=l(xj(i),4),d=h[0],f=h[1],p=h[2],g=h[3],m=l([0,0,+e,+n],4),y=m[0],v=m[1],b=m[2],x=m[3],w=ZF(r);if(w.includes("i"))return new jI(y,v,b,x);w.forEach((function(t,r){var i,o,a,s;"t"===t&&(i=l(0===r?[u+p,+n-u-p]:[0,+n],2),v=i[0],x=i[1]),"r"===t&&(o=l([+e-c-g],1),b=o[0]),"b"===t&&(a=l([+n-u-d],1),x=a[0]),"l"===t&&(s=l(0===r?[c+f,+e-c-f]:[0,+e],2),y=s[0],b=s[1])}));var E=l(xj(o),4),M=E[0],S=E[1],N=E[2],k=E[3],C=l([k+S,M+N],2),T=C[0],A=C[1];return new jI(y+k,v+M,b-T,x-A)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new jI(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=o(t,["width","height","position","spacing"]),i=l(Tj(r),1)[0],a=function(t){var e,n,r,i,o=t,a=o.width,s=o.height,c=o.position,u=l([+a/2,+s/2],2),h=l([+u[0],+u[1],"center","middle"],4),d=h[0],f=h[1],p=h[2],g=h[3],m=ZF(c);return m.includes("l")&&(d=(e=l([0,"start"],2))[0],p=e[1]),m.includes("r")&&(d=(n=l([+a,"end"],2))[0],p=n[1]),m.includes("t")&&(f=(r=l([0,"top"],2))[0],g=r[1]),m.includes("b")&&(f=(i=l([+s,"bottom"],2))[0],g=i[1]),{x:d,y:f,textAlign:p,textBaseline:g}}(t),s=a.x,c=a.y,u=a.textAlign,h=a.textBaseline;ZI(!!r.text,bj(e),(function(t){n.title=t.maybeAppendByClassName(XF.text,"text").styles(i).call(QF,{x:s,y:c,textAlign:u,textBaseline:h}).node()}))},e}(Rj);function tz(t,e,n,r,a){var s=l(Tj(kj(r,"title")),2),c=s[0],u=s[1],h=u.transform,d=u.transformOrigin,f=o(u,["transform","transformOrigin"]);e.styles(f);var p=h||function(t,e,n){var r=2*t.getGeometryBounds().halfExtents[1];if("vertical"===e){if("left"===n)return"rotate(-90) translate(0, ".concat(r/2,")");if("right"===n)return"rotate(-90) translate(0, -".concat(r/2,")")}return""}(t.node(),c.direction,c.position);t.styles(i(i({},c),{transformOrigin:d})),Pj(t.node(),p);var g=function(t,e,n){var r=n.titlePosition,i=void 0===r?"lb":r,o=n.titleSpacing,a=ZF(i),s=t.node().getLocalBounds(),c=l(s.min,2),u=c[0],h=c[1],d=l(s.halfExtents,2),f=d[0],p=d[1],g=l(e.node().getLocalBounds().halfExtents,2),m=g[0],y=g[1],v=l([u+f,h+p],2),b=v[0],x=v[1],w=l(xj(o),4),E=w[0],M=w[1],S=w[2],N=w[3];if(["start","end"].includes(i)&&"linear"===n.type){var k=n.startPos,C=n.endPos,T=l("start"===i?[k,C]:[C,k],2),A=T[0],P=T[1],O=l(ij(lj([-P[0]+A[0],-P[1]+A[1]]),E),2),R=O[0],_=O[1];return{x:A[0]+R,y:A[1]+_}}return a.includes("t")&&(x-=p+y+E),a.includes("r")&&(b+=f+m+M),a.includes("l")&&(b-=f+m+N),a.includes("b")&&(x+=p+y+S),{x:b,y:x}}(bj(n._offscreen||n.querySelector(rF.mainGroup.class)),e,r),m=g.x,y=g.y;return UB(e.node(),{transform:"translate(".concat(m,", ").concat(y,")")},a)}function ez(t,e,n,r){var i=t.showLine,o=t.showTick,a=t.showLabel,s=ZI(i,e.maybeAppendByClassName(rF.lineGroup,"g"),(function(e){return MF(e,t,r)}))||[],c=ZI(o,e.maybeAppendByClassName(rF.tickGroup,"g"),(function(e){return function(t,e,n,r){var i=lF(e,n.tickFilter),o=kj(n,"tick");return t.selectAll(rF.tick.class).data(i,(function(t){return t.id||t.label})).join((function(t){return t.append("g").attr("className",rF.tick.name).transition((function(t,e){return KF.call(this,t,e,i,n,o,!1)}))}),(function(t){return t.transition((function(t,e){return this.removeChildren(),KF.call(this,t,e,i,n,o,r.update)}))}),(function(t){return t.transition((function(){var t=this,e=YB(this.childNodes[0],r.exit);return WB(e,(function(){return t.remove()})),e}))})).transitions()}(e,n,t,r)}))||[],u=ZI(a,e.maybeAppendByClassName(rF.labelGroup,"g"),(function(e){return UF(e,n,t,r)}))||[];return h(h(h([],l(s),!1),l(c),!1),l(u),!1).filter((function(t){return!!t}))}var nz=function(t){function e(e){return t.call(this,e,nF)||this}return r(e,t),e.prototype.render=function(t,e,n){var r=this,i=t.titleText,o=t.data,a=t.animate,s=t.showTitle,c=t.showGrid,u=t.dataThreshold,d=t.truncRange,f=function(t,e){if(t.length<=e)return t;for(var n=Math.floor(t.length/e),r=[],i=0;i<t.length;i+=n)r.push(t[i]);return r}(o,u).filter((function(t){var e=t.value;return!(d&&e>d[0]&&e<d[1])})),p=VB(void 0===n?a:n),g=ZI(c,bj(e).maybeAppendByClassName(rF.gridGroup,"g"),(function(e){return kF(e,f,t,p)}))||[],m=bj(e).maybeAppendByClassName(rF.mainGroup,"g");i&&(!this.initialized&&p.enter||this.initialized&&p.update)&&ez(t,bj(this.offscreenGroup),f,VB(!1));var y=ez(t,bj(m.node()),f,p),v=ZI(s,bj(e).maybeAppendByClassName(rF.titleGroup,"g"),(function(e){return function(t,e,n,r){var i=n.titleText;return t.selectAll(rF.title.class).data([{title:i}].filter((function(t){return!!t.title})),(function(t,e){return t.title})).join((function(o){return o.append((function(){return XI(i)})).attr("className",rF.title.name).transition((function(){return tz(bj(this),t,e,n,r.enter)}))}),(function(i){return i.transition((function(){return tz(bj(this),t,e,n,r.update)}))}),(function(t){return t.remove()})).transitions()}(e,r,t,p)}))||[];return h(h(h([],l(g),!1),l(y),!1),l(v),!1).flat().filter((function(t){return!!t}))},e}(Rj),rz=zI({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),iz=function(t){function e(e){var n=t.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:Bj(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new Ys({class:rz.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Ys({class:rz.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return r(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return Ut(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=l(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map((function(e,n){return t.map((function(t){return t[n]}))})))||[]}(this.pageViews.map((function(t){var e=t.getBBox();return[e.width,e.height]}))).map((function(t){return Math.max.apply(Math,h([],l(t),!1))})),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,a=r.pageHeight;return{pageWidth:o,pageHeight:void 0===a?n:a}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,a=o.pageWidth,s=o.pageHeight;return new jI(n,r,a+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,a=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var c=l(this.getFollowingPageDiff(t),2),u=c[0],h=c[1];this.playState="running";var d=$B(a,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-u,", ").concat(-h,")")}],n);return WB(d,(function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()})),d},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:Ut(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:Ut(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(rz.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach((function(e,n){t.includes(n)?AI(e):PI(e)}))},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,a=i.controllerPadding,s=r.getBBox(),c=s.width;s.height;var u=l("horizontal"===o?[-180,0]:[-90,90],2),h=u[0],d=u[1];e.setLocalEulerAngles(h),n.setLocalEulerAngles(d);var f=e.getBBox(),p=f.width,g=f.height,m=n.getBBox(),y=m.width,v=m.height,b=Math.max(p,c,y),x="horizontal"===o?{offset:[[0,0],[p/2+a,0],[p+c+2*a,0]],textAlign:"start"}:{offset:[[b/2,-g-a],[b/2,0],[b/2,v+a]],textAlign:"center"},w=l(x.offset,3),E=l(w[0],2),M=E[0],S=E[1],N=l(w[1],2),k=N[0],C=N[1],T=l(w[2],2),A=T[0],P=T[1],O=x.textAlign,R=r.querySelector("text");R&&(R.style.textAlign=O),e.setLocalPosition(M,S),r.setLocalPosition(k,C),n.setLocalPosition(A,P)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(rz.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=t<e?-1:1;return"horizontal"===n?[a*i,0]:[0,a*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=l(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes.controllerSpacing,r=this.pageShape,a=r.pageWidth,s=r.pageHeight,c=this.pageViews.length>=2,u=t.maybeAppendByClassName(rz.controller,"g");if(OI(u.node(),c),c){var h=kj(this.attributes,"button"),d=kj(this.attributes,"pageNum"),f=l(Tj(h),2),p=f[0],g=f[1],m=p.size,y=o(p,["size"]),v=!u.select(rz.prevBtnGroup.class).node(),b=u.maybeAppendByClassName(rz.prevBtnGroup,"g").styles(g);this.prevBtnGroup=b.node();var x=b.maybeAppendByClassName(rz.prevBtn,"path"),w=u.maybeAppendByClassName(rz.nextBtnGroup,"g").styles(g);this.nextBtnGroup=w.node(),[x,w.maybeAppendByClassName(rz.nextBtn,"path")].forEach((function(t){t.styles(i(i({},y),{transformOrigin:"center"})),yj(t.node(),m)}));var E=u.maybeAppendByClassName(rz.pageInfoGroup,"g");this.pageInfoGroup=E.node(),E.maybeAppendByClassName(rz.pageInfo,"text").styles(d),this.updatePageInfo(),u.node().setLocalPosition(a+n,s/2),v&&(this.prevBtnGroup.addEventListener("click",(function(){e.prev()})),this.nextBtnGroup.addEventListener("click",(function(){e.next()})))}},e.prototype.render=function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i;this.attr("transform","translate(".concat(r,", ").concat(o,")"));var a=bj(e);this.renderClipPath(a),this.renderController(a),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=se((function(){return t.render(t.attributes,t)}),50);this.playWindow.addEventListener(hs.INSERTED,e),this.playWindow.addEventListener(hs.REMOVED,e)},e}(Rj);function oz(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}zj.registerSymbol("hiddenHandle",(function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]})),zj.registerSymbol("verticalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=t+.4*r;return[["M",t,e],["L",a,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",a,e-i],["Z"],["M",a,e+o],["L",t+r-2,e+o],["M",a,e-o],["L",t+r-2,e-o]]})),zj.registerSymbol("horizontalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=e+.4*r;return[["M",t,e],["L",t-i,a],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,a],["Z"],["M",t-o,a],["L",t-o,e+r-2],["M",t+o,a],["L",t+o,e+r-2]]}));var az=zI({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");var sz=function(t){function e(e){return t.call(this,e,{span:[1,1],marker:function(){return new Hs({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return r(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes.markerSize,r=t.node().getBBox(),i=r.width,o=r.height,a=e.node().getBBox(),s=a.width,c=a.height;return{markerWidth:n,labelWidth:i,valueWidth:s,height:Math.max(n,o,c)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=l(xj(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,a=i.height,s=this.actualSpace,c=s.labelWidth,u=s.valueWidth,h=l(this.spacing,2),d=h[0],f=h[1];if(r){var p=r-n-d-f,g=l(this.span,2);c=(t=l([g[0]*p,g[1]*p],2))[0],u=t[1]}return{width:o+c+u+d+f,height:a,markerWidth:o,labelWidth:c,valueWidth:u}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes.spacing;if(!t)return[0,0];var e=l(xj(t),2),n=e[0],r=e[1];return this.showValue?[n,r]:[n,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.width,o=t.height,a=l(this.spacing,2),s=a[0];return{height:o,width:i,markerWidth:e,labelWidth:n,valueWidth:r,position:[e/2,e+s,e+n+s+a[1]]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(az.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,a=void 0===o?t.lineWidth:o,s=e.markerStroke,c=void 0===s?t.stroke:s,u=+(i||a||(c?1:0))*Math.sqrt(2),l=this.markerGroup.node().getBBox(),h=l.width,d=l.height;return(1-u/Math.max(h,d))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes.marker,r=kj(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(az.markerGroup,"g").style("zIndex",0),ZI(!!n,this.markerGroup,(function(){var t,o=e.markerGroup.node(),a=null===(t=o.childNodes)||void 0===t?void 0:t[0],s="string"==typeof n?new zj({style:{symbol:n},className:az.marker.name}):n();a?s.nodeName===a.nodeName?a instanceof zj?a.update(i(i({},r),{symbol:n})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=u(Object.entries(i)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),c=s[0],h=s[1];"id"!==c&&"className"!==c&&t.attr(c,h)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(a,s),bj(a).styles(r)):(a.remove(),bj(s).attr("className",az.marker.name).styles(r),o.appendChild(s)):(s instanceof zj||bj(s).attr("className",az.marker.name).styles(r),o.appendChild(s)),e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]);var c=yj(e.markerGroup.node(),e.scaleSize);e.markerGroup.node().style._transform="scale(".concat(c,")")}))},e.prototype.renderLabel=function(t){var e=kj(this.attributes,"label"),n=e.text,r=o(e,["text"]);this.labelGroup=t.maybeAppendByClassName(az.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(az.label,(function(){return XI(n)})).styles(r)},e.prototype.renderValue=function(t){var e=this,n=kj(this.attributes,"value"),r=n.text,i=o(n,["text"]);this.valueGroup=t.maybeAppendByClassName(az.valueGroup,"g").style("zIndex",0),ZI(this.showValue,this.valueGroup,(function(){e.valueGroup.maybeAppendByClassName(az.value,(function(){return XI(r)})).styles(i)}))},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,o=kj(this.attributes,"background");this.background=t.maybeAppendByClassName(az.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(az.background,"rect").styles(i({width:n,height:r},o))},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=l(t.position,3),o=i[0],a=i[1],s=i[2],c=r/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(a,", ").concat(c,")")}),qI(this.labelGroup.select(az.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(s,", ").concat(c,")")}),qI(this.valueGroup.select(az.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=bj(e),r=t.x,i=void 0===r?0:r,o=t.y,a=void 0===o?0:o;n.styles({transform:"translate(".concat(i,", ").concat(a,")")}),this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.adjustLayout()},e}(Rj),cz=zI({page:"item-page",navigator:"navigator",item:"item"},"items"),uz=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},lz=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:xe,mouseenter:xe,mouseleave:xe})||this;return n.navigatorShape=[0,0],n}return r(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=kj(this.attributes,"item"),o=e.map((function(t,o){var a=t.id,s=void 0===a?o:a,c=t.label,u=t.value;return{id:"".concat(s),index:o,style:i({layout:n,labelText:c,valueText:u},Object.fromEntries(Object.entries(r).map((function(n){var r=l(n,2);return[r[0],BI(r[1],[t,o,e])]}))))}}));return o},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,a=l(this.navigatorShape,1)[0],s=l(this.grid,2),c=s[0],u=s[1],h=u*c,d=0;return this.pageViews.children.map((function(e,s){var f,p,g=Math.floor(s/h),m=s%h,y=t.ifHorizontal(u,c),v=[Math.floor(m/y),m%y];"vertical"===n&&v.reverse();var b=l(v,2),x=b[0],w=b[1],E=(r-a-(u-1)*o)/u,M=e.getBBox().height,S=l([0,0],2),N=S[0],k=S[1];return"horizontal"===n?(N=(f=l([d,x*(M+i)],2))[0],k=f[1],d=w===u-1?0:d+E+o):(N=(p=l([w*(E+o),d],2))[0],k=p[1],d=x===c-1?0:d+M+i),{page:g,index:s,row:x,col:w,pageIndex:m,width:E,height:M,x:N,y:k}}))},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=l(this.navigatorShape,1)[0],a=l(this.grid,2),s=a[0],c=a[1],u=l([e-o,n],2),h=u[0],d=u[1],f=l([0,0,0,0,0,0,0,0],8),p=f[0],g=f[1],m=f[2],y=f[3],v=f[4],b=f[5],x=f[6],w=f[7];return this.pageViews.children.map((function(t,e){var n,o,a,u,f=t.getBBox(),E=f.width,M=f.height,S=0===x?0:i,N=x+S+E;return N<=h&&uz(v,(function(t){return t<c}))?(n=l([x+S,w,N],3),p=n[0],g=n[1],x=n[2],{width:E,height:M,x:p,y:g,page:m,index:e,pageIndex:y++,row:b,col:v++}):(o=l([b+1,0,0,w+M+r],4),b=o[0],v=o[1],x=o[2],(w=o[3])+M<=d&&uz(b,(function(t){return t<s}))?(a=l([x,w,E],3),p=a[0],g=a[1],x=a[2],{width:E,height:M,x:p,y:g,page:m,index:e,pageIndex:y++,row:b,col:v++}):(u=l([0,0,E,0,m+1,0,0,0],8),p=u[0],g=u[1],x=u[2],w=u[3],m=u[4],y=u[5],b=u[6],v=u[7],{width:E,height:M,x:p,y:g,page:m,index:e,pageIndex:y++,row:b,col:v++}))}))},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return oz(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(cz.item.class).forEach((function(e){t.appendChild(e)})),t.querySelectorAll(cz.page.class).forEach((function(e){t.removeChild(e).destroy()}))},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave;this.flattenPage(t);var o=this.dispatchCustomEvent.bind(this);bj(t).selectAll(cz.item.class).data(this.renderData,(function(t){return t.id})).join((function(t){return t.append((function(t){var e=t.style;return new sz({style:e})})).attr("className",cz.item.name).on("click",(function(){null==n||n(this),o("itemClick",{item:this})})).on("pointerenter",(function(){null==r||r(this),o("itemMouseenter",{item:this})})).on("pointerleave",(function(){null==i||i(this),o("itemMouseleave",{item:this})}))}),(function(t){return t.each((function(t){var e=t.style;this.update(e)}))}),(function(t){return t.remove()}))},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=l(this.navigatorShape,2),a=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-a,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{}))).map((function(t){var e=l(t,2);return{page:e[0],layouts:e[1]}})),i=h([],l(this.navigator.getContainer().children),!1);r.forEach((function(t){var e=t.layouts,r=n.pageViews.appendChild(new Ys({className:cz.page.name}));e.forEach((function(t){var e=t.x,n=t.y,o=t.index,a=t.width,s=t.height,c=i[o];r.appendChild(c),ge(c,"__layout__",t),c.update({x:e,y:n,width:a,height:s})}))})),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes.orientation,n=kj(this.attributes,"nav"),r=VI({orientation:e},n),i=this;return t.selectAll(cz.navigator.class).data(["nav"]).join((function(t){return t.append((function(){return new iz({style:r})})).attr("className",cz.navigator.name).each((function(){i.navigator=this}))}),(function(t){return t.each((function(){this.update(r)}))}),(function(t){return t.remove()})),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator(bj(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new as(t,{detail:e});this.dispatchEvent(n)},e}(Rj),hz=zI({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),dz={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,dz)||this}r(e,t),e.prototype.render=function(t,e){var n=bj(e).maybeAppendByClassName(hz.markerGroup,"g");this.renderMarker(n);var r=bj(e).maybeAppendByClassName(hz.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,o=n.markerSymbol,a=void 0===o?oz(r,"horizontalHandle","verticalHandle"):o;ZI(!!a,t,(function(t){var n=kj(e.attributes,"marker"),r=i({symbol:a},n);e.marker=t.maybeAppendByClassName(hz.marker,(function(){return new zj({style:r})})).update(r)}))},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,a=n.orientation,s=n.spacing,c=void 0===s?0:s,u=n.formatter;ZI(r,t,(function(t){var n,r=kj(e.attributes,"label"),s=r.text,h=o(r,["text"]),d=(null===(n=t.select(hz.marker.class))||void 0===n?void 0:n.node().getBBox())||{},f=d.width,p=void 0===f?0:f,g=d.height,m=l(oz(a,[0,(void 0===g?0:g)+c,"center","top"],[p+c,0,"start","middle"]),4),y=m[0],v=m[1],b=m[2],x=m[3];t.maybeAppendByClassName(hz.label,"text").styles(i(i({},h),{x:y,y:v,text:u(s).toString(),textAlign:b,textBaseline:x}))}))}}(Rj);var fz={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},pz=VI({},fz,{});VI({},fz,Cj(dz,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var gz=zI({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),mz=function(t){function e(e){return t.call(this,e,pz)||this}return r(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,o=r.showTitle,a=r.titleText,s=l(Tj(kj(this.attributes,"title")),2),c=s[0],u=s[1];this.titleGroup=t.maybeAppendByClassName(gz.titleGroup,"g").styles(u);var h=i(i({width:e,height:n},c),{text:o?a:""});this.title=this.titleGroup.maybeAppendByClassName(gz.title,(function(){return new JF({style:h})})).update(h)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,o=e.width,a=e.height,s=l(Tj(kj(this.attributes,"title",!0)),2),c=s[0],u=s[1],h=i(i({},c),{width:o,height:a,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName(gz.itemsGroup,"g").styles(i(i({},u),{transform:"translate(".concat(n,", ").concat(r,")")}));var d=this;this.itemsGroup.selectAll(gz.items.class).data(["items"]).join((function(t){return t.append((function(){return new lz({style:h})})).attr("className",gz.items.name).each((function(){d.items=bj(this)}))}),(function(t){return t.update(h)}),(function(t){return t.remove()}))},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().style.transform="translate(".concat(e,", ").concat(n,")")}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new jI(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,a=n.text,s=t.getBBox(),c=e.getBBox(),u=ZF(r),h=l(xj(a?i:0),4),d=h[0],f=h[1],p=h[2],g=h[3],m=l(xj(o),4),y=m[0],v=m[1],b=m[2],x=m[3],w=l([g+f,d+p],2),E=w[0],M=w[1],S=l([x+v,y+b],2),N=S[0],k=S[1];if("l"===u[0])return new jI(s.x,s.y,c.width+s.width+E+N,Math.max(c.height+k,s.height));if("t"===u[0])return new jI(s.x,s.y,Math.max(c.width+N,s.width),c.height+s.height+M+k);var C=l([e.attributes.width||c.width,e.attributes.height||c.height],2),T=C[0],A=C[1];return new jI(c.x,c.y,T+s.width+E+N,A+s.height+M+k)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=this.attributes,r=n.width,i=n.height,o=n.x,a=void 0===o?0:o,s=n.y,c=void 0===s?0:s,u=bj(e);e.style.transform="translate(".concat(a,", ").concat(c,")"),this.renderTitle(u,r,i),this.renderItems(u,this.availableSpace),this.adjustLayout()},e}(Rj),yz={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(t){return t.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},vz=zI({background:"background",labelGroup:"label-group",label:"label"},"indicator"),bz=function(t){function e(e){var n=t.call(this,e,yz)||this;return n.point=[0,0],n.group=n.appendChild(new Ys({})),n.isMutationObserved=!0,n}return r(e,t),e.prototype.renderBackground=function(){if(this.label){var t=this.attributes,e=t.position,n=l(xj(t.padding),4),r=n[0],o=n[1],a=n[2],s=n[3],c=this.label.node().getLocalBounds(),u=c.min,h=c.max,d=new jI(u[0]-s,u[1]-r,h[0]+o-u[0]+s,h[1]+a-u[1]+r),f=this.getPath(e,d),p=kj(this.attributes,"background");this.background=bj(this.group).maybeAppendByClassName(vz.background,"path").styles(i(i({},p),{d:f})),this.group.appendChild(this.label.node())}},e.prototype.renderLabel=function(){var t=this.attributes,e=t.formatter,n=t.labelText,r=l(Tj(kj(this.attributes,"label")),2),i=r[0],a=r[1];i.text;var s=o(i,["text"]);(this.label=bj(this.group).maybeAppendByClassName(vz.labelGroup,"g").styles(a),n)&&this.label.maybeAppendByClassName(vz.label,(function(){return XI(e(n))})).style("text",e(n).toString()).selectAll("text").styles(s)},e.prototype.adjustLayout=function(){var t=l(this.point,2),e=t[0],n=t[1],r=this.attributes,i=r.x,o=r.y;this.group.attr("transform","translate(".concat(i-e,", ").concat(o-n,")"))},e.prototype.getPath=function(t,e){var n=this.attributes.radius,r=e.x,i=e.y,o=e.width,a=e.height,s=[["M",r+n,i],["L",r+o-n,i],["A",n,n,0,0,1,r+o,i+n],["L",r+o,i+a-n],["A",n,n,0,0,1,r+o-n,i+a],["L",r+n,i+a],["A",n,n,0,0,1,r,i+a-n],["L",r,i+n],["A",n,n,0,0,1,r+n,i],["Z"]],c={top:4,right:6,bottom:0,left:2}[t],u=this.createCorner([s[c].slice(-2),s[c+1].slice(-2)]);return s.splice.apply(s,h([c+1,1],l(u),!1)),s[0][0]="M",s},e.prototype.createCorner=function(t,e){void 0===e&&(e=10);var n=Ej.apply(void 0,h([],l(t),!1)),r=l(t,2),i=l(r[0],2),o=i[0],a=i[1],s=l(r[1],2),c=s[0],u=s[1],d=l(n?[c-o,[o,c]]:[u-a,[a,u]],2),f=d[0],p=l(d[1],2),g=p[0],m=p[1],y=f/2,v=e*(f/Math.abs(f)),b=v/2,x=v*Math.sqrt(3)/2*.8,w=l([g,g+y-b,g+y,g+y+b,m],5),E=w[0],M=w[1],S=w[2],N=w[3],k=w[4];return n?(this.point=[S,a-x],[["L",E,a],["L",M,a],["L",S,a-x],["L",N,a],["L",k,a]]):(this.point=[o+x,S],[["L",o,E],["L",o,M],["L",o+x,S],["L",o,N],["L",o,k]])},e.prototype.applyVisibility=function(){"hidden"===this.attributes.visibility?PI(this):AI(this)},e.prototype.bindEvents=function(){this.label.on(hs.BOUNDS_CHANGED,this.renderBackground)},e.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},e}(Rj);function xz(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var wz={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function Ez(t){var e;void 0===t&&(t="");var n=xz(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=i({flex:1},wz),e[".".concat(n.VALUE)]=i({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},wz),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var Mz=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,a=xz(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(a.CONTAINER,'"></div>'),title:'<div class="'.concat(a.TITLE,'"></div>'),item:'<li class="'.concat(a.LIST_ITEM,'" data-index={index}>\n <span class="').concat(a.NAME,'">\n <span class="').concat(a.MARKER,'" style="background:{color}"></span>\n <span class="').concat(a.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(a.VALUE,'" title="{value}">{value}</span>\n </li>')},style:Ez(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return r(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map((function(t,e){var r=t.name,a=void 0===r?"":r,s=t.color,c=void 0===s?"black":s,u=t.index,l=o(t,["name","color","index"]),h=i({name:a,color:c,index:null!=u?u:e},l);return an(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t}(n.item,h))}))},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=an(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:this.element.replaceChildren(t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,a=n.style,s=n.content,c=xz(r.prefixCls),u=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(u.innerHTML=r.title,u.getElementsByClassName(c.TITLE)[0].innerHTML=i):null===(e=null===(t=u.getElementsByClassName(c.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=c.LIST,f.replaceChildren.apply(f,h([],l(d),!1));var p=this.element.querySelector(".".concat(c.LIST));p?p.replaceWith(f):u.appendChild(f)}!function(t,e){Object.entries(e).forEach((function(e){var n=l(e,2),r=n[0],i=n[1];h([t],l(t.querySelectorAll(r)),!1).filter((function(t){return t.matches(r)})).forEach((function(t){t&&(t.style.cssText+=Object.entries(i).reduce((function(t,e){return"".concat(t).concat(e.join(":"),";")}),""))}))}))}(u,a)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},a=this.elementSize,s=a.width,c=a.height,u=[-s/2,-c/2];return i.forEach((function(t){var e=l(u,2),n=e[0],i=e[1],a=l(o[t],2),h=a[0],d=a[1];u=[n+(s/2+r[0])*h,i+(c/2+r[1])*d]})),u},e.prototype.setOffsetPosition=function(t){var e=l(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=void 0===o?0:o,s=i.y,c=void 0===s?0:s,u=i.container,h=u.x,d=u.y;this.element.style.left="".concat(+a+h+n,"px"),this.element.style.top="".concat(+c+d+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=l(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=i.y,s=i.bounding,c=i.position;if(!s)return[n,r];var u=this.element,h=u.offsetWidth,d=u.offsetHeight,f=l([+o+n,+a+r],2),p=f[0],g=f[1],m={left:"right",right:"left",top:"bottom",bottom:"top"},y=s.x,v=s.y,b={left:p<y,right:p+h>y+s.width,top:g<v,bottom:g+d>v+s.height},x=[];c.split("-").forEach((function(t){b[t]?x.push(m[t]):x.push(t)}));var w=x.join("-");return this.getRelativeOffsetFromCursor(w)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height;return new jI(r,i,o,a).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout((function(){e.element.style.transition=n}),10)},e.tag="tooltip",e}(Rj),Sz=function(t){function e(e){var n=t.call(this,e)||this;n.layoutEvents=[hs.BOUNDS_CHANGED,hs.INSERTED,hs.REMOVED],n.$margin=xj(0),n.$padding=xj(0);var r=e.style||{},i=r.margin,o=void 0===i?0:i,a=r.padding,s=void 0===a?0:a;return n.margin=o,n.padding=s,n.isMutationObserved=!0,n.bindEvents(),n}return r(e,t),Object.defineProperty(e.prototype,"margin",{get:function(){return this.$margin},set:function(t){this.$margin=xj(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return this.$padding},set:function(t){this.$padding=xj(t)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var t=this.attributes,e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.width,a=t.height,s=l(this.$margin,4),c=s[0],u=s[1],h=s[2],d=s[3];return new jI(n-d,i-c,o+d+u,a+c+h)},e.prototype.appendChild=function(e,n){return e.isMutationObserved=!0,t.prototype.appendChild.call(this,e,n),e},e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=l(this.$padding,4),i=r[0],o=r[1],a=r[2],s=r[3],c=l(this.$margin,4),u=c[0],h=c[3];return new jI(s+h,i+u,e-s-o,n-i-a)},e.prototype.layout=function(){if(this.attributes.display&&this.isConnected&&!this.children.some((function(t){return!t.isConnected})))try{var t=this.attributes,e=t.x,n=t.y;this.style.transform="translate(".concat(e,", ").concat(n,")");var r=function(t,e,n){if(0===e.length)return[];var r={flex:nj,grid:rj},i=n.display in r?r[n.display]:null;return(null==i?void 0:i.call(null,t,e,n))||[]}(this.getAvailableSpace(),this.children.map((function(t){return t.getBBox()})),this.attributes);this.children.forEach((function(t,e){var n=r[e],i=n.x,o=n.y;t.style.transform="translate(".concat(i,", ").concat(o,")")}))}catch(t){}},e.prototype.bindEvents=function(){var t=this;this.layoutEvents.forEach((function(e){t.addEventListener(e,(function(e){e.target.isMutationObserved=!0,t.layout()}))}))},e.prototype.attributeChangedCallback=function(t,e,n){"margin"===t?this.margin=n:"padding"===t&&(this.padding=n),this.layout()},e}(Ys),Nz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;return r.hoverColor="#f5f5f5",r.selectedColor="#e6f7ff",r.background=r.appendChild(new tc({})),r.label=r.background.appendChild(new Ys({})),r}return r(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(this.style.padding)},enumerable:!1,configurable:!0}),e.prototype.renderLabel=function(){var t=this.style,e=t.label,n=t.value,r=kj(this.attributes,"label");bj(this.label).maybeAppend(".label",(function(){return XI(e)})).attr("className","label").styles(r),this.label.attr("__data__",n)},e.prototype.renderBackground=function(){var t=this.label.getBBox(),e=l(this.padding,4),n=e[0],r=e[1],o=e[2],a=e[3],s=t.width,c=t.height,u=s+a+r,h=c+n+o,d=kj(this.attributes,"background"),f=this.style,p=f.width,g=void 0===p?0:p,m=f.height,y=void 0===m?0:m,v=f.selected;this.background.attr(i(i({},d),{width:Math.max(u,g),height:Math.max(h,y),fill:v?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(a,", ").concat((h-c)/2,")")})},e.prototype.render=function(){this.renderLabel(),this.renderBackground()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("pointerenter",(function(){t.style.selected||t.background.attr("fill",t.hoverColor)})),this.addEventListener("pointerleave",(function(){t.style.selected||t.background.attr("fill",t.style.backgroundFill)}));var e=this;this.addEventListener("click",(function(){var n=t.style,r=n.label,i=n.value,o=n.onClick;null==o||o(i,{label:r,value:i},e)}))},e.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},e}(Rj),kz=function(t){function e(n){var r,i,o=t.call(this,VI({},e.defaultOptions,n))||this;o.currentValue=null===(r=e.defaultOptions.style)||void 0===r?void 0:r.defaultValue,o.isPointerInSelect=!1,o.select=o.appendChild(new tc({className:"select",style:{cursor:"pointer",width:0,height:0}})),o.dropdown=o.appendChild(new tc({className:"dropdown"}));var a=o.style.defaultValue;return a&&(null===(i=o.style.options)||void 0===i?void 0:i.some((function(t){return t.value===a})))&&(o.currentValue=a),o}return r(e,t),e.prototype.setValue=function(t){this.currentValue=t,this.render()},e.prototype.getValue=function(){return this.currentValue},Object.defineProperty(e.prototype,"dropdownPadding",{get:function(){return xj(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),e.prototype.renderSelect=function(){var t,e=this,n=this.style,r=n.x,o=n.y,a=n.width,s=n.height,c=n.bordered,u=n.showDropdownIcon,l=kj(this.attributes,"select"),h=kj(this.attributes,"placeholder");this.select.attr(i(i({x:r,y:o,width:a,height:s},l),{fill:"#fff",strokeWidth:c?1:0}));var d=this.dropdownPadding;u&&bj(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(r+a-10-d[1]-d[3],", ").concat(o+s/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var f=null===(t=this.style.options)||void 0===t?void 0:t.find((function(t){return t.value===e.currentValue})),p=i({x:r+d[3]},h);bj(this.select).selectAll(".placeholder").data(f?[]:[1]).join((function(t){return t.append("text").attr("className","placeholder").styles(p).style("y",(function(){var t=this.getBBox();return o+(s-t.height)/2}))}),(function(t){return t.styles(p)}),(function(t){return t.remove()}));var g=kj(this.attributes,"optionLabel"),m=i({x:r+d[3]},g);bj(this.select).selectAll(".value").data(f?[f]:[]).join((function(t){return t.append((function(t){return XI(t.label)})).attr("className","value").styles(m).style("y",(function(){var t=this.getBBox();return o+(s-t.height)/2}))}),(function(t){return t.styles(m)}),(function(t){return t.remove()}))},e.prototype.renderDropdown=function(){var t,e,n=this,r=this.style,o=r.x,a=r.y,s=r.width,c=r.height,u=r.options,l=r.onSelect,h=r.open,d=kj(this.attributes,"dropdown"),f=kj(this.attributes,"option"),p=this.dropdownPadding;bj(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(u,(function(t){return t.value})).join((function(t){return t.append((function(t){return new Nz({className:"dropdown-item",style:i(i(i({},t),f),{width:s-p[1]-p[3],selected:t.value===n.currentValue,onClick:function(t,e,r){n.setValue(t),null==l||l(t,e,r),n.dispatchEvent(new as("change",{detail:{value:t,option:e,item:r}})),PI(n.dropdown)}})})})).each((function(t,e){var n,r=(null===(n=this.parentNode)||void 0===n?void 0:n.children).reduce((function(t,n,r){return r<e&&(t+=n.getBBox().height),t}),0);this.attr("transform","translate(".concat(p[3],", ").concat(p[0]+r,")"))}))}),(function(t){return t.update((function(t){return{selected:t.value===n.currentValue}}))}),(function(t){return t.remove()}));var g=null===(e=null===(t=this.dropdown.getElementsByClassName("dropdown-container"))||void 0===t?void 0:t[0])||void 0===e?void 0:e.getBBox(),m=d.spacing;this.dropdown.attr(i({transform:"translate(".concat(o,", ").concat(a+c+m,")"),width:g.width+p[1]+p[3],height:g.height+p[0]+p[2]},d)),!h&&PI(this.dropdown)},e.prototype.render=function(){this.renderSelect(),this.renderDropdown()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("click",(function(t){t.stopPropagation()})),this.select.addEventListener("click",(function(){"visible"===t.dropdown.style.visibility?PI(t.dropdown):AI(t.dropdown)})),this.addEventListener("pointerenter",(function(){t.isPointerInSelect=!0})),this.addEventListener("pointerleave",(function(){t.isPointerInSelect=!1})),null===document||void 0===document||document.addEventListener("click",(function(){t.isPointerInSelect||PI(t.dropdown)}))},e.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},e}(Rj),Cz=function(t){function e(n){var r=t.call(this,VI({},{style:{backgroundOpacity:e.backgroundOpacities.default}},e.defaultOptions,n))||this;return r.showBackground=!0,r.background=r.appendChild(new tc({})),r.icon=r.appendChild(new Ys({})),r}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"iconSize",{get:function(){var t=this.attributes.size,e=l(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3];return Math.max(t-Math.max(o+r,n+i),2*this.lineWidth+1)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.size,o=r/2,a=kj(this.attributes,"background");this.background.attr(i({x:e-o,y:n-o,width:r,height:r},a))},e.prototype.showIndicator=function(){if(this.label){var t=this.attributes.size,e=this.background.getBBox(),n=e.x,r=e.y;this.indicator.update({x:n+t/2,y:r-5,labelText:this.label,visibility:"visible"})}},e.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},e.prototype.connectedCallback=function(){var e;t.prototype.connectedCallback.call(this);var n=this.attributes.size,r=this.background.getBBox(),i=r.x,o=r.y,a=null===(e=this.ownerDocument)||void 0===e?void 0:e.defaultView;a&&(this.indicator=a.appendChild(new bz({style:{x:i+n/2,y:o-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},e.prototype.disconnectedCallback=function(){this.indicator.destroy()},e.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},e.prototype.bindEvents=function(){var t=this,n=this.attributes.onClick;if(this.addEventListener("click",(function(){null==n||n(t)})),this.showBackground){var r=function(){return t.background.attr({opacity:e.backgroundOpacities.default})};this.addEventListener("pointerenter",(function(){t.background.attr({opacity:e.backgroundOpacities.hover}),t.showIndicator()})),this.addEventListener("pointerleave",(function(){r(),t.hideIndicator()})),this.addEventListener("pointerdown",(function(){t.background.attr({opacity:e.backgroundOpacities.active})})),this.addEventListener("pointerup",(function(){r()}))}},e.tag="IconBase",e.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},e.backgroundOpacities={default:0,hover:.8,active:1},e}(Rj),Tz=function(t,e){return void 0===e&&(e="#565758"),new Zs({style:{fill:e,d:"M ".concat(t,",").concat(t," L -").concat(t,",0 L ").concat(t,",-").concat(t," Z"),transformOrigin:"center"}})},Az=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.arcPath=function(t,e,n){var r=l([n,n],2),i=r[0],o=r[1],a=function(r){return[t+n*Math.cos(r),e+n*Math.sin(r)]},s=l(a(-5/4*Math.PI),2),c=s[0],u=s[1],h=l(a(1/4*Math.PI),2),d=h[0],f=h[1];return"M".concat(c,",").concat(u,",A").concat(i,",").concat(o,",0,1,1,").concat(d,",").concat(f)},Object.defineProperty(e.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o+.5;bj(this.icon).maybeAppend(".reset","path").styles({stroke:r,lineWidth:o,d:this.arcPath(e,n,i/2-o),markerStart:Tz(a,r)})},e}(Cz),Pz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e-o,n],[e,n+a],[e,n],[e+o,n-a],[e+o,n+a],[e,n]];bj(this.icon).maybeAppend(".backward","polygon").styles({points:s,fill:r})},e}(Cz),Oz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,a=i/2/Math.pow(3,.5),s=[[e,n],[e,n-a],[e+o,n],[e,n+a],[e,n],[e-o,n-a],[e-o,n+a],[e,n]];bj(this.icon).maybeAppend(".forward","polygon").styles({points:s,fill:r})},e}(Cz),Rz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3*Math.pow(3,.5)*.8,a=[[e+o,n],[e-o/2,n-i/2*.8],[e-o/2,n+i/2*.8],[e+o,n]];bj(this.icon).maybeAppend(".play","polygon").styles({points:a,fill:r})},e}(Cz),_z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3,a=[[e-o,n-i/2],[e-o,n+i/2],[e-o/2,n+i/2],[e-o/2,n-i/2],[e-o,n-i/2],[e+o/2,n-i/2],[e+o/2,n+i/2],[e+o,n+i/2],[e+o,n-i/2]];bj(this.icon).maybeAppend(".pause","polygon").styles({points:a,fill:r})},e}(Cz),Dz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=o;bj(this.icon).maybeAppend(".left-line","line").styles({x1:e-i/2,y1:n-i/2,x2:e-i/2,y2:n+i/2,stroke:r,lineWidth:o}),bj(this.icon).maybeAppend(".right-line","line").styles({x1:e+i/2,y1:n-i/2,x2:e+i/2,y2:n+i/2,stroke:r,lineWidth:o}),bj(this.icon).maybeAppend(".left-arrow","line").styles({x1:e,y1:n,x2:e-i/2+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)}),bj(this.icon).maybeAppend(".right-arrow","line").styles({x1:e,y1:n,x2:e+i/2-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)})},e}(Cz),Lz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;bj(this.icon).maybeAppend(".line","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o});var a=o;bj(this.icon).maybeAppend(".left-arrow","line").styles({x1:e-i/2-2*a,y1:n,x2:e-2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)}),bj(this.icon).maybeAppend(".right-arrow","line").styles({x1:e+i/2+2*a,y1:n,x2:e+2*a,y2:n,stroke:r,lineWidth:o,markerEnd:Tz(2*o,r)})},e}(Cz),Iz=function(t){return[[-t/2,-t/2],[-t/2,t/2],[t/2,t/2]]},jz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,a=(i-2*o-o)/4,s=(i-2*o-o)/2,c=l([e-i/2+o,n+i/2-2*o],2),u=c[0],h=c[1];bj(this.icon).maybeAppend(".coordinate","polyline").styles({points:Iz(i).map((function(t){var r=l(t,2),i=r[0],o=r[1];return[i+e,o+n]})),stroke:r,lineWidth:o}),bj(this.icon).maybeAppend(".line","polyline").styles({points:[[u,h],[u+a,h-s],[u+2*a,h],[u+4*a,h-2*s]],stroke:r,lineWidth:o})},e}(Cz),Bz=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.data,e=this.attributes,n=e.x,r=e.y,i=e.color,o=this.iconSize,a=this.lineWidth,s=a,c=(o-s)/t.length,u=(o-2*s)/4,h=l([n-o/2+2*s,r+o/2-s],2),d=h[0],f=h[1];bj(this.icon).maybeAppend(".coordinate","polyline").styles({points:Iz(o).map((function(t){var e=l(t,2),i=e[0],o=e[1];return[i+n,o+r]})),stroke:i,lineWidth:a}),bj(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map((function(t,e){return{value:t,index:e}}))).join((function(t){return t.append("line").attr("className","column").style("x1",(function(t){var e=t.index;return d+c*e})).style("y1",f).style("x2",(function(t){var e=t.index;return d+c*e})).style("y2",(function(t){var e=t.value;return f-u*e})).styles({y1:f,stroke:i,lineWidth:a})}))},e}(Cz),Fz=function(t){function e(e){var n=t.call(this,VI({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return r(e,t),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;bj(this.icon).maybeAppend(".split","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o})},e}(Cz),zz=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.showBackground=!1,e}return r(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(0)},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.iconSize,e=this.attributes,n=e.x,r=e.y,o=e.speed,a=void 0===o?1:o,s=ve(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),c=Ut(t,20,1/0),u=i(i({},s),{x:n-c/2,y:r-10,width:c,height:20,defaultValue:a,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:t/5,placeholderFontSize:t/2,optionPadding:0,optionLabelFontSize:t/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});bj(this.icon).maybeAppend(".speed",(function(){return new kz({style:u})})).attr("className","speed").each((function(){this.update(u)}))},e.tag="SpeedSelect",e}(Cz),Gz=function(t){function e(e){var n=t.call(this,e)||this;return n.icon=n.appendChild(new Ys({})),n.currentType=n.attributes.type,n}return r(e,t),e.prototype.getType=function(){return this.currentType},e.prototype.render=function(){var t=this,e=this.attributes;e.onChange;var n=o(e,["onChange"]);bj(this.icon).selectAll(".icon").data([this.currentType]).join((function(e){return e.append((function(e){var n,r=null===(n=t.toggles.find((function(t){return l(t,1)[0]===e})))||void 0===n?void 0:n[1];if(!r)throw new Error("Invalid type: ".concat(e));return new r({})})).attr("className","icon").styles(n,!1).update({})}),(function(t){return t.styles({restStyles:n}).update({})}),(function(t){return t.remove()}))},e.prototype.bindEvents=function(){var t=this,e=this.attributes.onChange;this.addEventListener("click",(function(n){n.preventDefault(),n.stopPropagation();var r=(t.toggles.findIndex((function(e){return l(e,1)[0]===t.currentType}))+1)%t.toggles.length,i=t.toggles[r][0];null==e||e(t.currentType),t.currentType=i,t.render()}))},e.tag="ToggleIcon",e}(Rj),Vz=function(t){function e(e){var n=t.call(this,VI({},{style:{type:"play"}},e))||this;return n.toggles=[["play",Rz],["pause",_z]],n}return r(e,t),e}(Gz),Wz=function(t){function e(e){var n=t.call(this,VI({},{style:{type:"range"}},e))||this;return n.toggles=[["range",Dz],["value",Lz]],n}return r(e,t),e}(Gz),Hz=function(t){function e(e){var n=t.call(this,VI({},{style:{type:"column"}},e))||this;return n.toggles=[["line",jz],["column",Bz]],n}return r(e,t),e}(Gz),$z={reset:Az,speed:zz,backward:Pz,playPause:Vz,forward:Oz,selectionType:Wz,chartType:Hz,split:Fz},Uz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;return r.background=r.appendChild(new tc({})),r.functions=r.appendChild(new Ys({})),r}return r(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return xj(this.attributes.padding)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.style,e=t.x,n=t.y,r=t.width,o=t.height,a=kj(this.attributes,"background");this.background.attr(i({x:e,y:n,width:r,height:o},a))},e.prototype.renderFunctions=function(){var t,e=this,n=this.attributes,r=n.functions,o=n.iconSize,a=n.iconSpacing,s=n.x,c=n.y,u=n.width,d=n.height,f=n.align,p=l(this.padding,4),g=p[1],m=p[3],y=r.reduce((function(t,e){return t.length&&e.length?t.concat.apply(t,h(["split"],l(e),!1)):t.concat.apply(t,h([],l(e),!1))}),[]),v=y.length*(o+a)-a,b={left:m+o/2,center:(u-v)/2+o/2,right:u-v-m-g+o/2}[f]||0;null===(t=this.speedSelect)||void 0===t||t.destroy(),this.functions.removeChildren(),y.forEach((function(t,n){var r,u=$z[t],l={x:s+n*(o+a)+b,y:c+d/2,size:o};if(u===zz?(l.speed=e.attributes.speed,l.onSelect=function(n){return e.handleFunctionChange(t,{value:n})}):[Vz,Wz,Hz].includes(u)?(l.onChange=function(n){return e.handleFunctionChange(t,{value:n})},u===Vz&&(l.type="play"===e.attributes.state?"pause":"play"),u===Wz&&(l.type="range"===e.attributes.selectionType?"value":"range"),u===Hz&&(l.type="line"===e.attributes.chartType?"column":"line")):l.onClick=function(){return e.handleFunctionChange(t,{value:t})},u===zz){var h=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView;h&&(e.speedSelect=new u({style:i(i({},l),{zIndex:100})}),h.appendChild(e.speedSelect))}else e.functions.appendChild(new u({style:l}))}))},e.prototype.disconnectedCallback=function(){var e;t.prototype.disconnectedCallback.call(this),null===(e=this.speedSelect)||void 0===e||e.destroy()},e.prototype.render=function(){this.renderBackground(),this.renderFunctions()},e.prototype.handleFunctionChange=function(t,e){var n=this.attributes.onChange;null==n||n(t,e)},e.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},e}(Rj),Yz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;return r.bindEvents(),r}return r(e,t),e.prototype.bindEvents=function(){var t=this;this.addEventListener("mouseenter",(function(){t.attr("lineWidth",Math.ceil(+(t.style.r||0)/2))})),this.addEventListener("mouseleave",(function(){t.attr("lineWidth",0)}))},e.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},e}(Hs),qz=function(t){function e(n){return t.call(this,VI({},e.defaultOptions,n))||this}return r(e,t),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,o=t.height,a=kj(this.attributes,"background");bj(this).maybeAppend("background","rect").attr("className","background").styles(i({x:e-r/2,y:n-o/2,width:r,height:o},a))},e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.iconSize,o=kj(this.attributes,"icon"),a=r/2;bj(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(i({x1:e-1,y1:n-a,x2:e-1,y2:n+a},o)),bj(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(i({x1:e+1,y1:n-a,x2:e+1,y2:n+a},o))},e.prototype.renderBorder=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,o=t.height,a=t.type,s=kj(this.attributes,"border"),c="start"===a?+r/2:-r/2;bj(this).maybeAppend("border","line").attr("className","border").styles(i({x1:c+e,y1:n-o/2,x2:c+e,y2:n+o/2},s))},e.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},e.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},e}(Rj);function Kz(t,e){return"number"==typeof t?Xz(t):function(t,e){var n=new Date(t);switch(e){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(n.getHours())&&0===n.getMinutes()?Aj(n,"HH:mm\nYYYY-MM-DD"):Aj(n,"HH:mm");case"half-day":return n.getHours()<12?"AM\n".concat(Aj(n,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(n.getDate())?Aj(n,"DD\nYYYY-MM"):Aj(n,"DD");case"week":return n.getDate()<=7?Aj(n,"DD\nYYYY-MM"):Aj(n,"DD");case"month":return[0,6].includes(n.getMonth())?Aj(n,"MM月\nYYYY"):Aj(n,"MM月");case"season":return[0].includes(n.getMonth())?Aj(n,"MM月\nYYYY"):Aj(n,"MM月");case"year":return Aj(n,"YYYY");default:return Aj(n,"YYYY-MM-DD HH:mm")}}(t,e)}function Xz(t){var e=String(Math.floor(t/3600)).padStart(2,"0"),n=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(Math.floor(t%60)).padStart(2,"0");return t<3600?"".concat(n,":").concat(r):"".concat(e,":").concat(n,":").concat(r)}var Zz=function(t){function e(n){var r=t.call(this,VI({},e.defaultOptions,n))||this;r.axis=r.appendChild(new nz({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),r.timeline=r.appendChild(new eF({style:{onChange:function(t){r.handleSliderChange(t)}}})),r.controller=r.appendChild(new Uz({})),r.states={},r.handleSliderChange=function(t){var e,n=(e=r.states.values,Array.isArray(e)?h([],l(e),!1):e);r.setBySliderValues(t),r.dispatchOnChange(n)};var i=r.attributes,o=i.selectionType,a=i.chartType,s=i.speed,c=i.state,u=i.playMode,d=i.values;return r.states={chartType:a,playMode:u,selectionType:o,speed:s,state:c},r.setByTimebarValues(d),r}return r(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.data.sort((function(t,e){return t.time<e.time?-1:t.time>e.time?1:0}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"space",{get:function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,a=t.controllerHeight,s=Ut(+i-a,0,+i),c=new jI(e,n+ +i-a,+r,a),u=0,l="time"===o?10:s;return{axisBBox:"chart"===o?new jI(e,n+s-(u=35),+r,u):new jI,controllerBBox:c,timelineBBox:new jI(e,n+("time"===o?s:s-l),+r,l-u)}},enumerable:!1,configurable:!0}),e.prototype.setBySliderValues=function(t){var e,n,r=this.data,i=l(Array.isArray(t)?t:[0,t],2),o=i[0],a=i[1],s=r.length,c=r[Math.floor(o*s)],u=r[Math.ceil(a*s)-(Array.isArray(t)?0:1)];this.states.values=[null!==(e=null==c?void 0:c.time)&&void 0!==e?e:r[0].time,null!==(n=null==u?void 0:u.time)&&void 0!==n?n:1/0]},e.prototype.setByTimebarValues=function(t){var e,n,r,i=this.data,o=l(Array.isArray(t)?t:[void 0,t],2),a=o[0],s=o[1],c=i.find((function(t){return t.time===a})),u=i.find((function(t){return t.time===s}));this.states.values=[null!==(e=null==c?void 0:c.time)&&void 0!==e?e:null===(n=i[0])||void 0===n?void 0:n.time,null!==(r=null==u?void 0:u.time)&&void 0!==r?r:1/0]},e.prototype.setByIndex=function(t){var e,n,r,i,o=this.data,a=l(t,2),s=a[0],c=a[1];this.states.values=[null!==(n=null===(e=o[s])||void 0===e?void 0:e.time)&&void 0!==n?n:o[0].time,null!==(i=null===(r=this.data[c])||void 0===r?void 0:r.time)&&void 0!==i?i:1/0]},Object.defineProperty(e.prototype,"sliderValues",{get:function(){var t,e=this.states,n=e.values,r=e.selectionType,i=l(Array.isArray(n)?n:[void 0,n],2),o=i[0],a=i[1],s=this.data,c=s.length,u="value"===r;return[(t=s.findIndex((function(t){return t.time===o})),u?0:t>-1?t/c:0),function(){if(a===1/0)return 1;var t=s.findIndex((function(t){return t.time===a}));return t>-1?t/c:u?.5:1}()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){var t=this.states,e=t.values,n=t.selectionType,r=l(Array.isArray(e)?e:[this.data[0].time,e],2),i=r[0],o=r[1];return"value"===n?o:[i,o]},enumerable:!1,configurable:!0}),e.prototype.getDatumByRatio=function(t){var e=this.data,n=e.length;return e[Math.floor(t*(n-1))]},Object.defineProperty(e.prototype,"chartHandleIconShape",{get:function(){var t=this.states.selectionType,e=this.space.timelineBBox.height;return"range"===t?function(t){return new qz({style:{type:t,height:e,iconSize:e/6}})}:function(){return new Xs({style:{x1:0,y1:-e/2,x2:0,y2:e/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),e.prototype.getChartStyle=function(t){var e=this,n=t.x,r=t.y,a=t.width,s=t.height,c=this.states,u=c.selectionType,l=c.chartType,h=this.data,d=this.attributes,f=d.type,p=d.labelFormatter,g=kj(this.attributes,"chart");g.type;var m=o(g,["type"]),y="range"===u;if("time"===f)return i({handleIconShape:function(){return new Yz({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:y?-15:0,autoFitLabel:y,handleSpacing:y?-15:0,trackFill:"#edeeef",trackLength:a,trackOpacity:.5,trackRadius:s/2,trackSize:s/2,type:u,values:this.sliderValues,formatter:function(t){if(p)return p(t);var n=e.getDatumByRatio(t).time;return"number"==typeof n?Xz(n):Aj(n,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},m);var v="range"===u?5:0,b=h.map((function(t){return t.value}));return i({handleIconOffset:v,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:b,sparklineType:l,sparklineScale:.8,trackLength:a,trackSize:s,type:u,values:this.sliderValues,transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},m)},e.prototype.renderChart=function(t){void 0===t&&(t=this.space.timelineBBox),this.timeline.update(this.getChartStyle(t))},e.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},e.prototype.getAxisStyle=function(t){var e=this.data,n=this.attributes,r=n.interval,o=n.labelFormatter,a=kj(this.attributes,"axis"),s=t.x,c=t.y,u=t.width,d=h(h([],l(e),!1),[{time:0}],!1).map((function(t,e,n){var r=t.time;return{label:"".concat(r),value:e/(n.length-1),time:r}})),f=i({startPos:[s,c],endPos:[s+u,c],data:d,labelFilter:function(t,e){return e<d.length-1},labelFormatter:function(t){var e=t.time;return o?o(e):Kz(e,r)}},a);return f},e.prototype.renderAxis=function(t){void 0===t&&(t=this.space.axisBBox),"chart"===this.attributes.type&&this.axis.update(this.getAxisStyle(t))},e.prototype.renderController=function(t){void 0===t&&(t=this.space.controllerBBox);var e=this.attributes.type,n=this.states,r=n.state,o=n.speed,a=n.selectionType,s=n.chartType,c=kj(this.attributes,"controller"),u=this,l=i(i(i({},t),{iconSize:20,speed:o,state:r,selectionType:a,chartType:s,onChange:function(t,e){var n=e.value;switch(t){case"reset":u.internalReset();break;case"speed":u.handleSpeedChange(n);break;case"backward":u.internalBackward();break;case"playPause":"play"===n?u.internalPlay():u.internalPause();break;case"forward":u.internalForward();break;case"selectionType":u.handleSelectionTypeChange(n);break;case"chartType":u.handleChartTypeChange(n)}}}),c);"time"===e&&(l.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(l)},e.prototype.dispatchOnChange=function(t){var e=this.data,n=this.attributes.onChange,r=this.states,i=r.values,o=r.selectionType,a=l(i,2),s=a[0],c=a[1],u=c===1/0?e.at(-1).time:c;t&&function(t,e){if(Array.isArray(t)){if(!Array.isArray(e))return!1;if(t[0]===e[0]){if(t[1]===e[1])return!0;if(t[1]===1/0||e[1]===1/0)return!0}return!1}return!Array.isArray(e)&&t===e}(t,"range"===o?[s,u]:u)||null==n||n("range"===o?[s,u]:u)},e.prototype.internalReset=function(t){var e,n,r=this.states.selectionType;this.internalPause(),this.setBySliderValues("range"===r?[0,1]:[0,0]),this.renderController(),this.updateSelection(),t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onReset)||void 0===n||n.call(e),this.dispatchOnChange())},e.prototype.reset=function(){this.internalReset()},e.prototype.moveSelection=function(t,e){var n=this.data,r=n.length,i=this.states,o=i.values,a=i.selectionType,s=i.playMode,c=l(o,2),u=c[0],h=c[1],d=n.findIndex((function(t){return t.time===u})),f=n.findIndex((function(t){return t.time===h}));-1===f&&(f=r);var p,g="backward"===t?-1:1;"range"===a?"acc"===s?(p=[d,f+g],-1===g&&d===f&&(p=[d,r])):p=[d+g,f+g]:p=[d,f+g];var m=function(t){var e=l(t.sort((function(t,e){return t-e})),2),n=e[0],i=e[1],o=function(t){return Ut(t,0,r)};return i>r?"value"===a?[0,0]:"acc"===s?[o(n),o(n)]:[0,o(i-n)]:n<0?"acc"===s?[0,o(i)]:[o(n+r-i),r]:[o(n),o(i)]}(p);return this.setByIndex(m),this.updateSelection(),m},e.prototype.internalBackward=function(t){var e,n,r=this.moveSelection("backward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onBackward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.backward=function(){this.internalBackward()},e.prototype.internalPlay=function(t){var e,n,r=this,i=this.data,o=this.attributes.loop,a=this.states.speed,s=void 0===a?1:a;this.playInterval=window.setInterval((function(){r.internalForward()[1]!==i.length||o||(r.internalPause(),r.renderController())}),1e3/s),this.states.state="play",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPlay)||void 0===n||n.call(e))},e.prototype.play=function(){this.internalPlay()},e.prototype.internalPause=function(t){var e,n;clearInterval(this.playInterval),this.states.state="pause",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPause)||void 0===n||n.call(e))},e.prototype.pause=function(){this.internalPause()},e.prototype.internalForward=function(t){var e,n,r=this.moveSelection("forward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onForward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.forward=function(){this.internalForward()},e.prototype.handleSpeedChange=function(t){var e,n;this.states.speed=t,"play"===this.states.state&&(this.internalPause(!0),this.internalPlay(!0)),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSpeedChange)||void 0===n||n.call(e,t)},e.prototype.handleSelectionTypeChange=function(t){var e,n;this.states.selectionType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSelectionTypeChange)||void 0===n||n.call(e,t)},e.prototype.handleChartTypeChange=function(t){var e,n;this.states.chartType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onChartTypeChange)||void 0===n||n.call(e,t)},e.prototype.render=function(){var t=this.space,e=t.axisBBox,n=t.controllerBBox,r=t.timelineBBox;this.renderController(n),this.renderAxis(e),this.renderChart(r),"play"===this.states.state&&this.internalPlay()},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.internalPause(!0)},e.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},e}(Rj);class Qz extends iL{static defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16};typePrefix="__data__";element=null;draw=!1;fieldMap={node:new Map,edge:new Map,combo:new Map};selectedItems=[];constructor(t,e){super(t,Object.assign({},Qz.defaultOptions,e)),this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){this.element?.destroy(),this.element=null,this.draw=!1}bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)};changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=pe(t,[r,"id"]),o=pe(t,[r,"style","labelText"]),[a]=i.split("__"),s=this.fieldMap[a].get(o)||[];n.setElementState(Object.fromEntries(s?.map((t=>[t,e]))))};click=t=>{if("hover"===this.options.trigger)return;const e=pe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter((t=>t!==e)),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))};mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))};mouseenter=t=>{if("click"===this.options.trigger)return;const e=pe(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter((t=>t!==e)):(this.selectedItems.push(e),this.changeState(t,"active"))};updateElement(){if(!this.element)return;this.element.getChildByIndex(0).update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])};getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click});getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r,graph:i}=this.context,{nodes:o,edges:a,combos:s}=n.getData(),c={},u=e=>Rt(t)?t(e):t,l={node:"circle",edge:"line",combo:"rect"},h={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},d=(t,e)=>{t.forEach((t=>{const{id:n}=t,i=pe(t,["data",u(t)]),o=r?.getElementType(e,t)||"circle",a=((t,e)=>{const n=r?.getElementComputedStyle(t,e);return n})(e,t),s=("edge"===e?a?.stroke:a?.fill)||"#1783ff";n&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),c[i]||(c[i]={id:`${e}__${n}`,label:i,marker:h[o]||l[e],elementType:e,lineWidth:1,stroke:s,fill:s}))}))};switch(e){case"node":d(o,"node");break;case"edge":d(a,"edge");break;case"combo":d(s,"combo");break;default:return[]}return Object.values(c)};layout=t=>{let{flexDirection:e,alignItems:n,justifyContent:r}={flexDirection:"row",alignItems:"flex-end",justifyContent:"center"};const i={top:["row","flex-start","center"],bottom:["row","flex-end","center"],left:["column","flex-start","center"],right:["column","flex-end","center"]};return t in i&&([e,n,r]=i[t]),{display:"flex",flexDirection:e,justifyContent:r,alignItems:n}};createElement=()=>{if(this.draw)return void this.updateElement();const{canvas:t}=this.context,[e,n]=t.getSize(),{width:r=e,height:i=n,nodeField:o,edgeField:a,comboField:s,trigger:c,position:u,...l}=this.options,h=this.getMarkerData(o,"node"),d=this.getMarkerData(a,"edge"),f=this.getMarkerData(s,"combo"),p=[...h,...f,...d],g=this.layout(u),m=new Sz({style:{width:r,height:i,...g}}),y=Object.assign({width:r,height:i,data:p,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:h.length},l,this.getEvents()),v=new mz({className:"legend",style:y});m.appendChild(v),t.appendChild(m),this.element=m,this.draw=!0};destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}function Jz(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,a=e.r;t.arc(r,o,a,0,2*Math.PI,!1)}function tG(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,a=e.rx,s=e.ry;if(t.ellipse)t.ellipse(r,o,a,s,0,0,2*Math.PI,!1);else{var c=a>s?a:s,u=a>s?1:a/s,l=a>s?s/a:1;t.save(),t.scale(u,l),t.arc(r,o,c,0,2*Math.PI)}}function eG(t,e){var n,r,i=e.x1,o=e.y1,a=e.x2,s=e.y2,c=e.markerStart,u=e.markerEnd,l=e.markerStartOffset,h=e.markerEndOffset,d=0,f=0,p=0,g=0,m=0;c&&Ls(c)&&l&&(n=a-i,r=s-o,m=Math.atan2(r,n),d=Math.cos(m)*(l||0),f=Math.sin(m)*(l||0)),u&&Ls(u)&&h&&(n=i-a,r=o-s,m=Math.atan2(r,n),p=Math.cos(m)*(h||0),g=Math.sin(m)*(h||0)),t.moveTo(i+d,o+f),t.lineTo(a+p,s+g)}function nG(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,c=e.d,u=c.absolutePath,h=c.segments,d=0,f=0,p=0,g=0,m=0;if(i&&Ls(i)&&a){var y=l(i.parentNode.getStartTangent(),2),v=y[0],b=y[1];n=v[0]-b[0],r=v[1]-b[1],m=Math.atan2(r,n),d=Math.cos(m)*(a||0),f=Math.sin(m)*(a||0)}if(o&&Ls(o)&&s){var x=l(o.parentNode.getEndTangent(),2);v=x[0],b=x[1];n=v[0]-b[0],r=v[1]-b[1],m=Math.atan2(r,n),p=Math.cos(m)*(s||0),g=Math.sin(m)*(s||0)}for(var w=0;w<u.length;w++){var E=u[w],M=E[0],S=u[w+1],N=0===w&&(0!==d||0!==f),k=(w===u.length-1||S&&("M"===S[0]||"Z"===S[0]))&&0!==p&&0!==g;switch(M){case"M":N?(t.moveTo(E[1]+d,E[2]+f),t.lineTo(E[1],E[2])):t.moveTo(E[1],E[2]);break;case"L":k?t.lineTo(E[1]+p,E[2]+g):t.lineTo(E[1],E[2]);break;case"Q":t.quadraticCurveTo(E[1],E[2],E[3],E[4]),k&&t.lineTo(E[3]+p,E[4]+g);break;case"C":t.bezierCurveTo(E[1],E[2],E[3],E[4],E[5],E[6]),k&&t.lineTo(E[5]+p,E[6]+g);break;case"A":var C=h[w].arcParams,T=C.cx,A=C.cy,P=C.rx,O=C.ry,R=C.startAngle,_=C.endAngle,D=C.xRotation,L=C.sweepFlag;if(t.ellipse)t.ellipse(T,A,P,O,D,R,_,!!(1-L));else{var I=P>O?P:O,j=P>O?1:P/O,B=P>O?O/P:1;t.translate(T,A),t.rotate(D),t.scale(j,B),t.arc(0,0,I,R,_,!!(1-L)),t.scale(1/j,1/B),t.rotate(-D),t.translate(-T,-A)}k&&t.lineTo(E[6]+p,E[7]+g);break;case"Z":t.closePath()}}}function rG(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,c=e.points.points,u=c.length,l=c[0][0],h=c[0][1],d=c[u-1][0],f=c[u-1][1],p=0,g=0,m=0,y=0,v=0;i&&Ls(i)&&a&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],v=Math.atan2(r,n),p=Math.cos(v)*(a||0),g=Math.sin(v)*(a||0)),o&&Ls(o)&&s&&(n=c[u-1][0]-c[0][0],r=c[u-1][1]-c[0][1],v=Math.atan2(r,n),m=Math.cos(v)*(s||0),y=Math.sin(v)*(s||0)),t.moveTo(l+(p||m),h+(g||y));for(var b=1;b<u-1;b++){var x=c[b];t.lineTo(x[0],x[1])}t.lineTo(d,f)}function iG(t,e){var n,r,i=e.markerStart,o=e.markerEnd,a=e.markerStartOffset,s=e.markerEndOffset,c=e.points.points,u=c.length,l=c[0][0],h=c[0][1],d=c[u-1][0],f=c[u-1][1],p=0,g=0,m=0,y=0,v=0;i&&Ls(i)&&a&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],v=Math.atan2(r,n),p=Math.cos(v)*(a||0),g=Math.sin(v)*(a||0)),o&&Ls(o)&&s&&(n=c[u-2][0]-c[u-1][0],r=c[u-2][1]-c[u-1][1],v=Math.atan2(r,n),m=Math.cos(v)*(s||0),y=Math.sin(v)*(s||0)),t.moveTo(l+p,h+g);for(var b=1;b<u-1;b++){var x=c[b];t.lineTo(x[0],x[1])}t.lineTo(d+m,f+y)}function oG(t,e){var n=e.x,r=void 0===n?0:n,i=e.y,o=void 0===i?0:i,a=e.radius,s=e.width,c=e.height,u=s,h=c;if(a&&a.some((function(t){return 0!==t}))){var d=s>0?1:-1,f=c>0?1:-1,p=d+f===0,g=l(a.map((function(t){return Ut(t,0,Math.min(Math.abs(u)/2,Math.abs(h)/2))})),4),m=g[0],y=g[1],v=g[2],b=g[3];t.moveTo(d*m+r,o),t.lineTo(u-d*y+r,o),0!==y&&t.arc(u-d*y+r,f*y+o,y,-f*Math.PI/2,d>0?0:Math.PI,p),t.lineTo(u+r,h-f*v+o),0!==v&&t.arc(u-d*v+r,h-f*v+o,v,d>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,p),t.lineTo(d*b+r,h+o),0!==b&&t.arc(d*b+r,h-f*b+o,b,f>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,p),t.lineTo(r,f*m+o),0!==m&&t.arc(d*m+r,f*m+o,m,d>0?Math.PI:0,f>0?1.5*Math.PI:Math.PI/2,p)}else t.rect(r,o,u,h)}var aG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="canvas-path-generator",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[ar.CIRCLE]=Jz,t[ar.ELLIPSE]=tG,t[ar.RECT]=oG,t[ar.LINE]=eG,t[ar.POLYLINE]=iG,t[ar.POLYGON]=rG,t[ar.PATH]=nG,t[ar.TEXT]=void 0,t[ar.GROUP]=void 0,t[ar.IMAGE]=void 0,t[ar.HTML]=void 0,t[ar.MESH]=void 0,t);this.context.pathGeneratorFactory=e},e.prototype.destroy=function(){delete this.context.pathGeneratorFactory},e}(ur),sG=nt(),cG=nt(),uG=nt(),lG=w(),hG=function(){function t(){var t=this;this.isHit=function(e,n,r,i){var o=t.context.pointInPathPickerFactory[e.nodeName];if(o){var a=C(lG,r),s=gt(cG,st(uG,n[0],n[1],0),a);if(o(e,new Lr(s[0],s[1]),i,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var r=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),i=t.context.pathGeneratorFactory[e.nodeName];return i&&(r.beginPath(),i(r,e.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(e,n){var r,i=this,o=e.renderingService,a=e.renderingContext;this.context=e,this.runtime=n;var u=null===(r=a.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,(function(t){return s(i,void 0,void 0,(function(){return c(this,(function(e){return[2,this.pick(u,t)]}))}))})),o.hooks.pickSync.tap(t.tag,(function(t){return i.pick(u,t)}))},t.prototype.pick=function(t,e){var n,r,i=e.topmost,o=e.position,a=o.x,s=o.y,c=st(sG,a,s,0),l=t.elementsFromBBox(c[0],c[1],c[0],c[1]),h=[];try{for(var d=u(l),f=d.next();!f.done;f=d.next()){var p=f.value,g=p.getWorldTransform();if(this.isHit(p,c,g,!1)){var m=ya(p);if(m){var y=m.parsedStyle.clipPath;if(this.isHit(y,c,y.getWorldTransform(),!0)){if(i)return e.picked=[p],e;h.push(p)}}else{if(i)return e.picked=[p],e;h.push(p)}}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return e.picked=h,e},t.tag="CanvasPicker",t}();function dG(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,a=r.cy,s=void 0===a?0:a,c=r.r,u=r.fill,h=r.stroke,d=r.lineWidth,f=void 0===d?1:d,p=r.increasedLineWidthForHitTesting,g=void 0===p?0:p,m=r.pointerEvents,y=void 0===m?"auto":m,v=(f+g)/2,b=zn(o,s,e.x,e.y),x=l(wa(y,u,h),2),w=x[0],E=x[1];return w&&E||n?b<=c+v:w?b<=c:!!E&&(b>=c-v&&b<=c+v)}function fG(t,e,n,r){return t/(n*n)+e/(r*r)}function pG(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,a=r.cy,s=void 0===a?0:a,c=r.rx,u=r.ry,h=r.fill,d=r.stroke,f=r.lineWidth,p=void 0===f?1:f,g=r.increasedLineWidthForHitTesting,m=void 0===g?0:g,y=r.pointerEvents,v=void 0===y?"auto":y,b=e.x,x=e.y,w=l(wa(v,h,d),2),E=w[0],M=w[1],S=(p+m)/2,N=(b-o)*(b-o),k=(x-s)*(x-s);return E&&M||n?fG(N,k,c+S,u+S)<=1:E?fG(N,k,c,u)<=1:!!M&&(fG(N,k,c-S,u-S)>=1&&fG(N,k,c+S,u+S)<=1)}function gG(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function mG(t,e,n,r,i,o,a,s){var c=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI),u={x:t+n*Math.cos(c),y:e+n*Math.sin(c)};return zn(u.x,u.y,a,s)<=o/2}function yG(t,e,n,r,i,o,a){var s=Math.min(t,n),c=Math.max(t,n),u=Math.min(e,r),l=Math.max(e,r),h=i/2;return o>=s-h&&o<=c+h&&a>=u-h&&a<=l+h&&Kn(t,e,n,r,o,a)<=i/2}function vG(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var a=0;a<o-1;a++){if(yG(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(i){var s=t[0],c=t[o-1];if(yG(s[0],s[1],c[0],c[1],e,n,r))return!0}return!1}var bG=1e-6;function xG(t){return Math.abs(t)<bG?0:t<0?-1:1}function wG(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function EG(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o<i;o++){var a=t[o],s=t[(o+1)%i];if(wG(a,s,[e,n]))return!0;xG(a[1]-n)>0!=xG(s[1]-n)>0&&xG(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}function MG(t,e,n){for(var r=!1,i=0;i<t.length;i++){if(r=EG(t[i],e,n))break}return r}function SG(t,e,n){var r=t.parsedStyle,i=r.x1,o=r.y1,a=r.x2,s=r.y2,c=r.lineWidth,u=void 0===c?1:c,h=r.increasedLineWidthForHitTesting,d=void 0===h?0:h,f=r.pointerEvents;return!(!l(wa(void 0===f?"auto":f,r.fill,r.stroke),2)[1]&&!n||!u)&&yG(i,o,a,s,u+d,e.x,e.y)}function NG(t,e,n,r,i,o){var a=t.parsedStyle,s=a.lineWidth,c=void 0===s?1:s,u=a.increasedLineWidthForHitTesting,h=void 0===u?0:u,d=a.stroke,f=a.fill,p=a.d,g=a.pointerEvents,m=void 0===g?"auto":g,y=p.segments,v=p.hasArc,b=p.polylines,x=p.polygons,w=l(wa(m,(null==x?void 0:x.length)&&f,d),2),E=w[0],M=w[1],S=co(t),N=!1;return E||n?N=v?r(t,e):MG(x,e.x,e.y)||MG(b,e.x,e.y):((M||n)&&(N=function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;s<t.length;s++){var c=t[s],u=c.currentPoint,l=c.params,h=c.prePoint,d=c.box;if(!d||gG(d.x-a,d.y-a,d.width+e,d.height+e,n,r))switch(c.command){case"L":case"Z":if(o=yG(h[0],h[1],u[0],u[1],e,n,r))return!0;break;case"Q":if(o=ir(h[0],h[1],l[1],l[2],l[3],l[4],n,r)<=e/2)return!0;break;case"C":if(o=Jn(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],n,r,i)<=e/2)return!0;break;case"A":c.cubicParams||(c.cubicParams=ze(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],l[7],void 0));for(var f=c.cubicParams,p=h,g=0;g<f.length;g+=6){var m=Jn(p[0],p[1],f[g],f[g+1],f[g+2],f[g+3],f[g+4],f[g+5],n,r,i);if(p=[f[g+4],f[g+5]],o=m<=e/2)return!0}}}return o}(y,c+h,e.x,e.y,S)),N)}function kG(t,e,n){var r=t.parsedStyle,i=r.stroke,o=r.fill,a=r.lineWidth,s=void 0===a?1:a,c=r.increasedLineWidthForHitTesting,u=void 0===c?0:c,h=r.points,d=r.pointerEvents,f=l(wa(void 0===d?"auto":d,o,i),2),p=f[0],g=!1;return(f[1]||n)&&(g=vG(h.points,s+u,e.x,e.y,!0)),g||!p&&!n||(g=EG(h.points,e.x,e.y)),g}function CG(t,e,n){var r=t.parsedStyle,i=r.lineWidth,o=void 0===i?1:i,a=r.increasedLineWidthForHitTesting,s=void 0===a?0:a,c=r.points,u=r.pointerEvents;return!(!l(wa(void 0===u?"auto":u,r.fill,r.stroke),2)[1]&&!n||!o)&&vG(c.points,o+s,e.x,e.y,!1)}function TG(t,e,n,r,i){var o=t.parsedStyle,a=o.radius,s=o.fill,c=o.stroke,u=o.lineWidth,h=void 0===u?1:u,d=o.increasedLineWidthForHitTesting,f=void 0===d?0:d,p=o.x,g=void 0===p?0:p,m=o.y,y=void 0===m?0:m,v=o.width,b=o.height,x=o.pointerEvents,w=l(wa(void 0===x?"auto":x,s,c),2),E=w[0],M=w[1],S=h+f;if(a&&a.some((function(t){return 0!==t}))){var N=!1;return(M||n)&&(N=function(t,e,n,r,i,o,a,s){var c=l(i,4),u=c[0],h=c[1],d=c[2],f=c[3];return yG(t+u,e,t+n-h,e,o,a,s)||yG(t+n,e+h,t+n,e+r-d,o,a,s)||yG(t+n-d,e+r,t+f,e+r,o,a,s)||yG(t,e+r-f,t,e+u,o,a,s)||mG(t+n-h,e+h,h,Math.PI,Math.PI,o,a,s)||mG(t+n-d,e+r-d,d,0,Math.PI,o,a,s)||mG(t+f,e+r-f,f,Math.PI,Math.PI,o,a,s)||mG(t+u,e+u,u,Math.PI,Math.PI,o,a,s)}(g,y,v,b,a.map((function(t){return Ut(t,0,Math.min(Math.abs(v)/2,Math.abs(b)/2))})),S,e.x,e.y)),N||!E&&!n||(N=r(t,e)),N}var k=S/2;return E&&M||n?gG(g-k,y-k,v+k,b+k,e.x,e.y):E?gG(g,y,v,b,e.x,e.y):!!M&&function(t,e,n,r,i,o,a){var s=i/2;return gG(t-s,e-s,n,i,o,a)||gG(t+n-s,e-s,i,r,o,a)||gG(t+s,e+r-s,n,i,o,a)||gG(t-s,e+s,i,r,o,a)}(g,y,v,b,S,e.x,e.y)}function AG(t,e,n,r,o,a){var s=t.parsedStyle,c=s.pointerEvents,u=void 0===c?"auto":c,l=s.x,h=void 0===l?0:l,d=s.y,f=void 0===d?0:d,p=s.width,g=s.height;if("non-transparent-pixel"===u){var m=o.config.offscreenCanvas,y=a.offscreenCanvasCreator.getOrCreateCanvas(m),v=a.offscreenCanvasCreator.getOrCreateContext(m,{willReadFrequently:!0});return y.width=p,y.height=g,o.defaultStyleRendererFactory[ar.IMAGE].render(v,i(i({},t.parsedStyle),{x:0,y:0}),t,void 0,void 0,void 0),v.getImageData(e.x-h,e.y-f,1,1).data.every((function(t){return 0!==t}))}return!0}var PG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="canvas-picker",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[ar.CIRCLE]=dG,t[ar.ELLIPSE]=pG,t[ar.RECT]=TG,t[ar.LINE]=SG,t[ar.POLYLINE]=CG,t[ar.POLYGON]=kG,t[ar.PATH]=NG,t[ar.TEXT]=function(){return!0},t[ar.GROUP]=null,t[ar.IMAGE]=AG,t[ar.HTML]=null,t[ar.MESH]=null,t);this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new hG)},e.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},e}(ur),OG=function(){function t(t){this.canvasRendererPluginOptions=t,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=w(),this.dprMatrix=w(),this.tmpMat4=w(),this.vec3a=nt(),this.vec3b=nt(),this.vec3c=nt(),this.vec3d=nt()}return t.prototype.apply=function(e,n){var r=this;this.context=e;var i=e.config,o=e.camera,a=e.renderingService,s=e.renderingContext,c=e.rBushRoot,u=e.pathGeneratorFactory;this.rBush=c,this.pathGeneratorFactory=u;var d=e.contextService,f=s.root.ownerDocument.defaultView,p=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)},g=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)};a.hooks.init.tap(t.tag,(function(){f.addEventListener(hs.UNMOUNTED,p),f.addEventListener(hs.CULLED,g);var t=d.getDPR(),e=i.width,n=i.height,o=d.getContext();r.clearRect(o,0,0,e*t,n*t,i.background)})),a.hooks.destroy.tap(t.tag,(function(){f.removeEventListener(hs.UNMOUNTED,p),f.removeEventListener(hs.CULLED,g),r.renderQueue=[],r.removedRBushNodeAABBs=[],r.restoreStack=[]})),a.hooks.beginFrame.tap(t.tag,(function(){var t,e=d.getContext(),n=d.getDPR(),o=i.width,s=i.height,c=r.canvasRendererPluginOptions,u=c.dirtyObjectNumThreshold,l=c.dirtyObjectRatioThreshold,h=a.getStats(),p=h.total,g=h.rendered,m=g/p;r.clearFullScreen=r.clearFullScreenLastFrame||!(null===(t=f.context.renderingPlugins[1])||void 0===t?void 0:t.isFirstTimeRenderingFinished)||a.disableDirtyRectangleRendering()||g>u&&m>l,e&&(e.resetTransform?e.resetTransform():e.setTransform(1,0,0,1,0,0),r.clearFullScreen&&r.clearRect(e,0,0,o*n,s*n,i.background))}));var m=function(t,e){t.isVisible()&&!t.isCulled()&&r.renderDisplayObject(t,e,r.context,r.restoreStack,n),(t.sortable.sorted||t.childNodes).forEach((function(t){m(t,e)}))};a.hooks.endFrame.tap(t.tag,(function(){if(0!==s.root.childNodes.length){r.clearFullScreenLastFrame=!1;var t=d.getContext(),e=d.getDPR();if(L(r.dprMatrix,[e,e,1]),A(r.vpMatrix,r.dprMatrix,o.getOrthoMatrix()),r.clearFullScreen)m(s.root,t);else{var a=r.safeMergeAABB.apply(r,h([r.mergeDirtyAABBs(r.renderQueue)],l(r.removedRBushNodeAABBs.map((function(t){var e=t.minX,n=t.minY,r=t.maxX,i=t.maxY,o=new Ar;return o.setMinMax([e,n,0],[r,i,0]),o}))),!1));if(r.removedRBushNodeAABBs=[],Ar.isEmpty(a))return void(r.renderQueue=[]);var c=r.convertAABB2Rect(a),u=c.x,p=c.y,g=c.width,y=c.height,v=gt(r.vec3a,[u,p,0],r.vpMatrix),b=gt(r.vec3b,[u+g,p,0],r.vpMatrix),x=gt(r.vec3c,[u,p+y,0],r.vpMatrix),w=gt(r.vec3d,[u+g,p+y,0],r.vpMatrix),E=Math.min(v[0],b[0],w[0],x[0]),M=Math.min(v[1],b[1],w[1],x[1]),S=Math.max(v[0],b[0],w[0],x[0]),N=Math.max(v[1],b[1],w[1],x[1]),k=Math.floor(E),C=Math.floor(M),T=Math.ceil(S-E),P=Math.ceil(N-M);t.save(),r.clearRect(t,k,C,T,P,i.background),t.beginPath(),t.rect(k,C,T,P),t.clip(),t.setTransform(r.vpMatrix[0],r.vpMatrix[1],r.vpMatrix[4],r.vpMatrix[5],r.vpMatrix[12],r.vpMatrix[13]),i.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new as(Is.DIRTY_RECTANGLE,{dirtyRect:{x:k,y:C,width:T,height:P}})),r.searchDirtyObjects(a).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t,r.context,r.restoreStack,n)})),t.restore(),r.renderQueue.forEach((function(t){r.saveDirtyAABB(t)})),r.renderQueue=[]}r.restoreStack.forEach((function(){t.restore()})),r.restoreStack=[]}else r.clearFullScreenLastFrame=!0})),a.hooks.render.tap(t.tag,(function(t){r.clearFullScreen||r.renderQueue.push(t)}))},t.prototype.clearRect=function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))},t.prototype.renderDisplayObject=function(t,e,n,r,i){var o=t.nodeName,a=r[r.length-1];!a||t.compareDocumentPosition(a)&cs.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.pop());var s=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],u=t.parsedStyle.clipPath;if(u){this.applyWorldTransform(e,u);var l=this.pathGeneratorFactory[u.nodeName];l&&(e.save(),r.push(t),e.beginPath(),l(e,u.parsedStyle),e.closePath(),e.clip())}s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),c&&(e.beginPath(),c(e,t.parsedStyle),t.nodeName!==ar.LINE&&t.nodeName!==ar.PATH&&t.nodeName!==ar.POLYLINE&&e.closePath()),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.renderable.dirty=!1},t.prototype.convertAABB2Rect=function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},t.prototype.mergeDirtyAABBs=function(t){var e=new Ar;return t.forEach((function(t){var n=t.getRenderBounds();e.add(n);var r=t.renderable.dirtyRenderBounds;r&&e.add(r)})),e},t.prototype.searchDirtyObjects=function(t){var e=l(t.getMin(),2),n=e[0],r=e[1],i=l(t.getMax(),2),o=i[0],a=i[1];return this.rBush.search({minX:n,minY:r,maxX:o,maxY:a}).map((function(t){return t.displayObject}))},t.prototype.saveDirtyAABB=function(t){var e=t.renderable;e.dirtyRenderBounds||(e.dirtyRenderBounds=new Ar);var n=t.getRenderBounds();n&&e.dirtyRenderBounds.update(n.center,n.halfExtents)},t.prototype.applyAttributesToContext=function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,a=n.lineDash,s=n.lineDashOffset;a&&t.setLineDash(a),_t(s)||(t.lineDashOffset=s),_t(o)||(t.globalAlpha*=o),_t(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),_t(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},t.prototype.applyWorldTransform=function(t,e,n){n?(M(this.tmpMat4,e.getLocalTransform()),A(this.tmpMat4,n,this.tmpMat4),A(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(M(this.tmpMat4,e.getWorldTransform()),A(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.prototype.safeMergeAABB=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=new Ar;return t.forEach((function(t){n.add(t)})),n},t.tag="CanvasRenderer",t}(),RG=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n,r,i,o){var a=e.fill,s=e.fillRule,c=e.opacity,u=void 0===c?1:c,l=e.fillOpacity,h=void 0===l?1:l,d=e.stroke,f=e.strokeOpacity,p=void 0===f?1:f,g=e.lineWidth,m=void 0===g?1:g,y=e.lineCap,v=e.lineJoin,b=e.shadowType,x=e.shadowColor,w=e.shadowBlur,E=e.filter,M=e.miterLimit,S=a&&!a.isNone,N=d&&!d.isNone&&m>0,k=0===(null==a?void 0:a.alpha),C=!(!E||!E.length),T=!_t(x)&&w>0,A=n.nodeName,P="inner"===b,O=N&&T&&(A===ar.PATH||A===ar.LINE||A===ar.POLYLINE||k||P);S&&(t.globalAlpha=u*h,O||_G(n,t,T),IG(t,n,a,s,r,i,o,this.imagePool),O||this.clearShadowAndFilter(t,C,T)),N&&(t.globalAlpha=u*p,t.lineWidth=m,_t(M)||(t.miterLimit=M),_t(y)||(t.lineCap=y),_t(v)||(t.lineJoin=v),O&&(P&&(t.globalCompositeOperation="source-atop"),_G(n,t,!0),P&&(jG(t,n,d,r,i,o,this.imagePool),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,C,!0))),jG(t,n,d,r,i,o,this.imagePool))},t.prototype.clearShadowAndFilter=function(t,e,n){if(n&&(t.shadowColor="transparent",t.shadowBlur=0),e){var r=t.filter;!_t(r)&&r.indexOf("drop-shadow")>-1&&(t.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},t}();function _G(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,a=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=c||0)}function DG(t,e,n,r,i,o,a){var s,c;if("rect"===t.image.nodeName){var u=t.image.parsedStyle,l=u.width,h=u.height;c=r.contextService.getDPR();var d=r.config.offscreenCanvas;(s=o.offscreenCanvasCreator.getOrCreateCanvas(d)).width=l*c,s.height=h*c;var f=o.offscreenCanvasCreator.getOrCreateContext(d),p=[];t.image.forEach((function(t){i.renderDisplayObject(t,f,r,p,o)})),p.forEach((function(){f.restore()}))}return a.getOrCreatePatternSync(t,n,s,c,e.getGeometryBounds().min,(function(){e.renderable.dirty=!0,r.renderingService.dirtify()}))}function LG(t,e,n,r){var o;if(t.type===Xr.LinearGradient||t.type===Xr.RadialGradient){var a=e.getGeometryBounds(),s=a&&2*a.halfExtents[0]||1,c=a&&2*a.halfExtents[1]||1,u=a&&a.min||[0,0];o=r.getOrCreateGradient(i(i({type:t.type},t.value),{min:u,width:s,height:c}),n)}return o}function IG(t,e,n,r,i,o,a,s,c){void 0===c&&(c=!1),Array.isArray(n)?n.forEach((function(n){t.fillStyle=LG(n,e,t,s),c||(r?t.fill(r):t.fill())})):(Bi(n)&&(t.fillStyle=DG(n,e,t,i,o,a,s)),c||(r?t.fill(r):t.fill()))}function jG(t,e,n,r,i,o,a,s){void 0===s&&(s=!1),Array.isArray(n)?n.forEach((function(n){t.strokeStyle=LG(n,e,t,a),s||t.stroke()})):(Bi(n)&&(t.strokeStyle=DG(n,e,t,r,i,o,a)),s||t.stroke())}var BG=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n){var r,i=e.x,o=void 0===i?0:i,a=e.y,s=void 0===a?0:a,c=e.width,u=e.height,l=e.src,h=e.shadowColor,d=e.shadowBlur,f=c,p=u;if(Wt(l)?r=this.imagePool.getImageSync(l):(f||(f=l.width),p||(p=l.height),r=l),r){_G(n,t,!_t(h)&&d>0);try{t.drawImage(r,o,s,f,p)}catch(t){}}},t}(),FG=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n,r,i,o){n.getBounds();var a=e,s=a.lineWidth,c=void 0===s?1:s,u=a.textAlign,l=void 0===u?"start":u,h=a.textBaseline,d=void 0===h?"alphabetic":h,f=a.lineJoin,p=void 0===f?"miter":f,g=a.miterLimit,m=void 0===g?10:g,y=a.letterSpacing,v=void 0===y?0:y,b=a.stroke,x=a.fill,w=a.fillRule,E=a.fillOpacity,M=void 0===E?1:E,S=a.strokeOpacity,N=void 0===S?1:S,k=a.opacity,C=void 0===k?1:k,T=a.metrics,A=a.x,P=void 0===A?0:A,O=a.y,R=void 0===O?0:O,_=a.dx,D=a.dy,L=a.shadowColor,I=a.shadowBlur,j=T.font,B=T.lines,F=T.height,z=T.lineHeight,G=T.lineMetrics;t.font=j,t.lineWidth=c,t.textAlign="middle"===l?"center":l;var V=d;o.enableCSSParsing||"alphabetic"!==V||(V="bottom"),t.lineJoin=p,_t(m)||(t.miterLimit=m);var W=R;"middle"===d?W+=-F/2-z/2:"bottom"===d||"alphabetic"===d||"ideographic"===d?W+=-F:"top"!==d&&"hanging"!==d||(W+=-z);var H=P+(_||0);W+=D||0,1===B.length&&("bottom"===V?(V="middle",W-=.5*F):"top"===V&&(V="middle",W+=.5*F)),t.textBaseline=V,_G(n,t,!_t(L)&&I>0);for(var $=0;$<B.length;$++){var U=c/2+H;W+=z,_t(b)||b.isNone||!c||this.drawLetterSpacing(t,n,B[$],G[$],l,U,W,v,x,w,M,b,N,C,!0,r,i,o),_t(x)||this.drawLetterSpacing(t,n,B[$],G[$],l,U,W,v,x,w,M,b,N,C,!1,r,i,o)}},t.prototype.drawLetterSpacing=function(t,e,n,r,i,o,a,s,c,u,l,h,d,f,p,g,m,y){if(0!==s){var v=t.textAlign;t.textAlign="left";var b=o;"center"===i||"middle"===i?b=o-r.width/2:"right"!==i&&"end"!==i||(b=o-r.width);for(var x=Array.from(n),w=t.measureText(n).width,E=0,M=0;M<x.length;++M){var S=x[M];p?this.strokeText(t,e,S,b,a,h,d,g,m,y):this.fillText(t,e,S,b,a,c,u,l,f,g,m,y),b+=w-(E=t.measureText(n.substring(M+1)).width)+s,w=E}t.textAlign=v}else p?this.strokeText(t,e,n,o,a,h,d,g,m,y):this.fillText(t,e,n,o,a,c,u,l,f,g,m,y)},t.prototype.fillText=function(t,e,n,r,i,o,a,s,c,u,l,h){var d;IG(t,e,o,a,u,l,h,this.imagePool,!0);var f=!_t(s)&&1!==s;f&&(d=t.globalAlpha,t.globalAlpha=s*c),t.fillText(n,r,i),f&&(t.globalAlpha=d)},t.prototype.strokeText=function(t,e,n,r,i,o,a,s,c,u){var l;jG(t,e,o,s,c,u,this.imagePool,!0);var h=!_t(a)&&1!==a;h&&(l=t.globalAlpha,t.globalAlpha=a),t.strokeText(n,r,i),h&&(t.globalAlpha=l)},t}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(RG);var zG=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="canvas-renderer",n}return r(e,t),e.prototype.init=function(){var t,e=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,r=new RG(n),o=((t={})[ar.CIRCLE]=r,t[ar.ELLIPSE]=r,t[ar.RECT]=r,t[ar.IMAGE]=new BG(n),t[ar.TEXT]=new FG(n),t[ar.LINE]=r,t[ar.POLYLINE]=r,t[ar.POLYGON]=r,t[ar.PATH]=r,t[ar.GROUP]=void 0,t[ar.HTML]=void 0,t[ar.MESH]=void 0,t);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new OG(e))},e.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},e}(ur),GG=function(){function t(){}return t.prototype.apply=function(e,n){var r=this,i=e.renderingService,o=e.renderingContext,a=e.config;this.context=e;var s=o.root.ownerDocument.defaultView,c=function(t){i.hooks.pointerMove.call(t)},u=function(t){i.hooks.pointerUp.call(t)},l=function(t){i.hooks.pointerDown.call(t)},h=function(t){i.hooks.pointerOver.call(t)},d=function(t){i.hooks.pointerOut.call(t)},f=function(t){i.hooks.pointerCancel.call(t)},p=function(t){i.hooks.pointerWheel.call(t)},g=function(t){i.hooks.click.call(t)};i.hooks.init.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="none",t.style.msTouchAction="none"):s.supportsPointerEvents&&(t.style.touchAction="none"),s.supportsPointerEvents?function(t){n.globalThis.document.addEventListener("pointermove",c,!0),t.addEventListener("pointerdown",l,!0),t.addEventListener("pointerleave",d,!0),t.addEventListener("pointerover",h,!0),n.globalThis.addEventListener("pointerup",u,!0),n.globalThis.addEventListener("pointercancel",f,!0)}(t):function(t){n.globalThis.document.addEventListener("mousemove",c,!0),t.addEventListener("mousedown",l,!0),t.addEventListener("mouseout",d,!0),t.addEventListener("mouseover",h,!0),n.globalThis.addEventListener("mouseup",u,!0)}(t),s.supportsTouchEvents&&function(t){t.addEventListener("touchstart",l,!0),t.addEventListener("touchend",u,!0),t.addEventListener("touchmove",c,!0),t.addEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.addEventListener("click",g,!0),t.addEventListener("wheel",p,{passive:!0,capture:!0})})),i.hooks.destroy.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):s.supportsPointerEvents&&(t.style.touchAction=""),s.supportsPointerEvents?function(t){n.globalThis.document.removeEventListener("pointermove",c,!0),t.removeEventListener("pointerdown",l,!0),t.removeEventListener("pointerleave",d,!0),t.removeEventListener("pointerover",h,!0),n.globalThis.removeEventListener("pointerup",u,!0)}(t):function(t){n.globalThis.document.removeEventListener("mousemove",c,!0),t.removeEventListener("mousedown",l,!0),t.removeEventListener("mouseout",d,!0),t.removeEventListener("mouseover",h,!0),n.globalThis.removeEventListener("mouseup",u,!0)}(t),s.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",l,!0),t.removeEventListener("touchend",u,!0),t.removeEventListener("touchmove",c,!0),t.removeEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.removeEventListener("click",g,!0),t.removeEventListener("wheel",p,!0)}))},t.tag="DOMInteraction",t}(),VG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="dom-interaction",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new GG)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(ur),WG=function(){function t(){this.displayObjectHTMLElementMap=new WeakMap}return t.prototype.joinTransformMatrix=function(t){return"matrix(".concat([t[0],t[1],t[4],t[5],t[12],t[13]].join(","),")")},t.prototype.apply=function(e,n){var r=this,i=e.camera,o=e.renderingContext,a=e.renderingService;this.context=e;var s=o.root.ownerDocument.defaultView,c=s.context.eventService.nativeHTMLMap,u=function(t,e){e.style.transform=r.joinTransformMatrix(t.getWorldTransform())},l=function(t){var e=t.target;if(e.nodeName===ar.HTML){r.$camera||(r.$camera=r.createCamera(i));var o=r.getOrCreateEl(e);if(r.$camera.appendChild(o),n.enableCSSParsing){var a=e.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(t){o.style[t]=a[t]}))}Object.keys(e.attributes).forEach((function(t){r.updateAttribute(t,e)})),u(e,o),c.set(o,e)}},h=function(t){var e=t.target;if(e.nodeName===ar.HTML&&r.$camera){var n=r.getOrCreateEl(e);n&&(n.remove(),c.delete(n))}},d=function(t){var e=t.target;if(e.nodeName===ar.HTML){var n=t.attrName;r.updateAttribute(n,e)}},f=function(t){var e=t.target;if(e.nodeName===ar.HTML){var n=r.getOrCreateEl(e);u(e,n)}},p=function(){if(r.$camera){var t=r.context.config,e=t.width,n=t.height;r.$camera.style.width="".concat(e||0,"px"),r.$camera.style.height="".concat(n||0,"px")}};a.hooks.init.tap(t.tag,(function(){s.addEventListener(Is.RESIZE,p),s.addEventListener(hs.MOUNTED,l),s.addEventListener(hs.UNMOUNTED,h),s.addEventListener(hs.ATTR_MODIFIED,d),s.addEventListener(hs.BOUNDS_CHANGED,f)})),a.hooks.endFrame.tap(t.tag,(function(){r.$camera&&o.renderReasons.has(es.CAMERA_CHANGED)&&(r.$camera.style.transform=r.joinTransformMatrix(i.getOrthoMatrix()))})),a.hooks.destroy.tap(t.tag,(function(){r.$camera&&r.$camera.remove(),s.removeEventListener(Is.RESIZE,p),s.removeEventListener(hs.MOUNTED,l),s.removeEventListener(hs.UNMOUNTED,h),s.removeEventListener(hs.ATTR_MODIFIED,d),s.removeEventListener(hs.BOUNDS_CHANGED,f)}))},t.prototype.createCamera=function(t){var e=this.context.config,n=e.document,r=e.width,i=e.height,o=this.context.contextService.getDomElement(),a=o.parentNode;if(a){var s="g-canvas-camera",c=a.querySelector("#"+s);if(!c){var u=(n||document).createElement("div");c=u,u.id=s,u.style.position="absolute",u.style.left="".concat(o.offsetLeft||0,"px"),u.style.top="".concat(o.offsetTop||0,"px"),u.style.transformOrigin="left top",u.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),u.style.overflow="hidden",u.style.pointerEvents="none",u.style.width="".concat(r||0,"px"),u.style.height="".concat(i||0,"px"),a.appendChild(u)}return c}return null},t.prototype.getOrCreateEl=function(t){var e=this.context.config.document,n=this.displayObjectHTMLElementMap.get(t);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(t,n),t.id&&(n.id=t.id),t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform())),n},t.prototype.updateAttribute=function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;Wt(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"x":n.style.left="".concat(e.parsedStyle.x,"px");break;case"y":n.style.top="".concat(e.parsedStyle.y,"px");break;case"transformOrigin":var i=e.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);break;case"width":if(this.context.enableCSSParsing){var o=e.computedStyleMap().get("width");n.style.width=o.toString()}else{o=e.parsedStyle.width;n.style.width=Yt(o)?"".concat(o,"px"):o.toString()}break;case"height":if(this.context.enableCSSParsing){var a=e.computedStyleMap().get("height");n.style.height=a.toString()}else{a=e.parsedStyle.height;n.style.height=Yt(a)?"".concat(a,"px"):a.toString()}break;case"zIndex":var s=e.parsedStyle.zIndex;n.style["z-index"]="".concat(s);break;case"visibility":var c=e.parsedStyle.visibility;n.style.visibility=c;break;case"pointerEvents":var u=e.parsedStyle.pointerEvents,l=void 0===u?"auto":u;n.style.pointerEvents=l;break;case"opacity":var h=e.parsedStyle.opacity;n.style.opacity="".concat(h);break;case"fill":var d=e.parsedStyle.fill,f="";Fi(d)?f=d.isNone?"transparent":e.getAttribute("fill"):Array.isArray(d)?f=e.getAttribute("fill"):Bi(d),n.style.background=f;break;case"stroke":var p=e.parsedStyle.stroke,g="";Fi(p)?g=p.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(p)?g=e.getAttribute("stroke"):Bi(p),n.style["border-color"]=g,n.style["border-style"]="solid";break;case"lineWidth":var m=e.parsedStyle.lineWidth;n.style["border-width"]="".concat(m||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":var y=e.style.filter;n.style.filter=y;break;default:_t(e.style[t])||""===e.style[t]||(n.style[t]=e.style[t])}},t.tag="HTMLRendering",t}(),HG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="html-renderer",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new WG)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(ur),$G=function(){function t(t){this.canvasConfig=t,this.imageCache={},this.gradientCache={},this.patternCache={}}return t.prototype.getImageSync=function(t,e){return this.imageCache[t]?e&&e(this.imageCache[t]):this.getOrCreateImage(t).then((function(t){e&&e(t)})),this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var e=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(r,i){var o;n?o=n(t):pa&&(o=new window.Image),o&&(o.onload=function(){e.imageCache[t]=o,r(o)},o.onerror=function(t){i(t)},o.crossOrigin="Anonymous",o.src=t)}))},t.prototype.getOrCreatePatternSync=function(t,e,n,r,i,o){var a=this.generatePatternKey(t);if(a&&this.patternCache[a])return this.patternCache[a];var s,c=t.image,u=t.repetition,l=t.transform,h=!1;Wt(c)?s=this.getImageSync(c,o):n?(s=n,h=!0):s=c;var d=s&&e.createPattern(s,u);if(d){var f=void 0;f=l?Wa(Po(l),new Ws({})):N(w()),h&&O(f,f,[1/r,1/r,1]),d.setTransform({a:f[0],b:f[1],c:f[4],d:f[5],e:f[12]+i[0],f:f[13]+i[1]})}return a&&d&&(this.patternCache[a]=d),d},t.prototype.getOrCreateGradient=function(t,e){var n=this.generateGradientKey(t),r=t.type,i=t.steps,o=t.min,a=t.width,s=t.height,c=t.angle,u=t.cx,l=t.cy,h=t.size;if(this.gradientCache[n])return this.gradientCache[n];var d=null;if(r===Xr.LinearGradient){var f=function(t,e,n,r){var i=yr(r.value),o=0+e/2,a=0+n/2,s=Math.abs(e*Math.cos(i))+Math.abs(n*Math.sin(i));return{x1:t[0]+o-Math.cos(i)*s/2,y1:t[1]+a-Math.sin(i)*s/2,x2:t[0]+o+Math.cos(i)*s/2,y2:t[1]+a+Math.sin(i)*s/2}}(o,a,s,c),p=f.x1,g=f.y1,m=f.x2,y=f.y2;d=e.createLinearGradient(p,g,m,y)}else if(r===Xr.RadialGradient){var v=function(t,e,n,r,i,o){var a=r.value,s=i.value;r.unit===Fr.kPercentage&&(a=r.value/100*e),i.unit===Fr.kPercentage&&(s=i.value/100*n);var c=Math.max($e([0,0],[a,s]),$e([0,n],[a,s]),$e([e,n],[a,s]),$e([e,0],[a,s]));return o&&(o instanceof hi?c=o.value:o instanceof ri&&("closest-side"===o.value?c=Math.min(a,e-a,s,n-s):"farthest-side"===o.value?c=Math.max(a,e-a,s,n-s):"closest-corner"===o.value&&(c=Math.min($e([0,0],[a,s]),$e([0,n],[a,s]),$e([e,n],[a,s]),$e([e,0],[a,s]))))),{x:a+t[0],y:s+t[1],r:c}}(o,a,s,u,l,h),b=v.x,x=v.y,w=v.r;d=e.createRadialGradient(b,x,0,b,x,w)}return d&&(i.forEach((function(t){var e=t.offset,n=t.color;e.unit===Fr.kPercentage&&(null==d||d.addColorStop(e.value/100,n.toString()))})),this.gradientCache[n]=d),this.gradientCache[n]},t.prototype.generateGradientKey=function(t){var e=t.type,n=t.min,r=t.width,i=t.height,o=t.steps,a=t.angle,s=t.cx,c=t.cy,u=t.size;return"gradient-".concat(e,"-").concat((null==a?void 0:a.toString())||0,"-").concat((null==s?void 0:s.toString())||0,"-").concat((null==c?void 0:c.toString())||0,"-").concat((null==u?void 0:u.toString())||0,"-").concat(n[0],"-").concat(n[1],"-").concat(r,"-").concat(i,"-").concat(o.map((function(t){var e=t.offset,n=t.color;return"".concat(e).concat(n)})).join("-"))},t.prototype.generatePatternKey=function(t){var e=t.image,n=t.repetition;return Wt(e)?"pattern-".concat(e,"-").concat(n):"rect"===e.nodeName?"pattern-".concat(e.entity,"-").concat(n):void 0},t}(),UG=function(){function t(){}return t.prototype.apply=function(e){var n=e.renderingService,r=e.renderingContext,i=e.imagePool,o=r.root.ownerDocument.defaultView,a=function(t,e,n){var r=t.parsedStyle,i=r.width,o=r.height;i&&!o?t.setAttribute("height",n/e*i):!i&&o&&t.setAttribute("width",e/n*o)},s=function(t){var e=t.target,r=e.nodeName,o=e.attributes;if(r===ar.IMAGE){var s=o.src,c=o.keepAspectRatio;Wt(s)&&i.getImageSync(s,(function(t){var r=t.width,i=t.height;c&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))}},c=function(t){var e=t.target,r=t.attrName,o=t.newValue;e.nodeName===ar.IMAGE&&"src"===r&&Wt(o)&&i.getOrCreateImage(o).then((function(t){var r=t.width,i=t.height;e.attributes.keepAspectRatio&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))};n.hooks.init.tap(t.tag,(function(){o.addEventListener(hs.MOUNTED,s),o.addEventListener(hs.ATTR_MODIFIED,c)})),n.hooks.destroy.tap(t.tag,(function(){o.removeEventListener(hs.MOUNTED,s),o.removeEventListener(hs.ATTR_MODIFIED,c)}))},t.tag="LoadImage",t}(),YG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="image-loader",e}return r(e,t),e.prototype.init=function(){this.context.imagePool=new $G(this.context.config),this.addRenderingPlugin(new UG)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(ur),qG=function(){function t(t){this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return t.prototype.init=function(){var t=this.canvasConfig,e=t.container,n=t.canvas;if(n)this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(e&&(this.$container=Wt(e)?document.getElementById(e):e,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},t.prototype.getContext=function(){return this.context},t.prototype.getDomElement=function(){return this.$canvas},t.prototype.getDPR=function(){return this.dpr},t.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},t.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},t.prototype.resize=function(t,e){var n=this.canvasConfig.devicePixelRatio||pa&&window.devicePixelRatio||1;n=n>=1?Math.ceil(n):1,this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,function(t,e,n){pa&&t.style&&(t.style.width=e+"px",t.style.height=n+"px")}(this.$canvas,t,e)),this.renderingContext.renderReasons.add(es.CAMERA_CHANGED)},t.prototype.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},t.prototype.toDataURL=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n;return c(this,(function(r){return e=t.type,n=t.encoderOptions,[2,this.context.canvas.toDataURL(e,n)]}))}))},t}(),KG=function(t){function e(){var e=t.apply(this,h([],l(arguments),!1))||this;return e.name="canvas-context-register",e}return r(e,t),e.prototype.init=function(){this.context.ContextService=qG},e.prototype.destroy=function(){delete this.context.ContextService},e}(ur),XG=function(t){function e(e){var n=t.call(this,e)||this;return n.registerPlugin(new KG),n.registerPlugin(new YG),n.registerPlugin(new aG),n.registerPlugin(new zG),n.registerPlugin(new VG),n.registerPlugin(new PG),n.registerPlugin(new HG),n}return r(e,t),e}(lr);const ZG=["timestamp","time","date","datetime"];class QG extends iL{static defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:t=>eV(t,ZG,void 0),loop:!1};timebar;canvas;wrapper;originalData;get padding(){return ol(this.options.padding)}constructor(t,e){super(t,Object.assign({},QG.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){this.timebar?.play()}pause(){this.timebar?.pause()}forward(){this.timebar?.forward()}backward(){this.timebar?.backward()}reset(){this.timebar?.reset()}update(t){super.update(t),this.backup(),Object.keys(t).forEach((t=>{if("position"===t)this.upsertWrapper();else this.upsertTimebar()}))}backup(){this.originalData=JG(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,{onChange:e,timebarType:n,data:r,x:i,y:o,width:a,height:s,mode:c,...u}=this.options,l=t.getSize(),[h]=this.padding;this.upsertCanvas().ready.then((()=>{const t={x:l[0]/2-a/2,y:h,onChange:t=>{const n=(It(t)?t:[t,t]).map((t=>function(t){return Lt(t,"Date")}(t)?t.getTime():t));"modify"===this.options.mode?this.filterElements(n):this.hiddenElements(n),e?.(n)},...u,data:r.map((t=>Yt(t)?{time:t,value:0}:t)),width:a,height:s,type:n};this.timebar?this.timebar.update(t):(this.timebar=new Zz({style:t}),this.canvas?.appendChild(this.timebar))}))}upsertWrapper(){if(!this.wrapper){const t=document.createElement("div");t.style.position="absolute",this.wrapper=t}const{x:t,y:e,className:n,position:r}=this.options;return n&&(this.wrapper.className=n),Yt(t)||Yt(e)?Object.assign(this.wrapper.style,{left:`${t??0}px`,top:`${e??0}px`}):Object.assign(this.wrapper.style,{["top"===r?"bottom":"top"]:"unset",["top"===r?"top":"bottom"]:"0px"}),this.context.canvas.getContainer()?.appendChild(this.wrapper),this.wrapper}upsertCanvas(){const t=this.upsertWrapper();if(this.canvas)return this.canvas;const{height:e}=this.options,[n]=this.context.canvas.getSize(),[r,,i]=this.padding;return this.canvas=new pc({container:t,width:n,height:e+r+i,renderer:this.context.options.renderer?.("main")||new XG,supportsMutipleCanvasesInOneContainer:!0}),this.canvas}async filterElements(t){if(!this.originalData)return;const{elementTypes:e,getTime:n}=this.options,{graph:r,element:i}=this.context,o=JG(this.originalData);e.forEach((e=>{const r=`${e}s`;o[r]=(this.originalData[r]||[]).filter((e=>{const r=n(e);return!!tV(r,t)}))}));const a=[...o.nodes,...o.combos].map((t=>Gu(t)));o.edges=o.edges.filter((t=>{const e=t.source,n=t.target;return a.includes(e)&&a.includes(n)})),r.setData(o),await(i.draw({animation:!1,silence:!0})?.finished)}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:r}=this.options,i=[],o=[];n.forEach((e=>{const n=`${e}s`;(this.originalData?.[n]||[]).forEach((e=>{const n=Gu(e),a=r(e);tV(a,t)?o.push(n):i.push(n)}))})),e.hideElement(i,!1),e.showElement(o,!1)}destroy(){const{graph:t}=this.context;this.originalData&&t.setData({...this.originalData}),this.timebar?.destroy(),this.canvas?.destroy(),this.wrapper?.remove(),this.originalData=void 0,this.wrapper=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}const JG=t=>{const{nodes:e=[],edges:n=[],combos:r=[]}=t;return{nodes:[...e],edges:[...n],combos:[...r]}},tV=(t,e)=>{if(Yt(e))return t===e;const[n,r]=e;return t>=n&&t<=r},eV=(t,e,n)=>{for(let n=0;n<e.length;n++){const r=e[n],i=t.data?.[r];if(i)return i}return n};class nV extends iL{static defaultOptions={position:"top-left"};$element=nL("toolbar",!1);constructor(t,e){super(t,Object.assign({},nV.defaultOptions,e));const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),rL("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n }\n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),rL("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">\n <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>\n <symbol id="request-fullscreen" viewBox="0 0 1024 1024">\n <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}async update(t){super.update(t);const{className:e,position:n,style:r}=this.options;this.$element.className=`g6-toolbar ${e||""}`,Object.assign(this.$element.style,r,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach((t=>{e[t]="8px"})),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(n)),this.$element.innerHTML=await this.getDOMContent()}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}async getDOMContent(){return(await this.options.getItems()).map((t=>`\n <div class="g6-toolbar-item" value="${t.value}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`)).join("")}onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");e?.(n,t.target)}}}class rV extends iL{static defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};currentTarget=null;tooltipElement=null;container=null;constructor(t,e){super(t,Object.assign({},rV.defaultOptions,e)),this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){this.unbindEvents(),super.update(t),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.off(n,e[n])}))}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.on(n,e[n])}))}isEnable=t=>{const{enable:e}=this.options;return"function"==typeof e?e(t):e};onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?(this.currentTarget=null,this.hide(t)):(this.currentTarget=e,this.show(t))};onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.show(t)};onPointerLeave=t=>{this.hide(t),this.currentTarget=null};onCanvasMove=t=>{this.hide(t),this.currentTarget=null};onPointerEnter=t=>{this.show(t)};showById=t=>{const e={target:{id:t}};this.show(e)};getElementData=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}};show=t=>{const{client:e,target:{id:n}}=t,r=this.context.graph.getElementType(n);if(!this.tooltipElement||!this.isEnable(t))return;const{getContent:i,title:o}=this.options;this.currentTarget=n;const a=this.getElementData(n,r);let s,c;if(e)s=e.x,c=e.y;else{const t=pe(a,"0.style",{x:0,y:0});s=t.x,c=t.y}let u={};if(i)u.content=i(t,a);else{const t=this.context.graph.getElementRenderStyle(n),e="node"===r?t.fill:t.stroke;u={title:o||r,data:a.map((t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:e})))}}this.tooltipElement.update({x:s,y:c,style:{".tooltip":{visibility:"visible"}},...u})};hide=t=>{if(!t)return void this.tooltipElement?.hide();if(!this.tooltipElement||!this.isEnable(t))return;const{client:{x:e,y:n}}=t;this.tooltipElement.hide(e,n)};initTooltip=()=>{const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:a,enterable:s,container:c={x:-i,y:-r},title:u,offset:l}=this.options,[h,d]=e,[f,p]=t.getSize(),g=new Mz({className:"tooltip",style:{x:h,y:d,container:c,title:u,bounding:{x:0,y:0,width:f,height:p},position:a,enterable:s,offset:l,style:o}});return this.container?.appendChild(g.HTMLTooltipElement),g};destroy(){this.unbindEvents(),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),super.destroy()}}let iV;function oV(t,e){iV||(iV=document.createElement("canvas")),iV.width=t,iV.height=e;return iV.getContext("2d").clearRect(0,0,t,e),iV}class aV extends iL{static defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};$element=nL("watermark");constructor(t,e){super(t,Object.assign({},aV.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}async update(t){super.update(t);const{width:e,height:n,text:r,imageURL:i,...o}=this.options;Object.keys(o).forEach((e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])}));const a=i?await async function(t,e,n,r){const i=oV(t,e),o=i.getContext("2d"),{rotate:a,opacity:s}=r;a&&o.rotate(a),s&&(o.globalAlpha=s);const c=new Image;return c.crossOrigin="anonymous",c.src=n,new Promise((n=>{c.onload=function(){const r=t>c.width?(t-c.width)/2:0,a=e>c.height?(e-c.height)/2:0;o.drawImage(c,0,0,c.width,c.height,r,a,t-2*r,e-2*a),n(i.toDataURL())}}))}(e,n,i,o):await async function(t,e,n,r){const i=oV(t,e),o=i.getContext("2d"),{rotate:a,opacity:s,textFill:c,textFontSize:u,textFontFamily:l,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:p}=r;return o.textAlign=f,o.textBaseline=p,o.translate(t/2,e/2),o.font=`${u}px ${l} ${h} ${d}`,a&&o.rotate(a),s&&(o.globalAlpha=s),c&&(o.fillStyle=c,o.fillText(`${n}`,0,0)),i.toDataURL()}(e,n,r,o);this.$element.style.backgroundImage=`url(${a})`}destroy(){super.destroy(),this.$element.remove()}}const sV=["#7E92B5","#F4664A","#FFBE3A"],cV={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},uV={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function lV(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeHaloStrokeOpacityActive:a=.15,nodeHaloStrokeOpacitySelected:s=.25,nodeOpacityDisabled:c=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:l=.25,nodeBadgePalette:h=sV,nodePaletteOptions:d=cV,edgeColor:f,edgeColorDisabled:p,edgePaletteOptions:g=uV,comboColor:m,comboColorDisabled:y,comboStroke:v,comboStrokeDisabled:b,edgeColorInactive:x}=t;return{background:e,node:{palette:d,style:{badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:r,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:n,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65,size:32,stroke:o,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:s,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:o},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:a},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:o,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:l,donutOpacity:l,fillOpacity:l,iconOpacity:u,labelFill:n,labelFillOpacity:l,strokeOpacity:l},disabled:{badgeBackgroundOpacity:.25,donutOpacity:c,fill:i,fillOpacity:c,iconFill:i,iconOpacity:.25,labelFill:n,labelFillOpacity:.25,strokeOpacity:c}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:f,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:f,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:x,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:p,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:e,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:m,halo:!1,haloLineWidth:12,haloStroke:v,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:v},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:y,fillOpacity:.25,labelOpacity:.25,stroke:b,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const hV=lV({bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:{type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"}),dV=lV({bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"});class fV extends el{beforeDraw(t,e){return t}}function pV(t,e,n,r,i){const o=Gu(r),a=`${n}s`,s=t.add[a].get(o)||t.update[a].get(o)||t.remove[a].get(o)||r;Object.entries(t).forEach((([t,n])=>{e===t?n[a].set(o,s):n[a].delete(o)}))}const gV=(t,e,n,r)=>{const i=`${n}s`,o=Gu(r);t.add[i].has(o)||t.update[i].has(o)||t[e][i].set(Gu(r),r)};class mV{type;constructor(t){this.type=t}}class yV extends mV{data;constructor(t,e){super(t),this.data=e}}class vV extends mV{animationType;animation;data;constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class bV extends mV{elementType;data;constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class xV extends mV{data;constructor(t,e){super(t),this.data=e}}function wV(t,e){t.emit(e.type,e)}class EV{context;constructor(t){this.context=t}tasks=[];animations=new Set;getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){e?.before?.();const r=this.getTasks().map((([e,r])=>{const{element:i,elementType:o,stage:a}=e,s=zu(this.context.options,o,a,t);r?.before?.();const c=Uu(i,this.inferStyle(e,n),s);return c?(r?.beforeAnimate?.(c),c.finished.then((()=>{r?.afterAnimate?.(c),r?.after?.()}))):r?.after?.(),c})).filter(Boolean);r.forEach((t=>this.animations.add(t)));const i=Iu(r);return i?(e?.beforeAnimate?.(i),i.finished.then((()=>{e?.afterAnimate?.(i),e?.after?.()}))):e?.after?.(),i}inferStyle(t,e){const{element:n,elementType:r,stage:i,originalStyle:o,modifiedStyle:a}=t,s={...o},c={...a},u=()=>dh(n,"opacity")??Bu("opacity");if("enter"===i)Object.assign(s,{opacity:0});else if("exit"===i)Object.assign(c,{opacity:0});else if("show"===i)Object.assign(s,{opacity:0}),Object.assign(c,{opacity:u()});else if("hide"===i)Object.assign(s,{opacity:u()}),Object.assign(c,{opacity:0});else if("collapse"===i){const{collapse:t}=e||{},{target:i,descendants:o,position:a}=t;if("node"===r){if(o.includes(n.id)){const[t,e,n]=a;Object.assign(c,{x:t,y:e,z:n})}}else if("combo"===r){if(n.id===i||o.includes(n.id)){const[t,e]=a;Object.assign(c,{x:t,y:e,childrenNode:s.childrenNode})}}else"edge"===r&&Object.assign(c,{sourceNode:s.sourceNode,targetNode:s.targetNode})}else if("expand"===i){const{expand:t}=e||{},{target:i,descendants:o,position:a}=t;if("node"===r){if(n.id===i||o.includes(n.id)){const[t,e,n]=a;Object.assign(s,{x:t,y:e,z:n})}}else if("combo"===r){if(n.id===i||o.includes(n.id)){const[t,e,n]=a;Object.assign(s,{x:t,y:e,z:n,childrenNode:c.childrenNode})}}else"edge"===r&&Object.assign(s,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[s,c]}stop(){this.animations.forEach((t=>t.cancel()))}clear(){this.tasks=[]}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class MV{context;batchCount=0;constructor(t){this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(e=!0){this.batchCount++,1===this.batchCount&&this.emit(new yV(t.GraphEvent.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,0===this.batchCount&&this.emit(new yV(t.GraphEvent.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class SV extends tl{currentTarget=null;currentTargetType=null;category="behavior";constructor(t){super(t),this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.addEventListener(t,this.forwardContainerEvents)}));const n=this.context.canvas.document;n&&[t.CommonEvent.CLICK,t.CommonEvent.DBLCLICK,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE,t.CommonEvent.POINTER_ENTER,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_OUT,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_UP,t.CommonEvent.CONTEXT_MENU,t.CommonEvent.DRAG_START,t.CommonEvent.DRAG,t.CommonEvent.DRAG_END,t.CommonEvent.DRAG_ENTER,t.CommonEvent.DRAG_OVER,t.CommonEvent.DRAG_LEAVE,t.CommonEvent.DROP,t.CommonEvent.WHEEL].forEach((t=>{n.addEventListener(t,this.forwardCanvasEvents)}))}forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof rc)return{type:"canvas",element:t};let e=t;for(;e;){if(Nd(e))return{type:"node",element:e};if(kd(e))return{type:"edge",element:e};if(Cd(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:a,element:s}=r;if("destroyed"in s&&(zd(s)||s.destroyed))return;const{type:c,detail:u,button:l}=e,h={...e,target:s,targetType:a,originalTarget:n};c===t.CommonEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${this.currentTargetType}:${t.CommonEvent.POINTER_LEAVE}`,{...h,type:t.CommonEvent.POINTER_LEAVE,target:this.currentTarget}),s&&(Object.assign(h,{type:t.CommonEvent.POINTER_ENTER}),i.emit(`${a}:${t.CommonEvent.POINTER_ENTER}`,h))),this.currentTarget=s,this.currentTargetType=a),c===t.CommonEvent.CLICK&&2===l||(i.emit(`${a}:${c}`,h),i.emit(c,h)),c===t.CommonEvent.CLICK&&2===u&&(Object.assign(h,{type:t.CommonEvent.DBLCLICK}),i.emit(`${a}:${t.CommonEvent.DBLCLICK}`,h),i.emit(t.CommonEvent.DBLCLICK,h)),c===t.CommonEvent.POINTER_DOWN&&2===l&&(Object.assign(h,{type:t.CommonEvent.CONTEXT_MENU,preventDefault:()=>{o.getContainer()?.addEventListener(t.CommonEvent.CONTEXT_MENU,(t=>t.preventDefault()),{once:!0})}}),i.emit(`${a}:${t.CommonEvent.CONTEXT_MENU}`,h),i.emit(t.CommonEvent.CONTEXT_MENU,h))};forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)};destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.removeEventListener(t,this.forwardContainerEvents)})),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var NV=function(){function t(t){this.dragndropPluginOptions=t}return t.prototype.apply=function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,a=function(t){var e=t.target,r=e===i,a=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(a){var u=!1,l=t.timeStamp,h=[t.clientX,t.clientY],d=null,f=[t.clientX,t.clientY],p=function(t){return s(n,void 0,void 0,(function(){var n,o,s,p,g,m;return c(this,(function(c){switch(c.label){case 0:if(!u){if(n=t.timeStamp-l,o=$e([t.clientX,t.clientY],h),n<=this.dragndropPluginOptions.dragstartTimeThreshold||o<=this.dragndropPluginOptions.dragstartDistanceThreshold)return[2];t.type="dragstart",a.dispatchEvent(t),u=!0}return t.type="drag",t.dx=t.clientX-f[0],t.dy=t.clientY-f[1],a.dispatchEvent(t),f=[t.clientX,t.clientY],r?[3,2]:(s="pointer"===this.dragndropPluginOptions.overlap?[t.canvasX,t.canvasY]:e.getBounds().center,[4,i.elementsFromPoint(s[0],s[1])]);case 1:p=c.sent(),g=p[p.indexOf(e)+1],m=(null==g?void 0:g.closest("[droppable=true]"))||(this.dragndropPluginOptions.isDocumentDroppable?i:null),d!==m&&(d&&(t.type="dragleave",t.target=d,d.dispatchEvent(t)),m&&(t.type="dragenter",t.target=m,m.dispatchEvent(t)),(d=m)&&(t.type="dragover",t.target=d,d.dispatchEvent(t))),c.label=2;case 2:return[2]}}))}))};o.addEventListener("pointermove",p);var g=function(t){if(u){t.detail={preventClick:!0};var e=t.clone();d&&(e.type="drop",e.target=d,d.dispatchEvent(e)),e.type="dragend",a.dispatchEvent(e),u=!1}o.removeEventListener("pointermove",p)};e.addEventListener("pointerup",g,{once:!0}),e.addEventListener("pointerupoutside",g,{once:!0})}};r.hooks.init.tap(t.tag,(function(){o.addEventListener("pointerdown",a)})),r.hooks.destroy.tap(t.tag,(function(){o.removeEventListener("pointerdown",a)}))},t.tag="Dragndrop",t}(),kV=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="dragndrop",n}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new NV(i({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e.prototype.setOptions=function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)},e}(ur);class CV{config;background;main;label;transient;get canvas(){return{main:this.main,label:this.label,transient:this.transient,background:this.background}}get document(){return this.main.document}renderers;initialized=!1;constructor(t){this.config=t}async init(){if(this.initialized)return;const{renderer:t,background:e,...n}=this.config,{renderers:r,canvas:i}=["main","label","transient","background"].reduce(((e,r)=>{const i=Rt(t)?t?.(r):new XG;"main"===r?i.registerPlugin(new kV({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):i.unregisterPlugin(i.getPlugin("dom-interaction"));const o=new pc({renderer:i,supportsMutipleCanvasesInOneContainer:!0,...n});return e.renderers[r]=i,e.canvas[r]=o,this[r]=o,e}),{renderers:{},canvas:{}});this.renderers=r,Object.entries(i).forEach((([t,e])=>{const n=e.getContextService().getDomElement();n.style.position="absolute",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")})),this.setBackground(),await Promise.all(Object.values(this.canvas).map((t=>t.ready))),this.initialized=!0}getRendererType(t="main"){const e=this.renderers[t].getPlugins();for(const t of e){if("canvas-renderer"===t.name)return"canvas";if("svg-renderer"===t.name)return"svg";if("device-renderer"===t.name)return"gpu"}return"unknown"}get context(){return this.main.context}getDevice(){return this.main.context?.deviceRendererPlugin?.getDevice()}getConfig(){return this.config}setBackground(t=this.config.background){this.config.background=t}setCursor(t){this.config.cursor=t,Object.values(this.canvas).forEach((e=>{e.setCursor(t)}))}getSize(){return[this.config.width||0,this.config.height||0]}resize(t,e){this.config.width=t,this.config.height=e,Object.values(this.canvas).forEach((n=>{n.resize(t,e)}))}getCamera(){return this.main.getCamera()}getBounds(){return hl(Object.values(this.canvas).map((t=>t.document.documentElement)).filter((t=>t.childNodes.length>0)).map((t=>t.getBounds())))}getContainer(){const t=this.config.container;return Wt(t)?document.getElementById(t):t}appendChild(t){return this[t.style?.$layer||"main"].appendChild(t)}getContextService(){return this.main.getContextService()}viewport2Client(t){return this.main.viewport2Client(t)}viewport2Canvas(t){return this.main.viewport2Canvas(t)}client2Viewport(t){return this.main.client2Viewport(t)}canvas2Viewport(t){return this.main.canvas2Viewport(t)}async toDataURL(t={}){const e=window.devicePixelRatio||1,{mode:n="viewport",...r}=t;let i=0,o=0,a=0,s=0;if("viewport"===n)[a,s]=[this.config.width||0,this.config.height||0];else if("overall"===n){const t=this.getBounds(),e=cl(t);[i,o]=t.min,[a,s]=e}const c=an('<div id="virtual-image"></div>'),u=new pc({width:a,height:s,renderer:new XG,devicePixelRatio:e,container:c,background:this.config.background});await u.ready,u.appendChild(this.background.getRoot().cloneNode(!0)),u.appendChild(this.main.getRoot().cloneNode(!0));const l=this.label.getRoot().cloneNode(!0),h=u.viewport2Canvas({x:0,y:0}),d=this.main.viewport2Canvas({x:0,y:0});l.translate([d.x-h.x,d.y-h.y]),l.scale(1/this.main.getCamera().getZoom()),u.appendChild(l),u.appendChild(this.transient.getRoot().cloneNode(!0));const f=this.main.getCamera(),p=u.getCamera();if("viewport"===n)p.setZoom(f.getZoom()),p.setPosition(f.getPosition()),p.setFocalPoint(f.getFocalPoint());else if("overall"===n){const[t,e,n]=p.getPosition(),[r,a,s]=p.getFocalPoint();p.setPosition([t+i,e+o,n]),p.setFocalPoint([r+i,a+o,s])}const g=u.getContextService();return new Promise((t=>{u.on(Is.RERENDER,(async()=>{await new Promise((t=>setTimeout(t,300)));const e=await g.toDataURL(r);t(e)}))}))}destroy(){this.config={},this.renderers={},Object.entries(this.canvas).forEach((([t,e])=>{const n=e.getCamera();n.landmarks?.length&&n.cancelLandmarkAnimation(),function(t){t.destroy();const e=t.getCamera();e.eventEmitter.removeAllListeners(),t.document.timeline.destroy();const{animationsWithPromises:n}=t.document.timeline;n.forEach((t=>{t.effect.target&&(t.effect.target=null),t.effect.computedTiming&&(t.effect.computedTiming=null)})),t.document.timeline.animationsWithPromises=[],t.document.timeline.rafCallbacks=[],t.document.timeline=null}(e),this[t]=void 0}))}}function TV(t,e){const{data:n,style:r,...i}=t,{data:o,style:a,...s}=e,c={...i,...s};return(n||o)&&Object.assign(c,{data:{...n,...o}}),(r||a)&&Object.assign(c,{style:{...r,...a}}),c}function AV(t){const{data:e,style:n,...r}=t,i=r;return e&&(i.data={...e}),n&&(i.style={...n}),i}function PV(t){const{id:e=Gu(t),style:n,data:r,...i}=t,o={...t,style:{...n},data:{...r}};return function(t){return"source"in t&&"target"in t}(t)?{id:e,data:o,...i}:{id:e,data:o}}function OV(t){return t.data}class RV{model;latestRemovedComboIds=new Set;comboIds=new Set;changes=[];batchCount=0;isTraceless=!1;constructor(){this.model=new Zd}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Mu.NodeUpdated||e===Mu.EdgeUpdated||e===Mu.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:AV(n),original:AV(r),type:e})}else this.changes.push({value:AV(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=OV(n);return this.isCombo(Gu(r))||(void 0===t||t.includes(Gu(r)))&&e.push(r),e}),[])}getEdgeDatum(t){return OV(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce(((e,n)=>{const r=OV(n);return(void 0===t||t.includes(Gu(r)))&&e.push(r),e}),[])}getComboData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=OV(n);return this.isCombo(Gu(r))?((void 0===t||t.includes(Gu(r)))&&e.push(r),e):e}),[])}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(OV):[]}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Kl(e,(t=>{t!==e&&n.push(t)}),(t=>this.getChildrenData(Gu(t))),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e)return void console.error("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?OV(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?_u:Ru,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(OV):[]}getElementsDataByType(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementDataById(t){return"edge"===this.getElementType(t)?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){return OV(this.model.getNode(t))}getNodeLikeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=OV(n);return t?t.includes(Gu(r))&&e.push(r):e.push(r),e}),[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter((t=>t.states?.includes(e)))}getElementState(t){return this.getElementDataById(t)?.states||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(OV)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(OV)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i=[],edges:o=[],combos:a=[]}=this.getData(),s=Ju(i,e,(t=>Gu(t))),c=Ju(o,n,(t=>Gu(t))),u=Ju(a,r,(t=>Gu(t)));this.batch((()=>{this.addData({nodes:s.enter,edges:c.enter,combos:u.enter}),this.updateData({nodes:s.update,edges:c.update,combos:u.update}),this.removeData({nodes:s.exit.map(Gu),edges:c.exit.map(Gu),combos:u.exit.map(Gu)})}))}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)}))}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map((t=>(this.pushChange({value:t,type:Mu.NodeAdded}),PV(t))))),this.updateNodeLikeHierarchy(t))}addEdgeData(t=[]){t.length&&this.model.addEdges(t.map((t=>(this.pushChange({value:t,type:Mu.EdgeAdded}),PV(t)))))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(Ru)||e.attachTreeStructure(Ru),e.addNodes(t.map((t=>(this.comboIds.add(Gu(t)),this.pushChange({value:t,type:Mu.ComboAdded}),PV(t))))),this.updateNodeLikeHierarchy(t)}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),r=e.map(Gu);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...r]}]),this.addEdgeData(r.map((e=>({source:t,target:e}))))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach((t=>{const n=Gu(t);e.attachTreeStructure(Ru),this.setParent(n,Vu(t),Ru);const r=t.children;if(void 0!==r){e.attachTreeStructure(_u);const t=r.filter((t=>e.hasNode(t)));t.forEach((t=>this.setParent(t,n,_u))),t.length!==r.length&&this.updateNodeData([{id:n,children:t}])}}))}enableUpdateNodeLikeHierarchy=!0;preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)}))}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{const n=[];t.forEach((t=>{const r=Gu(t),i=OV(e.getNode(r));if(fe(i,t))return;const o=TV(i,t);this.pushChange({value:o,original:i,type:Mu.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.NodeUpdated})})),e.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.EdgeUpdated})})),n.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.ComboUpdated})}))}syncNodeDatum(t){const{model:e}=this,n=Gu(t),r=TV(OV(e.getNode(n)),t);e.mergeNodeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{t.forEach((t=>{const n=Gu(t),r=OV(e.getEdge(n));if(fe(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=TV(r,t);this.pushChange({value:i,original:r,type:Mu.EdgeUpdated}),e.mergeEdgeData(n,i)}))}))}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch((()=>{const n=[];t.forEach((t=>{const r=Gu(t),i=OV(e.getNode(r));if(fe(i,t))return;const o=TV(i,t);this.pushChange({value:o,original:i,type:Mu.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}setParent(t,e,n,r=!0){if(t===e)return;const i=Vu(this.getNodeLikeDatum(t));if(i!==e&&n===Ru){const n={id:t,combo:e};this.isCombo(t)?this.syncComboDatum(n):this.syncNodeDatum(n)}this.model.setParent(t,e,n),r&&n===Ru&&function(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}([i,e]).forEach((t=>{void 0!==t&&this.refreshComboData(t)}))}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,Ru);e&&this.pushChange({value:e,original:e,type:Mu.ComboUpdated}),n.forEach((t=>{this.pushChange({value:t,original:t,type:Mu.ComboUpdated})}))}syncComboDatum(t){const{model:e}=this,n=Gu(t);if(!e.hasNode(n))return;const r=TV(OV(e.getNode(n)),t);e.mergeNodeData(n,r)}getElementPosition(t){return Pl(this.getElementDataById(t))}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=ml(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])}))}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every((t=>0===t)))return;const o=this.getComboData([t])[0];o&&Kl(o,(t=>{const e=Gu(t),[o,a,s]=Pl(t),c=TV(t,{style:{x:o+n,y:a+r,z:s+i}});this.pushChange({value:c,original:t,type:this.isCombo(e)?Mu.ComboUpdated:Mu.NodeUpdated}),this.model.mergeNodeData(e,c)}),(t=>this.getChildrenData(Gu(t))),"BT")}translateComboTo(t,e){if(e.some(isNaN))return;const[n=0,r=0,i=0]=e,o=this.getComboData([t])?.[0];if(!o)return;const[a,s,c]=Pl(o),u=n-a,l=r-s,h=i-c;Kl(o,(t=>{const e=Gu(t),[n,r,i]=Pl(t),o=TV(t,{style:{x:n+u,y:r+l,z:i+h}});this.pushChange({value:o,original:t,type:this.isCombo(e)?Mu.ComboUpdated:Mu.NodeUpdated}),this.model.mergeNodeData(e,o)}),(t=>this.getChildrenData(Gu(t))),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)}))}removeNodeData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(Gu)),this.pushChange({value:this.getNodeData([t])[0],type:Mu.NodeRemoved}),this.removeNodeLikeHierarchy(t)})),this.model.removeNodes(t)}))}removeEdgeData(t=[]){t.length&&(t.forEach((t=>this.pushChange({value:this.getEdgeData([t])[0],type:Mu.EdgeRemoved}))),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.pushChange({value:this.getComboData([t])[0],type:Mu.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)})),this.model.removeNodes(t)}))}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(Ru)){const e=Vu(this.getNodeLikeDatum(t));this.setParent(t,void 0,Ru,!1),this.model.getChildren(t,Ru).forEach((t=>{const n=OV(t),r=Gu(n);this.setParent(Gu(n),e,Ru,!1);const i=TV(n,{id:Gu(n),combo:e});this.pushChange({value:i,original:n,type:this.isCombo(r)?Mu.ComboUpdated:Mu.NodeUpdated}),this.model.mergeNodeData(Gu(n),i)})),oe(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(`Unknown element type of id: ${t}`)}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map((t=>t.id))),t.removeNodes(e.map((t=>t.id))),this.context={}}}class _V{context;container;elementMap={};shapeTypeMap={};constructor(t){this.context=t}init(){if(!this.container){const{canvas:t}=this.context;this.container=t.appendChild(new Ys)}}emit(t,e){e.silence||wV(this.context.graph,t)}forEachElementData(t){ql.forEach((e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)}))}getElementType(t,e){const{options:n,graph:r}=this.context,i=n[t]?.type||e.type;return i?"string"==typeof i?i:i.call(r,e):"edge"===t?"line":"circle"}getTheme(t){return Lu(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map((t=>n[t]||{})))}paletteStyle={};computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData(((e,n)=>{const r=Object.assign({},yh(this.getTheme(e)?.palette),yh(t[e]?.palette));r?.field&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,a=t=>{const e="string"==typeof r?KV("palette",r):r;if("function"==typeof e){const n={};return t.forEach((([t,r])=>{n[t]=e(o?1-r:r)})),n}if(Array.isArray(e)){const n=o?[...e].reverse():e,r={};return t.forEach((([t,i])=>{r[t]=n[i%e.length]})),r}return{}},s=(t,e)=>"string"==typeof t?e.data?.[t]:t?.(e);if("group"===n){const e=$t(t,(t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"})),n=a(Object.keys(e).map(((t,e)=>[t,e]))),r={};return Object.entries(e).forEach((([t,e])=>{e.forEach((e=>{r[Gu(e)]=n[t]}))})),r}if("value"===n){const[e,n]=t.reduce((([t,e],n)=>{const r=s(i,n);if("number"!=typeof r)throw new Error(`Palette field ${i} is not a number`);return[Math.min(t,r),Math.max(e,r)]}),[1/0,-1/0]),r=n-e;return a(t.map((t=>[t.id,(s(i,t)-e)/r])))}}(n,r))}))}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?"edge"===t?{stroke:n}:{fill:n}:{}}defaultStyle={};computeElementDefaultStyle(t,e){const{options:n}=this.context,r=n[t]?.style||{};this.defaultStyle[Gu(e.datum)]=sh(r,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];(void 0===t||t.includes(Gu(i)))&&this.computeElementDefaultStyle(n,{datum:i,graph:e})}}))}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}stateStyle={};getElementStateStyle(t,e,n){const{options:r}=this.context;return sh(r[t]?.state?.[e]||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[Gu(n.datum)]=Object.assign({},...e.map((e=>this.getElementStateStyle(t,e,n))))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData(((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];if(void 0===t||t.includes(Gu(i))){const t=this.getElementState(Gu(i));this.computeElementStatesStyle(n,t,{datum:i,graph:e})}}}))}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getElementZIndex(t){const e=this.getElement(t);return e?e.style.zIndex??0:0}getNodes(){return this.context.model.getNodeData().map((({id:t})=>this.elementMap[t]))}getEdges(){return this.context.model.getEdgeData().map((t=>this.elementMap[Gu(t)]))}getCombos(){return this.context.model.getComboData().map((({id:t})=>this.elementMap[t]))}getElementComputedStyle(t,e){const n=Gu(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(t,n),o=e.style||{},a=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},r,i,o,a,s,c);if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!u.collapsed?[]:t.map(Gu).filter((t=>this.getElement(t)));Object.assign(u,{childrenNode:e,childrenData:t})}return u}draw(e={animation:!0}){this.init();const n=this.computeChangesAndDrawData(e);if(!n)return null;const{dataChanges:r,drawData:i}=n;this.markDestroyElement(i),this.computeStyle(e.stage);const{add:o,update:a,remove:s}=i;this.destroyElements(s,e),this.createElements(o,e),this.updateElements(a,e);const{animation:c,silence:u}=e;return this.context.animation.animate(c,u?{}:{before:()=>this.emit(new yV(t.GraphEvent.BEFORE_DRAW,{dataChanges:r,animation:c}),e),beforeAnimate:n=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.DRAW,n,i),e),afterAnimate:n=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.DRAW,n,i),e),after:()=>this.emit(new yV(t.GraphEvent.AFTER_DRAW,{dataChanges:r,animation:c}),e)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),r=QL(n);if(0===r.length)return null;const{NodeAdded:i=[],NodeUpdated:o=[],NodeRemoved:a=[],EdgeAdded:s=[],EdgeUpdated:c=[],EdgeRemoved:u=[],ComboAdded:l=[],ComboUpdated:h=[],ComboRemoved:d=[]}=$t(r,(t=>t.type)),f=t=>new Map(t.map((t=>{const e=t.value;return[Gu(e),e]}))),p={add:{nodes:f(i),edges:f(s),combos:f(l)},update:{nodes:f(o),edges:f(c),combos:f(h)},remove:{nodes:f(a),edges:f(u),combos:f(d)}},g=this.transformData(p,t);return e.clearChanges(),{dataChanges:n,drawData:g}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce(((t,n)=>n.beforeDraw(t,e)),t)}createElement(e,n,r){const i=Gu(n);if(this.getElement(i))return;const o=this.getElementType(e,n),a=this.getElementComputedStyle(e,n),s=KV(e,o);if(!s)return;this.emit(new bV(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n),r);const c=this.container.appendChild(new s({id:i,style:{context:this.context,...a}}));this.shapeTypeMap[i]=o,this.elementMap[i]=c;const{stage:u="enter"}=r;this.context.animation?.add({element:c,elementType:e,stage:u,originalStyle:{...c.attributes},modifiedStyle:{...c.attributes,...a}},{after:()=>{this.emit(new bV(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n),r),c.onCreate?.()}})}createElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.createElement(t,n,e)))}))}updateElement(e,n,r){const i=Gu(n),o=this.getElement(i);if(!o)return()=>null;this.emit(new bV(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n),r);const a=this.getElementType(e,n),s=this.getElementComputedStyle(e,n);this.shapeTypeMap[i]!==a&&(o.destroy(),delete this.shapeTypeMap[i],delete this.elementMap[i],this.createElement(e,n,{animation:!1,silence:!0}));const{stage:c="update"}=r,u="visibility"!==c?c:"hidden"===s.visibility?"hide":"show";this.context.animation?.add({element:o,elementType:e,stage:u,originalStyle:{...o.attributes},modifiedStyle:{...o.attributes,...s}},{before:()=>{"collapse"!==c&&Fd(o,s),"visibility"===c&&(fh(o,"opacity")||hh(o,"opacity"),ph(o,"visibility","show"===u?"visible":"hidden"),"show"===u&&Fd(o,{visibility:"visible"}))},after:()=>{"collapse"===c&&Fd(o,s),"hide"===u&&Fd(o,{visibility:dh(o,"visibility")}),this.emit(new bV(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n),r),o.onUpdate?.()}})}updateElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{n.forEach((n=>this.updateElement(t,n,e)))}))}markDestroyElement(t){Object.values(t.remove).forEach((t=>{t.forEach((t=>{const e=Gu(t),n=this.getElement(e);n&&function(t){ge(t,"__to_be_destroyed__",!0)}(n)}))}))}destroyElement(e,n,r){const{stage:i="exit"}=r,o=Gu(n),a=this.elementMap[o];if(!a)return()=>null;this.emit(new bV(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n),r),this.context.animation?.add({element:a,elementType:e,stage:i,originalStyle:{...a.attributes},modifiedStyle:{...a.attributes}},{after:()=>{this.clearElement(o),a.destroy(),a.onDestroy?.(),this.emit(new bV(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n),r)}})}destroyElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["combo",i],["edge",r],["node",n]].forEach((([t,n])=>{n.forEach((n=>this.destroyElement(t,n,e)))}))}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}async collapseNode(e,n){const{model:r,layout:i}=this.context,o=this.computeChangesAndDrawData({stage:"collapse",animation:n});this.markDestroyElement(o.drawData);const a=await i.simulate();r.updateData(a);const{drawData:s}=this.computeChangesAndDrawData({stage:"collapse",animation:n}),{add:c,remove:u,update:l}=s;this.markDestroyElement(s);const h={animation:n,stage:"collapse",data:s};this.destroyElements(u,h),this.createElements(c,h),this.updateElements(l,h),await(this.context.animation.animate(n,{beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.COLLAPSE,e,s),h),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.COLLAPSE,e,s),h)},{collapse:{target:e,descendants:Array.from(u.nodes).map((([,t])=>Gu(t))),position:Pl(l.nodes.get(e))}})?.finished)}async expandNode(e,n){const{model:r,layout:i}=this.context;if(!r.getAncestorsData(e,Ru).every((t=>th(t))))return;const o=Pl(r.getNodeData([e])[0]),{drawData:{add:a}}=this.computeChangesAndDrawData({stage:"collapse",animation:n});this.createElements(a,{animation:!1,stage:"expand"}),this.context.animation.clear();const s=await i.simulate();r.updateData(s),this.computeStyle("expand");const{drawData:c}=this.computeChangesAndDrawData({stage:"collapse",animation:n}),{update:u}=c,l={animation:n,stage:"expand",data:c};a.edges.forEach((t=>{const e=Gu(t);u.edges.has(e)||u.edges.set(e,t)})),this.updateElements(u,l),await(this.context.animation.animate(n,{beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.EXPAND,e,c),l),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.EXPAND,e,c),l)},{expand:{target:e,descendants:Array.from(a.nodes).map((([,t])=>Gu(t))),position:o}})?.finished)}async collapseCombo(e,n){const{model:r,element:i}=this.context;if(r.getAncestorsData(e,Ru).some((t=>th(t))))return;const o=i.getElement(e),a=o.getComboPosition({...o.attributes,collapsed:!0}),{dataChanges:s,drawData:c}=this.computeChangesAndDrawData({stage:"collapse",animation:n});this.markDestroyElement(c);const{update:u,remove:l}=c,h={animation:n,stage:"collapse",data:c};this.destroyElements(l,h),this.updateElements(u,h);const d=t=>Array.from(t).map((([,t])=>Gu(t)));await(this.context.animation.animate(n,{before:()=>this.emit(new yV(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:n}),h),beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.COLLAPSE,e,c),h),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.COLLAPSE,e,c),h),after:()=>this.emit(new yV(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:n}),h)},{collapse:{target:e,descendants:[...d(l.nodes),...d(l.combos)],position:a}})?.finished)}async expandCombo(e,n){const{model:r}=this.context,i=Pl(r.getComboData([e])[0]);this.computeStyle("expand");const{dataChanges:o,drawData:a}=this.computeChangesAndDrawData({stage:"expand",animation:n}),{add:s,update:c}=a,u={animation:n,stage:"expand",data:a};this.createElements(s,u),this.updateElements(c,u);const l=t=>Array.from(t).map((([,t])=>Gu(t)));await(this.context.animation.animate(n,{before:()=>this.emit(new yV(t.GraphEvent.BEFORE_DRAW,{dataChanges:o,animation:n}),u),beforeAnimate:e=>this.emit(new vV(t.GraphEvent.BEFORE_ANIMATE,Su.EXPAND,e,a),u),afterAnimate:e=>this.emit(new vV(t.GraphEvent.AFTER_ANIMATE,Su.EXPAND,e,a),u),after:()=>this.emit(new yV(t.GraphEvent.AFTER_DRAW,{dataChanges:o,animation:n}),u)},{expand:{target:e,descendants:[...l(s.nodes),...l(s.combos)],position:i}})?.finished)}getFrontZIndex(t){const{model:e}=this.context,n=e.getElementType(t),r=e.getElementDataById(t),i=e.getData();if(Object.assign(i,{[`${n}s`]:i[`${n}s`].filter((e=>Gu(e)!==t))}),"combo"===n&&!th(r)){const n=e.getAncestorsData(t,Ru).map(Gu);i.nodes=i.nodes.filter((t=>!n.includes(Gu(t)))),i.combos=i.combos.filter((t=>!n.includes(Gu(t)))),i.edges=i.edges.filter((({source:t,target:e})=>n.includes(t)&&n.includes(e)))}return Math.max(0,...Object.values(i).flat().map((t=>{const e=Gu(t);return this.getElementZIndex(e)})))+1}destroy(){this.container.destroy(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={},this.context={}}}class DV{context;supervisor;instance;instances=[];animationResult;get presetOptions(){return{animation:!!Fu(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.context=t}getLayoutInstance(){return this.instances}async layout(){if(!this.options)return;const e=Array.isArray(this.options)?this.options:[this.options],{graph:n}=this.context;wV(n,new yV(t.GraphEvent.BEFORE_LAYOUT));for(const r of e){const i=e.indexOf(r),o=this.getLayoutData(r),a={...this.presetOptions,...r};wV(n,new yV(t.GraphEvent.BEFORE_STAGE_LAYOUT,{options:a,index:i}));const s=await this.stepLayout(o,a,i);wV(n,new yV(t.GraphEvent.AFTER_STAGE_LAYOUT,{options:a,index:i})),r.animation||this.updateElementPosition(s,!1)}wV(n,new yV(t.GraphEvent.AFTER_LAYOUT))}async simulate(){if(!this.options)return{};const t=Array.isArray(this.options)?this.options:[this.options];let e={};for(const n of t){const r=t.indexOf(n),i=this.getLayoutData(n);e=await this.stepLayout(i,{...this.presetOptions,...n,animation:!1},r)}return e}async stepLayout(t,e,n){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?await this.treeLayout(t,e,n):await this.graphLayout(t,e,n)}async graphLayout(t,e,n){const{animation:r,enableWorker:i,iterations:o=300}=e,a=this.initGraphLayout(e);if(this.instances[n]=a,this.instance=a,i){const e=a;return this.supervisor=new JD(e.graphData2LayoutModel(t),e.instance,{iterations:o}),Jd(await this.supervisor.execute())}if(RD(a))return r?await a.execute(t,{onTick:t=>{this.updateElementPosition(t,!1)}}):(a.execute(t),a.stop(),a.tick(o));const s=await a.execute(t);return r&&this.updateElementPosition(s,r),s}async treeLayout(t,e,n){const{type:r,animation:i}=e,o=KV("layout",r);if(!o)throw new Error(`The layout type ${r} is not found`);const{nodes:a=[],edges:s=[]}=t,c=new Zd({nodes:a.map((t=>({id:Gu(t),data:t.data||{}}))),edges:s.map((t=>({id:Gu(t),source:t.source,target:t.target,data:t.data||{}})))});!function(t){if(t.hasTreeStructure(_u))return;t.attachTreeStructure(_u);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,_u)}}(c);const u={nodes:[],edges:[]};return c.getRoots(_u).forEach((t=>{Kl(t,(t=>{t.children=c.getSuccessors(t.id)}),(t=>c.getSuccessors(t.id)),"TB");Kl(o(t,e),(t=>{const{id:e,x:n,y:r,z:i=0}=t;u.nodes.push({id:e,style:{x:n,y:r,z:i}})}),(t=>t.children),"TB")})),i&&this.updateElementPosition(u,i),u}stopLayout(){this.instance&&RD(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=(()=>!0)}=t,{nodes:n,edges:r,combos:i}=this.context.model.getData(),o=t=>this.context.element.getElement(t),a=n.filter((t=>{const n=Gu(t),r=o(n);return!!r&&(!zd(r)&&e(t))})),s=new Map(a.map((t=>[Gu(t),t])));return{nodes:a,edges:r.filter((t=>{const{source:e,target:n}=t;return!(!s.has(e)||!s.has(n))})),combos:i}}initGraphLayout(t){const{element:e,viewport:n}=this.context,{type:r,enableWorker:i,animation:o,iterations:a,...s}=t,[c,u]=n.getCanvasSize(),l=[c/2,u/2],h=t?.nodeSize??(t=>{const n=e?.getElement(t.id),{size:r}=n?.attributes||{};return Math.max(...ah(r))}),d=KV("layout",r);if(!d)throw new Error(`The layout type ${r} is not found`);const f=Object.getPrototypeOf(d.prototype)===Qd.prototype?d:function(t,e){return class extends Qd{instance;id;constructor(e,n){if(super(e,n),this.instance=new t({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const t=this.instance;this.stop=t.stop.bind(t),this.tick=e=>Jd(t.tick(e))}}async execute(t,e){return Jd(await this.instance.execute(this.graphData2LayoutModel(t),this.transformOptions(le({},this.options,e))))}transformOptions(t){const{onTick:e}=t;return e?(t.onTick=t=>e(Jd(t)),t):t}graphData2LayoutModel(t){const{nodes:n=[],edges:r=[],combos:i=[]}=t,o=n.map((t=>{const e=Gu(t),{data:n,style:r,combo:i}=t;return{id:e,data:{...n,...i?{parentId:i}:{}},style:{...r}}})),a=new Map(o.map((t=>[t.id,t]))),s=r.filter((t=>{const{source:e,target:n}=t;return a.has(e)&&a.has(n)})).map((t=>{const{source:e,target:n,data:r,style:i}=t;return{id:Gu(t),source:e,target:n,data:{...r},style:{...i}}})),c=i.map((t=>({id:Gu(t),data:{_isCombo:!0,...t.data},style:{...t.style}}))),u=new Zd({nodes:[...o,...c],edges:s});return e.model.model.hasTreeStructure(Ru)&&(u.attachTreeStructure(Ru),o.forEach((t=>{const n=e.model.model.getParent(t.id,Ru);n&&u.hasNode(n.id)&&u.setParent(t.id,n.id,Ru)}))),u}}}(d,this.context),p=new f(this.context),g={nodeSize:h,width:c,height:u,center:l};switch(p.id){case"d3-force":case"d3-force-3d":Object.assign(g,{center:{x:c/2,y:u/2,z:0}})}return le(p.options,g,s),p}updateElementPosition(t,e){const{model:n,element:r}=this.context;return r?(n.updateData(t),r.draw({animation:e,silence:!0})):null}destroy(){this.stopLayout(),this.context={},this.supervisor?.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}class LV extends tl{category="plugin";constructor(t){super(t),this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){return this.extensionMap[t]}}const IV=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class jV extends tl{category="transform";constructor(t){super(t),this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...IV.slice(0,IV.length-1),...t,IV[IV.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}class BV{context;get padding(){return ol(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,a]=[(r-e)/2,(t-n)/2,0];return[i,o,a]}constructor(t){this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:a=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,a],rotate:i},!1)}get camera(){return this.context.canvas.getCamera()}landmarkCounter=0;createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=Fu(this.context.options,t);return!!e&&ye({...e},["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),a=e.getFocalPoint(),[s,c]=this.getCanvasCenter(),[u=0,l=0,h=0]=r,d=bl([-u,-l,-h],i);return"relative"===n?{position:ml(o,d),focalPoint:ml(a,d)}:{position:ml([s,c,o[2]],d),focalPoint:ml([s,c,a[2]],d)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return Ut("relative"===r?n*i:i,...e)}async transform(e,n){const{graph:r}=this.context,{translate:i,rotate:o,scale:a}=e;this.cancelAnimation(),wV(r,new xV(t.GraphEvent.BEFORE_TRANSFORM,e));const s=this.getAnimation(n),c={};if(i&&Object.assign(c,this.getTranslateOptions(e)),Yt(o)&&Object.assign(c,this.getRotateOptions(e)),Yt(a)&&Object.assign(c,{zoom:this.getZoomOptions(e)}),s)return wV(r,new vV(t.GraphEvent.BEFORE_ANIMATE,Su.TRANSFORM,null,e)),new Promise((n=>{this.camera.gotoLandmark(this.createLandmark(c),{...s,onfinish:()=>{wV(r,new vV(t.GraphEvent.AFTER_ANIMATE,Su.TRANSFORM,null,e)),wV(r,new xV(t.GraphEvent.AFTER_TRANSFORM,e)),n()}})}));this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),wV(r,new xV(t.GraphEvent.AFTER_TRANSFORM,e))}async fitView(t,e){const[n,r,i,o]=this.padding,{when:a="always",direction:s="both"}=t||{},[c,u]=this.context.canvas.getSize(),l=c-o-r,h=u-n-i,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[p,g]=cl(f);if("overflow"===a&&!("x"===s&&p>=l||"y"===s&&g>=h||"both"===s&&p>=l&&g>=h))return await this.fitCenter(e);const m=l/p,y=h/g,v="x"===s?m:"y"===s?y:Math.min(m,y),b=this.getAnimation(e);await this.transform({mode:"relative",scale:v,translate:ml(yl(this.getCanvasCenter(),this.getBBoxInViewport(d).center),bl(this.paddingOffset,v))},b)}async fitCenter(t){const e=this.context.canvas.getBounds();await this.focus(e,t)}async focusElements(t,e){const{element:n}=this.context;if(!n)return;const r=hl(t.map((t=>n.getElement(t).getRenderBounds())));await this.focus(r,e)}async focus(t,e){const{center:n}=this.getBBoxInViewport(t),r=yl(this.getCanvasCenter(),n);await this.transform({mode:"relative",translate:ml(r,this.paddingOffset)},e)}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[a,s]=r.getViewportByCanvas(n),c=new Ar;return c.setMinMax([i,o,0],[a,s,0]),c}cancelAnimation(){this.camera.landmarks?.length&&this.camera.cancelLandmarkAnimation()}}class FV extends Ud{options;static defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};destroyed=!1;context={model:new RV};constructor(t){super(),this.options=Object.assign({},FV.defaultOptions,t),this.setOptions(this.options),this.context.graph=this,this.options.autoResize&&window.addEventListener("resize",this.onResize)}getOptions(){return this.options}setOptions(t){const{background:e,behaviors:n,combo:r,data:i,edge:o,height:a,layout:s,node:c,plugins:u,theme:l,transforms:h,width:d}=t;Object.assign(this.options,t),e&&this.setBackground(e),n&&this.setBehaviors(n),r&&this.setCombo(r),i&&this.setData(i),o&&this.setEdge(o),s&&this.setLayout(s),c&&this.setNode(c),l&&this.setTheme(l),u&&this.setPlugins(u),h&&this.setTransforms(h),(Yt(d)||Yt(a))&&this.setSize(d??this.options.width??0,a??this.options.height??0)}setBackground(t){this.options.background=t,this.context.canvas?.setBackground(t)}getBackground(){return this.options.background}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){Object.assign(this.options,{width:t,height:e}),this.context.canvas?.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Rt(t)?t(this.getTheme()):t;const{background:e}=KV("theme",this.options.theme)||{};e&&!this.options.background&&this.setBackground(e)}setLayout(t){this.options.layout=Rt(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){this.options.behaviors=Rt(t)?t(this.getBehaviors()):t,this.context.behavior?.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors((e=>e.map((e=>"object"==typeof e&&e.key===t.key?{...e,...t}:e))))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){this.options.plugins=Rt(t)?t(this.getPlugins()):t,this.context.plugin?.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins((e=>e.map((e=>"object"==typeof e&&e.key===t.key?{...e,...t}:e))))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){this.options.transforms=Rt(t)?t(this.getTransforms()):t,this.context.transform?.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms((e=>e.map((e=>"object"==typeof e&&e.key===t.key?{...e,...t}:e)))),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map((t=>this.context.model.getElementDataById(t))):this.context.model.getElementDataById(t)}getNodeData(t){return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):this.context.model.getNodeData([t])?.[0]}getEdgeData(t){return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):this.context.model.getEdgeData([t])?.[0]}getComboData(t){return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):this.context.model.getComboData([t])?.[0]}setData(t){this.context.model.setData(Rt(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Rt(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Rt(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Rt(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Rt(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Rt(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Rt(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Rt(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Rt(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Rt(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Rt(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Rt(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Rt(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}async initCanvas(){if(this.context.canvas)return await this.context.canvas.init();const{container:e="container",width:n,height:r,renderer:i,background:o}=this.options;if(e instanceof CV)this.context.canvas=e,e.setBackground(o),await e.init();else{const a=Wt(e)?document.getElementById(e):e,s=eL(a);this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:a,width:n,height:r});const c=new CV({container:a,width:n||s[0],height:r||s[1],background:o,renderer:i});this.context.canvas=c,await c.init(),this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:c})}}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new MV(this.context)),this.context.plugin||(this.context.plugin=new LV(this.context)),this.context.viewport||(this.context.viewport=new BV(this.context)),this.context.transform||(this.context.transform=new jV(this.context)),this.context.element||(this.context.element=new _V(this.context)),this.context.animation||(this.context.animation=new EV(this.context)),this.context.layout||(this.context.layout=new DV(this.context)),this.context.behavior||(this.context.behavior=new SV(this.context))}async prepare(){if(await Promise.resolve(),this.destroyed)throw new Error("Graph has been destroyed");await this.initCanvas(),this.initRuntime()}async render(){await this.prepare(),wV(this,new yV(t.GraphEvent.BEFORE_RENDER));const e=this.context.element.draw();await Promise.all([e?.finished,this.context.layout.layout()]),await this.autoFit(),wV(this,new yV(t.GraphEvent.AFTER_RENDER))}async draw(){await this.prepare(),await(this.context.element.draw()?.finished),await this.autoFit()}async layout(){await this.context.layout.layout()}stopLayout(){this.context.layout.stopLayout()}async clear(){this.context.model.setData({}),await this.draw()}destroy(){wV(this,new yV(t.GraphEvent.BEFORE_DESTROY));const{layout:e,animation:n,element:r,model:i,canvas:o,behavior:a,plugin:s}=this.context;s?.destroy(),a?.destroy(),e?.destroy(),n?.destroy(),r?.destroy(),i.destroy(),o?.destroy(),this.options={},this.context={},this.off(),window.removeEventListener("resize",this.onResize),this.destroyed=!0,wV(this,new yV(t.GraphEvent.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,n){const r=e&&n?[e,n]:eL(this.context.canvas.getContainer());fe(r,this.getSize())||(wV(this,new yV(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:r})),this.context.canvas.resize(...r),wV(this,new yV(t.GraphEvent.AFTER_SIZE_CHANGE,{size:r})))}async fitView(t,e){await(this.context.viewport?.fitView(t,e))}async fitCenter(t){await(this.context.viewport?.fitCenter(t))}async autoFit(){const{autoFit:t}=this.context.options;if(t)if(Wt(t))"view"===t?await this.fitView():"center"===t&&await this.fitCenter();else{const{type:e,animation:n}=t;"view"===e?await this.fitView(t.options,n):"center"===e&&await this.fitCenter(n)}}async focusElement(t,e){await(this.context.viewport?.focusElements(Array.isArray(t)?t:[t],e))}async zoomBy(t,e,n){await this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)}async zoomTo(t,e,n){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)}getZoom(){return this.context.viewport.getZoom()}async rotateBy(t,e,n){await this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)}async rotateTo(t,e,n){await this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)}getRotation(){return this.context.viewport.getRotation()}async translateBy(t,e){await this.context.viewport.transform({mode:"relative",translate:t},e)}async translateTo(t,e){await this.context.viewport.transform({mode:"absolute",translate:t},e)}getPosition(){return yl([0,0],this.getCanvasByViewport([0,0]))}async translateElementBy(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeLikeBy(t,e))),await(this.context.element.draw({animation:i,stage:"translate"})?.finished)}async translateElementTo(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeLikeTo(t,e))),await(this.context.element.draw({animation:i,stage:"translate"})?.finished)}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return ve(this.context.element.getElement(t).attributes,["context"])}async setElementVisibility(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);o[`${n}s`].push({id:t,style:{visibility:e}})}));const{model:a,element:s}=this.context;a.preventUpdateNodeLikeHierarchy((()=>{a.updateData(o)})),await(s.draw({animation:i,stage:"visibility"})?.finished)}async showElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"visible"]))),e)}async hideElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"hidden"]))),e)}getElementVisibility(t){const e=this.context.element.getElement(t);return e?.style?.visibility??"visible"}async setElementZIndex(t,e){const n={nodes:[],edges:[],combos:[]},r=jt(t)?t:{[t]:e};Object.entries(r).forEach((([t,e])=>{const r=this.getElementType(t);n[`${r}s`].push({id:t,style:{zIndex:e}})}));const{model:i,element:o}=this.context;i.preventUpdateNodeLikeHierarchy((()=>i.updateData(n))),await(o.draw({animation:!1,stage:"zIndex"})?.finished)}async frontElement(t){const e=Array.isArray(t)?t:[t],{model:n,element:r}=this.context,i={};e.map((t=>{const e=r.getFrontZIndex(t);if("combo"===n.getElementType(t)){const o=n.getAncestorsData(t,Ru).at(-1)||this.getComboData(t),a=[o,...n.getDescendantsData(Gu(o))],s=e-r.getElementZIndex(t);a.forEach((t=>{i[Gu(t)]=this.getElementZIndex(Gu(t))+s}))}else i[t]=e})),await this.setElementZIndex(i)}getElementZIndex(t){const{model:e,element:n}=this.context;return e.getElementDataById(t)?.style?.zIndex??n.getElementZIndex(t)}async setElementState(t,e,n=!0){const[r,i]=jt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);var r;o[`${n}s`].push({id:t,states:(r=e,r?Array.isArray(r)?r:[r]:[])})})),this.updateData(o),await(this.context.element.draw({animation:i})?.finished)}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}isCollapsingExpanding=!1;async collapseElement(t,e=!0){const{model:n,element:r}=this.context;if(th(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;const i=n.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!0),"node"===i?await r.collapseNode(t,e):"combo"===i&&await r.collapseCombo(t,e),this.isCollapsingExpanding=!1}async expandElement(t,e=!0){const{model:n,element:r}=this.context;if(!th(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;const i=n.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!1),"node"===i?await r.expandNode(t,e):"combo"===i&&await r.expandCombo(t,e),this.isCollapsingExpanding=!1}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}async toDataURL(t={}){return this.context.canvas.toDataURL(t)}getCanvasByViewport(t){return Rl(this.context.canvas.viewport2Canvas(_l(t)))}getViewportByCanvas(t){return Rl(this.context.canvas.canvas2Viewport(_l(t)))}getClientByCanvas(t){const e=this.context.canvas.canvas2Viewport(_l(t));return Rl(this.context.canvas.viewport2Canvas(e))}getCanvasByClient(t){const e=this.context.canvas.client2Viewport(_l(t));return Rl(this.context.canvas.viewport2Canvas(e))}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}onResize=se((()=>{this.resize()}),300);on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}const zV=(t,e)=>{const{source:n,target:r}=e,i=t.getElementDataById(n),o=t.getElementDataById(r),a=gd(i,(e=>t.getParentData(e,Ru))),s=gd(o,(e=>t.getParentData(e,Ru))),c={sourceNode:Gu(a),targetNode:Gu(s)};return e.style?Object.assign(e.style,c):e.style=c,e},GV=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class VV extends fV{static defaultOptions={mode:"bundle",edges:void 0,distance:15};cacheMergeStyle=new Map;constructor(t,e){super(t,Object.assign({},VV.defaultOptions,e))}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return 0===e.size||("bundle"===this.options.mode?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}getAffectedParallelEdges=t=>{const{add:{edges:e},update:{nodes:n,edges:r,combos:i},remove:{edges:o}}=t,{model:a}=this.context,s=new Map,c=(t,e)=>{a.getRelatedEdgesData(e).forEach((t=>!s.has(Gu(t))&&s.set(Gu(t),t)))};n.forEach(c),i.forEach(c);const u=t=>{const e=a.getEdgeData().map((t=>zV(a,t)));HV(t,e).forEach((t=>!s.has(Gu(t))&&s.set(Gu(t),t)))};if(o.size&&o.forEach(u),e.size&&e.forEach(u),r.size){const t=JL(QL(a.getChanges())).update.edges;r.forEach((e=>{u(e);const n=t.find((t=>Gu(t.value)===Gu(e)))?.original;n&&!$V(e,n)&&u(n)}))}de(this.options.edges)||s.forEach(((t,e)=>!this.options.edges.includes(e)&&s.delete(e)));const l=a.getEdgeData().map(Gu);return new Map([...s].sort(((t,e)=>l.indexOf(t[0])-l.indexOf(e[0]))))};applyBundlingStyle=(t,e,n)=>{const{edgeMap:r,reverses:i}=WV(e);r.forEach((e=>{e.forEach(((e,r,o)=>{const a=Object.assign(e,{type:"quadratic",style:(()=>{const t=o.length,a={};if(e.source===e.target){const t=GV.length;a.loopPlacement=GV[r%t],a.loopDist=Math.floor(r/t)*n+50}else if(1===t)a.curveOffset=0;else{const o=(r%2==0?1:-1)*(i[`${e.source}|${e.target}|${r}`]?-1:1);a.curveOffset=t%2==1?o*Math.ceil(r/2)*n*2:o*(Math.floor(r/2)*n*2+n)}return Object.assign({},e.style,a)})()}),s=this.context.element?.getElement(Gu(e));$u(t,s?"update":"add","edge",a,!0)}))}))};resetEdgeStyle=t=>{const e=t.style||{},n=this.cacheMergeStyle.get(Gu(t))||{};return Object.keys(n).forEach((r=>{fe(e[r],n[r])&&(t[r]?e[r]=t[r]:delete e[r])})),Object.assign(t,{style:e})};applyMergingStyle=(t,e)=>{const{edgeMap:n,reverses:r}=WV(e);n.forEach((e=>{if(1===e.length){const n=e[0],r=this.context.element?.getElement(Gu(n));return void $u(t,r?"update":"add","edge",this.resetEdgeStyle(n),!0)}const n=e.map((({source:t,target:e,style:n={}},i)=>{const{startArrow:o,endArrow:a}=n,s={},[c,u]=r[`${t}|${e}|${i}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return re(o)&&(s[c]=o),re(a)&&(s[u]=a),s})).reduce(((t,e)=>({...t,...e})),{});e.forEach(((e,r,i)=>{if(0===r){const r=Object.assign({},Rt(this.options.style)?this.options.style(i):this.options.style,{childrenData:i});this.cacheMergeStyle.set(Gu(e),r);const o={...e,type:"line",style:{...n,...r}},a=this.context.element?.getElement(Gu(e));$u(t,a?"update":"add","edge",o,!0)}else $u(t,"remove","edge",e)}))}))}}const WV=t=>{const e=new Map,n=new Set,r={};for(const[i,o]of t){if(n.has(i))continue;const{source:a,target:s}=o,c=`${a}-${s}`;e.has(c)||e.set(c,[]),e.get(c).push(o),n.add(i);for(const[i,u]of t)n.has(i)||$V(o,u)&&(e.get(c).push(u),n.add(i),a===u.target&&s===u.source&&(r[`${u.source}|${u.target}|${e.get(c).length-1}`]=!0))}return{edgeMap:e,reverses:r}},HV=(t,e,n)=>e.filter((e=>$V(e,t))),$V=(t,e)=>{const{sourceNode:n,targetNode:r}=t.style||{},{sourceNode:i,targetNode:o}=e.style||{};return n===i&&r===o||n===o&&r===i};const UV={animation:{"combo-collapse":Zu,"combo-expand":Qu,"node-collapse":Yu,"node-expand":qu,"path-in":Ku,"path-out":Xu,fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}]},behavior:{"zoom-canvas":cf,"drag-canvas":Hd,"drag-element":$d,"drag-element-force":nf,"scroll-canvas":sf,"collapse-expand":Gd,"click-select":Ql,"hover-activate":of,"focus-element":rf,"create-edge":Wd,"brush-select":$l,"lasso-select":af},combo:{circle:Yh,rect:qh},edge:{cubic:bd,line:Ed,polyline:Md,quadratic:Sd,"cubic-horizontal":xd,"cubic-vertical":wd},layout:{"antv-dagre":xm,"combo-combined":nv,"compact-box":mp.compactBox,"force-atlas2":uD,circular:Sm,concentric:Tm,"d3-force":Uv,dagre:iD,dendrogram:mp.dendrogram,force:Xm,fruchterman:hD,grid:fD,indented:mp.indented,mds:Zy,mindmap:mp.mindmap,radial:SD,random:OD},node:{circle:_h,diamond:Lh,ellipse:Fh,hexagon:zh,html:Gh,image:Vh,rect:Wh,star:Hh,donut:Ih,triangle:$h},palette:{spectral:["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],tableau:["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],oranges:["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],greens:["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],blues:["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"]},theme:{dark:hV,light:dV},plugin:{"bubble-sets":UL,"grid-line":ZL,background:oL,contextmenu:KL,fullscreen:XL,history:nI,hull:CI,legend:Qz,timebar:QG,toolbar:nV,tooltip:rV,watermark:aV},transform:{"update-related-edges":class extends fV{beforeDraw(t,e){const{stage:n}=e;if("visibility"===n)return t;const{model:r}=this.context,{update:{nodes:i,edges:o,combos:a}}=t,s=(t,e)=>{r.getRelatedEdgesData(e).forEach((t=>!o.has(Gu(t))&&o.set(Gu(t),t)))};return i.forEach(s),a.forEach(s),t}},"arrange-draw-order":class extends fV{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,r=t=>{const n=[];return t.forEach(((t,r)=>{const i=e.getAncestorsData(r,"combo").map((t=>Gu(t))).reverse();n.push([r,t,i.length])})),new Map(n.sort((([,,t],[,,e])=>e-t)).map((([t,e])=>[t,e])))};return t.add.combos=r(n),t.update.combos=r(t.update.combos),t}},"collapse-expand-combo":class extends fV{beforeDraw(t,e){if("visibility"===e.stage)return t;const{model:n}=this.context,{add:r,update:i}=t,o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[e,a]=o.pop();if(th(a)){const a=n.getDescendantsData(e),s=a.map(Gu),{internal:c,external:u}=pd(s,(t=>n.getRelatedEdgesData(t)));a.forEach((e=>{const r=Gu(e),i=o.findIndex((([t])=>t===r));-1!==i&&o.splice(i,1);const a=n.getElementType(r);pV(t,"remove",a,e)})),c.forEach((e=>pV(t,"remove","edge",e))),u.forEach((t=>{const e=Gu(t),n=this.context.element?.getElement(e);n?i.edges.set(e,t):r.edges.set(e,t)}))}else{const r=n.getChildrenData(e),i=r.map(Gu),{edges:a}=pd(i,(t=>n.getRelatedEdgesData(t)));[...r,...a].forEach((e=>{const r=Gu(e),i=n.getElementType(r),a=this.context.element?.getElement(r);pV(t,a?"update":"add",i,e),"combo"===i&&o.push([r,e])}))}}return t}},"collapse-expand-node":class extends fV{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(gV(e,"add","node",t),th(t))return;const n=Gu(t);gV(e,"add","node",t);this.context.model.getRelatedEdgesData(n,"out").forEach((t=>{pV(e,"add","edge",t)}));this.context.model.getChildrenData(n).forEach((t=>{this.handleExpand(t,e)}))}beforeDraw(t){const{graph:e,model:n}=this.context,{add:{nodes:r,edges:i},update:{nodes:o}}=t,a=new Map,s=new Map;r.forEach(((t,e)=>{th(t)&&a.set(e,t)})),i.forEach((t=>{if("node"!==e.getElementType(t.source))return;const n=e.getNodeData(t.source);th(n)&&a.set(t.source,n)})),o.forEach(((t,e)=>{const n=this.getElement(e);if(!n)return;const r=n.attributes.collapsed;th(t)?r||a.set(e,t):r&&s.set(e,t)}));const c=new Set;return a.forEach(((e,r)=>{n.getDescendantsData(r).forEach((e=>{const r=Gu(e);if(c.has(r))return;pV(t,"remove","node",e);n.getRelatedEdgesData(r).forEach((e=>{pV(t,"remove","edge",e)})),c.add(r)}))})),s.forEach(((e,r)=>{n.getAncestorsData(r,_u).some(th)?pV(t,"remove","node",e):this.handleExpand(e,t)})),t}},"process-parallel-edges":VV,"get-edge-actual-ends":class extends fV{beforeDraw(t){const{add:e,update:n}=t,{model:r}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach((([,t])=>{zV(r,t)})),t}}}},YV={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{}};function qV(t,e,n){const r=YV[t][e];r?r!==n&&console.error(`The extension ${e} of ${t} has been registered before.`):Object.assign(YV[t],{[e]:n})}function KV(t,e){const n=YV[t]?.[e];if(n)return n}Cs.enableCSSParsing=!1,Object.entries(UV).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{qV(t,e,n)}))}));t.AntVDagreLayout=xm,t.Badge=Nh,t.BaseBehavior=nl,t.BaseCombo=Uh,t.BaseEdge=vd,t.BaseLayout=Qd,t.BaseNode=Rh,t.BasePlugin=iL,t.BaseShape=Mh,t.BaseTransform=fV,t.BrushSelect=$l,t.BubbleSets=UL,t.CameraSetting=class extends iL{constructor(t,e){super(t,e),this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,(()=>this.setOptions(this.options)))}setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach((([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}}))};getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Circle=_h,t.CircleCombo=Yh,t.CircularLayout=Sm,t.ClickSelect=Ql,t.CollapseExpand=Gd,t.ComboCombinedLayout=nv,t.ConcentricLayout=Tm,t.Contextmenu=KL,t.CreateEdge=Wd,t.Cubic=bd,t.CubicHorizontal=xd,t.CubicVertical=wd,t.D3ForceLayout=Uv,t.DagreLayout=iD,t.Diamond=Lh,t.Donut=Ih,t.DragCanvas=Hd,t.DragElement=$d,t.DragElementForce=nf,t.Ellipse=Fh,t.FocusElement=rf,t.ForceAtlas2Layout=uD,t.ForceLayout=Xm,t.FruchtermanLayout=hD,t.Fullscreen=XL,t.Graph=FV,t.GridLayout=fD,t.GridLine=ZL,t.HTML=Gh,t.Hexagon=zh,t.History=nI,t.HoverActivate=of,t.Hull=CI,t.Icon=Ph,t.Image=Vh,t.Label=Sh,t.LassoSelect=af,t.Legend=Qz,t.Line=Ed,t.MDSLayout=Zy,t.Polyline=Md,t.Quadratic=Sd,t.RadialLayout=SD,t.RandomLayout=OD,t.Rect=Wh,t.RectCombo=qh,t.ScrollCanvas=sf,t.Shortcut=Hl,t.Star=Hh,t.Timebar=QG,t.Toolbar=nV,t.Tooltip=rV,t.Triangle=$h,t.Watermark=aV,t.ZoomCanvas=cf,t.compactBox=mp.compactBox,t.dendrogram=mp.dendrogram,t.getExtension=KV,t.getExtensions=function(t){return YV[t]},t.iconfont={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"},t.idOf=Gu,t.indented=mp.indented,t.invokeLayoutMethod=tf,t.isCollapsed=th,t.mindmap=mp.mindmap,t.omitStyleProps=oh,t.parseSize=ah,t.register=qV,t.subStyleProps=rh,t.treeToGraphData=function(t,e){const{getNodeData:n=(t=>{if(!t.children)return t;const{children:e,...n}=t;return{...n,children:e.map((t=>t.id))}}),getEdgeData:r=((t,e)=>({source:t.id,target:e.id})),getChildren:i=(t=>t.children||[])}=e||{},o=[],a=[];return Kl(t,(t=>{o.push(n(t));const e=i(t);for(const n of e)a.push(r(t,n))}),(t=>i(t)),"TB"),{nodes:o,edges:a}},t.version="5.0.6"}));
|