| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- var J$=Object.defineProperty;var A3=r=>{throw TypeError(r)};var Q$=(r,t,e)=>t in r?J$(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var oe=(r,t,e)=>Q$(r,typeof t!="symbol"?t+"":t,e),ev=(r,t,e)=>t.has(r)||A3("Cannot "+e);var Ci=(r,t,e)=>(ev(r,t,"read from private field"),e?e.call(r):t.get(r)),nv=(r,t,e)=>t.has(r)?A3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),jh=(r,t,e,n)=>(ev(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),rv=(r,t,e)=>(ev(r,t,"access private method"),e);import tj from"./LayoutExperience-Cv7avAI4.js";import ej from"./ContentContainer-dsu8BuWR.js";/* empty css */import{m as nj,c as Sx,V as rj,a as ij,D as aj}from"./ViewerDocxFromUrl-Bsy4QN0O.js";import{S as fR}from"./index-BbwHpBDC.js";import{C as sj}from"./index-BhPfRfn4.js";import{S as t0}from"./index-V-i8u8-0.js";import{T as oj}from"./index-B5xD8FOR.js";import{D as gR}from"./index-Ch_7zASM.js";import{u as aw,b as lj}from"./index-BKegOqL-.js";import{d as Gs,c as Xe,o as Pt,a as Pe,n as Tc,b as Sr,e as ln,q as Mx,l as Mo,p as Be,y as he,m as gi,k as Ba,P as jl,X as e0,Y as uj,A as pR,Z as vR,r as Ps,f as ue,O as cj,u as n0,Q as r0,i as hj,s as dj,w as uf,B as le,F as mR,G as Il,V as Ki,z as fj,D as gj,_ as pj,C as vj}from"./vue-vendor-DFp1TAzT.js";import"./index-1uvjSEkH.js";import{T as mj}from"./index-Dyz-xrWZ.js";import{_ as Vs}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{I as yj}from"./index-B1R-cSoC.js";import{_ as Hs,a as qo,i as ql,o as iv,b as av,s as yR,c as bR,I as bj,d as wj,u as wR,B as xR,e as bt,f as xj,h as cf,j as Ej,g as i0,k as P3,l as _j,m as jt,n as at,p as Ce,q as st,r as Lt,t as Bs,v as ER,w as Ca,x as kx,y as Sj,z as _R}from"./index-BNM7SxA1.js";import{I as Mj}from"./index-CeoAKoD8.js";import{R as kj}from"./resize-observer-MNhnITvS.js";import{r as N3}from"./responsive-observe-aL7Iq97G.js";import{C as Cj,a as Tj}from"./index-wX5wZdJZ.js";/* empty css *//* empty css */import{T as Oj,a as Aj,P as Pj}from"./index-2syoWuWi.js";/* empty css */import{T as Nj}from"./index-qG9PFKdz.js";import{_ as Rj}from"./Header-DKfWvU1s.js";import{P as Lj}from"./index-Cp3MFNEN.js";import{P as SR}from"./index-51HbhVcV.js";import{Q as Ij}from"./common-DQlXdSGy.js";import{M as a0}from"./index-D5fhO7ss.js";import"./index-C3vJ2S_y.js";import"./index-C5DTsicj.js";import"./index-Da0npD6J.js";import"./render-function-BUOKTXkZ.js";import"./index.es-BW_FzNZC.js";/* empty css */import"./use-logout-Cffw9l0T.js";import"./use-current-user-Dgr4cDvx.js";import"./login-Bg4scs31.js";const Dj=Gs({name:"IconAttachment",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=qo("icon"),n=ln(()=>[e,`${e}-attachment`,{[`${e}-spin`]:r.spin}]),i=ln(()=>{const s={};return r.size&&(s.fontSize=ql(r.size)?`${r.size}px`:r.size),r.rotate&&(s.transform=`rotate(${r.rotate}deg)`),s});return{cls:n,innerStyle:i,onClick:s=>{t("click",s)}}}}),Fj=["stroke-width","stroke-linecap","stroke-linejoin"],Bj=Pe("path",{d:"M29.037 15.236s-9.174 9.267-11.48 11.594c-2.305 2.327-1.646 4.987-.329 6.316 1.317 1.33 3.994 1.953 6.258-.332L37.32 18.851c3.623-3.657 2.092-8.492 0-10.639-2.093-2.147-6.916-3.657-10.54 0L11.3 23.838c-3.623 3.657-3.953 10.638.329 14.96 4.282 4.322 11.115 4.105 14.821.333 3.706-3.773 8.74-8.822 11.224-11.33"},null,-1),zj=[Bj];function $j(r,t,e,n,i,a){return Pt(),Xe("svg",{viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:Sr(r.cls),style:Tc(r.innerStyle),"stroke-width":r.strokeWidth,"stroke-linecap":r.strokeLinecap,"stroke-linejoin":r.strokeLinejoin,onClick:t[0]||(t[0]=(...s)=>r.onClick&&r.onClick(...s))},zj,14,Fj)}var sv=Hs(Dj,[["render",$j]]);const jj=Object.assign(sv,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+sv.name,sv)}}),qj=Gs({name:"IconDragDot",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=qo("icon"),n=ln(()=>[e,`${e}-drag-dot`,{[`${e}-spin`]:r.spin}]),i=ln(()=>{const s={};return r.size&&(s.fontSize=ql(r.size)?`${r.size}px`:r.size),r.rotate&&(s.transform=`rotate(${r.rotate}deg)`),s});return{cls:n,innerStyle:i,onClick:s=>{t("click",s)}}}}),Wj=["stroke-width","stroke-linecap","stroke-linejoin"],Gj=Pe("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z",fill:"currentColor",stroke:"none"},null,-1),Vj=Pe("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z"},null,-1),Hj=[Gj,Vj];function Uj(r,t,e,n,i,a){return Pt(),Xe("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:Sr(r.cls),style:Tc(r.innerStyle),"stroke-width":r.strokeWidth,"stroke-linecap":r.strokeLinecap,"stroke-linejoin":r.strokeLinejoin,onClick:t[0]||(t[0]=(...s)=>r.onClick&&r.onClick(...s))},Hj,14,Wj)}var ov=Hs(qj,[["render",Uj]]);const Yj=Object.assign(ov,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+ov.name,ov)}}),Xj=Symbol("LayoutSiderInjectionKey"),Kj=Symbol("SiderInjectionKey");var Zj=Gs({name:"ResizeTrigger",components:{ResizeObserver:kj,IconDragDot:Yj,IconDragDotVertical:Mj},props:{prefixCls:{type:String,required:!0},direction:{type:String,default:"horizontal"}},emits:["resize"],setup(r,{emit:t}){const{direction:e,prefixCls:n}=Mx(r),i=ln(()=>(e==null?void 0:e.value)==="horizontal");return{classNames:ln(()=>[n.value,{[`${n.value}-horizontal`]:i.value,[`${n.value}-vertical`]:!i.value}]),onResize:o=>{t("resize",o)},isHorizontal:i}}});function Jj(r,t,e,n,i,a){const s=Mo("IconDragDot"),o=Mo("IconDragDotVertical"),l=Mo("ResizeObserver");return Pt(),Be(l,{onResize:r.onResize},{default:he(()=>[Pe("div",{class:Sr(r.classNames)},[gi(" @slot 自定义内容 "),Ba(r.$slots,"default",{},()=>[Pe("div",{class:Sr(`${r.prefixCls}-icon-wrapper`)},[gi(" @slot 自定义 icon "),Ba(r.$slots,"icon",{},()=>[r.isHorizontal?(Pt(),Be(s,{key:0,class:Sr(`${r.prefixCls}-icon`)},null,8,["class"])):(Pt(),Be(o,{key:1,class:Sr(`${r.prefixCls}-icon`)},null,8,["class"]))])],2)])],2)]),_:3},8,["onResize"])}var Qj=Hs(Zj,[["render",Jj]]),tq=Object.defineProperty,R3=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,nq=Object.prototype.propertyIsEnumerable,L3=(r,t,e)=>t in r?tq(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lv=(r,t)=>{for(var e in t||(t={}))eq.call(t,e)&&L3(r,e,t[e]);if(R3)for(var e of R3(t))nq.call(t,e)&&L3(r,e,t[e]);return r};const MR="left",kR="right",Cx="top",Tx="bottom",rq=[MR,kR,Cx,Tx];function I3(r,t){if(r===0)return 0;const e=r-t;return e<=0?0:e}function uv(r){return[Cx,Tx].indexOf(r)>-1}const iq=Gs({name:"ResizeBox",components:{ResizeTrigger:Qj},inheritAttrs:!1,props:{width:{type:Number},height:{type:Number},component:{type:String,default:"div"},directions:{type:Array,default:()=>["right"]}},emits:{"update:width":r=>!0,"update:height":r=>!0,movingStart:r=>!0,moving:(r,t)=>!0,movingEnd:r=>!0},setup(r,{emit:t}){const{height:e,width:n,directions:i}=Mx(r),[a,s]=aw(null,Ps({value:n})),[o,l]=aw(null,Ps({value:e})),u=ue(),c=Ps({}),h=qo("resizebox"),d=ln(()=>[h]),g=ln(()=>lv(lv(lv({},ql(a.value)?{width:`${a.value}px`}:{}),ql(o.value)?{height:`${o.value}px`}:{}),c)),p=ln(()=>i.value.filter(S=>rq.includes(S))),v={direction:"",startPageX:0,startPageY:0,startWidth:0,startHeight:0,moving:!1,padding:{left:0,right:0,top:0,bottom:0}};function m(S){if(!v.moving)return;const{startPageX:_,startPageY:k,startWidth:M,startHeight:C,direction:P}=v;let T=M,A=C;const R=S.pageX-_,L=S.pageY-k;switch(P){case MR:T=M-R,s(T),t("update:width",T);break;case kR:T=M+R,s(T),t("update:width",T);break;case Cx:A=C-L,l(A),t("update:height",A);break;case Tx:A=C+L,l(A),t("update:height",A);break}t("moving",{width:T,height:A},S)}function b(S){v.moving=!1,av(window,"mousemove",m),av(window,"mouseup",b),av(window,"contextmenu",b),document.body.style.cursor="default",t("movingEnd",S)}function w(S,_){var k,M;t("movingStart",_),v.moving=!0,v.startPageX=_.pageX,v.startPageY=_.pageY,v.direction=S;const{top:C,left:P,right:T,bottom:A}=v.padding;v.startWidth=I3(((k=u.value)==null?void 0:k.clientWidth)||0,P+T),v.startHeight=I3(((M=u.value)==null?void 0:M.clientHeight)||0,C+A),iv(window,"mousemove",m),iv(window,"mouseup",b),iv(window,"contextmenu",b),document.body.style.cursor=uv(S)?"row-resize":"col-resize"}function x(S,_){const{width:k,height:M}=_.contentRect,C=uv(S)?M:k;v.padding[S]=C,c[`padding-${S}`]=`${C}px`}return{prefixCls:h,classNames:d,styles:g,wrapperRef:u,onMoveStart:w,isHorizontal:uv,allowDirections:p,onTiggerResize:x}}});function aq(r,t,e,n,i,a){const s=Mo("ResizeTrigger");return Pt(),Be(vR(r.component),pR({ref:"wrapperRef",class:r.classNames},r.$attrs,{style:r.styles}),{default:he(()=>[Ba(r.$slots,"default"),(Pt(!0),Xe(jl,null,e0(r.allowDirections,o=>(Pt(),Be(s,{key:o,"prefix-cls":`${r.prefixCls}-trigger`,class:Sr(`${r.prefixCls}-direction-${o}`),direction:r.isHorizontal(o)?"horizontal":"vertical",onMousedown:l=>{r.onMoveStart(o,l)},onResize:l=>{r.onTiggerResize(o,l)}},uj({default:he(()=>[r.$slots["resize-trigger"]?Ba(r.$slots,"resize-trigger",{key:0,direction:o}):gi("v-if",!0)]),_:2},[r.$slots["resize-trigger-icon"]?{name:"icon",fn:he(()=>[Ba(r.$slots,"resize-trigger-icon",{direction:o})])}:void 0]),1032,["prefix-cls","class","direction","onMousedown","onResize"]))),128))]),_:3},16,["class","style"])}var cv=Hs(iq,[["render",aq]]);const sq=Object.assign(cv,{install:(r,t)=>{yR(r,t);const e=bR(t);r.component(e+cv.name,cv)}});function oq(r,t){const e=ln(()=>cj(r)?r.value:r);let n="";n0(()=>{n=N3.subscribe((i,a)=>{e.value&&(!a||a===e.value)&&t(!!i[e.value])})}),r0(()=>{n&&N3.unsubscribe(n)})}const lq=(()=>{let r=0;return(t="")=>(r+=1,`${t}${r}`)})();var uq=Gs({name:"LayoutSider",components:{IconLeft:bj,IconRight:yj,ResizeBox:sq},props:{theme:{type:String,default:"light"},collapsed:{type:Boolean,default:void 0},defaultCollapsed:{type:Boolean},collapsible:{type:Boolean},width:{type:Number,default:200},collapsedWidth:{type:Number,default:48},reverseArrow:{type:Boolean},breakpoint:{type:String},resizeDirections:{type:Array,default:void 0},hideTrigger:{type:Boolean}},emits:["collapse","update:collapsed","breakpoint"],setup(r,{emit:t}){const{theme:e,collapsed:n,defaultCollapsed:i,collapsible:a,hideTrigger:s,breakpoint:o,collapsedWidth:l,resizeDirections:u}=Mx(r),[c,h]=aw(i.value,Ps({value:n})),d=ln(()=>u.value?"ResizeBox":"div"),g=ln(()=>a.value&&!s.value),p=qo("layout-sider"),v=ln(()=>[p,{[`${p}-light`]:e.value==="light",[`${p}-has-trigger`]:g.value,[`${p}-collapsed`]:n.value}]),m=ln(()=>{const{width:_,collapsedWidth:k}=r,M=c.value?k:_;return ql(M)?`${M}px`:String(M)}),b=ln(()=>[`${p}-trigger`,{[`${p}-trigger-light`]:e.value==="light"}]),w=()=>{const _=!c.value;h(_),t("update:collapsed",_),t("collapse",_,"clickTrigger")};oq(o,_=>{const k=!_;k!==c.value&&(h(k),t("update:collapsed",k),t("collapse",k,"responsive"),t("breakpoint",k))});const x=lq("__arco_layout_sider"),S=hj(Xj,void 0);return n0(()=>{var _;(_=S==null?void 0:S.onSiderMount)==null||_.call(S,x)}),r0(()=>{var _;(_=S==null?void 0:S.onSiderUnMount)==null||_.call(S,x)}),dj(Kj,Ps({theme:e,collapsed:c,collapsedWidth:l})),{componentTag:d,prefixCls:p,classNames:v,triggerClassNames:b,localCollapsed:c,siderWidth:m,showTrigger:g,toggleTrigger:w}}});const cq={key:0},hq={key:1};function dq(r,t,e,n,i,a){const s=Mo("IconLeft"),o=Mo("IconRight");return Pt(),Be(vR(r.componentTag),pR({class:r.classNames,style:{width:r.siderWidth}},r.resizeDirections?{directions:r.resizeDirections}:{}),{default:he(()=>[Pe("div",{class:Sr(`${r.prefixCls}-children`)},[Ba(r.$slots,"default")],2),r.showTrigger?(Pt(),Xe("div",{key:0,class:Sr(r.triggerClassNames),style:Tc({width:r.siderWidth}),onClick:t[0]||(t[0]=(...l)=>r.toggleTrigger&&r.toggleTrigger(...l))},[Ba(r.$slots,"trigger",{collapsed:r.localCollapsed},()=>[r.reverseArrow?(Pt(),Xe("div",hq,[r.localCollapsed?(Pt(),Be(s,{key:0})):(Pt(),Be(o,{key:1}))])):(Pt(),Xe("div",cq,[r.localCollapsed?(Pt(),Be(o,{key:1})):(Pt(),Be(s,{key:0}))]))])],6)):gi("v-if",!0)]),_:3},16,["class","style"])}var fq=Hs(uq,[["render",dq]]);const gq=Gs({name:"Skeleton",props:{loading:{type:Boolean,default:!0},animation:{type:Boolean,default:!1}},setup(r){const t=qo("skeleton"),e=ln(()=>[t,{[`${t}-animation`]:r.animation}]);return{prefixCls:t,cls:e}}});function pq(r,t,e,n,i,a){return Pt(),Xe("div",{class:Sr(r.cls)},[r.loading?Ba(r.$slots,"default",{key:0}):Ba(r.$slots,"content",{key:1})],2)}var hv=Hs(gq,[["render",pq]]);const vq=Gs({name:"SkeletonLine",props:{rows:{type:Number,default:1},widths:{type:Array,default:()=>[]},lineHeight:{type:Number,default:20},lineSpacing:{type:Number,default:15}},setup(r){const t=qo("skeleton-line"),e=[];for(let n=0;n<r.rows;n++){const i={};ql(r.widths[n])?i.width=`${r.widths[n]}px`:wj(r.widths[n])&&(i.width=String(r.widths[n])),i.height=`${r.lineHeight}px`,n>0&&(i.marginTop=`${r.lineSpacing}px`),e.push(i)}return{prefixCls:t,lines:e}}});function mq(r,t,e,n,i,a){return Pt(!0),Xe(jl,null,e0(r.lines,(s,o)=>(Pt(),Xe("ul",{key:o,class:Sr(r.prefixCls)},[Pe("li",{class:Sr(`${r.prefixCls}-row`),style:Tc(s)},null,6)],2))),128)}var Xd=Hs(vq,[["render",mq]]);const yq=Gs({name:"SkeletonShape",props:{shape:{type:String,default:"square"},size:{type:String,default:"medium"}},setup(r){const t=qo("skeleton-shape"),e=ln(()=>[t,`${t}-${r.shape}`,`${t}-${r.size}`]);return{prefixCls:t,cls:e}}});function bq(r,t,e,n,i,a){return Pt(),Xe("div",{class:Sr(r.cls)},null,2)}var dv=Hs(yq,[["render",bq]]);const wq=Object.assign(hv,{Line:Xd,Shape:dv,install:(r,t)=>{yR(r,t);const e=bR(t);r.component(e+hv.name,hv),r.component(e+Xd.name,Xd),r.component(e+dv.name,dv)}}),xq={key:1,class:"no-data"},Eq={__name:"Sidebar",props:{model_list:{type:Array,default:()=>[]}},emits:["updateCheckedList"],setup(r,{emit:t}){const e=ue(!1),n=ue([]),i=ue([]),a=t,s=r;uf(()=>s.model_list,l=>{n.value=l.map(u=>u.id)},{immediate:!0});const o=l=>{n.value=l,a("updateCheckedList",l)};return(l,u)=>{const c=mj,h=fR,d=fq;return Pt(),Be(d,{width:"18%"},{default:he(()=>[le(h,{loading:e.value},{default:he(()=>[r.model_list.length?(Pt(),Be(c,{key:0,class:"tree",data:r.model_list,checkable:"","checked-keys":n.value,"selected-keys":i.value,"field-names":{title:"name",key:"id"},onCheck:o},null,8,["data","checked-keys","selected-keys"])):(Pt(),Xe("div",xq,"暂无数据"))]),_:1},8,["loading"])]),_:1})}}},_q=Vs(Eq,[["__scopeId","data-v-4324e6a4"]]),Sq="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.66667%2010H13.3333M6.5%2017.5H13.5C14.9001%2017.5%2015.6002%2017.5%2016.135%2017.2275C16.6054%2016.9878%2016.9878%2016.6054%2017.2275%2016.135C17.5%2015.6002%2017.5%2014.9001%2017.5%2013.5V6.5C17.5%205.09987%2017.5%204.3998%2017.2275%203.86502C16.9878%203.39462%2016.6054%203.01217%2016.135%202.77248C15.6002%202.5%2014.9001%202.5%2013.5%202.5H6.5C5.09987%202.5%204.3998%202.5%203.86502%202.77248C3.39462%203.01217%203.01217%203.39462%202.77248%203.86502C2.5%204.3998%202.5%205.09987%202.5%206.5V13.5C2.5%2014.9001%202.5%2015.6002%202.77248%2016.135C3.01217%2016.6054%203.39462%2016.9878%203.86502%2017.2275C4.3998%2017.5%205.09987%2017.5%206.5%2017.5Z'%20stroke='%237F56D9'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3c/svg%3e",Mq=["src"],kq={__name:"RetrievalDocuments",props:{documents:String},emits:"onFilesSelected",setup(r,{emit:t}){const{t:e}=wR(),n=t,i=ue([]),a=ue([]),s=Ps({type:"checkbox",showCheckedAll:!0,onlyCurrent:!1}),o={pageSize:10},l=c=>{i.value=c},u=c=>{n("onFilesSelected",c),l(c)};return(c,h)=>{const d=t0,g=Aj,p=Mo("icon-eye"),v=xR,m=Nj,b=Oj,w=Cj,x=Tj;return Pt(),Be(x,{class:"select-files-collapse"},{default:he(()=>[(Pt(),Be(w,{key:1},{"expand-icon":he(({active:S})=>[Pe("img",{src:Ki(Sq),style:Tc({transform:S?"rotate(180deg)":"rotate(0deg)"})},null,12,Mq)]),header:he(()=>[le(d,null,{default:he(()=>{var S;return[mR(Il(i.value.length)+"/"+Il(((S=r.documents)==null?void 0:S.length)||0)+" "+Il(c.$t("ai_search.selected_files")),1)]}),_:1})]),default:he(()=>[le(b,{data:r.documents,onSelectionChange:u,rowKey:"doc_id","show-header":!1,bordered:!1,"row-selection":s,selectedKeys:a.value,"onUpdate:selectedKeys":h[0]||(h[0]=S=>a.value=S),pagination:o},{columns:he(()=>[le(g,{"data-index":"doc_name"}),le(g,{"data-index":"count",width:"80"}),le(g,{width:"80"},{cell:he(({record:S})=>[le(m,{content:c.$t("ai_search.preview")},{default:he(()=>[le(v,{type:"text"},{default:he(()=>[le(p)]),_:1})]),_:1},8,["content"])]),_:1})]),_:1},8,["data","row-selection","selectedKeys"])]),_:1}))]),_:1})}}},Cq=Vs(kq,[["__scopeId","data-v-d181d36c"]]),Tq={class:"markdown-content"},Oq=["innerHTML"],Aq={__name:"MarkdownContent",props:{content:String},setup(r){const t=r,e=ln(()=>nj(t.content||""));return(n,i)=>{const a=Xd,s=t0,o=wq;return Pt(),Xe("div",Tq,[i[0]||(i[0]=Pe("div",{class:"header"},[Pe("img",{src:Rj,alt:"Logo",class:"logo"}),Pe("h3",null,"智能回答")],-1)),r.content?(Pt(),Xe("div",{key:0,innerHTML:e.value,class:"content"},null,8,Oq)):(Pt(),Be(o,{key:1,class:"content",animation:!0},{default:he(()=>[le(s,{direction:"vertical",style:{width:"100%"},size:"large"},{default:he(()=>[le(a,{rows:3})]),_:1})]),_:1}))])}}},Pq=Vs(Aq,[["__scopeId","data-v-9922981b"]]);function D3(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),e.push.apply(e,n)}return e}function Bt(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?D3(Object(e),!0).forEach(function(n){bt(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):D3(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function qt(r,t,e){return t=cf(t),xj(r,Ej()?Reflect.construct(t,e||[],cf(r).constructor):t.apply(r,e))}var CR={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function a(l,u,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var g=new i(c,h||l,d),p=e?e+u:u;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],g]:l._events[p].push(g):(l._events[p]=g,l._eventsCount++),l}function s(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,g=h.length,p=new Array(g);d<g;d++)p[d]=h[d].fn;return p},o.prototype.listenerCount=function(u){var c=e?e+u:u,h=this._events[c];return h?h.fn?1:h.length:0},o.prototype.emit=function(u,c,h,d,g,p){var v=e?e+u:u;if(!this._events[v])return!1;var m=this._events[v],b=arguments.length,w,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),b){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,h),!0;case 4:return m.fn.call(m.context,c,h,d),!0;case 5:return m.fn.call(m.context,c,h,d,g),!0;case 6:return m.fn.call(m.context,c,h,d,g,p),!0}for(x=1,w=new Array(b-1);x<b;x++)w[x-1]=arguments[x];m.fn.apply(m.context,w)}else{var S=m.length,_;for(x=0;x<S;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),b){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,c);break;case 3:m[x].fn.call(m[x].context,c,h);break;case 4:m[x].fn.call(m[x].context,c,h,d);break;default:if(!w)for(_=1,w=new Array(b-1);_<b;_++)w[_-1]=arguments[_];m[x].fn.apply(m[x].context,w)}}return!0},o.prototype.on=function(u,c,h){return a(this,u,c,h,!1)},o.prototype.once=function(u,c,h){return a(this,u,c,h,!0)},o.prototype.removeListener=function(u,c,h,d){var g=e?e+u:u;if(!this._events[g])return this;if(!c)return s(this,g),this;var p=this._events[g];if(p.fn)p.fn===c&&(!d||p.once)&&(!h||p.context===h)&&s(this,g);else{for(var v=0,m=[],b=p.length;v<b;v++)(p[v].fn!==c||d&&!p[v].once||h&&p[v].context!==h)&&m.push(p[v]);m.length?this._events[g]=m.length===1?m[0]:m:s(this,g)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=e?e+u:u,this._events[c]&&s(this,c)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,r.exports=o})(CR);var Nq=CR.exports;const TR=i0(Nq);var Fe=1e-6,pn=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});function OR(){var r=new pn(9);return pn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Rq(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[4],r[4]=t[5],r[5]=t[6],r[6]=t[8],r[7]=t[9],r[8]=t[10],r}function Lq(r,t,e,n,i,a,s,o,l){var u=new pn(9);return u[0]=r,u[1]=t,u[2]=e,u[3]=n,u[4]=i,u[5]=a,u[6]=s,u[7]=o,u[8]=l,u}function Se(){var r=new pn(16);return pn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function AR(r){var t=new pn(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t}function Wl(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function PR(r,t,e,n,i,a,s,o,l,u,c,h,d,g,p,v){var m=new pn(16);return m[0]=r,m[1]=t,m[2]=e,m[3]=n,m[4]=i,m[5]=a,m[6]=s,m[7]=o,m[8]=l,m[9]=u,m[10]=c,m[11]=h,m[12]=d,m[13]=g,m[14]=p,m[15]=v,m}function sw(r,t,e,n,i,a,s,o,l,u,c,h,d,g,p,v,m){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=l,r[8]=u,r[9]=c,r[10]=h,r[11]=d,r[12]=g,r[13]=p,r[14]=v,r[15]=m,r}function zs(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function NR(r,t){if(r===t){var e=t[1],n=t[2],i=t[3],a=t[6],s=t[7],o=t[11];r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=e,r[6]=t[9],r[7]=t[13],r[8]=n,r[9]=a,r[11]=t[14],r[12]=i,r[13]=s,r[14]=o}else r[0]=t[0],r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=t[1],r[5]=t[5],r[6]=t[9],r[7]=t[13],r[8]=t[2],r[9]=t[6],r[10]=t[10],r[11]=t[14],r[12]=t[3],r[13]=t[7],r[14]=t[11],r[15]=t[15];return r}function Qi(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],g=t[11],p=t[12],v=t[13],m=t[14],b=t[15],w=e*o-n*s,x=e*l-i*s,S=e*u-a*s,_=n*l-i*o,k=n*u-a*o,M=i*u-a*l,C=c*v-h*p,P=c*m-d*p,T=c*b-g*p,A=h*m-d*v,R=h*b-g*v,L=d*b-g*m,$=w*L-x*R+S*A+_*T-k*P+M*C;return $?($=1/$,r[0]=(o*L-l*R+u*A)*$,r[1]=(i*R-n*L-a*A)*$,r[2]=(v*M-m*k+b*_)*$,r[3]=(d*k-h*M-g*_)*$,r[4]=(l*T-s*L-u*P)*$,r[5]=(e*L-i*T+a*P)*$,r[6]=(m*S-p*M-b*x)*$,r[7]=(c*M-d*S+g*x)*$,r[8]=(s*R-o*T+u*C)*$,r[9]=(n*T-e*R-a*C)*$,r[10]=(p*k-v*S+b*w)*$,r[11]=(h*S-c*k-g*w)*$,r[12]=(o*P-s*A-l*C)*$,r[13]=(e*A-n*P+i*C)*$,r[14]=(v*x-p*_-m*w)*$,r[15]=(c*_-h*x+d*w)*$,r):null}function Iq(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],g=t[11],p=t[12],v=t[13],m=t[14],b=t[15];return r[0]=o*(d*b-g*m)-h*(l*b-u*m)+v*(l*g-u*d),r[1]=-(n*(d*b-g*m)-h*(i*b-a*m)+v*(i*g-a*d)),r[2]=n*(l*b-u*m)-o*(i*b-a*m)+v*(i*u-a*l),r[3]=-(n*(l*g-u*d)-o*(i*g-a*d)+h*(i*u-a*l)),r[4]=-(s*(d*b-g*m)-c*(l*b-u*m)+p*(l*g-u*d)),r[5]=e*(d*b-g*m)-c*(i*b-a*m)+p*(i*g-a*d),r[6]=-(e*(l*b-u*m)-s*(i*b-a*m)+p*(i*u-a*l)),r[7]=e*(l*g-u*d)-s*(i*g-a*d)+c*(i*u-a*l),r[8]=s*(h*b-g*v)-c*(o*b-u*v)+p*(o*g-u*h),r[9]=-(e*(h*b-g*v)-c*(n*b-a*v)+p*(n*g-a*h)),r[10]=e*(o*b-u*v)-s*(n*b-a*v)+p*(n*u-a*o),r[11]=-(e*(o*g-u*h)-s*(n*g-a*h)+c*(n*u-a*o)),r[12]=-(s*(h*m-d*v)-c*(o*m-l*v)+p*(o*d-l*h)),r[13]=e*(h*m-d*v)-c*(n*m-i*v)+p*(n*d-i*h),r[14]=-(e*(o*m-l*v)-s*(n*m-i*v)+p*(n*l-i*o)),r[15]=e*(o*d-l*h)-s*(n*d-i*h)+c*(n*l-i*o),r}function RR(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],l=r[7],u=r[8],c=r[9],h=r[10],d=r[11],g=r[12],p=r[13],v=r[14],m=r[15],b=t*s-e*a,w=t*o-n*a,x=t*l-i*a,S=e*o-n*s,_=e*l-i*s,k=n*l-i*o,M=u*p-c*g,C=u*v-h*g,P=u*m-d*g,T=c*v-h*p,A=c*m-d*p,R=h*m-d*v;return b*R-w*A+x*T+S*P-_*C+k*M}function Jn(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],g=t[10],p=t[11],v=t[12],m=t[13],b=t[14],w=t[15],x=e[0],S=e[1],_=e[2],k=e[3];return r[0]=x*n+S*o+_*h+k*v,r[1]=x*i+S*l+_*d+k*m,r[2]=x*a+S*u+_*g+k*b,r[3]=x*s+S*c+_*p+k*w,x=e[4],S=e[5],_=e[6],k=e[7],r[4]=x*n+S*o+_*h+k*v,r[5]=x*i+S*l+_*d+k*m,r[6]=x*a+S*u+_*g+k*b,r[7]=x*s+S*c+_*p+k*w,x=e[8],S=e[9],_=e[10],k=e[11],r[8]=x*n+S*o+_*h+k*v,r[9]=x*i+S*l+_*d+k*m,r[10]=x*a+S*u+_*g+k*b,r[11]=x*s+S*c+_*p+k*w,x=e[12],S=e[13],_=e[14],k=e[15],r[12]=x*n+S*o+_*h+k*v,r[13]=x*i+S*l+_*d+k*m,r[14]=x*a+S*u+_*g+k*b,r[15]=x*s+S*c+_*p+k*w,r}function Dl(r,t,e){var n=e[0],i=e[1],a=e[2],s,o,l,u,c,h,d,g,p,v,m,b;return t===r?(r[12]=t[0]*n+t[4]*i+t[8]*a+t[12],r[13]=t[1]*n+t[5]*i+t[9]*a+t[13],r[14]=t[2]*n+t[6]*i+t[10]*a+t[14],r[15]=t[3]*n+t[7]*i+t[11]*a+t[15]):(s=t[0],o=t[1],l=t[2],u=t[3],c=t[4],h=t[5],d=t[6],g=t[7],p=t[8],v=t[9],m=t[10],b=t[11],r[0]=s,r[1]=o,r[2]=l,r[3]=u,r[4]=c,r[5]=h,r[6]=d,r[7]=g,r[8]=p,r[9]=v,r[10]=m,r[11]=b,r[12]=s*n+c*i+p*a+t[12],r[13]=o*n+h*i+v*a+t[13],r[14]=l*n+d*i+m*a+t[14],r[15]=u*n+g*i+b*a+t[15]),r}function LR(r,t,e){var n=e[0],i=e[1],a=e[2];return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r[3]=t[3]*n,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*a,r[9]=t[9]*a,r[10]=t[10]*a,r[11]=t[11]*a,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function Dq(r,t,e,n){var i=n[0],a=n[1],s=n[2],o=Math.hypot(i,a,s),l,u,c,h,d,g,p,v,m,b,w,x,S,_,k,M,C,P,T,A,R,L,$,q;return o<Fe?null:(o=1/o,i*=o,a*=o,s*=o,l=Math.sin(e),u=Math.cos(e),c=1-u,h=t[0],d=t[1],g=t[2],p=t[3],v=t[4],m=t[5],b=t[6],w=t[7],x=t[8],S=t[9],_=t[10],k=t[11],M=i*i*c+u,C=a*i*c+s*l,P=s*i*c-a*l,T=i*a*c-s*l,A=a*a*c+u,R=s*a*c+i*l,L=i*s*c+a*l,$=a*s*c-i*l,q=s*s*c+u,r[0]=h*M+v*C+x*P,r[1]=d*M+m*C+S*P,r[2]=g*M+b*C+_*P,r[3]=p*M+w*C+k*P,r[4]=h*T+v*A+x*R,r[5]=d*T+m*A+S*R,r[6]=g*T+b*A+_*R,r[7]=p*T+w*A+k*R,r[8]=h*L+v*$+x*q,r[9]=d*L+m*$+S*q,r[10]=g*L+b*$+_*q,r[11]=p*L+w*$+k*q,t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r)}function IR(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[4],s=t[5],o=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=a*i+u*n,r[5]=s*i+c*n,r[6]=o*i+h*n,r[7]=l*i+d*n,r[8]=u*i-a*n,r[9]=c*i-s*n,r[10]=h*i-o*n,r[11]=d*i-l*n,r}function DR(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=a*i-u*n,r[1]=s*i-c*n,r[2]=o*i-h*n,r[3]=l*i-d*n,r[8]=a*n+u*i,r[9]=s*n+c*i,r[10]=o*n+h*i,r[11]=l*n+d*i,r}function Fq(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=a*i+u*n,r[1]=s*i+c*n,r[2]=o*i+h*n,r[3]=l*i+d*n,r[4]=u*i-a*n,r[5]=c*i-s*n,r[6]=h*i-o*n,r[7]=d*i-l*n,r}function ws(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function mo(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function FR(r,t,e){var n=e[0],i=e[1],a=e[2],s=Math.hypot(n,i,a),o,l,u;return s<Fe?null:(s=1/s,n*=s,i*=s,a*=s,o=Math.sin(t),l=Math.cos(t),u=1-l,r[0]=n*n*u+l,r[1]=i*n*u+a*o,r[2]=a*n*u-i*o,r[3]=0,r[4]=n*i*u-a*o,r[5]=i*i*u+l,r[6]=a*i*u+n*o,r[7]=0,r[8]=n*a*u+i*o,r[9]=i*a*u-n*o,r[10]=a*a*u+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function BR(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=e,r[7]=0,r[8]=0,r[9]=-e,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function zR(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=0,r[2]=-e,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=e,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ow(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=0,r[3]=0,r[4]=-e,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function $R(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=n+n,l=i+i,u=a+a,c=n*o,h=n*l,d=n*u,g=i*l,p=i*u,v=a*u,m=s*o,b=s*l,w=s*u;return r[0]=1-(g+v),r[1]=h+w,r[2]=d-b,r[3]=0,r[4]=h-w,r[5]=1-(c+v),r[6]=p+m,r[7]=0,r[8]=d+b,r[9]=p-m,r[10]=1-(c+g),r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function Bq(r,t){var e=new pn(3),n=-t[0],i=-t[1],a=-t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=n*n+i*i+a*a+s*s;return h>0?(e[0]=(o*s+c*n+l*a-u*i)*2/h,e[1]=(l*s+c*i+u*n-o*a)*2/h,e[2]=(u*s+c*a+o*i-l*n)*2/h):(e[0]=(o*s+c*n+l*a-u*i)*2,e[1]=(l*s+c*i+u*n-o*a)*2,e[2]=(u*s+c*a+o*i-l*n)*2),$R(r,t,e),r}function hf(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function Gl(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],u=t[9],c=t[10];return r[0]=Math.hypot(e,n,i),r[1]=Math.hypot(a,s,o),r[2]=Math.hypot(l,u,c),r}function df(r,t){var e=new pn(3);Gl(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,l=t[2]*a,u=t[4]*n,c=t[5]*i,h=t[6]*a,d=t[8]*n,g=t[9]*i,p=t[10]*a,v=s+c+p,m=0;return v>0?(m=Math.sqrt(v+1)*2,r[3]=.25*m,r[0]=(h-g)/m,r[1]=(d-l)/m,r[2]=(o-u)/m):s>c&&s>p?(m=Math.sqrt(1+s-c-p)*2,r[3]=(h-g)/m,r[0]=.25*m,r[1]=(o+u)/m,r[2]=(d+l)/m):c>p?(m=Math.sqrt(1+c-s-p)*2,r[3]=(d-l)/m,r[0]=(o+u)/m,r[1]=.25*m,r[2]=(h+g)/m):(m=Math.sqrt(1+p-s-c)*2,r[3]=(o-u)/m,r[0]=(d+l)/m,r[1]=(h+g)/m,r[2]=.25*m),r}function zq(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,g=i*c,p=a*u,v=a*c,m=s*c,b=o*l,w=o*u,x=o*c,S=n[0],_=n[1],k=n[2];return r[0]=(1-(p+m))*S,r[1]=(d+x)*S,r[2]=(g-w)*S,r[3]=0,r[4]=(d-x)*_,r[5]=(1-(h+m))*_,r[6]=(v+b)*_,r[7]=0,r[8]=(g+w)*k,r[9]=(v-b)*k,r[10]=(1-(h+p))*k,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function ec(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],l=t[3],u=a+a,c=s+s,h=o+o,d=a*u,g=a*c,p=a*h,v=s*c,m=s*h,b=o*h,w=l*u,x=l*c,S=l*h,_=n[0],k=n[1],M=n[2],C=i[0],P=i[1],T=i[2],A=(1-(v+b))*_,R=(g+S)*_,L=(p-x)*_,$=(g-S)*k,q=(1-(d+b))*k,j=(m+w)*k,B=(p+x)*M,F=(m-w)*M,V=(1-(d+v))*M;return r[0]=A,r[1]=R,r[2]=L,r[3]=0,r[4]=$,r[5]=q,r[6]=j,r[7]=0,r[8]=B,r[9]=F,r[10]=V,r[11]=0,r[12]=e[0]+C-(A*C+$*P+B*T),r[13]=e[1]+P-(R*C+q*P+F*T),r[14]=e[2]+T-(L*C+j*P+V*T),r[15]=1,r}function Ox(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,u=e*s,c=n*s,h=n*o,d=i*s,g=i*o,p=i*l,v=a*s,m=a*o,b=a*l;return r[0]=1-h-p,r[1]=c+b,r[2]=d-m,r[3]=0,r[4]=c-b,r[5]=1-u-p,r[6]=g+v,r[7]=0,r[8]=d+m,r[9]=g-v,r[10]=1-u-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function $q(r,t,e,n,i,a,s){var o=1/(e-t),l=1/(i-n),u=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*l,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*l,r[10]=(s+a)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*u,r[15]=0,r}function jR(r,t,e,n,i){var a=1/Math.tan(t/2),s;return r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(s=1/(n-i),r[10]=(i+n)*s,r[14]=2*i*n*s):(r[10]=-1,r[14]=-2*n),r}var jq=jR;function qq(r,t,e,n,i){var a=1/Math.tan(t/2),s;return r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(s=1/(n-i),r[10]=i*s,r[14]=i*n*s):(r[10]=-1,r[14]=-n),r}function Wq(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),u=2/(i+a);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=-((s-o)*l*.5),r[9]=(i-a)*u*.5,r[10]=n/(e-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*e/(e-n),r[15]=0,r}function qR(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=(s+a)*u,r[15]=1,r}var WR=qR;function GR(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=a*u,r[15]=1,r}function VR(r,t,e,n){var i,a,s,o,l,u,c,h,d,g,p=t[0],v=t[1],m=t[2],b=n[0],w=n[1],x=n[2],S=e[0],_=e[1],k=e[2];return Math.abs(p-S)<Fe&&Math.abs(v-_)<Fe&&Math.abs(m-k)<Fe?zs(r):(c=p-S,h=v-_,d=m-k,g=1/Math.hypot(c,h,d),c*=g,h*=g,d*=g,i=w*d-x*h,a=x*c-b*d,s=b*h-w*c,g=Math.hypot(i,a,s),g?(g=1/g,i*=g,a*=g,s*=g):(i=0,a=0,s=0),o=h*s-d*a,l=d*i-c*s,u=c*a-h*i,g=Math.hypot(o,l,u),g?(g=1/g,o*=g,l*=g,u*=g):(o=0,l=0,u=0),r[0]=i,r[1]=o,r[2]=c,r[3]=0,r[4]=a,r[5]=l,r[6]=h,r[7]=0,r[8]=s,r[9]=u,r[10]=d,r[11]=0,r[12]=-(i*p+a*v+s*m),r[13]=-(o*p+l*v+u*m),r[14]=-(c*p+h*v+d*m),r[15]=1,r)}function Gq(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=n[0],l=n[1],u=n[2],c=i-e[0],h=a-e[1],d=s-e[2],g=c*c+h*h+d*d;g>0&&(g=1/Math.sqrt(g),c*=g,h*=g,d*=g);var p=l*d-u*h,v=u*c-o*d,m=o*h-l*c;return g=p*p+v*v+m*m,g>0&&(g=1/Math.sqrt(g),p*=g,v*=g,m*=g),r[0]=p,r[1]=v,r[2]=m,r[3]=0,r[4]=h*m-d*v,r[5]=d*p-c*m,r[6]=c*v-h*p,r[7]=0,r[8]=c,r[9]=h,r[10]=d,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function Vq(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function Hq(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function Uq(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r[8]=t[8]+e[8],r[9]=t[9]+e[9],r[10]=t[10]+e[10],r[11]=t[11]+e[11],r[12]=t[12]+e[12],r[13]=t[13]+e[13],r[14]=t[14]+e[14],r[15]=t[15]+e[15],r}function HR(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r[6]=t[6]-e[6],r[7]=t[7]-e[7],r[8]=t[8]-e[8],r[9]=t[9]-e[9],r[10]=t[10]-e[10],r[11]=t[11]-e[11],r[12]=t[12]-e[12],r[13]=t[13]-e[13],r[14]=t[14]-e[14],r[15]=t[15]-e[15],r}function Yq(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r[6]=t[6]*e,r[7]=t[7]*e,r[8]=t[8]*e,r[9]=t[9]*e,r[10]=t[10]*e,r[11]=t[11]*e,r[12]=t[12]*e,r[13]=t[13]*e,r[14]=t[14]*e,r[15]=t[15]*e,r}function Xq(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r[6]=t[6]+e[6]*n,r[7]=t[7]+e[7]*n,r[8]=t[8]+e[8]*n,r[9]=t[9]+e[9]*n,r[10]=t[10]+e[10]*n,r[11]=t[11]+e[11]*n,r[12]=t[12]+e[12]*n,r[13]=t[13]+e[13]*n,r[14]=t[14]+e[14]*n,r[15]=t[15]+e[15]*n,r}function lw(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]}function Kq(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],u=r[7],c=r[8],h=r[9],d=r[10],g=r[11],p=r[12],v=r[13],m=r[14],b=r[15],w=t[0],x=t[1],S=t[2],_=t[3],k=t[4],M=t[5],C=t[6],P=t[7],T=t[8],A=t[9],R=t[10],L=t[11],$=t[12],q=t[13],j=t[14],B=t[15];return Math.abs(e-w)<=Fe*Math.max(1,Math.abs(e),Math.abs(w))&&Math.abs(n-x)<=Fe*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-S)<=Fe*Math.max(1,Math.abs(i),Math.abs(S))&&Math.abs(a-_)<=Fe*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(s-k)<=Fe*Math.max(1,Math.abs(s),Math.abs(k))&&Math.abs(o-M)<=Fe*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(l-C)<=Fe*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(u-P)<=Fe*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(c-T)<=Fe*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(h-A)<=Fe*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-R)<=Fe*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(g-L)<=Fe*Math.max(1,Math.abs(g),Math.abs(L))&&Math.abs(p-$)<=Fe*Math.max(1,Math.abs(p),Math.abs($))&&Math.abs(v-q)<=Fe*Math.max(1,Math.abs(v),Math.abs(q))&&Math.abs(m-j)<=Fe*Math.max(1,Math.abs(m),Math.abs(j))&&Math.abs(b-B)<=Fe*Math.max(1,Math.abs(b),Math.abs(B))}var UR=Jn,Zq=HR;const Jq=Object.freeze(Object.defineProperty({__proto__:null,add:Uq,adjoint:Iq,clone:AR,copy:Wl,create:Se,determinant:RR,equals:Kq,exactEquals:lw,frob:Hq,fromQuat:Ox,fromQuat2:Bq,fromRotation:FR,fromRotationTranslation:$R,fromRotationTranslationScale:zq,fromRotationTranslationScaleOrigin:ec,fromScaling:mo,fromTranslation:ws,fromValues:PR,fromXRotation:BR,fromYRotation:zR,fromZRotation:ow,frustum:$q,getRotation:df,getScaling:Gl,getTranslation:hf,identity:zs,invert:Qi,lookAt:VR,mul:UR,multiply:Jn,multiplyScalar:Yq,multiplyScalarAndAdd:Xq,ortho:WR,orthoNO:qR,orthoZO:GR,perspective:jq,perspectiveFromFieldOfView:Wq,perspectiveNO:jR,perspectiveZO:qq,rotate:Dq,rotateX:IR,rotateY:DR,rotateZ:Fq,scale:LR,set:sw,str:Vq,sub:Zq,subtract:HR,targetTo:Gq,translate:Dl,transpose:NR},Symbol.toStringTag,{value:"Module"}));function Qt(){var r=new pn(3);return pn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Sa(r){var t=new pn(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function Ta(r){var t=r[0],e=r[1],n=r[2];return Math.hypot(t,e,n)}function Ae(r,t,e){var n=new pn(3);return n[0]=r,n[1]=t,n[2]=e,n}function ta(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function Zn(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function Ns(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function uw(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function Qq(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function tW(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r[2]=Math.min(t[2],e[2]),r}function eW(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r}function ff(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function nW(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2];return Math.hypot(e,n,i)}function ko(r,t){var e=t[0],n=t[1],i=t[2],a=e*e+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r}function ea(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Kd(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],l=e[2];return r[0]=i*l-a*o,r[1]=a*s-n*l,r[2]=n*o-i*s,r}function cw(r,t,e,n){var i=t[0],a=t[1],s=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r}function Qn(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[3]*n+e[7]*i+e[11]*a+e[15];return s=s||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/s,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/s,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/s,r}function rW(r,t,e){var n=t[0],i=t[1],a=t[2];return r[0]=n*e[0]+i*e[3]+a*e[6],r[1]=n*e[1]+i*e[4]+a*e[7],r[2]=n*e[2]+i*e[5]+a*e[8],r}function iW(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],u=t[2],c=i*u-a*l,h=a*o-n*u,d=n*l-i*o,g=i*d-a*h,p=a*c-n*d,v=n*h-i*c,m=s*2;return c*=m,h*=m,d*=m,g*=2,p*=2,v*=2,r[0]=o+c+g,r[1]=l+h+p,r[2]=u+d+v,r}function ku(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2];return Math.abs(e-a)<=Fe*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=Fe*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=Fe*Math.max(1,Math.abs(i),Math.abs(o))}var aW=uw,F3=nW,YR=Ta;(function(){var r=Qt();return function(t,e,n,i,a,s){var o,l;for(e||(e=3),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2];return t}})();function na(){var r=new pn(4);return pn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Bu(r,t,e,n){var i=new pn(4);return i[0]=r,i[1]=t,i[2]=e,i[3]=n,i}function sW(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function oW(r,t,e,n,i){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function lW(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e+n*n+i*i+a*a;return s>0&&(s=1/Math.sqrt(s)),r[0]=e*s,r[1]=n*s,r[2]=i*s,r[3]=a*s,r}function Ra(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3];return r[0]=e[0]*n+e[4]*i+e[8]*a+e[12]*s,r[1]=e[1]*n+e[5]*i+e[9]*a+e[13]*s,r[2]=e[2]*n+e[6]*i+e[10]*a+e[14]*s,r[3]=e[3]*n+e[7]*i+e[11]*a+e[15]*s,r}(function(){var r=na();return function(t,e,n,i,a,s){var o,l;for(e||(e=4),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],r[3]=t[o+3],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2],t[o+3]=r[3];return t}})();function En(){var r=new pn(4);return pn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function _s(r,t,e){e=e*.5;var n=Math.sin(e);return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=Math.cos(e),r}function Rs(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],l=e[1],u=e[2],c=e[3];return r[0]=n*c+s*o+i*u-a*l,r[1]=i*c+s*l+a*o-n*u,r[2]=a*c+s*u+n*l-i*o,r[3]=s*c-n*o-i*l-a*u,r}function fv(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=e[0],u=e[1],c=e[2],h=e[3],d,g,p,v,m;return g=i*l+a*u+s*c+o*h,g<0&&(g=-g,l=-l,u=-u,c=-c,h=-h),1-g>Fe?(d=Math.acos(g),p=Math.sin(d),v=Math.sin((1-n)*d)/p,m=Math.sin(n*d)/p):(v=1-n,m=n),r[0]=v*i+m*l,r[1]=v*a+m*u,r[2]=v*s+m*c,r[3]=v*o+m*h,r}function gv(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e+n*n+i*i+a*a,o=s?1/s:0;return r[0]=-e*o,r[1]=-n*o,r[2]=-i*o,r[3]=a*o,r}function uW(r,t){var e=t[0]+t[4]+t[8],n;if(e>0)n=Math.sqrt(e+1),r[3]=.5*n,n=.5/n,r[0]=(t[5]-t[7])*n,r[1]=(t[6]-t[2])*n,r[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[s*3+s]+1),r[i]=.5*n,n=.5/n,r[3]=(t[a*3+s]-t[s*3+a])*n,r[a]=(t[a*3+i]+t[i*3+a])*n,r[s]=(t[s*3+i]+t[i*3+s])*n}return r}function qh(r,t,e,n){var i=.5*Math.PI/180;t*=i,e*=i,n*=i;var a=Math.sin(t),s=Math.cos(t),o=Math.sin(e),l=Math.cos(e),u=Math.sin(n),c=Math.cos(n);return r[0]=a*l*c-s*o*u,r[1]=s*o*c+a*l*u,r[2]=s*l*u-a*o*c,r[3]=s*l*c+a*o*u,r}var cW=Bu,Wh=sW,B3=oW,z3=Rs,gf=lW;(function(){var r=Qt(),t=Ae(1,0,0),e=Ae(0,1,0);return function(n,i,a){var s=ea(i,a);return s<-.999999?(Kd(r,t,i),YR(r)<1e-6&&Kd(r,e,i),ko(r,r),_s(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Kd(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,gf(n,n))}})();(function(){var r=En(),t=En();return function(e,n,i,a,s,o){return fv(r,n,s,o),fv(t,i,a,o),fv(e,r,t,2*o*(1-o)),e}})();(function(){var r=OR();return function(t,e,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-e[0],r[5]=-e[1],r[8]=-e[2],gf(t,uW(t,r))}})();function Ax(){var r=new pn(2);return pn!=Float32Array&&(r[0]=0,r[1]=0),r}function hW(r,t){return r[0]=t[0],r[1]=t[1],r}function dW(r,t,e){return r[0]=t,r[1]=e,r}function fW(r,t){var e=t[0],n=t[1],i=e*e+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=t[0]*i,r[1]=t[1]*i,r}function gW(r,t){return r[0]*t[0]+r[1]*t[1]}function pW(r,t){return r[0]===t[0]&&r[1]===t[1]}(function(){var r=Ax();return function(t,e,n,i,a,s){var o,l;for(e||(e=2),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],a(r,r,s),t[o]=r[0],t[o+1]=r[1];return t}})();var cc=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},vW=function(r,t){return cc(r)?r.indexOf(t)>-1:!1},mW=function(r,t){if(!cc(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];t(i,n)&&e.push(i)}return e},yW=function(r,t){return t===void 0&&(t=[]),mW(r,function(e){return!vW(t,e)})};function Et(r){return typeof r=="function"}function kt(r){return r==null}function Yr(r){return Array.isArray(r)}const un=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function XR(r,t){if(r){var e;if(Yr(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(un(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}var hw=function(r){return typeof r=="object"&&r!==null},bW={}.toString,KR=function(r,t){return bW.call(r)==="[object "+t+"]"},Vl=function(r){if(!hw(r)||!KR(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var t=r;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t};function pf(r){if(!Array.isArray(r))return-1/0;var t=r.length;if(!t)return-1/0;for(var e=r[0],n=1;n<t;n++)e=Math.max(e,r[n]);return e}const vf=function(r){if(Yr(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};var wW=function(r,t,e){if(!Yr(r)&&!Vl(r))return r;var n=e;return XR(r,function(i,a){n=t(n,i,a)}),n};function se(r){return typeof r=="string"}function xW(r,t){t===void 0&&(t=new Map);var e=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];t.has(a)||(e.push(a),t.set(a,!0))}return e}var EW=Object.prototype.hasOwnProperty;function s0(r,t){if(!t||!Yr(r))return{};for(var e={},n=Et(t)?t:function(o){return o[t]},i,a=0;a<r.length;a++){var s=r[a];i=n(s),EW.call(e,i)?e[i].push(s):e[i]=[s]}return e}var Ke=function(r,t,e){return r<t?t:r>e?e:r};function yt(r){return typeof r=="number"}var _W=1e-5;function nc(r,t,e){return e===void 0&&(e=_W),r===t||Math.abs(r-t)<e}const SW=function(r,t){if(Yr(r)){for(var e,n=-1/0,i=0;i<r.length;i++){var a=r[i],s=Et(t)?t(a):a[t];s>n&&(e=a,n=s)}return e}},MW=function(r,t){if(Yr(r)){for(var e,n=1/0,i=0;i<r.length;i++){var a=r[i],s=Et(t)?t(a):a[t];s<n&&(e=a,n=s)}return e}};var ZR=function(r,t){return(r%t+t)%t};const JR=function(r){return kt(r)?"":r.toString()};var kW=function(r){var t=JR(r);return t.charAt(0).toLowerCase()+t.substring(1)};function CW(r,t){return!r||!t?r:r.replace(/\\?\{([^{}]+)\}/g,function(e,n){return e.charAt(0)==="\\"?e.slice(1):t[n]===void 0?"":t[n]})}var mf=function(r){var t=JR(r);return t.charAt(0).toUpperCase()+t.substring(1)},TW={}.toString,OW=function(r){return TW.call(r).replace(/^\[object /,"").replace(/]$/,"")},yf=function(r){return KR(r,"Boolean")};function AW(r){return r instanceof Date}function PW(r){return r===null}var NW=Object.prototype,RW=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||NW;return r===e},Nt=function(r){return r===void 0},$s=function(r){if(typeof r!="object"||r===null)return r;var t;if(Yr(r)){t=[];for(var e=0,n=r.length;e<n;e++)typeof r[e]=="object"&&r[e]!=null?t[e]=$s(r[e]):t[e]=r[e]}else{t={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?t[i]=$s(r[i]):t[i]=r[i]}return t};function Oc(r,t,e){var n;return function(){var i=this,a=arguments,s=function(){n=null,e||r.apply(i,a)},o=e&&!n;clearTimeout(n),n=setTimeout(s,t),o&&r.apply(i,a)}}function LW(r){var t,e,n,i=r||1;function a(o,l){++t>i&&(n=e,s(1),++t),e[o]=l}function s(o){t=0,e=Object.create(null),o||(n=Object.create(null))}return s(),{clear:s,has:function(o){return e[o]!==void 0||n[o]!==void 0},get:function(o){var l=e[o];if(l!==void 0)return l;if((l=n[o])!==void 0)return a(o,l),l},set:function(o,l){e[o]!==void 0?e[o]=l:a(o,l)}}}var pv=new Map;function dw(r,t,e){e===void 0&&(e=128);var n=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=t?t.apply(this,i):i[0];pv.has(r)||pv.set(r,LW(e));var o=pv.get(r);if(o.has(s))return o.get(s);var l=r.apply(this,i);return o.set(s,l),l};return n}var IW=5;function DW(r,t){if(Object.hasOwn)return Object.hasOwn(r,t);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),t)}function QR(r,t,e,n){e=e||0,n=n||IW;for(var i in t)if(DW(t,i)){var a=t[i];a!==null&&Vl(a)?(Vl(r[i])||(r[i]={}),e<n?QR(r[i],a,e+1,n):r[i]=t[i]):Yr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var cr=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)QR(r,t[n]);return r},FW=Object.prototype.hasOwnProperty;function Ji(r){if(kt(r))return!0;if(cc(r))return!r.length;var t=OW(r);if(t==="Map"||t==="Set")return!r.size;if(RW(r))return!Object.keys(r).length;for(var e in r)if(FW.call(r,e))return!1;return!0}var Ze=function(r,t){if(r===t)return!0;if(!r||!t||se(r)||se(t))return!1;if(cc(r)||cc(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n<r.length&&(e=Ze(r[n],t[n]),!!e);n++);return e}if(hw(r)||hw(t)){var i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)return!1;for(var e=!0,n=0;n<i.length&&(e=Ze(r[i[n]],t[i[n]]),!!e);n++);return e}return!1};const sr=function(r,t,e){for(var n=0,i=se(t)?t.split("."):t;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?e:r},hc=function(r,t,e){var n=r,i=se(t)?t.split("."):t;return i.forEach(function(a,s){s<i.length-1?(un(n[a])||(n[a]=yt(i[s+1])?[]:{}),n=n[a]):n[a]=e}),r};var BW=Object.prototype.hasOwnProperty;const Lo=function(r,t){if(r===null||!Vl(r))return{};var e={};return XR(t,function(n){BW.call(r,n)&&(e[n]=r[n])}),e},Px=function(r,t){return wW(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})},tL=function(r,t,e){var n,i,a,s,o=0;e||(e={});var l=function(){o=e.leading===!1?0:Date.now(),n=null,s=r.apply(i,a),n||(i=a=null)},u=function(){var c=Date.now();!o&&e.leading===!1&&(o=c);var h=t-(c-o);return i=this,a=arguments,h<=0||h>t?(n&&(clearTimeout(n),n=null),o=c,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(l,h)),s};return u.cancel=function(){clearTimeout(n),o=0,n=i=a=null},u};var Gh={};const zW=function(r){return r=r||"g",Gh[r]?Gh[r]+=1:Gh[r]=1,r+Gh[r]},vv=function(){},fw=function(r){return r};var gw=function(r,t){return gw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])},gw(r,t)};function Ut(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");gw(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var et=function(){return et=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},et.apply(this,arguments)};function en(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function Ht(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})}function Ac(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return a}function $W(){for(var r=0,t=0,e=arguments.length;t<e;t++)r+=arguments[t].length;for(var n=Array(r),i=0,t=0;t<e;t++)for(var a=arguments[t],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n}function vt(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))}function mv(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)}var eL={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function jW(r,t,e){if(r[e].length>7){r[e].shift();for(var n=r[e],i=e;n.length;)t[e]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(e,1)}}var rc={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function nL(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return rc[e]===t.length-1&&"achlmqstvz".includes(e)})}function rL(r){return nL(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function iL(r){return rL(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function $3(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=rc[e]&&(e==="m"&&n.length>2?(r.segments.push([t].concat(n.splice(0,2))),e="l",t=t==="m"?"l":"L"):r.segments.push([t].concat(n.splice(0,rc[e]))),!!rc[e]););}function qW(r){var t=r.index,e=r.pathValue,n=e.charCodeAt(t);if(n===48){r.param=0,r.index+=1;return}if(n===49){r.param=1,r.index+=1;return}r.err='[path-util]: invalid Arc flag "'.concat(e[t],'", expecting 0 or 1 at index ').concat(t)}function WW(r){return r>=48&&r<=57||r===43||r===45||r===46}function gl(r){return r>=48&&r<=57}function GW(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,l=!1,u;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(u=e.charCodeAt(i),(u===43||u===45)&&(i+=1,u=e.charCodeAt(i)),!gl(u)&&u!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(u!==46){if(a=u===48,i+=1,u=e.charCodeAt(i),a&&i<t&&u&&gl(u)){r.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(e[n],'" illegal number');return}for(;i<t&&gl(e.charCodeAt(i));)i+=1,s=!0;u=e.charCodeAt(i)}if(u===46){for(l=!0,i+=1;gl(e.charCodeAt(i));)i+=1,o=!0;u=e.charCodeAt(i)}if(u===101||u===69){if(l&&!s&&!o){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" invalid float exponent');return}if(i+=1,u=e.charCodeAt(i),(u===43||u===45)&&(i+=1),i<t&&gl(e.charCodeAt(i)))for(;i<t&&gl(e.charCodeAt(i));)i+=1;else{r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" invalid integer exponent');return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function VW(r){var t=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];return r===10||r===13||r===8232||r===8233||r===32||r===9||r===11||r===12||r===160||r>=5760&&t.includes(r)}function Zd(r){for(var t=r.pathValue,e=r.max;r.index<e&&VW(t.charCodeAt(r.index));)r.index+=1}function HW(r){switch(r|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}function UW(r){return(r|32)===97}function YW(r){var t=r.max,e=r.pathValue,n=r.index,i=e.charCodeAt(n),a=rc[e[n].toLowerCase()];if(r.segmentStart=n,!HW(i)){r.err='[path-util]: Invalid path value "'.concat(e[n],'" is not a path command');return}if(r.index+=1,Zd(r),r.data=[],!a){$3(r);return}for(;;){for(var s=a;s>0;s-=1){if(UW(i)&&(s===3||s===4)?qW(r):GW(r),r.err.length)return;r.data.push(r.param),Zd(r),r.index<t&&e.charCodeAt(r.index)===44&&(r.index+=1,Zd(r))}if(r.index>=r.max||!WW(e.charCodeAt(r.index)))break}$3(r)}var XW=function(){function r(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r}();function KW(r){if(nL(r))return[].concat(r);var t=new XW(r);for(Zd(t);t.index<t.max&&!t.err.length;)YW(t);return t.err?t.err:t.segments}function ZW(r){if(rL(r))return[].concat(r);var t=KW(r),e=0,n=0,i=0,a=0;return t.map(function(s){var o=s.slice(1).map(Number),l=s[0],u=l.toUpperCase();if(l==="M")return e=o[0],n=o[1],i=e,a=n,["M",e,n];var c;if(l!==u)switch(u){case"A":c=[u,o[0],o[1],o[2],o[3],o[4],o[5]+e,o[6]+n];break;case"V":c=[u,o[0]+n];break;case"H":c=[u,o[0]+e];break;default:{var h=o.map(function(g,p){return g+(p%2?n:e)});c=[u].concat(h)}}else c=[u].concat(o);var d=c.length;switch(u){case"Z":e=i,n=a;break;case"H":e=c[1];break;case"V":n=c[1];break;default:e=c[d-2],n=c[d-1],u==="M"&&(i=e,a=n)}return c})}function JW(r,t){var e=r[0],n=t.x1,i=t.y1,a=t.x2,s=t.y2,o=r.slice(1).map(Number),l=r;if("TQ".includes(e)||(t.qx=null,t.qy=null),e==="H")l=["L",r[1],i];else if(e==="V")l=["L",n,r[1]];else if(e==="S"){var u=n*2-a,c=i*2-s;t.x1=u,t.y1=c,l=["C",u,c].concat(o)}else if(e==="T"){var h=n*2-t.qx,d=i*2-t.qy;t.qx=h,t.qy=d,l=["Q",h,d].concat(o)}else if(e==="Q"){var g=o[0],p=o[1];t.qx=g,t.qy=p}return l}function bf(r){if(iL(r))return[].concat(r);for(var t=ZW(r),e=et({},eL),n=0;n<t.length;n+=1){t[n]=JW(t[n],e);var i=t[n],a=i.length;e.x1=+i[a-2],e.y1=+i[a-1],e.x2=+i[a-4]||e.x1,e.y2=+i[a-3]||e.y1}return t}function QW(r){return iL(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function Vh(r,t,e){var n=r*Math.cos(e)-t*Math.sin(e),i=r*Math.sin(e)+t*Math.cos(e);return{x:n,y:i}}function Nx(r,t,e,n,i,a,s,o,l,u){var c=r,h=t,d=e,g=n,p=o,v=l,m=Math.PI*120/180,b=Math.PI/180*(+i||0),w=[],x,S,_,k,M;if(u)S=u[0],_=u[1],k=u[2],M=u[3];else{x=Vh(c,h,-b),c=x.x,h=x.y,x=Vh(p,v,-b),p=x.x,v=x.y;var C=(c-p)/2,P=(h-v)/2,T=C*C/(d*d)+P*P/(g*g);T>1&&(T=Math.sqrt(T),d*=T,g*=T);var A=d*d,R=g*g,L=(a===s?-1:1)*Math.sqrt(Math.abs((A*R-A*P*P-R*C*C)/(A*P*P+R*C*C)));k=L*d*P/g+(c+p)/2,M=L*-g*C/d+(h+v)/2,S=Math.asin(((h-M)/g*Math.pow(10,9)>>0)/Math.pow(10,9)),_=Math.asin(((v-M)/g*Math.pow(10,9)>>0)/Math.pow(10,9)),S=c<k?Math.PI-S:S,_=p<k?Math.PI-_:_,S<0&&(S=Math.PI*2+S),_<0&&(_=Math.PI*2+_),s&&S>_&&(S-=Math.PI*2),!s&&_>S&&(_-=Math.PI*2)}var $=_-S;if(Math.abs($)>m){var q=_,j=p,B=v;_=S+m*(s&&_>S?1:-1),p=k+d*Math.cos(_),v=M+g*Math.sin(_),w=Nx(p,v,d,g,i,0,s,j,B,[_,q,k,M])}$=_-S;var F=Math.cos(S),V=Math.sin(S),X=Math.cos(_),K=Math.sin(_),nt=Math.tan($/4),ot=4/3*d*nt,ct=4/3*g*nt,ht=[c,h],pt=[c+ot*V,h-ct*F],wt=[p+ot*K,v-ct*X],zt=[p,v];if(pt[0]=2*ht[0]-pt[0],pt[1]=2*ht[1]-pt[1],u)return pt.concat(wt,zt,w);w=pt.concat(wt,zt,w);for(var Wt=[],Te=0,Ge=w.length;Te<Ge;Te+=1)Wt[Te]=Te%2?Vh(w[Te-1],w[Te],b).y:Vh(w[Te],w[Te+1],b).x;return Wt}function tG(r,t,e,n,i,a){var s=.3333333333333333,o=2/3;return[s*r+o*e,s*t+o*n,s*i+o*e,s*a+o*n,i,a]}function ys(r,t,e){var n=r[0],i=r[1],a=t[0],s=t[1];return[n+(a-n)*e,i+(s-i)*e]}var j3=function(r,t,e,n){var i=.5,a=ys([r,t],[e,n],i);return vt(vt([],a,!0),[e,n,e,n],!1)};function eG(r,t){var e=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],s,o=t.x1,l=t.y1,u=t.x,c=t.y;switch("TQ".includes(e)||(t.qx=null,t.qy=null),e){case"M":return t.x=i,t.y=a,r;case"A":return s=[o,l].concat(n),["C"].concat(Nx(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]));case"Q":return t.qx=i,t.qy=a,s=[o,l].concat(n),["C"].concat(tG(s[0],s[1],s[2],s[3],s[4],s[5]));case"L":return["C"].concat(j3(o,l,i,a));case"Z":return o===u&&l===c?["C",o,l,u,c,u,c]:["C"].concat(j3(o,l,u,c))}return r}function pw(r,t){if(t===void 0&&(t=!1),QW(r)){var e=[].concat(r);return t?[e,[]]:e}for(var n=bf(r),i=et({},eL),a=[],s="",o=n.length,l,u,c=[],h=0;h<o;h+=1){n[h]&&(s=n[h][0]),a[h]=s;var d=eG(n[h],i);n[h]=d,jW(n,a,h),o=n.length,s==="Z"&&c.push(h),l=n[h],u=l.length,i.x1=+l[u-2],i.y1=+l[u-1],i.x2=+l[u-4]||i.x1,i.y2=+l[u-3]||i.y1}return t?[n,c]:n}function nG(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function rG(r){var t=r.slice(1).map(function(e,n,i){return n?i[n-1].slice(-2).concat(e.slice(1)):r[0].slice(1).concat(e.slice(1))}).map(function(e){return e.map(function(n,i){return e[e.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(function(e){return["C"].concat(e.slice(2))}))}function br(r,t){return Math.sqrt((r[0]-t[0])*(r[0]-t[0])+(r[1]-t[1])*(r[1]-t[1]))}function vw(r,t,e,n,i){var a=br([r,t],[e,n]),s={x:0,y:0};if(typeof i=="number")if(i<=0)s={x:r,y:t};else if(i>=a)s={x:e,y:n};else{var o=ys([r,t],[e,n],i/a),l=o[0],u=o[1];s={x:l,y:u}}return{length:a,point:s,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function q3(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,s=e*i+n*a,o=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),l=e*a-n*i<0?-1:1,u=l*Math.acos(s/o);return u}function iG(r,t,e,n,i,a,s,o,l,u){var c=Math.abs,h=Math.sin,d=Math.cos,g=Math.sqrt,p=Math.PI,v=c(e),m=c(n),b=(i%360+360)%360,w=b*(p/180);if(r===o&&t===l)return{x:r,y:t};if(v===0||m===0)return vw(r,t,o,l,u).point;var x=(r-o)/2,S=(t-l)/2,_={x:d(w)*x+h(w)*S,y:-h(w)*x+d(w)*S},k=Math.pow(_.x,2)/Math.pow(v,2)+Math.pow(_.y,2)/Math.pow(m,2);k>1&&(v*=g(k),m*=g(k));var M=Math.pow(v,2)*Math.pow(m,2)-Math.pow(v,2)*Math.pow(_.y,2)-Math.pow(m,2)*Math.pow(_.x,2),C=Math.pow(v,2)*Math.pow(_.y,2)+Math.pow(m,2)*Math.pow(_.x,2),P=M/C;P=P<0?0:P;var T=(a!==s?1:-1)*g(P),A={x:T*(v*_.y/m),y:T*(-(m*_.x)/v)},R={x:d(w)*A.x-h(w)*A.y+(r+o)/2,y:h(w)*A.x+d(w)*A.y+(t+l)/2},L={x:(_.x-A.x)/v,y:(_.y-A.y)/m},$=q3({x:1,y:0},L),q={x:(-_.x-A.x)/v,y:(-_.y-A.y)/m},j=q3(L,q);!s&&j>0?j-=2*p:s&&j<0&&(j+=2*p),j%=2*p;var B=$+j*u,F=v*d(B),V=m*h(B),X={x:d(w)*F-h(w)*V+R.x,y:h(w)*F+d(w)*V+R.y};return X}function aG(r,t,e,n,i,a,s,o,l,u,c){var h,d=c.bbox,g=d===void 0?!0:d,p=c.length,v=p===void 0?!0:p,m=c.sampleSize,b=m===void 0?30:m,w=typeof u=="number",x=r,S=t,_=0,k=[x,S,_],M=[x,S],C=0,P={x:0,y:0},T=[{x,y:S}];w&&u<=0&&(P={x,y:S});for(var A=0;A<=b;A+=1){if(C=A/b,h=iG(r,t,e,n,i,a,s,o,l,C),x=h.x,S=h.y,g&&T.push({x,y:S}),v&&(_+=br(M,[x,S])),M=[x,S],w&&_>=u&&u>k[2]){var R=(_-u)/(_-k[2]);P={x:M[0]*(1-R)+k[0]*R,y:M[1]*(1-R)+k[1]*R}}k=[x,S,_]}return w&&u>=_&&(P={x:o,y:l}),{length:_,point:P,min:{x:Math.min.apply(null,T.map(function(L){return L.x})),y:Math.min.apply(null,T.map(function(L){return L.y}))},max:{x:Math.max.apply(null,T.map(function(L){return L.x})),y:Math.max.apply(null,T.map(function(L){return L.y}))}}}function sG(r,t,e,n,i,a,s,o,l){var u=1-l;return{x:Math.pow(u,3)*r+3*Math.pow(u,2)*l*e+3*u*Math.pow(l,2)*i+Math.pow(l,3)*s,y:Math.pow(u,3)*t+3*Math.pow(u,2)*l*n+3*u*Math.pow(l,2)*a+Math.pow(l,3)*o}}function aL(r,t,e,n,i,a,s,o,l,u){var c,h=u.bbox,d=h===void 0?!0:h,g=u.length,p=g===void 0?!0:g,v=u.sampleSize,m=v===void 0?10:v,b=typeof l=="number",w=r,x=t,S=0,_=[w,x,S],k=[w,x],M=0,C={x:0,y:0},P=[{x:w,y:x}];b&&l<=0&&(C={x:w,y:x});for(var T=0;T<=m;T+=1){if(M=T/m,c=sG(r,t,e,n,i,a,s,o,M),w=c.x,x=c.y,d&&P.push({x:w,y:x}),p&&(S+=br(k,[w,x])),k=[w,x],b&&S>=l&&l>_[2]){var A=(S-l)/(S-_[2]);C={x:k[0]*(1-A)+_[0]*A,y:k[1]*(1-A)+_[1]*A}}_=[w,x,S]}return b&&l>=S&&(C={x:s,y:o}),{length:S,point:C,min:{x:Math.min.apply(null,P.map(function(R){return R.x})),y:Math.min.apply(null,P.map(function(R){return R.y}))},max:{x:Math.max.apply(null,P.map(function(R){return R.x})),y:Math.max.apply(null,P.map(function(R){return R.y}))}}}function oG(r,t,e,n,i,a,s){var o=1-s;return{x:Math.pow(o,2)*r+2*o*s*e+Math.pow(s,2)*i,y:Math.pow(o,2)*t+2*o*s*n+Math.pow(s,2)*a}}function lG(r,t,e,n,i,a,s,o){var l,u=o.bbox,c=u===void 0?!0:u,h=o.length,d=h===void 0?!0:h,g=o.sampleSize,p=g===void 0?10:g,v=typeof s=="number",m=r,b=t,w=0,x=[m,b,w],S=[m,b],_=0,k={x:0,y:0},M=[{x:m,y:b}];v&&s<=0&&(k={x:m,y:b});for(var C=0;C<=p;C+=1){if(_=C/p,l=oG(r,t,e,n,i,a,_),m=l.x,b=l.y,c&&M.push({x:m,y:b}),d&&(w+=br(S,[m,b])),S=[m,b],v&&w>=s&&s>x[2]){var P=(w-s)/(w-x[2]);k={x:S[0]*(1-P)+x[0]*P,y:S[1]*(1-P)+x[1]*P}}x=[m,b,w]}return v&&s>=w&&(k={x:i,y:a}),{length:w,point:k,min:{x:Math.min.apply(null,M.map(function(T){return T.x})),y:Math.min.apply(null,M.map(function(T){return T.y}))},max:{x:Math.max.apply(null,M.map(function(T){return T.x})),y:Math.max.apply(null,M.map(function(T){return T.y}))}}}function sL(r,t,e){for(var n,i,a,s,o,l,u=bf(r),c=typeof t=="number",h,d=[],g,p=0,v=0,m=0,b=0,w,x=[],S=[],_=0,k={x:0,y:0},M=k,C=k,P=k,T=0,A=0,R=u.length;A<R;A+=1)w=u[A],g=w[0],h=g==="M",d=h?d:[p,v].concat(w.slice(1)),h?(m=w[1],b=w[2],k={x:m,y:b},M=k,_=0,c&&t<.001&&(P=k)):g==="L"?(n=vw(d[0],d[1],d[2],d[3],(t||0)-T),_=n.length,k=n.min,M=n.max,C=n.point):g==="A"?(i=aG(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],(t||0)-T,e||{}),_=i.length,k=i.min,M=i.max,C=i.point):g==="C"?(a=aL(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],(t||0)-T,e||{}),_=a.length,k=a.min,M=a.max,C=a.point):g==="Q"?(s=lG(d[0],d[1],d[2],d[3],d[4],d[5],(t||0)-T,e||{}),_=s.length,k=s.min,M=s.max,C=s.point):g==="Z"&&(d=[p,v,m,b],o=vw(d[0],d[1],d[2],d[3],(t||0)-T),_=o.length,k=o.min,M=o.max,C=o.point),c&&T<t&&T+_>=t&&(P=C),S.push(M),x.push(k),T+=_,l=g!=="Z"?w.slice(-2):[m,b],p=l[0],v=l[1];return c&&t>=T&&(P={x:p,y:v}),{length:T,point:P,min:{x:Math.min.apply(null,x.map(function(L){return L.x})),y:Math.min.apply(null,x.map(function(L){return L.y}))},max:{x:Math.max.apply(null,S.map(function(L){return L.x})),y:Math.max.apply(null,S.map(function(L){return L.y}))}}}function uG(r,t){return sL(r,void 0,et(et({},t),{bbox:!1,length:!0})).length}function cG(r){var t=r.length,e=t-1;return r.map(function(n,i){return r.map(function(a,s){var o=i+s,l;return s===0||r[o]&&r[o][0]==="M"?(l=r[o],["M"].concat(l.slice(-2))):(o>=t&&(o-=e),r[o])})})}function hG(r,t){var e=r.length-1,n=[],i=0,a=0,s=cG(r);return s.forEach(function(o,l){r.slice(1).forEach(function(u,c){a+=br(r[(l+c)%e].slice(-2),t[c%e].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}function dG(r,t,e,n,i,a,s,o){return 3*((o-t)*(e+i)-(s-r)*(n+a)+n*(r-i)-e*(t-a)+o*(i+r/3)-s*(a+t/3))/20}function fG(r){var t=0,e=0,n=0;return pw(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=i[2],0;default:var s=i.slice(1),o=s[0],l=s[1],u=s[2],c=s[3],h=s[4],d=s[5];return n=dG(t,e,o,l,u,c,h,d),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function W3(r){return fG(r)>=0}function gG(r,t,e){return sL(r,t,et(et({},e),{bbox:!1,length:!0})).point}function pG(r,t){t===void 0&&(t=.5);var e=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),s=ys(e,n,t),o=ys(n,i,t),l=ys(i,a,t),u=ys(s,o,t),c=ys(o,l,t),h=ys(u,c,t);return[["C"].concat(s,u,h),["C"].concat(c,l,a)]}function G3(r){return r.map(function(t,e,n){var i=e&&n[e-1].slice(-2).concat(t.slice(1)),a=e?aL(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,s;return e?s=a?pG(i):[t,t]:s=[t],{s:t,ss:s,l:a}})}function oL(r,t,e){var n=G3(r),i=G3(t),a=n.length,s=i.length,o=n.filter(function(m){return m.l}).length,l=i.filter(function(m){return m.l}).length,u=n.filter(function(m){return m.l}).reduce(function(m,b){var w=b.l;return m+w},0)/o||0,c=i.filter(function(m){return m.l}).reduce(function(m,b){var w=b.l;return m+w},0)/l||0,h=e||Math.max(a,s),d=[u,c],g=[h-a,h-s],p=0,v=[n,i].map(function(m,b){return m.l===h?m.map(function(w){return w.s}):m.map(function(w,x){return p=x&&g[b]&&w.l>=d[b],g[b]-=p?1:0,p?w.ss:[w.s]}).flat()});return v[0].length===v[1].length?v:oL(v[0],v[1],h)}function mw(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function vG(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=cf(r))!==null;);return r}function yw(){return yw=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=vG(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},yw.apply(null,arguments)}function V3(r,t,e,n){var i=yw(cf(r.prototype),t,e);return typeof i=="function"?function(a){return i.apply(e,a)}:i}function za(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function lL(r,t){var e=Math.min.apply(Math,vt([],z(r),!1)),n=Math.min.apply(Math,vt([],z(t),!1)),i=Math.max.apply(Math,vt([],z(r),!1)),a=Math.max.apply(Math,vt([],z(t),!1));return{x:e,y:n,width:i-e,height:a-n}}function mG(r,t,e){return Math.atan(-t/r*Math.tan(e))}function yG(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function bG(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function wG(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function xG(r,t,e,n,i,a,s){for(var o=mG(e,n,i),l=1/0,u=-1/0,c=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var d=o+h;a<s?a<d&&d<s&&c.push(d):s<d&&d<a&&c.push(d)}for(var h=0;h<c.length;h++){var g=bG(r,t,e,n,i,c[h]);g<l&&(l=g),g>u&&(u=g)}for(var p=yG(e,n,i),v=1/0,m=-1/0,b=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var w=p+h;a<s?a<w&&w<s&&b.push(w):s<w&&w<a&&b.push(w)}for(var h=0;h<b.length;h++){var x=wG(r,t,e,n,i,b[h]);x<v&&(v=x),x>m&&(m=x)}return{x:l,y:v,width:u-l,height:m-v}}var EG=1e-4;function uL(r,t,e,n,i,a){var s=-1,o=1/0,l=[e,n],u=20;a&&a>200&&(u=a/10);for(var c=1/u,h=c/10,d=0;d<=u;d++){var g=d*c,p=[i.apply(void 0,vt([],z(r.concat([g])),!1)),i.apply(void 0,vt([],z(t.concat([g])),!1))],v=za(l[0],l[1],p[0],p[1]);v<o&&(s=g,o=v)}if(s===0)return{x:r[0],y:t[0]};if(s===1){var m=r.length;return{x:r[m-1],y:t[m-1]}}o=1/0;for(var d=0;d<32&&!(h<EG);d++){var b=s-h,w=s+h,p=[i.apply(void 0,vt([],z(r.concat([b])),!1)),i.apply(void 0,vt([],z(t.concat([b])),!1))],v=za(l[0],l[1],p[0],p[1]);if(b>=0&&v<o)s=b,o=v;else{var x=[i.apply(void 0,vt([],z(r.concat([w])),!1)),i.apply(void 0,vt([],z(t.concat([w])),!1))],S=za(l[0],l[1],x[0],x[1]);w<=1&&S<o?(s=w,o=S):h*=.5}}return{x:i.apply(void 0,vt([],z(r.concat([s])),!1)),y:i.apply(void 0,vt([],z(t.concat([s])),!1))}}function cL(r,t,e,n){return za(r,t,e,n)}function hL(r,t,e,n,i){return{x:(1-i)*r+i*e,y:(1-i)*t+i*n}}function _G(r,t,e,n,i,a){var s=[e-r,n-t];if(pW(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];fW(o,o);var l=[i-r,a-t];return Math.abs(gW(l,o))}function bw(r,t,e,n,i){var a=1-i;return a*a*a*r+3*t*i*a*a+3*e*i*i*a+n*i*i*i}function H3(r,t,e,n){var i=-3*r+9*t-9*e+3*n,a=6*r-12*t+6*e,s=3*t-3*r,o=[],l,u,c;if(nc(i,0))nc(a,0)||(l=-s/a,l>=0&&l<=1&&o.push(l));else{var h=a*a-4*i*s;nc(h,0)?o.push(-a/(2*i)):h>0&&(c=Math.sqrt(h),l=(-a+c)/(2*i),u=(-a-c)/(2*i),l>=0&&l<=1&&o.push(l),u>=0&&u<=1&&o.push(u))}return o}function SG(r,t,e,n,i,a,s,o){for(var l=[r,s],u=[t,o],c=H3(r,e,i,s),h=H3(t,n,a,o),d=0;d<c.length;d++)l.push(bw(r,e,i,s,c[d]));for(var d=0;d<h.length;d++)u.push(bw(t,n,a,o,h[d]));return lL(l,u)}function MG(r,t,e,n,i,a,s,o,l,u,c){return uL([r,e,i,s],[t,n,a,o],l,u,bw,c)}function U3(r,t,e,n,i,a,s,o,l,u,c){var h=MG(r,t,e,n,i,a,s,o,l,u,c);return za(h.x,h.y,l,u)}function kG(r){if(r.length<2)return 0;for(var t=0,e=0;e<r.length-1;e++){var n=r[e],i=r[e+1];t+=za(n[0],n[1],i[0],i[1])}return t}function CG(r){return kG(r)}function ww(r,t,e,n){var i=1-n;return i*i*r+2*n*i*t+n*n*e}function Y3(r,t,e){var n=r+e-2*t;if(nc(n,0))return[.5];var i=(r-t)/n;return i<=1&&i>=0?[i]:[]}function TG(r,t,e,n,i,a){var s=Y3(r,e,i)[0],o=Y3(t,n,a)[0],l=[r,i],u=[t,a];return s!==void 0&&l.push(ww(r,e,i,s)),o!==void 0&&u.push(ww(t,n,a,o)),lL(l,u)}function OG(r,t,e,n,i,a,s,o){return uL([r,e,i],[t,n,a],s,o,ww)}function AG(r,t,e,n,i,a,s,o){var l=OG(r,t,e,n,i,a,s,o);return za(l.x,l.y,s,o)}function qn(){qn=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(j,B,F){j[B]=F.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(j,B,F){return Object.defineProperty(j,B,{value:F,enumerable:!0,configurable:!0,writable:!0}),j[B]}try{u({},"")}catch{u=function(F,V,X){return F[V]=X}}function c(j,B,F,V){var X=B&&B.prototype instanceof b?B:b,K=Object.create(X.prototype),nt=new $(V||[]);return i(K,"_invoke",{value:T(j,F,nt)}),K}function h(j,B,F){try{return{type:"normal",arg:j.call(B,F)}}catch(V){return{type:"throw",arg:V}}}t.wrap=c;var d="suspendedStart",g="suspendedYield",p="executing",v="completed",m={};function b(){}function w(){}function x(){}var S={};u(S,s,function(){return this});var _=Object.getPrototypeOf,k=_&&_(_(q([])));k&&k!==e&&n.call(k,s)&&(S=k);var M=x.prototype=b.prototype=Object.create(S);function C(j){["next","throw","return"].forEach(function(B){u(j,B,function(F){return this._invoke(B,F)})})}function P(j,B){function F(X,K,nt,ot){var ct=h(j[X],j,K);if(ct.type!=="throw"){var ht=ct.arg,pt=ht.value;return pt&&P3(pt)=="object"&&n.call(pt,"__await")?B.resolve(pt.__await).then(function(wt){F("next",wt,nt,ot)},function(wt){F("throw",wt,nt,ot)}):B.resolve(pt).then(function(wt){ht.value=wt,nt(ht)},function(wt){return F("throw",wt,nt,ot)})}ot(ct.arg)}var V;i(this,"_invoke",{value:function(K,nt){function ot(){return new B(function(ct,ht){F(K,nt,ct,ht)})}return V=V?V.then(ot,ot):ot()}})}function T(j,B,F){var V=d;return function(X,K){if(V===p)throw Error("Generator is already running");if(V===v){if(X==="throw")throw K;return{value:r,done:!0}}for(F.method=X,F.arg=K;;){var nt=F.delegate;if(nt){var ot=A(nt,F);if(ot){if(ot===m)continue;return ot}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if(V===d)throw V=v,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);V=p;var ct=h(j,B,F);if(ct.type==="normal"){if(V=F.done?v:g,ct.arg===m)continue;return{value:ct.arg,done:F.done}}ct.type==="throw"&&(V=v,F.method="throw",F.arg=ct.arg)}}}function A(j,B){var F=B.method,V=j.iterator[F];if(V===r)return B.delegate=null,F==="throw"&&j.iterator.return&&(B.method="return",B.arg=r,A(j,B),B.method==="throw")||F!=="return"&&(B.method="throw",B.arg=new TypeError("The iterator does not provide a '"+F+"' method")),m;var X=h(V,j.iterator,B.arg);if(X.type==="throw")return B.method="throw",B.arg=X.arg,B.delegate=null,m;var K=X.arg;return K?K.done?(B[j.resultName]=K.value,B.next=j.nextLoc,B.method!=="return"&&(B.method="next",B.arg=r),B.delegate=null,m):K:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,m)}function R(j){var B={tryLoc:j[0]};1 in j&&(B.catchLoc=j[1]),2 in j&&(B.finallyLoc=j[2],B.afterLoc=j[3]),this.tryEntries.push(B)}function L(j){var B=j.completion||{};B.type="normal",delete B.arg,j.completion=B}function $(j){this.tryEntries=[{tryLoc:"root"}],j.forEach(R,this),this.reset(!0)}function q(j){if(j||j===""){var B=j[s];if(B)return B.call(j);if(typeof j.next=="function")return j;if(!isNaN(j.length)){var F=-1,V=function X(){for(;++F<j.length;)if(n.call(j,F))return X.value=j[F],X.done=!1,X;return X.value=r,X.done=!0,X};return V.next=V}}throw new TypeError(P3(j)+" is not iterable")}return w.prototype=x,i(M,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=u(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(j){var B=typeof j=="function"&&j.constructor;return!!B&&(B===w||(B.displayName||B.name)==="GeneratorFunction")},t.mark=function(j){return Object.setPrototypeOf?Object.setPrototypeOf(j,x):(j.__proto__=x,u(j,l,"GeneratorFunction")),j.prototype=Object.create(M),j},t.awrap=function(j){return{__await:j}},C(P.prototype),u(P.prototype,o,function(){return this}),t.AsyncIterator=P,t.async=function(j,B,F,V,X){X===void 0&&(X=Promise);var K=new P(c(j,B,F,V),X);return t.isGeneratorFunction(B)?K:K.next().then(function(nt){return nt.done?nt.value:K.next()})},C(M),u(M,l,"Generator"),u(M,s,function(){return this}),u(M,"toString",function(){return"[object Generator]"}),t.keys=function(j){var B=Object(j),F=[];for(var V in B)F.push(V);return F.reverse(),function X(){for(;F.length;){var K=F.pop();if(K in B)return X.value=K,X.done=!1,X}return X.done=!0,X}},t.values=q,$.prototype={constructor:$,reset:function(B){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(L),!B)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=r)},stop:function(){this.done=!0;var B=this.tryEntries[0].completion;if(B.type==="throw")throw B.arg;return this.rval},dispatchException:function(B){if(this.done)throw B;var F=this;function V(ht,pt){return nt.type="throw",nt.arg=B,F.next=ht,pt&&(F.method="next",F.arg=r),!!pt}for(var X=this.tryEntries.length-1;X>=0;--X){var K=this.tryEntries[X],nt=K.completion;if(K.tryLoc==="root")return V("end");if(K.tryLoc<=this.prev){var ot=n.call(K,"catchLoc"),ct=n.call(K,"finallyLoc");if(ot&&ct){if(this.prev<K.catchLoc)return V(K.catchLoc,!0);if(this.prev<K.finallyLoc)return V(K.finallyLoc)}else if(ot){if(this.prev<K.catchLoc)return V(K.catchLoc,!0)}else{if(!ct)throw Error("try statement without catch or finally");if(this.prev<K.finallyLoc)return V(K.finallyLoc)}}}},abrupt:function(B,F){for(var V=this.tryEntries.length-1;V>=0;--V){var X=this.tryEntries[V];if(X.tryLoc<=this.prev&&n.call(X,"finallyLoc")&&this.prev<X.finallyLoc){var K=X;break}}K&&(B==="break"||B==="continue")&&K.tryLoc<=F&&F<=K.finallyLoc&&(K=null);var nt=K?K.completion:{};return nt.type=B,nt.arg=F,K?(this.method="next",this.next=K.finallyLoc,m):this.complete(nt)},complete:function(B,F){if(B.type==="throw")throw B.arg;return B.type==="break"||B.type==="continue"?this.next=B.arg:B.type==="return"?(this.rval=this.arg=B.arg,this.method="return",this.next="end"):B.type==="normal"&&F&&(this.next=F),m},finish:function(B){for(var F=this.tryEntries.length-1;F>=0;--F){var V=this.tryEntries[F];if(V.finallyLoc===B)return this.complete(V.completion,V.afterLoc),L(V),m}},catch:function(B){for(var F=this.tryEntries.length-1;F>=0;--F){var V=this.tryEntries[F];if(V.tryLoc===B){var X=V.completion;if(X.type==="throw"){var K=X.arg;L(V)}return K}}throw Error("illegal catch attempt")},delegateYield:function(B,F,V){return this.delegate={iterator:q(B),resultName:F,nextLoc:V},this.method==="next"&&(this.arg=r),m}},t}function yo(r,t){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=_j(r))||t){e&&(r=e);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){e=e.call(r)},n:function(){var u=e.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||e.return==null||e.return()}finally{if(o)throw a}}}}function PG(r,t){if(r==null)return{};var e={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(t.indexOf(n)!==-1)continue;e[n]=r[n]}return e}function Wo(r,t){if(r==null)return{};var e,n,i=PG(r,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(n=0;n<a.length;n++)e=a[n],t.indexOf(e)===-1&&{}.propertyIsEnumerable.call(r,e)&&(i[e]=r[e])}return i}/*!
- * @antv/g-lite
- * @description A core module for rendering engine implements DOM API.
- * @version 2.2.16
- * @date 1/23/2025, 8:31:51 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var NG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dL={exports:{}};(function(r,t){(function(e,n){r.exports=n()})(NG,function(){function e(_,k,M,C,P){n(_,k,M||0,C||_.length-1,P||a)}function n(_,k,M,C,P){for(;C>M;){if(C-M>600){var T=C-M+1,A=k-M+1,R=Math.log(T),L=.5*Math.exp(2*R/3),$=.5*Math.sqrt(R*L*(T-L)/T)*(A-T/2<0?-1:1),q=Math.max(M,Math.floor(k-A*L/T+$)),j=Math.min(C,Math.floor(k+(T-A)*L/T+$));n(_,k,q,j,P)}var B=_[k],F=M,V=C;for(i(_,M,k),P(_[C],B)>0&&i(_,M,C);F<V;){for(i(_,F,V),F++,V--;P(_[F],B)<0;)F++;for(;P(_[V],B)>0;)V--}P(_[M],B)===0?i(_,M,V):(V++,i(_,V,C)),V<=k&&(M=V+1),k<=V&&(C=V-1)}}function i(_,k,M){var C=_[k];_[k]=_[M],_[M]=C}function a(_,k){return _<k?-1:_>k?1:0}var s=function(k){k===void 0&&(k=9),this._maxEntries=Math.max(4,k),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(k){var M=this.data,C=[];if(!w(k,M))return C;for(var P=this.toBBox,T=[];M;){for(var A=0;A<M.children.length;A++){var R=M.children[A],L=M.leaf?P(R):R;w(k,L)&&(M.leaf?C.push(R):b(k,L)?this._all(R,C):T.push(R))}M=T.pop()}return C},s.prototype.collides=function(k){var M=this.data;if(!w(k,M))return!1;for(var C=[];M;){for(var P=0;P<M.children.length;P++){var T=M.children[P],A=M.leaf?this.toBBox(T):T;if(w(k,A)){if(M.leaf||b(k,A))return!0;C.push(T)}}M=C.pop()}return!1},s.prototype.load=function(k){if(!(k&&k.length))return this;if(k.length<this._minEntries){for(var M=0;M<k.length;M++)this.insert(k[M]);return this}var C=this._build(k.slice(),0,k.length-1,0);if(!this.data.children.length)this.data=C;else if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var P=this.data;this.data=C,C=P}this._insert(C,this.data.height-C.height-1,!0)}return this},s.prototype.insert=function(k){return k&&this._insert(k,this.data.height-1),this},s.prototype.clear=function(){return this.data=x([]),this},s.prototype.remove=function(k,M){if(!k)return this;for(var C=this.data,P=this.toBBox(k),T=[],A=[],R,L,$;C||T.length;){if(C||(C=T.pop(),L=T[T.length-1],R=A.pop(),$=!0),C.leaf){var q=o(k,C.children,M);if(q!==-1)return C.children.splice(q,1),T.push(C),this._condense(T),this}!$&&!C.leaf&&b(C,P)?(T.push(C),A.push(R),R=0,L=C,C=C.children[0]):L?(R++,C=L.children[R],$=!1):C=null}return this},s.prototype.toBBox=function(k){return k},s.prototype.compareMinX=function(k,M){return k.minX-M.minX},s.prototype.compareMinY=function(k,M){return k.minY-M.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(k){return this.data=k,this},s.prototype._all=function(k,M){for(var C=[];k;)k.leaf?M.push.apply(M,k.children):C.push.apply(C,k.children),k=C.pop();return M},s.prototype._build=function(k,M,C,P){var T=C-M+1,A=this._maxEntries,R;if(T<=A)return R=x(k.slice(M,C+1)),l(R,this.toBBox),R;P||(P=Math.ceil(Math.log(T)/Math.log(A)),A=Math.ceil(T/Math.pow(A,P-1))),R=x([]),R.leaf=!1,R.height=P;var L=Math.ceil(T/A),$=L*Math.ceil(Math.sqrt(A));S(k,M,C,$,this.compareMinX);for(var q=M;q<=C;q+=$){var j=Math.min(q+$-1,C);S(k,q,j,L,this.compareMinY);for(var B=q;B<=j;B+=L){var F=Math.min(B+L-1,j);R.children.push(this._build(k,B,F,P-1))}}return l(R,this.toBBox),R},s.prototype._chooseSubtree=function(k,M,C,P){for(;P.push(M),!(M.leaf||P.length-1===C);){for(var T=1/0,A=1/0,R=void 0,L=0;L<M.children.length;L++){var $=M.children[L],q=g($),j=v(k,$)-q;j<A?(A=j,T=q<T?q:T,R=$):j===A&&q<T&&(T=q,R=$)}M=R||M.children[0]}return M},s.prototype._insert=function(k,M,C){var P=C?k:this.toBBox(k),T=[],A=this._chooseSubtree(P,this.data,M,T);for(A.children.push(k),c(A,P);M>=0&&T[M].children.length>this._maxEntries;)this._split(T,M),M--;this._adjustParentBBoxes(P,T,M)},s.prototype._split=function(k,M){var C=k[M],P=C.children.length,T=this._minEntries;this._chooseSplitAxis(C,T,P);var A=this._chooseSplitIndex(C,T,P),R=x(C.children.splice(A,C.children.length-A));R.height=C.height,R.leaf=C.leaf,l(C,this.toBBox),l(R,this.toBBox),M?k[M-1].children.push(R):this._splitRoot(C,R)},s.prototype._splitRoot=function(k,M){this.data=x([k,M]),this.data.height=k.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(k,M,C){for(var P,T=1/0,A=1/0,R=M;R<=C-M;R++){var L=u(k,0,R,this.toBBox),$=u(k,R,C,this.toBBox),q=m(L,$),j=g(L)+g($);q<T?(T=q,P=R,A=j<A?j:A):q===T&&j<A&&(A=j,P=R)}return P||C-M},s.prototype._chooseSplitAxis=function(k,M,C){var P=k.leaf?this.compareMinX:h,T=k.leaf?this.compareMinY:d,A=this._allDistMargin(k,M,C,P),R=this._allDistMargin(k,M,C,T);A<R&&k.children.sort(P)},s.prototype._allDistMargin=function(k,M,C,P){k.children.sort(P);for(var T=this.toBBox,A=u(k,0,M,T),R=u(k,C-M,C,T),L=p(A)+p(R),$=M;$<C-M;$++){var q=k.children[$];c(A,k.leaf?T(q):q),L+=p(A)}for(var j=C-M-1;j>=M;j--){var B=k.children[j];c(R,k.leaf?T(B):B),L+=p(R)}return L},s.prototype._adjustParentBBoxes=function(k,M,C){for(var P=C;P>=0;P--)c(M[P],k)},s.prototype._condense=function(k){for(var M=k.length-1,C=void 0;M>=0;M--)k[M].children.length===0?M>0?(C=k[M-1].children,C.splice(C.indexOf(k[M]),1)):this.clear():l(k[M],this.toBBox)};function o(_,k,M){if(!M)return k.indexOf(_);for(var C=0;C<k.length;C++)if(M(_,k[C]))return C;return-1}function l(_,k){u(_,0,_.children.length,k,_)}function u(_,k,M,C,P){P||(P=x(null)),P.minX=1/0,P.minY=1/0,P.maxX=-1/0,P.maxY=-1/0;for(var T=k;T<M;T++){var A=_.children[T];c(P,_.leaf?C(A):A)}return P}function c(_,k){return _.minX=Math.min(_.minX,k.minX),_.minY=Math.min(_.minY,k.minY),_.maxX=Math.max(_.maxX,k.maxX),_.maxY=Math.max(_.maxY,k.maxY),_}function h(_,k){return _.minX-k.minX}function d(_,k){return _.minY-k.minY}function g(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function p(_){return _.maxX-_.minX+(_.maxY-_.minY)}function v(_,k){return(Math.max(k.maxX,_.maxX)-Math.min(k.minX,_.minX))*(Math.max(k.maxY,_.maxY)-Math.min(k.minY,_.minY))}function m(_,k){var M=Math.max(_.minX,k.minX),C=Math.max(_.minY,k.minY),P=Math.min(_.maxX,k.maxX),T=Math.min(_.maxY,k.maxY);return Math.max(0,P-M)*Math.max(0,T-C)}function b(_,k){return _.minX<=k.minX&&_.minY<=k.minY&&k.maxX<=_.maxX&&k.maxY<=_.maxY}function w(_,k){return k.minX<=_.maxX&&k.minY<=_.maxY&&k.maxX>=_.minX&&k.maxY>=_.minY}function x(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function S(_,k,M,C,P){for(var T=[k,M];T.length;)if(M=T.pop(),k=T.pop(),!(M-k<=C)){var A=k+Math.ceil((M-k)/C/2)*C;e(_,A,k,M,P),T.push(k,A,A,M)}}return s})})(dL);var RG=dL.exports,Q=function(r){return r.GROUP="g",r.FRAGMENT="fragment",r.CIRCLE="circle",r.ELLIPSE="ellipse",r.IMAGE="image",r.RECT="rect",r.LINE="line",r.POLYLINE="polyline",r.POLYGON="polygon",r.TEXT="text",r.PATH="path",r.HTML="html",r.MESH="mesh",r}({}),Jd=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),Us=function(){function r(){st(this,r),this.plugins=[]}return at(r,[{key:"addRenderingPlugin",value:function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)}},{key:"removeAllRenderingPlugins",value:function(){var e=this;this.plugins.forEach(function(n){var i=e.context.renderingPlugins.indexOf(n);i>=0&&e.context.renderingPlugins.splice(i,1)})}}])}(),LG=function(){function r(t){st(this,r),this.clipSpaceNearZ=Jd.NEGATIVE_ONE,this.plugins=[],this.config=Bt({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return at(r,[{key:"registerPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n===-1&&this.plugins.push(e)}},{key:"unregisterPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n>-1&&this.plugins.splice(n,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(e){return this.plugins.find(function(n){return n.name===e})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(e){Object.assign(this.config,e)}}])}(),yv=Ns,pl=ta,IG=eW,DG=tW,X3=ff,bv=aW,Me=function(){function r(){st(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return at(r,[{key:"update",value:function(e,n){pl(this.center,e),pl(this.halfExtents,n),bv(this.min,this.center,this.halfExtents),yv(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){yv(this.center,n,e),X3(this.center,this.center,.5),bv(this.halfExtents,n,e),X3(this.halfExtents,this.halfExtents,.5),pl(this.min,e),pl(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!r.isEmpty(e)){if(r.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,l=o[0],u=o[1],c=o[2],h=i-l,d=i+l,g=a-u,p=a+u,v=s-c,m=s+c,b=e.center,w=b[0],x=b[1],S=b[2],_=e.halfExtents,k=_[0],M=_[1],C=_[2],P=w-k,T=w+k,A=x-M,R=x+M,L=S-C,$=S+C;P<h&&(h=P),T>d&&(d=T),A<g&&(g=A),R>p&&(p=R),L<v&&(v=L),$>m&&(m=$),n[0]=(h+d)*.5,n[1]=(g+p)*.5,n[2]=(v+m)*.5,o[0]=(d-h)*.5,o[1]=(p-g)*.5,o[2]=(m-v)*.5,this.min[0]=h,this.min[1]=g,this.min[2]=v,this.max[0]=d,this.max[1]=p,this.max[2]=m}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,l=n[0],u=n[4],c=n[8],h=n[1],d=n[5],g=n[9],p=n[2],v=n[6],m=n[10],b=Math.abs(l),w=Math.abs(u),x=Math.abs(c),S=Math.abs(h),_=Math.abs(d),k=Math.abs(g),M=Math.abs(p),C=Math.abs(v),P=Math.abs(m);i[0]=n[12]+l*s[0]+u*s[1]+c*s[2],i[1]=n[13]+h*s[0]+d*s[1]+g*s[2],i[2]=n[14]+p*s[0]+v*s[1]+m*s[2],a[0]=b*o[0]+w*o[1]+x*o[2],a[1]=S*o[0]+_*o[1]+k*o[2],a[2]=M*o[0]+C*o[1]+P*o[2],bv(this.min,i,a),yv(this.max,i,a)}},{key:"intersects",value:function(e){var n=this.getMax(),i=this.getMin(),a=e.getMax(),s=e.getMin();return i[0]<=a[0]&&n[0]>=s[0]&&i[1]<=a[1]&&n[1]>=s[1]&&i[2]<=a[2]&&n[2]>=s[2]}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new r,i=IG([0,0,0],this.getMin(),e.getMin()),a=DG([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?pl([0,0,0],this.min):e.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:e.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(e){return e.pnVertexFlag===273?pl([0,0,0],this.max):e.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:e.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]}}],[{key:"isEmpty",value:function(e){return!e||e.halfExtents[0]===0&&e.halfExtents[1]===0&&e.halfExtents[2]===0}}])}(),FG=function(){function r(t,e){st(this,r),this.distance=t||0,this.normal=e||Ae(0,1,0),this.updatePNVertexFlag()}return at(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(e){return ea(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/YR(this.normal);ff(this.normal,this.normal,e),this.distance*=e}},{key:"intersectsLine",value:function(e,n,i){var a=this.distanceToPoint(e),s=this.distanceToPoint(n),o=a/(a-s),l=o>=0&&o<=1;return l&&i&&cw(i,e,n,o),l}}])}(),vl=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),BG=function(){function r(t){if(st(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new FG)}return at(r,[{key:"extractFromVPMatrix",value:function(e){var n=Lt(e,16),i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=n[5],c=n[6],h=n[7],d=n[8],g=n[9],p=n[10],v=n[11],m=n[12],b=n[13],w=n[14],x=n[15];Zn(this.planes[0].normal,o-i,h-l,v-d),this.planes[0].distance=x-m,Zn(this.planes[1].normal,o+i,h+l,v+d),this.planes[1].distance=x+m,Zn(this.planes[2].normal,o+a,h+u,v+g),this.planes[2].distance=x+b,Zn(this.planes[3].normal,o-a,h-u,v-g),this.planes[3].distance=x-b,Zn(this.planes[4].normal,o-s,h-c,v-p),this.planes[4].distance=x-w,Zn(this.planes[5].normal,o+s,h+c,v+p),this.planes[5].distance=x+w,this.planes.forEach(function(S){S.normalize(),S.updatePNVertexFlag()})}}])}(),$n=function(){function r(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;st(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return at(r,[{key:"clone",value:function(){return new r(this.x,this.y)}},{key:"copyFrom",value:function(e){this.x=e.x,this.y=e.y}}])}(),Hl=function(){function r(t,e,n,i){st(this,r),this.x=t,this.y=e,this.width=n,this.height=i,this.left=t,this.right=t+n,this.top=e,this.bottom=e+i}return at(r,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new r(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var i=Bu(e.x,e.y,0,1),a=Bu(e.x+e.width,e.y,0,1),s=Bu(e.x,e.y+e.height,0,1),o=Bu(e.x+e.width,e.y+e.height,0,1),l=na(),u=na(),c=na(),h=na();Ra(l,i,n),Ra(u,a,n),Ra(c,s,n),Ra(h,o,n);var d=Math.min(l[0],u[0],c[0],h[0]),g=Math.min(l[1],u[1],c[1],h[1]),p=Math.max(l[0],u[0],c[0],h[0]),v=Math.max(l[1],u[1],c[1],h[1]);return r.fromRect({x:d,y:g,width:p-d,height:v-g})}}])}(),ve="Method not implemented.",ml="Use document.documentElement instead.",zG="Cannot append a destroyed element.";function Fl(r){return r===void 0?0:r>360||r<-360?r%360:r}var wv=Qt();function ar(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(r)&&r.length===3?n?Sa(r):ta(wv,r):yt(r)?n?Ae(r,t,e):Zn(wv,r,t,e):n?Ae(r[0],r[1]||t,r[2]||e):Zn(wv,r[0],r[1]||t,r[2]||e)}var $G=Math.PI/180;function me(r){return r*$G}var jG=180/Math.PI;function wr(r){return r*jG}function qG(r){return 360*r}var wf=Math.PI/2;function WG(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,l=i*i,u=a*a,c=s+o+l+u,h=e*a-n*i;return h>.499995*c?(r[0]=wf,r[1]=2*Math.atan2(n,e),r[2]=0):h<-.499995*c?(r[0]=-wf,r[1]=2*Math.atan2(n,e),r[2]=0):(r[0]=Math.asin(2*(e*i-a*n)),r[1]=Math.atan2(2*(e*a+n*i),1-2*(l+u)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+l))),r}function GG(r,t){var e,n,i=Gl(Qt(),t),a=Lt(i,3),s=a[0],o=a[1],l=a[2],u=Math.asin(-t[2]/s);return u<wf?u>-wf?(e=Math.atan2(t[6]/o,t[10]/l),n=Math.atan2(t[1]/s,t[0]/s)):(n=0,e=-Math.atan2(t[4]/o,t[5]/o)):(n=0,e=Math.atan2(t[4]/o,t[5]/o)),r[0]=e,r[1]=u,r[2]=n,r}function xv(r,t){return t.length===16?GG(r,t):WG(r,t)}function VG(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return Lq(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function HG(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,l=2*a,u=e-t,c=n-i,h=l/u,d=l/c,g=(e+t)/u,p=(n+i)/c,v,m,b=s-a,w=s*a;return o?(v=-s/b,m=-w/b):(v=-(s+a)/b,m=-2*w/b),r[0]=h,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=g,r[9]=p,r[10]=v,r[11]=-1,r[12]=0,r[13]=0,r[14]=m,r[15]=0,r}function K3(r){var t=r[0],e=r[1],n=r[3],i=r[4],a=Math.sqrt(t*t+e*e),s=Math.sqrt(n*n+i*i),o=t*i-e*n;if(o<0&&(t<i?a=-a:s=-s),a){var l=1/a;t*=l,e*=l}if(s){var u=1/s;n*=u,i*=u}var c=Math.atan2(e,t),h=wr(c);return[r[6],r[7],a,s,h]}var Ui=Se(),Ti=Se(),Cu=na(),At=[Qt(),Qt(),Qt()],Z3=Qt();function UG(r,t,e,n,i,a){if(!YG(Ui,r)||(Wl(Ti,Ui),Ti[3]=0,Ti[7]=0,Ti[11]=0,Ti[15]=1,Math.abs(RR(Ti))<1e-8))return!1;var s=Ui[3],o=Ui[7],l=Ui[11],u=Ui[12],c=Ui[13],h=Ui[14],d=Ui[15];if(s!==0||o!==0||l!==0){Cu[0]=s,Cu[1]=o,Cu[2]=l,Cu[3]=d;var g=Qi(Ti,Ti);if(!g)return!1;NR(Ti,Ti),Ra(i,Cu,Ti)}else i[0]=i[1]=i[2]=0,i[3]=1;if(t[0]=u,t[1]=c,t[2]=h,XG(At,Ui),e[0]=Ta(At[0]),ko(At[0],At[0]),n[0]=ea(At[0],At[1]),Ev(At[1],At[1],At[0],1,-n[0]),e[1]=Ta(At[1]),ko(At[1],At[1]),n[0]/=e[1],n[1]=ea(At[0],At[2]),Ev(At[2],At[2],At[0],1,-n[1]),n[2]=ea(At[1],At[2]),Ev(At[2],At[2],At[1],1,-n[2]),e[2]=Ta(At[2]),ko(At[2],At[2]),n[1]/=e[2],n[2]/=e[2],Kd(Z3,At[1],At[2]),ea(At[0],Z3)<0)for(var p=0;p<3;p++)e[p]*=-1,At[p][0]*=-1,At[p][1]*=-1,At[p][2]*=-1;return a[0]=.5*Math.sqrt(Math.max(1+At[0][0]-At[1][1]-At[2][2],0)),a[1]=.5*Math.sqrt(Math.max(1-At[0][0]+At[1][1]-At[2][2],0)),a[2]=.5*Math.sqrt(Math.max(1-At[0][0]-At[1][1]+At[2][2],0)),a[3]=.5*Math.sqrt(Math.max(1+At[0][0]+At[1][1]+At[2][2],0)),At[2][1]>At[1][2]&&(a[0]=-a[0]),At[0][2]>At[2][0]&&(a[1]=-a[1]),At[1][0]>At[0][1]&&(a[2]=-a[2]),!0}function YG(r,t){var e=t[15];if(e===0)return!1;for(var n=1/e,i=0;i<16;i++)r[i]=t[i]*n;return!0}function XG(r,t){r[0][0]=t[0],r[0][1]=t[1],r[0][2]=t[2],r[1][0]=t[4],r[1][1]=t[5],r[1][2]=t[6],r[2][0]=t[8],r[2][1]=t[9],r[2][2]=t[10]}function Ev(r,t,e,n,i){r[0]=t[0]*n+e[0]*i,r[1]=t[1]*n+e[1]*i,r[2]=t[2]*n+e[2]*i}var pe=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),xw=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),ui=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),fL={UPDATED:"updated"},J3=2e-4,gL=function(){function r(){st(this,r),this.clipSpaceNearZ=Jd.NEGATIVE_ONE,this.eventEmitter=new TR,this.matrix=Se(),this.right=Ae(1,0,0),this.up=Ae(0,1,0),this.forward=Ae(0,0,1),this.position=Ae(0,0,1),this.focalPoint=Ae(0,0,0),this.distanceVector=Ae(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=Se(),this.projectionMatrixInverse=Se(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=pe.EXPLORING,this.trackingMode=xw.DEFAULT,this.projectionMode=ui.PERSPECTIVE,this.frustum=new BG,this.orthoMatrix=Se()}return at(r,[{key:"isOrtho",value:function(){return this.projectionMode===ui.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(e){this.enableUpdate=e}},{key:"setType",value:function(e,n){return this.type=e,this.type===pe.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===pe.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(e){return this.projectionMode=e,this}},{key:"setTrackingMode",value:function(e){if(this.type!==pe.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this}},{key:"setWorldRotation",value:function(e){return this.rotateWorld=e,this._getAngles(),this}},{key:"getViewTransform",value:function(){return Qi(Se(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=ws(Se(),[e,n,0]);this.jitteredProjectionMatrix=Jn(Se(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(e){return this.matrix=e,this._update(),this}},{key:"setProjectionMatrix",value:function(e){this.projectionMatrix=e}},{key:"setFov",value:function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this}},{key:"setAspect",value:function(e){return this.setPerspective(this.near,this.far,this.fov,e),this}},{key:"setNear",value:function(e){return this.projectionMode===ui.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this}},{key:"setFar",value:function(e){return this.projectionMode===ui.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this}},{key:"setViewOffset",value:function(e,n,i,a,s,o){return this.aspect=e/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.projectionMode===ui.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===ui.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(e){return this.zoom=e,this.projectionMode===ui.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===ui.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(e,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(e),this.rotate(0,0,o);var l=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),u=l.x,c=l.y,h=Ae(u-a,c-s,0),d=ea(h,this.right)/Ta(this.right),g=ea(h,this.up)/Ta(this.up),p=this.getPosition(),v=Lt(p,2),m=v[0],b=v[1],w=this.getFocalPoint(),x=Lt(w,2),S=x[0],_=x[1];return this.setPosition(m-d,b-g),this.setFocalPoint(S-d,_-g),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=ui.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(me(.5*this.fov))/this.zoom,l=2*o,u=this.aspect*l,c=-.5*u;if((s=this.view)!==null&&s!==void 0&&s.enabled){var h=this.view.fullWidth,d=this.view.fullHeight;c+=this.view.offsetX*u/h,o-=this.view.offsetY*l/d,u*=this.view.width/h,l*=this.view.height/d}return HG(this.projectionMatrix,c,c+u,o-l,o,e,this.far,this.clipSpaceNearZ===Jd.ZERO),Qi(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var l;this.projectionMode=ui.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var u=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),h=(this.rright+this.left)/2,d=(this.top+this.bottom)/2,g=h-u,p=h+u,v=d+c,m=d-c;if((l=this.view)!==null&&l!==void 0&&l.enabled){var b=(this.rright-this.left)/this.view.fullWidth/this.zoom,w=(this.top-this.bottom)/this.view.fullHeight/this.zoom;g+=b*this.view.offsetX,p=g+b*this.view.width,v-=w*this.view.offsetY,m=v-w*this.view.height}return this.clipSpaceNearZ===Jd.NEGATIVE_ONE?WR(this.projectionMatrix,g,p,v,m,s,o):GR(this.projectionMatrix,g,p,v,m,s,o),Qi(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=ar(e,n,i);return this._setPosition(a),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],a=Ae(0,1,0);if(this.focalPoint=ar(e,n,i),this.trackingMode===xw.CINEMATIC){var s=uw(Qt(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=Ta(s),l=wr(Math.asin(n/o)),u=90+wr(Math.atan2(i,e)),c=Se();DR(c,c,me(u)),IR(c,c,me(l)),a=Qn(Qt(),[0,1,0],c)}return Qi(this.matrix,VR(Se(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance<J3&&(this.distance=J3),this.dollyingStep=this.distance/100;var n=Qt();e=this.distance;var i=this.forward,a=this.focalPoint;return n[0]=e*i[0]+a[0],n[1]=e*i[1]+a[1],n[2]=e*i[2]+a[2],this._setPosition(n),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(e){return this.maxDistance=e,this}},{key:"setMinDistance",value:function(e){return this.minDistance=e,this}},{key:"setAzimuth",value:function(e){return this.azimuth=Fl(e),this.computeMatrix(),this._getAxes(),this.type===pe.ORBITING||this.type===pe.EXPLORING?this._getPosition():this.type===pe.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(e){return this.elevation=Fl(e),this.computeMatrix(),this._getAxes(),this.type===pe.ORBITING||this.type===pe.EXPLORING?this._getPosition():this.type===pe.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(e){return this.roll=Fl(e),this.computeMatrix(),this._getAxes(),this.type===pe.ORBITING||this.type===pe.EXPLORING?this._getPosition():this.type===pe.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var e=_s(En(),[0,0,1],me(this.roll));zs(this.matrix);var n=_s(En(),[1,0,0],me((this.rotateWorld&&this.type!==pe.TRACKING||this.type===pe.TRACKING?1:-1)*this.elevation)),i=_s(En(),[0,1,0],me((this.rotateWorld&&this.type!==pe.TRACKING||this.type===pe.TRACKING?1:-1)*this.azimuth)),a=Rs(En(),i,n);a=Rs(En(),a,e);var s=Ox(Se(),a);this.type===pe.ORBITING||this.type===pe.EXPLORING?(Dl(this.matrix,this.matrix,this.focalPoint),Jn(this.matrix,this.matrix,s),Dl(this.matrix,this.matrix,[0,0,this.distance])):this.type===pe.TRACKING&&(Dl(this.matrix,this.matrix,this.position),Jn(this.matrix,this.matrix,s))}},{key:"_setPosition",value:function(e,n,i){this.position=ar(e,n,i);var a=this.matrix;a[12]=this.position[0],a[13]=this.position[1],a[14]=this.position[2],a[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){ta(this.right,ar(Ra(na(),[1,0,0,0],this.matrix))),ta(this.up,ar(Ra(na(),[0,1,0,0],this.matrix))),ta(this.forward,ar(Ra(na(),[0,0,1,0],this.matrix))),ko(this.right,this.right),ko(this.up,this.up),ko(this.forward,this.forward)}},{key:"_getAngles",value:function(){var e=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=Ta(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===pe.TRACKING?(this.elevation=wr(Math.asin(n/a)),this.azimuth=wr(Math.atan2(-e,-i))):this.rotateWorld?(this.elevation=wr(Math.asin(n/a)),this.azimuth=wr(Math.atan2(-e,-i))):(this.elevation=-wr(Math.asin(n/a)),this.azimuth=-wr(Math.atan2(-e,-i)))}},{key:"_getPosition",value:function(){ta(this.position,ar(Ra(na(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){rW(this.distanceVector,[0,0,-this.distance],Rq(OR(),this.matrix)),Ns(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=uw(Qt(),this.focalPoint,this.position),this.distance=Ta(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===ui.ORTHOGRAPHIC){var e=this.position,n=_s(En(),[0,0,1],-this.roll*Math.PI/180);ec(this.orthoMatrix,n,Ae((this.rright-this.left)/2-e[0],(this.top-this.bottom)/2-e[1],0),Ae(this.zoom,this.zoom,1),e)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var e=this.getViewTransform(),n=Jn(Se(),this.getPerspective(),e);this.getFrustum().extractFromVPMatrix(n),this.eventEmitter.emit(fL.UPDATED)}}},{key:"rotate",value:function(e,n,i){throw new Error(ve)}},{key:"pan",value:function(e,n){throw new Error(ve)}},{key:"dolly",value:function(e){throw new Error(ve)}},{key:"createLandmark",value:function(e,n){throw new Error(ve)}},{key:"gotoLandmark",value:function(e,n){throw new Error(ve)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(ve)}}])}(),KG=function(r){return r[r.Standard=0]="Standard",r}({}),xf=function(r){return r[r.ADDED=0]="ADDED",r[r.REMOVED=1]="REMOVED",r[r.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",r}({}),pL={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Hl(0,0,0,0)},ft=function(r){return r.COORDINATE="<coordinate>",r.COLOR="<color>",r.PAINT="<paint>",r.NUMBER="<number>",r.ANGLE="<angle>",r.OPACITY_VALUE="<opacity-value>",r.SHADOW_BLUR="<shadow-blur>",r.LENGTH="<length>",r.PERCENTAGE="<percentage>",r.LENGTH_PERCENTAGE="<length> | <percentage>",r.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",r.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",r.LIST_OF_POINTS="<list-of-points>",r.PATH="<path>",r.FILTER="<filter>",r.Z_INDEX="<z-index>",r.OFFSET_DISTANCE="<offset-distance>",r.DEFINED_PATH="<defined-path>",r.MARKER="<marker>",r.TRANSFORM="<transform>",r.TRANSFORM_ORIGIN="<transform-origin>",r.TEXT="<text>",r.TEXT_TRANSFORM="<text-transform>",r}({});function Rx(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function vL(r,t){var e=Object.create(r.prototype);for(var n in t)e[n]=t[n];return e}function Pc(){}var dc=.7,Ef=1/dc,Bl="\\s*([+-]?\\d+)\\s*",fc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ia="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ZG=/^#([0-9a-f]{3,8})$/,JG=new RegExp(`^rgb\\(${Bl},${Bl},${Bl}\\)$`),QG=new RegExp(`^rgb\\(${ia},${ia},${ia}\\)$`),tV=new RegExp(`^rgba\\(${Bl},${Bl},${Bl},${fc}\\)$`),eV=new RegExp(`^rgba\\(${ia},${ia},${ia},${fc}\\)$`),nV=new RegExp(`^hsl\\(${fc},${ia},${ia}\\)$`),rV=new RegExp(`^hsla\\(${fc},${ia},${ia},${fc}\\)$`),Q3={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Rx(Pc,o0,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:tM,formatHex:tM,formatHex8:iV,formatHsl:aV,formatRgb:eM,toString:eM});function tM(){return this.rgb().formatHex()}function iV(){return this.rgb().formatHex8()}function aV(){return mL(this).formatHsl()}function eM(){return this.rgb().formatRgb()}function o0(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=ZG.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?nM(t):e===3?new Mr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Hh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Hh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=JG.exec(r))?new Mr(t[1],t[2],t[3],1):(t=QG.exec(r))?new Mr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tV.exec(r))?Hh(t[1],t[2],t[3],t[4]):(t=eV.exec(r))?Hh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nV.exec(r))?aM(t[1],t[2]/100,t[3]/100,1):(t=rV.exec(r))?aM(t[1],t[2]/100,t[3]/100,t[4]):Q3.hasOwnProperty(r)?nM(Q3[r]):r==="transparent"?new Mr(NaN,NaN,NaN,0):null}function nM(r){return new Mr(r>>16&255,r>>8&255,r&255,1)}function Hh(r,t,e,n){return n<=0&&(r=t=e=NaN),new Mr(r,t,e,n)}function sV(r){return r instanceof Pc||(r=o0(r)),r?(r=r.rgb(),new Mr(r.r,r.g,r.b,r.opacity)):new Mr}function oV(r,t,e,n){return arguments.length===1?sV(r):new Mr(r,t,e,n??1)}function Mr(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}Rx(Mr,oV,vL(Pc,{brighter(r){return r=r==null?Ef:Math.pow(Ef,r),new Mr(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?dc:Math.pow(dc,r),new Mr(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Mr(Co(this.r),Co(this.g),Co(this.b),_f(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rM,formatHex:rM,formatHex8:lV,formatRgb:iM,toString:iM}));function rM(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}`}function lV(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}${wo((isNaN(this.opacity)?1:this.opacity)*255)}`}function iM(){const r=_f(this.opacity);return`${r===1?"rgb(":"rgba("}${Co(this.r)}, ${Co(this.g)}, ${Co(this.b)}${r===1?")":`, ${r})`}`}function _f(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Co(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function wo(r){return r=Co(r),(r<16?"0":"")+r.toString(16)}function aM(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new Ni(r,t,e,n)}function mL(r){if(r instanceof Ni)return new Ni(r.h,r.s,r.l,r.opacity);if(r instanceof Pc||(r=o0(r)),!r)return new Ni;if(r instanceof Ni)return r;r=r.rgb();var t=r.r/255,e=r.g/255,n=r.b/255,i=Math.min(t,e,n),a=Math.max(t,e,n),s=NaN,o=a-i,l=(a+i)/2;return o?(t===a?s=(e-n)/o+(e<n)*6:e===a?s=(n-t)/o+2:s=(t-e)/o+4,o/=l<.5?a+i:2-a-i,s*=60):o=l>0&&l<1?0:s,new Ni(s,o,l,r.opacity)}function uV(r,t,e,n){return arguments.length===1?mL(r):new Ni(r,t,e,n??1)}function Ni(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}Rx(Ni,uV,vL(Pc,{brighter(r){return r=r==null?Ef:Math.pow(Ef,r),new Ni(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?dc:Math.pow(dc,r),new Ni(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,n=e+(e<.5?e:1-e)*t,i=2*e-n;return new Mr(_v(r>=240?r-240:r+120,i,n),_v(r,i,n),_v(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new Ni(sM(this.h),Uh(this.s),Uh(this.l),_f(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=_f(this.opacity);return`${r===1?"hsl(":"hsla("}${sM(this.h)}, ${Uh(this.s)*100}%, ${Uh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function sM(r){return r=(r||0)%360,r<0?r+360:r}function Uh(r){return Math.max(0,Math.min(1,r||0))}function _v(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}function vn(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");var e=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=t?t.apply(this,a):a[0],l=e.cache;if(l.has(o))return l.get(o);var u=r.apply(this,a);return e.cache=l.set(o,u)||l,u};return e.cache=new(vn.Cache||Map),vn.cacheList.push(e.cache),e}vn.Cache=Map;vn.cacheList=[];vn.clearCache=function(){vn.cacheList.forEach(function(r){return r.clear()})};var gt=function(r){return r[r.kUnknown=0]="kUnknown",r[r.kNumber=1]="kNumber",r[r.kPercentage=2]="kPercentage",r[r.kEms=3]="kEms",r[r.kPixels=4]="kPixels",r[r.kRems=5]="kRems",r[r.kDegrees=6]="kDegrees",r[r.kRadians=7]="kRadians",r[r.kGradians=8]="kGradians",r[r.kTurns=9]="kTurns",r[r.kMilliseconds=10]="kMilliseconds",r[r.kSeconds=11]="kSeconds",r[r.kInteger=12]="kInteger",r}({}),Pi=function(r){return r[r.kUNumber=0]="kUNumber",r[r.kUPercent=1]="kUPercent",r[r.kULength=2]="kULength",r[r.kUAngle=3]="kUAngle",r[r.kUTime=4]="kUTime",r[r.kUOther=5]="kUOther",r}({}),cV=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),hV=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),dV=[{name:"em",unit_type:gt.kEms},{name:"px",unit_type:gt.kPixels},{name:"deg",unit_type:gt.kDegrees},{name:"rad",unit_type:gt.kRadians},{name:"grad",unit_type:gt.kGradians},{name:"ms",unit_type:gt.kMilliseconds},{name:"s",unit_type:gt.kSeconds},{name:"rem",unit_type:gt.kRems},{name:"turn",unit_type:gt.kTurns}],Ul=function(r){return r[r.kUnknownType=0]="kUnknownType",r[r.kUnparsedType=1]="kUnparsedType",r[r.kKeywordType=2]="kKeywordType",r[r.kUnitType=3]="kUnitType",r[r.kSumType=4]="kSumType",r[r.kProductType=5]="kProductType",r[r.kNegateType=6]="kNegateType",r[r.kInvertType=7]="kInvertType",r[r.kMinType=8]="kMinType",r[r.kMaxType=9]="kMaxType",r[r.kClampType=10]="kClampType",r[r.kTransformType=11]="kTransformType",r[r.kPositionType=12]="kPositionType",r[r.kURLImageType=13]="kURLImageType",r[r.kColorType=14]="kColorType",r[r.kUnsupportedColorType=15]="kUnsupportedColorType",r}({}),fV=function(t){return dV.find(function(e){return e.name===t}).unit_type},gV=function(t){return t?t==="number"?gt.kNumber:t==="percent"||t==="%"?gt.kPercentage:fV(t):gt.kUnknown},pV=function(t){switch(t){case gt.kNumber:case gt.kInteger:return Pi.kUNumber;case gt.kPercentage:return Pi.kUPercent;case gt.kPixels:return Pi.kULength;case gt.kMilliseconds:case gt.kSeconds:return Pi.kUTime;case gt.kDegrees:case gt.kRadians:case gt.kGradians:case gt.kTurns:return Pi.kUAngle;default:return Pi.kUOther}},vV=function(t){switch(t){case Pi.kUNumber:return gt.kNumber;case Pi.kULength:return gt.kPixels;case Pi.kUPercent:return gt.kPercentage;case Pi.kUTime:return gt.kSeconds;case Pi.kUAngle:return gt.kDegrees;default:return gt.kUnknown}},oM=function(t){var e=1;switch(t){case gt.kPixels:case gt.kDegrees:case gt.kSeconds:break;case gt.kMilliseconds:e=.001;break;case gt.kRadians:e=180/Math.PI;break;case gt.kGradians:e=.9;break;case gt.kTurns:e=360;break}return e},Ew=function(t){switch(t){case gt.kNumber:case gt.kInteger:return"";case gt.kPercentage:return"%";case gt.kEms:return"em";case gt.kRems:return"rem";case gt.kPixels:return"px";case gt.kDegrees:return"deg";case gt.kRadians:return"rad";case gt.kGradians:return"grad";case gt.kMilliseconds:return"ms";case gt.kSeconds:return"s";case gt.kTurns:return"turn"}return""},l0=function(){function r(){st(this,r)}return at(r,[{key:"toString",value:function(){return this.buildCSSText(cV.kNo,hV.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=Ul.kUnitType&&this.getType()<=Ul.kClampType}}],[{key:"isAngle",value:function(e){return e===gt.kDegrees||e===gt.kRadians||e===gt.kGradians||e===gt.kTurns}},{key:"isLength",value:function(e){return e>=gt.kEms&&e<gt.kDegrees}},{key:"isRelativeUnit",value:function(e){return e===gt.kPercentage||e===gt.kEms||e===gt.kRems}},{key:"isTime",value:function(e){return e===gt.kSeconds||e===gt.kMilliseconds}}])}(),mV=function(r){function t(e){var n;return st(this,t),n=qt(this,t),n.colorSpace=e,n}return jt(t,r),at(t,[{key:"getType",value:function(){return Ul.kColorType}},{key:"to",value:function(n){return this}}])}(l0),Ss=function(r){return r[r.Constant=0]="Constant",r[r.LinearGradient=1]="LinearGradient",r[r.RadialGradient=2]="RadialGradient",r}({}),Yh=function(r){function t(e,n){var i;return st(this,t),i=qt(this,t),i.type=e,i.value=n,i}return jt(t,r),at(t,[{key:"clone",value:function(){return new t(this.type,this.value)}},{key:"buildCSSText",value:function(n,i,a){return a}},{key:"getType",value:function(){return Ul.kColorType}}])}(l0),vi=function(r){function t(e){var n;return st(this,t),n=qt(this,t),n.value=e,n}return jt(t,r),at(t,[{key:"clone",value:function(){return new t(this.value)}},{key:"getType",value:function(){return Ul.kKeywordType}},{key:"buildCSSText",value:function(n,i,a){return a+this.value}}])}(l0),yV=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(t)?n="NaN":t>0?n="infinity":n="-infinity",n+=e},_w=function(t){return vV(pV(t))},An=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gt.kNumber;st(this,t),n=qt(this,t);var a;return typeof i=="string"?a=gV(i):a=i,n.unit=a,n.value=e,n}return jt(t,r),at(t,[{key:"clone",value:function(){return new t(this.value,this.unit)}},{key:"equals",value:function(n){var i=n;return this.value===i.value&&this.unit===i.unit}},{key:"getType",value:function(){return Ul.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=_w(this.unit);if(i!==_w(n)||i===gt.kUnknown)return null;var a=oM(this.unit)/oM(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case gt.kUnknown:break;case gt.kInteger:s=Number(this.value).toFixed(0);break;case gt.kNumber:case gt.kPercentage:case gt.kEms:case gt.kRems:case gt.kPixels:case gt.kDegrees:case gt.kRadians:case gt.kGradians:case gt.kMilliseconds:case gt.kSeconds:case gt.kTurns:{var o=-999999,l=999999,u=this.value,c=Ew(this.unit);if(u<o||u>l){var h=Ew(this.unit);!Number.isFinite(u)||Number.isNaN(u)?s=yV(u,h):s=u+(h||"")}else s="".concat(u).concat(c)}}return a+=s,a}}])}(l0),Oi=new An(0,"px");new An(1,"px");var Io=new An(0,"deg"),Lx=function(r){function t(e,n,i){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return st(this,t),a=qt(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return jt(t,r),at(t,[{key:"clone",value:function(){return new t(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(n,i,a){return"".concat(a,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(mV),lM=new vi("unset"),bV=new vi("initial"),wV=new vi("inherit"),Sv={"":lM,unset:lM,initial:bV,inherit:wV},xV=function(t){return Sv[t]||(Sv[t]=new vi(t)),Sv[t]},yL=new Lx(0,0,0,0,!0),bL=new Lx(0,0,0,0),EV=vn(function(r,t,e,n){return new Lx(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),ze=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gt.kNumber;return new An(t,e)};new An(50,"%");function _V(r){var t=r.type,e=r.value;return t==="hex"?"#".concat(e):t==="literal"?e:t==="rgb"?"rgb(".concat(e.join(","),")"):"rgba(".concat(e.join(","),")")}var SV=function(){var r={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function e(B){throw new Error("".concat(t,": ").concat(B))}function n(){var B=i();return t.length>0&&e("Invalid input not EOF"),B}function i(){return x(a)}function a(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,h)||s("repeating-radial-gradient",r.repeatingRadialGradient,h)||s("conic-gradient",r.conicGradient,h)}function s(B,F,V){return o(F,function(X){var K=V();return K&&(q(r.comma)||e("Missing comma before color stops")),{type:B,orientation:K,colorStops:x(S)}})}function o(B,F){var V=q(B);if(V){q(r.startCall)||e("Missing (");var X=F(V);return q(r.endCall)||e("Missing )"),X}}function l(){return u()||c()}function u(){return $("directional",r.sideOrCorner,1)}function c(){return $("angular",r.angleValue,1)}function h(){var B,F=d(),V;return F&&(B=[],B.push(F),V=t,q(r.comma)&&(F=d(),F?B.push(F):t=V)),B}function d(){var B=g()||p();if(B)B.at=m();else{var F=v();if(F){B=F;var V=m();V&&(B.at=V)}else{var X=b();X&&(B={type:"default-radial",at:X})}}return B}function g(){var B=$("shape",/^(circle)/i,0);return B&&(B.style=L()||v()),B}function p(){var B=$("shape",/^(ellipse)/i,0);return B&&(B.style=A()||v()),B}function v(){return $("extent-keyword",r.extentKeywords,1)}function m(){if($("position",/^at/,0)){var B=b();return B||e("Missing positioning value"),B}}function b(){var B=w();if(B.x||B.y)return{type:"position",value:B}}function w(){return{x:A(),y:A()}}function x(B){var F=B(),V=[];if(F)for(V.push(F);q(r.comma);)F=B(),F?V.push(F):e("One extra comma");return V}function S(){var B=_();return B||e("Expected color definition"),B.length=A(),B}function _(){return M()||P()||C()||k()}function k(){return $("literal",r.literalColor,0)}function M(){return $("hex",r.hexColor,1)}function C(){return o(r.rgbColor,function(){return{type:"rgb",value:x(T)}})}function P(){return o(r.rgbaColor,function(){return{type:"rgba",value:x(T)}})}function T(){return q(r.number)[1]}function A(){return $("%",r.percentageValue,1)||R()||L()}function R(){return $("position-keyword",r.positionKeywords,1)}function L(){return $("px",r.pixelValue,1)||$("em",r.emValue,1)}function $(B,F,V){var X=q(F);if(X)return{type:B,value:X[V]}}function q(B){var F=/^[\n\r\t\s]+/.exec(t);F&&j(F[0].length);var V=B.exec(t);return V&&j(V[0].length),V}function j(B){t=t.substring(B)}return function(B){return t=B,n()}}();function MV(r,t,e,n){var i=me(n.value),a=0,s=0,o=a+t/2,l=s+e/2,u=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),c=r[0]+o-Math.cos(i)*u/2,h=r[1]+l-Math.sin(i)*u/2,d=r[0]+o+Math.cos(i)*u/2,g=r[1]+l+Math.sin(i)*u/2;return{x1:c,y1:h,x2:d,y2:g}}function kV(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===gt.kPercentage&&(s=n.value/100*t),i.unit===gt.kPercentage&&(o=i.value/100*e);var l=Math.max(br([0,0],[s,o]),br([0,e],[s,o]),br([t,e],[s,o]),br([t,0],[s,o]));return a&&(a instanceof An?l=a.value:a instanceof vi&&(a.value==="closest-side"?l=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?l=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(l=Math.min(br([0,0],[s,o]),br([0,e],[s,o]),br([t,e],[s,o]),br([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:l}}var CV=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,TV=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,OV=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,wL=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function AV(r){var t,e=r.length;if(r[e-1].length=(t=r[e-1].length)!==null&&t!==void 0?t:{type:"%",value:"100"},e>1){var n;r[0].length=(n=r[0].length)!==null&&n!==void 0?n:{type:"%",value:"0"}}for(var i=0,a=Number(r[0].length.value),s=1;s<e;s++){var o,l=(o=r[s].length)===null||o===void 0?void 0:o.value;if(!kt(l)&&!kt(a)){for(var u=1;u<s-i;u++)r[i+u].length={type:"%",value:"".concat(a+(Number(l)-a)*u/(s-i))};i=s,a=Number(l)}}}var PV={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},NV=vn(function(r){var t;return r.type==="angular"?t=Number(r.value):t=PV[r.value]||0,ze(t,"deg")}),RV=vn(function(r){var t=50,e=50,n="%",i="%";if((r==null?void 0:r.type)==="position"){var a=r.value,s=a.x,o=a.y;(s==null?void 0:s.type)==="position-keyword"&&(s.value==="left"?t=0:s.value==="center"?t=50:s.value==="right"?t=100:s.value==="top"?e=0:s.value==="bottom"&&(e=100)),(o==null?void 0:o.type)==="position-keyword"&&(o.value==="left"?t=0:o.value==="center"?e=50:o.value==="right"?t=100:o.value==="top"?e=0:o.value==="bottom"&&(e=100)),((s==null?void 0:s.type)==="px"||(s==null?void 0:s.type)==="%"||(s==null?void 0:s.type)==="em")&&(n=s==null?void 0:s.type,t=Number(s.value)),((o==null?void 0:o.type)==="px"||(o==null?void 0:o.type)==="%"||(o==null?void 0:o.type)==="em")&&(i=o==null?void 0:o.type,e=Number(o.value))}return{cx:ze(t,n),cy:ze(e,i)}}),LV=vn(function(r){if(r.indexOf("linear")>-1||r.indexOf("radial")>-1){var t=SV(r);return t.map(function(o){var l=o.type,u=o.orientation,c=o.colorStops;AV(c);var h=c.map(function(x){return{offset:ze(Number(x.length.value),"%"),color:_V(x)}});if(l==="linear-gradient")return new Yh(Ss.LinearGradient,{angle:u?NV(u):Io,steps:h});if(l==="radial-gradient"&&(u||(u=[{type:"shape",value:"circle"}]),u[0].type==="shape"&&u[0].value==="circle")){var d=RV(u[0].at),g=d.cx,p=d.cy,v;if(u[0].style){var m=u[0].style,b=m.type,w=m.value;b==="extent-keyword"?v=xV(w):v=ze(w,b)}return new Yh(Ss.RadialGradient,{cx:g,cy:p,size:v,steps:h})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=CV.exec(r);if(n){var i,a=((i=n[2].match(wL))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new Yh(Ss.LinearGradient,{angle:ze(parseFloat(n[1]),"deg"),steps:a.map(function(o){var l=Lt(o,2),u=l[0],c=l[1];return{offset:ze(Number(u)*100,"%"),color:c}})})]}}else if(e==="r"){var s=IV(r);if(s)if(se(s))r=s;else return[new Yh(Ss.RadialGradient,s)]}else if(e==="p")return DV(r)}});function IV(r){var t=TV.exec(r);if(t){var e,n=((e=t[4].match(wL))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:ze(50,"%"),cy:ze(50,"%"),steps:n.map(function(i){var a=Lt(i,2),s=a[0],o=a[1];return{offset:ze(Number(s)*100,"%"),color:o}})}}return null}function DV(r){var t=OV.exec(r);if(t){var e=t[1],n=t[2];switch(e){case"a":e="repeat";break;case"x":e="repeat-x";break;case"y":e="repeat-y";break;case"n":e="no-repeat";break;default:e="no-repeat"}return{image:n,repetition:e}}return null}function Do(r){return r&&!!r.image}function Sf(r){return r&&!kt(r.r)&&!kt(r.g)&&!kt(r.b)}var ic=vn(function(r){if(Do(r))return Bt({repetition:"repeat"},r);if(kt(r)&&(r=""),r==="transparent")return bL;if(r==="currentColor")r="black";else if(r==="none")return yL;var t=LV(r);if(t)return t;var e=o0(r),n=[0,0,0,0];return e!==null&&(n[0]=e.r||0,n[1]=e.g||0,n[2]=e.b||0,n[3]=e.opacity),EV.apply(void 0,n)});function FV(r,t){if(!(!Sf(r)||!Sf(t)))return[[Number(r.r),Number(r.g),Number(r.b),Number(r.alpha)],[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],function(e){var n=e.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(Ke(n[i],0,255));return n[3]=Ke(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function Nc(r,t){if(kt(t))return ze(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return ze(Number(t),"px");if("deg".search(r)>=0)return ze(Number(t),"deg")}var e=[];t=t.replace(r,function(i){return e.push(i),"U".concat(i)});var n="U(".concat(r.source,")");return e.map(function(i){return ze(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var xL=function(t){return Nc(new RegExp("px","g"),t)},BV=vn(xL),zV=function(t){return Nc(new RegExp("%","g"),t)};vn(zV);var EL=function(t){return yt(t)||isFinite(Number(t))?ze(Number(t)||0,"px"):Nc(new RegExp("px|%|em|rem","g"),t)},Sw=vn(EL),_L=function(t){return Nc(new RegExp("deg|rad|grad|turn","g"),t)},$V=vn(_L);function jV(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a="",s=r.value||0,o=t.value||0,l=_w(r.unit),u=r.convertTo(l),c=t.convertTo(l);return u&&c?(s=u.value,o=c.value,a=Ew(r.unit)):(An.isLength(r.unit)||An.isLength(t.unit))&&(s=Fr(r,i,e),o=Fr(t,i,e),a="px"),[s,o,function(h){return h+a}]}function xr(r){var t=0;return r.unit===gt.kDegrees?t=r.value:r.unit===gt.kRadians?t=wr(Number(r.value)):r.unit===gt.kTurns?t=qG(Number(r.value)):r.value&&(t=r.value),t}function uM(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):se(r)?e=r.split(" ").map(function(n){return Number(n)}):yt(r)&&(e=[r]),t===2?e.length===1?[e[0],e[0]]:[e[0],e[1]]:t===4?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0],e[1]]:e.length===3?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]:t==="even"&&e.length%2===1?[].concat(Ce(e),Ce(e)):e}function Fr(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===gt.kPixels)return Number(r.value);if(r.unit===gt.kPercentage&&e){var i=e.nodeName===Q.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var qV=function(t){return Nc(/deg|rad|grad|turn|px|%/g,t)},WV=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function GV(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(r=r.toLowerCase().trim(),r==="none")return[];for(var t=/\s*([\w-]+)\(([^)]*)\)/g,e=[],n,i=0;n=t.exec(r);){if(n.index!==i)return[];if(i=n.index+n[0].length,WV.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return qV(a)||ic(a)})}),t.lastIndex===r.length)return e}return[]}function SL(r){return r.toString()}var ML=function(t){return typeof t=="number"?ze(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?ze(Number(t)):ze(0)},Mw=vn(ML);vn(function(r){return se(r)?r.split(" ").map(Mw):r.map(Mw)});function Ix(r,t){return[r,t,SL]}function Dx(r,t){return function(e,n){return[e,n,function(i){return SL(Ke(i,r,t))}]}}function kL(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function kw(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=uG(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function VV(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=CG(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function HV(r){for(var t=0;t<r.length;t++){var e=r[t-1],n=r[t],i=n[0];if(i==="M"&&e){var a=e[0],s=[n[1],n[2]],o=void 0;a==="L"||a==="M"?o=[e[1],e[2]]:(a==="C"||a==="A"||a==="Q")&&(o=[e[e.length-2],e[e.length-1]]),o&&Mf(s,o)&&(r.splice(t,1),t--)}}}function UV(r){for(var t=!1,e=r.length,n=0;n<e;n++){var i=r[n],a=i[0];if(a==="C"||a==="A"||a==="Q"){t=!0;break}}return t}function YV(r){for(var t=[],e=[],n=[],i=0;i<r.length;i++){var a=r[i],s=a[0];s==="M"?(n.length&&(e.push(n),n=[]),n.push([a[1],a[2]])):s==="Z"?n.length&&(t.push(n),n=[]):n.push([a[1],a[2]])}return n.length>0&&e.push(n),{polygons:t,polylines:e}}function Mf(r,t){return r[0]===t[0]&&r[1]===t[1]}function XV(r,t){for(var e=[],n=[],i=[],a=0;a<r.length;a++){var s=r[a],o=s.currentPoint,l=s.params,u=s.prePoint,c=void 0;switch(s.command){case"Q":c=TG(u[0],u[1],l[1],l[2],l[3],l[4]);break;case"C":c=SG(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=s.arcParams;c=xG(h.cx,h.cy,h.rx,h.ry,h.xRotation,h.startAngle,h.endAngle);break;default:e.push(o[0]),n.push(o[1]);break}c&&(s.box=c,e.push(c.x,c.x+c.width),n.push(c.y,c.y+c.height))}e=e.filter(function(S){return!Number.isNaN(S)&&S!==1/0&&S!==-1/0}),n=n.filter(function(S){return!Number.isNaN(S)&&S!==1/0&&S!==-1/0});var d=vf(e),g=vf(n),p=pf(e),v=pf(n);if(i.length===0)return{x:d,y:g,width:p-d,height:v-g};for(var m=0;m<i.length;m++){var b=i[m],w=b.currentPoint,x=void 0;w[0]===d?(x=Xh(b,t),d-=x.xExtra):w[0]===p&&(x=Xh(b,t),p+=x.xExtra),w[1]===g?(x=Xh(b,t),g-=x.yExtra):w[1]===v&&(x=Xh(b,t),v+=x.yExtra)}return{x:d,y:g,width:p-d,height:v-g}}function Xh(r,t){var e=r.prePoint,n=r.currentPoint,i=r.nextPoint,a=Math.pow(n[0]-e[0],2)+Math.pow(n[1]-e[1],2),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),o=Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2),l=Math.acos((a+s-o)/(2*Math.sqrt(a)*Math.sqrt(s)));if(!l||Math.sin(l)===0||nc(l,0))return{xExtra:0,yExtra:0};var u=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),c=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));u=u>Math.PI/2?Math.PI-u:u,c=c>Math.PI/2?Math.PI-c:c;var h={xExtra:Math.cos(l/2-u)*(t/2*(1/Math.sin(l/2)))-t/2||0,yExtra:Math.cos(c-l/2)*(t/2*(1/Math.sin(l/2)))-t/2||0};return h}function cM(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var hM=function(t,e){var n=t.x*e.x+t.y*e.y,i=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2))),a=t.x*e.y-t.y*e.x<0?-1:1,s=a*Math.acos(n/i);return s},dM=function(t,e,n,i,a,s,o,l){e=Math.abs(e),n=Math.abs(n),i=ZR(i,360);var u=me(i);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-o.x)/2,h=(t.y-o.y)/2,d={x:Math.cos(u)*c+Math.sin(u)*h,y:-Math.sin(u)*c+Math.cos(u)*h},g=Math.pow(d.x,2)/Math.pow(e,2)+Math.pow(d.y,2)/Math.pow(n,2);g>1&&(e*=Math.sqrt(g),n*=Math.sqrt(g));var p=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(d.y,2)-Math.pow(n,2)*Math.pow(d.x,2),v=Math.pow(e,2)*Math.pow(d.y,2)+Math.pow(n,2)*Math.pow(d.x,2),m=p/v;m=m<0?0:m;var b=(a!==s?1:-1)*Math.sqrt(m),w={x:b*(e*d.y/n),y:b*(-(n*d.x)/e)},x={x:Math.cos(u)*w.x-Math.sin(u)*w.y+(t.x+o.x)/2,y:Math.sin(u)*w.x+Math.cos(u)*w.y+(t.y+o.y)/2},S={x:(d.x-w.x)/e,y:(d.y-w.y)/n},_=hM({x:1,y:0},S),k={x:(-d.x-w.x)/e,y:(-d.y-w.y)/n},M=hM(S,k);!s&&M>0?M-=2*Math.PI:s&&M<0&&(M+=2*Math.PI),M%=2*Math.PI;var C=_+M*l,P=e*Math.cos(C),T=n*Math.sin(C),A={x:Math.cos(u)*P-Math.sin(u)*T+x.x,y:Math.sin(u)*P+Math.cos(u)*T+x.y,ellipticalArcStartAngle:_,ellipticalArcEndAngle:_+M,ellipticalArcAngle:C,ellipticalArcCenter:x,resultantRx:e,resultantRy:n};return A};function KV(r){for(var t=[],e=null,n=null,i=null,a=0,s=r.length,o=0;o<s;o++){var l=r[o];n=r[o+1];var u=l[0],c={command:u,prePoint:e,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(u){case"M":i=[l[1],l[2]],a=o;break;case"A":var h=ZV(e,l);c.arcParams=h;break}if(u==="Z")e=i,n=r[a+1];else{var d=l.length;e=[l[d-2],l[d-1]]}n&&n[0]==="Z"&&(n=r[a],t[a]&&(t[a].prePoint=e)),c.currentPoint=e,t[a]&&Mf(e,t[a].currentPoint)&&(t[a].prePoint=c.prePoint);var g=n?[n[n.length-2],n[n.length-1]]:null;c.nextPoint=g;var p=c.prePoint;if(["L","H","V"].includes(u))c.startTangent=[p[0]-e[0],p[1]-e[1]],c.endTangent=[e[0]-p[0],e[1]-p[1]];else if(u==="Q"){var v=[l[1],l[2]];c.startTangent=[p[0]-v[0],p[1]-v[1]],c.endTangent=[e[0]-v[0],e[1]-v[1]]}else if(u==="T"){var m=t[o-1],b=cM(m.currentPoint,p);m.command==="Q"?(c.command="Q",c.startTangent=[p[0]-b[0],p[1]-b[1]],c.endTangent=[e[0]-b[0],e[1]-b[1]]):(c.command="TL",c.startTangent=[p[0]-e[0],p[1]-e[1]],c.endTangent=[e[0]-p[0],e[1]-p[1]])}else if(u==="C"){var w=[l[1],l[2]],x=[l[3],l[4]];c.startTangent=[p[0]-w[0],p[1]-w[1]],c.endTangent=[e[0]-x[0],e[1]-x[1]],c.startTangent[0]===0&&c.startTangent[1]===0&&(c.startTangent=[w[0]-x[0],w[1]-x[1]]),c.endTangent[0]===0&&c.endTangent[1]===0&&(c.endTangent=[x[0]-w[0],x[1]-w[1]])}else if(u==="S"){var S=t[o-1],_=cM(S.currentPoint,p),k=[l[1],l[2]];S.command==="C"?(c.command="C",c.startTangent=[p[0]-_[0],p[1]-_[1]],c.endTangent=[e[0]-k[0],e[1]-k[1]]):(c.command="SQ",c.startTangent=[p[0]-k[0],p[1]-k[1]],c.endTangent=[e[0]-k[0],e[1]-k[1]])}else if(u==="A"){var M=fM(c,0),C=M.x,P=M.y,T=fM(c,1,!1),A=T.x,R=T.y;c.startTangent=[C,P],c.endTangent=[A,R]}t.push(c)}return t}function fM(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,l=n.xRotation,u=n.arcFlag,c=n.sweepFlag,h=dM({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},t),d=dM({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),g=d.x-h.x,p=d.y-h.y,v=Math.sqrt(g*g+p*p);return{x:-g/v,y:-p/v}}function Kh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Cw(r,t){return Kh(r)*Kh(t)?(r[0]*t[0]+r[1]*t[1])/(Kh(r)*Kh(t)):1}function gM(r,t){return(r[0]*t[1]<r[1]*t[0]?-1:1)*Math.acos(Cw(r,t))}function ZV(r,t){var e=t[1],n=t[2],i=ZR(me(t[3]),Math.PI*2),a=t[4],s=t[5],o=r[0],l=r[1],u=t[6],c=t[7],h=Math.cos(i)*(o-u)/2+Math.sin(i)*(l-c)/2,d=-1*Math.sin(i)*(o-u)/2+Math.cos(i)*(l-c)/2,g=h*h/(e*e)+d*d/(n*n);g>1&&(e*=Math.sqrt(g),n*=Math.sqrt(g));var p=e*e*(d*d)+n*n*(h*h),v=p?Math.sqrt((e*e*(n*n)-p)/p):1;a===s&&(v*=-1),isNaN(v)&&(v=0);var m=n?v*e*d/n:0,b=e?v*-n*h/e:0,w=(o+u)/2+Math.cos(i)*m-Math.sin(i)*b,x=(l+c)/2+Math.sin(i)*m+Math.cos(i)*b,S=[(h-m)/e,(d-b)/n],_=[(-1*h-m)/e,(-1*d-b)/n],k=gM([1,0],S),M=gM(S,_);return Cw(S,_)<=-1&&(M=Math.PI),Cw(S,_)>=1&&(M=0),s===0&&M>0&&(M-=2*Math.PI),s===1&&M<0&&(M+=2*Math.PI),{cx:w,cy:x,rx:Mf(r,[u,c])?0:e,ry:Mf(r,[u,c])?0:n,startAngle:k,endAngle:k+M,xRotation:i,arcFlag:a,sweepFlag:s}}var CL=function(t){if(t===""||Array.isArray(t)&&t.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=bf(t)}catch{e=bf(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}HV(e);var n=UV(e),i=YV(e),a=i.polygons,s=i.polylines,o=KV(e),l=XV(o,0),u=l.x,c=l.y,h=l.width,d=l.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(u)?u:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(h)?h:0,height:Number.isFinite(d)?d:0}}},JV=vn(CL);function TL(r){return se(r)?JV(r):CL(r)}function QV(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=pw(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=pw(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=oL(n,i));var s=W3(a[0])!==W3(a[1])?rG(a[0]):nG(a[0]);return[s,hG(a[1],s),function(o){return o}]}function tH(r,t){var e;return se(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=Lt(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function eH(r,t){return[r.points,t.points,function(e){return e}]}var Ye=null,zl=/\s*(\w+)\(([^)]*)\)/g;function vr(r){return function(t){var e=0;return r.map(function(n){return n===Ye?t[e++]:n})}}function co(r){return r}var gc={matrix:["NNNNNN",[Ye,Ye,0,0,Ye,Ye,0,0,0,0,1,0,Ye,Ye,0,1],co],matrix3d:["NNNNNNNNNNNNNNNN",co],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",vr([Ye,Ye,new An(1)]),co],scaleX:["N",vr([Ye,new An(1),new An(1)]),vr([Ye,new An(1)])],scaleY:["N",vr([new An(1),Ye,new An(1)]),vr([new An(1),Ye])],scaleZ:["N",vr([new An(1),new An(1),Ye])],scale3d:["NNN",co],skew:["Aa",null,co],skewX:["A",null,vr([Ye,Io])],skewY:["A",null,vr([Io,Ye])],translate:["Tt",vr([Ye,Ye,Oi]),co],translateX:["T",vr([Ye,Oi,Oi]),vr([Ye,Oi])],translateY:["T",vr([Oi,Ye,Oi]),vr([Oi,Ye])],translateZ:["L",vr([Oi,Oi,Ye])],translate3d:["TTL",co]};function OL(r){for(var t=[],e=r.length,n=0;n<e;n++){var i=r[n],a=i[0],s=i.slice(1);a==="translate"||a==="skew"?s.length===1&&s.push(0):a==="scale"&&s.length===1&&s.push(s[0]);var o=gc[a];if(!o)return[];var l=s.map(function(u){return ze(u)});t.push({t:a,d:l})}return t}function AL(r){if(Array.isArray(r))return OL(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(zl.lastIndex=0;e=zl.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=gc[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(p){return p.trim()==="0"?Io:$V(p)},N:Mw,T:Sw,L:BV}[h.toUpperCase()](c):d={a:Io,n:l[0],t:Oi}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),zl.lastIndex===r.length)return t}return[]}function nH(r){if(Array.isArray(r))return OL(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(zl.lastIndex=0;e=zl.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=gc[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(p){return p.trim()==="0"?Io:_L(p)},N:ML,T:EL,L:xL}[h.toUpperCase()](c):d={a:Io,n:l[0],t:Oi}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),zl.lastIndex===r.length)return t}return[]}function rH(r){var t,e,n,i;switch(r.t){case"rotateX":return i=me(xr(r.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotateY":return i=me(xr(r.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotateZ":return i=me(xr(r.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":t=r.d[0].value,e=r.d[1].value,n=r.d[2].value,i=me(xr(r.d[3]));var a=t*t+e*e+n*n;if(a===0)t=1,e=0,n=0;else if(a!==1){var s=Math.sqrt(a);t/=s,e/=s,n/=s}var o=Math.sin(i/2),l=o*Math.cos(i/2),u=o*o;return[1-2*(e*e+n*n)*u,2*(t*e*u+n*l),2*(t*n*u-e*l),0,2*(t*e*u-n*l),1-2*(t*t+n*n)*u,2*(e*n*u+t*l),0,2*(t*n*u+e*l),2*(e*n*u-t*l),1-2*(t*t+e*e)*u,0,0,0,0,1];case"scale":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[r.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaleY":return[1,0,0,0,0,r.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scaleZ":return[1,0,0,0,0,1,0,0,0,0,r.d[0].value,0,0,0,0,1];case"scale3d":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,r.d[2].value,0,0,0,0,1];case"skew":var c=me(xr(r.d[0])),h=me(xr(r.d[1]));return[1,Math.tan(h),0,0,Math.tan(c),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=me(xr(r.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return i=me(xr(r.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return t=Fr(r.d[0],0,null)||0,e=Fr(r.d[1],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1];case"translateX":return t=Fr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,0,0,1];case"translateY":return e=Fr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,e,0,1];case"translateZ":return n=Fr(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,n,1];case"translate3d":return t=Fr(r.d[0],0,null)||0,e=Fr(r.d[1],0,null)||0,n=Fr(r.d[2],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,n,1];case"perspective":var d=Fr(r.d[0],0,null)||0,g=d?-1/d:0;return[1,0,0,0,0,1,0,0,0,0,1,g,0,0,0,1];case"matrix":return[r.d[0].value,r.d[1].value,0,0,r.d[2].value,r.d[3].value,0,0,0,0,1,0,r.d[4].value,r.d[5].value,0,1];case"matrix3d":return r.d.map(function(p){return p.value})}}function iH(r,t){return[r[0]*t[0]+r[4]*t[1]+r[8]*t[2]+r[12]*t[3],r[1]*t[0]+r[5]*t[1]+r[9]*t[2]+r[13]*t[3],r[2]*t[0]+r[6]*t[1]+r[10]*t[2]+r[14]*t[3],r[3]*t[0]+r[7]*t[1]+r[11]*t[2]+r[15]*t[3],r[0]*t[4]+r[4]*t[5]+r[8]*t[6]+r[12]*t[7],r[1]*t[4]+r[5]*t[5]+r[9]*t[6]+r[13]*t[7],r[2]*t[4]+r[6]*t[5]+r[10]*t[6]+r[14]*t[7],r[3]*t[4]+r[7]*t[5]+r[11]*t[6]+r[15]*t[7],r[0]*t[8]+r[4]*t[9]+r[8]*t[10]+r[12]*t[11],r[1]*t[8]+r[5]*t[9]+r[9]*t[10]+r[13]*t[11],r[2]*t[8]+r[6]*t[9]+r[10]*t[10]+r[14]*t[11],r[3]*t[8]+r[7]*t[9]+r[11]*t[10]+r[15]*t[11],r[0]*t[12]+r[4]*t[13]+r[8]*t[14]+r[12]*t[15],r[1]*t[12]+r[5]*t[13]+r[9]*t[14]+r[13]*t[15],r[2]*t[12]+r[6]*t[13]+r[10]*t[14]+r[14]*t[15],r[3]*t[12]+r[7]*t[13]+r[11]*t[14]+r[15]*t[15]]}function aH(r){return r.length===0?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:r.map(rH).reduce(iH)}function pM(r){var t=[0,0,0],e=[1,1,1],n=[0,0,0],i=[0,0,0,1],a=[0,0,0,1];return UG(aH(r),t,e,n,i,a),[[t,e,n,a,i]]}var sH=function(){function r(n,i){for(var a=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],s=0;s<4;s++)for(var o=0;o<4;o++)for(var l=0;l<4;l++)a[s][o]+=i[s][l]*n[l][o];return a}function t(n){return n[0][2]===0&&n[0][3]===0&&n[1][2]===0&&n[1][3]===0&&n[2][0]===0&&n[2][1]===0&&n[2][2]===1&&n[2][3]===0&&n[3][2]===0&&n[3][3]===1}function e(n,i,a,s,o){for(var l=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],u=0;u<4;u++)l[u][3]=o[u];for(var c=0;c<3;c++)for(var h=0;h<3;h++)l[3][c]+=n[h]*l[h][c];var d=s[0],g=s[1],p=s[2],v=s[3],m=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];m[0][0]=1-2*(g*g+p*p),m[0][1]=2*(d*g-p*v),m[0][2]=2*(d*p+g*v),m[1][0]=2*(d*g+p*v),m[1][1]=1-2*(d*d+p*p),m[1][2]=2*(g*p-d*v),m[2][0]=2*(d*p-g*v),m[2][1]=2*(g*p+d*v),m[2][2]=1-2*(d*d+g*g),l=r(l,m);var b=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];a[2]&&(b[2][1]=a[2],l=r(l,b)),a[1]&&(b[2][1]=0,b[2][0]=a[0],l=r(l,b)),a[0]&&(b[2][0]=0,b[1][0]=a[0],l=r(l,b));for(var w=0;w<3;w++)for(var x=0;x<3;x++)l[w][x]*=i[w];return t(l)?[l[0][0],l[0][1],l[1][0],l[1][1],l[3][0],l[3][1]]:l[0].concat(l[1],l[2],l[3])}return e}();function oH(r){return r.toFixed(6).replace(".000000","")}function Mv(r,t){var e,n;return r.decompositionPair!==t&&(r.decompositionPair=t,e=pM(r)),t.decompositionPair!==r&&(t.decompositionPair=r,n=pM(t)),e[0]===null||n[0]===null?[[!1],[!0],function(i){return i?t[0].d:r[0].d}]:(e[0].push(0),n[0].push(1),[e,n,function(i){var a=uH(e[0][3],n[0][3],i[5]),s=sH(i[0],i[1],i[2],a,i[4]),o=s.map(oH).join(",");return o}])}function lH(r,t){for(var e=0,n=0;n<r.length;n++)e+=r[n]*t[n];return e}function uH(r,t,e){var n=lH(r,t);n=Ke(n,-1,1);var i=[];if(n===1)i=r;else for(var a=Math.acos(n),s=Math.sin(e*a)*1/Math.sqrt(1-n*n),o=0;o<4;o++)i.push(r[o]*(Math.cos(e*a)-n*s)+t[o]*s);return i}function kv(r){return r.replace(/[XY]/,"")}function Cv(r){return r.replace(/(X|Y|Z|3d)?$/,"3d")}var cH=function(t,e){return t==="perspective"&&e==="perspective"||(t==="matrix"||t==="matrix3d")&&(e==="matrix"||e==="matrix3d")};function hH(r,t,e){var n=!1;if(!r.length||!t.length){r.length||(n=!0,r=t,t=[]);for(var i=function(){var A=r[a],R=A.t,L=A.d,$=R.substring(0,5)==="scale"?1:0;t.push({t:R,d:L.map(function(q){return typeof q=="number"?ze($):ze($,q.unit)})})},a=0;a<r.length;a++)i()}var s=[],o=[],l=[];if(r.length!==t.length){var u=Mv(r,t);s=[u[0]],o=[u[1]],l=[["matrix",[u[2]]]]}else for(var c=0;c<r.length;c++){var h=r[c].t,d=t[c].t,g=r[c].d,p=t[c].d,v=gc[h],m=gc[d],b=void 0;if(cH(h,d)){var w=Mv([r[c]],[t[c]]);s.push(w[0]),o.push(w[1]),l.push(["matrix",[w[2]]]);continue}else if(h===d)b=h;else if(v[2]&&m[2]&&kv(h)===kv(d))b=kv(h),g=v[2](g),p=m[2](p);else if(v[1]&&m[1]&&Cv(h)===Cv(d))b=Cv(h),g=v[1](g),p=m[1](p);else{var x=Mv(r,t);s=[x[0]],o=[x[1]],l=[["matrix",[x[2]]]];break}for(var S=[],_=[],k=[],M=0;M<g.length;M++){var C=jV(g[M],p[M],e,!1,M);S[M]=C[0],_[M]=C[1],k.push(C[2])}s.push(S),o.push(_),l.push([b,k])}if(n){var P=s;s=o,o=P}return[s,o,function(T){return T.map(function(A,R){var L=A.map(function($,q){return l[R][1][q]($)}).join(",");return l[R][0]==="matrix"&&L.split(",").length===16&&(l[R][0]="matrix3d"),l[R][0]==="matrix3d"&&L.split(",").length===6&&(l[R][0]="matrix"),"".concat(l[R][0],"(").concat(L,")")}).join(" ")}]}var dH=vn(function(r){if(se(r)){if(r==="text-anchor")return[ze(0,"px"),ze(0,"px")];var t=r.split(" ");return t.length===1&&(t[0]==="top"||t[0]==="bottom"?(t[1]=t[0],t[0]="center"):t[1]="center"),t.length!==2?null:[Sw(vM(t[0])),Sw(vM(t[1]))]}return[ze(r[0]||0,"px"),ze(r[1]||0,"px")]});function vM(r){return r==="center"?"50%":r==="left"||r==="top"?"0%":r==="right"||r==="bottom"?"100%":r}var Fx=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:ft.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:ft.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:ft.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:ft.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:ft.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:ft.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:ft.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:ft.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:ft.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:ft.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:ft.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:ft.FILTER},{n:"clipPath",syntax:ft.DEFINED_PATH},{n:"textPath",syntax:ft.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:ft.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:ft.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"y1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"z1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"x2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"y2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"z2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:ft.PATH,p:50},{n:"points",int:!0,l:!0,syntax:ft.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:ft.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:ft.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:ft.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:ft.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:ft.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:ft.NUMBER,d:function(t){return t===Q.PATH||t===Q.POLYGON||t===Q.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:ft.MARKER},{n:"markerEnd",syntax:ft.MARKER},{n:"markerMid",syntax:ft.MARKER},{n:"markerStartOffset",syntax:ft.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:ft.LENGTH,l:!0,int:!0,d:"0"}],fH=new Set(Fx.filter(function(r){return!!r.l}).map(function(r){return r.n})),PL={},gH=function(){function r(t){var e=this;st(this,r),this.runtime=t,Fx.forEach(function(n){e.registerMetadata(n)})}return at(r,[{key:"registerMetadata",value:function(e){[e.n].concat(Ce(e.a||[])).forEach(function(n){PL[n]=e})}},{key:"getPropertySyntax",value:function(e){return this.runtime.CSSPropertySyntaxFactory[e]}},{key:"processProperties",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{forceUpdateGeometry:!1};Object.assign(e.attributes,n);var a=e.parsedStyle.clipPath,s=e.parsedStyle.offsetPath;pH(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var l in n)if(fH.has(l)){o=!0;break}}var u=NL(e);u.has("fill")&&n.fill&&(e.parsedStyle.fill=ic(n.fill)),u.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=ic(n.stroke)),u.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=ic(n.shadowColor)),u.has("filter")&&n.filter&&(e.parsedStyle.filter=GV(n.filter)),u.has("radius")&&!kt(n.radius)&&(e.parsedStyle.radius=uM(n.radius,4)),u.has("lineDash")&&!kt(n.lineDash)&&(e.parsedStyle.lineDash=uM(n.lineDash,"even")),u.has("points")&&n.points&&(e.parsedStyle.points=tH(n.points)),u.has("d")&&n.d===""&&(e.parsedStyle.d=Bt({},pL)),u.has("d")&&n.d&&(e.parsedStyle.d=TL(n.d)),u.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[ft.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),u.has("clipPath")&&!Nt(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[ft.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),u.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[ft.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),u.has("transform")&&n.transform&&(e.parsedStyle.transform=AL(n.transform)),u.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=dH(n.transformOrigin)),u.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),u.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),u.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),u.has("zIndex")&&!kt(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[ft.Z_INDEX].postProcessor(e),u.has("offsetDistance")&&!kt(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[ft.OFFSET_DISTANCE].postProcessor(e),u.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[ft.TRANSFORM].postProcessor(e),u.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[ft.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.geometry.dirty=!0,e.renderable.boundsDirty=!0,e.renderable.renderBoundsDirty=!0,i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtifyToRoot(e))}},{key:"updateGeometry",value:function(e){var n=e.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=e.geometry;a.contentBounds||(a.contentBounds=new Me),a.renderBounds||(a.renderBounds=new Me);var s=e.parsedStyle,o=i.update(s,e),l=o.cx,u=l===void 0?0:l,c=o.cy,h=c===void 0?0:c,d=o.cz,g=d===void 0?0:d,p=o.hwidth,v=p===void 0?0:p,m=o.hheight,b=m===void 0?0:m,w=o.hdepth,x=w===void 0?0:w,S=[Math.abs(v),Math.abs(b),x],_=s.stroke,k=s.lineWidth,M=k===void 0?1:k,C=s.increasedLineWidthForHitTesting,P=C===void 0?0:C,T=s.shadowType,A=T===void 0?"outer":T,R=s.shadowColor,L=s.filter,$=L===void 0?[]:L,q=s.transformOrigin,j=[u,h,g];a.contentBounds.update(j,S);var B=n===Q.POLYLINE||n===Q.POLYGON||n===Q.PATH?Math.SQRT2:.5,F=_&&!_.isNone;if(F){var V=((M||0)+(P||0))*B;S[0]+=V,S[1]+=V}if(a.renderBounds.update(j,S),R&&A&&A!=="inner"){var X=a.renderBounds,K=X.min,nt=X.max,ot=s.shadowBlur,ct=s.shadowOffsetX,ht=s.shadowOffsetY,pt=ot||0,wt=ct||0,zt=ht||0,Wt=K[0]-pt+wt,Te=nt[0]+pt+wt,Ge=K[1]-pt+zt,Ve=nt[1]+pt+zt;K[0]=Math.min(K[0],Wt),nt[0]=Math.max(nt[0],Te),K[1]=Math.min(K[1],Ge),nt[1]=Math.max(nt[1],Ve),a.renderBounds.setMinMax(K,nt)}$.forEach(function(Gt){var Xr=Gt.name,Tr=Gt.params;if(Xr==="blur"){var qi=Tr[0].value;a.renderBounds.update(a.renderBounds.center,Ns(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[qi,qi,0]))}else if(Xr==="drop-shadow"){var bn=Tr[0].value,Dn=Tr[1].value,$e=Tr[2].value,fa=a.renderBounds,Cn=fa.min,xi=fa.max,Wi=Cn[0]-$e+bn,tr=xi[0]+$e+bn,Qa=Cn[1]-$e+Dn,ts=xi[1]+$e+Dn;Cn[0]=Math.min(Cn[0],Wi),xi[0]=Math.max(xi[0],tr),Cn[1]=Math.min(Cn[1],Qa),xi[1]=Math.max(xi[1],ts),a.renderBounds.setMinMax(Cn,xi)}}),e.geometry.dirty=!1;var In=v<0,yn=b<0,te=(In?-1:1)*(q?Fr(q[0],0,e,!0):0),wi=(yn?-1:1)*(q?Fr(q[1],1,e,!0):0);(te||wi)&&e.setOrigin(te,wi)}}},{key:"updateSizeAttenuation",value:function(e,n){e.style.isSizeAttenuation?(e.style.rawLineWidth||(e.style.rawLineWidth=e.style.lineWidth),e.style.lineWidth=(e.style.rawLineWidth||1)/n,e.nodeName===Q.CIRCLE&&(e.style.rawR||(e.style.rawR=e.style.r),e.style.r=(e.style.rawR||1)/n)):(e.style.rawLineWidth&&(e.style.lineWidth=e.style.rawLineWidth,delete e.style.rawLineWidth),e.nodeName===Q.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function pH(r,t){var e=NL(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function NL(r){return r.constructor.PARSED_STYLE_LIST}var vH=function(){function r(){st(this,r),this.mixer=Ix}return at(r,[{key:"calculator",value:function(e,n,i,a){return xr(i)}}])}(),mH=function(){function r(){st(this,r)}return at(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof vi&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtifyToRoot(o)}),i}}])}(),yH=function(){function r(){st(this,r),this.parser=ic,this.mixer=FV}return at(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof vi?i.value==="none"?yL:bL:i}}])}(),bH=function(){function r(){st(this,r)}return at(r,[{key:"calculator",value:function(e,n,i){return i instanceof vi?[]:i}}])}();function mM(r){var t=r.parsedStyle,e=t.fontSize;return kt(e)?null:e}var Tw=function(){function r(){st(this,r),this.mixer=Ix}return at(r,[{key:"calculator",value:function(e,n,i,a,s){if(yt(i))return i;if(An.isRelativeUnit(i.unit)){if(i.unit===gt.kPercentage)return 0;if(i.unit===gt.kEms){if(a.parentNode){var o=mM(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===gt.kRems){var l;if(a!=null&&(l=a.ownerDocument)!==null&&l!==void 0&&l.documentElement){var u=mM(a.ownerDocument.documentElement);if(u)return u*=i.value,u}return 0}}else return i.value}}])}(),wH=function(){function r(){st(this,r),this.mixer=kL}return at(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),xH=function(){function r(){st(this,r),this.mixer=kL}return at(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),EH=function(){function r(){st(this,r)}return at(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof vi&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),_H=function(){function r(){st(this,r),this.mixer=Ix}return at(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),SH=function(){function r(){st(this,r),this.mixer=Dx(0,1)}return at(r,[{key:"calculator",value:function(e,n,i){return i.value}},{key:"postProcessor",value:function(e){var n=e.parsedStyle,i=n.offsetPath,a=n.offsetDistance;if(i){var s=i.nodeName;if(s===Q.LINE||s===Q.PATH||s===Q.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),MH=function(){function r(){st(this,r),this.mixer=Dx(0,1)}return at(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),kH=function(){function r(){st(this,r),this.parser=TL,this.mixer=QV}return at(r,[{key:"calculator",value:function(e,n,i){return i instanceof vi&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Hl(0,0,0,0)}:i}}])}(),CH=at(function r(){st(this,r),this.mixer=eH}),TH=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.mixer=Dx(0,1/0),e}return jt(t,r),at(t)}(Tw),OH=function(){function r(){st(this,r)}return at(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof vi?i.value==="unset"?"":i.value:"".concat(i)}},{key:"postProcessor",value:function(e){e.nodeValue="".concat(e.parsedStyle.text)||""}}])}(),AH=function(){function r(){st(this,r)}return at(r,[{key:"calculator",value:function(e,n,i,a){var s=a.getAttribute("text");if(s){var o=s;i.value==="capitalize"?o=s.charAt(0).toUpperCase()+s.slice(1):i.value==="lowercase"?o=s.toLowerCase():i.value==="uppercase"&&(o=s.toUpperCase()),a.parsedStyle.text=o}return i.value}}])}(),Tv=new WeakMap;function PH(r,t,e){if(r){var n=typeof r=="string"?document.getElementById(r):r;Tv.has(n)&&Tv.get(n).destroy(e),Tv.set(n,t)}}var Bx=typeof window<"u"&&typeof window.document<"u";function NH(r){return!!r.getAttribute}function RH(r,t){for(var e=0,n=r.length;e<n;){var i=e+n>>>1;RL(r[i],t)<0?e=i+1:n=i}return e}function RL(r,t){var e=Number(r.parsedStyle.zIndex||0),n=Number(t.parsedStyle.zIndex||0);if(e===n){var i=r.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(r)-a.indexOf(t)}}return e-n}function LL(r){var t=r;do{var e,n=(e=t.parsedStyle)===null||e===void 0?void 0:e.clipPath;if(n)return t;t=t.parentElement}while(t!==null);return null}var yM="px";function LH(r,t,e){Bx&&r.style&&(r.style.width=t+yM,r.style.height=e+yM)}function IL(r,t){if(Bx)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function IH(r){var t=IL(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function DH(r){var t=IL(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var FH=1,BH={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ow=typeof performance=="object"&&performance.now?performance:Date;function kf(r){return r.nodeName===Q.FRAGMENT?!0:r.getRootNode().nodeName===Q.FRAGMENT}function Go(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auto",t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,n=!1,i=!1,a=!!t&&!t.isNone,s=!!e&&!e.isNone;return r==="visiblepainted"||r==="painted"||r==="auto"?(n=a,i=s):r==="visiblefill"||r==="fill"?n=!0:r==="visiblestroke"||r==="stroke"?i=!0:(r==="visible"||r==="all")&&(n=!0,i=!0),[n,i]}var zH=1,$H=function(){return zH++},aa=typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:{},jH=Date.now(),qH=function(){return aa.performance&&typeof aa.performance.now=="function"?aa.performance.now():Date.now()-jH},zu={},bM=Date.now(),WH=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-bM,i=n>16?0:16-n,a=$H();return zu[a]=t,Object.keys(zu).length>1||setTimeout(function(){bM=e;var s=zu;zu={},Object.keys(s).forEach(function(o){return s[o](qH())})},i),a},GH=function(t){delete zu[t]},VH=["","webkit","moz","ms","o"],DL=function(t){return typeof t!="string"?WH:t===""?aa.requestAnimationFrame:aa["".concat(t,"RequestAnimationFrame")]},HH=function(t){return typeof t!="string"?GH:t===""?aa.cancelAnimationFrame:aa["".concat(t,"CancelAnimationFrame")]||aa["".concat(t,"CancelRequestAnimationFrame")]},UH=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},FL=UH(VH,function(r){return!!DL(r)}),zx=DL(FL),BL=HH(FL);aa.requestAnimationFrame=zx;aa.cancelAnimationFrame=BL;var YH=function(){function r(){st(this,r),this.callbacks=[]}return at(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return Promise.all(this.callbacks.map(function(a){return a.apply(void 0,n)}))}}])}(),XH=function(){function r(){st(this,r),this.callbacks=[]}return at(r,[{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){var t=Bs(qn().mark(function n(){var i,a,s,o,l=arguments;return qn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!this.callbacks.length){c.next=14;break}return c.next=3,(i=this.callbacks)[0].apply(i,l);case 3:a=c.sent,s=0;case 5:if(!(s<this.callbacks.length-1)){c.next=13;break}return o=this.callbacks[s],c.next=9,o(a);case 9:a=c.sent;case 10:s++,c.next=5;break;case 13:return c.abrupt("return",a);case 14:return c.abrupt("return",null);case 15:case"end":return c.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),ir=function(){function r(){st(this,r),this.callbacks=[]}return at(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var a=arguments;this.callbacks.forEach(function(s){s.apply(void 0,a)})}}])}(),Ov=function(){function r(){st(this,r),this.callbacks=[]}return at(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(this.callbacks.length){for(var a=arguments,s=this.callbacks[0].apply(void 0,a),o=0;o<this.callbacks.length-1;o++){var l=this.callbacks[o];s=l(s)}return s}return null}}])}(),KH=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ZH=/([\"\'])[^\'\"]+\1/;function JH(r){for(var t=r.fontSize,e=t===void 0?16:t,n=r.fontFamily,i=n===void 0?"sans-serif":n,a=r.fontStyle,s=a===void 0?"normal":a,o=r.fontVariant,l=o===void 0?"normal":o,u=r.fontWeight,c=u===void 0?"normal":u,h=yt(e)&&"".concat(e,"px")||"16px",d=i.split(","),g=d.length-1;g>=0;g--){var p=d[g].trim();!ZH.test(p)&&KH.indexOf(p)<0&&(p='"'.concat(p,'"')),d[g]=p}return"".concat(s," ").concat(l," ").concat(c," ").concat(h," ").concat(d.join(","))}function Av(r,t,e){return zs(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var on=Se(),QH=Se(),tU={scale:function(t){mo(on,[t[0].value,t[1].value,1])},scaleX:function(t){mo(on,[t[0].value,1,1])},scaleY:function(t){mo(on,[1,t[0].value,1])},scaleZ:function(t){mo(on,[1,1,t[0].value])},scale3d:function(t){mo(on,[t[0].value,t[1].value,t[2].value])},translate:function(t){ws(on,[t[0].value,t[1].value,0])},translateX:function(t){ws(on,[t[0].value,0,0])},translateY:function(t){ws(on,[0,t[0].value,0])},translateZ:function(t){ws(on,[0,0,t[0].value])},translate3d:function(t){ws(on,[t[0].value,t[1].value,t[2].value])},rotate:function(t){ow(on,me(xr(t[0])))},rotateX:function(t){BR(on,me(xr(t[0])))},rotateY:function(t){zR(on,me(xr(t[0])))},rotateZ:function(t){ow(on,me(xr(t[0])))},rotate3d:function(t){FR(on,me(xr(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){Av(on,me(t[0].value),me(t[1].value))},skewX:function(t){Av(on,me(t[0].value),0)},skewY:function(t){Av(on,0,me(t[0].value))},matrix:function(t){sw(on,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){sw.apply(Jq,[on].concat(Ce(t.map(function(e){return e.value}))))}},eU=Ae(1,1,1),nU=Qt(),wM={translate:function(t,e){lt.sceneGraphService.setLocalScale(t,eU,!1),lt.sceneGraphService.setLocalEulerAngles(t,nU,void 0,void 0,!1),lt.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),lt.sceneGraphService.dirtifyLocal(t,t.transformable)}};function zL(r,t){if(r.length){if(r.length===1&&wM[r[0].t]){wM[r[0].t](t,r[0].d);return}for(var e=zs(QH),n=0;n<r.length;n++){var i=r[n],a=i.t,s=i.d,o=tU[a];o&&(o(s),UR(e,e,on))}t.setLocalTransform(e)}else t.resetLocalTransform();return t.getLocalTransform()}var rU=function(){function r(){st(this,r),this.parser=nH,this.mixer=hH}return at(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof vi?[]:i}},{key:"postProcessor",value:function(e){zL(e.parsedStyle.transform,e)}}])}(),iU=function(){function r(){st(this,r)}return at(r,[{key:"postProcessor",value:function(e){var n=e.parsedStyle.transformOrigin;n[0].unit===gt.kPixels&&n[1].unit===gt.kPixels?e.setOrigin(n[0].value,n[1].value):e.getGeometryBounds()}}])}(),aU=function(){function r(){st(this,r)}return at(r,[{key:"calculator",value:function(e,n,i,a){return i.value}},{key:"postProcessor",value:function(e){if(e.parentNode){var n=e.parentNode,i=n.renderable,a=n.sortable;i&&(i.dirty=!0),a&&(a.dirty=!0,a.dirtyReason=xf.Z_INDEX_CHANGED)}}}])}(),sU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.r,u=l===void 0?0:l;return{cx:a,cy:o,hwidth:u,hheight:u}}}])}(),oU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.rx,u=l===void 0?0:l,c=e.ry,h=c===void 0?0:c;return{cx:a,cy:o,hwidth:u,hheight:h}}}])}(),lU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e){var n=e.x1,i=e.y1,a=e.x2,s=e.y2,o=Math.min(n,a),l=Math.max(n,a),u=Math.min(i,s),c=Math.max(i,s),h=l-o,d=c-u,g=h/2,p=d/2;return{cx:o+g,cy:u+p,hwidth:g,hheight:p}}}])}(),uU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e){var n=e.d,i=n.rect,a=i.x,s=i.y,o=i.width,l=i.height,u=o/2,c=l/2;return{cx:a+u,cy:s+c,hwidth:u,hheight:c}}}])}(),cU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e){if(e.points&&Yr(e.points.points)){var n=e.points.points,i=Math.min.apply(Math,Ce(n.map(function(d){return d[0]}))),a=Math.max.apply(Math,Ce(n.map(function(d){return d[0]}))),s=Math.min.apply(Math,Ce(n.map(function(d){return d[1]}))),o=Math.max.apply(Math,Ce(n.map(function(d){return d[1]}))),l=a-i,u=o-s,c=l/2,h=u/2;return{cx:i+c,cy:s+h,hwidth:c,hheight:h}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),hU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.src,u=e.width,c=u===void 0?0:u,h=e.height,d=h===void 0?0:h,g=c,p=d;return l&&!se(l)&&(g||(g=l.width,e.width=g),p||(p=l.height,e.height=p)),{cx:a+g/2,cy:o+p/2,hwidth:g/2,hheight:p/2}}}])}(),dU=function(){function r(t){st(this,r),this.globalRuntime=t}return at(r,[{key:"isReadyToMeasure",value:function(e,n){var i=e.text;return i}},{key:"update",value:function(e,n){var i,a=e.text,s=e.textAlign,o=s===void 0?"start":s,l=e.lineWidth,u=l===void 0?1:l,c=e.textBaseline,h=c===void 0?"alphabetic":c,d=e.dx,g=d===void 0?0:d,p=e.dy,v=p===void 0?0:p,m=e.x,b=m===void 0?0:m,w=e.y,x=w===void 0?0:w;if(!this.isReadyToMeasure(e,n))return e.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{hwidth:0,hheight:0,cx:0,cy:0};var S=(n==null||(i=n.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0?void 0:i.getConfig())||{},_=S.offscreenCanvas,k=this.globalRuntime.textService.measureText(a,e,_);e.metrics=k;var M=k.width,C=k.height,P=M/2,T=C/2,A=b+P;o==="center"||o==="middle"?A+=u/2-P:(o==="right"||o==="end")&&(A+=u-P*2);var R=x-T;return h==="middle"?R+=T:h==="top"||h==="hanging"?R+=T*2:h==="alphabetic"||(h==="bottom"||h==="ideographic")&&(R+=0),g&&(A+=g),v&&(R+=v),{cx:A,cy:R,hwidth:P,hheight:T}}}])}(),fU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e,n){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),gU=function(){function r(){st(this,r)}return at(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.width,u=l===void 0?0:l,c=e.height,h=c===void 0?0:c;return{cx:a+u/2,cy:o+h/2,hwidth:u/2,hheight:h/2}}}])}(),u0=function(){function r(t){st(this,r),this.eventPhase=r.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new $n,this.page=new $n,this.canvas=new $n,this.viewport=new $n,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}return at(r,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}},{key:"clone",value:function(){throw new Error(ve)}}])}(),$L=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.client=new $n,e.movement=new $n,e.offset=new $n,e.global=new $n,e.screen=new $n,e}return jt(t,r),at(t,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(n){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(n)}},{key:"initMouseEvent",value:function(){throw new Error(ve)}}])}(u0),Cf=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.width=0,e.height=0,e.isPrimary=!1,e}return jt(t,r),at(t,[{key:"getCoalescedEvents",value:function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])}($L),Aw=function(r){function t(){return st(this,t),qt(this,t,arguments)}return jt(t,r),at(t,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}($L),dn=function(r){function t(e,n){var i;return st(this,t),i=qt(this,t,[null]),i.type=e,i.detail=n,Object.assign(i,n),i}return jt(t,r),at(t)}(u0),xM=new WeakMap,jL=function(){function r(){st(this,r),this.emitter=new TR}return at(r,[{key:"on",value:function(e,n,i){return this.addEventListener(e,n,i),this}},{key:"addEventListener",value:function(e,n,i){var a=!1,s=!1;if(yf(i))a=i;else if(i){var o=i.capture;a=o===void 0?!1:o;var l=i.once;s=l===void 0?!1:l}a&&(e+="capture"),n=Et(n)?n:n.handleEvent;var u=Et(n)?void 0:n;return s?this.emitter.once(e,n,u):this.emitter.on(e,n,u),this}},{key:"off",value:function(e,n,i){return e?this.removeEventListener(e,n,i):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var e;(e=this.emitter)===null||e===void 0||e.removeAllListeners()}},{key:"removeEventListener",value:function(e,n,i){var a;if(!this.emitter)return this;var s=yf(i)?i:i==null?void 0:i.capture;s&&(e+="capture"),n=Et(n)?n:(a=n)===null||a===void 0?void 0:a.handleEvent;var o=Et(n)?void 0:n;return this.emitter.off(e,n,o),this}},{key:"emit",value:function(e,n){this.dispatchEvent(new dn(e,n))}},{key:"dispatchEvent",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=xM.get(this);if(!i){var a;this.document?i=this:this.defaultView?i=this.defaultView:i=(a=this.ownerDocument)===null||a===void 0?void 0:a.defaultView,i&&xM.set(this,i)}if(i){if(e.manager=i.getEventService(),!e.manager)return!1;e.defaultPrevented=!1,e.path?e.path.length=0:e.page=[],n||(e.target=this),e.manager.dispatchEvent(e,e.type,n)}else this.emitter.emit(e.type,e);return!e.defaultPrevented}}])}(),qe=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.shadow=!1,e.ownerDocument=null,e.isConnected=!1,e.baseURI="",e.childNodes=[],e.nodeType=0,e.nodeName="",e.nodeValue=null,e.parentNode=null,e}return jt(t,r),at(t,[{key:"textContent",get:function(){var n="";this.nodeName===Q.TEXT&&(n+=this.style.text);var i=yo(this.childNodes),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;s.nodeName===Q.TEXT?n+=s.nodeValue:n+=s.textContent}}catch(o){i.e(o)}finally{i.f()}return n},set:function(n){var i=this;this.childNodes.slice().forEach(function(a){i.removeChild(a)}),this.nodeName===Q.TEXT&&(this.style.text="".concat(n))}},{key:"getRootNode",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(ve)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(ve)}},{key:"lookupPrefix",value:function(n){throw new Error(ve)}},{key:"normalize",value:function(){throw new Error(ve)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(l=i.parentNode)!==null&&l!==void 0?l:a.parentNode;){var l;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return t.DOCUMENT_POSITION_DISCONNECTED|t.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t.DOCUMENT_POSITION_PRECEDING;var u=s.length>o.length?s:o,c=u===s?o:s;if(u[u.length-c.length]===c[0])return u===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var h=u.length-c.length,d=c.length-1;d>=0;d--){var g=c[d],p=u[h+d];if(p!==g){var v=g.parentNode.childNodes;return v.indexOf(g)<v.indexOf(p)?c===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING:u===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING}}return t.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(n){return this.contains(n)}},{key:"contains",value:function(n){for(var i=n;i&&this!==i;)i=i.parentNode;return!!i}},{key:"getAncestor",value:function(n){for(var i=this;n>0&&i;)i=i.parentNode,n--;return i}},{key:"forEach",value:function(n){for(var i=[this];i.length>0;){var a=i.pop(),s=n(a);if(s===!1)break;for(var o=a.childNodes.length-1;o>=0;o--)i.push(a.childNodes[o])}}}],[{key:"isNode",value:function(n){return!!n.childNodes}}])}(jL);qe.DOCUMENT_POSITION_DISCONNECTED=1;qe.DOCUMENT_POSITION_PRECEDING=2;qe.DOCUMENT_POSITION_FOLLOWING=4;qe.DOCUMENT_POSITION_CONTAINS=8;qe.DOCUMENT_POSITION_CONTAINED_BY=16;qe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var pU=2048,vU=function(){function r(t,e){var n=this;st(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=Se(),this.tmpVec3=Qt(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var s=a.button===2;n.dispatchEvent(a,s?"rightdown":"mousedown")}var o=n.trackingData(i.pointerId);o.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a=Ow.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var l=n.trackingData(i.pointerId),u=n.findMountedTarget(l.pressTargetsByButton[i.button]),c=u;if(u&&!s.composedPath().includes(u)){for(var h=u;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var d=s.button===2;n.notifyTarget(s,d?"rightupoutside":"mouseupoutside")}qe.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],c=h}if(c){var g,p=n.clonePointerEvent(s,"click");p.target=c,p.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:p.target,timeStamp:a});var v=n.context.renderingContext.root.ownerDocument.defaultView,m=l.clicksByButton[i.button];m.target===p.target&&a-m.timeStamp<v.getConfig().dblClickSpeed?++m.clickCount:m.clickCount=1,m.target=p.target,m.timeStamp=a,p.detail=m.clickCount,(g=s.detail)!==null&&g!==void 0&&g.preventClick||(!n.context.config.useNativeClickEvent&&(p.pointerType==="mouse"||p.pointerType==="touch")&&n.dispatchEvent(p,"click"),n.dispatchEvent(p,"pointertap")),n.freeEvent(p)}n.freeEvent(s)},this.onPointerMove=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),s=a.pointerType==="mouse"||a.pointerType==="pen",o=n.trackingData(i.pointerId),l=n.findMountedTarget(o.overTargets);if(o.overTargets&&l!==a.target){var u=i.type==="mousemove"?"mouseout":"pointerout",c=n.createPointerEvent(i,u,l||void 0);if(n.dispatchEvent(c,"pointerout"),s&&n.dispatchEvent(c,"mouseout"),!a.composedPath().includes(l)){var h=n.createPointerEvent(i,"pointerleave",l||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&!a.composedPath().includes(h.target);)h.currentTarget=h.target,n.notifyTarget(h),s&&n.notifyTarget(h,"mouseleave"),qe.isNode(h.target)&&(h.target=h.target.parentNode);n.freeEvent(h)}n.freeEvent(c)}if(l!==a.target){var d=i.type==="mousemove"?"mouseover":"pointerover",g=n.clonePointerEvent(a,d);n.dispatchEvent(g,"pointerover"),s&&n.dispatchEvent(g,"mouseover");for(var p=l&&qe.isNode(l)&&l.parentNode;p&&p!==(qe.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&p!==a.target;)p=p.parentNode;var v=!p||p===(qe.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(v){var m=n.clonePointerEvent(a,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==l&&m.target!==(qe.isNode(n.rootTarget)&&n.rootTarget.parentNode);)m.currentTarget=m.target,n.notifyTarget(m),s&&n.notifyTarget(m,"mouseenter"),qe.isNode(m.target)&&(m.target=m.target.parentNode);n.freeEvent(m)}n.freeEvent(g)}n.dispatchEvent(a,"pointermove"),a.pointerType==="touch"&&n.dispatchEvent(a,"touchmove"),s&&(n.dispatchEvent(a,"mousemove"),n.cursor=n.getCursor(a.target)),o.overTargets=a.composedPath(),n.freeEvent(a)},this.onPointerOut=function(i){var a=n.trackingData(i.pointerId);if(a.overTargets){var s=i.pointerType==="mouse"||i.pointerType==="pen",o=n.findMountedTarget(a.overTargets),l=n.createPointerEvent(i,"pointerout",o||void 0);n.dispatchEvent(l),s&&n.dispatchEvent(l,"mouseout");var u=n.createPointerEvent(i,"pointerleave",o||void 0);for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==(qe.isNode(n.rootTarget)&&n.rootTarget.parentNode);)u.currentTarget=u.target,n.notifyTarget(u),s&&n.notifyTarget(u,"mouseleave"),qe.isNode(u.target)&&(u.target=u.target.parentNode);a.overTargets=null,n.freeEvent(l),n.freeEvent(u)}n.cursor=null},this.onPointerOver=function(i){var a=n.trackingData(i.pointerId),s=n.createPointerEvent(i),o=s.pointerType==="mouse"||s.pointerType==="pen";n.dispatchEvent(s,"pointerover"),o&&n.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(n.cursor=n.getCursor(s.target));var l=n.clonePointerEvent(s,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==(qe.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),o&&n.notifyTarget(l,"mouseenter"),qe.isNode(l.target)&&(l.target=l.target.parentNode);a.overTargets=s.composedPath(),n.freeEvent(s),n.freeEvent(l)},this.onPointerUpOutside=function(i){var a=n.trackingData(i.pointerId),s=n.findMountedTarget(a.pressTargetsByButton[i.button]),o=n.createPointerEvent(i);if(s){for(var l=s;l;)o.currentTarget=l,n.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"||(o.pointerType==="mouse"||o.pointerType==="pen")&&n.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),qe.isNode(l)&&(l=l.parentNode);delete a.pressTargetsByButton[i.button]}n.freeEvent(o)},this.onWheel=function(i){var a=n.createWheelEvent(i);n.dispatchEvent(a),n.freeEvent(a)},this.onClick=function(i){if(n.context.config.useNativeClickEvent){var a=n.createPointerEvent(i);n.dispatchEvent(a),n.freeEvent(a)}},this.onPointerCancel=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(a),n.freeEvent(a)},this.globalRuntime=t,this.context=e}return at(r,[{key:"init",value:function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)}},{key:"destroy",value:function(){this.mappingTable={},this.mappingState={},this.eventPool.clear()}},{key:"getScale",value:function(){var e=this.context.contextService.getBoundingClientRect(),n=1,i=1,a=this.context.contextService.getDomElement();if(a&&e){var s=a.offsetWidth,o=a.offsetHeight;s&&o&&(n=e.width/s,i=e.height/o)}return{scaleX:n,scaleY:i,bbox:e}}},{key:"client2Viewport",value:function(e){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new $n((e.x-((s==null?void 0:s.left)||0))/i,(e.y-((s==null?void 0:s.top)||0))/a)}},{key:"viewport2Client",value:function(e){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new $n((e.x+((s==null?void 0:s.left)||0))*i,(e.y+((s==null?void 0:s.top)||0))*a)}},{key:"viewport2Canvas",value:function(e){var n=e.x,i=e.y,a=this.rootTarget.defaultView,s=a.getCamera(),o=this.context.config,l=o.width,u=o.height,c=s.getPerspectiveInverse(),h=s.getWorldTransform(),d=Jn(this.tmpMatrix,h,c),g=Zn(this.tmpVec3,n/l*2-1,(1-i/u)*2-1,0);return Qn(g,g,d),new $n(g[0],g[1])}},{key:"canvas2Viewport",value:function(e){var n=this.rootTarget.defaultView,i=n.getCamera(),a=i.getPerspective(),s=i.getViewTransform(),o=Jn(this.tmpMatrix,a,s),l=Zn(this.tmpVec3,e.x,e.y,0);Qn(this.tmpVec3,this.tmpVec3,o);var u=this.context.config,c=u.width,h=u.height;return new $n((l[0]+1)/2*c,(1-(l[1]+1)/2)*h)}},{key:"setPickHandler",value:function(e){this.pickHandler=e}},{key:"addEventMapping",value:function(e,n){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:n,priority:0}),this.mappingTable[e].sort(function(i,a){return i.priority-a.priority})}},{key:"mapEvent",value:function(e){if(this.rootTarget){var n=this.mappingTable[e.type];if(n)for(var i=0,a=n.length;i<a;i++)n[i].fn(e);else console.warn("[EventService]: Event mapping not defined for ".concat(e.type))}}},{key:"dispatchEvent",value:function(e,n,i){if(!i)e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,n);else{e.eventPhase=e.AT_TARGET;var a=this.rootTarget.defaultView||null;e.currentTarget=a,this.notifyListeners(e,n)}}},{key:"propagate",value:function(e,n){if(e.target){var i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(var a=i.length-1;a>=1;a--)if(e.currentTarget=i[a],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,n),!(e.propagationStopped||e.propagationImmediatelyStopped)){var s=i.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var o=s+1;o<i.length;o++)if(e.currentTarget=i[o],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(e){var n=[e],i=this.rootTarget.defaultView||null;if(i&&i===e)return n.unshift(i.document),n;for(var a=0;a<pU&&e!==this.rootTarget;a++)qe.isNode(e)&&e.parentNode&&(n.push(e.parentNode),e=e.parentNode);return i&&n.push(i),n}},{key:"hitTest",value:function(e){var n=e.viewportX,i=e.viewportY,a=this.context.config,s=a.width,o=a.height,l=a.disableHitTesting;return n<0||i<0||n>s||i>o?null:!l&&this.pickHandler(e)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(e,n){var i,a=n==null?void 0:n.target;if((i=a)!==null&&i!==void 0&&i.shadowRoot&&(a=n.composedPath()[0]),a){if(a===e)return!0;if(e&&e.contains)return e.contains(a)}return n!=null&&n.composedPath?n.composedPath().indexOf(e)>-1:!1}},{key:"getExistedHTML",value:function(e){if(e.nativeEvent.composedPath)for(var n=0,i=e.nativeEvent.composedPath();n<i.length;n++){var a=i[n],s=this.nativeHTMLMap.get(a);if(s)return s}return null}},{key:"pickTarget",value:function(e){return this.hitTest({clientX:e.clientX,clientY:e.clientY,viewportX:e.viewportX,viewportY:e.viewportY,x:e.canvasX,y:e.canvasY})}},{key:"createPointerEvent",value:function(e,n,i,a){var s=this.allocateEvent(Cf);this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e;var o=this.getExistedHTML(s),l=this.context.contextService.getDomElement();return s.target=i??(o||this.isNativeEventFromCanvas(l,s.nativeEvent)&&this.pickTarget(s)||a),typeof n=="string"&&(s.type=n),s}},{key:"createWheelEvent",value:function(e){var n=this.allocateEvent(Aw);this.copyWheelData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n.originalEvent=e;var i=this.getExistedHTML(n),a=this.context.contextService.getDomElement();return n.target=i||this.isNativeEventFromCanvas(a,n.nativeEvent)&&this.pickTarget(n),n}},{key:"trackingData",value:function(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}},{key:"cloneWheelEvent",value:function(e){var n=this.allocateEvent(Aw);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyWheelData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=e.type,n}},{key:"clonePointerEvent",value:function(e,n){var i=this.allocateEvent(Cf);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=n??i.type,i}},{key:"copyPointerData",value:function(e,n){n.pointerId=e.pointerId,n.width=e.width,n.height=e.height,n.isPrimary=e.isPrimary,n.pointerType=e.pointerType,n.pressure=e.pressure,n.tangentialPressure=e.tangentialPressure,n.tiltX=e.tiltX,n.tiltY=e.tiltY,n.twist=e.twist}},{key:"copyMouseData",value:function(e,n){n.altKey=e.altKey,n.button=e.button,n.buttons=e.buttons,n.ctrlKey=e.ctrlKey,n.metaKey=e.metaKey,n.shiftKey=e.shiftKey,n.client.copyFrom(e.client),n.movement.copyFrom(e.movement),n.canvas.copyFrom(e.canvas),n.screen.copyFrom(e.screen),n.global.copyFrom(e.global),n.offset.copyFrom(e.offset)}},{key:"copyWheelData",value:function(e,n){n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ}},{key:"copyData",value:function(e,n){n.isTrusted=e.isTrusted,n.timeStamp=Ow.now(),n.type=e.type,n.detail=e.detail,n.view=e.view,n.page.copyFrom(e.page),n.viewport.copyFrom(e.viewport)}},{key:"allocateEvent",value:function(e){this.eventPool.has(e)||this.eventPool.set(e,[]);var n=this.eventPool.get(e).pop()||new e(this);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n}},{key:"freeEvent",value:function(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var n=e.constructor;this.eventPool.has(n)||this.eventPool.set(n,[]),this.eventPool.get(n).push(e)}},{key:"notifyTarget",value:function(e,n){n=n??e.type;var i=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?"".concat(n,"capture"):n;this.notifyListeners(e,i),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,n)}},{key:"notifyListeners",value:function(e,n){var i=e.currentTarget.emitter,a=i._events[n];if(a)if("fn"in a)a.once&&i.removeListener(n,a.fn,void 0,!0),a.fn.call(e.currentTarget||a.context,e);else for(var s=0;s<a.length&&!e.propagationImmediatelyStopped;s++)a[s].once&&i.removeListener(n,a[s].fn,void 0,!0),a[s].fn.call(e.currentTarget||a[s].context,e)}},{key:"findMountedTarget",value:function(e){if(!e)return null;for(var n=e[e.length-1],i=e.length-2;i>=0;i--){var a=e[i];if(a===this.rootTarget||qe.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=NH(n)&&n.getAttribute("cursor");if(i)return i;n=qe.isNode(n)&&n.parentNode}}}])}(),$x=function(){function r(){st(this,r)}return at(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||lt.offscreenCanvas)this.canvas=e||lt.offscreenCanvas,this.context=this.canvas.getContext("2d",Bt({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",Bt({willReadFrequently:!0},n)),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch{this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",Bt({willReadFrequently:!0},n))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(e,n){return this.context?this.context:(this.getOrCreateCanvas(e,n),this.context)}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch{}try{return document.createElement("canvas")}catch{}return null}}])}(),$l=function(r){return r[r.CAMERA_CHANGED=0]="CAMERA_CHANGED",r[r.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",r[r.NONE=2]="NONE",r}({}),mU=function(){function r(t,e){st(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new ir,initAsync:new YH,dirtycheck:new Ov,cull:new Ov,beginFrame:new ir,beforeRender:new ir,render:new ir,afterRender:new ir,endFrame:new ir,destroy:new ir,pick:new XH,pickSync:new Ov,pointerDown:new ir,pointerUp:new ir,pointerMove:new ir,pointerOut:new ir,pointerOver:new ir,pointerWheel:new ir,pointerCancel:new ir,click:new ir},this.globalRuntime=t,this.context=e}return at(r,[{key:"init",value:function(e){var n=this,i=Bt(Bt({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(a){a.apply(i,n.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,e()):this.hooks.initAsync.promise().then(function(){n.inited=!0,e()}).catch(function(a){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){var e=this.context.config.renderer,n=e.getConfig(),i=n.enableDirtyRectangleRendering;return!i||this.context.renderingContext.renderReasons.has($l.CAMERA_CHANGED)}},{key:"render",value:function(e,n,i){var a=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var s=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(s.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),s.renderReasons.size&&this.inited){s.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var o=s.renderReasons.size===1&&s.renderReasons.has($l.CAMERA_CHANGED),l=!e.disableRenderHooks||!(e.disableRenderHooks&&o);l&&this.renderDisplayObject(s.root,e,s),this.hooks.beginFrame.call(n),l&&s.renderListCurrentFrame.forEach(function(u){a.hooks.beforeRender.call(u),a.hooks.render.call(u),a.hooks.afterRender.call(u)}),this.hooks.endFrame.call(n),s.renderListCurrentFrame=[],s.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,l=s.enableCulling;function u(p){var v=p.renderable,m=p.sortable,b=o?v.dirty||i.dirtyRectangleRenderingDisabled?p:null:p;if(b){var w=l?a.hooks.cull.call(b,a.context.camera):b;w&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(w))}v.dirty=!1,m.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,m.dirty&&(a.sort(p,m),m.dirty=!1,m.dirtyChildren=[],m.dirtyReason=void 0)}for(var c=[e];c.length>0;){var h=c.pop();u(h);for(var d=h.sortable.sorted||h.childNodes,g=d.length-1;g>=0;g--)c.push(d[g])}}},{key:"sort",value:function(e,n){n.sorted&&n.dirtyReason!==xf.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(i){var a=e.childNodes.indexOf(i);if(a===-1){var s=n.sorted.indexOf(i);s>=0&&n.sorted.splice(s,1)}else if(n.sorted.length===0)n.sorted.push(i);else{var o=RH(n.sorted,i);n.sorted.splice(o,0,i)}}):n.sorted=e.childNodes.slice().sort(RL)}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add($l.DISPLAY_OBJECT_CHANGED)}}])}(),yU=/\[\s*(.*)=(.*)\s*\]/,bU=function(){function r(){st(this,r)}return at(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(l){return((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(l){return l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):null}return n.find(function(l){return n!==l&&l.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(l){return n!==l&&((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(l){return n!==l&&l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):[]}return n.findAll(function(l){return n!==l&&l.nodeName===e})}},{key:"is",value:function(e,n){if(e.startsWith("."))return n.className===this.getIdOrClassname(e);if(e.startsWith("#"))return n.id===this.getIdOrClassname(e);if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===e}},{key:"getIdOrClassname",value:function(e){return e.substring(1)}},{key:"getAttribute",value:function(e){var n=e.match(yU),i="",a="";return n&&n.length>2&&(i=n[1].replace(/"/g,""),a=n[2].replace(/"/g,"")),{name:i,value:a}}},{key:"attributeToString",value:function(e,n){if(!e.getAttribute)return"";var i=e.getAttribute(n);return kt(i)?"":i.toString?i.toString():""}}])}(),Xt=function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r}({}),sa=function(r){function t(e,n,i,a,s,o,l,u){var c;return st(this,t),c=qt(this,t,[null]),c.relatedNode=n,c.prevValue=i,c.newValue=a,c.attrName=s,c.attrChange=o,c.prevParsedValue=l,c.newParsedValue=u,c.type=e,c}return jt(t,r),at(t)}(u0);sa.ADDITION=2;sa.MODIFICATION=1;sa.REMOVAL=3;function EM(r){var t=r.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var wU=new sa(Xt.REPARENT,null,"","","",0,"",""),xU=Ax(),Zh=Qt(),EU=Ae(1,1,1),_U=Se(),SU=Ax(),cs=Qt(),yl=Se(),hs=En(),MU=Qt(),kU=En(),CU=Qt(),Tu=Qt(),ho=Qt(),Jh=Se(),_M=En(),SM=En(),Qh=En(),Pv={affectChildren:!0},TU=function(){function r(t){st(this,r),this.pendingEvents=new Map,this.boundsChangedEvent=new dn(Xt.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return at(r,[{key:"matches",value:function(e,n){return this.runtime.sceneGraphSelector.is(e,n)}},{key:"querySelector",value:function(e,n){return this.runtime.sceneGraphSelector.selectOne(e,n)}},{key:"querySelectorAll",value:function(e,n){return this.runtime.sceneGraphSelector.selectAll(e,n)}},{key:"attach",value:function(e,n,i){var a,s=!1;e.parentNode&&(s=e.parentNode!==n,this.detach(e));var o=e.nodeName===Q.FRAGMENT,l=kf(n);e.parentNode=n;var u=o?e.childNodes:[e];yt(i)?u.forEach(function(g){n.childNodes.splice(i,0,g),g.parentNode=n}):u.forEach(function(g){n.childNodes.push(g),g.parentNode=n});var c=n,h=c.sortable;if((h!=null&&(a=h.sorted)!==null&&a!==void 0&&a.length||e.parsedStyle.zIndex)&&(h.dirtyChildren.indexOf(e)===-1&&h.dirtyChildren.push(e),h.dirty=!0,h.dirtyReason=xf.ADDED),!l){if(o)this.dirtifyFragment(e);else{var d=e.transformable;d&&this.dirtifyWorld(e,d)}s&&e.dispatchEvent(wU)}}},{key:"detach",value:function(e){if(e.parentNode){var n,i,a=e.transformable,s=e.parentNode,o=s.sortable;(o!=null&&(n=o.sorted)!==null&&n!==void 0&&n.length||(i=e.style)!==null&&i!==void 0&&i.zIndex)&&(o.dirtyChildren.indexOf(e)===-1&&o.dirtyChildren.push(e),o.dirty=!0,o.dirtyReason=xf.REMOVED);var l=e.parentNode.childNodes.indexOf(e);l>-1&&e.parentNode.childNodes.splice(l,1),a&&this.dirtifyWorld(e,a),e.parentNode=null}}},{key:"getOrigin",value:function(e){return e.getGeometryBounds(),e.transformable.origin}},{key:"setOrigin",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=[n,i,a]);var s=e.transformable;if(!(n[0]===s.origin[0]&&n[1]===s.origin[1]&&n[2]===s.origin[2])){var o=s.origin;o[0]=n[0],o[1]=n[1],o[2]=n[2]||0,this.dirtifyLocal(e,s)}}},{key:"rotate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ae(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=hs;qh(o,n[0],n[1],n[2]);var l=this.getRotation(e),u=this.getRotation(e.parentNode);Wh(Qh,u),gv(Qh,Qh),Rs(o,Qh,o),Rs(s.localRotation,o,l),gf(s.localRotation,s.localRotation),this.dirtifyLocal(e,s)}}},{key:"rotateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ae(n,i,a));var s=e.transformable;qh(SM,n[0],n[1],n[2]),z3(s.localRotation,s.localRotation,SM),this.dirtifyLocal(e,s)}},{key:"setEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ae(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{qh(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);Wh(_M,gv(hs,o)),z3(s.localRotation,s.localRotation,_M),this.dirtifyLocal(e,s)}}},{key:"setLocalEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;typeof n=="number"&&(n=Ae(n,i,a));var o=e.transformable;qh(o.localRotation,n[0],n[1],n[2]),s&&this.dirtifyLocal(e,o)}},{key:"translateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ae(n,i,a));var s=e.transformable;ku(n,Zh)||(iW(n,n,s.localRotation),Ns(s.localPosition,s.localPosition,n),this.dirtifyLocal(e,s))}},{key:"setPosition",value:function(e,n){var i,a=e.transformable;if(ho[0]=n[0],ho[1]=n[1],ho[2]=(i=n[2])!==null&&i!==void 0?i:0,!ku(this.getPosition(e),ho)){if(ta(a.position,ho),e.parentNode===null||!e.parentNode.transformable)ta(a.localPosition,ho);else{var s=e.parentNode.transformable;Wl(Jh,s.worldTransform),Qi(Jh,Jh),Qn(a.localPosition,ho,Jh)}this.dirtifyLocal(e,a)}}},{key:"setLocalPosition",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Tu[0]=n[0],Tu[1]=n[1],Tu[2]=(i=n[2])!==null&&i!==void 0?i:0,!ku(s.localPosition,Tu)&&(ta(s.localPosition,Tu),a&&this.dirtifyLocal(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;Qq(a.localScale,a.localScale,Zn(cs,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:1)),this.dirtifyLocal(e,a)}},{key:"setLocalScale",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Zn(cs,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!ku(cs,s.localScale)&&(ta(s.localScale,cs),a&&this.dirtifyLocal(e,s))}},{key:"translate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Zn(cs,n,i,a)),!ku(n,Zh)&&(Ns(cs,this.getPosition(e),n),this.setPosition(e,cs))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=cW(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var l=this.getRotation(e.parentNode);Wh(hs,l),gv(hs,hs),Rs(o.localRotation,hs,n),gf(o.localRotation,o.localRotation),this.dirtifyLocal(e,o)}}},{key:"setLocalRotation",value:function(e,n,i,a,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;typeof n=="number"&&(n=B3(hs,n,i,a,s));var l=e.transformable;Wh(l.localRotation,n),o&&this.dirtifyLocal(e,l)}},{key:"setLocalSkew",value:function(e,n,i){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;typeof n=="number"&&(n=dW(SU,n,i));var s=e.transformable;hW(s.localSkew,n),a&&this.dirtifyLocal(e,s)}},{key:"dirtifyLocal",value:function(e,n){kf(e)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtifyWorld(e,n))}},{key:"dirtifyWorld",value:function(e,n){n.dirtyFlag||this.unfreezeParentToRoot(e),this.dirtifyWorldInternal(e,n),this.dirtifyToRoot(e,!0)}},{key:"dirtifyFragment",value:function(e){var n=e.transformable;n&&(n.frozen=!1,n.dirtyFlag=!0,n.localDirtyFlag=!0);var i=e.renderable;i&&(i.renderBoundsDirty=!0,i.boundsDirty=!0,i.dirty=!0);for(var a=e.childNodes.length,s=0;s<a;s++)this.dirtifyFragment(e.childNodes[s]);e.nodeName===Q.FRAGMENT&&this.pendingEvents.set(e,!1)}},{key:"triggerPendingEvents",value:function(){var e=this,n=new Set,i=function(s,o){!s.isConnected||n.has(s)||s.nodeName===Q.FRAGMENT||(e.boundsChangedEvent.detail=o,e.boundsChangedEvent.target=s,s.isMutationObserved?s.dispatchEvent(e.boundsChangedEvent):s.ownerDocument.defaultView.dispatchEvent(e.boundsChangedEvent,!0),n.add(s))};this.pendingEvents.forEach(function(a,s){s.nodeName!==Q.FRAGMENT&&(Pv.affectChildren=a,a?s.forEach(function(o){i(o,Pv)}):i(s,Pv))}),n.clear(),this.clearPendingEvents()}},{key:"clearPendingEvents",value:function(){this.pendingEvents.clear()}},{key:"dirtifyToRoot",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e;for(i.renderable&&(i.renderable.dirty=!0);i;)EM(i),i=i.parentNode;n&&e.forEach(function(a){EM(a)}),this.informDependentDisplayObjects(e),this.pendingEvents.set(e,n)}},{key:"updateDisplayObjectDependency",value:function(e,n,i,a){if(n&&n!==i){var s=this.displayObjectDependencyMap.get(n);if(s&&s[e]){var o=s[e].indexOf(a);s[e].splice(o,1)}}if(i){var l=this.displayObjectDependencyMap.get(i);l||(this.displayObjectDependencyMap.set(i,{}),l=this.displayObjectDependencyMap.get(i)),l[e]||(l[e]=[]),l[e].push(a)}}},{key:"informDependentDisplayObjects",value:function(e){var n=this,i=this.displayObjectDependencyMap.get(e);i&&Object.keys(i).forEach(function(a){i[a].forEach(function(s){n.dirtifyToRoot(s,!0),s.dispatchEvent(new sa(Xt.ATTR_MODIFIED,s,n,n,a,sa.MODIFICATION,n,n)),s.isCustomElement&&s.isConnected&&s.attributeChangedCallback&&s.attributeChangedCallback(a,n,n)})})}},{key:"getPosition",value:function(e){var n=e.transformable;return hf(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return df(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return Gl(n.scaling,this.getWorldTransform(e,n))}},{key:"getWorldTransform",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e.transformable;return!n.localDirtyFlag&&!n.dirtyFlag||(e.parentNode&&e.parentNode.transformable&&this.getWorldTransform(e.parentNode),this.sync(e,n)),n.worldTransform}},{key:"getLocalPosition",value:function(e){return e.transformable.localPosition}},{key:"getLocalRotation",value:function(e){return e.transformable.localRotation}},{key:"getLocalScale",value:function(e){return e.transformable.localScale}},{key:"getLocalSkew",value:function(e){return e.transformable.localSkew}},{key:"calcLocalTransform",value:function(e){var n=e.localSkew[0]!==0||e.localSkew[1]!==0;if(n){ec(e.localTransform,e.localRotation,e.localPosition,Ae(1,1,1),e.origin),(e.localSkew[0]!==0||e.localSkew[1]!==0)&&(zs(yl),yl[4]=Math.tan(e.localSkew[0]),yl[1]=Math.tan(e.localSkew[1]),Jn(e.localTransform,e.localTransform,yl));var i=ec(yl,B3(hs,0,0,0,1),Zn(cs,1,1,1),e.localScale,e.origin);Jn(e.localTransform,e.localTransform,i)}else{var a=e.localTransform,s=e.localPosition,o=e.localRotation,l=e.localScale,u=e.origin,c=s[0]!==0||s[1]!==0||s[2]!==0,h=o[3]!==1||o[0]!==0||o[1]!==0||o[2]!==0,d=l[0]!==1||l[1]!==1||l[2]!==1,g=u[0]!==0||u[1]!==0||u[2]!==0;!h&&!d&&!g?c?ws(a,s):zs(a):ec(a,o,s,l,u)}}},{key:"getLocalTransform",value:function(e){var n=e.transformable;return n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.localTransform}},{key:"setLocalTransform",value:function(e,n){var i=hf(MU,n),a=df(kU,n),s=Gl(CU,n);this.setLocalScale(e,s,!1),this.setLocalPosition(e,i,!1),this.setLocalRotation(e,a,void 0,void 0,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"resetLocalTransform",value:function(e){this.setLocalScale(e,EU,!1),this.setLocalPosition(e,Zh,!1),this.setLocalEulerAngles(e,Zh,void 0,void 0,!1),this.setLocalSkew(e,xU,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"getTransformedGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0,a=this.getGeometryBounds(e,n);if(!Me.isEmpty(a)){var s=i||new Me;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&<.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new Me}},{key:"getBounds",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,l=this.getTransformedGeometryBounds(e,i,o),u=e.childNodes;if(u.forEach(function(d){var g=n.getBounds(d,i);g&&(l?l.add(g):(l=o||new Me,l.update(g.center,g.halfExtents)))}),l||(l=new Me),i){var c=LL(e);if(c){var h=c.parsedStyle.clipPath.getBounds(i);l?h&&(l=h.intersection(l)):l.update(h.center,h.halfExtents)}}return i?(s.renderBounds=l,s.renderBoundsDirty=!1):(s.bounds=l,s.boundsDirty=!1),l}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=_U;e.parentNode.transformable&&(n=Qi(yl,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!Me.isEmpty(i)){var a=new Me;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);Me.isEmpty(a)||(i=new Me,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),l=Lt(o,2),u=l[0],c=l[1],h=i.getMax(),d=Lt(h,2),g=d[0],p=d[1];return new Hl(u+((s==null?void 0:s.left)||0),c+((s==null?void 0:s.top)||0),g-u,p-c)}return new Hl((s==null?void 0:s.left)||0,(s==null?void 0:s.top)||0,0,0)}},{key:"dirtifyWorldInternal",value:function(e,n){var i=this;if(!n.dirtyFlag){n.dirtyFlag=!0,n.frozen=!1,e.childNodes.forEach(function(o){var l=o.transformable;l.dirtyFlag||i.dirtifyWorldInternal(o,l)});var a=e,s=a.renderable;s&&(s.renderBoundsDirty=!0,s.boundsDirty=!0,s.dirty=!0)}}},{key:"syncHierarchy",value:function(e){var n=e.transformable;if(!n.frozen){n.frozen=!0,(n.localDirtyFlag||n.dirtyFlag)&&this.sync(e,n);for(var i=e.childNodes,a=0;a<i.length;a++)this.syncHierarchy(i[a])}}},{key:"sync",value:function(e,n){if(n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.dirtyFlag){var i=e.parentNode,a=i&&i.transformable;i===null||!a?Wl(n.worldTransform,n.localTransform):Jn(n.worldTransform,a.worldTransform,n.localTransform),n.dirtyFlag=!1}}},{key:"unfreezeParentToRoot",value:function(e){for(var n=e.parentNode;n;){var i=n.transformable;i&&(i.frozen=!1),n=n.parentNode}}}])}(),fo={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},MM=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,OU=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,AU=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,PU=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,NU=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,RU=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,LU=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,IU=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,DU=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,FU=new RegExp("".concat(OU.source,"|").concat(PU.source,"|").concat(RU.source,"|").concat(IU.source)),BU=new RegExp("".concat(AU.source,"|").concat(NU.source,"|").concat(LU.source,"|").concat(DU.source)),zU=function(){function r(t){var e=this;st(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&(BU.exec(i)||FU.exec(n)))},this.trimByKinsokuShorui=function(n){var i=Ce(n),a=i[i.length-2];if(!a)return n;var s=a[a.length-1];return i[i.length-2]=a.slice(0,-1),i[i.length-1]=s+i[i.length-1],i},this.runtime=t}return at(r,[{key:"measureFont",value:function(e,n){if(this.fontMetricsCache[e])return this.fontMetricsCache[e];var i={ascent:0,descent:0,fontSize:0},a=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(n),s=this.runtime.offscreenCanvasCreator.getOrCreateContext(n,{willReadFrequently:!0});s.font=e;var o=fo.MetricsString+fo.BaselineSymbol,l=Math.ceil(s.measureText(o).width),u=Math.ceil(s.measureText(fo.BaselineSymbol).width),c=fo.HeightMultiplier*u;u=u*fo.BaselineMultiplier|0,a.width=l,a.height=c,s.fillStyle="#f00",s.fillRect(0,0,l,c),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,u);var h=s.getImageData(0,0,l||1,c||1).data,d=h.length,g=l*4,p=0,v=0,m=!1;for(p=0;p<u;++p){for(var b=0;b<g;b+=4)if(h[v+b]!==255){m=!0;break}if(!m)v+=g;else break}for(i.ascent=u-p,v=d-g,m=!1,p=c;p>u;--p){for(var w=0;w<g;w+=4)if(h[v+w]!==255){m=!0;break}if(!m)v-=g;else break}return i.descent=p-u,i.fontSize=i.ascent+i.descent,this.fontMetricsCache[e]=i,i}},{key:"measureText",value:function(e,n,i){var a=n.fontSize,s=a===void 0?16:a,o=n.wordWrap,l=o===void 0?!1:o,u=n.lineHeight,c=n.lineWidth,h=c===void 0?1:c,d=n.textBaseline,g=d===void 0?"alphabetic":d,p=n.textAlign,v=p===void 0?"start":p,m=n.letterSpacing,b=m===void 0?0:m,w=n.textPath;n.textPathSide,n.textPathStartOffset;var x=n.leading,S=x===void 0?0:x,_=JH(n),k=this.measureFont(_,i);k.fontSize===0&&(k.fontSize=s,k.ascent=s);var M=this.runtime.offscreenCanvasCreator.getOrCreateContext(i);M.font=_,n.isOverflowing=!1;var C=l?this.wordWrap(e,n,i):e,P=C.split(/(?:\r\n|\r|\n)/),T=new Array(P.length),A=0;if(w){w.getTotalLength();for(var R=0;R<P.length;R++)M.measureText(P[R]).width+(P[R].length-1)*b}else{for(var L=0;L<P.length;L++){var $=M.measureText(P[L]).width+(P[L].length-1)*b;T[L]=$,A=Math.max(A,$)}var q=A+h,j=u||k.fontSize+h,B=Math.max(j,k.fontSize+h)+(P.length-1)*(j+S);j+=S;var F=0;return g==="middle"?F=-B/2:g==="bottom"||g==="alphabetic"||g==="ideographic"?F=-B:(g==="top"||g==="hanging")&&(F=0),{font:_,width:q,height:B,lines:P,lineWidths:T,lineHeight:j,maxLineWidth:A,fontProperties:k,lineMetrics:T.map(function(V,X){var K=0;return v==="center"||v==="middle"?K-=V/2:(v==="right"||v==="end")&&(K-=V),new Hl(K-h/2,F+X*j,V+h,j)})}}}},{key:"wordWrap",value:function(e,n,i){var a=this,s=this,o=n.wordWrapWidth,l=o===void 0?0:o,u=n.letterSpacing,c=u===void 0?0:u,h=n.maxLines,d=h===void 0?1/0:h,g=n.textOverflow,p=this.runtime.offscreenCanvasCreator.getOrCreateContext(i),v=l+c,m="";g==="ellipsis"?m="...":g&&g!=="clip"&&(m=g);var b=Array.from(e),w=[],x=0,S=0,_=0,k={},M=function(F){return a.getFromCache(F,c,k,p)},C=M(m);function P(B,F,V,X){for(;M(B)<X&&F<b.length-1&&!s.isNewline(b[F+1]);)F+=1,B+=b[F];for(;M(B)>X&&F>V;)F-=1,B=B.slice(0,-1);return{lineTxt:B,txtLastCharIndex:F}}function T(B,F){if(!(C<=0||C>v)){if(!w[B]){w[B]=m;return}var V=P(w[B],F,_+1,v-C);w[B]=V.lineTxt+m}}for(var A=0;A<b.length;A++){var R=b[A],L=b[A-1],$=b[A+1],q=M(R);if(this.isNewline(R)){if(x+1>=d){n.isOverflowing=!0,A<b.length-1&&T(x,A-1);break}_=A-1,x+=1,S=0,w[x]="";continue}if(S>0&&S+q>v){var j=P(w[x],A-1,_+1,v);if(j.txtLastCharIndex!==A-1){if(w[x]=j.lineTxt,j.txtLastCharIndex===b.length-1)break;A=j.txtLastCharIndex+1,R=b[A],L=b[A-1],$=b[A+1],q=M(R)}if(x+1>=d){n.isOverflowing=!0,T(x,A-1);break}if(_=A-1,x+=1,S=0,w[x]="",this.isBreakingSpace(R))continue;this.canBreakInLastChar(R)||(w=this.trimToBreakable(w),S=this.sumTextWidthByCache(w[x]||"",M)),this.shouldBreakByKinsokuShorui(R,$)&&(w=this.trimByKinsokuShorui(w),S+=M(L||""))}S+=q,w[x]=(w[x]||"")+R}return w.join(`
- `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:fo.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:fo.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=Ce(e),i=n[n.length-2],a=this.findBreakableIndex(i);if(a===-1||!i)return n;var s=i.slice(a,a+1),o=this.isBreakingSpace(s),l=a+1,u=a+(o?0:1);return n[n.length-1]+=i.slice(l,i.length),n[n.length-2]=i.slice(0,u),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&MM.test(e))}},{key:"sumTextWidthByCache",value:function(e,n){return e.split("").reduce(function(i,a){return i+n(a)},0)}},{key:"findBreakableIndex",value:function(e){for(var n=e.length-1;n>=0;n--)if(!MM.test(e[n]))return n;return-1}},{key:"getFromCache",value:function(e,n,i,a){var s=i[e];if(typeof s!="number"){var o=e.length*n,l=a.measureText(e);s=l.width+o,i[e]=s}return s}}])}(),lt={},$U=function(r){var t=new hU,e=new cU;return r={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(r,Q.FRAGMENT,null),Q.CIRCLE,new sU),Q.ELLIPSE,new oU),Q.RECT,t),Q.IMAGE,t),Q.GROUP,new fU),Q.LINE,new lU),Q.TEXT,new dU(lt)),Q.POLYLINE,e),Q.POLYGON,e),bt(bt(bt(r,Q.PATH,new uU),Q.HTML,new gU),Q.MESH,null)}(),jU=function(r){var t=new yH,e=new Tw;return r={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(r,ft.PERCENTAGE,null),ft.NUMBER,new _H),ft.ANGLE,new vH),ft.DEFINED_PATH,new mH),ft.PAINT,t),ft.COLOR,t),ft.FILTER,new bH),ft.LENGTH,e),ft.LENGTH_PERCENTAGE,e),ft.LENGTH_PERCENTAGE_12,new wH),bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(r,ft.LENGTH_PERCENTAGE_14,new xH),ft.COORDINATE,new Tw),ft.OFFSET_DISTANCE,new SH),ft.OPACITY_VALUE,new MH),ft.PATH,new kH),ft.LIST_OF_POINTS,new CH),ft.SHADOW_BLUR,new TH),ft.TEXT,new OH),ft.TEXT_TRANSFORM,new AH),ft.TRANSFORM,new rU),bt(bt(bt(r,ft.TRANSFORM_ORIGIN,new iU),ft.Z_INDEX,new aU),ft.MARKER,new EH)}(),qU=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};lt.CameraContribution=gL;lt.AnimationTimeline=null;lt.EasingFunction=null;lt.offscreenCanvasCreator=new $x;lt.sceneGraphSelector=new bU;lt.sceneGraphService=new TU(lt);lt.textService=new zU(lt);lt.geometryUpdaterFactory=$U;lt.CSSPropertySyntaxFactory=jU;lt.styleValueRegistry=new gH(lt);lt.layoutRegistry=null;lt.globalThis=qU();lt.enableStyleSyntax=!0;lt.enableSizeAttenuation=!1;var WU=0,Pw=new sa(Xt.INSERTED,null,"","","",0,"",""),Nw=new sa(Xt.REMOVED,null,"","","",0,"",""),qL=new dn(Xt.DESTROY),GU=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.entity=WU++,e.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},e.cullable={strategy:KG.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},e.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},e.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},e.geometry={contentBounds:void 0,renderBounds:void 0,dirty:!0},e.rBushNode={aabb:void 0},e.namespaceURI="g",e.scrollLeft=0,e.scrollTop=0,e.clientTop=0,e.clientLeft=0,e.destroyed=!1,e.style={},e.computedStyle={},e.parsedStyle={},e.attributes={},e}return jt(t,r),at(t,[{key:"className",get:function(){return this.getAttribute("class")||""},set:function(n){this.setAttribute("class",n)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(n){return n!==""})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n-1]||null}return null}},{key:"cloneNode",value:function(n){throw new Error(ve)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(zG);return lt.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!kf(this)&&n.nodeName===Q.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(Pw.relatedNode=this,n.dispatchEvent(Pw)),n}},{key:"insertBefore",value:function(n,i){if(!i)this.appendChild(n);else{n.parentElement&&n.parentElement.removeChild(n);var a=this.childNodes.indexOf(i);a===-1?this.appendChild(n):this.appendChild(n,a)}return n}},{key:"replaceChild",value:function(n,i){var a=this.childNodes.indexOf(i);return this.removeChild(i),this.appendChild(n,a),i}},{key:"removeChild",value:function(n){var i;return Nw.relatedNode=this,n.dispatchEvent(Nw),(i=n.ownerDocument)!==null&&i!==void 0&&i.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),lt.sceneGraphService.detach(n),n}},{key:"removeChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];this.removeChild(i)}}},{key:"destroyChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];i.childNodes.length>0&&i.destroyChildren(),i.destroy()}}},{key:"matches",value:function(n){return lt.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return lt.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return lt.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return lt.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return lt.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return lt.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return lt.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(lt.sceneGraphService.matches(n,i))return i;i=i.parentElement}while(i!==null);return null}},{key:"find",value:function(n){var i=this,a=null;return this.forEach(function(s){return s!==i&&n(s)?(a=s,!1):!0}),a}},{key:"findAll",value:function(n){var i=this,a=[];return this.forEach(function(s){s!==i&&n(s)&&a.push(s)}),a}},{key:"after",value:function(){var n=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];s.forEach(function(l,u){var c;return(c=n.parentNode)===null||c===void 0?void 0:c.appendChild(l,i+u+1)})}}},{key:"before",value:function(){if(this.parentNode){for(var n,i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];var l=s[0],u=s.slice(1);this.parentNode.appendChild(l,i),(n=l).after.apply(n,Ce(u))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o){return n.appendChild(o)})}},{key:"prepend",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o,l){return n.appendChild(o,l)})}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){return this.parentNode?this.parentNode.removeChild(this):this}},{key:"destroy",value:function(){this.destroyChildren(),this.dispatchEvent(qL),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){return lt.sceneGraphService.getGeometryBounds(this)}},{key:"getRenderBounds",value:function(){return lt.sceneGraphService.getBounds(this,!0)}},{key:"getBounds",value:function(){return lt.sceneGraphService.getBounds(this)}},{key:"getLocalBounds",value:function(){return lt.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return lt.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(n){if(typeof n!="symbol"){var i=this.attributes[n];return i}}},{key:"hasAttribute",value:function(n){return this.getAttributeNames().includes(n)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(n){this.setAttribute(n,null),delete this.attributes[n]}},{key:"setAttribute",value:function(n,i,a,s){this.attributes[n]=i}},{key:"getAttributeNS",value:function(n,i){throw new Error(ve)}},{key:"getAttributeNode",value:function(n){throw new Error(ve)}},{key:"getAttributeNodeNS",value:function(n,i){throw new Error(ve)}},{key:"hasAttributeNS",value:function(n,i){throw new Error(ve)}},{key:"removeAttributeNS",value:function(n,i){throw new Error(ve)}},{key:"removeAttributeNode",value:function(n){throw new Error(ve)}},{key:"setAttributeNS",value:function(n,i,a){throw new Error(ve)}},{key:"setAttributeNode",value:function(n){throw new Error(ve)}},{key:"setAttributeNodeNS",value:function(n){throw new Error(ve)}},{key:"toggleAttribute",value:function(n,i){throw new Error(ve)}}])}(qe);function ae(r){return!!(r!=null&&r.nodeName)}var VU=lt.globalThis.Proxy?lt.globalThis.Proxy:function(){},Zi=new sa(Xt.ATTR_MODIFIED,null,null,null,null,sa.MODIFICATION,null,null),Ou=Qt(),HU=En(),Re=function(r){function t(e){var n;return st(this,t),n=qt(this,t),n.isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=e,n.id=e.id||"",n.name=e.name||"",(e.className||e.class)&&(n.className=e.className||e.class),n.nodeName=e.type||Q.GROUP,e.initialParsedStyle&&Object.assign(n.parsedStyle,e.initialParsedStyle),n.initAttributes(e.style),lt.enableStyleSyntax&&(n.style=new VU({setProperty:function(a,s){n.setAttribute(a,s)},getPropertyValue:function(a){return n.getAttribute(a)},removeProperty:function(a){n.removeAttribute(a)},item:function(){return""}},{get:function(a,s){return a[s]!==void 0?a[s]:n.getAttribute(s)},set:function(a,s,o){return n.setAttribute(s,o),!0}})),n}return jt(t,r),at(t,[{key:"destroy",value:function(){V3(t,"destroy",this)([]),this.getAnimations().forEach(function(n){n.cancel()})}},{key:"cloneNode",value:function(n,i){var a=Bt({},this.attributes);for(var s in a){var o=a[s];ae(o)&&s!=="clipPath"&&s!=="offsetPath"&&s!=="textPath"&&(a[s]=o.cloneNode(n)),i&&(a[s]=i(s,o))}var l=new this.constructor(Bt(Bt({},this.config),{},{style:a}));return l.setLocalTransform(this.getLocalTransform()),n&&this.children.forEach(function(u){if(!u.style.isMarker){var c=u.cloneNode(n);l.appendChild(c)}}),l}},{key:"initAttributes",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};lt.styleValueRegistry.processProperties(this,n,i),this.renderable.dirty=!0}},{key:"setAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;Nt(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),V3(t,"setAttribute",this)([n,i]))}},{key:"internalSetAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.renderable,o=this.attributes[n],l=this.parsedStyle[n];lt.styleValueRegistry.processProperties(this,bt({},n,i),a),s.dirty=!0;var u=this.parsedStyle[n];if(this.isConnected&&(Zi.relatedNode=this,Zi.prevValue=o,Zi.newValue=i,Zi.attrName=n,Zi.prevParsedValue=l,Zi.newParsedValue=u,this.isMutationObserved?this.dispatchEvent(Zi):(Zi.target=this,this.ownerDocument.defaultView.dispatchEvent(Zi,!0))),this.isCustomElement&&this.isConnected||!this.isCustomElement){var c,h;(c=(h=this).attributeChangedCallback)===null||c===void 0||c.call(h,n,o,i,l,u)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=Lt(i,2),s=a[0],o=a[1],l=n.getMax(),u=Lt(l,2),c=u[0],h=u[1];return new Hl(s,o,c-s,h-o)}},{key:"setOrigin",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return lt.sceneGraphService.setOrigin(this,ar(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return lt.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return lt.sceneGraphService.setPosition(this,ar(n,i,a,!1)),this}},{key:"setLocalPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return lt.sceneGraphService.setLocalPosition(this,ar(n,i,a,!1)),this}},{key:"translate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return lt.sceneGraphService.translate(this,ar(n,i,a,!1)),this}},{key:"translateLocal",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return lt.sceneGraphService.translateLocal(this,ar(n,i,a,!1)),this}},{key:"getPosition",value:function(){return lt.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return lt.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(n,i,a){return this.scaleLocal(n,i,a)}},{key:"scaleLocal",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=ar(n,i,a,!1)),lt.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=ar(n,i,a,!1)),lt.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return lt.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return lt.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=xv(Ou,lt.sceneGraphService.getWorldTransform(this)),i=Lt(n,3),a=i[2];return wr(a)}},{key:"getLocalEulerAngles",value:function(){var n=xv(Ou,lt.sceneGraphService.getLocalRotation(this)),i=Lt(n,3),a=i[2];return wr(a)}},{key:"setEulerAngles",value:function(n){return lt.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return lt.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return kt(i)&&kt(a)?lt.sceneGraphService.rotateLocal(this,0,0,n):lt.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return kt(i)&&kt(a)?lt.sceneGraphService.rotate(this,0,0,n):lt.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return lt.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return lt.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return lt.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return lt.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return lt.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return lt.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return lt.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return lt.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return lt.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){lt.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(n,i){var a,s=(a=this.ownerDocument)===null||a===void 0?void 0:a.timeline;return s?s.play(this,n,i):null}},{key:"isVisible",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.visibility)!=="hidden"}},{key:"interactive",get:function(){return this.isInteractive()},set:function(n){this.style.pointerEvents=n?"auto":"none"}},{key:"isInteractive",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.pointerEvents)!=="none"}},{key:"isCulled",value:function(){return!!(this.cullable&&this.cullable.enable&&!this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,Ce(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,Ce(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=a[0],l=a[1];return o?un(o)?(Object.keys(o).forEach(function(u){n.setAttribute(u,o[u])}),this):a.length===2?(this.setAttribute(o,l),this):this.attributes[o]:this.attributes}},{key:"getMatrix",value:function(n){var i=n||this.getWorldTransform(),a=hf(Ou,i),s=Lt(a,2),o=s[0],l=s[1],u=Gl(Ou,i),c=Lt(u,2),h=c[0],d=c[1],g=df(HU,i),p=xv(Ou,g),v=Lt(p,3),m=v[0],b=v[2];return VG(m||b,o,l,h,d)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(n){var i=K3(n),a=Lt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setEulerAngles(c).setPosition(s,o).setLocalScale(l,u)}},{key:"setLocalMatrix",value:function(n){var i=K3(n),a=Lt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setLocalEulerAngles(c).setLocalPosition(s,o).setLocalScale(l,u)}},{key:"show",value:function(){this.forEach(function(n){n.style.visibility="visible"})}},{key:"hide",value:function(){this.forEach(function(n){n.style.visibility="hidden"})}},{key:"getCount",value:function(){return this.childElementCount}},{key:"getParent",value:function(){return this.parentElement}},{key:"getChildren",value:function(){return this.children}},{key:"getFirst",value:function(){return this.firstElementChild}},{key:"getLast",value:function(){return this.lastElementChild}},{key:"getChildByIndex",value:function(n){return this.children[n]||null}},{key:"add",value:function(n,i){return this.appendChild(n,i)}},{key:"set",value:function(n,i){this.config[n]=i}},{key:"get",value:function(n){return this.config[n]}},{key:"moveTo",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"move",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"setZIndex",value:function(n){return this.style.zIndex=n,this}}])}(GU);Re.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var Ya=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return st(this,t),qt(this,t,[Bt({type:Q.CIRCLE},e)])}return jt(t,r),at(t)}(Re);Ya.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var UU=["style"],jx=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,UU);return st(this,t),e=qt(this,t,[Bt({style:i},a)]),e.isCustomElement=!0,e}return jt(t,r),at(t)}(Re);jx.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var Rc=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return st(this,t),qt(this,t,[Bt({type:Q.ELLIPSE},e)])}return jt(t,r),at(t)}(Re);Rc.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var YU=function(r){function t(){return st(this,t),qt(this,t,[{type:Q.FRAGMENT}])}return jt(t,r),at(t)}(Re);YU.PARSED_STYLE_LIST=new Set(["class","className"]);var Mn=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return st(this,t),qt(this,t,[Bt({type:Q.GROUP},e)])}return jt(t,r),at(t)}(Re);Mn.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var XU=["style"],Lc=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,XU);return st(this,t),e=qt(this,t,[Bt({type:Q.HTML,style:i},a)]),e.cullable.enable=!1,e}return jt(t,r),at(t,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var n=Qi(Se(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!Me.isEmpty(i)){var a=new Me;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(Re);Lc.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var Ic=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return st(this,t),qt(this,t,[Bt({type:Q.IMAGE},e)])}return jt(t,r),at(t)}(Re);Ic.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var KU=["style"],Fo=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,KU);st(this,t),e=qt(this,t,[Bt({type:Q.LINE,style:Bt({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},i)},a)]),e.markerStartAngle=0,e.markerEndAngle=0;var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd;return o&&ae(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&ae(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return jt(t,r),at(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="x1"||n==="y1"||n==="x2"||n==="y2"||n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&ae(s)&&(this.markerStartAngle=0,s.remove()),o&&ae(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&ae(s)&&(this.markerEndAngle=0,s.remove()),o&&ae(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1)))}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.x1,c=i.x2,h=i.y1,d=i.y2,g=n?a:s;if(!(!g||!ae(g))){var p=0,v,m,b,w,x,S;n?(b=u,w=h,v=c-u,m=d-h,x=o||0,S=this.markerStartAngle):(b=c,w=d,v=u-c,m=h-d,x=l||0,S=this.markerEndAngle),p=Math.atan2(m,v),g.setLocalEulerAngles(p*180/Math.PI+S),g.setLocalPosition(b+Math.cos(p)*x,w+Math.sin(p)*x)}}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle,s=a.x1,o=a.y1,l=a.x2,u=a.y2,c=hL(s,o,l,u,n),h=c.x,d=c.y,g=Qn(Qt(),Ae(h,d,0),i?this.getWorldTransform():this.getLocalTransform());return new $n(g[0],g[1])}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getTotalLength",value:function(){var n=this.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2;return cL(i,a,s,o)}}])}(Re);Fo.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var ZU=["style"],jr=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,ZU);st(this,t),e=qt(this,t,[Bt({type:Q.PATH,style:i,initialParsedStyle:{miterLimit:4,d:Bt({},pL)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&ae(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&ae(u)&&e.placeMarkerMid(u),l&&ae(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return jt(t,r),at(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="d"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&ae(s)&&(this.markerStartAngle=0,s.remove()),o&&ae(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&ae(s)&&(this.markerEndAngle=0,s.remove()),o&&ae(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=n?a:s;if(!(!u||!ae(u))){var c=0,h,d,g,p,v,m;if(n){var b=this.getStartTangent(),w=Lt(b,2),x=w[0],S=w[1];g=S[0],p=S[1],h=x[0]-S[0],d=x[1]-S[1],v=o||0,m=this.markerStartAngle}else{var _=this.getEndTangent(),k=Lt(_,2),M=k[0],C=k[1];g=C[0],p=C[1],h=M[0]-C[0],d=M[1]-C[1],v=l||0,m=this.markerEndAngle}c=Math.atan2(d,h),u.setLocalEulerAngles(c*180/Math.PI+m),u.setLocalPosition(g+Math.cos(c)*v,p+Math.sin(c)*v)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(c){c.remove()}),n&&ae(n))for(var a=1;a<i.length-1;a++){var s=Lt(i[a].currentPoint,2),o=s[0],l=s[1],u=a===1?n:n.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(o,l)}}},{key:"getTotalLength",value:function(){return kw(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=gG(a,n),o=s.x,l=s.y,u=Qn(Qt(),Ae(o,l,0),i?this.getWorldTransform():this.getLocalTransform());return new $n(u[0],u[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*kw(this),i)}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.d.segments,i=[];if(n.length>1){var a=n[0].currentPoint,s=n[1].currentPoint,o=n[1].startTangent;i=[],o?(i.push([a[0]-o[0],a[1]-o[1]]),i.push([a[0],a[1]])):(i.push([s[0],s[1]]),i.push([a[0],a[1]]))}return i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.d.segments,i=n.length,a=[];if(i>1){var s=n[i-2].currentPoint,o=n[i-1].currentPoint,l=n[i-1].endTangent;a=[],l?(a.push([o[0]-l[0],o[1]-l[1]]),a.push([o[0],o[1]])):(a.push([s[0],s[1]]),a.push([o[0],o[1]]))}return a}}])}(Re);jr.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var JU=["style"],Vo=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,JU);st(this,t),e=qt(this,t,[Bt({type:Q.POLYGON,style:i,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&ae(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&ae(u)&&e.placeMarkerMid(u),l&&ae(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return jt(t,r),at(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&ae(s)&&(this.markerStartAngle=0,s.remove()),o&&ae(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&ae(s)&&(this.markerEndAngle=0,s.remove()),o&&ae(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.points,c=u||{},h=c.points,d=n?a:s;if(!(!d||!ae(d)||!h)){var g=0,p,v,m,b,w,x;if(m=h[0][0],b=h[0][1],n)p=h[1][0]-h[0][0],v=h[1][1]-h[0][1],w=o||0,x=this.markerStartAngle;else{var S=h.length;this.parsedStyle.isClosed?(p=h[S-1][0]-h[0][0],v=h[S-1][1]-h[0][1]):(m=h[S-1][0],b=h[S-1][1],p=h[S-2][0]-h[S-1][0],v=h[S-2][1]-h[S-1][1]),w=l||0,x=this.markerEndAngle}g=Math.atan2(v,p),d.setLocalEulerAngles(g*180/Math.PI+x),d.setLocalPosition(m+Math.cos(g)*w,b+Math.sin(g)*w)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],n&&ae(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var l=s[o][0],u=s[o][1],c=o===1?n:n.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(l,u)}}}])}(Re);Vo.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var QU=["style"],c0=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=Wo(e,QU);return st(this,t),qt(this,t,[Bt({type:Q.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return jt(t,r),at(t,[{key:"getTotalLength",value:function(){return VV(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var s=[],o=0,l,u,c=this.getTotalLength();a.forEach(function(b,w){a[w+1]&&(l=[0,0],l[0]=o/c,u=cL(b[0],b[1],a[w+1][0],a[w+1][1]),o+=u,l[1]=o/c,s.push(l))}),this.parsedStyle.points.segments=s}var h=0,d=0;this.parsedStyle.points.segments.forEach(function(b,w){n>=b[0]&&n<=b[1]&&(h=(n-b[0])/(b[1]-b[0]),d=w)});var g=hL(a[d][0],a[d][1],a[d+1][0],a[d+1][1],h),p=g.x,v=g.y,m=Qn(Qt(),Ae(p,v,0),i?this.getWorldTransform():this.getLocalTransform());return new $n(m[0],m[1])}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.points.points,i=[];return i.push([n[1][0],n[1][1]]),i.push([n[0][0],n[0][1]]),i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.points.points,i=n.length-1,a=[];return a.push([n[i-1][0],n[i-1][1]]),a.push([n[i][0],n[i][1]]),a}}])}(Vo);c0.PARSED_STYLE_LIST=new Set([].concat(Ce(Vo.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var Nn=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return st(this,t),qt(this,t,[Bt({type:Q.RECT},e)])}return jt(t,r),at(t)}(Re);Nn.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var tY=["style"],Ys=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=Wo(e,tY);return st(this,t),qt(this,t,[Bt({type:Q.TEXT,style:Bt({fill:"black"},n)},i)])}return jt(t,r),at(t,[{key:"getComputedTextLength",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(Re);Ys.PARSED_STYLE_LIST=new Set([].concat(Ce(Re.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textPathSide","textPathStartOffset","metrics","dx","dy"]));var eY=function(){function r(){st(this,r),this.registry={},this.define(Q.CIRCLE,Ya),this.define(Q.ELLIPSE,Rc),this.define(Q.RECT,Nn),this.define(Q.IMAGE,Ic),this.define(Q.LINE,Fo),this.define(Q.GROUP,Mn),this.define(Q.PATH,jr),this.define(Q.POLYGON,Vo),this.define(Q.POLYLINE,c0),this.define(Q.TEXT,Ys),this.define(Q.HTML,Lc)}return at(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),WL=function(r){function t(){var e;st(this,t),e=qt(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new lt.AnimationTimeline(e)}catch{}var n={};return Fx.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=Et(o)?o(Q.GROUP):o)}),e.documentElement=new Mn({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return jt(t,r),at(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(n,i){if(n==="svg")return this.documentElement;var a=this.defaultView.customElements.get(n);a||(console.warn("Unsupported tagName: ",n),a=n==="tspan"?Ys:Mn);var s=new a(i);return s.ownerDocument=this,s}},{key:"createElementNS",value:function(n,i,a){return this.createElement(i,a)}},{key:"cloneNode",value:function(n){throw new Error(ve)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch{}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=this.defaultView.context.rBushRoot,l=o.search({minX:n,minY:i,maxX:a,maxY:s}),u=[];return l.forEach(function(c){var h=c.displayObject,d=h.parsedStyle.pointerEvents,g=d===void 0?"auto":d,p=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(g);(!p||p&&h.isVisible())&&!h.isCulled()&&h.isInteractive()&&u.push(h)}),u.sort(function(c,h){return h.sortable.renderOrder-c.sortable.renderOrder}),u}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return null;var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,g=h.y,p=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:g},picked:[]}),v=p.picked;return v&&v[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=Bs(qn().mark(function i(a,s){var o,l,u,c,h,d,g,p,v,m,b;return qn().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){x.next=4;break}return x.abrupt("return",null);case 4:return g=this.defaultView.viewport2Client({x:l,y:u}),p=g.x,v=g.y,x.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:p,clientY:v},picked:[]});case 7:return m=x.sent,b=m.picked,x.abrupt("return",b&&b[0]||this.documentElement);case 10:case"end":return x.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"elementsFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return[];var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,g=h.y,p=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:g},picked:[]}),v=p.picked;return v[v.length-1]!==this.documentElement&&v.push(this.documentElement),v}},{key:"elementsFromPoint",value:function(){var e=Bs(qn().mark(function i(a,s){var o,l,u,c,h,d,g,p,v,m,b;return qn().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){x.next=4;break}return x.abrupt("return",[]);case 4:return g=this.defaultView.viewport2Client({x:l,y:u}),p=g.x,v=g.y,x.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:p,clientY:v},picked:[]});case 7:return m=x.sent,b=m.picked,b[b.length-1]!==this.documentElement&&b.push(this.documentElement),x.abrupt("return",b);case 11:case"end":return x.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(ml)}},{key:"insertBefore",value:function(n,i){throw new Error(ml)}},{key:"removeChild",value:function(n,i){throw new Error(ml)}},{key:"replaceChild",value:function(n,i,a){throw new Error(ml)}},{key:"append",value:function(){throw new Error(ml)}},{key:"prepend",value:function(){throw new Error(ml)}},{key:"getElementById",value:function(n){return this.documentElement.getElementById(n)}},{key:"getElementsByName",value:function(n){return this.documentElement.getElementsByName(n)}},{key:"getElementsByTagName",value:function(n){return this.documentElement.getElementsByTagName(n)}},{key:"getElementsByClassName",value:function(n){return this.documentElement.getElementsByClassName(n)}},{key:"querySelector",value:function(n){return this.documentElement.querySelector(n)}},{key:"querySelectorAll",value:function(n){return this.documentElement.querySelectorAll(n)}},{key:"find",value:function(n){return this.documentElement.find(n)}},{key:"findAll",value:function(n){return this.documentElement.findAll(n)}}])}(qe),GL=function(){function r(t){st(this,r),this.strategies=t}return at(r,[{key:"apply",value:function(e){var n=e.camera,i=e.renderingService,a=e.renderingContext,s=this.strategies;i.hooks.cull.tap(r.tag,function(o){if(o){var l=o.cullable;return s.length===0?l.visible=a.unculledEntities.indexOf(o.entity)>-1:l.visible=s.every(function(u){return u.isVisible(n,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new dn(Xt.CULLED)),null)}return o}),i.hooks.afterRender.tap(r.tag,function(o){o.cullable.visibilityPlaneMask=-1})}}])}();GL.tag="Culling";var VL=function(){function r(){var t=this;st(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new Cf(null),this.rootWheelEvent=new Aw(null),this.onPointerMove=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView;if(!(i.supportsTouchEvents&&e.pointerType==="touch")){var a=t.normalizeToPointerEvent(e,i),s=yo(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView,a=t.normalizeToPointerEvent(e,i),s=yo(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return at(r,[{key:"apply",value:function(e){var n=this;this.context=e;var i=e.renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(s){var o=n.context.renderingService.hooks.pickSync.call({position:s,picked:[],topmost:!0}),l=o.picked;return l[0]||null}),i.hooks.pointerWheel.tap(r.tag,function(s){var o=n.normalizeWheelEvent(s);n.context.eventService.mapEvent(o)}),i.hooks.pointerDown.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.normalizeToPointerEvent(s,a);if(n.autoPreventDefault&&o[0].isNormalized){var l=s.cancelable||!("cancelable"in s);l&&s.preventDefault()}var u=yo(o),c;try{for(u.s();!(c=u.n()).done;){var h=c.value,d=n.bootstrapEvent(n.rootPointerEvent,h,a,s);n.context.eventService.mapEvent(d)}}catch(g){u.e(g)}finally{u.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerUp.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.context.contextService.getDomElement(),l=n.context.eventService.isNativeEventFromCanvas(o,s),u=l?"":"outside",c=n.normalizeToPointerEvent(s,a),h=yo(c),d;try{for(h.s();!(d=h.n()).done;){var g=d.value,p=n.bootstrapEvent(n.rootPointerEvent,g,a,s);p.type+=u,n.context.eventService.mapEvent(p)}}catch(v){h.e(v)}finally{h.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerMove.tap(r.tag,this.onPointerMove),i.hooks.pointerOver.tap(r.tag,this.onPointerMove),i.hooks.pointerOut.tap(r.tag,this.onPointerMove),i.hooks.click.tap(r.tag,this.onClick),i.hooks.pointerCancel.tap(r.tag,function(s){var o=n.normalizeToPointerEvent(s,a),l=yo(o),u;try{for(l.s();!(u=l.n()).done;){var c=u.value,h=n.bootstrapEvent(n.rootPointerEvent,c,a,s);n.context.eventService.mapEvent(h)}}catch(d){l.e(d)}finally{l.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(e,n,i,a){e.view=i,e.originalEvent=null,e.nativeEvent=a,e.pointerId=n.pointerId,e.width=n.width,e.height=n.height,e.isPrimary=n.isPrimary,e.pointerType=n.pointerType,e.pressure=n.pressure,e.tangentialPressure=n.tangentialPressure,e.tiltX=n.tiltX,e.tiltY=n.tiltY,e.twist=n.twist,this.transferMouseData(e,n);var s=this.context.eventService.client2Viewport({x:n.clientX,y:n.clientY}),o=s.x,l=s.y;e.viewport.x=o,e.viewport.y=l;var u=this.context.eventService.viewport2Canvas(e.viewport),c=u.x,h=u.y;return e.canvas.x=c,e.canvas.y=h,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=a.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=BH[e.type]||e.type),e}},{key:"normalizeWheelEvent",value:function(e){var n=this.rootWheelEvent;this.transferMouseData(n,e),n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ;var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),a=i.x,s=i.y;n.viewport.x=a,n.viewport.y=s;var o=this.context.eventService.viewport2Canvas(n.viewport),l=o.x,u=o.y;return n.canvas.x=l,n.canvas.y=u,n.global.copyFrom(n.canvas),n.offset.copyFrom(n.canvas),n.nativeEvent=e,n.type=e.type,n}},{key:"transferMouseData",value:function(e,n){e.isTrusted=n.isTrusted,e.srcElement=n.srcElement,e.timeStamp=Ow.now(),e.type=n.type,e.altKey=n.altKey,e.metaKey=n.metaKey,e.shiftKey=n.shiftKey,e.ctrlKey=n.ctrlKey,e.button=n.button,e.buttons=n.buttons,e.client.x=n.clientX,e.client.y=n.clientY,e.movement.x=n.movementX,e.movement.y=n.movementY,e.page.x=n.pageX,e.page.y=n.pageY,e.screen.x=n.screenX,e.screen.y=n.screenY,e.relatedTarget=null}},{key:"setCursor",value:function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(e,n){var i=[];if(n.isTouchEvent(e))for(var a=0;a<e.changedTouches.length;a++){var s=e.changedTouches[a];Nt(s.button)&&(s.button=0),Nt(s.buttons)&&(s.buttons=1),Nt(s.isPrimary)&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),Nt(s.width)&&(s.width=s.radiusX||1),Nt(s.height)&&(s.height=s.radiusY||1),Nt(s.tiltX)&&(s.tiltX=0),Nt(s.tiltY)&&(s.tiltY=0),Nt(s.pointerType)&&(s.pointerType="touch"),Nt(s.pointerId)&&(s.pointerId=s.identifier||0),Nt(s.pressure)&&(s.pressure=s.force||.5),Nt(s.twist)&&(s.twist=0),Nt(s.tangentialPressure)&&(s.tangentialPressure=0),s.isNormalized=!0,s.type=e.type,i.push(s)}else if(n.isMouseEvent(e)){var o=e;Nt(o.isPrimary)&&(o.isPrimary=!0),Nt(o.width)&&(o.width=1),Nt(o.height)&&(o.height=1),Nt(o.tiltX)&&(o.tiltX=0),Nt(o.tiltY)&&(o.tiltY=0),Nt(o.pointerType)&&(o.pointerType="mouse"),Nt(o.pointerId)&&(o.pointerId=FH),Nt(o.pressure)&&(o.pressure=.5),Nt(o.twist)&&(o.twist=0),Nt(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,i.push(o)}else i.push(e);return i}}])}();VL.tag="Event";var nY=[Q.CIRCLE,Q.ELLIPSE,Q.IMAGE,Q.RECT,Q.LINE,Q.POLYLINE,Q.POLYGON,Q.TEXT,Q.PATH,Q.HTML],rY=function(){function r(){st(this,r)}return at(r,[{key:"isVisible",value:function(e,n){var i,a=n.cullable;if(!a.enable)return!0;var s=n.getRenderBounds();if(Me.isEmpty(s))return!1;var o=e.getFrustum(),l=(i=n.parentNode)===null||i===void 0||(i=i.cullable)===null||i===void 0?void 0:i.visibilityPlaneMask;return a.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(n,s,l||vl.INDETERMINATE,o.planes),a.visible=a.visibilityPlaneMask!==vl.OUTSIDE,a.visible}},{key:"computeVisibilityWithPlaneMask",value:function(e,n,i,a){if(i===vl.OUTSIDE||i===vl.INSIDE)return i;for(var s=vl.INSIDE,o=nY.indexOf(e.nodeName)>-1,l=0,u=a.length;l<u;++l){var c=1<<l;if(i&c&&!(o&&(l===4||l===5))){var h=a[l],d=h.normal,g=h.distance;if(ea(d,n.getPositiveFarPoint(a[l]))+g<0)return vl.OUTSIDE;ea(d,n.getNegativeFarPoint(a[l]))+g<0&&(s|=c)}}return s}}])}(),HL=function(){function r(){st(this,r),this.syncTasks=new Map,this.isFirstTimeRendering=!0,this.syncing=!1,this.isFirstTimeRenderingFinished=!1}return at(r,[{key:"apply",value:function(e){var n=this,i,a=e.renderingService,s=e.renderingContext,o=e.rBushRoot,l=s.root.ownerDocument.defaultView;this.rBush=o;var u=function(v){var m=v.target;m.renderable.dirty=!0,a.dirtify()},c=function(v){n.syncTasks.set(v.target,v.detail.affectChildren),a.dirtify()},h=function(v){var m=v.target;lt.enableSizeAttenuation&<.styleValueRegistry.updateSizeAttenuation(m,l.getCamera().getZoom())},d=function(v){var m=v.target,b=m.rBushNode;b.aabb&&n.rBush.remove(b.aabb),n.syncTasks.delete(m),lt.sceneGraphService.dirtifyToRoot(m),a.dirtify()};a.hooks.init.tap(r.tag,function(){l.addEventListener(Xt.MOUNTED,h),l.addEventListener(Xt.UNMOUNTED,d),l.addEventListener(Xt.ATTR_MODIFIED,u),l.addEventListener(Xt.BOUNDS_CHANGED,c)}),a.hooks.destroy.tap(r.tag,function(){l.removeEventListener(Xt.MOUNTED,h),l.removeEventListener(Xt.UNMOUNTED,d),l.removeEventListener(Xt.ATTR_MODIFIED,u),l.removeEventListener(Xt.BOUNDS_CHANGED,c),n.syncTasks.clear()});var g=(i=lt.globalThis.requestIdleCallback)!==null&&i!==void 0?i:zx.bind(lt.globalThis);a.hooks.endFrame.tap(r.tag,function(){n.isFirstTimeRendering?(n.isFirstTimeRendering=!1,n.syncing=!0,g(function(){n.syncRTree(!0),n.isFirstTimeRenderingFinished=!0})):n.syncRTree()})}},{key:"syncNode",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.isConnected){var i=e.rBushNode;i.aabb&&this.rBush.remove(i.aabb);var a=e.getRenderBounds();if(a){var s=e.renderable;n&&(s.dirtyRenderBounds||(s.dirtyRenderBounds=new Me),s.dirtyRenderBounds.update(a.center,a.halfExtents));var o=a.getMin(),l=Lt(o,2),u=l[0],c=l[1],h=a.getMax(),d=Lt(h,2),g=d[0],p=d[1];i.aabb||(i.aabb={}),i.aabb.displayObject=e,i.aabb.minX=u,i.aabb.minY=c,i.aabb.maxX=g,i.aabb.maxY=p}if(i.aabb&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.minX)&&!isNaN(i.aabb.minY))return i.aabb}}},{key:"syncRTree",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(!n&&(this.syncing||this.syncTasks.size===0))){this.syncing=!0;var i=[],a=new Set,s=function(l){if(!a.has(l)&&l.renderable){var u=e.syncNode(l,n);u&&(i.push(u),a.add(l))}};this.syncTasks.forEach(function(o,l){o&&l.forEach(s);for(var u=l;u;)s(u),u=u.parentElement}),this.rBush.load(i),i.length=0,this.syncing=!1}}}])}();HL.tag="Prepare";var zr=function(r){return r.READY="ready",r.BEFORE_RENDER="beforerender",r.RERENDER="rerender",r.AFTER_RENDER="afterrender",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.RESIZE="resize",r.DIRTY_RECTANGLE="dirtyrectangle",r.RENDERER_CHANGED="rendererchanged",r}({}),kM=500,iY=.1,aY=1e3,td=new dn(Xt.MOUNTED),ed=new dn(Xt.UNMOUNTED),Nv=new dn(zr.BEFORE_RENDER),CM=new dn(zr.RERENDER),Rv=new dn(zr.AFTER_RENDER),Rw=function(r){function t(e){var n;st(this,t),n=qt(this,t),n.Element=Re,n.inited=!1,n.context={};var i=e.container,a=e.canvas,s=e.renderer,o=e.width,l=e.height,u=e.background,c=e.cursor,h=e.supportsMutipleCanvasesInOneContainer,d=e.cleanUpOnDestroy,g=d===void 0?!0:d,p=e.offscreenCanvas,v=e.devicePixelRatio,m=e.requestAnimationFrame,b=e.cancelAnimationFrame,w=e.createImage,x=e.supportsTouchEvents,S=e.supportsPointerEvents,_=e.isTouchEvent,k=e.isMouseEvent,M=e.dblClickSpeed,C=o,P=l,T=v||Bx&&window.devicePixelRatio||1;return T=T>=1?Math.ceil(T):1,a&&(C=o||IH(a)||a.width/T,P=l||DH(a)||a.height/T),n.customElements=new eY,n.devicePixelRatio=T,n.requestAnimationFrame=m??zx.bind(lt.globalThis),n.cancelAnimationFrame=b??BL.bind(lt.globalThis),n.supportsTouchEvents=x??"ontouchstart"in lt.globalThis,n.supportsPointerEvents=S??!!lt.globalThis.PointerEvent,n.isTouchEvent=_??function(A){return n.supportsTouchEvents&&A instanceof lt.globalThis.TouchEvent},n.isMouseEvent=k??function(A){return!lt.globalThis.MouseEvent||A instanceof lt.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(A instanceof lt.globalThis.PointerEvent))},p&&(lt.offscreenCanvas=p),n.document=new WL,n.document.defaultView=n,h||PH(i,n,g),n.initRenderingContext(Bt(Bt({},e),{},{width:C,height:P,background:u??"transparent",cursor:c??"default",cleanUpOnDestroy:g,devicePixelRatio:T,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:M??200,createImage:w??function(){return new window.Image}})),n.initDefaultCamera(C,P,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return jt(t,r),at(t,[{key:"initRenderingContext",value:function(n){this.context.config=n,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(n,i,a){var s=this,o=new lt.CameraContribution;o.clipSpaceNearZ=a,o.setType(pe.EXPLORING,xw.DEFAULT).setPosition(n/2,i/2,kM).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,iY,aY),o.canvas=this,o.eventEmitter.on(fL.UPDATED,function(){s.context.renderingContext.renderReasons.add($l.CAMERA_CHANGED),lt.enableSizeAttenuation&&s.getConfig().renderer.getConfig().enableSizeAttenuation&&s.updateSizeAttenuation()}),this.context.camera=o}},{key:"updateSizeAttenuation",value:function(){var n=this.getCamera().getZoom();this.document.documentElement.forEach(function(i){lt.styleValueRegistry.updateSizeAttenuation(i,n)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var n=this;return this.readyPromise||(this.readyPromise=new Promise(function(i){n.resolveReadyPromise=function(){i(n)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1?arguments[1]:void 0;vn.clearCache(),i||this.dispatchEvent(new dn(zr.BEFORE_DESTROY)),this.frameId&&this.cancelAnimationFrame(this.frameId);var a=this.getRoot();n&&(this.unmountChildren(a),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),this.context.rBushRoot&&this.context.rBushRoot.clear(),i||this.dispatchEvent(new dn(zr.AFTER_DESTROY));var s=function(l){l.currentTarget=null,l.manager=null,l.target=null,l.relatedNode=null};s(td),s(ed),s(Nv),s(CM),s(Rv),s(Zi),s(Pw),s(Nw),s(qL)}},{key:"changeSize",value:function(n,i){this.resize(n,i)}},{key:"resize",value:function(n,i){var a=this.context.config;a.width=n,a.height=i,this.getContextService().resize(n,i);var s=this.context.camera,o=s.getProjectionMode();s.setPosition(n/2,i/2,kM).setFocalPoint(n/2,i/2,0),o===ui.ORTHOGRAPHIC?s.setOrthographic(n/-2,n/2,i/2,i/-2,s.getNear(),s.getFar()):s.setAspect(n/i),this.dispatchEvent(new dn(zr.RESIZE,{width:n,height:i}))}},{key:"appendChild",value:function(n,i){return this.document.documentElement.appendChild(n,i)}},{key:"insertBefore",value:function(n,i){return this.document.documentElement.insertBefore(n,i)}},{key:"removeChild",value:function(n){return this.document.documentElement.removeChild(n)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(n){var i=this;n&&(Nv.detail=n,Rv.detail=n),this.dispatchEvent(Nv);var a=this.getRenderingService();a.render(this.getConfig(),n,function(){i.dispatchEvent(CM)}),this.dispatchEvent(Rv)}},{key:"run",value:function(){var n=this,i=function(s,o){n.render(o),n.frameId=n.requestAnimationFrame(i)};i()}},{key:"initRenderer",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!n)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new RG,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new VL,new HL,new GL([new rY])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService(Bt(Bt({},lt),this.context)),this.context.renderingService=new mU(lt,this.context),this.context.eventService=new vU(lt,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(n,a,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(n,a)}).catch(function(s){console.error(s)})}},{key:"initRenderingService",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){i.inited=!0,a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new dn(zr.READY))}):i.dispatchEvent(new dn(zr.READY)):i.dispatchEvent(new dn(zr.RENDERER_CHANGED)),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(o){var l=o,u=l.renderable;u&&(u.renderBoundsDirty=!0,u.boundsDirty=!0,u.dirty=!0)}),i.mountChildren(i.getRoot()),n.getConfig().enableAutoRendering&&i.run()})}},{key:"loadRendererContainerModule",value:function(n){var i=this,a=n.getPlugins();a.forEach(function(s){s.context=i.context,s.init(lt)})}},{key:"setRenderer",value:function(n){var i=this.getConfig();if(i.renderer!==n){var a=i.renderer;i.renderer=n,this.destroy(!1,!0),Ce((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(lt)}),this.initRenderer(n)}}},{key:"setCursor",value:function(n){var i=this.getConfig();i.cursor=n,this.getContextService().applyCursorStyle(n)}},{key:"unmountChildren",value:function(n){var i=this;n.childNodes.forEach(function(a){i.unmountChildren(a)}),this.inited&&(n.isMutationObserved?n.dispatchEvent(ed):(ed.target=n,this.dispatchEvent(ed,!0)),n!==this.document.documentElement&&(n.ownerDocument=null),n.isConnected=!1),n.isCustomElement&&n.disconnectedCallback&&n.disconnectedCallback()}},{key:"mountChildren",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kf(n);this.inited?n.isConnected||(n.ownerDocument=this.document,n.isConnected=!0,a||(n.isMutationObserved?n.dispatchEvent(td):(td.target=n,this.dispatchEvent(td,!0)))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",n.nodeName),n.childNodes.forEach(function(s){i.mountChildren(s,a)}),n.isCustomElement&&n.connectedCallback&&n.connectedCallback()}},{key:"mountFragment",value:function(n){this.mountChildren(n,!1)}},{key:"client2Viewport",value:function(n){return this.getEventService().client2Viewport(n)}},{key:"viewport2Client",value:function(n){return this.getEventService().viewport2Client(n)}},{key:"viewport2Canvas",value:function(n){return this.getEventService().viewport2Canvas(n)}},{key:"canvas2Viewport",value:function(n){return this.getEventService().canvas2Viewport(n)}},{key:"getPointByClient",value:function(n,i){return this.client2Viewport({x:n,y:i})}},{key:"getClientByPoint",value:function(n,i){return this.viewport2Client({x:n,y:i})}}])}(jL);/*!
- * @antv/g-camera-api
- * @description A simple implementation of Camera API.
- * @version 2.0.35
- * @date 1/23/2025, 8:32:08 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var sY=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.landmarks=[],e}return jt(t,r),at(t,[{key:"rotate",value:function(n,i,a){if(this.relElevation=Fl(i),this.relAzimuth=Fl(n),this.relRoll=Fl(a),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===pe.EXPLORING){var s=_s(En(),[1,0,0],me((this.rotateWorld?1:-1)*this.relElevation)),o=_s(En(),[0,1,0],me((this.rotateWorld?1:-1)*this.relAzimuth)),l=_s(En(),[0,0,1],me(this.relRoll)),u=Rs(En(),o,s);u=Rs(En(),u,l);var c=Ox(Se(),u);Dl(this.matrix,this.matrix,[0,0,-this.distance]),Jn(this.matrix,this.matrix,c),Dl(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===pe.ORBITING||this.type===pe.EXPLORING?this._getPosition():this.type===pe.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=ar(n,i,0),s=Sa(this.position);return Ns(s,s,ff(Qt(),this.right,a[0])),Ns(s,s,ff(Qt(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=Sa(this.position),s=n*this.dollyingStep,o=this.distance+n*this.dollyingStep;return s=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],this._setPosition(a),this.type===pe.ORBITING||this.type===pe.EXPLORING?this._getDistance():this.type===pe.TRACKING&&Ns(this.focalPoint,a,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(n){var i,a,s,o,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=l.position,c=u===void 0?this.position:u,h=l.focalPoint,d=h===void 0?this.focalPoint:h,g=l.roll,p=l.zoom,v=new lt.CameraContribution;v.setType(this.type,void 0),v.setPosition(c[0],(i=c[1])!==null&&i!==void 0?i:this.position[1],(a=c[2])!==null&&a!==void 0?a:this.position[2]),v.setFocalPoint(d[0],(s=d[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=d[2])!==null&&o!==void 0?o:this.focalPoint[2]),v.setRoll(g??this.roll),v.setZoom(p??this.zoom);var m={name:n,matrix:AR(v.getWorldTransform()),right:Sa(v.right),up:Sa(v.up),forward:Sa(v.forward),position:Sa(v.getPosition()),focalPoint:Sa(v.getFocalPoint()),distanceVector:Sa(v.getDistanceVector()),distance:v.getDistance(),dollyingStep:v.getDollyingStep(),azimuth:v.getAzimuth(),elevation:v.getElevation(),roll:v.getRoll(),relAzimuth:v.relAzimuth,relElevation:v.relElevation,relRoll:v.relRoll,zoom:v.getZoom()};return this.landmarks.push(m),m}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=se(n)?this.landmarks.find(function(A){return A.name===n}):n;if(s){var o=yt(a)?{duration:a}:a,l=o.easing,u=l===void 0?"linear":l,c=o.duration,h=c===void 0?100:c,d=o.easingFunction,g=d===void 0?void 0:d,p=o.onfinish,v=p===void 0?void 0:p,m=o.onframe,b=m===void 0?void 0:m,w=.01;this.cancelLandmarkAnimation();var x=s.position,S=s.focalPoint,_=s.zoom,k=s.roll,M=g||lt.EasingFunction(u),C,P=function(){i.setFocalPoint(S),i.setPosition(x),i.setRoll(k),i.setZoom(_),i.computeMatrix(),i.triggerUpdate(),v==null||v()};if(h===0)return P();var T=function(R){C===void 0&&(C=R);var L=R-C;if(L>=h){P();return}var $=M(L/h),q=Qt(),j=Qt(),B=1,F=0;cw(q,i.focalPoint,S,$),cw(j,i.position,x,$),F=i.roll*(1-$)+k*$,B=i.zoom*(1-$)+_*$,i.setFocalPoint(q),i.setPosition(j),i.setRoll(F),i.setZoom(B);var V=F3(q,S)+F3(j,x);if(V<=w&&_===void 0&&k===void 0)return P();i.computeMatrix(),i.triggerUpdate(),L<h&&(b==null||b($),i.landmarkAnimationID=i.canvas.requestAnimationFrame(T))};this.canvas.requestAnimationFrame(T)}}}])}(gL);lt.CameraContribution=sY;/*!
- * @antv/g-web-animations-api
- * @description A simple implementation of Web Animations API.
- * @version 2.1.21
- * @date 1/23/2025, 8:33:55 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var Lv=function(r){function t(e,n,i,a){var s;return st(this,t),s=qt(this,t,[e]),s.currentTime=i,s.timelineTime=a,s.target=n,s.type="finish",s.bubbles=!1,s.currentTarget=n,s.defaultPrevented=!1,s.eventPhase=s.AT_TARGET,s.timeStamp=Date.now(),s.currentTime=i,s.timelineTime=a,s}return jt(t,r),at(t)}(u0),oY=0,lY=function(){function r(t,e){var n;st(this,r),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=t,t.animation=this,this.timeline=e,this.id="".concat(oY++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number((n=this.effect)===null||n===void 0?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return at(r,[{key:"pending",get:function(){return this._startTime===null&&!this._paused&&this.playbackRate!==0||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var e=this;return this.readyPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(n,i){e.resolveReadyPromise=function(){n(e)},e.rejectReadyPromise=function(){i(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var e=this;return this.finishedPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(n,i){e.resolveFinishedPromise=function(){n(e)},e.rejectFinishedPromise=function(){i(new Error)}}),this.playState==="finished"&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(e){if(e=Number(e),!isNaN(e)){if(this.timeline.restart(),!this._paused&&this._startTime!==null){var n;this._startTime=Number((n=this.timeline)===null||n===void 0?void 0:n.currentTime)-e/this.playbackRate}this.currentTimePending=!1,this._currentTime!==e&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(e,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(e){if(e!==null){if(this.updatePromises(),e=Number(e),isNaN(e)||this._paused||this._idle)return;this._startTime=e,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(e){if(e!==this._playbackRate){this.updatePromises();var n=this.currentTime;this._playbackRate=e,this.startTime=null,this.playState!=="paused"&&this.playState!=="idle"&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),n!==null&&(this.currentTime=n),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||this.playState==="running"||!this._finishedFlag}},{key:"updatePromises",value:function(){var e=this.oldPlayState,n=this.pending?"pending":this.playState;return this.readyPromise&&n!==e&&(n==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):e==="pending"?this.resolveReadyPromise():n==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&n!==e&&(n==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):n==="finished"?this.resolveFinishedPromise():e==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=n,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var n=new Lv(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(n)})}}},{key:"reverse",value:function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()}},{key:"updatePlaybackRate",value:function(e){this.playbackRate=e}},{key:"targetAnimations",value:function(){var e,n=(e=this.effect)===null||e===void 0?void 0:e.target;return n.getAnimations()}},{key:"markTarget",value:function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)}},{key:"unmarkTarget",value:function(){var e=this.targetAnimations(),n=e.indexOf(this);n!==-1&&e.splice(n,1)}},{key:"tick",value:function(e,n){!this._idle&&!this._paused&&(this._startTime===null?n&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),n&&(this.currentTimePending=!1,this.fireEvents(e))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(ve)}},{key:"addEventListener",value:function(e,n,i){throw new Error(ve)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(ve)}},{key:"dispatchEvent",value:function(e){throw new Error(ve)}},{key:"commitStyles",value:function(){throw new Error(ve)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var e;this._inEffect=!!((e=this.effect)!==null&&e!==void 0&&e.update(-1))}else{var n;this._inEffect=!!((n=this.effect)!==null&&n!==void 0&&n.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(e,n){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!n&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(e){var n=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var i=new Lv(null,this,this.currentTime,e);setTimeout(function(){n.onfinish&&n.onfinish(i)})}this._finishedFlag=!0}}else{if(this.onframe&&this.playState==="running"){var a=new Lv(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),uY=4,cY=.001,hY=1e-7,dY=10,$u=11,nd=1/($u-1),fY=typeof Float32Array=="function",UL=function(t,e){return 1-3*e+3*t},YL=function(t,e){return 3*e-6*t},XL=function(t){return 3*t},Tf=function(t,e,n){return((UL(e,n)*t+YL(e,n))*t+XL(e))*t},KL=function(t,e,n){return 3*UL(e,n)*t*t+2*YL(e,n)*t+XL(e)},gY=function(t,e,n,i,a){var s,o,l=0;do o=e+(n-e)/2,s=Tf(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>hY&&++l<dY);return o},pY=function(t,e,n,i){for(var a=0;a<uY;++a){var s=KL(e,n,i);if(s===0)return e;var o=Tf(e,n,i)-t;e-=o/s}return e},qx=function(t,e,n,i){if(!(t>=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===i)return function(l){return l};for(var a=fY?new Float32Array($u):new Array($u),s=0;s<$u;++s)a[s]=Tf(s*nd,t,n);var o=function(u){for(var c=0,h=1,d=$u-1;h!==d&&a[h]<=u;++h)c+=nd;--h;var g=(u-a[h])/(a[h+1]-a[h]),p=c+g*nd,v=KL(p,t,n);return v>=cY?pY(u,p,t,n):v===0?p:gY(u,c,c+nd,t,n)};return function(l){return l===0||l===1?l:Tf(o(l),e,i)}},vY=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},rd=function(t){return Math.pow(t,2)},id=function(t){return Math.pow(t,3)},ad=function(t){return Math.pow(t,4)},sd=function(t){return Math.pow(t,5)},od=function(t){return Math.pow(t,6)},ld=function(t){return 1-Math.cos(t*Math.PI/2)},ud=function(t){return 1-Math.sqrt(1-t*t)},cd=function(t){return t*t*(3*t-2)},hd=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((e*3-2)/22-t,2)},dd=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=Lt(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,l=Ke(Number(a),1,10),u=Ke(Number(o),.1,2);return t===0||t===1?t:-l*Math.pow(2,10*(t-1))*Math.sin((t-1-u/(Math.PI*2)*Math.asin(1/l))*(Math.PI*2)/u)},Au=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=Lt(e,4),a=i[0],s=a===void 0?1:a,o=i[1],l=o===void 0?100:o,u=i[2],c=u===void 0?10:u,h=i[3],d=h===void 0?0:h;s=Ke(s,.1,1e3),l=Ke(l,.1,1e3),c=Ke(c,.1,1e3),d=Ke(d,.1,1e3);var g=Math.sqrt(l/s),p=c/(2*Math.sqrt(l*s)),v=p<1?g*Math.sqrt(1-p*p):0,m=1,b=p<1?(p*g+-d)/v:-d+g,w=n?n*t/1e3:t;return p<1?w=Math.exp(-w*p*g)*(m*Math.cos(v*w)+b*Math.sin(v*w)):w=(m+b*w)*Math.exp(-w*g),t===0||t===1?t:1-w},Iv=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=Lt(n,2),a=i[0],s=a===void 0?10:a,o=i[1],l=o==="start"?Math.ceil:Math.floor;return l(Ke(t,0,1)*s)/s},TM=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=Lt(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return qx(i,a,s,o)(t)},fd=qx(.42,0,1,1),ai=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return 1-t(1-e,n,i)}},si=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?t(e*2,n,i)/2:1-t(e*-2+2,n,i)/2}},oi=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-e*2,n,i))/2:(t(e*2-1,n,i)+1)/2}},OM={steps:Iv,"step-start":function(t){return Iv(t,[1,"start"])},"step-end":function(t){return Iv(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":TM,ease:function(t){return TM(t,[.25,.1,.25,1])},in:fd,out:ai(fd),"in-out":si(fd),"out-in":oi(fd),"in-quad":rd,"out-quad":ai(rd),"in-out-quad":si(rd),"out-in-quad":oi(rd),"in-cubic":id,"out-cubic":ai(id),"in-out-cubic":si(id),"out-in-cubic":oi(id),"in-quart":ad,"out-quart":ai(ad),"in-out-quart":si(ad),"out-in-quart":oi(ad),"in-quint":sd,"out-quint":ai(sd),"in-out-quint":si(sd),"out-in-quint":oi(sd),"in-expo":od,"out-expo":ai(od),"in-out-expo":si(od),"out-in-expo":oi(od),"in-sine":ld,"out-sine":ai(ld),"in-out-sine":si(ld),"out-in-sine":oi(ld),"in-circ":ud,"out-circ":ai(ud),"in-out-circ":si(ud),"out-in-circ":oi(ud),"in-back":cd,"out-back":ai(cd),"in-out-back":si(cd),"out-in-back":oi(cd),"in-bounce":hd,"out-bounce":ai(hd),"in-out-bounce":si(hd),"out-in-bounce":oi(hd),"in-elastic":dd,"out-elastic":ai(dd),"in-out-elastic":si(dd),"out-in-elastic":oi(dd),spring:Au,"spring-in":Au,"spring-out":ai(Au),"spring-in-out":si(Au),"spring-out-in":oi(Au)},mY=function(t){return vY(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},yY=function(t){return OM[mY(t)]||OM.linear},bY=function(t){return t},wY=1,xY=.5,AM=0;function PM(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var gd="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",EY=new RegExp("cubic-bezier\\(".concat(gd,",").concat(gd,",").concat(gd,",").concat(gd,"\\)")),_Y=/steps\(\s*(\d+)\s*\)/,SY=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Wx(r){var t=EY.exec(r);if(t)return qx.apply(void 0,Ce(t.slice(1).map(Number)));var e=_Y.exec(r);if(e)return PM(Number(e[1]),AM);var n=SY.exec(r);return n?PM(Number(n[1]),{start:wY,middle:xY,end:AM}[n[2]]):yY(r)}function MY(r){return Math.abs(kY(r)/(r.playbackRate||1))}function kY(r){var t;return r.duration===0||r.iterations===0?0:(r.duration==="auto"?0:Number(r.duration))*((t=r.iterations)!==null&&t!==void 0?t:1)}var ZL=0,Gx=1,h0=2,JL=3;function CY(r,t,e){if(t===null)return ZL;var n=e.endTime;return t<Math.min(e.delay,n)?Gx:t>=Math.min(e.delay+r+e.endDelay,n)?h0:JL}function TY(r,t,e,n,i){switch(n){case Gx:return t==="backwards"||t==="both"?0:null;case JL:return e-i;case h0:return t==="forwards"||t==="both"?r:null;case ZL:return null}}function OY(r,t,e,n,i){var a=i;return r===0?t!==Gx&&(a+=e):a+=n/r,a}function AY(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===h0&&n!==0&&(i!==0||a===0)&&(s=1),s}function PY(r,t,e,n){return r===h0&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function NY(r,t,e){var n=r;if(r!=="normal"&&r!=="reverse"){var i=t;r==="alternate-reverse"&&(i+=1),n="normal",i!==1/0&&i%2!==0&&(n="reverse")}return n==="normal"?e:1-e}function RY(r,t,e){var n=CY(r,t,e),i=TY(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=OY(a,n,e.iterations,i,e.iterationStart),o=AY(s,e.iterationStart,n,e.iterations,i,a),l=PY(n,e.iterations,o,s),u=NY(e.direction,l,o);return e.currentIteration=l,e.progress=u,e.easingFunction(u)}function LY(r,t,e){var n=IY(r,t),i=DY(n,e);return function(a,s){if(s!==null)i.filter(function(l){return s>=l.applyFrom&&s<l.applyTo}).forEach(function(l){var u=s-l.startOffset,c=l.endOffset-l.startOffset,h=c===0?0:u/c;a.setAttribute(l.property,l.interpolation(h),!1,!1)});else for(var o in n)QL(o)&&a.setAttribute(o,null)}}function QL(r){return r!=="offset"&&r!=="easing"&&r!=="composite"&&r!=="computedOffset"}function IY(r,t){for(var e={},n=0;n<r.length;n++)for(var i in r[n])if(QL(i)){var a={offset:r[n].offset,computedOffset:r[n].computedOffset,easing:r[n].easing,easingFunction:Wx(r[n].easing)||t.easingFunction,value:r[n][i]};e[i]=e[i]||[],e[i].push(a)}return e}function DY(r,t){var e=[];for(var n in r)for(var i=r[n],a=0;a<i.length-1;a++){var s=a,o=a+1,l=i[s].computedOffset,u=i[o].computedOffset,c=l,h=u;a===0&&(c=-1/0,u===0&&(o=s)),a===i.length-2&&(h=1/0,l===1&&(s=o)),e.push({applyFrom:c,applyTo:h,startOffset:i[s].computedOffset,endOffset:i[o].computedOffset,easingFunction:i[s].easingFunction,property:n,interpolation:FY(n,i[s].value,i[o].value,t)})}return e.sort(function(d,g){return d.startOffset-g.startOffset}),e}var NM=function(t,e,n){return function(i){var a=t6(t,e,i);return yt(a)?a:n(a)}};function FY(r,t,e,n){var i=PL[r];if(i&&i.syntax&&i.int){var a=lt.styleValueRegistry.getPropertySyntax(i.syntax);if(a){var s=a.parser,o=s?s(t,n):t,l=s?s(e,n):e,u=a.mixer(o,l,n);if(u){var c=NM.apply(void 0,Ce(u));return function(h){return h===0?t:h===1?e:c(h)}}}}return NM(!1,!0,function(h){return h?e:t})}function t6(r,t,e){if(typeof r=="number"&&typeof t=="number")return r*(1-e)+t*e;if(typeof r=="boolean"&&typeof t=="boolean"||typeof r=="string"&&typeof t=="string")return e<.5?r:t;if(Array.isArray(r)&&Array.isArray(t)){for(var n=r.length,i=t.length,a=Math.max(n,i),s=[],o=0;o<a;o++)s.push(t6(r[o<n?o:n-1],t[o<i?o:i-1],e));return s}throw new Error("Mismatched interpolation arguments ".concat(r,":").concat(t))}var BY=function(){function r(){st(this,r),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=bY,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return at(r,[{key:"easing",get:function(){return this._easing},set:function(e){this.easingFunction=Wx(e),this._easing=e}}])}();function zY(r){var t=[];for(var e in r)if(!(e in["easing","offset","composite"])){var n=r[e];Array.isArray(n)||(n=[n]);for(var i=n.length,a=0;a<i;a++){if(!t[a]){var s={};"offset"in r&&(s.offset=Number(r.offset)),"easing"in r&&(s.easing=r.easing),"composite"in r&&(s.composite=r.composite),t[a]=s}n[a]!==void 0&&n[a]!==null&&(t[a][e]=n[a])}}return t.sort(function(o,l){return(o.computedOffset||0)-(l.computedOffset||0)}),t}function RM(r,t){if(r===null)return[];Array.isArray(r)||(r=zY(r));for(var e=r.map(function(l){var u={};t!=null&&t.composite&&(u.composite="auto");for(var c in l){var h=l[c];if(c==="offset"){if(h!==null){if(h=Number(h),!isFinite(h))throw new Error("Keyframe offsets must be numbers.");if(h<0||h>1)throw new Error("Keyframe offsets must be between 0 and 1.");u.computedOffset=h}}else if(c==="composite"&&["replace","add","accumulate","auto"].indexOf(h)===-1)throw new Error("".concat(h," compositing is not supported"));u[c]=h}return u.offset===void 0&&(u.offset=null),u.easing===void 0&&(u.easing=(t==null?void 0:t.easing)||"linear"),u.composite===void 0&&(u.composite="auto"),u}),n=!0,i=-1/0,a=0;a<e.length;a++){var s=e[a].offset;if(kt(s))n=!1;else{if(s<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=s}}e=e.filter(function(l){return Number(l.offset)>=0&&Number(l.offset)<=1});function o(){var l,u=e,c=u.length;if(e[c-1].computedOffset=Number((l=e[c-1].offset)!==null&&l!==void 0?l:1),c>1){var h;e[0].computedOffset=Number((h=e[0].offset)!==null&&h!==void 0?h:0)}for(var d=0,g=Number(e[0].computedOffset),p=1;p<c;p++){var v=e[p].computedOffset;if(!kt(v)&&!kt(g)){for(var m=1;m<p-d;m++)e[d+m].computedOffset=g+(Number(v)-g)*m/(p-d);d=p,g=Number(v)}}}return n||o(),e}var $Y="backwards|forwards|both|none".split("|"),jY="reverse|alternate|alternate-reverse".split("|");function qY(r,t){var e=new BY;return typeof r=="number"&&!isNaN(r)?e.duration=r:r!==void 0&&Object.keys(r).forEach(function(n){if(r[n]!==void 0&&r[n]!==null&&r[n]!=="auto"){if((typeof e[n]=="number"||n==="duration")&&(typeof r[n]!="number"||isNaN(r[n]))||n==="fill"&&$Y.indexOf(r[n])===-1||n==="direction"&&jY.indexOf(r[n])===-1)return;e[n]=r[n]}}),e}function WY(r,t){return r=GY(r??{duration:"auto"}),qY(r)}function GY(r){return typeof r=="number"&&(isNaN(r)?r={duration:"auto"}:r={duration:r}),r}var VY=function(){function r(t,e,n){var i=this;st(this,r),this.composite="replace",this.iterationComposite="replace",this.target=t,this.timing=WY(n),this.timing.effect=this,this.timing.activeDuration=MY(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=RM(e,this.timing),this.interpolations=LY(this.normalizedKeyframes,this.timing,this.target);var a=lt.globalThis.Proxy;this.computedTiming=a?new a(this.timing,{get:function(o,l){return l==="duration"?o.duration==="auto"?0:o.duration:l==="fill"?o.fill==="auto"?"none":o.fill:l==="localTime"?i.animation&&i.animation.currentTime||null:l==="currentIteration"?!i.animation||i.animation.playState!=="running"?null:o.currentIteration||0:l==="progress"?!i.animation||i.animation.playState!=="running"?null:o.progress||0:o[l]},set:function(){return!0}}):this.timing}return at(r,[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(e){return e===null?!1:(this.timeFraction=RY(this.timing.activeDuration,e,this.timing),this.timeFraction!==null)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(e){this.normalizedKeyframes=RM(e)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(e){var n=this;Object.keys(e||{}).forEach(function(i){n.timing[i]=e[i]})}}])}();function LM(r,t){return Number(r.id)-Number(t.id)}var HY=function(){function r(t){var e=this;st(this,r),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(n){e.currentTime=n,e.discardAnimations(),e.animations.length===0?e.timelineTicking=!1:e.requestAnimationFrame(e.webAnimationsNextTick)},this.processRafCallbacks=function(n){var i=e.rafCallbacks;e.rafCallbacks=[],n<Number(e.currentTime)&&(n=Number(e.currentTime)),e.animations.sort(LM),e.animations=e.tick(n,!0,e.animations)[0],i.forEach(function(a){a[1](n)}),e.applyPendingEffects()},this.document=t}return at(r,[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(e,n,i){var a=new VY(e,n,i),s=new lY(a,this);return this.animations.push(s),this.restartWebAnimationsNextTick(),s.updatePromises(),s.play(),s.updatePromises(),s}},{key:"applyDirtiedAnimation",value:function(e){var n=this;if(!this.inTick){e.markTarget();var i=e.targetAnimations();i.sort(LM);var a=this.tick(Number(this.currentTime),!1,i.slice())[1];a.forEach(function(s){var o=n.animations.indexOf(s);o!==-1&&n.animations.splice(o,1)}),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach(function(e){e==null||e.applyInterpolations()}),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(e){return e.updatePromises()})}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(e){return e.playState!=="finished"&&e.playState!=="idle"})}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(e){var n=this.rafId++;return this.rafCallbacks.length===0&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([n,e]),n}},{key:"requestAnimationFrame",value:function(e){var n=this;return this.rAF(function(i){n.updateAnimationsPromises(),e(i),n.updateAnimationsPromises()})}},{key:"tick",value:function(e,n,i){var a=this,s,o;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=e,this.ticking=!1;var l=[],u=[],c=[],h=[];return i.forEach(function(d){d.tick(e,n),d._inEffect?(u.push(d.effect),d.markTarget()):(l.push(d.effect),d.unmarkTarget()),d._needsTick&&(a.ticking=!0);var g=d._inEffect||d._needsTick;d._inTimeline=g,g?c.push(d):h.push(d)}),(s=this.pendingEffects).push.apply(s,l),(o=this.pendingEffects).push.apply(o,u),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[c,h]}}])}();lt.EasingFunction=Wx;lt.AnimationTimeline=HY;const UY={duration:500},YY={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var De;(function(r){r.NodeAdded="NodeAdded",r.NodeUpdated="NodeUpdated",r.NodeRemoved="NodeRemoved",r.EdgeAdded="EdgeAdded",r.EdgeUpdated="EdgeUpdated",r.EdgeRemoved="EdgeRemoved",r.ComboAdded="ComboAdded",r.ComboUpdated="ComboUpdated",r.ComboRemoved="ComboRemoved"})(De||(De={}));var yr;(function(r){r.DRAW="draw",r.COLLAPSE="collapse",r.EXPAND="expand",r.TRANSFORM="transform"})(yr||(yr={}));var qa;(function(r){r.CLICK="canvas:click",r.DBLCLICK="canvas:dblclick",r.POINTER_OVER="canvas:pointerover",r.POINTER_LEAVE="canvas:pointerleave",r.POINTER_ENTER="canvas:pointerenter",r.POINTER_MOVE="canvas:pointermove",r.POINTER_OUT="canvas:pointerout",r.POINTER_DOWN="canvas:pointerdown",r.POINTER_UP="canvas:pointerup",r.CONTEXT_MENU="canvas:contextmenu",r.DRAG_START="canvas:dragstart",r.DRAG="canvas:drag",r.DRAG_END="canvas:dragend",r.DRAG_ENTER="canvas:dragenter",r.DRAG_OVER="canvas:dragover",r.DRAG_LEAVE="canvas:dragleave",r.DROP="canvas:drop",r.WHEEL="canvas:wheel"})(qa||(qa={}));var xo;(function(r){r.CLICK="combo:click",r.DBLCLICK="combo:dblclick",r.POINTER_OVER="combo:pointerover",r.POINTER_LEAVE="combo:pointerleave",r.POINTER_ENTER="combo:pointerenter",r.POINTER_MOVE="combo:pointermove",r.POINTER_OUT="combo:pointerout",r.POINTER_DOWN="combo:pointerdown",r.POINTER_UP="combo:pointerup",r.CONTEXT_MENU="combo:contextmenu",r.DRAG_START="combo:dragstart",r.DRAG="combo:drag",r.DRAG_END="combo:dragend",r.DRAG_ENTER="combo:dragenter",r.DRAG_OVER="combo:dragover",r.DRAG_LEAVE="combo:dragleave",r.DROP="combo:drop"})(xo||(xo={}));var J;(function(r){r.CLICK="click",r.DBLCLICK="dblclick",r.POINTER_OVER="pointerover",r.POINTER_LEAVE="pointerleave",r.POINTER_ENTER="pointerenter",r.POINTER_MOVE="pointermove",r.POINTER_OUT="pointerout",r.POINTER_DOWN="pointerdown",r.POINTER_UP="pointerup",r.CONTEXT_MENU="contextmenu",r.DRAG_START="dragstart",r.DRAG="drag",r.DRAG_END="dragend",r.DRAG_ENTER="dragenter",r.DRAG_OVER="dragover",r.DRAG_LEAVE="dragleave",r.DROP="drop",r.KEY_DOWN="keydown",r.KEY_UP="keyup",r.WHEEL="wheel",r.PINCH="pinch"})(J||(J={}));var Nl;(function(r){r.KEY_DOWN="keydown",r.KEY_UP="keyup"})(Nl||(Nl={}));var Of;(function(r){r.CLICK="edge:click",r.DBLCLICK="edge:dblclick",r.POINTER_OVER="edge:pointerover",r.POINTER_LEAVE="edge:pointerleave",r.POINTER_ENTER="edge:pointerenter",r.POINTER_MOVE="edge:pointermove",r.POINTER_OUT="edge:pointerout",r.POINTER_DOWN="edge:pointerdown",r.POINTER_UP="edge:pointerup",r.CONTEXT_MENU="edge:contextmenu",r.DRAG_ENTER="edge:dragenter",r.DRAG_OVER="edge:dragover",r.DRAG_LEAVE="edge:dragleave",r.DROP="edge:drop"})(Of||(Of={}));var dt;(function(r){r.BEFORE_CANVAS_INIT="beforecanvasinit",r.AFTER_CANVAS_INIT="aftercanvasinit",r.BEFORE_SIZE_CHANGE="beforesizechange",r.AFTER_SIZE_CHANGE="aftersizechange",r.BEFORE_ELEMENT_CREATE="beforeelementcreate",r.AFTER_ELEMENT_CREATE="afterelementcreate",r.BEFORE_ELEMENT_UPDATE="beforeelementupdate",r.AFTER_ELEMENT_UPDATE="afterelementupdate",r.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",r.AFTER_ELEMENT_DESTROY="afterelementdestroy",r.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",r.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",r.BEFORE_DRAW="beforedraw",r.AFTER_DRAW="afterdraw",r.BEFORE_RENDER="beforerender",r.AFTER_RENDER="afterrender",r.BEFORE_ANIMATE="beforeanimate",r.AFTER_ANIMATE="afteranimate",r.BEFORE_LAYOUT="beforelayout",r.AFTER_LAYOUT="afterlayout",r.BEFORE_STAGE_LAYOUT="beforestagelayout",r.AFTER_STAGE_LAYOUT="afterstagelayout",r.BEFORE_TRANSFORM="beforetransform",r.AFTER_TRANSFORM="aftertransform",r.BATCH_START="batchstart",r.BATCH_END="batchend",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.BEFORE_RENDERER_CHANGE="beforerendererchange",r.AFTER_RENDERER_CHANGE="afterrendererchange"})(dt||(dt={}));var bs;(function(r){r.UNDO="undo",r.REDO="redo",r.CANCEL="cancel",r.ADD="add",r.CLEAR="clear",r.CHANGE="change"})(bs||(bs={}));var fi;(function(r){r.CLICK="node:click",r.DBLCLICK="node:dblclick",r.POINTER_OVER="node:pointerover",r.POINTER_LEAVE="node:pointerleave",r.POINTER_ENTER="node:pointerenter",r.POINTER_MOVE="node:pointermove",r.POINTER_OUT="node:pointerout",r.POINTER_DOWN="node:pointerdown",r.POINTER_UP="node:pointerup",r.CONTEXT_MENU="node:contextmenu",r.DRAG_START="node:dragstart",r.DRAG="node:drag",r.DRAG_END="node:dragend",r.DRAG_ENTER="node:dragenter",r.DRAG_OVER="node:dragover",r.DRAG_LEAVE="node:dragleave",r.DROP="node:drop"})(fi||(fi={}));const we="combo",$r="tree";var La;(function(r){r.NODE="node",r.EDGE="edge",r.COMBO="combo",r.THEME="theme",r.PALETTE="palette",r.LAYOUT="layout",r.BEHAVIOR="behavior",r.PLUGIN="plugin",r.ANIMATION="animation",r.TRANSFORM="transform",r.SHAPE="shape"})(La||(La={}));const Lw={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function Wa(r,t){var e;const n=(e=Lw[r])===null||e===void 0?void 0:e[t];if(n)return n}const XY="5.0.43",KY="G6";function Ia(r){return`[${KY} v${XY}] ${r}`}const la={mute:!1,debug:r=>{console.debug(Ia(r))},info:r=>{console.info(Ia(r))},warn:r=>{console.warn(Ia(r))},error:r=>{console.error(Ia(r))}};function e6(r){const{theme:t}=r;if(!t)return{};const e=Wa(La.THEME,t);return e||(la.warn(`The theme of ${t} is not registered.`),{})}function Vx(r,t){if(Array.isArray(r)&&r.length===0)return null;const e=Array.isArray(r)?r[0]:r,n=Array.isArray(r)?r.slice(1):t||[];return new Proxy(e,{get(i,a){return typeof i[a]=="function"&&!["onframe","onfinish"].includes(a)?(...s)=>{i[a](...s),n.forEach(o=>{var l;return(l=o[a])===null||l===void 0?void 0:l.call(o,...s)})}:a==="finished"?Promise.all([e.finished,...n.map(s=>s.finished)]):Reflect.get(i,a)},set(i,a,s){return["onframe","onfinish"].includes(a)||n.forEach(o=>{o[a]=s}),Reflect.set(i,a,s)}})}function Iw(r){const t=r.reduce((n,i)=>(Object.entries(i).forEach(([a,s])=>{n[a]===void 0?n[a]=[s]:n[a].push(s)}),n),{});Object.entries(t).forEach(([n,i])=>{(i.length!==r.length||i.some(a=>kt(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Ze(a,i[0])))&&delete t[n]});const e=Object.entries(t).reduce((n,[i,a])=>(a.forEach((s,o)=>{n[o]?n[o][i]=s:n[o]={[i]:s}}),n),[]);return r.length!==0&&e.length===0&&e.push({_:0},{_:0}),e}function pc(r){switch(r){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function n6(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},UY);return un(e)&&Object.assign(n,e),un(t)&&Object.assign(n,t),n}function ZY(r){if(typeof r=="string"){const t=Wa(La.ANIMATION,r);return t||(la.warn(`The animation of ${r} is not registered.`),[])}return r}function JY(r,t,e,n){var i,a;const{animation:s}=r;if(s===!1||n===!1)return[];const o=(i=r==null?void 0:r[t])===null||i===void 0?void 0:i.animation;if(o===!1)return[];const l=o==null?void 0:o[e];if(l===!1)return[];const u=(a=e6(r)[t])===null||a===void 0?void 0:a.animation,c=(d=[])=>ZY(d).map(g=>Object.assign(Object.assign(Object.assign(Object.assign({},YY),un(s)&&s),g),un(n)&&n));if(l)return c(l);if(!u)return[];const h=u[e];return h===!1?[]:c(h)}function r6(r,t,e,n=[]){if(!n&&r===0&&t===0&&e===0)return null;if(Array.isArray(n)){let a=-1;const s=[];for(let o=0;o<n.length;o++){const l=n[o];if(l[0]==="translate"){if(l[1]===r&&l[2]===t)return null;a=o,s.push(["translate",r,t])}else if(l[0]==="translate3d"){if(l[1]===r&&l[2]===t&&l[3]===e)return null;a=o,s.push(["translate3d",r,t,e??0])}else s.push(l)}return a===-1&&s.splice(0,0,yt(e)?["translate3d",r,t,e??0]:["translate",r,t]),s.length===0?null:s}const i=n?n.replace(/translate(3d)?\([^)]*\)/g,""):"";return e===0?`translate(${r}, ${t})${i}`:`translate3d(${r}, ${t}, ${e})${i}`}var QY=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};const tX=(r,t,e)=>{if(!e.length)return null;const[n,i]=t,a=u=>{var c;if(u){const h=r.getShape(u);if(!h)return null;const d=`get${mf(u)}Style`,g=((c=r==null?void 0:r[d])===null||c===void 0?void 0:c.bind(r))||(m=>m),p=(g==null?void 0:g(n))||{},v=(g==null?void 0:g(i))||{};return{shape:h,fromStyle:p,toStyle:v}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(u=>{var{fields:c,shape:h,states:d}=u,g=QY(u,["fields","shape","states"]);const p=a(h);if(!p)return null;const{shape:v,fromStyle:m,toStyle:b}=p,w=[{},{}];if(c.forEach(S=>{var _,k;Object.assign(w[0],{[S]:(_=m[S])!==null&&_!==void 0?_:pc(S)}),Object.assign(w[1],{[S]:(k=b[S])!==null&&k!==void 0?k:pc(S)})}),w.some(S=>Object.keys(S).some(_=>["x","y","z"].includes(_)))){const{x:S=0,y:_=0,z:k,transform:M=""}=v.attributes||{};w.forEach(C=>{var P,T,A;C.transform=r6((P=C.x)!==null&&P!==void 0?P:S,(T=C.y)!==null&&T!==void 0?T:_,(A=C.z)!==null&&A!==void 0?A:k,M)})}const x=v.animate(Iw(w),g);return h===void 0&&(s=x),x}).filter(Boolean),l=s||(o==null?void 0:o[0]);return l?Vx(l,o.filter(u=>u!==u)):null},eX=[{fields:["opacity"]}],nX=[{fields:["x","y"]}],i6=[{fields:["x","y"]}],rX=i6,a6=[{fields:["sourceNode","targetNode"]}],iX=a6,s6=[{fields:["childrenNode","x","y"]}],aX=s6;function sX(r){return"source"in r&&"target"in r}function oX(r){return r.length===2}function Yl(r){return r instanceof Float32Array?!0:Array.isArray(r)&&(r.length===2||r.length===3)?r.every(t=>typeof t=="number"):!1}function oa(r,t,e){return r>=t&&r<=e}function ua(r=0){if(Array.isArray(r)){const[t=0,e=t,n=t,i=e]=r;return[t,e,n,i]}return[r,r,r,r]}function lX(r=0){const t=ua(r);return t[0]+t[2]}function ca(r){return r.max[0]-r.min[0]}function ha(r){return r.max[1]-r.min[1]}function Xs(r){return[ca(r),ha(r)]}function Ms(r,t){const e=Yl(r)?Hx(r):r.getShape("key").getBounds();return t?Ks(e,t):e}function Hx(r){const[t,e,n=0]=r,i=new Me;return i.setMinMax([t,e,n],[t,e,n]),i}function Ks(r,t){const[e,n,i,a]=ua(t),[s,o,l]=r.min,[u,c,h]=r.max,d=new Me;return d.setMinMax([s-a,o-e,l],[u+n,c+i,h]),d}function Dc(r){if(r.length===0)return new Me;if(r.length===1)return r[0];const t=new Me;t.setMinMax(r[0].min,r[0].max);for(let e=1;e<r.length;e++){const n=r[e];t.setMinMax([Math.min(t.min[0],n.min[0]),Math.min(t.min[1],n.min[1]),Math.min(t.min[2],n.min[2])],[Math.max(t.max[0],n.max[0]),Math.max(t.max[1],n.max[1]),Math.max(t.max[2],n.max[2])])}return t}function uX(r,t){const[e,n]=r.min,[i,a]=r.max,[s,o]=t.min,[l,u]=t.max;return e>=s&&i<=l&&n>=o&&a<=u}function Di(r,t){return oa(r[0],t.min[0],t.max[0])&&oa(r[1],t.min[1],t.max[1])}function o6(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||oa(r[0],n,a)),l=(r[0]===n||r[0]===a)&&(e||oa(r[1],i,s));return o||l}function cX(r,t){return!Di(r,t)}function Af(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function ac(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,l=e-i,u=s-e,c=n-a,h=o-n,d=Math.min(l,u,c,h);return d===l?"left":d===u?"right":d===c?"top":d===h?"bottom":"left"}function To(r,t){const e=$s(r);if(Di(r,t))switch(ac(r,t)){case"left":e[0]=t.min[0];break;case"right":e[0]=t.max[0];break;case"top":e[1]=t.min[1];break;case"bottom":e[1]=t.max[1];break}else{const[n,i]=r,[a,s]=t.min,[o,l]=t.max;e[0]=oa(n,a,o)?n:n<a?a:o,e[1]=oa(i,s,l)?i:i<s?s:l}return e}function hX(r,t){const{center:e}=r,[n,i]=Xs(r),a=t==="up"||t==="down"?e[0]:t==="right"?e[0]-n/6:e[0]+n/6,s=t==="left"||t==="right"?e[1]:t==="down"?e[1]-i/6:e[1]+i/6;return[a,s]}function dX(r,t){let[e,n]=Xs(r);return[e,n]=t==="up"||t==="down"?[e,n]:[n,e],(Math.pow(n,2)-Math.pow(Math.sqrt(Math.pow(e/2,2)+Math.pow(n,2))-e/2,2))/(2*n)}function fX(r){const{min:[t,e],max:[n,i]}=r,a=[t,i],s=[n,i],o=[n,e],l=[t,e];return[[a,s],[s,o],[o,l],[l,a]]}var gX=function(t,e){return t===e},IM=function(){function r(t,e){e===void 0&&(e=null),this.value=t,this.next=e}return r.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},r}(),pX=function(){function r(t){t===void 0&&(t=gX),this.head=null,this.tail=null,this.compare=t}return r.prototype.prepend=function(t){var e=new IM(t,this.head);return this.head=e,this.tail||(this.tail=e),this},r.prototype.append=function(t){var e=new IM(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},r.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},r.prototype.find=function(t){var e=t.value,n=e===void 0?void 0:e,i=t.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var s=this.head;s;){if(a&&a(s.value)||n!==void 0&&this.compare(s.value,n))return s;s=s.next}return null},r.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},r.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},r.prototype.fromArray=function(t){var e=this;return t.forEach(function(n){return e.append(n)}),this},r.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},r.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},r.prototype.toString=function(t){return t===void 0&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},r}(),vX=function(t,e,n){e===void 0&&(e=[]);var i=e.filter(function(l){return l.source===t||l.target===t});if(n==="target"){var a=function(u){return u.source===t};return i.filter(a).map(function(l){return l.target})}if(n==="source"){var s=function(u){return u.target===t};return i.filter(s).map(function(l){return l.source})}var o=function(u){return u.source===t?u.target:u.source};return i.map(o)},mX=function(t,e){return e.filter(function(n){return n.source===t})},yX=function(t,e){return e.filter(function(n){return n.source===t||n.target===t})},bX=function(t){var e={},n=t.nodes,i=n===void 0?[]:n,a=t.edges,s=a===void 0?[]:a;return i.forEach(function(o){e[o.id]={degree:0,inDegree:0,outDegree:0}}),s.forEach(function(o){e[o.source].degree++,e[o.source].outDegree++,e[o.target].degree++,e[o.target].inDegree++}),e},wX={}.toString,Ux=function(r,t){return wX.call(r)==="[object "+t+"]"};const l6=function(r){return Ux(r,"Function")},u6=function(r){return Array.isArray?Array.isArray(r):Ux(r,"Array")},xX=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function EX(r,t){if(r){var e;if(u6(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(xX(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}const _X=function(r){return Ux(r,"String")};var SX=Object.values?function(r){return Object.values(r)}:function(r){var t=[];return EX(r,function(e,n){l6(r)&&n==="prototype"||t.push(e)}),t};const MX=function(r,t){if(!l6(r))throw new TypeError("Expected a function");var e=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=t?t.apply(this,n):n[0],s=e.cache;if(s.has(a))return s.get(a);var o=r.apply(this,n);return s.set(a,o),o};return e.cache=new Map,e};var pd;MX(function(r,t){t===void 0&&(t={});var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return pd||(pd=document.createElement("canvas").getContext("2d")),pd.font=[a,s,i,e+"px",n].join(" "),pd.measureText(_X(r)?r:"").width},function(r,t){return t===void 0&&(t={}),$W([r],SX(t)).join("")});var kX=function(t,e,n){for(var i=1/0,a,s=0;s<e.length;s++){var o=e[s].id;!n[o]&&t[o]<=i&&(i=t[o],a=e[s])}return a},CX=function(t,e,n,i){var a=t.nodes,s=a===void 0?[]:a,o=t.edges,l=o===void 0?[]:o,u={},c={},h={};s.forEach(function(w,x){var S=w.id;c[S]=1/0,S===e&&(c[S]=0)});for(var d=s.length,g=function(x){var S=kX(c,s,u),_=S.id;if(u[_]=!0,c[_]===1/0)return"continue";var k=[];n?k=mX(_,l):k=yX(_,l),k.forEach(function(M){var C=M.target,P=M.source,T=C===_?P:C,A=i&&M[i]?M[i]:1;c[T]>c[S.id]+A?(c[T]=c[S.id]+A,h[T]=[S.id]):c[T]===c[S.id]+A&&h[T].push(S.id)})},p=0;p<d;p++)g();h[e]=[e];var v={};for(var m in c)c[m]!==1/0&&c6(e,m,h,v);var b={};for(var m in v)b[m]=v[m][0];return{length:c,path:b,allPath:v}};function c6(r,t,e,n){if(r===t)return[r];if(n[t])return n[t];for(var i=[],a=0,s=e[t];a<s.length;a++){var o=s[a],l=c6(r,o,e,n);if(!l)return;for(var u=0,c=l;u<c.length;u++){var h=c[u];u6(h)?i.push(vt(vt([],h,!0),[t],!1)):i.push([h,t])}}return n[t]=i,n[t]}var h6=function(t,e,n,i,a){var s=CX(t,e,i,a),o=s.length,l=s.path,u=s.allPath;return{length:o[n],path:l[n],allPath:u[n]}},DM;(function(r){r.EuclideanDistance="euclideanDistance"})(DM||(DM={}));var TX=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,s=1e3,o=t.nodes,l=o===void 0?[]:o,u=t.edges,c=u===void 0?[]:u,h=l.length,d,g={},p={},v=0;v<h;++v){var m=l[v],b=m.id;g[b]=1/h,p[b]=1/h}for(var w=bX(t);s>0&&i>e;){a=0;for(var v=0;v<h;++v){var m=l[v],b=m.id;if(d=0,w[m.id].inDegree===0)g[b]=0;else{for(var x=vX(b,c,"source"),S=0;S<x.length;++S){var _=x[S],k=w[_].outDegree;k>0&&(d+=p[_]/k)}g[b]=n*d,a+=g[b]}}a=(1-a)/h,i=0;for(var v=0;v<h;++v){var m=l[v],b=m.id;d=g[b]+a,i+=Math.abs(d-p[b]),p[b]=d}s-=1}return p};(function(){function r(t){t===void 0&&(t=10),this.linkedList=new pX,this.maxStep=t}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r})();function H(r){if(r.id!==void 0)return r.id;if(r.source!==void 0&&r.target!==void 0)return`${r.source}-${r.target}`;throw new Error(Ia("The datum does not have available id."))}function vd(r){return r.combo}function d6(r,t){const e={nodes:(r.nodes||[]).map(H),edges:(r.edges||[]).map(H),combos:(r.combos||[]).map(H)};return t?Object.values(e).flat():e}const f6=(r,t,e)=>{var n;switch(e.type){case"degree":{const i=new Map;return(n=r.nodes)===null||n===void 0||n.forEach(a=>{const s=t(H(a),e.direction).length;i.set(H(a),s)}),i}case"betweenness":return OX(r,e.directed,e.weightPropertyName);case"closeness":return AX(r,e.directed,e.weightPropertyName);case"eigenvector":return NX(r,e.directed);case"pagerank":return PX(r,e.epsilon,e.linkProb);default:return g6(r)}},g6=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(H(n),0)}),e},OX=(r,t,e)=>{const n=g6(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=h6(r,H(a),H(s),t,e),l=o.length;o.flat().forEach(u=>{u!==H(a)&&u!==H(s)&&n.set(u,n.get(u)+1/l)})}})}),n},AX=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,l)=>{if(a!==l){const{length:u}=h6(r,H(a),H(l),t,e);o+=u}return o},0);n.set(H(a),1/s)}),n},PX=(r,t,e)=>{var n;const i=new Map,a=TX(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(H(s),a[H(s)])}),i},NX=(r,t)=>{const{nodes:e=[]}=r,n=RX(r,t),i=LX(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(H(s),i[o])}),a},RX=(r,t)=>{const{nodes:e=[],edges:n=[]}=r,i=Array(e.length).fill(null).map(()=>Array(e.length).fill(0));return n.forEach(({source:a,target:s})=>{const o=e.findIndex(u=>H(u)===a),l=e.findIndex(u=>H(u)===s);t?i[o][l]=1:(i[o][l]=1,i[l][o]=1)}),i},LX=(r,t,e=100,n=1e-6)=>{let i=Array(t).fill(1),a=1/0;for(let s=0;s<e&&a>n;s++){const o=Array(t).fill(0);for(let u=0;u<t;u++)for(let c=0;c<t;c++)o[u]+=r[u][c]*i[c];const l=Math.sqrt(o.reduce((u,c)=>u+c*c,0));for(let u=0;u<t;u++)o[u]/=l;a=Math.sqrt(o.reduce((u,c,h)=>u+(c-i[h])*c,0)),i=o}return i};function Ls(r,t,e,n=Ze){const i=new Map(r.map(d=>[e(d),d])),a=new Map(t.map(d=>[e(d),d])),s=new Set(i.keys()),o=new Set(a.keys()),l=[],u=[],c=[],h=[];return o.forEach(d=>{s.has(d)?n(i.get(d),a.get(d))?h.push(a.get(d)):u.push(a.get(d)):l.push(a.get(d))}),s.forEach(d=>{o.has(d)||c.push(i.get(d))}),{enter:l,exit:c,keep:h,update:u}}function Bo(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function IX(r,t,e){const n={},i=a=>(a in n||(n[a]=0),`${t}-${a}-${n[a]++}`);return e.map(a=>typeof a=="string"?{type:a,key:i(a)}:typeof a=="function"?a.call(r):a.key?a:Object.assign(Object.assign({},a),{key:i(a.type)}))}class Yx{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=IX(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=Ls(this.extensions,e,o=>o.key);this.createExtensions(n),this.updateExtensions([...i,...s]),this.destroyExtensions(a),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:i}=t,a=Wa(e,i);if(!a)return la.warn(`The extension ${i} of ${e} is not registered.`);const s=new a(this.context,t);this.extensionMap[n]=s}createExtensions(t){t.forEach(e=>this.createExtension(e))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach(e=>this.updateExtension(e))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach(({key:e})=>this.destroyExtension(e))}destroy(){Object.values(this.extensionMap).forEach(t=>t.destroy()),this.context={},this.extensions=[],this.extensionMap={}}}class Xx{constructor(t,e){this.events=[],this.destroyed=!1,this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class Cr extends Xx{}class d0 extends Cr{constructor(t,e){super(t,Object.assign({},d0.defaultOptions,e)),this.isOverlapping=(n,i)=>i.some(a=>n.intersects(a)),this.occupiedBounds=[],this.detectLabelCollision=n=>{const i=this.context.viewport,a={show:[],hide:[]};return this.occupiedBounds=[],n.forEach(s=>{const o=s.getShape("label").getRenderBounds();i.isInViewport(o,!0)&&!this.isOverlapping(o,this.occupiedBounds)?(a.show.push(s),this.occupiedBounds.push(Ks(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=Ls(n,i,s=>s.id);a==null||a.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(n,i)=>{const{model:a}=this.context,s=a.getData(),o=a.getRelatedEdgesData.bind(a);return n.map(u=>(this.nodeCentralities.has(u.id)||(this.nodeCentralities=f6(s,o,i)),{node:u,centrality:this.nodeCentralities.get(u.id)})).sort((u,c)=>c.centrality-u.centrality).map(u=>u.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:l}=this.context;if(Et(i))return n.sort((v,m)=>i(l.getElementDataById(v.id),l.getElementDataById(m.id)));const{node:u=[],edge:c=[],combo:h=[]}=s0(n,v=>v.type),d=Et(s)?h.sort((v,m)=>s(...l.getComboData([v.id,m.id]))):h,g=Et(a)?u.sort((v,m)=>a(...l.getNodeData([v.id,m.id]))):this.sortNodesByCentrality(u,a),p=Et(o)?c.sort((v,m)=>o(...l.getEdgeData([v.id,m.id]))):c;return[...d,...g,...p]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=n=>{var i;if(((i=n.data)===null||i===void 0?void 0:i.stage)==="zIndex")return;if(!this.validate(n)){this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear());return}const a=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,a),this.labelElementsInView=a;const s=this.sortLabelElementsInView(this.labelElementsInView),{show:o,hide:l}=this.detectLabelCollision(s);for(let u=o.length-1;u>=0;u--)this.showLabel(o[u]);l.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Bo(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Bo(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=tL(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=n=>{this.enableToggle&&this.onToggleVisibility(n)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=n=>{this.onToggleVisibility(n),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const i=t[n];i.isVisible()&&i.getShape("label")&&e.push(i)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:t}=this.context;t.on(dt.BEFORE_RENDER,this.onBeforeRender),t.on(dt.AFTER_RENDER,this.onAfterRender),t.on(dt.AFTER_DRAW,this.toggle),t.on(dt.AFTER_LAYOUT,this.toggle),t.on(dt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(dt.BEFORE_RENDER,this.onBeforeRender),t.off(dt.AFTER_RENDER,this.onAfterRender),t.off(dt.AFTER_DRAW,this.toggle),t.off(dt.AFTER_LAYOUT,this.toggle),t.off(dt.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}d0.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const FM=[0,0,0];function It(r,t){return r.map((e,n)=>e+t[n])}function be(r,t){return r.map((e,n)=>e-t[n])}function Oa(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function Fi(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function DX(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function FX(r,t){const e=vc(r),n=vc(t);return[e[1]*n[2]-e[2]*n[1],e[2]*n[0]-e[0]*n[2],e[0]*n[1]-e[1]*n[0]]}function ks(r,t){return r.map(e=>e*t)}function Ne(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function Pf(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function $a(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function Kx(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Oa(r,t).reduce((a,s)=>a+s,0)/(Ne(r,FM)*Ne(t,FM)));return e&&n<0&&(i=2*Math.PI-i),i}function f0(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function BX(r,t){return r.map(e=>e%t)}function zo(r){return[r[0],r[1]]}function vc(r){return oX(r)?[r[0],r[1],0]:r}function p6(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function v6(r,t){const[e,n]=r,[i,a]=t,s=be(e,n),o=be(i,a);return FX(s,o).every(l=>l===0)}function Zx(r,t,e=!1){if(v6(r,t))return;const[n,i]=r,[a,s]=t,o=((n[0]-a[0])*(a[1]-s[1])-(n[1]-a[1])*(a[0]-s[0]))/((n[0]-i[0])*(a[1]-s[1])-(n[1]-i[1])*(a[0]-s[0])),l=s[0]-a[0]?(n[0]-a[0]+o*(i[0]-n[0]))/(s[0]-a[0]):(n[1]-a[1]+o*(i[1]-n[1]))/(s[1]-a[1]);if(!(!e&&(!oa(o,0,1)||!oa(l,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function m6(r){if(Array.isArray(r))return oa(r[0],0,1)&&oa(r[1],0,1)?r:[.5,.5];const t=r.split("-"),e=t.includes("left")?0:t.includes("right")?1:.5,n=t.includes("top")?0:t.includes("bottom")?1:.5;return[e,n]}function cn(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function zX(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function $X(r,t){const[e,n]=t,{min:i,max:a}=r;return[i[0]+e*(a[0]-i[0]),i[1]+n*(a[1]-i[1])]}function Aa(r,t="center"){const e=m6(t);return $X(r,e)}function jn(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function Ri(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function Pu(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function Is(r,t,e,n=!1){if(Ze(r,t))return r;const i=n?be(r,t):be(t,r),a=$a(i),s=[a[0]*e,a[1]*e];return It(zo(r),s)}function y6(r,t){return r[1]===t[1]}function jX(r,t){return r[0]===t[0]}function qX(r,t){return y6(r,t)||jX(r,t)}function b6(r,t,e){return v6([r,t],[t,e])}function w6(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function x6(r,t,e,n=!0,i=!1){for(let a=0;a<e.length;a++){let s=e[a],o=e[(a+1)%e.length];n&&(s=It(t,s),o=It(t,o));const l=i?w6(r,t):r,u=Zx([t,l],[s,o]);if(u)return{point:u,line:[s,o]}}return{point:t,line:void 0}}function WX(r,t,e,n){const i=r[0],a=r[1];let s=!1;e===void 0&&(e=0),n===void 0&&(n=t.length);const o=n-e;for(let l=0,u=o-1;l<o;u=l++){const c=t[l+e][0],h=t[l+e][1],d=t[u+e][0],g=t[u+e][1];h>a!=g>a&&i<(d-c)*(a-h)/(g-h)+c&&(s=!s)}return s}function GX(r,t,e=!1){const n=Aa(t,"center"),i=[Aa(t,"left-top"),Aa(t,"right-top"),Aa(t,"right-bottom"),Aa(t,"left-bottom")];return x6(r,n,i,!1,e).point}function g0(r,t,e=!1){const n=t.center,i=e?w6(r,n):r,a=be(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=ca(t)/2,l=ha(t)/2,u=n[0]+o*Math.cos(s),c=n[1]+l*Math.sin(s);return[u,c]}function VX(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=Ne(i,a);s<e&&(e=s,n=[i,a])})}),n}function HX(r,t){let e=1/0,n=[[0,0],[0,0]];return t.forEach(i=>{const a=UX(r,i);a<e&&(e=a,n=i)}),n}function UX(r,t){const e=E6(r,t);return Ne(r,e)}function E6(r,t){const[e,n]=t[0],[i,a]=t[1],[s,o]=r,l=i-e,u=a-n;if(l===0&&u===0)return[e,n];let c=((s-e)*l+(o-n)*u)/(l*l+u*u);c>1?c=1:c<0&&(c=0);const h=e+c*l,d=n+c*u;return[h,d]}function YX(r){const t=r.reduce((e,n)=>It(e,n),[0,0]);return Fi(t,r.length)}function Jx(r,t=!0){const e=YX(r);return r.sort(([n,i],[a,s])=>{const o=Math.atan2(i-e[1],n-e[0]),l=Math.atan2(s-e[1],a-e[0]);return t?l-o:o-l})}function BM(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class XX{constructor(t,e){this.callback=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents()}bindEvents(){const{emitter:t}=this;t.on(J.POINTER_DOWN,this.onPointerDown),t.on(J.POINTER_MOVE,this.onPointerMove),t.on(J.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const i=this.pointerByTouch.findIndex(a=>a.pointerId===t);i>=0&&(this.pointerByTouch[i]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client;if(!(e===void 0||n===void 0)&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),t.pointerType==="touch"&&this.pointerByTouch.length===2)){const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(i*i+a*a)}}onPointerMove(t){if(this.pointerByTouch.length!==2||this.initialDistance===null)return;const{x:e,y:n}=t.client;if(e===void 0||n===void 0)return;this.updatePointerPosition(t.pointerId,e,n);const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(i*i+a*a)/this.initialDistance;this.callback(t,{scale:(o-1)*5})}onPointerUp(){this.initialDistance=null,this.pointerByTouch=[]}destroy(){this.emitter.off(J.POINTER_DOWN,this.onPointerDown),this.emitter.off(J.POINTER_MOVE,this.onPointerMove),this.emitter.off(J.POINTER_UP,this.onPointerUp)}}const zM=r=>r.map(t=>se(t)?t.toLocaleLowerCase():t);class Jl{constructor(t){this.map=new Map,this.recordKey=new Set,this.onKeyDown=e=>{e!=null&&e.key&&(this.recordKey.add(e.key),this.trigger(e))},this.onKeyUp=e=>{e!=null&&e.key&&this.recordKey.delete(e.key)},this.onWheel=e=>{this.triggerExtendKey(J.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(J.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(J.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=t,this.bindEvents()}bind(t,e){t.length!==0&&(t.includes(J.PINCH)&&!this.pinchHandler&&(this.pinchHandler=new XX(this.emitter,this.handlePinch.bind(this))),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{Ze(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=zM(Array.from(this.recordKey)).sort(),n=zM(t).sort();return Ze(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(J.KEY_DOWN,this.onKeyDown),e.on(J.KEY_UP,this.onKeyUp),e.on(J.WHEEL,this.onWheel),e.on(J.DRAG,this.onDrag),(t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,i)=>{i.includes(t)&&Ze(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(J.KEY_DOWN,this.onKeyDown),this.emitter.off(J.KEY_UP,this.onKeyUp),this.emitter.off(J.WHEEL,this.onWheel),this.emitter.off(J.DRAG,this.onDrag),(t=this.pinchHandler)===null||t===void 0||t.destroy(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"blur",this.onFocus)}}class Fc extends Cr{constructor(t,e){super(t,cr({},Fc.defaultOptions,e)),this.shortcut=new Jl(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,i=Object.assign({},this.options.style);this.options.style.lineWidth&&(i.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new Nn({id:"g6-brush-select",style:i}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:i}=this.options;this.endPoint=Nf(t),(e=this.rectShape)===null||e===void 0||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&i==="default"&&this.updateElementsStates(BM(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=Nf(t),this.updateElementsStates(BM(this.startPoint,this.endPoint)),this.clearBrush()}}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((n,i)=>Object.assign({},n,i.reduce((a,s)=>(a[H(s)]=[],a),{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:i,mode:a,onSelect:s}=this.options,o=this.selector(e,t,n);let l={};switch(a){case"union":o.forEach(u=>{l[u]=[...e.getElementState(u),i]});break;case"diff":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?c.filter(h=>h!==i):[...c,i]});break;case"intersect":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?[i]:[]});break;case"default":default:o.forEach(u=>{l[u]=[i]});break}Et(s)&&(l=s(l)),e.setElementState(l,this.options.animation)}selector(t,e,n){if(!n||n.length===0)return[];const i=[],a=t.getData();if(n.forEach(s=>{a[`${s}s`].forEach(o=>{const l=H(o);t.getElementVisibility(l)!=="hidden"&&WX(t.getElementPosition(l),e)&&i.push(l)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:l,target:u}=o;i.includes(l)&&i.includes(u)&&i.push(H(o))})}return i}clearBrush(){var t;(t=this.rectShape)===null||t===void 0||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(n=>n!=="drag"))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(J.POINTER_DOWN,this.onPointerDown),t.on(J.POINTER_MOVE,this.onPointerMove),t.on(J.POINTER_UP,this.onPointerUp),t.on(qa.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(J.POINTER_DOWN,this.onPointerDown),t.off(J.POINTER_MOVE,this.onPointerMove),t.off(J.POINTER_UP,this.onPointerUp),t.off(qa.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=cr(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Fc.defaultOptions={animation:!1,enable:!0,enableElements:["node","combo","edge"],immediately:!1,mode:"default",state:"selected",trigger:["shift"],style:{width:0,height:0,lineWidth:1,fill:"#1677FF",stroke:"#1677FF",fillOpacity:.1,zIndex:2,pointerEvents:"none"}};const Nf=r=>[r.canvas.x,r.canvas.y],Ga=.8,$o=["node","edge","combo"];function Oo(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)Oo(s,t,e,n,i+1);n==="BT"&&t(r,i)}function KX(r,t,e){const n=[[r,0]];for(;n.length;){const[i,a]=n.shift();t(i,a);const s=e(i);if(s)for(const o of s)n.push([o,a+1])}}function _6(r,t,e,n,i="both"){if(t==="combo"||t==="node")return Dv(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=Dv(r,a.source,n-1,i),o=Dv(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function Dv(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return KX(t,(o,l)=>{l>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(u=>{const c=H(u);!a.has(c)&&l<e&&(s.add(c),a.add(c))}))},o=>r.getRelatedEdgesData(o,n).map(l=>l.source===o?l.target:l.source).filter(l=>i.has(l)?!1:(i.add(l),!0))),Array.from(s)}function Fv(r){return r.states||[]}var md=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class p0 extends Cr{constructor(t,e){super(t,Object.assign({},p0.defaultOptions,e)),this.onClickSelect=n=>md(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.updateState(n),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.onClickCanvas=n=>md(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.clearState(),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.shortcut=new Jl(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$o.forEach(e=>{t.on(`${e}:${J.CLICK}`,this.onClickSelect)}),t.on(qa.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:i}=this.context,{degree:a}=this.options;return _6(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return md(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:i,animation:a}=this.options;if(!e&&!i&&!n)return;const{target:s}=t,{graph:o}=this.context,l=o.getElementData(s.id),u=Fv(l).includes(e)?"unselect":"select",c={},h=this.isMultipleSelect,d=[s.id],g=this.getNeighborIds(t);if(h)if(Object.assign(c,this.getDataStates()),u==="select"){const p=(v,m)=>{v.forEach(b=>{const w=new Set(o.getElementState(b));w.add(m),w.delete(n),c[b]=Array.from(w)})};p(d,e),p(g,i),n&&Object.keys(c).forEach(v=>{const m=c[v];!m.includes(e)&&!m.includes(i)&&!m.includes(n)&&c[v].push(n)})}else{const p=c[s.id];c[s.id]=p.filter(v=>v!==e&&v!==i),p.includes(n)||c[s.id].push(n),g.forEach(v=>{c[v]=c[v].filter(m=>m!==i),c[v].includes(e)||c[v].push(n)})}else if(u==="select"){Object.assign(c,this.getClearStates(!!n));const p=(v,m)=>{v.forEach(b=>{c[b]||(c[b]=o.getElementState(b)),c[b].push(m)})};p(d,e),p(g,i),n&&Object.keys(c).forEach(v=>{!d.includes(v)&&!g.includes(v)&&c[v].push(n)})}else Object.assign(c,this.getClearStates());yield o.setElementState(c,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[H(s)]=Fv(s)}),a}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:i,neighborState:a}=this.options,s=new Set([n,i,a]),{nodes:o,edges:l,combos:u}=e.getData(),c={};return[...o,...l,...u].forEach(h=>{const d=Fv(h),g=d.filter(p=>!s.has(p));(t||g.length!==d.length)&&(c[H(h)]=g)}),c}clearState(){return md(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$o.forEach(e=>{t.off(`${e}:${J.CLICK}`,this.onClickSelect)}),t.off(qa.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}p0.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function _r(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}function Rf(r,t){if(!r.startsWith(t))return!1;const e=r[t.length];return e>="A"&&e<="Z"}function ZX(r,t){return`${t}${mf(r)}`}function JX(r,t,e=!0){if(!t||!Rf(r,t))return r;const n=r.slice(t.length);return e?kW(n):n}function gn(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||Rf(i,t)&&Object.assign(n,{[JX(i,t)]:a}),n),{});if("opacity"in r){const n=ZX("opacity",t),i=r.opacity;if(n in r){const a=r[n];Object.assign(e,{opacity:i*a})}else Object.assign(e,{opacity:i})}return e}function Dw(r,t){const e=t.length;return Object.keys(r).reduce((n,i)=>{if(i.startsWith(t)){const a=i.slice(e);n[a]=r[i]}return n},{})}function S6(r,t){const e=typeof t=="string"?[t]:t,n={};return Object.keys(r).forEach(i=>{e.find(a=>i.startsWith(a))||(n[i]=r[i])}),n}function Vr(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var QX=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function $M(r,t){const{datum:e,graph:n}=t;return typeof r=="function"?r.call(n,e):Object.fromEntries(Object.entries(r).map(([i,a])=>typeof a=="function"?[i,a.call(n,e)]:[i,a]))}function Ln(r,t){const e=(r==null?void 0:r.style)||{},n=(t==null?void 0:t.style)||{};for(const i in e)i in n||(n[i]=e[i]);return Object.assign({},r,t,{style:n})}function tK(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:l,visibility:u}=r;return QX(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function eK(r,t){const e=Vr(r);let n={};return t.text&&!t.fontSize&&(n={fontSize:Math.min(...e)*.5}),t.src&&(!t.width||!t.height)&&(n={width:e[0]*.5,height:e[1]*.5}),n}function jM(r){if(r)return typeof r=="string"||typeof r=="function"||Array.isArray(r)?{type:"group",field:t=>t.id,color:r,invert:!1}:r}function nK(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=l=>{const u=typeof n=="string"?Wa("palette",n):n;if(typeof u=="function"){const c={};return l.forEach(([h,d])=>{c[h]=u(a?1-d:d)}),c}else if(Array.isArray(u)){const c=a?[...u].reverse():u,h={};return l.forEach(([d,g])=>{h[d]=c[g%u.length]}),h}return{}},o=(l,u)=>{var c;return typeof l=="string"?(c=u.data)===null||c===void 0?void 0:c[l]:l==null?void 0:l(u)};if(e==="group"){const l=s0(r,d=>{if(!i)return"default";const g=o(i,d);return g?String(g):"default"}),u=Object.keys(l),c=s(u.map((d,g)=>[d,g])),h={};return Object.entries(l).forEach(([d,g])=>{g.forEach(p=>{h[H(p)]=c[d]})}),h}else if(e==="value"){const[l,u]=r.reduce(([h,d],g)=>{const p=o(i,g);if(typeof p!="number")throw new Error(Ia(`Palette field ${i} is not a number`));return[Math.min(h,p),Math.max(d,p)]},[1/0,-1/0]),c=u-l;return s(r.map(h=>[h.id,(o(i,h)-l)/c]))}}function M6(r){const t=typeof r=="string"?Wa("palette",r):r;if(typeof t!="function")return t}function k6(r,t){let e=2*r;return typeof t=="string"?e=r*Number(t.replace("%",""))/100:typeof t=="number"&&(e=t),isNaN(e)&&(e=2*r),e}function C6(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return k6(a,t)}function rK(r,t,e=1){const n=Ne(r[0],r[1])*e;return k6(n,t)}class Bc extends jx{constructor(t){qM(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(t,e,n,i,a){var s,o,l,u,c,h,d,g;const p=this.shapeMap[t];if(n===!1){p&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,p),i.removeChild(p),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,p));return}const v=typeof e=="string"?Wa(La.SHAPE,e):e;if(!v)throw new Error(Ia(`Shape ${e} not found`));if(!p||p.destroyed||!(p instanceof v)){p&&((l=a==null?void 0:a.beforeDestroy)===null||l===void 0||l.call(a,p),p==null||p.destroy(),(u=a==null?void 0:a.afterDestroy)===null||u===void 0||u.call(a,p)),(c=a==null?void 0:a.beforeCreate)===null||c===void 0||c.call(a);const m=new v({className:t,style:n});return i.appendChild(m),this.shapeMap[t]=m,(h=a==null?void 0:a.afterCreate)===null||h===void 0||h.call(a,m),m}return(d=a==null?void 0:a.beforeUpdate)===null||d===void 0||d.call(a,p),Gw(p,n),(g=a==null?void 0:a.afterUpdate)===null||g===void 0||g.call(a,p),p}update(t={}){const e=Object.assign({},this.attributes,t);qM(e),JZ(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return tK(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(t.length===0)return null;const n=[];if(t[0].x!==void 0||t[0].y!==void 0||t[0].z!==void 0){const{x:a=0,y:s=0,z:o=0}=this.attributes;t.forEach(l=>{const{x:u=a,y:c=s,z:h=o}=l;Object.assign(l,{transform:h?[["translate3d",u,c,h]]:[["translate",u,c]]})})}const i=super.animate(t,e);if(i&&(Bv(this,i),n.push(i)),Array.isArray(t)&&t.length>0){const a=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(s=>!a.includes(s))){Object.entries(this.shapeMap).forEach(([o,l])=>{const u=`get${mf(o)}Style`,c=this[u];if(Et(c)){const h=t.map(g=>c.call(this,Object.assign(Object.assign({},this.attributes),g))),d=l.animate(Iw(h),e);d&&(Bv(l,d),n.push(d))}});const s=(o,l)=>{if(!Ji(o)){const u=`get${mf(l)}Style`,c=this[u];if(Et(c)){const h=t.map(d=>c.call(this,Object.assign(Object.assign({},this.attributes),d)));Object.entries(h[0]).map(([d])=>{const g=h.map(v=>v[d]),p=o[d];if(p){const v=p.animate(Iw(g),e);v&&(Bv(p,v),n.push(v))}})}}};this.compositeShapes.forEach(([o,l])=>{const u=Dw(this.shapeMap,l);s(u,o)})}}return Vx(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Bo(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function Bv(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function qM(r){if(!r)return{};if("x"in r||"y"in r||"z"in r){const{x:t=0,y:e=0,z:n,transform:i}=r,a=r6(t,e,n,i);a&&(r.transform=a)}return r}var iK=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Zs extends Bc{constructor(t){super(Ln({style:Zs.defaultStyleProps},t))}isTextStyle(t){return Rf(t,"label")}isBackgroundStyle(t){return Rf(t,"background")}getTextStyle(t){const e=this.getGraphicStyle(t),{padding:n}=e,i=iK(e,["padding"]);return S6(i,"background")}getBackgroundStyle(t){if(t.background===!1)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:i,padding:a}=e,s=gn(e,"background"),{min:[o,l],center:[u,c],halfExtents:[h,d]}=this.shapeMap.text.getGeometryBounds(),[g,p,v,m]=ua(a),b=h*2+m+p,{width:w,height:x}=s;w&&x?Object.assign(s,{x:u-Number(w)/2,y:c-Number(x)/2}):Object.assign(s,{x:o-m,y:l-g,width:n?Math.min(b,i+m+p):b,height:d*2+g+v});const{radius:S}=s;if(typeof S=="string"&&S.endsWith("%")){const _=Number(S.replace("%",""))/100;s.radius=Math.min(+s.width,+s.height)*_}return s}render(t=this.parsedAttributes,e=this){this.upsert("text",Ys,this.getTextStyle(t),e),this.upsert("background",Nn,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}Zs.defaultStyleProps={padding:0,fontSize:12,fontFamily:"system-ui, sans-serif",wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};class ja extends Bc{constructor(t){super(Ln({style:ja.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",Zs,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}ja.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};function aK(r,t=!0){const e=[];return r.forEach((n,i)=>{e.push([i===0?"M":"L",...n])}),t&&e.push(["Z"]),e}const WM={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};function sK(r){const t=r.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),e=[];let n="",i={};for(;t.length>0;){let a=t.shift();a in WM?n=a:t.unshift(a),i={type:n},WM[n].forEach(l=>{a=t.shift(),i[l]=a}),n==="M"?n="L":n==="m"&&(n="l");const[s,...o]=Object.values(i);e.push([s,...o.map(Number)])}return e}function oK(r){const t=[];return(typeof r=="string"?sK(r):r).forEach(n=>{const i=n[0];if(i==="Z"){t.push(t[0]);return}if(i!=="A")for(let a=1;a<n.length;a=a+2)t.push([n[a],n[a+1],0]);else{const a=n.length;t.push([n[a-2],n[a-1],0])}}),t}const T6=r=>{if(r.length<2)return[["M",0,0],["L",0,0]];const t=r[0],e=r[1],n=r[r.length-1],i=r[r.length-2];r.unshift(i,n),r.push(t,e);const a=[["M",n[0],n[1]]];for(let s=1;s<r.length-2;s+=1){const[o,l]=r[s-1],[u,c]=r[s],[h,d]=r[s+1],[g,p]=s!==r.length-2?r[s+2]:[h,d],v=u+(h-o)/6,m=c+(d-l)/6,b=h-(g-u)/6,w=d-(p-c)/6;a.push(["C",v,m,b,w,h,d])}return a};function lK(r,t,e,n,i,a,s){const[o,l]=Aa(r,t),u={textAlign:t==="left"?"right":t==="right"?"left":"center",textBaseline:t==="top"?"bottom":t==="bottom"?"top":"middle",transform:[["translate",o+e,l+n]]};if(t==="center"||!i)return u;const c=oK(a);if(!c||c.length<=3)return u;const h=c.map((p,v)=>{const m=p,b=c[(v+1)%c.length];return Ze(m,b)?null:[m,b]}).filter(Boolean),d=HX([o,l],h),g=E6([o,l],d);if(g&&d&&(u.transform=[["translate",g[0]+e,g[1]+n]],s)){const p=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));u.transform.push(["rotate",p/Math.PI*180]),u.textAlign="center",(t==="right"||t==="left")&&(p>0?u.textBaseline=t==="right"?"bottom":"top":u.textBaseline=t==="right"?"top":"bottom")}return u}var uK=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class zc extends Bc{constructor(t){super(Ln({style:zc.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||t.d.length===0)return!1;const e=gn(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:i,offsetY:a,autoRotate:s,placement:o,closeToPath:l}=e,u=uK(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),c=this.shapeMap.key,h=c==null?void 0:c.getRenderBounds();return Object.assign(lK(h,o,i,a,l,t.d,s),{wordWrapWidth:C6(h,n)},u)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",jr,this.getKeyStyle(t),e),this.upsert("label",Zs,this.getLabelStyle(t),e)}}zc.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};function cK(r){const t=[],e=n=>{n!=null&&n.children.length&&n.children.forEach(i=>{t.push(i),e(i)})};return e(r),t}function hK(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}let Qx=class extends Ic{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Cl=this,this.isMutationObserved=!0,this.addEventListener(Xt.MOUNTED,this.onMounted),this.addEventListener(Xt.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:i=0}=this.attributes;if(t&&n&&i){const[a,s]=this.getBounds().min,o={x:a,y:s,radius:t,width:n,height:i};if(e)Object.assign(this.parsedStyle.clipPath.style,o);else{const l=new Nn({style:o});this.style.clipPath=l}}else e&&(this.style.clipPath=null)}};const Fw=new WeakMap;let Cl=null;const tE=r=>{if(Cl&&hK(Cl).includes(r)){const t=Fw.get(r);t?t.includes(Cl)||t.push(Cl):Fw.set(r,[Cl])}},eE=r=>{const t=Fw.get(r);t&&t.forEach(e=>e.handleRadius())};class O6 extends Bc{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,i=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},i):Object.assign({textBaseline:"middle",textAlign:"center"},i)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?Qx:Ys,this.getIconStyle(t),e)}}class A6 extends Bc{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then(()=>this.onframe())),n}}var yd=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class mi extends A6{constructor(t){super(Ln({style:mi.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return Vr(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(S6(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=gn(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:i,offsetX:a,offsetY:s}=e,o=yd(e,["placement","maxWidth","offsetX","offsetY"]),l=this.getShape("key").getLocalBounds();return Object.assign(ak(l,n,a,s),{wordWrapWidth:C6(l,i)},o)}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),{fill:n}=e,i=yd(e,["fill"]),a=gn(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},i),{stroke:n}),a)}getIconStyle(t){if(t.icon===!1||!t.iconText&&!t.iconSrc)return!1;const e=gn(this.getGraphicStyle(t),"icon");return Object.assign(eK(t.size,e),e)}getBadgesStyle(t){var e;const n=Dw(this.shapeMap,"badge-"),i={};if(Object.keys(n).forEach(h=>{i[h]=!1}),t.badge===!1||!(!((e=t.badges)===null||e===void 0)&&e.length))return i;const{badges:a=[],badgePalette:s,opacity:o=1}=t,l=yd(t,["badges","badgePalette","opacity"]),u=M6(s),c=gn(this.getGraphicStyle(l),"badge");return a.forEach((h,d)=>{i[d]=Object.assign(Object.assign({backgroundFill:u?u[d%(u==null?void 0:u.length)]:void 0,opacity:o},c),this.getBadgeStyle(h))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=yd(t,["placement","offsetX","offsetY"]),o=ak(e.getLocalBounds(),n,i,a,!0);return Object.assign(Object.assign({},o),s)}getPortsStyle(t){var e;const n=this.getPorts(),i={};if(Object.keys(n).forEach(o=>{i[o]=!1}),t.port===!1||!(!((e=t.ports)===null||e===void 0)&&e.length))return i;const a=gn(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,l)=>{const u=o.key||l,c=Object.assign(Object.assign({},a),o);if(Z6(c))i[u]=!1;else{const[h,d]=this.getPortXY(t,o);i[u]=Object.assign({transform:[["translate",h,d]]},c)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return sE(dK(this.context,i),n)}getPorts(){return Dw(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return GX(t,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t),i=this.getShape("key");this.upsert("halo",i.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);this.upsert("icon",O6,n,e),tE(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,ja,a,e)})}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach(i=>{const a=n[i],s=`port-${i}`;this.upsert(s,Ya,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Zs,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&eE(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}mi.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};function dK(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Bo(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}let $c=class P6 extends mi{constructor(t){super(Ln({style:P6.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ya,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,i=n*2*Ga;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return g0(t,n,e)}};$c.defaultStyleProps={size:32};class v0 extends mi{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",Vo,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,i;const{points:a}=this.getShape("key").attributes,s=[+(((n=this.attributes)===null||n===void 0?void 0:n.x)||0),+(((i=this.attributes)===null||i===void 0?void 0:i.y)||0)];return x6(t,s,a,!0,e).point}}class fK extends v0{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return KZ(e,n)}}var gK=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class m0 extends $c{constructor(t){super(Ln({style:m0.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...Vr(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return se(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(n!=null&&n.length))return;const i=n.map(h=>yt(h)?{value:h}:h),a=gn(this.getGraphicStyle(t),"donut"),s=M6(t.donutPalette);if(!s)return;const o=i.reduce((h,d)=>{var g;return h+((g=d.value)!==null&&g!==void 0?g:0)},0),l=this.parseOuterR(),u=this.parseInnerR();let c=0;i.forEach((h,d)=>{const{value:g=0,color:p=s[d%s.length]}=h,v=gK(h,["value","color"]),m=(o===0?1/i.length:g/o)*360;this.upsert(`round${d}`,jr,Object.assign(Object.assign(Object.assign({},a),{d:mK(l,u,c,c+m),fill:p}),v),e),c+=m})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}m0.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const bd=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],pK=(r,t,e,n)=>n<=0||e<=n?[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"]]:[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"],["M",r+n,t],["A",n,n,0,1,0,r-n,t],["A",n,n,0,1,0,r+n,t],["Z"]],vK=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],l=[bd(r,t,n,s),bd(r,t,e,s),bd(r,t,e,o),bd(r,t,n,o)],u=o-s>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",e,e,0,u,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",n,n,0,u,0,l[0][0],l[0][1]],["Z"]]},mK=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?pK(i,a,r,t):vK(i,a,r,t,e,n)};class y0 extends mi{constructor(t){super(Ln({style:y0.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Rc,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:i/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:i}=this.getShape("key").attributes,a=Math.min(+n,+i)*2*Ga;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return g0(t,n,e)}}y0.defaultStyleProps={size:[45,35]};class yK extends v0{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return QZ(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*Ga;return e?Object.assign({width:n,height:n},e):!1}}/*!
- * @antv/g-plugin-canvas-path-generator
- * @description A G plugin of path generator with Canvas2D API
- * @version 2.1.16
- * @date 1/23/2025, 8:32:57 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */function bK(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.r;r.arc(n,a,s,0,Math.PI*2,!1)}function wK(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.rx,o=t.ry;if(r.ellipse)r.ellipse(n,a,s,o,0,0,Math.PI*2,!1);else{var l=s>o?s:o,u=s>o?1:s/o,c=s>o?o/s:1;r.save(),r.scale(u,c),r.arc(n,a,l,0,Math.PI*2)}}function xK(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,l=t.markerStartOffset,u=t.markerEndOffset,c=0,h=0,d=0,g=0,p=0,v,m;s&&ae(s)&&l&&(v=i-e,m=a-n,p=Math.atan2(m,v),c=Math.cos(p)*(l||0),h=Math.sin(p)*(l||0)),o&&ae(o)&&u&&(v=e-i,m=n-a,p=Math.atan2(m,v),d=Math.cos(p)*(u||0),g=Math.sin(p)*(u||0)),r.moveTo(e+c,n+h),r.lineTo(i+d,a+g)}function EK(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,l=s.segments,u=0,c=0,h=0,d=0,g=0,p,v;if(e&&ae(e)&&i){var m=e.parentNode.getStartTangent(),b=Lt(m,2),w=b[0],x=b[1];p=w[0]-x[0],v=w[1]-x[1],g=Math.atan2(v,p),u=Math.cos(g)*(i||0),c=Math.sin(g)*(i||0)}if(n&&ae(n)&&a){var S=n.parentNode.getEndTangent(),_=Lt(S,2),k=_[0],M=_[1];p=k[0]-M[0],v=k[1]-M[1],g=Math.atan2(v,p),h=Math.cos(g)*(a||0),d=Math.sin(g)*(a||0)}for(var C=0;C<o.length;C++){var P=o[C],T=P[0],A=o[C+1],R=C===0&&(u!==0||c!==0),L=(C===o.length-1||A&&(A[0]==="M"||A[0]==="Z"))&&h!==0&&d!==0,$=R?[u,c]:[0,0],q=Lt($,2),j=q[0],B=q[1],F=L?[h,d]:[0,0],V=Lt(F,2),X=V[0],K=V[1];switch(T){case"M":r.moveTo(P[1]+j,P[2]+B);break;case"L":r.lineTo(P[1]+X,P[2]+K);break;case"Q":r.quadraticCurveTo(P[1],P[2],P[3]+X,P[4]+K);break;case"C":r.bezierCurveTo(P[1],P[2],P[3],P[4],P[5]+X,P[6]+K);break;case"A":{var nt=l[C].arcParams,ot=nt.cx,ct=nt.cy,ht=nt.rx,pt=nt.ry,wt=nt.startAngle,zt=nt.endAngle,Wt=nt.xRotation,Te=nt.sweepFlag;if(r.ellipse)r.ellipse(ot,ct,ht,pt,Wt,wt,zt,!!(1-Te));else{var Ge=ht>pt?ht:pt,Ve=ht>pt?1:ht/pt,In=ht>pt?pt/ht:1;r.translate(ot,ct),r.rotate(Wt),r.scale(Ve,In),r.arc(0,0,Ge,wt,zt,!!(1-Te)),r.scale(1/Ve,1/In),r.rotate(-Wt),r.translate(-ot,-ct)}L&&r.lineTo(P[6]+h,P[7]+d);break}case"Z":r.closePath();break}}}function _K(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,g=0,p=0,v=0,m=0,b,w;e&&ae(e)&&i&&(b=s[1][0]-s[0][0],w=s[1][1]-s[0][1],m=Math.atan2(w,b),d=Math.cos(m)*(i||0),g=Math.sin(m)*(i||0)),n&&ae(n)&&a&&(b=s[o-1][0]-s[0][0],w=s[o-1][1]-s[0][1],m=Math.atan2(w,b),p=Math.cos(m)*(a||0),v=Math.sin(m)*(a||0)),r.moveTo(l+(d||p),u+(g||v));for(var x=1;x<o-1;x++){var S=s[x];r.lineTo(S[0],S[1])}r.lineTo(c,h)}function SK(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,g=0,p=0,v=0,m=0,b,w;e&&ae(e)&&i&&(b=s[1][0]-s[0][0],w=s[1][1]-s[0][1],m=Math.atan2(w,b),d=Math.cos(m)*(i||0),g=Math.sin(m)*(i||0)),n&&ae(n)&&a&&(b=s[o-2][0]-s[o-1][0],w=s[o-2][1]-s[o-1][1],m=Math.atan2(w,b),p=Math.cos(m)*(a||0),v=Math.sin(m)*(a||0)),r.moveTo(l+d,u+g);for(var x=1;x<o-1;x++){var S=s[x];r.lineTo(S[0],S[1])}r.lineTo(c+p,h+v)}function MK(r,t){var e=t.x,n=e===void 0?0:e,i=t.y,a=i===void 0?0:i,s=t.radius,o=t.width,l=t.height,u=o,c=l,h=s&&s.some(function(_){return _!==0});if(!h)r.rect(n,a,u,c);else{var d=o>0?1:-1,g=l>0?1:-1,p=d+g===0,v=s.map(function(_){return Ke(_,0,Math.min(Math.abs(u)/2,Math.abs(c)/2))}),m=Lt(v,4),b=m[0],w=m[1],x=m[2],S=m[3];r.moveTo(d*b+n,a),r.lineTo(u-d*w+n,a),w!==0&&r.arc(u-d*w+n,g*w+a,w,-g*Math.PI/2,d>0?0:Math.PI,p),r.lineTo(u+n,c-g*x+a),x!==0&&r.arc(u-d*x+n,c-g*x+a,x,d>0?0:Math.PI,g>0?Math.PI/2:1.5*Math.PI,p),r.lineTo(d*S+n,c+a),S!==0&&r.arc(d*S+n,c-g*S+a,S,g>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,p),r.lineTo(n,g*b+a),b!==0&&r.arc(d*b+n,g*b+a,b,d>0?Math.PI:0,g>0?Math.PI*1.5:Math.PI/2,p)}}var kK=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="canvas-path-generator",e}return jt(t,r),at(t,[{key:"init",value:function(){var n,i=(n={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(n,Q.CIRCLE,bK),Q.ELLIPSE,wK),Q.RECT,MK),Q.LINE,xK),Q.POLYLINE,SK),Q.POLYGON,_K),Q.PATH,EK),Q.TEXT,void 0),Q.GROUP,void 0),Q.IMAGE,void 0),bt(bt(bt(n,Q.HTML,void 0),Q.MESH,void 0),Q.FRAGMENT,void 0));this.context.pathGeneratorFactory=i}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(Us);/*!
- * @antv/g-plugin-canvas-picker
- * @description A G plugin for picking in canvas
- * @version 2.1.18
- * @date 1/23/2025, 8:35:03 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var CK=Qt(),TK=Qt(),OK=Qt(),AK=Se(),N6=function(){function r(){var t=this;st(this,r),this.isHit=function(e,n,i,a){var s=t.context.pointInPathPickerFactory[e.nodeName];if(s){var o=Qi(AK,i),l=Qn(TK,Zn(OK,n[0],n[1],0),o);if(s(e,new $n(l[0],l[1]),a,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var i=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),a=t.context.pathGeneratorFactory[e.nodeName];return a&&(i.beginPath(),a(i,e.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return at(r,[{key:"apply",value:function(e,n){var i,a=this,s=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=n;var l=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;s.hooks.pick.tapPromise(r.tag,function(){var u=Bs(qn().mark(function c(h){return qn().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.abrupt("return",a.pick(l,h));case 1:case"end":return g.stop()}},c)}));return function(c){return u.apply(this,arguments)}}()),s.hooks.pickSync.tap(r.tag,function(u){return a.pick(l,u)})}},{key:"pick",value:function(e,n){var i=n.topmost,a=n.position,s=a.x,o=a.y,l=Zn(CK,s,o,0),u=e.elementsFromBBox(l[0],l[1],l[0],l[1]),c=[],h=yo(u),d;try{for(h.s();!(d=h.n()).done;){var g=d.value,p=g.getWorldTransform(),v=this.isHit(g,l,p,!1);if(v){var m=LL(g);if(m){var b=m.parsedStyle.clipPath,w=this.isHit(b,l,b.getWorldTransform(),!0);if(w){if(i)return n.picked=[g],n;c.push(g)}}else{if(i)return n.picked=[g],n;c.push(g)}}}}catch(x){h.e(x)}finally{h.f()}return n.picked=c,n}}])}();N6.tag="CanvasPicker";function PK(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.r,u=n.fill,c=n.stroke,h=n.lineWidth,d=h===void 0?1:h,g=n.increasedLineWidthForHitTesting,p=g===void 0?0:g,v=n.pointerEvents,m=v===void 0?"auto":v,b=(d+p)/2,w=za(a,o,t.x,t.y),x=Go(m,u,c),S=Lt(x,2),_=S[0],k=S[1];return _&&k||e?w<=l+b:_?w<=l:k?w>=l-b&&w<=l+b:!1}function wd(r,t,e,n){return r/(e*e)+t/(n*n)}function NK(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.rx,u=n.ry,c=n.fill,h=n.stroke,d=n.lineWidth,g=d===void 0?1:d,p=n.increasedLineWidthForHitTesting,v=p===void 0?0:p,m=n.pointerEvents,b=m===void 0?"auto":m,w=t.x,x=t.y,S=Go(b,c,h),_=Lt(S,2),k=_[0],M=_[1],C=(g+v)/2,P=(w-a)*(w-a),T=(x-o)*(x-o);return k&&M||e?wd(P,T,l+C,u+C)<=1:k?wd(P,T,l,u)<=1:M?wd(P,T,l-C,u-C)>=1&&wd(P,T,l+C,u+C)<=1:!1}function Eo(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function RK(r,t,e,n,i,a,s){var o=i/2;return Eo(r-o,t-o,e,i,a,s)||Eo(r+e-o,t-o,i,n,a,s)||Eo(r+o,t+n-o,e,i,a,s)||Eo(r-o,t+o,i,n,a,s)}function xd(r,t,e,n,i,a,s,o){var l=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),u={x:r+e*Math.cos(l),y:t+e*Math.sin(l)};return za(u.x,u.y,s,o)<=a/2}function Cs(r,t,e,n,i,a,s){var o=Math.min(r,e),l=Math.max(r,e),u=Math.min(t,n),c=Math.max(t,n),h=i/2;return a>=o-h&&a<=l+h&&s>=u-h&&s<=c+h?_G(r,t,e,n,a,s)<=i/2:!1}function R6(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s<a-1;s++){var o=r[s][0],l=r[s][1],u=r[s+1][0],c=r[s+1][1];if(Cs(o,l,u,c,t,e,n))return!0}if(i){var h=r[0],d=r[a-1];if(Cs(h[0],h[1],d[0],d[1],t,e,n))return!0}return!1}var LK=1e-6;function zv(r){return Math.abs(r)<LK?0:r<0?-1:1}function IK(r,t,e){return(e[0]-r[0])*(t[1]-r[1])===(t[0]-r[0])*(e[1]-r[1])&&Math.min(r[0],t[0])<=e[0]&&e[0]<=Math.max(r[0],t[0])&&Math.min(r[1],t[1])<=e[1]&&e[1]<=Math.max(r[1],t[1])}function L6(r,t,e){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var s=r[a],o=r[(a+1)%i];if(IK(s,o,[t,e]))return!0;zv(s[1]-e)>0!=zv(o[1]-e)>0&&zv(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function GM(r,t,e){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=L6(a,t,e),n)break}return n}function DK(r,t,e){var n=r.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2,l=n.lineWidth,u=l===void 0?1:l,c=n.increasedLineWidthForHitTesting,h=c===void 0?0:c,d=n.pointerEvents,g=d===void 0?"auto":d,p=n.fill,v=n.stroke,m=Go(g,p,v),b=Lt(m,2),w=b[1];return!w&&!e||!u?!1:Cs(i,a,s,o,u+h,t.x,t.y)}function FK(r,t,e,n,i){for(var a=!1,s=t/2,o=0;o<r.length;o++){var l=r[o],u=l.currentPoint,c=l.params,h=l.prePoint,d=l.box;if(!(d&&!Eo(d.x-s,d.y-s,d.width+t,d.height+t,e,n)))switch(l.command){case"L":case"Z":if(a=Cs(h[0],h[1],u[0],u[1],t,e,n),a)return!0;break;case"Q":var g=AG(h[0],h[1],c[1],c[2],c[3],c[4],e,n);if(a=g<=t/2,a)return!0;break;case"C":var p=U3(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],e,n,i);if(a=p<=t/2,a)return!0;break;case"A":l.cubicParams||(l.cubicParams=Nx(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],c[7],void 0));for(var v=l.cubicParams,m=h,b=0;b<v.length;b+=6){var w=U3(m[0],m[1],v[b],v[b+1],v[b+2],v[b+3],v[b+4],v[b+5],e,n,i);if(m=[v[b+4],v[b+5]],a=w<=t/2,a)return!0}break}}return a}function BK(r,t,e,n,i,a){var s=r.parsedStyle,o=s.lineWidth,l=o===void 0?1:o,u=s.increasedLineWidthForHitTesting,c=u===void 0?0:u,h=s.stroke,d=s.fill,g=s.d,p=s.pointerEvents,v=p===void 0?"auto":p,m=g.segments,b=g.hasArc,w=g.polylines,x=g.polygons,S=Go(v,(x==null?void 0:x.length)&&d,h),_=Lt(S,2),k=_[0],M=_[1],C=kw(r),P=!1;return k||e?(b?P=n(r,t):P=GM(x,t.x,t.y)||GM(w,t.x,t.y),P):((M||e)&&(P=FK(m,l+c,t.x,t.y,C)),P)}function zK(r,t,e){var n=r.parsedStyle,i=n.stroke,a=n.fill,s=n.lineWidth,o=s===void 0?1:s,l=n.increasedLineWidthForHitTesting,u=l===void 0?0:l,c=n.points,h=n.pointerEvents,d=h===void 0?"auto":h,g=Go(d,a,i),p=Lt(g,2),v=p[0],m=p[1],b=!1;return(m||e)&&(b=R6(c.points,o+u,t.x,t.y,!0)),!b&&(v||e)&&(b=L6(c.points,t.x,t.y)),b}function $K(r,t,e){var n=r.parsedStyle,i=n.lineWidth,a=i===void 0?1:i,s=n.increasedLineWidthForHitTesting,o=s===void 0?0:s,l=n.points,u=n.pointerEvents,c=u===void 0?"auto":u,h=n.fill,d=n.stroke,g=Go(c,h,d),p=Lt(g,2),v=p[1];return!v&&!e||!a?!1:R6(l.points,a+o,t.x,t.y,!1)}function jK(r,t,e,n,i){var a=r.parsedStyle,s=a.radius,o=a.fill,l=a.stroke,u=a.lineWidth,c=u===void 0?1:u,h=a.increasedLineWidthForHitTesting,d=h===void 0?0:h,g=a.x,p=g===void 0?0:g,v=a.y,m=v===void 0?0:v,b=a.width,w=a.height,x=a.pointerEvents,S=x===void 0?"auto":x,_=Go(S,o,l),k=Lt(_,2),M=k[0],C=k[1],P=s&&s.some(function(L){return L!==0}),T=c+d;if(P){var R=!1;return(C||e)&&(R=qK(p,m,b,w,s.map(function(L){return Ke(L,0,Math.min(Math.abs(b)/2,Math.abs(w)/2))}),T,t.x,t.y)),!R&&(M||e)&&(R=n(r,t)),R}else{var A=T/2;if(M&&C||e)return Eo(p-A,m-A,b+A,w+A,t.x,t.y);if(M)return Eo(p,m,b,w,t.x,t.y);if(C)return RK(p,m,b,w,T,t.x,t.y)}return!1}function qK(r,t,e,n,i,a,s,o){var l=Lt(i,4),u=l[0],c=l[1],h=l[2],d=l[3];return Cs(r+u,t,r+e-c,t,a,s,o)||Cs(r+e,t+c,r+e,t+n-h,a,s,o)||Cs(r+e-h,t+n,r+d,t+n,a,s,o)||Cs(r,t+n-d,r,t+u,a,s,o)||xd(r+e-c,t+c,c,1.5*Math.PI,2*Math.PI,a,s,o)||xd(r+e-h,t+n-h,h,0,.5*Math.PI,a,s,o)||xd(r+d,t+n-d,d,.5*Math.PI,Math.PI,a,s,o)||xd(r+u,t+u,u,Math.PI,1.5*Math.PI,a,s,o)}function WK(r,t,e,n,i,a){var s=r.parsedStyle,o=s.pointerEvents,l=o===void 0?"auto":o,u=s.x,c=u===void 0?0:u,h=s.y,d=h===void 0?0:h,g=s.width,p=s.height;if(l==="non-transparent-pixel"){var v=i.config.offscreenCanvas,m=a.offscreenCanvasCreator.getOrCreateCanvas(v),b=a.offscreenCanvasCreator.getOrCreateContext(v,{willReadFrequently:!0});m.width=g,m.height=p,i.defaultStyleRendererFactory[Q.IMAGE].render(b,Bt(Bt({},r.parsedStyle),{},{x:0,y:0}),r,void 0,void 0,void 0);var w=b.getImageData(t.x-c,t.y-d,1,1).data;return w.every(function(x){return x!==0})}return!0}function GK(r,t,e,n){var i=r.getGeometryBounds();return t.x>=i.min[0]&&t.y>=i.min[1]&&t.x<=i.max[0]&&t.y<=i.max[1]}var VK=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="canvas-picker",e}return jt(t,r),at(t,[{key:"init",value:function(){var n,i=(n={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(n,Q.CIRCLE,PK),Q.ELLIPSE,NK),Q.RECT,jK),Q.LINE,DK),Q.POLYLINE,$K),Q.POLYGON,zK),Q.PATH,BK),Q.TEXT,GK),Q.GROUP,null),Q.IMAGE,WK),bt(bt(n,Q.HTML,null),Q.MESH,null));this.context.pointInPathPickerFactory=i,this.addRenderingPlugin(new N6)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(Us);function Yi(r,t){if(!{}.hasOwnProperty.call(r,t))throw new TypeError("attempted to use private field on non-instance");return r}var HK=0;function UK(r){return"__private_"+HK+++"_"+r}/*!
- * @antv/g-plugin-image-loader
- * @description A G plugin for loading image
- * @version 2.1.18
- * @date 1/23/2025, 8:33:24 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var YK=function(){function r(){st(this,r),this.cacheStore=new Map}return at(r,[{key:"onRefAdded",value:function(e){}},{key:"has",value:function(e){return this.cacheStore.has(e)}},{key:"put",value:function(e,n,i){return this.cacheStore.has(e)?!1:(this.cacheStore.set(e,{value:n,counter:new Set([i])}),this.onRefAdded(i),!0)}},{key:"get",value:function(e,n){var i=this.cacheStore.get(e);return i?(i.counter.has(n)||(i.counter.add(n),this.onRefAdded(n)),i.value):null}},{key:"update",value:function(e,n,i){var a=this.cacheStore.get(e);return a?(a.value=Bt(Bt({},a.value),n),a.counter.has(i)||(a.counter.add(i),this.onRefAdded(i)),!0):!1}},{key:"release",value:function(e,n){var i=this.cacheStore.get(e);return i?(i.counter.delete(n),i.counter.size<=0&&this.cacheStore.delete(e),!0):!1}},{key:"releaseRef",value:function(e){var n=this;Array.from(this.cacheStore.keys()).forEach(function(i){n.release(i,e)})}},{key:"getSize",value:function(){return this.cacheStore.size}},{key:"clear",value:function(){this.cacheStore.clear()}}])}(),$v=[],jv=[],Bw=function(){function r(){st(this,r)}return at(r,null,[{key:"stop",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;r.rafId&&(e.cancelAnimationFrame(r.rafId),r.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;$v.length<=0&&jv.length<=0||(jv.forEach(function(n){return n()}),jv=$v.splice(0,r.TASK_NUM_PER_FRAME),r.rafId=e.requestAnimationFrame(function(){r.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,i,a){for(var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:r.api,l=e.naturalWidth||e.width,u=e.naturalHeight||e.height,c=n-s,h=i-s,d=Math.ceil(l/c),g=Math.ceil(u/h),p={tileSize:[n,i],gridSize:[g,d],tiles:Array(g).fill(null).map(function(){return Array(d).fill(null)})},v=function(w){for(var x=function(k){$v.push(function(){var M=k*c,C=w*h,P=[Math.min(n,l-M),Math.min(i,u-C)],T=P[0],A=P[1],R=o.createCanvas();R.width=n,R.height=i;var L=R.getContext("2d");L.drawImage(e,M,C,T,A,0,0,T,A),p.tiles[w][k]={x:M,y:C,tileX:k,tileY:w,data:R},a()})},S=0;S<d;S++)x(S)},m=0;m<g;m++)v(m);return r.stop(),r.executeTask(),p}}])}();Bw.TASK_NUM_PER_FRAME=10;var Ir=new YK;Ir.onRefAdded=function(t){var e=this;t.addEventListener(Xt.DESTROY,function(){e.releaseRef(t)},{once:!0})};var nE=function(){function r(t,e){st(this,r),this.gradientCache={},this.patternCache={},this.context=t,this.runtime=e}return at(r,[{key:"getImageSync",value:function(e,n,i){var a=se(e)?e:e.src;if(Ir.has(a)){var s=Ir.get(a,n);if(s.img.complete)return i==null||i(s),s}return this.getOrCreateImage(e,n).then(function(o){i==null||i(o)}).catch(function(){}),null}},{key:"getOrCreateImage",value:function(e,n){var i=this,a=se(e)?e:e.src;if(!se(e)&&!Ir.has(a)){var s={img:e,size:[e.naturalWidth||e.width,e.naturalHeight||e.height],tileSize:Ed(e)};Ir.put(a,s,n)}if(Ir.has(a)){var o=Ir.get(a,n);return o.img.complete?Promise.resolve(o):new Promise(function(l,u){o.img.addEventListener("load",function(){o.size=[o.img.naturalWidth||o.img.width,o.img.naturalHeight||o.img.height],o.tileSize=Ed(o.img),l(o)}),o.img.addEventListener("error",function(c){u(c)})})}return new Promise(function(l,u){var c=i.context.config.createImage();if(c){var h={img:c,size:[0,0],tileSize:Ed(c)};Ir.put(a,h,n),c.onload=function(){h.size=[c.naturalWidth||c.width,c.naturalHeight||c.height],h.tileSize=Ed(h.img),l(h)},c.onerror=function(d){u(d)},c.crossOrigin="Anonymous",c.src=a}})}},{key:"createDownSampledImage",value:function(){var t=Bs(qn().mark(function n(i,a){var s,o,l,u,c,h,d,g,p,v,m,b,w,x;return qn().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return _.next=2,this.getOrCreateImage(i,a);case 2:if(s=_.sent,!(typeof s.downSamplingRate<"u")){_.next=5;break}return _.abrupt("return",s);case 5:if(o=this.context.config.enableLargeImageOptimization,l=typeof o=="boolean"?{}:o,u=l.maxDownSampledImageSize,c=u===void 0?2048:u,h=l.downSamplingRateThreshold,d=h===void 0?.5:h,g=this.runtime.globalThis.createImageBitmap,p=Lt(s.size,2),v=p[0],m=p[1],b=s.img,w=Math.min((c+c)/(v+m),Math.max(.01,Math.min(d,.5))),x=Bt(Bt({},s),{},{downSamplingRate:w}),Ir.update(s.img.src,x,a),!g){_.next=25;break}return _.prev=14,_.next=17,g(s.img,{resizeWidth:v*w,resizeHeight:m*w});case 17:b=_.sent,_.next=23;break;case 20:_.prev=20,_.t0=_.catch(14),w=1;case 23:_.next=26;break;case 25:w=1;case 26:return x=Bt(Bt({},this.getImageSync(i,a)),{},{downSampled:b,downSamplingRate:w}),Ir.update(s.img.src,x,a),_.abrupt("return",x);case 29:case"end":return _.stop()}},n,this,[[14,20]])}));function e(n,i){return t.apply(this,arguments)}return e}()},{key:"createImageTiles",value:function(){var t=Bs(qn().mark(function n(i,a,s,o){var l,u,c,h,d;return qn().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.getOrCreateImage(i,o);case 2:return l=p.sent,u=o.ownerDocument.defaultView,c=u.requestAnimationFrame,h=u.cancelAnimationFrame,Bw.api={requestAnimationFrame:c,cancelAnimationFrame:h,createCanvas:function(){return $x.createCanvas()}},d=Bt(Bt({},l),Bw.sliceImage(l.img,l.tileSize[0],l.tileSize[0],s)),Ir.update(l.img.src,d,o),p.abrupt("return",d);case 8:case"end":return p.stop()}},n,this)}));function e(n,i,a,s){return t.apply(this,arguments)}return e}()},{key:"releaseImage",value:function(e,n){Ir.release(se(e)?e:e.src,n)}},{key:"releaseImageRef",value:function(e){Ir.releaseRef(e)}},{key:"getOrCreatePatternSync",value:function(e,n,i,a,s,o,l){var u=this.generatePatternKey(n);if(u&&this.patternCache[u])return this.patternCache[u];var c=n.image,h=n.repetition,d=n.transform,g,p=!1;if(se(c)){var v=this.getImageSync(c,e,l);g=v==null?void 0:v.img}else a?(g=a,p=!0):g=c;var m=g&&i.createPattern(g,h);if(m){var b;d?b=zL(AL(d),new Re({})):b=zs(Se()),p&&LR(b,b,[1/s,1/s,1]),m.setTransform({a:b[0],b:b[1],c:b[4],d:b[5],e:b[12]+o[0],f:b[13]+o[1]})}return u&&m&&(this.patternCache[u]=m),m}},{key:"getOrCreateGradient",value:function(e,n){var i=this.generateGradientKey(e),a=e.type,s=e.steps,o=e.min,l=e.width,u=e.height,c=e.angle,h=e.cx,d=e.cy,g=e.size;if(this.gradientCache[i])return this.gradientCache[i];var p=null;if(a===Ss.LinearGradient){var v=MV(o,l,u,c),m=v.x1,b=v.y1,w=v.x2,x=v.y2;p=n.createLinearGradient(m,b,w,x)}else if(a===Ss.RadialGradient){var S=kV(o,l,u,h,d,g),_=S.x,k=S.y,M=S.r;p=n.createRadialGradient(_,k,0,_,k,M)}return p&&(s.forEach(function(C){var P=C.offset,T=C.color;if(P.unit===gt.kPercentage){var A;(A=p)===null||A===void 0||A.addColorStop(P.value/100,T.toString())}}),this.gradientCache[i]=p),this.gradientCache[i]}},{key:"generateGradientKey",value:function(e){var n=e.type,i=e.min,a=e.width,s=e.height,o=e.steps,l=e.angle,u=e.cx,c=e.cy,h=e.size;return"gradient-".concat(n,"-").concat((l==null?void 0:l.toString())||0,"-").concat((u==null?void 0:u.toString())||0,"-").concat((c==null?void 0:c.toString())||0,"-").concat((h==null?void 0:h.toString())||0,"-").concat(i[0],"-").concat(i[1],"-").concat(a,"-").concat(s,"-").concat(o.map(function(d){var g=d.offset,p=d.color;return"".concat(g).concat(p)}).join("-"))}},{key:"generatePatternKey",value:function(e){var n=e.image,i=e.repetition;if(se(n))return"pattern-".concat(n,"-").concat(i);if(n.nodeName==="rect")return"pattern-".concat(n.entity,"-").concat(i)}}])}();nE.isSupportTile=!!$x.createCanvas();function Ed(r){if(!r.complete)return[0,0];var t=r.naturalWidth||r.width,e=r.naturalHeight||r.height,n=256;return[256,512].forEach(function(i){var a=Math.ceil(e/i),s=Math.ceil(t/i);a*s<1e3&&(n=i)}),[n,n]}var I6=function(){function r(){st(this,r)}return at(r,[{key:"apply",value:function(e){var n=e.renderingService,i=e.renderingContext,a=e.imagePool,s=i.root.ownerDocument.defaultView,o=function(h,d,g){var p=h.parsedStyle,v=p.width,m=p.height;v&&!m?h.setAttribute("height",g/d*v):!v&&m&&h.setAttribute("width",d/g*m)},l=function(h){var d=h.target,g=d.nodeName,p=d.attributes;if(g===Q.IMAGE){var v=p.src,m=p.keepAspectRatio;a.getImageSync(v,d,function(b){var w=b.img,x=w.width,S=w.height;m&&o(d,x,S),d.renderable.dirty=!0,n.dirtify()})}},u=function(h){var d=h.target,g=h.attrName,p=h.prevValue,v=h.newValue;d.nodeName!==Q.IMAGE||g!=="src"||(p!==v&&a.releaseImage(p,d),se(v)&&a.getOrCreateImage(v,d).then(function(m){var b=m.img,w=b.width,x=b.height;d.attributes.keepAspectRatio&&o(d,w,x),d.renderable.dirty=!0,n.dirtify()}).catch(function(){}))};n.hooks.init.tap(r.tag,function(){s.addEventListener(Xt.MOUNTED,l),s.addEventListener(Xt.ATTR_MODIFIED,u)}),n.hooks.destroy.tap(r.tag,function(){s.removeEventListener(Xt.MOUNTED,l),s.removeEventListener(Xt.ATTR_MODIFIED,u)})}}])}();I6.tag="LoadImage";var XK=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="image-loader",e}return jt(t,r),at(t,[{key:"init",value:function(n){this.context.imagePool=new nE(this.context,n),this.addRenderingPlugin(new I6)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Us);/*!
- * @antv/g-plugin-canvas-renderer
- * @description A G plugin of renderer implementation with Canvas2D API
- * @version 2.2.18
- * @date 1/23/2025, 8:34:11 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var sn=UK("renderState"),D6=function(){function r(t){st(this,r),this.removedRBushNodeAABBs=[],this.renderQueue=[],Object.defineProperty(this,sn,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=Se(),this.dprMatrix=Se(),this.tmpMat4=Se(),this.vec3a=Qt(),this.vec3b=Qt(),this.vec3c=Qt(),this.vec3d=Qt(),this.canvasRendererPluginOptions=t}return at(r,[{key:"apply",value:function(e,n){var i=this;this.context=e;var a=this.context,s=a.config,o=a.camera,l=a.renderingService,u=a.renderingContext,c=a.rBushRoot,h=a.pathGeneratorFactory,d=s.renderer.getConfig().enableRenderingOptimization;s.renderer.getConfig().enableDirtyCheck=!1,s.renderer.getConfig().enableDirtyRectangleRendering=!1,this.rBush=c,this.pathGeneratorFactory=h;var g=e.contextService,p=u.root.ownerDocument.defaultView,v=function(x){var S=x.target,_=S.rBushNode;_.aabb&&i.removedRBushNodeAABBs.push(_.aabb)},m=function(x){var S=x.target,_=S.rBushNode;_.aabb&&i.removedRBushNodeAABBs.push(_.aabb)};l.hooks.init.tap(r.tag,function(){p.addEventListener(Xt.UNMOUNTED,v),p.addEventListener(Xt.CULLED,m);var w=g.getDPR(),x=s.width,S=s.height,_=g.getContext();i.clearRect(_,0,0,x*w,S*w,s.background)}),l.hooks.destroy.tap(r.tag,function(){p.removeEventListener(Xt.UNMOUNTED,v),p.removeEventListener(Xt.CULLED,m),i.renderQueue=[],i.removedRBushNodeAABBs=[],Yi(i,sn)[sn]={restoreStack:[],prevObject:null,currentContext:null}}),l.hooks.beginFrame.tap(r.tag,function(){var w,x=g.getContext(),S=g.getDPR(),_=s.width,k=s.height,M=i.canvasRendererPluginOptions,C=M.dirtyObjectNumThreshold,P=M.dirtyObjectRatioThreshold,T=l.getStats(),A=T.total,R=T.rendered,L=R/A;i.clearFullScreen=i.clearFullScreenLastFrame||!((w=p.context.renderingPlugins[1])!==null&&w!==void 0&&w.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||R>C&&L>P,x&&(typeof x.resetTransform=="function"?x.resetTransform():x.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(x,0,0,_*S,k*S,s.background))});var b=function(x,S){for(var _=[x];_.length>0;){var k=_.pop();k.isVisible()&&!k.isCulled()&&(d?i.renderDisplayObjectOptimized(k,S,i.context,Yi(i,sn)[sn],n):i.renderDisplayObject(k,S,i.context,Yi(i,sn)[sn],n));for(var M=k.sortable.sorted||k.childNodes,C=M.length-1;C>=0;C--)_.push(M[C])}};l.hooks.endFrame.tap(r.tag,function(){if(u.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}d=s.renderer.getConfig().enableRenderingOptimization,Yi(i,sn)[sn]={restoreStack:[],prevObject:null,currentContext:Yi(i,sn)[sn].currentContext},Yi(i,sn)[sn].currentContext.clear(),i.clearFullScreenLastFrame=!1;var w=g.getContext(),x=g.getDPR();if(mo(i.dprMatrix,[x,x,1]),Jn(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)d?(w.save(),b(u.root,w),w.restore()):b(u.root,w),i.removedRBushNodeAABBs=[];else{var S=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat(Ce(i.removedRBushNodeAABBs.map(function(ht){var pt=ht.minX,wt=ht.minY,zt=ht.maxX,Wt=ht.maxY,Te=new Me;return Te.setMinMax([pt,wt,0],[zt,Wt,0]),Te}))));if(i.removedRBushNodeAABBs=[],Me.isEmpty(S)){i.renderQueue=[];return}var _=i.convertAABB2Rect(S),k=_.x,M=_.y,C=_.width,P=_.height,T=Qn(i.vec3a,[k,M,0],i.vpMatrix),A=Qn(i.vec3b,[k+C,M,0],i.vpMatrix),R=Qn(i.vec3c,[k,M+P,0],i.vpMatrix),L=Qn(i.vec3d,[k+C,M+P,0],i.vpMatrix),$=Math.min(T[0],A[0],L[0],R[0]),q=Math.min(T[1],A[1],L[1],R[1]),j=Math.max(T[0],A[0],L[0],R[0]),B=Math.max(T[1],A[1],L[1],R[1]),F=Math.floor($),V=Math.floor(q),X=Math.ceil(j-$),K=Math.ceil(B-q);w.save(),i.clearRect(w,F,V,X,K,s.background),w.beginPath(),w.rect(F,V,X,K),w.clip(),w.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var nt=s.renderer.getConfig(),ot=nt.enableDirtyRectangleRenderingDebug;ot&&p.dispatchEvent(new dn(zr.DIRTY_RECTANGLE,{dirtyRect:{x:F,y:V,width:X,height:K}}));var ct=i.searchDirtyObjects(S);ct.sort(function(ht,pt){return ht.sortable.renderOrder-pt.sortable.renderOrder}).forEach(function(ht){ht&&ht.isVisible()&&!ht.isCulled()&&i.renderDisplayObject(ht,w,i.context,Yi(i,sn)[sn],n)}),w.restore(),i.renderQueue.forEach(function(ht){i.saveDirtyAABB(ht)}),i.renderQueue=[]}Yi(i,sn)[sn].restoreStack.forEach(function(){w.restore()}),Yi(i,sn)[sn].restoreStack=[]}),l.hooks.render.tap(r.tag,function(w){i.clearFullScreen||i.renderQueue.push(w)})}},{key:"clearRect",value:function(e,n,i,a,s,o){e.clearRect(n,i,a,s),o&&(e.fillStyle=o,e.fillRect(n,i,a,s))}},{key:"renderDisplayObjectOptimized",value:function(e,n,i,a,s){var o=e.nodeName,l=!1,u=!1,c=this.context.styleRendererFactory[o],h=this.pathGeneratorFactory[o],d=e.parsedStyle.clipPath;if(d){l=!a.prevObject||!lw(d.getWorldTransform(),a.prevObject.getWorldTransform()),l&&(this.applyWorldTransform(n,d),a.prevObject=null);var g=this.pathGeneratorFactory[d.nodeName];g&&(n.save(),u=!0,n.beginPath(),g(n,d.parsedStyle),n.closePath(),n.clip())}if(c){l=!a.prevObject||!lw(e.getWorldTransform(),a.prevObject.getWorldTransform()),l&&this.applyWorldTransform(n,e);var p=!a.prevObject;if(!p){var v=a.prevObject.nodeName;o===Q.TEXT?p=v!==Q.TEXT:o===Q.IMAGE?p=v!==Q.IMAGE:p=v===Q.TEXT||v===Q.IMAGE}c.applyStyleToContext(n,e,p,a),a.prevObject=e}h&&(n.beginPath(),h(n,e.parsedStyle),o!==Q.LINE&&o!==Q.PATH&&o!==Q.POLYLINE&&n.closePath()),c&&c.drawToContext(n,e,Yi(this,sn)[sn],this,s),u&&n.restore(),e.renderable.dirty=!1}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,l=a.restoreStack[a.restoreStack.length-1];l&&!(e.compareDocumentPosition(l)&qe.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var u=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),a.restoreStack.push(e),n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}u&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),o!==Q.LINE&&o!==Q.PATH&&o!==Q.POLYLINE&&n.closePath()),u&&(u.render(n,e.parsedStyle,e,i,this,s),n.restore()),e.renderable.dirty=!1}},{key:"applyAttributesToContext",value:function(e,n){var i=n.parsedStyle,a=i.stroke,s=i.fill,o=i.opacity,l=i.lineDash,u=i.lineDashOffset;l&&e.setLineDash(l),kt(u)||(e.lineDashOffset=u),kt(o)||(e.globalAlpha*=o),!kt(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!kt(s)&&!Array.isArray(s)&&!s.isNone&&(e.fillStyle=n.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var n=e.getMin(),i=e.getMax(),a=Math.floor(n[0]),s=Math.floor(n[1]),o=Math.ceil(i[0]),l=Math.ceil(i[1]),u=o-a,c=l-s;return{x:a,y:s,width:u,height:c}}},{key:"mergeDirtyAABBs",value:function(e){var n=new Me;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"searchDirtyObjects",value:function(e){var n=e.getMin(),i=Lt(n,2),a=i[0],s=i[1],o=e.getMax(),l=Lt(o,2),u=l[0],c=l[1],h=this.rBush.search({minX:a,minY:s,maxX:u,maxY:c});return h.map(function(d){var g=d.displayObject;return g})}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new Me);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(Wl(this.tmpMat4,n.getLocalTransform()),Jn(this.tmpMat4,i,this.tmpMat4),Jn(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(Wl(this.tmpMat4,n.getWorldTransform()),Jn(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var e=new Me,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return i.forEach(function(s){e.add(s)}),e}}])}();D6.tag="CanvasRenderer";function Lf(r,t,e,n,i,a,s){var o,l;if(r.image.nodeName==="rect"){var u=r.image.parsedStyle,c=u.width,h=u.height;l=n.contextService.getDPR();var d=n.config.offscreenCanvas;o=a.offscreenCanvasCreator.getOrCreateCanvas(d),o.width=c*l,o.height=h*l;var g=a.offscreenCanvasCreator.getOrCreateContext(d),p={restoreStack:[],prevObject:null,currentContext:new Map};r.image.forEach(function(m){i.renderDisplayObject(m,g,n,p,a)}),p.restoreStack.forEach(function(){g.restore()})}var v=s.getOrCreatePatternSync(t,r,e,o,l,t.getGeometryBounds().min,function(){t.renderable.dirty=!0,n.renderingService.dirtify()});return v}function If(r,t,e,n){var i;if(r.type===Ss.LinearGradient||r.type===Ss.RadialGradient){var a=t.getGeometryBounds(),s=a&&a.halfExtents[0]*2||1,o=a&&a.halfExtents[1]*2||1,l=a&&a.min||[0,0];i=n.getOrCreateGradient(Bt(Bt({type:r.type},r.value),{},{min:l,width:s,height:o}),e)}return i}var _d=["shadowBlur","shadowOffsetX","shadowOffsetY"],VM=["lineCap","lineJoin","miterLimit"],hn={globalAlpha:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",filter:"none",globalCompositeOperation:"source-over",strokeStyle:"#000",strokeOpacity:1,lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,fillStyle:"#000",fillOpacity:1},HM={};function Ue(r,t,e,n){var i=n.has(t)?n.get(t):hn[t];return i!==e&&(t==="lineDash"?r.setLineDash(e):r[t]=e,n.set(t,e)),i}var KK=function(){function r(t){st(this,r),this.imagePool=t}return at(r,[{key:"applyAttributesToContext",value:function(e,n){}},{key:"render",value:function(e,n,i,a,s,o){}},{key:"applyCommonStyleToContext",value:function(e,n,i,a){var s=i?HM:a.prevObject.parsedStyle,o=n.parsedStyle;(i||o.opacity!==s.opacity)&&Ue(e,"globalAlpha",kt(o.opacity)?hn.globalAlpha:o.opacity,a.currentContext),(i||o.blend!==s.blend)&&Ue(e,"globalCompositeOperation",kt(o.blend)?hn.globalCompositeOperation:o.blend,a.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(e,n,i,a){var s=i?HM:a.prevObject.parsedStyle,o=n.parsedStyle,l=o.lineWidth,u=l===void 0?hn.lineWidth:l,c=o.fill&&!o.fill.isNone,h=o.stroke&&!o.stroke.isNone&&u>0;if(h){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var d=!kt(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:hn.strokeStyle;Ue(e,"strokeStyle",d,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&Ue(e,"lineWidth",kt(o.lineWidth)?hn.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&Ue(e,"lineDash",o.lineDash||hn.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&Ue(e,"lineDashOffset",kt(o.lineDashOffset)?hn.lineDashOffset:o.lineDashOffset,a.currentContext);for(var g=0;g<VM.length;g++){var p=VM[g];(i||o[p]!==s[p])&&Ue(e,p,kt(o[p])?hn[p]:o[p],a.currentContext)}}if(c&&(i||n.attributes.fill!==a.prevObject.attributes.fill)){var v=!kt(o.fill)&&!Array.isArray(o.fill)&&!o.fill.isNone?n.attributes.fill:hn.fillStyle;Ue(e,"fillStyle",v,a.currentContext)}}},{key:"applyStyleToContext",value:function(e,n,i,a){var s=n.nodeName;this.applyCommonStyleToContext(e,n,i,a),s===Q.IMAGE||this.applyStrokeFillStyleToContext(e,n,i,a)}},{key:"applyShadowAndFilterStyleToContext",value:function(e,n,i,a){var s=n.parsedStyle;if(i){Ue(e,"shadowColor",s.shadowColor.toString(),a.currentContext);for(var o=0;o<_d.length;o++){var l=_d[o];Ue(e,l,s[l]||hn[l],a.currentContext)}}s.filter&&s.filter.length&&Ue(e,"filter",n.attributes.filter,a.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(e,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(n){Ue(e,"shadowColor",hn.shadowColor,a.currentContext);for(var o=0;o<_d.length;o++){var l=_d[o];Ue(e,l,hn[l],a.currentContext)}}if(i)if(n&&s){var u=e.filter;!kt(u)&&u.indexOf("drop-shadow")>-1&&Ue(e,"filter",u.replace(/drop-shadow\([^)]*\)/,"").trim()||hn.filter,a.currentContext)}else Ue(e,"filter",hn.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle,u=l.fill,c=l.fillRule,h=null;if(Array.isArray(u)&&u.length>0)u.forEach(function(g){var p=Ue(e,"fillStyle",If(g,n,e,o.imagePool),i.currentContext);h=h??p,c?e.fill(c):e.fill()});else{if(Do(u)){var d=Lf(u,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);d&&(e.fillStyle=d,h=!0)}c?e.fill(c):e.fill()}h!==null&&Ue(e,"fillStyle",h,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle.stroke,u=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var g=Ue(e,"strokeStyle",If(d,n,e,o.imagePool),i.currentContext);u=u??g,e.stroke()});else{if(Do(l)){var c=Lf(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(c){var h=Ue(e,"strokeStyle",c,i.currentContext);u=u??h}}e.stroke()}u!==null&&Ue(e,"strokeStyle",u,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,l=n.nodeName,u=n.parsedStyle,c=u.opacity,h=c===void 0?hn.globalAlpha:c,d=u.fillOpacity,g=d===void 0?hn.fillOpacity:d,p=u.strokeOpacity,v=p===void 0?hn.strokeOpacity:p,m=u.lineWidth,b=m===void 0?hn.lineWidth:m,w=u.fill&&!u.fill.isNone,x=u.stroke&&!u.stroke.isNone&&b>0;if(!(!w&&!x)){var S=!kt(u.shadowColor)&&u.shadowBlur>0,_=u.shadowType==="inner",k=((o=u.fill)===null||o===void 0?void 0:o.alpha)===0,M=!!(u.filter&&u.filter.length),C=S&&x&&(l===Q.PATH||l===Q.LINE||l===Q.POLYLINE||k||_),P=null;if(w){C||this.applyShadowAndFilterStyleToContext(e,n,S,i);var T=h*g;P=Ue(e,"globalAlpha",T,i.currentContext),this.fillToContext(e,n,i,a,s),C||this.clearShadowAndFilterStyleForContext(e,S,M,i)}if(x){var A=!1,R=h*v,L=Ue(e,"globalAlpha",R,i.currentContext);if(P=w?P:L,C&&(this.applyShadowAndFilterStyleToContext(e,n,S,i),A=!0,_)){var $=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=$,this.clearShadowAndFilterStyleForContext(e,S,M,i,!0)}this.strokeToContext(e,n,i,a,s),A&&this.clearShadowAndFilterStyleForContext(e,S,M,i)}P!==null&&Ue(e,"globalAlpha",P,i.currentContext)}}}])}(),rE=function(r){function t(){return st(this,t),qt(this,t,arguments)}return jt(t,r),at(t,[{key:"render",value:function(n,i,a,s,o,l){var u=i.fill,c=i.fillRule,h=i.opacity,d=h===void 0?1:h,g=i.fillOpacity,p=g===void 0?1:g,v=i.stroke,m=i.strokeOpacity,b=m===void 0?1:m,w=i.lineWidth,x=w===void 0?1:w,S=i.lineCap,_=i.lineJoin,k=i.shadowType,M=i.shadowColor,C=i.shadowBlur,P=i.filter,T=i.miterLimit,A=u&&!u.isNone,R=v&&!v.isNone&&x>0,L=(u==null?void 0:u.alpha)===0,$=!!(P&&P.length),q=!kt(M)&&C>0,j=a.nodeName,B=k==="inner",F=R&&q&&(j===Q.PATH||j===Q.LINE||j===Q.POLYLINE||L||B);A&&(n.globalAlpha=d*p,F||Df(a,n,q),F6(n,a,u,c,s,o,l,this.imagePool),F||this.clearShadowAndFilter(n,$,q)),R&&(n.globalAlpha=d*b,n.lineWidth=x,kt(T)||(n.miterLimit=T),kt(S)||(n.lineCap=S),kt(_)||(n.lineJoin=_),F&&(B&&(n.globalCompositeOperation="source-atop"),Df(a,n,!0),B&&(zw(n,a,v,s,o,l,this.imagePool),n.globalCompositeOperation=hn.globalCompositeOperation,this.clearShadowAndFilter(n,$,!0))),zw(n,a,v,s,o,l,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!kt(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(KK);function Df(r,t,e){var n=r.parsedStyle,i=n.filter,a=n.shadowColor,s=n.shadowBlur,o=n.shadowOffsetX,l=n.shadowOffsetY;i&&i.length&&(t.filter=r.style.filter),e&&(t.shadowColor=a.toString(),t.shadowBlur=s||0,t.shadowOffsetX=o||0,t.shadowOffsetY=l||0)}function F6(r,t,e,n,i,a,s,o){var l=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(u){r.fillStyle=If(u,t,r,o),l||(n?r.fill(n):r.fill())}):(Do(e)&&(r.fillStyle=Lf(e,t,r,i,a,s,o)),l||(n?r.fill(n):r.fill()))}function zw(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1;Array.isArray(e)?e.forEach(function(l){r.strokeStyle=If(l,t,r,s),o||r.stroke()}):(Do(e)&&(r.strokeStyle=Lf(e,t,r,n,i,a,s)),o||r.stroke())}function ZK(r,t){var e=Lt(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=Lt(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=Math.max(n,l),g=Math.max(i,u),p=Math.min(n+a,l+c),v=Math.min(i+s,u+h);return p<=d||v<=g?null:[d,g,p-d,v-g]}function JK(r,t){var e=Qn(Qt(),[r[0],r[1],0],t),n=Qn(Qt(),[r[0]+r[2],r[1],0],t),i=Qn(Qt(),[r[0],r[1]+r[3],0],t),a=Qn(Qt(),[r[0]+r[2],r[1]+r[3],0],t);return[Math.min(e[0],n[0],i[0],a[0]),Math.min(e[1],n[1],i[1],a[1]),Math.max(e[0],n[0],i[0],a[0])-Math.min(e[0],n[0],i[0],a[0]),Math.max(e[1],n[1],i[1],a[1])-Math.min(e[1],n[1],i[1],a[1])]}var QK=function(r){function t(){return st(this,t),qt(this,t,arguments)}return jt(t,r),at(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,l=s.imageCache;if(!l.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(u){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()}).catch(function(){});return}n.drawImage(l.downSampled,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}},{key:"renderTile",value:function(n,i,a,s){var o=s.src,l=s.imageCache,u=s.imageRect,c=s.drawRect,h=l.size,d=n.getTransform(),g=d.a,p=d.b,v=d.c,m=d.d,b=d.e,w=d.f;if(n.resetTransform(),!(l!=null&&l.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()},a).catch(function(){});return}for(var x=[h[0]/u[2],h[1]/u[3]],S=[l.tileSize[0]/x[0],l.tileSize[1]/x[1]],_=[Math.floor((c[0]-u[0])/S[0]),Math.ceil((c[0]+c[2]-u[0])/S[0])],k=_[0],M=_[1],C=[Math.floor((c[1]-u[1])/S[1]),Math.ceil((c[1]+c[3]-u[1])/S[1])],P=C[0],T=C[1],A=P;A<=T;A++)for(var R=k;R<=M;R++){var L=l.tiles[A][R];if(L){var $=[Math.floor(u[0]+L.tileX*S[0]),Math.floor(u[1]+L.tileY*S[1]),Math.ceil(S[0]),Math.ceil(S[1])];n.drawImage(L.data,$[0],$[1],$[2],$[3])}}n.setTransform(g,p,v,m,b,w)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,l=i.y,u=l===void 0?0:l,c=i.width,h=i.height,d=i.src,g=i.shadowColor,p=i.shadowBlur,v=this.imagePool.getImageSync(d,a),m=v==null?void 0:v.img,b=c,w=h;if(m){b||(b=m.width),w||(w=m.height);var x=!kt(g)&&p>0;Df(a,n,x);try{var S=a.ownerDocument.defaultView.getContextService().getDomElement(),_=S.width,k=S.height,M=n.getTransform(),C=M.a,P=M.b,T=M.c,A=M.d,R=M.e,L=M.f,$=PR(C,T,0,0,P,A,0,0,0,0,1,0,R,L,0,1),q=JK([o,u,b,w],$),j=ZK([0,0,_,k],q);if(!j)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:m,drawRect:[o,u,b,w]});return}var B=q[2]/v.size[0];if(B<(v.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:d,imageCache:v,drawRect:[o,u,b,w]});return}if(!nE.isSupportTile){t.renderFull(n,i,a,{image:m,drawRect:[o,u,b,w]});return}this.renderTile(n,i,a,{src:d,imageCache:v,imageRect:q,drawRect:j})}catch{}}}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i)}}],[{key:"renderFull",value:function(n,i,a,s){n.drawImage(s.image,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}}])}(rE),tZ=function(r){function t(){return st(this,t),qt(this,t,arguments)}return jt(t,r),at(t,[{key:"render",value:function(n,i,a,s,o,l){a.getBounds();var u=i.lineWidth,c=u===void 0?1:u,h=i.textAlign,d=h===void 0?"start":h,g=i.textBaseline,p=g===void 0?"alphabetic":g,v=i.lineJoin,m=v===void 0?"miter":v,b=i.miterLimit,w=b===void 0?10:b,x=i.letterSpacing,S=x===void 0?0:x,_=i.stroke,k=i.fill,M=i.fillRule,C=i.fillOpacity,P=C===void 0?1:C,T=i.strokeOpacity,A=T===void 0?1:T,R=i.opacity,L=R===void 0?1:R,$=i.metrics,q=i.x,j=q===void 0?0:q,B=i.y,F=B===void 0?0:B,V=i.dx,X=i.dy,K=i.shadowColor,nt=i.shadowBlur,ot=$.font,ct=$.lines,ht=$.height,pt=$.lineHeight,wt=$.lineMetrics;n.font=ot,n.lineWidth=c,n.textAlign=d==="middle"?"center":d;var zt=p;zt==="alphabetic"&&(zt="bottom"),n.lineJoin=m,kt(w)||(n.miterLimit=w);var Wt=F;p==="middle"?Wt+=-ht/2-pt/2:p==="bottom"||p==="alphabetic"||p==="ideographic"?Wt+=-ht:(p==="top"||p==="hanging")&&(Wt+=-pt);var Te=j+(V||0);Wt+=X||0,ct.length===1&&(zt==="bottom"?(zt="middle",Wt-=.5*ht):zt==="top"&&(zt="middle",Wt+=.5*ht)),n.textBaseline=zt;var Ge=!kt(K)&&nt>0;Df(a,n,Ge);for(var Ve=0;Ve<ct.length;Ve++){var In=c/2+Te;Wt+=pt,!kt(_)&&!_.isNone&&c&&this.drawLetterSpacing(n,a,ct[Ve],wt[Ve],d,In,Wt,S,k,M,P,_,A,L,!0,s,o,l),kt(k)||this.drawLetterSpacing(n,a,ct[Ve],wt[Ve],d,In,Wt,S,k,M,P,_,A,L,!1,s,o,l)}}},{key:"drawLetterSpacing",value:function(n,i,a,s,o,l,u,c,h,d,g,p,v,m,b,w,x,S){if(c===0){b?this.strokeText(n,i,a,l,u,p,v,w,x,S):this.fillText(n,i,a,l,u,h,d,g,m,w,x,S);return}var _=n.textAlign;n.textAlign="left";var k=l;o==="center"||o==="middle"?k=l-s.width/2:(o==="right"||o==="end")&&(k=l-s.width);for(var M=Array.from(a),C=n.measureText(a).width,P=0,T=0;T<M.length;++T){var A=M[T];b?this.strokeText(n,i,A,k,u,p,v,w,x,S):this.fillText(n,i,A,k,u,h,d,g,m,w,x,S),P=n.measureText(a.substring(T+1)).width,k+=C-P+c,C=P}n.textAlign=_}},{key:"fillText",value:function(n,i,a,s,o,l,u,c,h,d,g,p){F6(n,i,l,u,d,g,p,this.imagePool,!0);var v,m=!kt(c)&&c!==1;m&&(v=n.globalAlpha,n.globalAlpha=c*h),n.fillText(a,s,o),m&&(n.globalAlpha=v)}},{key:"strokeText",value:function(n,i,a,s,o,l,u,c,h,d){zw(n,i,l,c,h,d,this.imagePool,!0);var g,p=!kt(u)&&u!==1;p&&(g=n.globalAlpha,n.globalAlpha=u),n.strokeText(a,s,o),p&&(n.globalAlpha=g)}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i,i.ownerDocument.defaultView.context,s,o)}}])}(rE),eZ=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return st(this,t),e=qt(this,t),e.name="canvas-renderer",e.options=n,e}return jt(t,r),at(t,[{key:"init",value:function(){var n,i=Bt({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new rE(a),o=(n={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(n,Q.CIRCLE,s),Q.ELLIPSE,s),Q.RECT,s),Q.IMAGE,new QK(a)),Q.TEXT,new tZ(a)),Q.LINE,s),Q.POLYLINE,s),Q.POLYGON,s),Q.PATH,s),Q.GROUP,void 0),bt(bt(bt(n,Q.HTML,void 0),Q.MESH,void 0),Q.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new D6(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(Us);/*!
- * @antv/g-plugin-dom-interaction
- * @description A G plugin
- * @version 2.1.21
- * @date 1/23/2025, 8:33:09 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var B6=function(){function r(){st(this,r)}return at(r,[{key:"apply",value:function(e,n){var i=this,a=e.renderingService,s=e.renderingContext,o=e.config;this.context=e;var l=s.root.ownerDocument.defaultView,u=function(C){a.hooks.pointerMove.call(C)},c=function(C){a.hooks.pointerUp.call(C)},h=function(C){a.hooks.pointerDown.call(C)},d=function(C){a.hooks.pointerOver.call(C)},g=function(C){a.hooks.pointerOut.call(C)},p=function(C){a.hooks.pointerCancel.call(C)},v=function(C){a.hooks.pointerWheel.call(C)},m=function(C){a.hooks.click.call(C)},b=function(C){n.globalThis.document.addEventListener("pointermove",u,!0),C.addEventListener("pointerdown",h,!0),C.addEventListener("pointerleave",g,!0),C.addEventListener("pointerover",d,!0),n.globalThis.addEventListener("pointerup",c,!0),n.globalThis.addEventListener("pointercancel",p,!0)},w=function(C){C.addEventListener("touchstart",h,!0),C.addEventListener("touchend",c,!0),C.addEventListener("touchmove",u,!0),C.addEventListener("touchcancel",p,!0)},x=function(C){n.globalThis.document.addEventListener("mousemove",u,!0),C.addEventListener("mousedown",h,!0),C.addEventListener("mouseout",g,!0),C.addEventListener("mouseover",d,!0),n.globalThis.addEventListener("mouseup",c,!0)},S=function(C){n.globalThis.document.removeEventListener("pointermove",u,!0),C.removeEventListener("pointerdown",h,!0),C.removeEventListener("pointerleave",g,!0),C.removeEventListener("pointerover",d,!0),n.globalThis.removeEventListener("pointerup",c,!0),n.globalThis.removeEventListener("pointercancel",p,!0)},_=function(C){C.removeEventListener("touchstart",h,!0),C.removeEventListener("touchend",c,!0),C.removeEventListener("touchmove",u,!0),C.removeEventListener("touchcancel",p,!0)},k=function(C){n.globalThis.document.removeEventListener("mousemove",u,!0),C.removeEventListener("mousedown",h,!0),C.removeEventListener("mouseout",g,!0),C.removeEventListener("mouseover",d,!0),n.globalThis.removeEventListener("mouseup",c,!0)};a.hooks.init.tap(r.tag,function(){var M=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(M.style.msContentZooming="none",M.style.msTouchAction="none"):l.supportsPointerEvents&&(M.style.touchAction="none"),l.supportsPointerEvents?b(M):x(M),l.supportsTouchEvents&&w(M),o.useNativeClickEvent&&M.addEventListener("click",m,!0),M.addEventListener("wheel",v,{passive:!0,capture:!0})}),a.hooks.destroy.tap(r.tag,function(){var M=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(M.style.msContentZooming="",M.style.msTouchAction=""):l.supportsPointerEvents&&(M.style.touchAction=""),l.supportsPointerEvents?S(M):k(M),l.supportsTouchEvents&&_(M),o.useNativeClickEvent&&M.removeEventListener("click",m,!0),M.removeEventListener("wheel",v,!0)})}}])}();B6.tag="DOMInteraction";var nZ=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="dom-interaction",e}return jt(t,r),at(t,[{key:"init",value:function(){this.addRenderingPlugin(new B6)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Us);/*!
- * @antv/g-plugin-html-renderer
- * @description A G plugin for rendering HTML
- * @version 2.1.21
- * @date 1/23/2025, 8:33:20 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var rZ="g-canvas-camera",z6=function(){function r(){st(this,r),this.displayObjectHTMLElementMap=new WeakMap}return at(r,[{key:"joinTransformMatrix",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+n[0],e[13]+n[1]].join(","),")")}},{key:"apply",value:function(e,n){var i=this,a=e.camera,s=e.renderingContext,o=e.renderingService;this.context=e;var l=s.root.ownerDocument.defaultView,u=l.context.eventService.nativeHTMLMap,c=function(b,w){w.style.transform=i.joinTransformMatrix(b.getWorldTransform(),b.getOrigin())},h=function(b){var w=b.target;if(w.nodeName===Q.HTML){i.$camera||(i.$camera=i.createCamera(a));var x=i.getOrCreateEl(w);i.$camera.appendChild(x),Object.keys(w.attributes).forEach(function(S){i.updateAttribute(S,w)}),c(w,x),u.set(x,w)}},d=function(b){var w=b.target;if(w.nodeName===Q.HTML&&i.$camera){var x=i.getOrCreateEl(w);x&&(x.remove(),u.delete(x))}},g=function(b){var w=b.target;if(w.nodeName===Q.HTML){var x=b.attrName;i.updateAttribute(x,w)}},p=function(b){var w=b.target,x=w.nodeName===Q.FRAGMENT?w.childNodes:[w];x.forEach(function(S){if(S.nodeName===Q.HTML){var _=i.getOrCreateEl(S);c(S,_)}})},v=function(){if(i.$camera){var b=i.context.config,w=b.width,x=b.height;i.$camera.parentElement.style.width="".concat(w||0,"px"),i.$camera.parentElement.style.height="".concat(x||0,"px")}};o.hooks.init.tap(r.tag,function(){l.addEventListener(zr.RESIZE,v),l.addEventListener(Xt.MOUNTED,h),l.addEventListener(Xt.UNMOUNTED,d),l.addEventListener(Xt.ATTR_MODIFIED,g),l.addEventListener(Xt.BOUNDS_CHANGED,p)}),o.hooks.endFrame.tap(r.tag,function(){i.$camera&&s.renderReasons.has($l.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))}),o.hooks.destroy.tap(r.tag,function(){i.$camera&&i.$camera.remove(),l.removeEventListener(zr.RESIZE,v),l.removeEventListener(Xt.MOUNTED,h),l.removeEventListener(Xt.UNMOUNTED,d),l.removeEventListener(Xt.ATTR_MODIFIED,g),l.removeEventListener(Xt.BOUNDS_CHANGED,p)})}},{key:"createCamera",value:function(e){var n=this.context.config,i=n.document,a=n.width,s=n.height,o=this.context.contextService.getDomElement(),l=o.parentNode;if(l){var u=rZ,c=l.querySelector("#".concat(u));if(!c){var h=(i||document).createElement("div");h.style.overflow="hidden",h.style.pointerEvents="none",h.style.position="absolute",h.style.left="0px",h.style.top="0px",h.style.width="".concat(a||0,"px"),h.style.height="".concat(s||0,"px");var d=(i||document).createElement("div");c=d,d.id=u,d.style.position="absolute",d.style.left="".concat(o.offsetLeft||0,"px"),d.style.top="".concat(o.offsetTop||0,"px"),d.style.transformOrigin="left top",d.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),d.style.pointerEvents="none",d.style.width="100%",d.style.height="100%",h.appendChild(d),l.appendChild(h)}return c}return null}},{key:"getOrCreateEl",value:function(e){var n=this.context.config.document,i=this.displayObjectHTMLElementMap.get(e);return i||(i=(n||document).createElement("div"),e.parsedStyle.$el=i,this.displayObjectHTMLElementMap.set(e,i),e.id&&(i.id=e.id),e.name&&i.setAttribute("name",e.name),e.className&&(i.className=e.className),i.style.position="absolute",i.style["will-change"]="transform",i.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),i}},{key:"updateAttribute",value:function(e,n){var i=this.getOrCreateEl(n);switch(e){case"innerHTML":var a=n.parsedStyle.innerHTML;se(a)?i.innerHTML=a:(i.innerHTML="",i.appendChild(a));break;case"x":i.style.left="".concat(n.parsedStyle.x,"px");break;case"y":i.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var s=n.parsedStyle.transformOrigin;i.style["transform-origin"]="".concat(s[0].buildCSSText(null,null,"")," ").concat(s[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;i.style.width=yt(o)?"".concat(o,"px"):o.toString();break;case"height":var l=n.parsedStyle.height;i.style.height=yt(l)?"".concat(l,"px"):l.toString();break;case"zIndex":var u=n.parsedStyle.zIndex;i.style["z-index"]="".concat(u);break;case"visibility":var c=n.parsedStyle.visibility;i.style.visibility=c;break;case"pointerEvents":var h=n.parsedStyle.pointerEvents,d=h===void 0?"auto":h;i.style.pointerEvents=d;break;case"opacity":var g=n.parsedStyle.opacity;i.style.opacity="".concat(g);break;case"fill":var p=n.parsedStyle.fill,v="";Sf(p)?p.isNone?v="transparent":v=n.getAttribute("fill"):Array.isArray(p)?v=n.getAttribute("fill"):Do(p),i.style.background=v;break;case"stroke":var m=n.parsedStyle.stroke,b="";Sf(m)?m.isNone?b="transparent":b=n.getAttribute("stroke"):Array.isArray(m)?b=n.getAttribute("stroke"):Do(m),i.style["border-color"]=b,i.style["border-style"]="solid";break;case"lineWidth":var w=n.parsedStyle.lineWidth;i.style["border-width"]="".concat(w||0,"px");break;case"lineDash":i.style["border-style"]="dashed";break;case"filter":var x=n.style.filter;i.style.filter=x;break;default:!kt(n.style[e])&&n.style[e]!==""&&(i.style[e]=n.style[e])}}}])}();z6.tag="HTMLRendering";var iZ=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="html-renderer",e}return jt(t,r),at(t,[{key:"init",value:function(){this.addRenderingPlugin(new z6)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Us);/*!
- * @antv/g-canvas
- * @description A renderer implemented by Canvas 2D API
- * @version 2.0.39
- * @date 1/23/2025, 8:35:49 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var aZ=function(){function r(t){st(this,r),this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return at(r,[{key:"init",value:function(){var e=this.canvasConfig,n=e.container,i=e.canvas;if(i)this.$canvas=i,n&&i.parentElement!==n&&n.appendChild(i),this.$container=i.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=se(n)?document.getElementById(n):n,this.$container)){var a=document.createElement("canvas");this.$container.appendChild(a),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=a}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(e,n){var i=this.canvasConfig.devicePixelRatio;this.dpr=i,this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,LH(this.$canvas,e,n)),this.renderingContext.renderReasons.add($l.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)}},{key:"toDataURL",value:function(){var t=Bs(qn().mark(function n(){var i,a,s,o=arguments;return qn().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return i=o.length>0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,u.abrupt("return",this.context.canvas.toDataURL(a,s));case 3:case"end":return u.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),sZ=function(r){function t(){var e;st(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="canvas-context-register",e}return jt(t,r),at(t,[{key:"init",value:function(){this.context.ContextService=aZ}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(Us),mc=function(r){function t(e){var n;return st(this,t),n=qt(this,t,[e]),n.registerPlugin(new sZ),n.registerPlugin(new XK),n.registerPlugin(new kK),n.registerPlugin(new eZ),n.registerPlugin(new nZ),n.registerPlugin(new VK),n.registerPlugin(new iZ),n}return jt(t,r),at(t)}(LG),oZ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class b0 extends mi{constructor(t){super(Object.assign(Object.assign({},t),{style:Object.assign({},b0.defaultStyleProps,t.style)})),this.rootPointerEvent=new Cf(null),this.forwardEvents=e=>{const n=this.context.canvas,i=n.context.renderingContext.root.ownerDocument.defaultView;this.normalizeToPointerEvent(e,i).forEach(s=>{const o=this.bootstrapEvent(this.rootPointerEvent,s,i,e);hc(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[J.CLICK,J.POINTER_DOWN,J.POINTER_MOVE,J.POINTER_UP,J.POINTER_OVER,J.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=Lo(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=oZ(e,["dx","dy"]),[s,o]=this.getSize(t);return Object.assign(Object.assign({x:n,y:i},a),{width:s,height:o})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:i,y:a,width:s=0,height:o=0}=n,l=this.upsert("key-container",Nn,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",Lc,n,l)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof mc))return;const n=this.getDomElement();this.events.forEach(i=>{n.addEventListener(i,this.forwardEvents)})}attributeChangedCallback(t,e,n){t==="zIndex"&&e!==n&&(this.getDomElement().style.zIndex=n)}destroy(){const t=this.getDomElement();this.events.forEach(e=>{t.removeEventListener(e,this.forwardEvents)}),super.destroy()}normalizeToPointerEvent(t,e){const n=[];if(e.isTouchEvent(t))for(let i=0;i<t.changedTouches.length;i++){const a=t.changedTouches[i];Nt(a.button)&&(a.button=0),Nt(a.buttons)&&(a.buttons=1),Nt(a.isPrimary)&&(a.isPrimary=t.touches.length===1&&t.type==="touchstart"),Nt(a.width)&&(a.width=a.radiusX||1),Nt(a.height)&&(a.height=a.radiusY||1),Nt(a.tiltX)&&(a.tiltX=0),Nt(a.tiltY)&&(a.tiltY=0),Nt(a.pointerType)&&(a.pointerType="touch"),Nt(a.pointerId)&&(a.pointerId=a.identifier||0),Nt(a.pressure)&&(a.pressure=a.force||.5),Nt(a.twist)&&(a.twist=0),Nt(a.tangentialPressure)&&(a.tangentialPressure=0),a.isNormalized=!0,a.type=t.type,n.push(a)}else if(e.isMouseEvent(t)){const i=t;Nt(i.isPrimary)&&(i.isPrimary=!0),Nt(i.width)&&(i.width=1),Nt(i.height)&&(i.height=1),Nt(i.tiltX)&&(i.tiltX=0),Nt(i.tiltY)&&(i.tiltY=0),Nt(i.pointerType)&&(i.pointerType="mouse"),Nt(i.pointerId)&&(i.pointerId=1),Nt(i.pressure)&&(i.pressure=.5),Nt(i.twist)&&(i.twist=0),Nt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,n.push(i)}else n.push(t);return n}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}bootstrapEvent(t,e,n,i){t.view=n,t.originalEvent=null,t.nativeEvent=i,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:a,y:s}=this.getViewportXY(e);t.viewport.x=a,t.viewport.y=s;const[o,l]=this.context.canvas.getCanvasByViewport([a,s]);return t.canvas.x=o,t.canvas.y=l,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=i.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t}getViewportXY(t){let e,n;const{offsetX:i,offsetY:a,clientX:s,clientY:o}=t;if(!kt(i)&&!kt(a))e=i,n=a;else{const l=this.eventService.client2Viewport({x:s,y:o});e=l.x,n=l.y}return{x:e,y:n}}onframe(){super.onframe();const{opacity:t}=this.attributes;this.getDomElement().style.opacity=`${t}`}}b0.defaultStyleProps={size:[160,80],halo:!1,icon:!1,label:!1,pointerEvents:"auto"};var UM=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};let $6=class j6 extends mi{constructor(t){super(Ln({style:j6.defaultStyleProps},t))}getKeyStyle(t){const[e,n]=this.getSize(t),i=super.getKeyStyle(t),{fillOpacity:a,opacity:s=a}=i,o=UM(i,["fillOpacity","opacity"]);return Object.assign(Object.assign({opacity:s},o),{width:e,height:n,x:-e/2,y:-n/2})}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getShape("key").attributes,{fill:n,stroke:i}=e;UM(e,["fill","stroke"]);const a=gn(this.getGraphicStyle(t),"halo"),s=Number(a.lineWidth),[o,l]=It(this.getSize(t),[s,s]);return Object.assign(Object.assign({},a),{width:o,height:l,fill:"transparent",x:-o/2,y:-l/2})}getIconStyle(t){const e=super.getIconStyle(t),[n,i]=this.getSize(t);return e?Object.assign({width:n*Ga,height:i*Ga},e):!1}drawKeyShape(t,e){const n=this.upsert("key",Qx,this.getKeyStyle(t),e);return tE(this),n}drawHaloShape(t,e){this.upsert("halo",Nn,this.getHaloStyle(t),e)}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&eE(this)}};$6.defaultStyleProps={size:32};class lZ extends mi{constructor(t){super(t)}getKeyStyle(t){const[e,n]=this.getSize(t);return Object.assign(Object.assign({},super.getKeyStyle(t)),{width:e,height:n,x:-e/2,y:-n/2})}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:i}=this.getShape("key").attributes;return e?Object.assign({width:n*Ga,height:i*Ga},e):!1}drawKeyShape(t,e){return this.upsert("key",Nn,this.getKeyStyle(t),e)}}class uZ extends v0{constructor(t){super(t)}getInnerR(t){return t.innerR||this.getOuterR(t)*3/8}getOuterR(t){return Math.min(...this.getSize(t))/2}getPoints(t){return HZ(this.getOuterR(t),this.getInnerR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getInnerR(t)*2*Ga;return e?Object.assign({width:n,height:n},e):!1}getPortXY(t,e){const{placement:n="top"}=e,i=this.getShape("key").getLocalBounds(),a=UZ(this.getOuterR(t),this.getInnerR(t));return sE(i,n,a,!1)}}class w0 extends v0{constructor(t){super(Ln({style:w0.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,i]=this.getSize(t);return YZ(n,i,e)}getPortXY(t,e){const{direction:n}=t,{placement:i="top"}=e,a=this.getShape("key").getLocalBounds(),[s,o]=this.getSize(t),l=XZ(s,o,n);return sE(a,i,l,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:i,direction:a}=t;if(e===!1||Ji(n||i))return!1;const s=gn(this.getGraphicStyle(t),"icon"),o=this.getShape("key").getLocalBounds(),[l,u]=hX(o,a),c=dX(o,a)*2*Ga;return Object.assign({x:l,y:u,width:c,height:c},s)}}w0.defaultStyleProps={size:40,direction:"up"};var YM=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Ql extends mi{constructor(t){super(Ln({style:Ql.defaultStyleProps},t)),this.type="combo",this.updateComboPosition(this.parsedAttributes)}getKeySize(t){const{collapsed:e,childrenNode:n=[]}=t;return n.length===0?this.getEmptyKeySize(t):e?this.getCollapsedKeySize(t):this.getExpandedKeySize(t)}getEmptyKeySize(t){const{padding:e,collapsedSize:n}=t,[i,a,s,o]=ua(e);return It(Vr(n),[o+a,i+s,0])}getCollapsedKeySize(t){return Vr(t.collapsedSize)}getExpandedKeySize(t){const e=this.getContentBBox(t);return[ca(e),ha(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,i=e.map(s=>this.context.element.getElement(s)).filter(Boolean);if(i.length===0){const s=new Me,{x:o=0,y:l=0,size:u}=t,[c,h]=Vr(u);return s.setMinMax([o-c/2,l-h/2,0],[o+c/2,l+h/2,0]),s}const a=Dc(i.map(s=>s.getBounds()));return n?Ks(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",O6,n,e),tE(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=gn(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=YM(e,["type"]),a=this.getShape("key"),[s,o]=Aa(a.getLocalBounds(),"center"),l=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const u=this.getCollapsedMarkerText(n,t);Object.assign(l,{text:u})}return l}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:i}=this.context;return t==="descendant-count"?i.getDescendantsData(this.id).length.toString():t==="child-count"?n.length.toString():t==="node-count"?i.getDescendantsData(this.id).filter(a=>i.getElementType(H(a))==="node").length.toString():Et(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:i,childrenData:a=[]}=t;if(a.length===0)return[+e,+n,0];if(i){const{model:s}=this.context,o=s.getDescendantsData(this.id).filter(l=>!s.isCombo(H(l)));if(o.length>0&&o.some(zX)){const l=o.reduce((u,c)=>It(u,cn(c)),[0,0,0]);return Fi(l,o.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:i}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:i}}),eE(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(i=>{var{x:a,y:s,z:o,transform:l}=i,u=YM(i,["x","y","z","transform"]);return u}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Ql.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class cZ extends Ql{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Ya,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&gn(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=Vr(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=Xs(e),a=Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2;return[a*2,a*2,0]}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return g0(t,n,e)}}class hZ extends Ql{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Nn,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&gn(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}const dZ={padding:10};function XM(r,t,e,n,i,a){const{padding:s}=Object.assign(dZ,a),o=Ms(e,s),l=Ms(n,s),u=[r,...i,t];let c=null;const h=[];for(let d=0,g=u.length;d<g-1;d++){const p=d+1,v=u[d],m=u[p],b=qX(v,m);let w=null;if(d===0)if(p===g-1)if(o.intersects(l))w=qv(v,m,o,l);else if(!Af(v,o)&&!Af(m,l)){const x=To(v,o),S=To(m,l);w=ZM(x,S,lr(x,S)),w.points.unshift(x),w.points.push(S)}else b||(w=gZ(v,m,o,l));else Di(m,o)?w=qv(v,m,o,Ms(m,s),c):b||(w=Qd(v,m,o));else p===g-1?Di(v,l)?w=qv(v,m,Ms(v,s),l,c):b||(w=q6(v,m,l,c)):b||(w=ZM(v,m,c));w?(h.push(...w.points),c=w.direction):c=lr(v,m),p<g-1&&h.push(m)}return h.map(zo)}const fZ={N:"S",S:"N",W:"E",E:"W"},KM={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function lr(r,t){const[e,n]=r,[i,a]=t;return e===i?n>a?"N":"S":n===a?e>i?"W":"E":null}function $w(r,t){return t==="N"||t==="S"?ha(r):ca(r)}function ZM(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=lr(r,n),s=lr(r,i),o=e?fZ[e]:null,l=a===e||a!==o&&s!==e?n:i;return{points:[l],direction:lr(l,t)}}function Qd(r,t,e){if(Af(r,e)){const n=yc(r,t,e);return{points:[n],direction:lr(n,t)}}else{const n=To(r,e),a=["left","right"].includes(ac(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:lr(a,t)}}}function q6(r,t,e,n){const i=Af(t,e)?t:To(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(l=>cX(l,e)&&!o6(l,e,!0)),o=s.filter(l=>lr(l,r)!==n);if(o.length>0){const l=o.find(u=>lr(r,u)===n)||o[0];return{points:[l],direction:lr(l,t)}}else{const l=yW(a,s)[0],u=Is(t,l,$w(e,n)/2);return{points:[yc(u,r,e),u],direction:lr(u,t)}}}function gZ(r,t,e,n){let i=Qd(r,t,e);const a=vc(i.points[0]);if(Di(a,n)){i=Qd(t,r,n);const s=vc(i.points[0]);if(Di(s,e)){const o=Is(r,a,$w(e,lr(r,a))/2),l=Is(t,s,$w(n,lr(t,s))/2),u=[(o[0]+l[0])/2,(o[1]+l[1])/2],c=Qd(r,u,e),h=q6(u,t,n,c.direction);i.points=[c.points[0],h.points[0]],i.direction=h.direction}}return i}function qv(r,t,e,n,i){const s=Dc([e,n]),o=Ne(t,s.center)>Ne(r,s.center),[l,u]=o?[t,r]:[r,t],c=ha(s)+ca(s);let h;if(i){const p=[l[0]+c*Math.cos(KM[i]),l[1]+c*Math.sin(KM[i])];h=Is(To(p,s),p,.01)}else h=Is(To(l,s),l,-.01);let d=yc(h,u,s),g=[Pu(h,2),Pu(d,2)];if(Ze(Pu(h),Pu(d))){const p=Kx(be(h,l),[1,0,0])+Math.PI/2;d=[u[0]+c*Math.cos(p),u[1]+c*Math.sin(p),0],d=Pu(Is(To(d,s),u,-.01),2);const v=yc(h,d,s);g=[h,v,d]}return{points:o?g.reverse():g,direction:lr(o?h:d,t)}}function yc(r,t,e){let n=[r[0],t[1]];return Di(n,e)&&(n=[t[0],r[1]]),n}function W6(r,t,e,n,i){let l=typeof t=="number"?t:.5;t==="start"&&(l=0),t==="end"&&(l=.99);const u=jn(r.getPoint(l)),c=jn(r.getPoint(l+.01));let h=t==="start"?"left":t==="end"?"right":"center";if(y6(u,c)||!e){const[b,w]=JM(r,l,n,i);return{transform:[["translate",b,w]],textAlign:h}}let d=Math.atan2(c[1]-u[1],c[0]-u[0]);c[0]<u[0]&&(h=h==="center"?h:h==="left"?"right":"left",n*=-1,d+=Math.PI);const[p,v]=JM(r,l,n,i,d),m=[["translate",p,v],["rotate",d/Math.PI*180]];return{textAlign:h,transform:m}}function pZ(r,t,e,n,i){var a,s;const o=((a=r.badge)===null||a===void 0?void 0:a.getGeometryBounds().halfExtents[0])*2||0,l=((s=r.label)===null||s===void 0?void 0:s.getGeometryBounds().halfExtents[0])*2||0;return W6(r.key,e,!0,(l?(l/2+o/2)*(t==="suffix"?1:-1):0)+n,i)}function JM(r,t,e,n,i){const[a,s]=jn(r.getPoint(t));let o=e,l=n;return i&&(o=e*Math.cos(i)-n*Math.sin(i),l=e*Math.sin(i)+n*Math.cos(i)),[a+o,s+l]}function jw(r,t,e,n){if(Ze(r,t))return r;const i=be(t,r),a=[r[0]+e*i[0],r[1]+e*i[1]],s=$a(f0(i,!1));return a[0]+=n*s[0],a[1]+=n*s[1],a}function vZ(r){return yt(r)?[r,-r]:r}function mZ(r){return yt(r)?[r,1-r]:r}function yZ(r,t,e){return[["M",r[0],r[1]],["Q",e[0],e[1],t[0],t[1]]]}function G6(r,t,e){return[["M",r[0],r[1]],["C",e[0][0],e[0][1],e[1][0],e[1][1],t[0],t[1]]]}function iE(r,t=0,e=!1){const n=r[0],i=r[r.length-1],a=r.slice(1,r.length-1),s=[["M",n[0],n[1]]];return a.forEach((o,l)=>{const u=a[l-1]||n,c=a[l+1]||i;if(!b6(u,o,c)&&t){const[h,d]=bZ(u,o,c,t);s.push(["L",h[0],h[1]],["Q",o[0],o[1],d[0],d[1]],["L",d[0],d[1]])}else s.push(["L",o[0],o[1]])}),s.push(["L",i[0],i[1]]),e&&s.push(["Z"]),s}function bZ(r,t,e,n){const i=Pf(r,t),a=Pf(e,t),s=Math.min(n,Math.min(i,a)/2),o=[t[0]-s/i*(t[0]-r[0]),t[1]-s/i*(t[1]-r[1])],l=[t[0]-s/a*(t[0]-e[0]),t[1]-s/a*(t[1]-e[1])];return[o,l]}const wZ=r=>{const t=Math.PI/2,e=ha(r)/2,n=ca(r)/2,i=Math.atan2(e,n)/2,a=Math.atan2(n,e)/2;return{top:[-t-a,-t+a],"top-right":[-t+a,-i],"right-top":[-t+a,-i],right:[-i,i],"bottom-right":[i,t-a],"right-bottom":[i,t-a],bottom:[t-a,t+a],"bottom-left":[t+a,Math.PI-i],"left-bottom":[t+a,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-t-a],"left-top":[Math.PI+i,-t-a]}};function V6(r,t,e,n,i){const a=Ms(r),s=r.getCenter();let o=n&&js(n),l=i&&js(i);if(!o||!l){const u=wZ(a),c=u[t][0],h=u[t][1],[d,g]=Xs(a),p=Math.max(d,g),v=It(s,[p*Math.cos(c),p*Math.sin(c),0]),m=It(s,[p*Math.cos(h),p*Math.sin(h),0]);o=Ww(r,v),l=Ww(r,m),e||([o,l]=[l,o])}return[o,l]}function xZ(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[l,u]=V6(r,t,e,s,o);const c=EZ(r,l,u,n);return s&&(l=bc(s,c[0])),o&&(u=bc(o,c[c.length-1])),G6(l,u,c)}function EZ(r,t,e,n){const i=r.getCenter();if(Ze(t,e)){const a=be(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[It(t,s),It(e,Oa(s,[1,-1,1]))]}return[Is(i,t,Ne(i,t)+n),Is(i,e,Ne(i,e)+n)]}function _Z(r,t,e,n,i,a,s){const o=oE(r),l=o[a||s],u=o[s||a];let[c,h]=V6(r,e,n,l,u);const d=SZ(r,c,h,i);return l&&(c=bc(l,d[0])),u&&(h=bc(u,d[d.length-1])),iE([c,...d,h],t)}function SZ(r,t,e,n){const i=[],a=Ms(r);if(Ze(t,e))switch(ac(t,a)){case"left":i.push([t[0]-n,t[1]]),i.push([t[0]-n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"right":i.push([t[0]+n,t[1]]),i.push([t[0]+n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"top":i.push([t[0],t[1]-n]),i.push([t[0]+n,t[1]-n]),i.push([t[0]+n,t[1]]);break;case"bottom":i.push([t[0],t[1]+n]),i.push([t[0]+n,t[1]+n]),i.push([t[0]+n,t[1]]);break}else{const s=ac(t,a),o=ac(e,a);if(s===o){const l=s;let u,c;switch(l){case"left":u=Math.min(t[0],e[0])-n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"right":u=Math.max(t[0],e[0])+n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"top":c=Math.min(t[1],e[1])-n,i.push([t[0],c]),i.push([e[0],c]);break;case"bottom":c=Math.max(t[1],e[1])+n,i.push([t[0],c]),i.push([e[0],c]);break}}else{const l=(d,g)=>({left:[g[0]-n,g[1]],right:[g[0]+n,g[1]],top:[g[0],g[1]-n],bottom:[g[0],g[1]+n]})[d],u=l(s,t),c=l(o,e),h=yc(u,c,a);i.push(u,h,c)}}return i}function qw(r,t){const e=new Set,n=new Set,i=new Set;return r.forEach(a=>{t(a).forEach(o=>{e.add(o),r.includes(o.source)&&r.includes(o.target)?n.add(o):i.add(o)})}),{edges:Array.from(e),internal:Array.from(n),external:Array.from(i)}}function QM(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(H(n));if(i)n=i;else break}if(e.some(i=>{var a;return(a=i.style)===null||a===void 0?void 0:a.collapsed})){const i=e.reverse().findIndex(_r);return e[i]||e.at(-1)}return r}function MZ(r,t){return t||(r<4?10:r===4?12:r*2.5)}const kZ=(r,t)=>{const e=Math.max(r,t)/2;return[["M",-r/2,0],["A",e,e,0,1,0,2*e-r/2,0],["A",e,e,0,1,0,-r/2,0],["Z"]]},H6=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],CZ=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],TZ=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],OZ=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],AZ=(r,t)=>{const e=r/2,n=r/7,i=r-n;return[["M",-e,0],["L",0,-t/2],["L",0,t/2],["Z"],["M",i-e,-t/2],["L",i+n-e,-t/2],["L",i+n-e,t/2],["L",i-e,t/2],["Z"]]},PZ=(r,t)=>[["M",r/2,-t/2],["L",-r/2,0],["L",r/2,0],["L",-r/2,0],["L",r/2,t/2]],NZ=Object.freeze(Object.defineProperty({__proto__:null,circle:kZ,diamond:CZ,rect:OZ,simple:PZ,triangle:H6,triangleRect:AZ,vee:TZ},Symbol.toStringTag,{value:"Module"}));var Sd=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Js extends A6{constructor(t){super(Ln({style:Js.defaultStyleProps},t)),this.type="edge"}get sourceNode(){const{sourceNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}get targetNode(){const{targetNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}getKeyStyle(t){const e=this.getGraphicStyle(t),{loop:n}=e,i=Sd(e,["loop"]),{sourceNode:a,targetNode:s}=this,l={d:n&&qZ(a,s)?this.getLoopPath(t):this.getKeyPath(t)};return jr.PARSED_STYLE_LIST.forEach(u=>{u in i&&(l[u]=i[u])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=Ms(i),s=Math.max(ca(a),ha(a)),{placement:o,clockwise:l,dist:u=s}=gn(this.getGraphicStyle(t),"loop");return xZ(i,o,l,u,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[l,u]=GZ(s,o,i,a);if(!e){const g=l?js(l):s.getCenter(),p=u?js(u):o.getCenter();return[g,p]}const c=typeof n=="function"?n():n,h=ik(l||s,c[0]||u||o),d=ik(u||o,c[c.length-1]||l||s);return[h,d]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=gn(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=gn(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,l=Sd(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),u=W6(this.shapeMap.key,n,s,i,a),c=this.shapeMap.key.getLocalBounds(),h=rK([c.min,c.max],o);return Object.assign({wordWrapWidth:h},u,l)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=gn(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=Sd(e,["offsetX","offsetY","placement"]);return Object.assign(s,pZ(this.shapeMap,a,t.labelPlacement,n,i))}drawArrow(t,e){var n;const i=e==="start",s=t[e==="start"?"startArrow":"endArrow"],o=this.shapeMap.key;if(s){const l=this.getArrowStyle(t,i),[u,c,h]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],d=o.parsedStyle[u];if(d)d.attr(l);else{const g=l.src?Ic:jr,p=new g({style:l});o.style[u]=p}o.style[c]=t[h]||l.width/2+ +l.lineWidth}else{const l=i?"markerStart":"markerEnd";(n=o.style[l])===null||n===void 0||n.destroy(),o.style[l]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=gn(this.getGraphicStyle(t),i),{size:s,type:o}=a,l=Sd(a,["size","type"]),[u,c]=Vr(MZ(n.lineWidth,s)),d=(Et(o)?o:NZ[o]||H6)(u,c);return Object.assign(Lo(n,["stroke","strokeOpacity","fillOpacity"]),{width:u,height:c},Object.assign({},d&&{d,fill:o==="simple"?"":n.stroke}),l)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Zs,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",jr,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",ja,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",jr,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Js.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class Ho extends Js{constructor(t){super(Ln({style:Ho.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,mZ(a),vZ(s),i);return G6(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[jw(t,e,n[0],i[0]),jw(t,e,n[1],i[1])]}}Ho.defaultStyleProps={curvePosition:.5,curveOffset:20};class jc extends Ho{constructor(t){super(Ln({style:jc.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[0]-t[0];return[[t[0]+a*n[0]+i[0],t[1]],[e[0]-a*n[1]+i[1],e[1]]]}}jc.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class x0 extends Ho{constructor(t){super(Ln({style:x0.defaultStyleProps},t))}get ref(){return this.context.model.getRootsData()[0]}getEndpoints(t){if(this.sourceNode.id===this.ref.id)return super.getEndpoints(t);const e=cn(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=cn(this.ref),n=Ne(t,e),i=p6(be(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),l=o-a;return[[t[0]+(l*n[0]+i[0])*Math.cos(s),t[1]+(l*n[0]+i[0])*Math.sin(s)],[e[0]-(l*n[1]-i[0])*Math.cos(s),e[1]-(l*n[1]-i[0])*Math.sin(s)]]}}x0.defaultStyleProps={curvePosition:.5,curveOffset:20};class E0 extends Ho{constructor(t){super(Ln({style:E0.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[1]-t[1];return[[t[0],t[1]+a*n[0]+i[0]],[e[0],e[1]-a*n[1]+i[1]]]}}E0.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let U6=class Y6 extends Js{constructor(t){super(Ln({style:Y6.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};U6.defaultStyleProps={};const RZ={enableObstacleAvoidance:!1,offset:10,maxAllowedDirectionChange:Math.PI/2,maximumLoops:3e3,gridSize:5,startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{right:{stepX:1,stepY:0},left:{stepX:-1,stepY:0},bottom:{stepX:0,stepY:1},top:{stepX:0,stepY:-1}},penalties:{0:0,90:0},distFunc:Pf},Ma=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function _o(r,t){const e=n=>Math.round(n/t);return yt(r)?e(r):r.map(e)}function LZ(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function tk(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function X6(r,t,e,n){const i=tk(r,t),a=e[Ma(r)],o=tk(a||n,r);return LZ(o,i)}const IZ=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=Ks(a.getRenderBounds(),e);for(let o=_o(s.min[0],n);o<=_o(s.max[0],n);o+=1)for(let l=_o(s.min[1],n);l<=_o(s.max[1],n);l+=1)i[`${o}|||${l}`]=!0}),i};function ek(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function DZ(r,t,e){let n=r[0],i=e(r[0],t);for(let a=0;a<r.length;a++){const s=r[a],o=e(s,t);o<i&&(n=s,i=o)}return n}const nk=(r,t,e,n)=>{if(!t)return[r];const{directionMap:i,offset:a}=n,s=Ks(t.getRenderBounds(),a),o=Object.keys(i).reduce((l,u)=>{if(e.includes(u)){const c=i[u],[h,d]=Xs(s),g=[r[0]+c.stepX*h,r[1]+c.stepY*d],p=fX(s);for(let v=0;v<p.length;v++){const m=Zx([r,g],p[v]);m&&o6(m,s)&&l.push(m)}}return l},[]);return Di(r,s)||o.push(r),o.map(l=>_o(l,n.gridSize))},FZ=(r,t,e,n,i,a,s)=>{const o=[];let l=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(l);let u=r,c=t[Ma(u)];for(;c;){const g=c,p=u;X6(g,p,t,e)&&(l=[g[0]===p[0]?l[0]:g[0]*s,g[1]===p[1]?l[1]:g[1]*s],o.unshift(l)),c=t[Ma(g)],u=g}const h=i.map(g=>[g[0]*s,g[1]*s]),d=DZ(h,l,Pf);return o.unshift(d),o};function BZ(r,t,e,n){const i=zo(r.getCenter()),a=zo(t.getCenter()),s=Object.assign(RZ,n),{gridSize:o}=s,l=s.enableObstacleAvoidance?e:[r,t],u=IZ(l,s),c=_o(i,o),h=_o(a,o),d=nk(i,r,s.startDirections,s),g=nk(a,t,s.endDirections,s);d.forEach(C=>delete u[Ma(C)]),g.forEach(C=>delete u[Ma(C)]);const p={},v={},m={},b={},w={},x=new zZ;for(let C=0;C<d.length;C++){const P=d[C],T=Ma(P);p[T]=P,b[T]=0,w[T]=ek(P,g,s.distFunc),x.add({id:T,value:w[T]})}const S=g.map(C=>Ma(C));let _=s.maximumLoops,k,M=1/0;for(const[C,P]of Object.entries(p))w[C]<=M&&(M=w[C],k=P);for(;Object.keys(p).length>0&&_>0;){const C=x.minId(!1);if(C)k=p[C];else break;const P=Ma(k);if(S.includes(P))return FZ(k,m,c,a,d,h,o);delete p[P],x.remove(P),v[P]=!0;for(const T of Object.values(s.directionMap)){const A=It(k,[T.stepX,T.stepY]),R=Ma(A);if(v[R])continue;const L=X6(k,A,m,c);if(L>s.maxAllowedDirectionChange||u[R])continue;p[R]||(p[R]=A);const $=s.penalties[L],q=s.distFunc(k,A)+(isNaN($)?o:$),j=b[P]+q,B=b[R];B&&j>=B||(m[R]=k,b[R]=j,w[R]=j+ek(A,g,s.distFunc),x.add({id:R,value:w[R]}))}_-=1}return[]}class zZ{constructor(){this.arr=[],this.map={},this.arr=[],this.map={}}_innerAdd(t,e){let n=0,i=e-1;for(;i-n>1;){const a=Math.floor((n+i)/2);if(this.arr[a].value>t.value)i=a;else if(this.arr[a].value<t.value)n=a;else{this.arr.splice(a,0,t),this.map[t.id]=!0;return}}this.arr.splice(i,0,t),this.map[t.id]=!0}add(t){delete this.map[t.id];const e=this.arr.length;if(!e||this.arr[e-1].value<t.value){this.arr.push(t),this.map[t.id]=!0;return}this._innerAdd(t,e)}remove(t){this.map[t]&&delete this.map[t]}_clearAndGetMinId(){let t;for(let e=this.arr.length-1;e>=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t}_findFirstId(){for(;this.arr.length;){const t=this.arr.shift();if(this.map[t.id])return t.id}}minId(t){return t?this._clearAndGetMinId():this._findFirstId()}}class _0 extends Js{constructor(t){super(Ln({style:_0.defaultStyleProps},t))}getControlPoints(t){const{router:e}=t,{sourceNode:n,targetNode:i}=this,[a,s]=this.getEndpoints(t,!1);let o=[];if(!e)o=t.controlPoints;else if(e.type==="shortest-path"){const l=this.context.element.getNodes();o=BZ(n,i,l,e),o.length||(o=XM(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=XM(a,s,n,i,t.controlPoints,e));return o}getPoints(t){const e=this.getControlPoints(t),[n,i]=this.getEndpoints(t,!0,e);return[n,...e,i]}getKeyPath(t){const e=this.getPoints(t);return iE(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=Ms(a),o=Math.max(ca(s),ha(s))/4,{placement:l,clockwise:u,dist:c=o}=gn(this.getGraphicStyle(t),"loop");return _Z(a,i,l,u,c,e,n)}}_0.defaultStyleProps={radius:0,controlPoints:[],router:!1};class S0 extends Js{constructor(t){super(Ln({style:S0.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||jw(i,a,e,n);return yZ(i,a,s)}}S0.defaultStyleProps={curvePosition:.5,curveOffset:30};var $Z=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function qc(r){return r instanceof mi&&r.type==="node"}function K6(r){return r instanceof Js}function aE(r){return r instanceof Ql}function jZ(r){return qc(r)||K6(r)||aE(r)}function qZ(r,t){return!r||!t?!1:r===t}const WZ={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],default:[.5,.5]};function sE(r,t,e=WZ,n=!0){const i=[.5,.5],a=se(t)?sr(e,t.toLocaleLowerCase(),i):t;if(!n&&se(t))return a;const[s,o]=a||i;return[r.min[0]+ca(r)*s,r.min[1]+ha(r)*o]}function oE(r){if(!r)return{};const t=r.getPorts();return(r.attributes.ports||[]).forEach((n,i)=>{var a;const{key:s,placement:o}=n;Z6(n)&&(t[a=s||i]||(t[a]=Aa(r.getShape("key").getBounds(),o)))}),t}function Z6(r){const{r:t}=r;return!t||Number(t)===0}function js(r){return Yl(r)?r:r.getPosition()}function GZ(r,t,e,n){const i=rk(r,t,e,n),a=rk(t,r,n,e);return[i,a]}function rk(r,t,e,n){const i=oE(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(u=>js(u)),o=VZ(t,n),[l]=VX(s,o);return a.find(u=>js(u)===l)}function VZ(r,t){const e=oE(r);if(t)return[js(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>js(i)):[r.getCenter()]}function ik(r,t){return aE(r)||qc(r)?Ww(r,t):bc(r,t)}function bc(r,t){if(!r||!t)return[0,0,0];if(Yl(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=Yl(t)?t:qc(t)?t.getCenter():t.getPosition();return g0(e,r.getBounds())}function Ww(r,t){if(!r||!t)return[0,0,0];const e=Yl(t)?t:qc(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function ak(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=Aa(r,t),l=a.includes("left")?"right":a.includes("right")?"left":"center";let u=a.includes("top")?"bottom":a.includes("bottom")?"top":"middle";return i&&(u=u==="top"?"bottom":u==="bottom"?"top":u),{transform:[["translate",s+e,o+n]],textBaseline:u,textAlign:l}}function HZ(r,t){return[[0,-r],[t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)],[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[0,t],[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[-t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[-t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)]]}function UZ(r,t){const e={};return e.top=[0,-r],e.left=[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e["left-bottom"]=[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.bottom=[0,t],e["right-bottom"]=[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.right=e.default=[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e}function YZ(r,t,e){const n=t/2,i=r/2,a={up:[[-i,n],[i,n],[0,-n]],left:[[-i,0],[i,n],[i,-n]],right:[[-i,n],[-i,-n],[i,0]],down:[[-i,-n],[i,-n],[0,n]]};return a[e]||a.up}function XZ(r,t,e){const n=t/2,i=r/2,a={};return e==="down"?(a.bottom=a.default=[0,n],a.right=[i,-n],a.left=[-i,-n]):e==="left"?(a.top=[i,-n],a.bottom=[i,n],a.left=a.default=[-i,0]):e==="right"?(a.top=[-i,-n],a.bottom=[-i,n],a.right=a.default=[i,0]):(a.left=[-i,n],a.top=a.default=[0,-n],a.right=[i,n]),a}function KZ(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function ZZ(r){return sr(r,["style","visibility"])!=="hidden"}function JZ(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:l}=t,u=$Z(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,u),n&&r.setAttribute("transform",n),yt(e)&&r.setAttribute("zIndex",e),i&&r.setAttribute("transformOrigin",i),a&&r.setAttribute("visibility",a),s&&r.setAttribute("cursor",s),o&&r.setAttribute("clipPath",o),l&&r.setAttribute("component",l)}function Gw(r,t){"update"in r?r.update(t):r.attr(t)}function QZ(r){return[[0,r],[r*Math.sqrt(3)/2,r/2],[r*Math.sqrt(3)/2,-r/2],[0,-r],[-r*Math.sqrt(3)/2,-r/2],[-r*Math.sqrt(3)/2,r/2]]}function tJ(r){hc(r,"__to_be_destroyed__",!0)}function M0(r){return sr(r,"__to_be_destroyed__",!1)}var eJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class k0 extends Cr{constructor(t,e){super(t,Object.assign({},k0.defaultOptions,e)),this.onCollapseExpand=n=>eJ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!jZ(i))return;const a=i.id,{model:s,graph:o}=this.context,l=s.getElementDataById(a);if(!l)return!1;const{onCollapse:u,onExpand:c,animation:h,align:d}=this.options;_r(l)?(yield o.expandElement(a,{animation:h,align:d}),c==null||c(a)):(yield o.collapseElement(a,{animation:h,align:d}),u==null||u(a))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}k0.defaultOptions={enable:!0,animation:!0,trigger:J.DBLCLICK,align:!0};var Md=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const nJ="g6-create-edge-assist-edge-id",kd="g6-create-edge-assist-node-id";class C0 extends Cr{constructor(t,e){super(t,Object.assign({},C0.defaultOptions,e)),this.drop=n=>Md(this,void 0,void 0,function*(){const{targetType:i}=n;["combo","node"].includes(i)&&this.source?yield this.handleCreateEdge(n):yield this.cancelEdge()}),this.handleCreateEdge=n=>Md(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:l,batch:u,element:c}=this.context,{style:h}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}u.startBatch(),l.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const d=o.getElementData(this.source);o.addNodeData([{id:kd,style:{visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:(i=d.style)===null||i===void 0?void 0:i.x,y:(a=d.style)===null||a===void 0?void 0:a.y}}]),o.addEdgeData([{id:nJ,source:this.source,target:kd,style:Object.assign({pointerEvents:"none"},h)}]),yield(s=c.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>Md(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(kd,[n.canvas.x,n.canvas.y]),yield(i=s.draw({animation:!1,silence:!0}))===null||i===void 0?void 0:i.finished}),this.createEdge=n=>{var i,a;const{graph:s}=this.context,{style:o,onFinish:l,onCreate:u}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const h=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],d=`${this.source}-${h}-${zW()}`,g=u({id:d,source:this.source,target:h,style:o});s.addEdgeData([g]),l(g)},this.cancelEdge=()=>Md(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([kd]),this.source=void 0,yield(n=a.draw({animation:!1}))===null||n===void 0?void 0:n.finished,s.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;this.unbindEvents(),e==="click"?(t.on(fi.CLICK,this.handleCreateEdge),t.on(xo.CLICK,this.handleCreateEdge),t.on(qa.CLICK,this.cancelEdge),t.on(Of.CLICK,this.cancelEdge)):(t.on(fi.DRAG_START,this.handleCreateEdge),t.on(xo.DRAG_START,this.handleCreateEdge),t.on(J.POINTER_UP,this.drop)),t.on(J.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(fi.CLICK,this.handleCreateEdge),t.off(xo.CLICK,this.handleCreateEdge),t.off(qa.CLICK,this.cancelEdge),t.off(Of.CLICK,this.cancelEdge),t.off(fi.DRAG_START,this.handleCreateEdge),t.off(xo.DRAG_START,this.handleCreateEdge),t.off(J.POINTER_UP,this.drop),t.off(J.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}C0.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};var sk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class T0 extends Cr{constructor(t,e){super(t,Object.assign({},T0.defaultOptions,e)),this.isDragging=!1,this.onDragStart=n=>{this.validate(n)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=n=>{var i,a,s,o;if(!this.isDragging)return;const l=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,u=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;l|u&&this.translate([l,u],!1)},this.onDragEnd=()=>{var n,i;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},this.invokeOnFinish=Oc(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new Jl(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(un(t)){const{up:e=[],down:n=[],left:i=[],right:a=[]}=t;this.shortcut.bind(e,s=>this.onTranslate([0,1],s)),this.shortcut.bind(n,s=>this.onTranslate([0,-1],s)),this.shortcut.bind(i,s=>this.onTranslate([1,0],s)),this.shortcut.bind(a,s=>this.onTranslate([-1,0],s))}else{const{graph:e}=this.context;e.on(J.DRAG_START,this.onDragStart),e.on(J.DRAG,this.onDrag),e.on(J.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return sk(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Oa(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return sk(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),yield this.context.graph.translateBy(t,e)})}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=ua(this.options.range),h=[s*o,a*l,s*u,a*c],d=Ks(Hx(n.getCanvasCenter()),h),g=be(n.getViewportCenter(),[t,e,0]);if(!Di(g,d)){const{min:[p,v],max:[m,b]}=d;(g[0]<p&&t>0||g[0]>m&&t<0)&&(t=0),(g[1]<v&&e>0||g[1]>b&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return typeof e=="function"?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:t}=this.context;t.off(J.DRAG_START,this.onDragStart),t.off(J.DRAG,this.onDrag),t.off(J.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}T0.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var ok=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Wc extends Cr{constructor(t,e){super(t,Object.assign({},Wc.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>ok(this,void 0,void 0,function*(){var i;if(this.options.dropEffect!=="link")return;const{model:a,element:s}=this.context,o=n.target.id;this.target.forEach(l=>{const u=a.getParentData(l,we);u&&H(u)===o&&a.refreshComboData(o),a.setParent(l,o,we)}),yield(i=s==null?void 0:s.draw({animation:!0}))===null||i===void 0?void 0:i.finished}),this.setCursor=n=>{if(this.isDragging)return;const{type:i}=n,{canvas:a}=this.context,{cursor:s}=this.options;i===J.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.addEventListener("blur",this.onDragEnd),n.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.on(`${i}:${J.DRAG_START}`,this.onDragStart),t.on(`${i}:${J.DRAG}`,this.onDrag),t.on(`${i}:${J.DRAG_END}`,this.onDragEnd),t.on(`${i}:${J.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${J.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(xo.DROP,this.onDrop),t.on(qa.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return Fi([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:i,graph:a}=this.context;i.setCursor(((e=this.options.cursor)===null||e===void 0?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const s=t.target.id;a.getElementState(s).includes(this.options.state)?this.target=this.getSelectedNodeIDs([s]):this.target=[s],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:s=0,y:o=0}=this.shadow.attributes,[l,u]=be([+s,+o],this.shadowOrigin);this.moveElement(this.target,[l,u])}this.showEdges(),(e=(t=this.options).onFinish)===null||e===void 0||e.call(t,this.target);const{batch:i,canvas:a}=this.context;i.endBatch(),a.setCursor(((n=this.options.cursor)===null||n===void 0?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}moveElement(t,e){return ok(this,void 0,void 0,function*(){const{graph:n,model:i}=this.context,{dropEffect:a}=this.options;a==="move"&&t.forEach(s=>i.refreshComboData(s)),n.translateElementBy(Object.fromEntries(t.map(s=>[s,e])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[i,a]=t;this.shadow.attr({x:+e+i,y:+n+a})}createShadow(t){const e=gn(this.options,"shadow"),n=Dc(t.map(u=>this.context.element.getElement(u).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=Xs(n),l={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),l),{visibility:"visible"})):(this.shadow=new Nn({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),l),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||this.hiddenEdges.length===0||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if(t==="none"||e)return;const{graph:n}=this.context;t==="all"?this.hiddenEdges=n.getEdgeData().map(H):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(H)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.removeEventListener("blur",this.onDragEnd),n.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.off(`${i}:${J.DRAG_START}`,this.onDragStart),t.off(`${i}:${J.DRAG}`,this.onDrag),t.off(`${i}:${J.DRAG_END}`,this.onDragEnd),t.off(`${i}:${J.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${J.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${J.DROP}`,this.onDrop),t.off(`canvas:${J.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}Wc.defaultOptions={animation:!0,enable:r=>["node","combo"].includes(r.targetType),dropEffect:"move",state:"selected",hideEdge:"none",shadow:!1,shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5],cursor:{default:"default",grab:"grab",grabbing:"grabbing"}};var rJ="*",O0=function(){function r(){this._events={}}return r.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},r.prototype.once=function(t,e){return this.on(t,e,!0)},r.prototype.emit=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=this._events[t]||[],s=this._events[rJ]||[],o=function(l){for(var u=l.length,c=0;c<u;c++)if(l[c]){var h=l[c],d=h.callback,g=h.once;g&&(l.splice(c,1),l.length===0&&delete e._events[t],u--,c--),d.apply(e,n)}};o(a),o(s)},r.prototype.off=function(t,e){if(!t)this._events={};else if(!e)delete this._events[t];else{for(var n=this._events[t]||[],i=n.length,a=0;a<i;a++)n[a].callback===e&&(n.splice(a,1),i--,a--);n.length===0&&delete this._events[t]}return this},r.prototype.getEvents=function(){return this._events},r}();function Vw(r,t,e,n){for(;r.length;){const i=r.shift();if(e(i))return!0;t.add(i.id),n(i.id).forEach(s=>{t.has(s.id)||(t.add(s.id),r.push(s))})}return!1}function Ff(r,t,e,n){if(e(r))return!0;t.add(r.id);for(const a of n(r.id))if(!t.has(a.id)&&Ff(a,t,e,n))return!0;return!1}const lk=()=>!0;class iJ{constructor(t){oe(this,"graph");oe(this,"nodeFilter");oe(this,"edgeFilter");oe(this,"cacheEnabled");oe(this,"inEdgesMap",new Map);oe(this,"outEdgesMap",new Map);oe(this,"bothEdgesMap",new Map);oe(this,"allNodesMap",new Map);oe(this,"allEdgesMap",new Map);oe(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});oe(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});oe(this,"updateCache",t=>{const e=new Set;t.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(a=>e.add(a.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const a=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),s=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...a,...s]));o.forEach(l=>e.add(l.id)),this.inEdgesMap.set(n,a),this.outEdgesMap.set(n,s),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),e.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});oe(this,"handleGraphChanged",t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":(n.propertyName==="source"||n.propertyName==="target")&&(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const i=t.graph.getEdge(n.id);e.add(i.source),e.add(i.target)}break;case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"NodeRemoved":e.add(n.value.id);break}}),this.updateCache(e)});this.graph=t.graph;const e=t.nodeFilter||lk,n=t.edgeFilter||lk;this.nodeFilter=e,this.edgeFilter=i=>{const{source:a,target:s}=this.graph.getEdgeDetail(i.id);return!e(a)||!e(s)?!1:n(i,a,s)},t.cache==="auto"?(this.cacheEnabled=!0,this.startAutoCache()):t.cache==="manual"?this.cacheEnabled=!0:this.cacheEnabled=!1}startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some(n=>n.id===t)}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?e==="in"?this.inEdgesMap.get(t):e==="out"?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const n=this.getRelatedEdges(t,"out").map(i=>this.getNode(i.target));return Array.from(new Set(n))}getPredecessors(t){const n=this.getRelatedEdges(t,"in").map(i=>this.getNode(i.source));return Array.from(new Set(n))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return!n||!this.nodeFilter(n)?null:n}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];Vw([this.getNode(t)],new Set,e,i)}dfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];Ff(this.getNode(t),new Set,e,i)}}let kn=class J6 extends O0{constructor(e){super();oe(this,"nodeMap",new Map);oe(this,"edgeMap",new Map);oe(this,"inEdgesMap",new Map);oe(this,"outEdgesMap",new Map);oe(this,"bothEdgesMap",new Map);oe(this,"treeIndices",new Map);oe(this,"changes",[]);oe(this,"batchCount",0);oe(this,"onChanged",()=>{});oe(this,"batch",e=>{this.batchCount+=1,e(),this.batchCount-=1,this.batchCount||this.commit()});e&&(e.nodes&&this.addNodes(e.nodes),e.edges&&this.addEdges(e.edges),e.tree&&this.addTree(e.tree),e.onChanged&&(this.onChanged=e.onChanged))}commit(){const e=this.changes;this.changes=[];const n={graph:this,changes:e};this.emit("changed",n),this.onChanged(n)}reduceChanges(e){let n=[];return e.forEach(i=>{switch(i.type){case"NodeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="NodeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else{if(s.type==="NodeDataUpdated")return s.id!==i.value.id;if(s.type==="TreeStructureChanged")return s.nodeId!==i.value.id}return!0}),a||n.push(i);break}case"EdgeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="EdgeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else if(s.type==="EdgeDataUpdated"||s.type==="EdgeUpdated")return s.id!==i.value.id;return!0}),a||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const a=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),s=n[a];s?i.propertyName!==void 0?s.newValue=i.newValue:(n.splice(a,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(a=>a.type==="TreeStructureAttached"||a.type==="TreeStructureChanged"?a.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const a=n.find(s=>s.type==="TreeStructureChanged"&&s.treeKey===i.treeKey&&s.nodeId===i.nodeId);a?a.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(e){this.getNode(e)}hasNode(e){return this.nodeMap.has(e)}areNeighbors(e,n){return this.getNeighbors(n).some(i=>i.id===e)}getNode(e){const n=this.nodeMap.get(e);if(!n)throw new Error("Node not found for id: "+e);return n}getRelatedEdges(e,n){if(this.checkNodeExistence(e),n==="in"){const i=this.inEdgesMap.get(e);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(e);return Array.from(i)}else{const i=this.bothEdgesMap.get(e);return Array.from(i)}}getDegree(e,n){return this.getRelatedEdges(e,n).length}getSuccessors(e){const i=this.getRelatedEdges(e,"out").map(a=>this.getNode(a.target));return Array.from(new Set(i))}getPredecessors(e){const i=this.getRelatedEdges(e,"in").map(a=>this.getNode(a.source));return Array.from(new Set(i))}getNeighbors(e){const n=this.getPredecessors(e),i=this.getSuccessors(e);return Array.from(new Set([...n,...i]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(n=>{n.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const n of e)this.doAddNode(n)})}addNode(e){this.addNodes([e])}doRemoveNode(e){const n=this.getNode(e),i=this.bothEdgesMap.get(e);i==null||i.forEach(a=>this.doRemoveEdge(a.id)),this.nodeMap.delete(e),this.treeIndices.forEach(a=>{var o,l;(o=a.childrenMap.get(e))==null||o.forEach(u=>{a.parentMap.delete(u.id)});const s=a.parentMap.get(e);s&&((l=a.childrenMap.get(s.id))==null||l.delete(n)),a.parentMap.delete(e),a.childrenMap.delete(e)}),this.bothEdgesMap.delete(e),this.inEdgesMap.delete(e),this.outEdgesMap.delete(e),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(e){this.batch(()=>{e.forEach(n=>this.doRemoveNode(n))})}removeNode(e){this.removeNodes([e])}updateNodeDataProperty(e,n,i){const a=this.getNode(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}mergeNodeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateNodeDataProperty(e,i,a)})})}updateNodeData(...e){const n=e[0],i=this.getNode(n);if(typeof e[1]=="string"){this.updateNodeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:s,newValue:o})})}checkEdgeExistence(e){if(!this.hasEdge(e))throw new Error("Edge not found for id: "+e)}hasEdge(e){return this.edgeMap.has(e)}getEdge(e){return this.checkEdgeExistence(e),this.edgeMap.get(e)}getEdgeDetail(e){const n=this.getEdge(e);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.target)}}doAddEdge(e){if(this.hasEdge(e.id))throw new Error("Edge already exists: "+e.id);this.checkNodeExistence(e.source),this.checkNodeExistence(e.target),this.edgeMap.set(e.id,e);const n=this.inEdgesMap.get(e.target),i=this.outEdgesMap.get(e.source),a=this.bothEdgesMap.get(e.source),s=this.bothEdgesMap.get(e.target);n.add(e),i.add(e),a.add(e),s.add(e),this.changes.push({type:"EdgeAdded",value:e})}addEdges(e){this.batch(()=>{for(const n of e)this.doAddEdge(n)})}addEdge(e){this.addEdges([e])}doRemoveEdge(e){const n=this.getEdge(e),i=this.outEdgesMap.get(n.source),a=this.inEdgesMap.get(n.target),s=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),a.delete(n),s.delete(n),o.delete(n),this.edgeMap.delete(e),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(e){this.batch(()=>{e.forEach(n=>this.doRemoveEdge(n))})}removeEdge(e){this.removeEdges([e])}updateEdgeSource(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.source,s=n;this.outEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.outEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"source",oldValue:a,newValue:s})})}updateEdgeTarget(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.target,s=n;this.inEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.inEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"target",oldValue:a,newValue:s})})}updateEdgeDataProperty(e,n,i){const a=this.getEdge(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}updateEdgeData(...e){const n=e[0],i=this.getEdge(n);if(typeof e[1]=="string"){this.updateEdgeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:s,newValue:o})})}mergeEdgeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateEdgeDataProperty(e,i,a)})})}checkTreeExistence(e){if(!this.hasTreeStructure(e))throw new Error("Tree structure not found for treeKey: "+e)}hasTreeStructure(e){return this.treeIndices.has(e)}attachTreeStructure(e){this.treeIndices.has(e)||(this.treeIndices.set(e,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:e})}))}detachTreeStructure(e){this.checkTreeExistence(e),this.treeIndices.delete(e),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:e})})}addTree(e,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],a=Array.isArray(e)?e:[e];for(;a.length;){const s=a.shift();i.push(s),s.children&&a.push(...s.children)}this.addNodes(i),i.forEach(s=>{var o;(o=s.children)==null||o.forEach(l=>{this.setParent(l.id,s.id,n)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(n=>!this.getParent(n.id,e))}getChildren(e,n){this.checkNodeExistence(e),this.checkTreeExistence(n);const a=this.treeIndices.get(n).childrenMap.get(e);return Array.from(a||[])}getParent(e,n){return this.checkNodeExistence(e),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(e)||null}getAncestors(e,n){const i=[];let a=this.getNode(e),s;for(;s=this.getParent(a.id,n);)i.push(s),a=s;return i}setParent(e,n,i){var c,h;this.checkTreeExistence(i);const a=this.treeIndices.get(i);if(!a)return;const s=this.getNode(e),o=a.parentMap.get(e);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((c=a.childrenMap.get(o.id))==null||c.delete(s)),a.parentMap.delete(e);return}const l=this.getNode(n);a.parentMap.set(e,l),o&&((h=a.childrenMap.get(o.id))==null||h.delete(s));let u=a.childrenMap.get(l.id);u||(u=new Set,a.childrenMap.set(l.id,u)),u.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:l.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Ff(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Vw([this.getNode(e)],new Set,n,a)}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return Vw([this.getNode(e)],new Set,n,a)}dfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return Ff(this.getNode(e),new Set,n,a)}clone(){const e=this.getAllNodes().map(a=>({...a,data:{...a.data}})),n=this.getAllEdges().map(a=>({...a,data:{...a.data}})),i=new J6({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const l=new Map;a.forEach((c,h)=>{l.set(h,i.getNode(c.id))});const u=new Map;s.forEach((c,h)=>{u.set(h,new Set(Array.from(c).map(d=>i.getNode(d.id))))}),i.treeIndices.set(o,{parentMap:l,childrenMap:u})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new iJ({graph:this,...e})}};class A0{constructor(t,e){this.context=t,this.options=e||{}}}var aJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},sJ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function oJ(r){const{type:t}=r;return["compact-box","mindmap","dendrogram","indented"].includes(t)}function lJ(r){return!Array.isArray(r)&&(r==null?void 0:r.preLayout)}function tf(r){const{nodes:t,edges:e}=r,n={nodes:[],edges:[],combos:[]};return t.forEach(i=>{const a=i.data._isCombo?n.combos:n.nodes,{x:s,y:o,z:l=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:l}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:l=[],controlPoints:u=l.slice(1,l.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},u!=null&&u.length?{controlPoints:u.map(jn)}:{})})}),n}function uJ(r,t){class e extends A0{constructor(i,a){if(super(i,a),this.instance=new r({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const s=this.instance;this.stop=s.stop.bind(s),this.tick=o=>{const l=s.tick(o);return tf(l)}}}execute(i,a){return aJ(this,void 0,void 0,function*(){return tf(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(cr({},this.options,a))))})}transformOptions(i){const{onTick:a}=i;return a&&(i.onTick=s=>a(tf(s))),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,l=a.map(g=>{const p=H(g),{data:v,style:m,combo:b}=g,w=sJ(g,["data","style","combo"]),x={id:p,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v),{data:v}),b?{parentId:b}:{}),{style:m}),w)};return m!=null&&m.x&&Object.assign(x.data,{x:m.x}),m!=null&&m.y&&Object.assign(x.data,{y:m.y}),m!=null&&m.z&&Object.assign(x.data,{z:m.z}),x}),u=new Map(l.map(g=>[g.id,g])),c=s.filter(g=>{const{source:p,target:v}=g;return u.has(p)&&u.has(v)}).map(g=>{const{source:p,target:v,data:m,style:b}=g;return{id:H(g),source:p,target:v,data:Object.assign({},m),style:Object.assign({},b)}}),h=o.map(g=>({id:H(g),data:Object.assign({_isCombo:!0},g.data),style:Object.assign({},g.style)})),d=new kn({nodes:[...l,...h],edges:c});return t.model.model.hasTreeStructure(we)&&(d.attachTreeStructure(we),l.forEach(g=>{const p=t.model.model.getParent(g.id,we);p&&d.hasNode(p.id)&&d.setParent(g.id,p.id,we)})),d}}return e}function Wv(r,t,...e){if(t in r)return r[t](...e);if("instance"in r){const n=r.instance;if(t in n)return n[t](...e)}return null}function uk(r,t){if(t in r)return r[t];if("instance"in r){const e=r.instance;if(t in e)return e[t]}return null}var cJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class hJ extends Wc{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find(t=>["d3-force","d3-force-3d"].includes(t==null?void 0:t.id))}validate(t){return this.context.layout?this.forceLayoutInstance?super.validate(t):(la.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return cJ(this,void 0,void 0,function*(){const n=this.forceLayoutInstance;this.context.graph.getNodeData(t).forEach((i,a)=>{const{x:s=0,y:o=0}=i.style||{};n&&Wv(n,"setFixedPosition",t[a],[...It([+s,+o],e)])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&uk(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&Wv(e,"setFixedPosition",H(n),[+i,+a])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&uk(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&Wv(t,"setFixedPosition",H(e),[null,null,null])})}}var ck=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class P0 extends Cr{constructor(t,e){super(t,Object.assign({},P0.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>ck(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:l}=this.options,u=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),c=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),h=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(l),d=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,g=[...u,...h];g.length>0&&g.forEach(p=>this.fixNodeLike(p,d)),this.updateRelatedEdges(),c.length>0&&c.forEach(p=>this.fixEdge(p,d))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],l=((s=o.find(u=>u.shape===i))===null||s===void 0?void 0:s.style)||{};return a in l||(l[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(u=>u.shape!==i),{shape:i,style:l}])),l[a]},this.scaleEntireElement=(n,i,a)=>{i.setLocalScale(1/a);const s=this.cachedStyles.get(n)||[];s.push({shape:i}),this.cachedStyles.set(n,s)},this.scaleSpecificShapes=(n,i,a)=>{const s=cK(n);(Array.isArray(a)?a:[a]).forEach(l=>{const{shape:u,fields:c}=l,h=typeof u=="function"?u(s):n.getShape(u);if(h){if(!c){this.scaleEntireElement(n.id,h,i);return}c.forEach(d=>{const g=this.getOriginalFieldValue(n.id,h,d);yt(g)&&(h.style[d]=g/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=H(n),{element:s,model:o}=this.context,l=s.getElement(a);if(!l||this.skipIfExceedViewport(l))return;o.getRelatedEdgesData(a).forEach(h=>this.relatedEdgeToUpdate.add(H(h)));const c=this.options[l.type];if(!c){this.scaleEntireElement(a,l,i);return}this.scaleSpecificShapes(l,i,c)},this.fixEdge=(n,i)=>{const a=H(n),s=this.context.element.getElement(a);if(!s||this.skipIfExceedViewport(s))return;const o=this.options.edge;if(!o){s.style.transformOrigin="center",this.scaleEntireElement(a,s,i);return}this.scaleSpecificShapes(s,i,o)},this.updateRelatedEdges=()=>{const{element:n}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(i=>{const a=n.getElement(i);a==null||a.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=n=>ck(this,void 0,void 0,function*(){var i;!((i=n.data)===null||i===void 0)&&i.firstRender||(this.options.reset?this.restoreCachedStyles():this.fixElementSize({data:{scale:this.zoom}}))}),this.bindEvents()}restoreCachedStyles(){if(this.cachedStyles.size>0){this.cachedStyles.forEach(i=>{i.forEach(({shape:a,style:s})=>{if(Ji(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,l])=>a.style[o]=l)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(i=>i&&t.getElementType(i)==="node");if(n.length>0){const i=new Set;n.forEach(a=>{t.getRelatedEdgesData(a).forEach(s=>i.add(H(s)))}),i.forEach(a=>{const s=e==null?void 0:e.getElement(a);s==null||s.update({})})}}}bindEvents(){const{graph:t}=this.context;t.on(dt.AFTER_DRAW,this.resetTransform),t.on(dt.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(dt.AFTER_DRAW,this.resetTransform),t.off(dt.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}P0.defaultOptions={enable:r=>r.data.scale<1,nodeFilter:()=>!0,edgeFilter:()=>!0,comboFilter:()=>!0,edge:[{shape:"key",fields:["lineWidth"]},{shape:"halo",fields:["lineWidth"]},{shape:"label"}],reset:!1};var dJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class N0 extends Cr{constructor(t,e){super(t,Object.assign({},N0.defaultOptions,e)),this.focus=n=>dJ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context;yield i.focusElement(n.target.id,this.options.animation)}),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$o.forEach(e=>{t.on(`${e}:${J.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$o.forEach(e=>{t.off(`${e}:${J.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}N0.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class R0 extends Cr{constructor(t,e){super(t,Object.assign({},R0.defaultOptions,e)),this.isFrozen=!1,this.toggleFrozen=n=>{this.isFrozen=n.type==="dragstart"},this.hoverElement=n=>{if(!this.validate(n))return;const i=n.type===J.POINTER_ENTER;this.updateElementsState(n,i);const{onHover:a,onHoverEnd:s}=this.options;i?a==null||a(n):s==null||s(n)},this.updateElementsState=(n,i)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:a}=this.context,{state:s,animation:o,inactiveState:l}=this.options,u=this.getActiveIds(n),c={};if(s&&Object.assign(c,this.getElementsState(u,s,i)),l){const h=d6(a.getData(),!0).filter(d=>!u.includes(d));Object.assign(c,this.getElementsState(h,l,i))}a.setElementState(c,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(l=>{const u=s.getElementState(l);a?o[l]=u.includes(i)?u:[...u,i]:o[l]=u.filter(c=>c!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$o.forEach(n=>{t.on(`${n}:${J.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${J.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${J.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${J.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?_6(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||M0(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$o.forEach(n=>{t.off(`${n}:${J.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${J.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${J.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${J.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}R0.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class fJ extends Fc{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e}=this.context;this.pathShape=new jr({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[Nf(t)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(Nf(t)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",aK(this.points)),n&&i==="default"&&this.points.length>2&&super.updateElementsStates(this.points)}onPointerUp(){if(this.points){if(this.points.length<2){this.clearLasso();return}super.updateElementsStates(this.points),this.clearLasso()}}clearLasso(){var t;(t=this.pathShape)===null||t===void 0||t.remove(),this.pathShape=void 0,this.points=void 0}}class L0 extends Cr{constructor(t,e){super(t,Object.assign({},L0.defaultOptions,e)),this.hiddenShapes=[],this.isVisible=!0,this.setElementsVisibility=(n,i,a)=>{n.filter(Boolean).forEach(s=>{i==="hidden"&&!s.isVisible()?this.hiddenShapes.push(s):i==="visible"&&this.hiddenShapes.includes(s)?this.hiddenShapes.splice(this.hiddenShapes.indexOf(s),1):Bo(s,i,a)})},this.filterShapes=(n,i)=>{if(Et(i))return s=>!i(n,s);const a=i==null?void 0:i[n];return s=>s.className?!(a!=null&&a.includes(s.className)):!0},this.hideShapes=n=>{if(!this.validate(n)||!this.isVisible)return;const{element:i}=this.context,{shapes:a={}}=this.options;this.setElementsVisibility(i.getNodes(),"hidden",this.filterShapes("node",a)),this.setElementsVisibility(i.getEdges(),"hidden",this.filterShapes("edge",a)),this.setElementsVisibility(i.getCombos(),"hidden",this.filterShapes("combo",a)),this.isVisible=!1},this.showShapes=Oc(n=>{if(!this.validate(n)||this.isVisible)return;const{element:i}=this.context;this.setElementsVisibility(i.getNodes(),"visible"),this.setElementsVisibility(i.getEdges(),"visible"),this.setElementsVisibility(i.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(dt.BEFORE_TRANSFORM,this.hideShapes),t.on(dt.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(dt.BEFORE_TRANSFORM,this.hideShapes),t.off(dt.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}L0.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};var hk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class I0 extends Cr{constructor(t,e){super(t,Object.assign({},I0.defaultOptions,e)),this.onWheel=n=>hk(this,void 0,void 0,function*(){this.options.preventDefault&&n.preventDefault();const i=n.deltaX,a=n.deltaY;yield this.scroll([-i,-a],n)}),this.shortcut=new Jl(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),un(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,l=>this.scroll([0,-10],l)),this.shortcut.bind(a,l=>this.scroll([0,10],l)),this.shortcut.bind(s,l=>this.scroll([-10,0],l)),this.shortcut.bind(o,l=>this.scroll([10,0],l))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(J.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Oa(t,e),t=this.clampByDirection(t),t=this.clampByRange(t),t}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=ua(this.options.range),h=[s*o,a*l,s*u,a*c],d=Ks(Hx(n.getCanvasCenter()),h),g=be(n.getViewportCenter(),[t,e,0]);if(!Di(g,d)){const{min:[p,v],max:[m,b]}=d;(g[0]<p&&t>0||g[0]>m&&t<0)&&(t=0),(g[1]<v&&e>0||g[1]>b&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return hk(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,i=this.context.graph,a=this.formatDisplacement(t);yield i.translateBy(a,!1),n==null||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.onWheel),super.destroy()}}I0.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var dk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class D0 extends Cr{constructor(t,e){super(t,Object.assign({},D0.defaultOptions,e)),this.zoom=(n,i,a)=>dk(this,void 0,void 0,function*(){if(!this.validate(i))return;const{graph:s}=this.context;let o;"viewport"in i&&(o=jn(i.viewport));const{sensitivity:l,onFinish:u}=this.options,c=1+Ke(n,-50,50)*l/100,h=s.getZoom();yield s.zoomTo(h*c,a,o),u==null||u()}),this.onReset=()=>dk(this,void 0,void 0,function*(){yield this.context.graph.zoomTo(1,this.options.animation)}),this.preventDefault=n=>{this.options.preventDefault&&n.preventDefault()},this.shortcut=new Jl(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(this.shortcut.unbindAll(),Array.isArray(t))if(t.includes(J.PINCH))this.shortcut.bind([J.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(J.WHEEL,this.preventDefault),this.shortcut.bind([...t,J.WHEEL],n=>{const{deltaX:i,deltaY:a}=n;this.zoom(-(a??i),n,!1)})}if(typeof t=="object"){const{zoomIn:e=[],zoomOut:n=[],reset:i=[]}=t;this.shortcut.bind(e,a=>this.zoom(10,a,this.options.animation)),this.shortcut.bind(n,a=>this.zoom(-10,a,this.options.animation)),this.shortcut.bind(i,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(J.WHEEL,this.preventDefault),super.destroy()}}D0.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};function gJ(r,t,e,n){return n===void 0&&(n="height"),e==="center"?(r[n]+t[n])/2:r.height}var Qs={assign:Object.assign,getHeight:gJ},Q6=Qs,lE=18,pJ=lE*2,fk=lE,vJ={getId:function(t){return t.id||t.name},getPreH:function(t){return t.preH||0},getPreV:function(t){return t.preV||0},getHGap:function(t){return t.hgap||fk},getVGap:function(t){return t.vgap||fk},getChildren:function(t){return t.children},getHeight:function(t){return t.height||pJ},getWidth:function(t){var e=t.label||" ";return t.width||e.split("").length*lE}};function Bf(r,t){var e=this;if(e.vgap=e.hgap=0,r instanceof Bf)return r;e.data=r;var n=t.getHGap(r),i=t.getVGap(r);return e.preH=t.getPreH(r),e.preV=t.getPreV(r),e.width=t.getWidth(r),e.height=t.getHeight(r),e.width+=e.preH,e.height+=e.preV,e.id=t.getId(r),e.x=e.y=0,e.depth=0,e.children||(e.children=[]),e.addGap(n,i),e}Q6.assign(Bf.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(t,e){var n=this;n.hgap+=t,n.vgap+=e,n.width+=2*t,n.height+=2*e},eachNode:function(t){for(var e=this,n=[e],i;i=n.shift();)t(i),n=i.children.concat(n)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e=this,n=[e],i;i=n.shift();)t(i),n=n.concat(i.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t},translate:function(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.eachNode(function(n){n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(n){n.x=n.x-(n.x-e.left)*2-n.width}),t.translate(e.width,0)},bottom2top:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(n){n.y=n.y-(n.y-e.top)*2-n.height}),t.translate(0,e.height)}});function mJ(r,t,e){t===void 0&&(t={}),t=Q6.assign({},vJ,t);var n=new Bf(r,t),i=[n],a;if(!e&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){var s=t.getChildren(a.data),o=s?s.length:0;if(a.children=new Array(o),s&&o)for(var l=0;l<o;l++){var u=new Bf(s[l],t);a.children[l]=u,i.push(u),u.parent=a,u.depth=a.depth+1}}}return n}var tI=mJ,yJ=tI,bJ=function(){function r(e,n){n===void 0&&(n={});var i=this;i.options=n,i.rootNode=yJ(e,n)}var t=r.prototype;return t.execute=function(){throw new Error("please override this method")},r}(),F0=bJ;function ju(r,t,e,n){n===void 0&&(n=[]);var i=this;i.w=r||0,i.h=t||0,i.y=e||0,i.x=0,i.c=n||[],i.cs=n.length,i.prelim=0,i.mod=0,i.shift=0,i.change=0,i.tl=null,i.tr=null,i.el=null,i.er=null,i.msel=0,i.mser=0}ju.fromNode=function(r,t){if(!r)return null;var e=[];return r.children.forEach(function(n){e.push(ju.fromNode(n,t))}),t?new ju(r.height,r.width,r.x,e):new ju(r.width,r.height,r.y,e)};function eI(r,t,e){e?r.y+=t:r.x+=t,r.children.forEach(function(n){eI(n,t,e)})}function nI(r,t){var e=t?r.y:r.x;return r.children.forEach(function(n){e=Math.min(nI(n,t),e)}),e}function wJ(r,t){var e=nI(r,t);eI(r,-e,t)}function rI(r,t,e){e?t.y=r.x:t.x=r.x,r.c.forEach(function(n,i){rI(n,t.children[i],e)})}function iI(r,t,e){e===void 0&&(e=0),t?(r.x=e,e+=r.width):(r.y=e,e+=r.height),r.children.forEach(function(n){iI(n,t,e)})}var xJ=function(r,t){t===void 0&&(t={});var e=t.isHorizontal;function n(w){if(w.cs===0){i(w);return}n(w.c[0]);for(var x=m(u(w.c[0].el),0,null),S=1;S<w.cs;++S){n(w.c[S]);var _=u(w.c[S].er);a(w,S,x),x=m(_,S,x)}d(w),i(w)}function i(w){w.cs===0?(w.el=w,w.er=w,w.msel=w.mser=0):(w.el=w.c[0].el,w.msel=w.c[0].msel,w.er=w.c[w.cs-1].er,w.mser=w.c[w.cs-1].mser)}function a(w,x,S){for(var _=w.c[x-1],k=_.mod,M=w.c[x],C=M.mod;_!==null&&M!==null;){u(_)>S.low&&(S=S.nxt);var P=k+_.prelim+_.w-(C+M.prelim);P>0&&(C+=P,s(w,x,S.index,P));var T=u(_),A=u(M);T<=A&&(_=l(_),_!==null&&(k+=_.mod)),T>=A&&(M=o(M),M!==null&&(C+=M.mod))}!_&&M?c(w,x,M,C):_&&!M&&h(w,x,_,k)}function s(w,x,S,_){w.c[x].mod+=_,w.c[x].msel+=_,w.c[x].mser+=_,p(w,x,S,_)}function o(w){return w.cs===0?w.tl:w.c[0]}function l(w){return w.cs===0?w.tr:w.c[w.cs-1]}function u(w){return w.y+w.h}function c(w,x,S,_){var k=w.c[0].el;k.tl=S;var M=_-S.mod-w.c[0].msel;k.mod+=M,k.prelim-=M,w.c[0].el=w.c[x].el,w.c[0].msel=w.c[x].msel}function h(w,x,S,_){var k=w.c[x].er;k.tr=S;var M=_-S.mod-w.c[x].mser;k.mod+=M,k.prelim-=M,w.c[x].er=w.c[x-1].er,w.c[x].mser=w.c[x-1].mser}function d(w){w.prelim=(w.c[0].prelim+w.c[0].mod+w.c[w.cs-1].mod+w.c[w.cs-1].prelim+w.c[w.cs-1].w)/2-w.w/2}function g(w,x){x+=w.mod,w.x=w.prelim+x,v(w);for(var S=0;S<w.cs;S++)g(w.c[S],x)}function p(w,x,S,_){if(S!==x-1){var k=x-S;w.c[S+1].shift+=_/k,w.c[x].shift-=_/k,w.c[x].change-=_-_/k}}function v(w){for(var x=0,S=0,_=0;_<w.cs;_++)x+=w.c[_].shift,S+=x+w.c[_].change,w.c[_].mod+=S}function m(w,x,S){for(;S!==null&&w>=S.low;)S=S.nxt;return{low:w,index:x,nxt:S}}iI(r,e);var b=ju.fromNode(r,e);return n(b),g(b,0),rI(b,r,e),wJ(r,e),r},gk=tI,aI=function(r,t){for(var e=gk(r.data,t,!0),n=gk(r.data,t,!0),i=r.children.length,a=Math.round(i/2),s=t.getSide||function(c,h){return h<a?"right":"left"},o=0;o<i;o++){var l=r.children[o],u=s(l,o);u==="right"?n.children.push(l):e.children.push(l)}return e.eachNode(function(c){c.isRoot()||(c.side="left")}),n.eachNode(function(c){c.isRoot()||(c.side="right")}),{left:e,right:n}},EJ=aI,ms=["LR","RL","TB","BT","H","V"],_J=["LR","RL","H"],SJ=function(t){return _J.indexOf(t)>-1},MJ=ms[0],uE=function(r,t,e){var n=t.direction||MJ;if(t.isHorizontal=SJ(n),ms.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===ms[0])e(r,t);else if(n===ms[1])e(r,t),r.right2left();else if(n===ms[2])e(r,t);else if(n===ms[3])e(r,t),r.bottom2top();else if(n===ms[4]||n===ms[5]){var i=EJ(r,t),a=i.left,s=i.right;e(a,t),e(s,t),t.isHorizontal?a.right2left():a.bottom2top(),s.translate(a.x-s.x,a.y-s.y),r.x=a.x,r.y=s.y;var o=r.getBoundingBox();t.isHorizontal?o.top<0&&r.translate(0,-o.top):o.left<0&&r.translate(-o.left,0)}var l=t.fixedRoot;return l===void 0&&(l=!0),l&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),kJ(r,t),r};function kJ(r,t){if(t.radial){var e=t.isHorizontal?["x","y"]:["y","x"],n=e[0],i=e[1],a={x:1/0,y:1/0},s={x:-1/0,y:-1/0},o=0;r.DFTraverse(function(c){o++;var h=c.x,d=c.y;a.x=Math.min(a.x,h),a.y=Math.min(a.y,d),s.x=Math.max(s.x,h),s.y=Math.max(s.y,d)});var l=s[i]-a[i];if(l===0)return;var u=Math.PI*2/o;r.DFTraverse(function(c){var h=(c[i]-a[i])/l*(Math.PI*2-u)+u,d=c[n]-r[n];c.x=Math.cos(h)*d,c.y=Math.sin(h)*d})}}function CJ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Hw(r,t)}function Hw(r,t){return Hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Hw(r,t)}var TJ=F0,OJ=xJ,AJ=uE,PJ=Qs,NJ=function(r){function t(){return r.apply(this,arguments)||this}CJ(t,r);var e=t.prototype;return e.execute=function(){var i=this;return AJ(i.rootNode,i.options,OJ)},t}(TJ),RJ={};function LJ(r,t){return t=PJ.assign({},RJ,t),new NJ(r,t).execute()}var IJ=LJ,DJ=Qs;function FJ(r,t){t===void 0&&(t=[]);var e=this;e.x=e.y=0,e.leftChild=e.rightChild=null,e.height=0,e.children=t}var BJ={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function sI(r,t,e){e?(t.x=r.x,t.y=r.y):(t.x=r.y,t.y=r.x),r.children.forEach(function(n,i){sI(n,t.children[i],e)})}var zJ=function(r,t){t===void 0&&(t={}),t=DJ.assign({},BJ,t);var e=0;function n(l){if(!l)return null;l.width=0,l.depth&&l.depth>e&&(e=l.depth);var u=l.children,c=u.length,h=new FJ(l.height,[]);return u.forEach(function(d,g){var p=n(d);h.children.push(p),g===0&&(h.leftChild=p),g===c-1&&(h.rightChild=p)}),h.originNode=l,h.isLeaf=l.isLeaf(),h}function i(l){if(l.isLeaf||l.children.length===0)l.drawingDepth=e;else{var u=l.children.map(function(h){return i(h)}),c=Math.min.apply(null,u);l.drawingDepth=c-1}return l.drawingDepth}var a;function s(l){l.x=l.drawingDepth*t.rankSep,l.isLeaf?(l.y=0,a&&(l.y=a.y+a.height+t.nodeSep,l.originNode.parent!==a.originNode.parent&&(l.y+=t.subTreeSep)),a=l):(l.children.forEach(function(u){s(u)}),l.y=(l.leftChild.y+l.rightChild.y)/2)}var o=n(r);return i(o),s(o),sI(o,r,t.isHorizontal),r};function $J(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Uw(r,t)}function Uw(r,t){return Uw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Uw(r,t)}var jJ=F0,qJ=zJ,WJ=uE,GJ=Qs,VJ=function(r){function t(){return r.apply(this,arguments)||this}$J(t,r);var e=t.prototype;return e.execute=function(){var i=this;return i.rootNode.width=0,WJ(i.rootNode,i.options,qJ)},t}(jJ),HJ={};function UJ(r,t){return t=GJ.assign({},HJ,t),new VJ(r,t).execute()}var YJ=UJ,pk=Qs;function XJ(r,t,e,n,i){var a=(typeof e=="function"?e(r):e)*r.depth;if(!n)try{if(r.id===r.parent.children[0].id){r.x+=a,r.y=t?t.y:0;return}}catch{}if(r.x+=a,t){if(r.y=t.y+pk.getHeight(t,r,i),t.parent&&r.parent.id!==t.parent.id){var s=t.parent,o=s.y+pk.getHeight(s,r,i);r.y=o>r.y?o:r.y}}else r.y=0}var KJ=function(r,t,e,n){var i=null;r.eachNode(function(a){XJ(a,i,t,e,n),i=a})};function ZJ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Yw(r,t)}function Yw(r,t){return Yw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Yw(r,t)}var JJ=F0,Cd=KJ,QJ=aI,tQ=Qs,qu=["LR","RL","H"],eQ=qu[0],nQ=function(r){function t(){return r.apply(this,arguments)||this}ZJ(t,r);var e=t.prototype;return e.execute=function(){var i=this,a=i.options,s=i.rootNode;a.isHorizontal=!0;var o=a.indent,l=o===void 0?20:o,u=a.dropCap,c=u===void 0?!0:u,h=a.direction,d=h===void 0?eQ:h,g=a.align;if(d&&qu.indexOf(d)===-1)throw new TypeError("Invalid direction: "+d);if(d===qu[0])Cd(s,l,c,g);else if(d===qu[1])Cd(s,l,c,g),s.right2left();else if(d===qu[2]){var p=QJ(s,a),v=p.left,m=p.right;Cd(v,l,c,g),v.right2left(),Cd(m,l,c,g);var b=v.getBoundingBox();m.translate(b.width,0),s.x=m.x-s.width/2}return s},t}(JJ),rQ={};function iQ(r,t){return t=tQ.assign({},rQ,t),new nQ(r,t).execute()}var aQ=iQ,sQ=Qs;function oI(r,t){var e=0;return r.children.length?r.children.forEach(function(n){e+=oI(n,t)}):e=r.height,r._subTreeSep=t.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,e)+2*r._subTreeSep,r.totalHeight}function lI(r){var t=r.children,e=t.length;if(e){t.forEach(function(l){lI(l)});var n=t[0],i=t[e-1],a=i.y-n.y+i.height,s=0;if(t.forEach(function(l){s+=l.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(t.length!==1||r.height>s){var o=r.y+(r.height-a)/2-n.y;t.forEach(function(l){l.translate(0,o)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}var oQ={getSubTreeSep:function(){return 0}},lQ=function(r,t){t===void 0&&(t={}),t=sQ.assign({},oQ,t),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(function(e){e.x=e.parent.x+e.parent.width}),r.parent=null,oI(r,t),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(function(e){var n=e.children,i=n.length;if(i){var a=n[0];if(a.startY=e.startY+e._subTreeSep,i===1)a.y=e.y+e.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(var s=1;s<i;s++){var o=n[s];o.startY=n[s-1].startY+n[s-1].totalHeight,o.y=o.startY+o.totalHeight/2-o.height/2}}}}),lI(r)};function uQ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Xw(r,t)}function Xw(r,t){return Xw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Xw(r,t)}var cQ=F0,hQ=lQ,dQ=uE,fQ=Qs,gQ=function(r){function t(){return r.apply(this,arguments)||this}uQ(t,r);var e=t.prototype;return e.execute=function(){var i=this;return dQ(i.rootNode,i.options,hQ)},t}(cQ),pQ={};function vQ(r,t){return t=fQ.assign({},pQ,t),new gQ(r,t).execute()}var mQ=vQ,yQ={compactBox:IJ,dendrogram:YJ,indented:aQ,mindmap:mQ},Td=yQ;const bQ=(r,t)=>{if(r!=="next"&&r!=="prev")return t},vk=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};let wQ=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return vk(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&vk(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,bQ)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}},xQ=class extends wQ{};const EQ=()=>1,_Q=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=MQ(r,t||EQ);return(e=SQ(n.graph,n.buckets,n.zeroIdx).map(a=>r.getRelatedEdges(a.v,"out").filter(({target:s})=>s===a.w)))===null||e===void 0?void 0:e.flat()},SQ=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)Gv(r,t,e,s);for(;s=i.dequeue();)Gv(r,t,e,s);if(r.getAllNodes().length){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(Gv(r,t,e,s,!0));break}}}return n},Gv=(r,t,e,n,i)=>{var a,s;const o=[];return r.hasNode(n.v)&&((a=r.getRelatedEdges(n.v,"in"))===null||a===void 0||a.forEach(l=>{const u=l.data.weight,c=r.getNode(l.source);i&&o.push({v:l.source,w:l.target,in:0,out:0}),c.data.out===void 0&&(c.data.out=0),c.data.out-=u,Kw(t,e,Object.assign({v:c.id},c.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(l=>{const u=l.data.weight,c=l.target,h=r.getNode(c);h.data.in===void 0&&(h.data.in=0),h.data.in-=u,Kw(t,e,Object.assign({v:h.id},h.data))}),r.removeNode(n.v)),i?o:void 0},MQ=(r,t)=>{const e=new kn;let n=0,i=0;r.getAllNodes().forEach(l=>{e.addNode({id:l.id,data:{v:l.id,in:0,out:0}})}),r.getAllEdges().forEach(l=>{const u=e.getRelatedEdges(l.source,"out").find(h=>h.target===l.target),c=(t==null?void 0:t(l))||1;u?e.updateEdgeData(u==null?void 0:u.id,Object.assign(Object.assign({},u.data),{weight:u.data.weight+c})):e.addEdge({id:l.id,source:l.source,target:l.target,data:{weight:c}}),i=Math.max(i,e.getNode(l.source).data.out+=c),n=Math.max(n,e.getNode(l.target).data.in+=c)});const a=[],s=i+n+3;for(let l=0;l<s;l++)a.push(new xQ);const o=n+1;return e.getAllNodes().forEach(l=>{Kw(a,o,Object.assign({v:l.id},e.getNode(l.id).data))}),{buckets:a,zeroIdx:o,graph:e}},Kw=(r,t,e)=>{e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)},kQ=(r,t)=>{const n=_Q(r,(i=>a=>a.data.weight||1)());n==null||n.forEach(i=>{const a=i.data;r.removeEdge(i.id),a.forwardName=i.data.name,a.reversed=!0,r.addEdge({id:i.id,source:i.target,target:i.source,data:Object.assign({},a)})})},CQ=r=>{r.getAllEdges().forEach(t=>{const e=t.data;if(e.reversed){r.removeEdge(t.id);const n=e.forwardName;delete e.reversed,delete e.forwardName,r.addEdge({id:t.id,source:t.target,target:t.source,data:Object.assign(Object.assign({},e),{forwardName:n})})}})},TQ=(r,t)=>Number(r)-Number(t),tu=(r,t,e,n)=>{let i;do i=`${n}${Math.random()}`;while(r.hasNode(i));return e.dummy=t,r.addNode({id:i,data:e}),i},OQ=r=>{const t=new kn;return r.getAllNodes().forEach(e=>{t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{const n=t.getRelatedEdges(e.source,"out").find(i=>i.target===e.target);n?t.updateEdgeData(n==null?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+e.data.weight||0,minlen:Math.max(n.data.minlen,e.data.minlen||1)})):t.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),t},uI=r=>{const t=new kn;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},AQ=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),mk=(r,t)=>{const e=Number(r.x),n=Number(r.y),i=Number(t.x)-e,a=Number(t.y)-n;let s=Number(r.width)/2,o=Number(r.height)/2;if(!i&&!a)return{x:0,y:0};let l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:e+l,y:n+u}},wc=r=>{const t=[],e=cI(r)+1;for(let n=0;n<e;n++)t.push([]);r.getAllNodes().forEach(n=>{const i=n.data.rank;i!==void 0&&t[i]&&t[i].push(n.id)});for(let n=0;n<e;n++)t[n]=t[n].sort((i,a)=>TQ(r.getNode(i).data.order,r.getNode(a).data.order));return t},PQ=r=>{const t=r.getAllNodes().filter(n=>n.data.rank!==void 0).map(n=>n.data.rank),e=Math.min(...t);r.getAllNodes().forEach(n=>{n.data.hasOwnProperty("rank")&&e!==1/0&&(n.data.rank-=e)})},NQ=(r,t=0)=>{const e=r.getAllNodes(),n=e.filter(o=>o.data.rank!==void 0).map(o=>o.data.rank),i=Math.min(...n),a=[];e.forEach(o=>{const l=(o.data.rank||0)-i;a[l]||(a[l]=[]),a[l].push(o.id)});let s=0;for(let o=0;o<a.length;o++){const l=a[o];l===void 0?o%t!==0&&(s-=1):s&&(l==null||l.forEach(u=>{const c=r.getNode(u);c&&(c.data.rank=c.data.rank||0,c.data.rank+=s)}))}},yk=(r,t,e,n)=>{const i={width:0,height:0};return yt(e)&&yt(n)&&(i.rank=e,i.order=n),tu(r,"border",i,t)},cI=r=>{let t;return r.getAllNodes().forEach(e=>{const n=e.data.rank;n!==void 0&&(t===void 0||n>t)&&(t=n)}),t||(t=0),t},RQ=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},cE=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),hI=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>hI(r,s,e,n,i,a)),e&&a.push(t.id))},dI=(r,t,e,n)=>{const i=Array.isArray(t)?t:[t],a=l=>r.getNeighbors(l),s=[],o=[];return i.forEach(l=>{if(r.hasNode(l.id))hI(r,l,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${l}`)}),s},LQ=r=>{const t=e=>{const n=r.getChildren(e),i=r.getNode(e);if(n!=null&&n.length&&n.forEach(a=>t(a.id)),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let a=i.data.minRank,s=i.data.maxRank+1;a<s;a+=1)bk(r,"borderLeft","_bl",e,i,a),bk(r,"borderRight","_br",e,i,a)}};r.getRoots().forEach(e=>t(e.id))},bk=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],l=tu(r,"border",s,e);i.data[t][a]=l,r.setParent(l,n),o&&r.addEdge({id:`e${Math.random()}`,source:o,target:l,data:{weight:1}})},IQ=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&fI(r)},DQ=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&FQ(r),(e==="lr"||e==="rl")&&(BQ(r),fI(r))},fI=r=>{r.getAllNodes().forEach(t=>{wk(t)}),r.getAllEdges().forEach(t=>{wk(t)})},wk=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},FQ=r=>{r.getAllNodes().forEach(t=>{Vv(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Vv(n)),t.data.hasOwnProperty("y")&&Vv(t.data)})},Vv=r=>{r!=null&&r.y&&(r.y=-r.y)},BQ=r=>{r.getAllNodes().forEach(t=>{Hv(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Hv(n)),t.data.hasOwnProperty("x")&&Hv(t.data)})},Hv=r=>{const t=r.x;r.x=r.y,r.y=t},zQ=r=>{const t=tu(r,"root",{},"_root"),e=$Q(r);let n=Math.max(...Object.values(e));Math.abs(n)===1/0&&(n=1);const i=n-1,a=2*i+1;r.getAllEdges().forEach(o=>{o.data.minlen*=a});const s=jQ(r)+1;return r.getRoots().forEach(o=>{gI(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},gI=(r,t,e,n,i,a,s)=>{const o=r.getChildren(s);if(!(o!=null&&o.length)){s!==t&&r.addEdge({id:`e${Math.random()}`,source:t,target:s,data:{weight:0,minlen:e}});return}const l=yk(r,"_bt"),u=yk(r,"_bb"),c=r.getNode(s);r.setParent(l,s),c.data.borderTop=l,r.setParent(u,s),c.data.borderBottom=u,o==null||o.forEach(h=>{gI(r,t,e,n,i,a,h.id);const d=h.data.borderTop?h.data.borderTop:h.id,g=h.data.borderBottom?h.data.borderBottom:h.id,p=h.data.borderTop?n:2*n,v=d!==g?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:l,target:d,data:{minlen:v,weight:p,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:g,target:u,data:{minlen:v,weight:p,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:l,data:{weight:0,minlen:i+a[s]}})},$Q=r=>{const t={},e=(n,i)=>{const a=r.getChildren(n);a==null||a.forEach(s=>e(s.id,i+1)),t[n]=i};return r.getRoots().forEach(n=>e(n.id,1)),t},jQ=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},qQ=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},WQ="edge",pI="edge-label",GQ=(r,t)=>{r.getAllEdges().forEach(e=>VQ(r,e,t))},VQ=(r,t,e)=>{let n=t.source,i=r.getNode(n).data.rank;const a=t.target,s=r.getNode(a).data.rank,o=t.data.labelRank;if(s===i+1)return;r.removeEdge(t.id);let l,u,c;for(c=0,++i;i<s;++c,++i)t.data.points=[],u={originalEdge:t,width:0,height:0,rank:i},l=tu(r,WQ,u,"_d"),i===o&&(u.width=t.data.width,u.height=t.data.height,u.dummy=pI,u.labelpos=t.data.labelpos),r.addEdge({id:`e${Math.random()}`,source:n,target:l,data:{weight:t.data.weight}}),c===0&&e.push(l),n=l;r.addEdge({id:`e${Math.random()}`,source:n,target:a,data:{weight:t.data.weight}})},HQ=(r,t)=>{t.forEach(e=>{let n=r.getNode(e);const{data:i}=n,a=i.originalEdge;let s;a&&r.addEdge(a);let o=e;for(;n.data.dummy;)s=r.getSuccessors(o)[0],r.removeNode(o),a.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===pI&&(a.data.x=n.data.x,a.data.y=n.data.y,a.data.width=n.data.width,a.data.height=n.data.height),o=s.id,n=r.getNode(o)})},UQ=(r,t,e)=>{const n={};let i;e==null||e.forEach(a=>{let s=r.getParent(a),o,l;for(;s;){if(o=r.getParent(s.id),o?(l=n[o.id],n[o.id]=s.id):(l=i,i=s.id),l&&l!==s.id){t.hasNode(l)||t.addNode({id:l,data:{}}),t.hasNode(s.id)||t.addNode({id:s.id,data:{}}),t.hasEdge(`e${l}-${s.id}`)||t.addEdge({id:`e${l}-${s.id}`,source:l,target:s.id,data:{}});return}s=o}})},YQ=(r,t,e)=>{const n=XQ(r),i=new kn({tree:[{id:n,children:[],data:{}}]});return r.getAllNodes().forEach(a=>{const s=r.getParent(a.id);(a.data.rank===t||a.data.minRank<=t&&t<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(Object.assign({},a)),s!=null&&s.id&&!i.hasNode(s==null?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(a.id,(s==null?void 0:s.id)||n),r.getRelatedEdges(a.id,e).forEach(o=>{const l=o.source===a.id?o.target:o.source;i.hasNode(l)||i.addNode(Object.assign({},r.getNode(l)));const u=i.getRelatedEdges(l,"out").find(({target:h})=>h===a.id),c=u!==void 0?u.data.weight:0;u?i.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:o.data.weight+c})):i.addEdge({id:o.id,source:l,target:a.id,data:{weight:o.data.weight+c}})}),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,Object.assign(Object.assign({},a.data),{borderLeft:a.data.borderLeft[t],borderRight:a.data.borderRight[t]})))}),i},XQ=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},KQ=(r,t,e)=>{const n=AQ(e,e.map((c,h)=>h)),a=t.map(c=>{const h=r.getRelatedEdges(c,"out").map(d=>({pos:n[d.target]||0,weight:d.data.weight}));return h==null?void 0:h.sort((d,g)=>d.pos-g.pos)}).flat().filter(c=>c!==void 0);let s=1;for(;s<e.length;)s<<=1;const o=2*s-1;s-=1;const l=Array(o).fill(0,0,o);let u=0;return a==null||a.forEach(c=>{if(c){let h=c.pos+s;l[h]+=c.weight;let d=0;for(;h>0;)h%2&&(d+=l[h+1]),h=h-1>>1,l[h]+=c.weight;u+=c.weight*d}}),u},xk=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=KQ(r,t[n-1],t[n]);return e},Ek=r=>{const t={},e=r.getAllNodes(),n=e.map(u=>{var c;return(c=u.data.rank)!==null&&c!==void 0?c:-1/0}),i=Math.max(...n),a=[];for(let u=0;u<i+1;u++)a.push([]);const s=e.sort((u,c)=>r.getNode(u.id).data.rank-r.getNode(c.id).data.rank),l=s.filter(u=>r.getNode(u.id).data.fixorder!==void 0).sort((u,c)=>r.getNode(u.id).data.fixorder-r.getNode(c.id).data.fixorder);return l==null||l.forEach(u=>{isNaN(r.getNode(u.id).data.rank)||a[r.getNode(u.id).data.rank].push(u.id),t[u.id]=!0}),s==null||s.forEach(u=>r.dfsTree(u.id,c=>{if(t.hasOwnProperty(c.id))return!0;t[c.id]=!0,isNaN(c.data.rank)||a[c.data.rank].push(c.id)})),a},ZQ=(r,t)=>t.map(e=>{const n=r.getRelatedEdges(e,"in");if(!(n!=null&&n.length))return{v:e};const i={sum:0,weight:0};return n==null||n.forEach(a=>{const s=r.getNode(a.source);i.sum+=a.data.weight*s.data.order,i.weight+=a.data.weight}),{v:e,barycenter:i.sum/i.weight,weight:i.weight}}),JQ=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,l)=>{a[o.v]={i:l,indegree:0,in:[],out:[],vs:[o.v]};const u=a[o.v];o.barycenter!==void 0&&(u.barycenter=o.barycenter,u.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const l=a[o.source],u=a[o.target];l!==void 0&&u!==void 0&&(u.indegree++,l.out.push(a[o.target]))});const s=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return QQ(s)},QQ=r=>{var t,e;const n=[],i=l=>u=>{u.merged||(u.barycenter===void 0||l.barycenter===void 0||u.barycenter>=l.barycenter)&&ttt(l,u)},a=l=>u=>{u.in.push(l),--u.indegree===0&&r.push(u)};for(;r!=null&&r.length;){const l=r.pop();n.push(l),(t=l.in.reverse())===null||t===void 0||t.forEach(u=>i(l)(u)),(e=l.out)===null||e===void 0||e.forEach(u=>a(l)(u))}const s=n.filter(l=>!l.merged),o=["vs","i","barycenter","weight"];return s.map(l=>{const u={};return o==null||o.forEach(c=>{l[c]!==void 0&&(u[c]=l[c])}),u})},ttt=(r,t)=>{var e;let n=0,i=0;r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),r.vs=(e=t.vs)===null||e===void 0?void 0:e.concat(r.vs),r.barycenter=n/i,r.weight=i,r.i=Math.min(t.i,r.i),t.merged=!0},ett=(r,t,e,n)=>{const i=RQ(r,d=>{const g=d.hasOwnProperty("fixorder")&&!isNaN(d.fixorder);return n?!g&&d.hasOwnProperty("barycenter"):g||d.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((d,g)=>-d.i- -g.i),o=[];let l=0,u=0,c=0;a==null||a.sort(ntt(!!t,!!e)),c=_k(o,s,c),a==null||a.forEach(d=>{var g;c+=(g=d.vs)===null||g===void 0?void 0:g.length,o.push(d.vs),l+=d.barycenter*d.weight,u+=d.weight,c=_k(o,s,c)});const h={vs:o.flat()};return u&&(h.barycenter=l/u,h.weight=u),h},_k=(r,t,e)=>{let n=e,i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),r==null||r.push(i.vs),n++;return n},ntt=(r,t)=>(e,n)=>{if(e.fixorder!==void 0&&n.fixorder!==void 0)return e.fixorder-n.fixorder;if(e.barycenter<n.barycenter)return-1;if(e.barycenter>n.barycenter)return 1;if(t&&e.order!==void 0&&n.order!==void 0){if(e.order<n.order)return-1;if(e.order>n.order)return 1}return r?n.i-e.i:e.i-n.i},vI=(r,t,e,n,i,a)=>{var s,o,l,u;let c=r.getChildren(t).map(w=>w.id);const h=r.getNode(t),d=h?h.data.borderLeft:void 0,g=h?h.data.borderRight:void 0,p={};d&&(c=c==null?void 0:c.filter(w=>w!==d&&w!==g));const v=ZQ(r,c||[]);v==null||v.forEach(w=>{var x;if(!((x=r.getChildren(w.v))===null||x===void 0)&&x.length){const S=vI(r,w.v,e,n,a);p[w.v]=S,S.hasOwnProperty("barycenter")&&itt(w,S)}});const m=JQ(v,e);rtt(m,p),(s=m.filter(w=>w.vs.length>0))===null||s===void 0||s.forEach(w=>{const x=r.getNode(w.vs[0]);x&&(w.fixorder=x.data.fixorder,w.order=x.data.order)});const b=ett(m,n,i,a);if(d&&(b.vs=[d,b.vs,g].flat(),!((o=r.getPredecessors(d))===null||o===void 0)&&o.length)){const w=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||""),x=r.getNode(((u=r.getPredecessors(g))===null||u===void 0?void 0:u[0].id)||"");b.hasOwnProperty("barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+w.data.order+x.data.order)/(b.weight+2),b.weight+=2}return b},rtt=(r,t)=>{r==null||r.forEach(e=>{var n;const i=(n=e.vs)===null||n===void 0?void 0:n.map(a=>t[a]?t[a].vs:a);e.vs=i.flat()})},itt=(r,t)=>{r.barycenter!==void 0?(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight):(r.barycenter=t.barycenter,r.weight=t.weight)},att=(r,t)=>{const e=cI(r),n=[],i=[];for(let c=1;c<e+1;c++)n.push(c);for(let c=e-1;c>-1;c--)i.push(c);const a=Sk(r,n,"in"),s=Sk(r,i,"out");let o=Ek(r);Uv(r,o);let l=Number.POSITIVE_INFINITY,u;for(let c=0,h=0;h<4;++c,++h){Mk(c%2?a:s,c%4>=2,!1,t),o=wc(r);const d=xk(r,o);d<l&&(h=0,u=$s(o),l=d)}o=Ek(r),Uv(r,o);for(let c=0,h=0;h<4;++c,++h){Mk(c%2?a:s,c%4>=2,!0,t),o=wc(r);const d=xk(r,o);d<l&&(h=0,u=$s(o),l=d)}Uv(r,u)},Sk=(r,t,e)=>t.map(n=>YQ(r,n,e)),Mk=(r,t,e,n)=>{const i=new kn;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,l=vI(a,o,i,t,e,n);for(let u=0;u<((s=l.vs)===null||s===void 0?void 0:s.length);u++){const c=a.getNode(l.vs[u]);c&&(c.data.order=u)}UQ(a,i,l.vs)})},Uv=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},stt=(r,t)=>{const n=r.getAllNodes().filter(s=>{var o;return!(!((o=r.getChildren(s.id))===null||o===void 0)&&o.length)}).map(s=>s.data.rank),i=Math.max(...n),a=[];for(let s=0;s<i+1;s++)a[s]=[];t==null||t.forEach(s=>{const o=r.getNode(s);!o||o.data.dummy||isNaN(o.data.rank)||(o.data.fixorder=a[o.data.rank].length,a[o.data.rank].push(s))})},ott=r=>{const t={};let e=0;const n=i=>{const a=e;r.getChildren(i).forEach(s=>n(s.id)),t[i]={low:a,lim:e++}};return r.getRoots().forEach(i=>n(i.id)),t},ltt=(r,t,e,n)=>{var i,a;const s=[],o=[],l=Math.min(t[e].low,t[n].low),u=Math.max(t[e].lim,t[n].lim);let c,h;c=e;do c=(i=r.getParent(c))===null||i===void 0?void 0:i.id,s.push(c);while(c&&(t[c].low>l||u>t[c].lim));for(h=c,c=n;c&&c!==h;)o.push(c),c=(a=r.getParent(c))===null||a===void 0?void 0:a.id;return{lca:h,path:s.concat(o.reverse())}},utt=(r,t)=>{const e=ott(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const l=o.data.originalEdge;if(!l)return;const u=ltt(r,e,l.source,l.target),c=u.path,h=u.lca;let d=0,g=c[d],p=!0;for(;s!==l.target;){if(o=r.getNode(s),p){for(;g!==h&&((i=r.getNode(g))===null||i===void 0?void 0:i.data.maxRank)<o.data.rank;)d++,g=c[d];g===h&&(p=!1)}if(!p){for(;d<c.length-1&&((a=r.getNode(c[d+1]))===null||a===void 0?void 0:a.data.minRank)<=o.data.rank;)d++;g=c[d]}r.hasNode(g)&&r.setParent(s,g),s=r.getSuccessors(s)[0].id}})},ctt=(r,t)=>{const e={},n=(i,a)=>{let s=0,o=0;const l=i.length,u=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((c,h)=>{var d;const g=dtt(r,c),p=g?r.getNode(g.id).data.order:l;(g||c===u)&&((d=a.slice(o,h+1))===null||d===void 0||d.forEach(v=>{var m;(m=r.getPredecessors(v))===null||m===void 0||m.forEach(b=>{var w;const x=r.getNode(b.id),S=x.data.order;(S<s||p<S)&&!(x.data.dummy&&(!((w=r.getNode(v))===null||w===void 0)&&w.data.dummy))&&mI(e,b.id,v)})}),o=h+1,s=p)}),a};return t!=null&&t.length&&t.reduce(n),e},htt=(r,t)=>{const e={};function n(o,l,u,c,h){var d,g;let p;for(let v=l;v<u;v++)p=o[v],!((d=r.getNode(p))===null||d===void 0)&&d.data.dummy&&((g=r.getPredecessors(p))===null||g===void 0||g.forEach(m=>{const b=r.getNode(m.id);b.data.dummy&&(b.data.order<c||b.data.order>h)&&mI(e,m.id,p)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,l){const u=i(o);l.get(u)||(n(...o),l.set(u,!0))}const s=(o,l)=>{let u=-1,c,h=0;const d=new Map;return l==null||l.forEach((g,p)=>{var v;if(((v=r.getNode(g))===null||v===void 0?void 0:v.data.dummy)==="border"){const m=r.getPredecessors(g)||[];m.length&&(c=r.getNode(m[0].id).data.order,a([l,h,p,u,c],d),h=p,u=c)}a([l,h,l.length,c,o.length],d)}),l};return t!=null&&t.length&&t.reduce(s),e},dtt=(r,t)=>{var e,n;if(!((e=r.getNode(t))===null||e===void 0)&&e.data.dummy)return(n=r.getPredecessors(t))===null||n===void 0?void 0:n.find(i=>r.getNode(i.id).data.dummy)},mI=(r,t,e)=>{let n=t,i=e;if(n>i){const s=n;n=i,i=s}let a=r[n];a||(r[n]=a={}),a[i]=!0},ftt=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},gtt=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((l,u)=>{i[l]=l,a[l]=l,s[l]=u})}),t==null||t.forEach(o=>{let l=-1;o==null||o.forEach(u=>{let c=n(u).map(h=>h.id);if(c.length){c=c.sort((d,g)=>s[d]-s[g]);const h=(c.length-1)/2;for(let d=Math.floor(h),g=Math.ceil(h);d<=g;++d){const p=c[d];a[u]===u&&l<s[p]&&!ftt(e,u,p)&&(a[p]=u,a[u]=i[u]=i[p],l=s[p])}}})}),{root:i,align:a}},ptt=(r,t,e,n,i,a,s)=>{var o;const l={},u=vtt(r,t,e,i,a,s),c=s?"borderLeft":"borderRight",h=(p,v)=>{let m=u.getAllNodes(),b=m.pop();const w={};for(;b;)w[b.id]?p(b.id):(w[b.id]=!0,m.push(b),m=m.concat(v(b.id))),b=m.pop()},d=p=>{l[p]=(u.getRelatedEdges(p,"in")||[]).reduce((v,m)=>Math.max(v,(l[m.source]||0)+m.data.weight),0)},g=p=>{const v=(u.getRelatedEdges(p,"out")||[]).reduce((b,w)=>Math.min(b,(l[w.target]||0)-w.data.weight),Number.POSITIVE_INFINITY),m=r.getNode(p);v!==Number.POSITIVE_INFINITY&&m.data.borderType!==c&&(l[p]=Math.max(l[p],v))};return h(d,u.getPredecessors.bind(u)),h(g,u.getSuccessors.bind(u)),(o=Object.values(n))===null||o===void 0||o.forEach(p=>{l[p]=l[e[p]]}),l},vtt=(r,t,e,n,i,a)=>{const s=new kn,o=wtt(n,i,a);return t==null||t.forEach(l=>{let u;l==null||l.forEach(c=>{const h=e[c];if(s.hasNode(h)||s.addNode({id:h,data:{}}),u){const d=e[u],g=s.getRelatedEdges(d,"out").find(p=>p.target===h);g?s.updateEdgeData(g.id,Object.assign(Object.assign({},g.data),{weight:Math.max(o(r,c,u),g.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:d,target:h,data:{weight:Math.max(o(r,c,u),0)}})}u=c})}),s},mtt=(r,t)=>cE(Object.values(t),e=>{var n;let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return(n=Object.keys(e))===null||n===void 0||n.forEach(s=>{const o=e[s],l=xtt(r,s)/2;i=Math.max(o+l,i),a=Math.min(o-l,a)}),i-a});function ytt(r,t){const e=Object.values(t),n=Math.min(...e),i=Math.max(...e);["u","d"].forEach(a=>{["l","r"].forEach(s=>{const o=a+s,l=r[o];let u;if(l===t)return;const c=Object.values(l);u=s==="l"?n-Math.min(...c):i-Math.max(...c),u&&(r[o]={},Object.keys(l).forEach(h=>{r[o][h]=l[h]+u}))})})}const btt=(r,t)=>{const e={};return Object.keys(r.ul).forEach(n=>{if(t)e[n]=r[t.toLowerCase()][n];else{const i=Object.values(r).map(a=>a[n]);e[n]=(i[0]+i[1])/2}}),e},wtt=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let l=0,u=0;if(l+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":u=-s.data.width/2;break;case"r":u=s.data.width/2;break}if(u&&(l+=e?u:-u),u=0,l+=(s.data.dummy?t:r)/2,l+=(o.data.dummy?t:r)/2,l+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":u=o.data.width/2;break;case"r":u=-o.data.width/2;break}return u&&(l+=e?u:-u),u=0,l},xtt=(r,t)=>r.getNode(t).data.width||0,Ett=(r,t)=>{const{ranksep:e=0}=t||{},n=wc(r);let i=0;n==null||n.forEach(a=>{const s=a.map(l=>r.getNode(l).data.height),o=Math.max(...s,0);a==null||a.forEach(l=>{r.getNode(l).data.y=i+o/2}),i+=o+e})},_tt=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=wc(r),s=Object.assign(ctt(r,a),htt(r,a)),o={};let l=[];["u","d"].forEach(c=>{l=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(v=>Object.values(v).reverse()));const d=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),g=gtt(r,l,s,d),p=ptt(r,l,g.root,g.align,n,i,h==="r");h==="r"&&Object.keys(p).forEach(v=>p[v]=-p[v]),o[c+h]=p})});const u=mtt(r,o);return u&&ytt(o,u),btt(o,e)},Stt=(r,t)=>{var e;const n=uI(r);Ett(n,t);const i=_tt(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},yI=r=>{const t={},e=n=>{var i;const a=r.getNode(n);if(!a)return 0;if(t[n])return a.data.rank;t[n]=!0;let s;return(i=r.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const l=e(o.target),u=o.data.minlen,c=l-u;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),a.data.rank=s,s};r.getAllNodes().filter(n=>r.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},Mtt=r=>{const t={};let e;const n=s=>{var o;const l=r.getNode(s);if(!l)return 0;if(t[s])return l.data.rank;t[s]=!0;let u;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(c=>{const h=n(c.target),d=c.data.minlen,g=h-d;g&&(u===void 0||g<u)&&(u=g)}),u||(u=0),(e===void 0||u<e)&&(e=u),l.data.rank=u,u};r.getAllNodes().filter(s=>r.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var l;const u=r.getNode(s),c=isNaN(u.data.layer)?o:u.data.layer;(u.data.rank===void 0||u.data.rank<c)&&(u.data.rank=c),!i[s]&&(i[s]=!0,(l=r.getRelatedEdges(s,"out"))===null||l===void 0||l.forEach(h=>{a(h.target,c+h.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},qs=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,ktt=r=>{const t=new kn({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Ctt(t,r)<n;)i=bI(t,r),a=t.hasNode(i.source)?qs(r,i):-qs(r,i),wI(t,r,a);return t},Ctt=(r,t)=>{const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!qs(t,i)&&(r.addNode({id:s,data:{}}),r.addEdge({id:i.id,source:n,target:s,data:{}}),e(s))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},Ttt=r=>{const t=new kn({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Ott(t,r)<n;)i=bI(t,r),a=t.hasNode(i.source)?qs(r,i):-qs(r,i),wI(t,r,a);return t},Ott=(r,t)=>{const e=n=>{var i;(i=t.getRelatedEdges(n,"both"))===null||i===void 0||i.forEach(a=>{const s=a.source,o=n===s?a.target:s;!r.hasNode(o)&&(t.getNode(o).data.layer!==void 0||!qs(t,a))&&(r.addNode({id:o,data:{}}),r.addEdge({id:a.id,source:n,target:o,data:{}}),e(o))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},bI=(r,t)=>cE(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?qs(t,e):1/0),wI=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},Att=r=>{const t=OQ(r);yI(t);const e=ktt(t);EI(e),xI(e,t);let n,i;for(;n=Rtt(e);)i=Ltt(e,t,n),Itt(e,t,n,i)},xI=(r,t)=>{let e=dI(r,r.getAllNodes(),"post");e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{Ptt(r,t,n)})},Ptt=(r,t,e)=>{const i=r.getNode(e).data.parent,a=r.getRelatedEdges(e,"both").find(s=>s.target===i||s.source===i);a.data.cutvalue=Ntt(r,t,e)},Ntt=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(l=>l.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(l=>l.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(l=>{const u=l.source===e,c=u?l.target:l.source;if(c!==i){const h=u===a,d=l.data.weight;if(o+=h?d:-d,Ftt(r,e,c)){const g=r.getRelatedEdges(e,"both").find(p=>p.source===c||p.target===c).data.cutvalue;o+=h?-g:g}}}),o},EI=(r,t=r.getAllNodes()[0].id)=>{_I(r,{},1,t)},_I=(r,t,e,n,i)=>{var a;const s=e;let o=e;const l=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(u=>{t[u.id]||(o=_I(r,t,o,u.id,n))}),l.data.low=s,l.data.lim=o++,i?l.data.parent=i:delete l.data.parent,o},Rtt=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),Ltt=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(c=>c.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,l=!1;a.data.lim>s.data.lim&&(o=s,l=!0);const u=t.getAllEdges().filter(c=>l===kk(r.getNode(c.source),o)&&l!==kk(r.getNode(c.target),o));return cE(u,c=>qs(t,c))},Itt=(r,t,e,n)=>{const i=r.getRelatedEdges(e.source,"both").find(a=>a.source===e.target||a.target===e.target);i&&r.removeEdge(i.id),r.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),EI(r),xI(r,t),Dtt(r,t)},Dtt=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=dI(r,e,"pre");n=n.slice(1),n.forEach(i=>{const a=r.getNode(i).data.parent;let s=t.getRelatedEdges(i,"out").find(l=>l.target===a),o=!1;!s&&t.hasNode(a)&&(s=t.getRelatedEdges(a,"out").find(l=>l.target===i),o=!0),t.getNode(i).data.rank=(t.hasNode(a)&&t.getNode(a).data.rank||0)+(o?s==null?void 0:s.data.minlen:-(s==null?void 0:s.data.minlen))})},Ftt=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),kk=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,Btt=(r,t)=>{switch(t){case"network-simplex":$tt(r);break;case"tight-tree":Ck(r);break;case"longest-path":ztt(r);break;default:Ck(r)}},ztt=yI,Ck=r=>{Mtt(r),Ttt(r)},$tt=r=>{Att(r)},jtt=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&Wtt(r,i);const o=Xtt(r);e&&(t.ranksep=Ktt(o,{rankdir:a,ranksep:s}));let l;try{l=qtt(o,t)}catch(u){if(u.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:
- `,u);return}throw u}return Gtt(r,o),l},qtt=(r,t)=>{const{ranker:e,rankdir:n="tb",nodeOrder:i,keepNodeOrder:a,align:s,nodesep:o=50,edgesep:l=20,ranksep:u=50}=t;aet(r),kQ(r);const{nestingRoot:c,nodeRankFactor:h}=zQ(r);Btt(uI(r),e),Ztt(r),NQ(r,h),qQ(r,c),PQ(r),Jtt(r),Qtt(r);const d=[];GQ(r,d),utt(r,d),LQ(r),a&&stt(r,i),att(r,a),set(r),IQ(r,n),Stt(r,{align:s,nodesep:o,edgesep:l,ranksep:u}),oet(r),iet(r),HQ(r,d),net(r),DQ(r,n);const{width:g,height:p}=tet(r);return eet(r),ret(r),CQ(r),{width:g,height:p}},Wtt=(r,t)=>{r.getAllNodes().forEach(e=>{const n=r.getNode(e.id);if(t.hasNode(e.id)){const i=t.getNode(e.id);n.data.fixorder=i.data._order,delete i.data._order}else delete n.data.fixorder})},Gtt=(r,t)=>{r.getAllNodes().forEach(e=>{var n;const i=r.getNode(e.id);if(i){const a=t.getNode(e.id);i.data.x=a.data.x,i.data.y=a.data.y,i.data._order=a.data.order,i.data._rank=a.data.rank,!((n=t.getChildren(e.id))===null||n===void 0)&&n.length&&(i.data.width=a.data.width,i.data.height=a.data.height)}}),r.getAllEdges().forEach(e=>{const n=r.getEdge(e.id),i=t.getEdge(e.id);n.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(n.data.x=i.data.x,n.data.y=i.data.y)})},Vtt=["width","height","layer","fixorder"],Htt={width:0,height:0},Utt=["minlen","weight","width","height","labeloffset"],Ytt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Yv=["labelpos"],Xtt=r=>{const t=new kn({tree:[]});return r.getAllNodes().forEach(e=>{const n=Ok(r.getNode(e.id).data),i=Object.assign(Object.assign({},Htt),n),a=Tk(i,Vtt);t.hasNode(e.id)||t.addNode({id:e.id,data:Object.assign({},a)});const s=r.hasTreeStructure("combo")?r.getParent(e.id,"combo"):r.getParent(e.id);kt(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=Ok(r.getEdge(e.id).data),i={};Yv==null||Yv.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},Ytt,Tk(n,Utt),i)})}),t},Ktt=(r,t)=>{const{ranksep:e=0,rankdir:n}=t;return r.getAllNodes().forEach(i=>{isNaN(i.data.layer)||i.data.layer||(i.data.layer=0)}),r.getAllEdges().forEach(i=>{var a;i.data.minlen*=2,((a=i.data.labelpos)===null||a===void 0?void 0:a.toLowerCase())!=="c"&&(n==="TB"||n==="BT"?i.data.width+=i.data.labeloffset:i.data.height+=i.data.labeloffset)}),e/2},Ztt=r=>{r.getAllEdges().forEach(t=>{if(t.data.width&&t.data.height){const e=r.getNode(t.source),n=r.getNode(t.target),i={e:t,rank:(n.data.rank-e.data.rank)/2+e.data.rank};tu(r,"edge-proxy",i,"_ep")}})},Jtt=r=>{let t=0;return r.getAllNodes().forEach(e=>{var n,i;e.data.borderTop&&(e.data.minRank=(n=r.getNode(e.data.borderTop))===null||n===void 0?void 0:n.data.rank,e.data.maxRank=(i=r.getNode(e.data.borderBottom))===null||i===void 0?void 0:i.data.rank,t=Math.max(t,e.data.maxRank||-1/0))}),t},Qtt=r=>{r.getAllNodes().forEach(t=>{t.data.dummy==="edge-proxy"&&(r.getEdge(t.data.e.id).data.labelRank=t.data.rank,r.removeNode(t.id))})},tet=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}={},l=u=>{if(!u.data)return;const c=u.data.x,h=u.data.y,d=u.data.width,g=u.data.height;!isNaN(c)&&!isNaN(d)&&(e===void 0&&(e=c-d/2),e=Math.min(e,c-d/2),n=Math.max(n,c+d/2)),!isNaN(h)&&!isNaN(g)&&(i===void 0&&(i=h-g/2),i=Math.min(i,h-g/2),a=Math.max(a,h+g/2))};return r.getAllNodes().forEach(u=>{l(u)}),r.getAllEdges().forEach(u=>{u!=null&&u.data.hasOwnProperty("x")&&l(u)}),e-=s,i-=o,r.getAllNodes().forEach(u=>{u.data.x-=e,u.data.y-=i}),r.getAllEdges().forEach(u=>{var c;(c=u.data.points)===null||c===void 0||c.forEach(h=>{h.x-=e,h.y-=i}),u.data.hasOwnProperty("x")&&(u.data.x-=e),u.data.hasOwnProperty("y")&&(u.data.y-=i)}),{width:n-e+s,height:a-i+o}},eet=r=>{r.getAllEdges().forEach(t=>{const e=r.getNode(t.source),n=r.getNode(t.target);let i,a;t.data.points?(i=t.data.points[0],a=t.data.points[t.data.points.length-1]):(t.data.points=[],i={x:n.data.x,y:n.data.y},a={x:e.data.x,y:e.data.y}),t.data.points.unshift(mk(e.data,i)),t.data.points.push(mk(n.data,a))})},net=r=>{r.getAllEdges().forEach(t=>{if(t.data.hasOwnProperty("x"))switch((t.data.labelpos==="l"||t.data.labelpos==="r")&&(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset;break}})},ret=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},iet=r=>{r.getAllNodes().forEach(t=>{var e,n,i;if(!((e=r.getChildren(t.id))===null||e===void 0)&&e.length){const a=r.getNode(t.id),s=r.getNode(a.data.borderTop),o=r.getNode(a.data.borderBottom),l=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),u=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((u==null?void 0:u.data.x)-(l==null?void 0:l.data.x))||10,a.data.height=Math.abs((o==null?void 0:o.data.y)-(s==null?void 0:s.data.y))||10,a.data.x=((l==null?void 0:l.data.x)||0)+a.data.width/2,a.data.y=((s==null?void 0:s.data.y)||0)+a.data.height/2}}),r.getAllNodes().forEach(t=>{t.data.dummy==="border"&&r.removeNode(t.id)})},aet=r=>{r.getAllEdges().forEach(t=>{if(t.source===t.target){const e=r.getNode(t.source);e.data.selfEdges||(e.data.selfEdges=[]),e.data.selfEdges.push(t),r.removeEdge(t.id)}})},set=r=>{const t=wc(r);t==null||t.forEach(e=>{let n=0;e==null||e.forEach((i,a)=>{var s;const o=r.getNode(i);o.data.order=a+n,(s=o.data.selfEdges)===null||s===void 0||s.forEach(l=>{tu(r,"selfedge",{width:l.data.width,height:l.data.height,rank:o.data.rank,order:a+ ++n,e:l},"_se")}),delete o.data.selfEdges})})},oet=r=>{r.getAllNodes().forEach(t=>{const e=r.getNode(t.id);if(e.data.dummy==="selfedge"){const n=r.getNode(e.data.e.source),i=n.data.x+n.data.width/2,a=n.data.y,s=e.data.x-i,o=n.data.height/2;r.hasEdge(e.data.e.id)?r.updateEdgeData(e.data.e.id,e.data.e.data):r.addEdge({id:e.data.e.id,source:e.data.e.source,target:e.data.e.target,data:e.data.e.data}),r.removeNode(t.id),e.data.e.data.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{y:a,x:i+s},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],e.data.e.data.x=e.data.x,e.data.e.data.y=e.data.y}})},Tk=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},Ok=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t},Pa=Array.isArray,SI=r=>{const t=[],e=r.length;for(let n=0;n<e;n+=1){t[n]=[];for(let i=0;i<e;i+=1)n===i?t[n][i]=0:r[n][i]===0||!r[n][i]?t[n][i]=1/0:t[n][i]=r[n][i]}for(let n=0;n<e;n+=1)for(let i=0;i<e;i+=1)for(let a=0;a<e;a+=1)t[i][a]>t[i][n]+t[n][a]&&(t[i][a]=t[i][n]+t[n][a]);return t},MI=(r,t)=>{const{nodes:e,edges:n}=r,i=[],a={};if(!e)throw new Error("invalid nodes data!");return e&&e.forEach((s,o)=>{a[s.id]=o;const l=[];i.push(l)}),n==null||n.forEach(s=>{const{source:o,target:l}=s,u=a[o],c=a[l];u===void 0||c===void 0||(i[u][c]=1,i[c][u]=1)}),i},uet=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},cet=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Pa(s)?s.length===1&&(s=[s[0],s[0]]):yt(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],l=a.data.x-o[0],u=a.data.x+o[0],c=a.data.y-o[1],h=a.data.y+o[1];t>l&&(t=l),e>c&&(e=c),n<u&&(n=u),i<h&&(i=h)}),{minX:t,minY:e,maxX:n,maxY:i}},Ak=(r,t)=>Math.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),Zw=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let l=0;l<t.length;l++){const u=t[l];if(r.hasNode(u.id)&&!(s!=null&&s(u))){if(o!=null&&o(u))return;n==="TB"&&e(u),Zw(r,r.getChildren(u.id,i),e,n,i,a),n!=="TB"&&e(u)}}},Jw=r=>{if(r===null)return r;if(r instanceof Date)return new Date(r.getTime());if(r instanceof Array){const t=[];return r.forEach(e=>{t.push(e)}),t.map(e=>Jw(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=Jw(r[e])}),t}return r},qr=(r,t)=>{const e=Jw(r);return e.data=e.data||{},t&&(yt(e.data.x)||(e.data.x=Math.random()*t[0]),yt(e.data.y)||(e.data.y=Math.random()*t[1])),e};function Gc(r){if(!r)return[0,0,0];if(yt(r))return[r,r,r];if(r.length===0)return[0,0,0];const[t,e=t,n=t]=r;return[t,e,n]}function Ao(r,t){let e;return Et(t)?e=t:yt(t)?e=()=>t:e=()=>r,e}function hE(r,t,e=!0){return!t&&t!==0?n=>{const{size:i}=n.data||{};return i?Array.isArray(i)?e?Math.max(...i)||r:i:un(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:Et(t)?t:yt(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:un(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const dE=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:Et(r)?n=r:n=s=>r:n=s=>{var o,l,u;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(l=s.data)===null||l===void 0?void 0:l.bboxSize;if(!((u=s.data)===null||u===void 0)&&u.size){const c=s.data.size;return Array.isArray(c)?c:un(c)?[c.width,c.height]:c}return e},s=>{const o=n(s),l=i(s);return Math.max(...Gc(o))+l}},het={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class det{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},het),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:l,nodesep:u,ranksepFunc:c,nodesepFunc:h,edgeLabelSpace:d,ranker:g,nodeOrder:p,begin:v,controlPoints:m,radial:b,sortByCombo:w,preset:x}=i,S=new kn({tree:[]}),_=Ao(l||50,c),k=Ao(u||50,h);let M=k,C=_;(o==="LR"||o==="RL")&&(M=_,C=k);const P=hE(10,a,!1),T=e.getAllNodes(),A=e.getAllEdges();T.forEach(F=>{const V=Gc(P(F)),X=C(F),K=M(F),nt=V[0]+2*K,ot=V[1]+2*X,ct=F.data.layer;yt(ct)?S.addNode({id:F.id,data:{width:nt,height:ot,layer:ct}}):S.addNode({id:F.id,data:{width:nt,height:ot}})}),w&&(S.attachTreeStructure("combo"),T.forEach(F=>{const{parentId:V}=F.data;V!==void 0&&S.hasNode(V)&&S.setParent(F.id,V,"combo")})),A.forEach(F=>{S.addEdge({id:F.id,source:F.source,target:F.target,data:{weight:F.data.weight||1}})});let R;x!=null&&x.length&&(R=new kn({nodes:x})),jtt(S,{prevGraph:R,edgeLabelSpace:d,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:o,nodesep:u,align:s});const L=[0,0];if(v){let F=1/0,V=1/0;S.getAllNodes().forEach(X=>{F>X.data.x&&(F=X.data.x),V>X.data.y&&(V=X.data.y)}),S.getAllEdges().forEach(X=>{var K;(K=X.data.points)===null||K===void 0||K.forEach(nt=>{F>nt.x&&(F=nt.x),V>nt.y&&(V=nt.y)})}),L[0]=v[0]-F,L[1]=v[1]-V}const $=o==="LR"||o==="RL";if(!b){const F=new Set,X=o==="BT"||o==="RL"?(ct,ht)=>ht-ct:(ct,ht)=>ct-ht;S.getAllNodes().forEach(ct=>{ct.data.x=ct.data.x+L[0],ct.data.y=ct.data.y+L[1],F.add($?ct.data.x:ct.data.y)});const K=Array.from(F).sort(X),nt=$?(ct,ht)=>ct.x!==ht.x:(ct,ht)=>ct.y!==ht.y,ot=$?(ct,ht,pt)=>{const wt=Math.max(ht.y,pt.y),zt=Math.min(ht.y,pt.y);return ct.filter(Wt=>Wt.y<=wt&&Wt.y>=zt)}:(ct,ht,pt)=>{const wt=Math.max(ht.x,pt.x),zt=Math.min(ht.x,pt.x);return ct.filter(Wt=>Wt.x<=wt&&Wt.x>=zt)};S.getAllEdges().forEach((ct,ht)=>{var pt;d&&m&&ct.data.type!=="loop"&&(ct.data.controlPoints=fet((pt=ct.data.points)===null||pt===void 0?void 0:pt.map(({x:wt,y:zt})=>({x:wt+L[0],y:zt+L[1]})),S.getNode(ct.source),S.getNode(ct.target),K,$,nt,ot))})}let q=[];q=S.getAllNodes().map(F=>qr(F));const j=S.getAllEdges();return t&&(q.forEach(F=>{e.mergeNodeData(F.id,{x:F.data.x,y:F.data.y})}),j.forEach(F=>{e.mergeEdgeData(F.id,{controlPoints:F.data.controlPoints})})),{nodes:q,edges:j}})}}const fet=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:l,y:u}=t.data,{x:c,y:h}=e.data;if(i&&(l=t.data.y,u=t.data.x,c=e.data.y,h=e.data.x),h!==u&&l!==c){const d=n.indexOf(u),g=n[d+1];if(g){const m=o[0],b=i?{x:(u+g)/2,y:(m==null?void 0:m.y)||c}:{x:(m==null?void 0:m.x)||c,y:(u+g)/2};(!m||a(m,b))&&o.unshift(b)}const p=n.indexOf(h),v=Math.abs(p-d);if(v===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(u+h)/2,y:l}:{x:l,y:(u+h)/2});else if(v>1){const m=n[p-1];if(m){const b=o[o.length-1],w=i?{x:(h+m)/2,y:(b==null?void 0:b.y)||c}:{x:(b==null?void 0:b.x)||l,y:(h+m)/2};(!b||a(b,w))&&o.push(w)}}}}return o},Uo=(r,t,e)=>{const n=r.getAllNodes(),i=r.getAllEdges();if(!(n!=null&&n.length))return{nodes:[],edges:i};if(n.length===1)return t&&r.mergeNodeData(n[0].id,{x:e[0],y:e[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:e[0],y:e[1]})})],edges:i}},get={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class pet{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},get),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:l,startAngle:u=0,endAngle:c=2*Math.PI,angleRatio:h,ordering:d,clockwise:g,nodeSpacing:p,nodeSize:v}=i,m=e.getAllNodes(),b=e.getAllEdges(),[w,x,S]=met(a,s,o),_=m==null?void 0:m.length;if(!_||_===1)return Uo(e,t,S);const k=(c-u)/_;let{radius:M,startRadius:C,endRadius:P}=i;if(p){const $=Ao(10,p),q=hE(10,v);let j=-1/0;m.forEach(F=>{const V=q(F);j<V&&(j=V)});let B=0;m.forEach((F,V)=>{V===0?B+=j||10:B+=($(F)||0)+(j||10)}),M=B/(2*Math.PI)}else!M&&!C&&!P?M=Math.min(x,w)/2:!C&&P?C=P:C&&!P&&(P=C);const T=k*h;let A=[];d==="topology"?A=Pk(e,m):d==="topology-directed"?A=Pk(e,m,!0):d==="degree"?A=vet(e,m):A=m.map($=>qr($));const R=Math.ceil(_/l);for(let $=0;$<_;++$){let q=M;!q&&C!==null&&P!==null&&(q=C+$*(P-C)/(_-1)),q||(q=10+$*100/(_-1));let j=u+$%R*T+2*Math.PI/l*Math.floor($/R);g||(j=c-$%R*T-2*Math.PI/l*Math.floor($/R)),A[$].data.x=S[0]+Math.cos(j)*q,A[$].data.y=S[1]+Math.sin(j)*q}return t&&A.forEach($=>{e.mergeNodeData($.id,{x:$.data.x,y:$.data.y})}),{nodes:A,edges:b}})}}const Pk=(r,t,e=!1)=>{const n=[qr(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,l)=>{if(l!==0)if((l===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[l+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(qr(o)),i[o.id]=!0,s++;else{const u=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let c=!1;for(let d=0;d<u.length;d++){const g=u[d];if(r.getDegree(g.id)===r.getDegree(o.id)&&!i[g.id]){n.push(qr(g)),i[g.id]=!0,c=!0;break}}let h=0;for(;!c&&(i[t[h].id]||(n.push(qr(t[h])),i[t[h].id]=!0,c=!0),h++,h!==a););}}),n};function vet(r,t){const e=[];return t.forEach((n,i)=>{e.push(qr(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const met=(r,t,e)=>{let n=r,i=t,a=e;return!n&&typeof window<"u"&&(n=window.innerWidth),!i&&typeof window<"u"&&(i=window.innerHeight),a||(a=[n/2,i/2]),[n,i,a]},yet={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Qw{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},yet),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:l,maxLevelDiff:u,sweep:c,clockwise:h,equidistant:d,preventOverlap:g,startAngle:p=3/2*Math.PI,nodeSize:v,nodeSpacing:m}=i,b=e.getAllNodes(),w=e.getAllEdges(),x=!s&&typeof window<"u"?window.innerWidth:s,S=!o&&typeof window<"u"?window.innerHeight:o,_=a||[x/2,S/2];if(!(b!=null&&b.length)||b.length===1)return Uo(e,t,_);const k=[];let M,C=0;Pa(v)?M=Math.max(v[0],v[1]):Et(v)?(M=-1/0,b.forEach(F=>{const V=Math.max(...Gc(v(F)));V>M&&(M=V)})):M=v,Pa(m)?C=Math.max(m[0],m[1]):yt(m)&&(C=m),b.forEach(F=>{const V=qr(F);k.push(V);let X=M;const{data:K}=V;Pa(K.size)?X=Math.max(K.size[0],K.size[1]):yt(K.size)?X=K.size:un(K.size)&&(X=Math.max(K.size.width,K.size.height)),M=Math.max(M,X),Et(m)&&(C=Math.max(m(F),C))});const P={};k.forEach((F,V)=>{P[F.id]=V});let T=l;(!se(T)||k[0].data[T]===void 0)&&(T="degree"),T==="degree"?k.sort((F,V)=>e.getDegree(V.id,"both")-e.getDegree(F.id,"both")):k.sort((F,V)=>V.data[T]-F.data[T]);const A=k[0],R=(u||(T==="degree"?e.getDegree(A.id,"both"):A.data[T]))/4,L=[{nodes:[]}];let $=L[0];k.forEach(F=>{if($.nodes.length>0){const V=Math.abs(T==="degree"?e.getDegree($.nodes[0].id,"both")-e.getDegree(F.id,"both"):$.nodes[0].data[T]-F.data[T]);R&&V>=R&&($={nodes:[]},L.push($))}$.nodes.push(F)});let q=M+C;if(!g){const F=L.length>0&&L[0].nodes.length>1,X=(Math.min(x,S)/2-q)/(L.length+(F?1:0));q=Math.min(q,X)}let j=0;if(L.forEach(F=>{const V=c===void 0?2*Math.PI-2*Math.PI/F.nodes.length:c;if(F.dTheta=V/Math.max(1,F.nodes.length-1),F.nodes.length>1&&g){const X=Math.cos(F.dTheta)-Math.cos(0),K=Math.sin(F.dTheta)-Math.sin(0),nt=Math.sqrt(q*q/(X*X+K*K));j=Math.max(nt,j)}F.r=j,j+=q}),d){let F=0,V=0;for(let X=0;X<L.length;X++){const nt=(L[X].r||0)-V;F=Math.max(F,nt)}V=0,L.forEach((X,K)=>{K===0&&(V=X.r||0),X.r=V,V+=F})}return L.forEach(F=>{const V=F.dTheta||0,X=F.r||0;F.nodes.forEach((K,nt)=>{const ot=p+(h?1:-1)*V*nt;K.data.x=_[0]+X*Math.cos(ot),K.data.y=_[1]+X*Math.sin(ot)})}),t&&k.forEach(F=>e.mergeNodeData(F.id,{x:F.data.x,y:F.data.y})),{nodes:k,edges:w}})}}function bet(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return kI(this.cover(t,e),t,e,r)}function kI(r,t,e,n){if(isNaN(t)||isNaN(e))return r;var i,a=r._root,s={data:n},o=r._x0,l=r._y0,u=r._x1,c=r._y1,h,d,g,p,v,m,b,w;if(!a)return r._root=s,r;for(;a.length;)if((v=t>=(h=(o+u)/2))?o=h:u=h,(m=e>=(d=(l+c)/2))?l=d:c=d,i=a,!(a=a[b=m<<1|v]))return i[b]=s,r;if(g=+r._x.call(null,a.data),p=+r._y.call(null,a.data),t===g&&e===p)return s.next=a,i?i[b]=s:r._root=s,r;do i=i?i[b]=new Array(4):r._root=new Array(4),(v=t>=(h=(o+u)/2))?o=h:u=h,(m=e>=(d=(l+c)/2))?l=d:c=d;while((b=m<<1|v)===(w=(p>=d)<<1|g>=h));return i[w]=a,i[b]=s,r}function wet(r){var t,e,n=r.length,i,a,s=new Array(n),o=new Array(n),l=1/0,u=1/0,c=-1/0,h=-1/0;for(e=0;e<n;++e)isNaN(i=+this._x.call(null,t=r[e]))||isNaN(a=+this._y.call(null,t))||(s[e]=i,o[e]=a,i<l&&(l=i),i>c&&(c=i),a<u&&(u=a),a>h&&(h=a));if(l>c||u>h)return this;for(this.cover(l,u).cover(c,h),e=0;e<n;++e)kI(this,s[e],o[e],r[e]);return this}function xet(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var e=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(e))i=(e=Math.floor(r))+1,a=(n=Math.floor(t))+1;else{for(var s=i-e||1,o=this._root,l,u;e>r||r>=i||n>t||t>=a;)switch(u=(t<n)<<1|r<e,l=new Array(4),l[u]=o,o=l,s*=2,u){case 0:i=e+s,a=n+s;break;case 1:e=i-s,a=n+s;break;case 2:i=e+s,n=a-s;break;case 3:e=i-s,n=a-s;break}this._root&&this._root.length&&(this._root=o)}return this._x0=e,this._y0=n,this._x1=i,this._y1=a,this}function Eet(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function _et(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function or(r,t,e,n,i){this.node=r,this.x0=t,this.y0=e,this.x1=n,this.y1=i}function Met(r,t,e){var n,i=this._x0,a=this._y0,s,o,l,u,c=this._x1,h=this._y1,d=[],g=this._root,p,v;for(g&&d.push(new or(g,i,a,c,h)),e==null?e=1/0:(i=r-e,a=t-e,c=r+e,h=t+e,e*=e);p=d.pop();)if(!(!(g=p.node)||(s=p.x0)>c||(o=p.y0)>h||(l=p.x1)<i||(u=p.y1)<a))if(g.length){var m=(s+l)/2,b=(o+u)/2;d.push(new or(g[3],m,b,l,u),new or(g[2],s,b,m,u),new or(g[1],m,o,l,b),new or(g[0],s,o,m,b)),(v=(t>=b)<<1|r>=m)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-v],d[d.length-1-v]=p)}else{var w=r-+this._x.call(null,g.data),x=t-+this._y.call(null,g.data),S=w*w+x*x;if(S<e){var _=Math.sqrt(e=S);i=r-_,a=t-_,c=r+_,h=t+_,n=g.data}}return n}function ket(r){if(isNaN(c=+this._x.call(null,r))||isNaN(h=+this._y.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._x1,u=this._y1,c,h,d,g,p,v,m,b;if(!e)return this;if(e.length)for(;;){if((p=c>=(d=(s+l)/2))?s=d:l=d,(v=h>=(g=(o+u)/2))?o=g:u=g,t=e,!(e=e[m=v<<1|p]))return this;if(!e.length)break;(t[m+1&3]||t[m+2&3]||t[m+3&3])&&(n=t,b=m)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[m]=a:delete t[m],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[b]=e:this._root=e),this):(this._root=a,this)}function Cet(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function Tet(){return this._root}function Oet(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function Aet(r){var t=[],e,n=this._root,i,a,s,o,l;for(n&&t.push(new or(n,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!r(n=e.node,a=e.x0,s=e.y0,o=e.x1,l=e.y1)&&n.length){var u=(a+o)/2,c=(s+l)/2;(i=n[3])&&t.push(new or(i,u,c,o,l)),(i=n[2])&&t.push(new or(i,a,c,u,l)),(i=n[1])&&t.push(new or(i,u,s,o,c)),(i=n[0])&&t.push(new or(i,a,s,u,c))}return this}function Pet(r){var t=[],e=[],n;for(this._root&&t.push(new or(this._root,this._x0,this._y0,this._x1,this._y1));n=t.pop();){var i=n.node;if(i.length){var a,s=n.x0,o=n.y0,l=n.x1,u=n.y1,c=(s+l)/2,h=(o+u)/2;(a=i[0])&&t.push(new or(a,s,o,c,h)),(a=i[1])&&t.push(new or(a,c,o,l,h)),(a=i[2])&&t.push(new or(a,s,h,c,u)),(a=i[3])&&t.push(new or(a,c,h,l,u))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function Net(r){return r[0]}function Ret(r){return arguments.length?(this._x=r,this):this._x}function Let(r){return r[1]}function Iet(r){return arguments.length?(this._y=r,this):this._y}function B0(r,t,e){var n=new fE(t??Net,e??Let,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function fE(r,t,e,n,i,a){this._x=r,this._y=t,this._x0=e,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function Nk(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var hr=B0.prototype=fE.prototype;hr.copy=function(){var r=new fE(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,n;if(!t)return r;if(!t.length)return r._root=Nk(t),r;for(e=[{source:t,target:r._root=new Array(4)}];t=e.pop();)for(var i=0;i<4;++i)(n=t.source[i])&&(n.length?e.push({source:n,target:t.target[i]=new Array(4)}):t.target[i]=Nk(n));return r};hr.add=bet;hr.addAll=wet;hr.cover=xet;hr.data=Eet;hr.extent=_et;hr.find=Met;hr.remove=ket;hr.removeAll=Cet;hr.root=Tet;hr.size=Oet;hr.visit=Aet;hr.visitAfter=Pet;hr.x=Ret;hr.y=Iet;function Det(r){const t=+this._x.call(null,r),e=+this._y.call(null,r),n=+this._z.call(null,r);return CI(this.cover(t,e,n),t,e,n,r)}function CI(r,t,e,n,i){if(isNaN(t)||isNaN(e)||isNaN(n))return r;var a,s=r._root,o={data:i},l=r._x0,u=r._y0,c=r._z0,h=r._x1,d=r._y1,g=r._z1,p,v,m,b,w,x,S,_,k,M,C;if(!s)return r._root=o,r;for(;s.length;)if((S=t>=(p=(l+h)/2))?l=p:h=p,(_=e>=(v=(u+d)/2))?u=v:d=v,(k=n>=(m=(c+g)/2))?c=m:g=m,a=s,!(s=s[M=k<<2|_<<1|S]))return a[M]=o,r;if(b=+r._x.call(null,s.data),w=+r._y.call(null,s.data),x=+r._z.call(null,s.data),t===b&&e===w&&n===x)return o.next=s,a?a[M]=o:r._root=o,r;do a=a?a[M]=new Array(8):r._root=new Array(8),(S=t>=(p=(l+h)/2))?l=p:h=p,(_=e>=(v=(u+d)/2))?u=v:d=v,(k=n>=(m=(c+g)/2))?c=m:g=m;while((M=k<<2|_<<1|S)===(C=(x>=m)<<2|(w>=v)<<1|b>=p));return a[C]=s,a[M]=o,r}function Fet(r){Array.isArray(r)||(r=Array.from(r));const t=r.length,e=new Float64Array(t),n=new Float64Array(t),i=new Float64Array(t);let a=1/0,s=1/0,o=1/0,l=-1/0,u=-1/0,c=-1/0;for(let h=0,d,g,p,v;h<t;++h)isNaN(g=+this._x.call(null,d=r[h]))||isNaN(p=+this._y.call(null,d))||isNaN(v=+this._z.call(null,d))||(e[h]=g,n[h]=p,i[h]=v,g<a&&(a=g),g>l&&(l=g),p<s&&(s=p),p>u&&(u=p),v<o&&(o=v),v>c&&(c=v));if(a>l||s>u||o>c)return this;this.cover(a,s,o).cover(l,u,c);for(let h=0;h<t;++h)CI(this,e[h],n[h],i[h],r[h]);return this}function Bet(r,t,e){if(isNaN(r=+r)||isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,a=this._z0,s=this._x1,o=this._y1,l=this._z1;if(isNaN(n))s=(n=Math.floor(r))+1,o=(i=Math.floor(t))+1,l=(a=Math.floor(e))+1;else{for(var u=s-n||1,c=this._root,h,d;n>r||r>=s||i>t||t>=o||a>e||e>=l;)switch(d=(e<a)<<2|(t<i)<<1|r<n,h=new Array(8),h[d]=c,c=h,u*=2,d){case 0:s=n+u,o=i+u,l=a+u;break;case 1:n=s-u,o=i+u,l=a+u;break;case 2:s=n+u,i=o-u,l=a+u;break;case 3:n=s-u,i=o-u,l=a+u;break;case 4:s=n+u,o=i+u,a=l-u;break;case 5:n=s-u,o=i+u,a=l-u;break;case 6:s=n+u,i=o-u,a=l-u;break;case 7:n=s-u,i=o-u,a=l-u;break}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this}function zet(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function $et(r){return arguments.length?this.cover(+r[0][0],+r[0][1],+r[0][2]).cover(+r[1][0],+r[1][1],+r[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ke(r,t,e,n,i,a,s){this.node=r,this.x0=t,this.y0=e,this.z0=n,this.x1=i,this.y1=a,this.z1=s}function jet(r,t,e,n){var i,a=this._x0,s=this._y0,o=this._z0,l,u,c,h,d,g,p=this._x1,v=this._y1,m=this._z1,b=[],w=this._root,x,S;for(w&&b.push(new ke(w,a,s,o,p,v,m)),n==null?n=1/0:(a=r-n,s=t-n,o=e-n,p=r+n,v=t+n,m=e+n,n*=n);x=b.pop();)if(!(!(w=x.node)||(l=x.x0)>p||(u=x.y0)>v||(c=x.z0)>m||(h=x.x1)<a||(d=x.y1)<s||(g=x.z1)<o))if(w.length){var _=(l+h)/2,k=(u+d)/2,M=(c+g)/2;b.push(new ke(w[7],_,k,M,h,d,g),new ke(w[6],l,k,M,_,d,g),new ke(w[5],_,u,M,h,k,g),new ke(w[4],l,u,M,_,k,g),new ke(w[3],_,k,c,h,d,M),new ke(w[2],l,k,c,_,d,M),new ke(w[1],_,u,c,h,k,M),new ke(w[0],l,u,c,_,k,M)),(S=(e>=M)<<2|(t>=k)<<1|r>=_)&&(x=b[b.length-1],b[b.length-1]=b[b.length-1-S],b[b.length-1-S]=x)}else{var C=r-+this._x.call(null,w.data),P=t-+this._y.call(null,w.data),T=e-+this._z.call(null,w.data),A=C*C+P*P+T*T;if(A<n){var R=Math.sqrt(n=A);a=r-R,s=t-R,o=e-R,p=r+R,v=t+R,m=e+R,i=w.data}}return i}const qet=(r,t,e,n,i,a)=>Math.sqrt((r-n)**2+(t-i)**2+(e-a)**2);function Wet(r,t,e,n){const i=[],a=r-n,s=t-n,o=e-n,l=r+n,u=t+n,c=e+n;return this.visit((h,d,g,p,v,m,b)=>{if(!h.length)do{const w=h.data;qet(r,t,e,this._x(w),this._y(w),this._z(w))<=n&&i.push(w)}while(h=h.next);return d>l||g>u||p>c||v<a||m<s||b<o}),i}function Get(r){if(isNaN(d=+this._x.call(null,r))||isNaN(g=+this._y.call(null,r))||isNaN(p=+this._z.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._z0,u=this._x1,c=this._y1,h=this._z1,d,g,p,v,m,b,w,x,S,_,k;if(!e)return this;if(e.length)for(;;){if((w=d>=(v=(s+u)/2))?s=v:u=v,(x=g>=(m=(o+c)/2))?o=m:c=m,(S=p>=(b=(l+h)/2))?l=b:h=b,t=e,!(e=e[_=S<<2|x<<1|w]))return this;if(!e.length)break;(t[_+1&7]||t[_+2&7]||t[_+3&7]||t[_+4&7]||t[_+5&7]||t[_+6&7]||t[_+7&7])&&(n=t,k=_)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[_]=a:delete t[_],(e=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&e===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[k]=e:this._root=e),this):(this._root=a,this)}function Vet(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function Het(){return this._root}function Uet(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function Yet(r){var t=[],e,n=this._root,i,a,s,o,l,u,c;for(n&&t.push(new ke(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=t.pop();)if(!r(n=e.node,a=e.x0,s=e.y0,o=e.z0,l=e.x1,u=e.y1,c=e.z1)&&n.length){var h=(a+l)/2,d=(s+u)/2,g=(o+c)/2;(i=n[7])&&t.push(new ke(i,h,d,g,l,u,c)),(i=n[6])&&t.push(new ke(i,a,d,g,h,u,c)),(i=n[5])&&t.push(new ke(i,h,s,g,l,d,c)),(i=n[4])&&t.push(new ke(i,a,s,g,h,d,c)),(i=n[3])&&t.push(new ke(i,h,d,o,l,u,g)),(i=n[2])&&t.push(new ke(i,a,d,o,h,u,g)),(i=n[1])&&t.push(new ke(i,h,s,o,l,d,g)),(i=n[0])&&t.push(new ke(i,a,s,o,h,d,g))}return this}function Xet(r){var t=[],e=[],n;for(this._root&&t.push(new ke(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();){var i=n.node;if(i.length){var a,s=n.x0,o=n.y0,l=n.z0,u=n.x1,c=n.y1,h=n.z1,d=(s+u)/2,g=(o+c)/2,p=(l+h)/2;(a=i[0])&&t.push(new ke(a,s,o,l,d,g,p)),(a=i[1])&&t.push(new ke(a,d,o,l,u,g,p)),(a=i[2])&&t.push(new ke(a,s,g,l,d,c,p)),(a=i[3])&&t.push(new ke(a,d,g,l,u,c,p)),(a=i[4])&&t.push(new ke(a,s,o,p,d,g,h)),(a=i[5])&&t.push(new ke(a,d,o,p,u,g,h)),(a=i[6])&&t.push(new ke(a,s,g,p,d,c,h)),(a=i[7])&&t.push(new ke(a,d,g,p,u,c,h))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function Ket(r){return r[0]}function Zet(r){return arguments.length?(this._x=r,this):this._x}function Jet(r){return r[1]}function Qet(r){return arguments.length?(this._y=r,this):this._y}function tnt(r){return r[2]}function ent(r){return arguments.length?(this._z=r,this):this._z}function TI(r,t,e,n){var i=new gE(t??Ket,e??Jet,n??tnt,NaN,NaN,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function gE(r,t,e,n,i,a,s,o,l){this._x=r,this._y=t,this._z=e,this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this._root=void 0}function Rk(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var Gn=TI.prototype=gE.prototype;Gn.copy=function(){var r=new gE(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,e,n;if(!t)return r;if(!t.length)return r._root=Rk(t),r;for(e=[{source:t,target:r._root=new Array(8)}];t=e.pop();)for(var i=0;i<8;++i)(n=t.source[i])&&(n.length?e.push({source:n,target:t.target[i]=new Array(8)}):t.target[i]=Rk(n));return r};Gn.add=Det;Gn.addAll=Fet;Gn.cover=Bet;Gn.data=zet;Gn.extent=$et;Gn.find=jet;Gn.findAllWithinRadius=Wet;Gn.remove=Get;Gn.removeAll=Vet;Gn.root=Het;Gn.size=Uet;Gn.visit=Yet;Gn.visitAfter=Xet;Gn.x=Zet;Gn.y=Qet;Gn.z=ent;const nnt=.81,Xv=.1;function rnt(r,t,e,n,i=2){const a=t/e,s=r.getAllNodes(),o=s.map((c,h)=>{const{nodeStrength:d,x:g,y:p,z:v,size:m}=c.data;return{x:g,y:p,z:v,size:m,index:h,id:c.id,vx:0,vy:0,vz:0,weight:a*d}}),l=(i===2?B0(o,c=>c.x,c=>c.y):TI(o,c=>c.x,c=>c.y,c=>c.z)).visitAfter(int),u=new Map;return o.forEach(c=>{u.set(c.id,c),snt(c,l,i)}),o.map((c,h)=>{const{id:d,data:g}=s[h],{mass:p=1}=g;n[d]={x:c.vx/p,y:c.vy/p,z:c.vz/p}}),n}function int(r){let t=0,e=0,n=0,i=0,a=0;const s=r.length;if(s){for(let o=0;o<s;o++){const l=r[o];l&&l.weight&&(t+=l.weight,e+=l.x*l.weight,n+=l.y*l.weight,i+=l.z*l.weight,a+=l.size*l.weight)}r.x=e/t,r.y=n/t,r.z=i/t,r.size=a/t,r.weight=t}else{const o=r;r.x=o.data.x,r.y=o.data.y,r.z=o.data.z,r.size=o.data.size,r.weight=o.data.weight}}const ant=(r,t,e,n,i,a,s)=>{var o;if(((o=r.data)===null||o===void 0?void 0:o.id)===a.id)return;const l=[e,n,i][s-1],u=a.x-r.x||Xv,c=a.y-r.y||Xv,h=a.z-r.z||Xv,d=[u,c,h],g=l-t;let p=0;for(let b=0;b<s;b++)p+=d[b]*d[b];const m=Math.sqrt(p)*p;if(g*g*nnt<p){const b=r.weight/m;return a.vx+=u*b,a.vy+=c*b,a.vz+=h*b,!0}if(r.length)return!1;if(r.data!==a){const b=r.data.weight/m;a.vx+=u*b,a.vy+=c*b,a.vz+=h*b}};function snt(r,t,e){t.visit((n,i,a,s,o)=>ant(n,i,a,s,o,r,e))}const ont={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class OI{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},ont),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&n<t;n++)this.runOneStep(this.lastCalcGraph,this.lastGraph,n,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericForceLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),a=e.getAllNodes(),s=e.getAllEdges(),o=this.formatOptions(i,e),{dimensions:l,width:u,height:c,nodeSize:h,getMass:d,nodeStrength:g,edgeStrength:p,linkDistance:v}=o,m=a.map((C,P)=>Object.assign(Object.assign({},C),{data:Object.assign(Object.assign({},C.data),{x:yt(C.data.x)?C.data.x:Math.random()*u,y:yt(C.data.y)?C.data.y:Math.random()*c,z:yt(C.data.z)?C.data.z:Math.random()*Math.sqrt(u*c),size:h(C)||30,mass:d(C),nodeStrength:g(C)})})),b=s.map(C=>Object.assign(Object.assign({},C),{data:Object.assign(Object.assign({},C.data),{edgeStrength:p(C),linkDistance:v(C,e.getNode(C.source),e.getNode(C.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const w={};a.forEach((C,P)=>{w[C.id]={x:0,y:0,z:0}});const x=new kn({nodes:m,edges:b});this.formatCentripetal(o,x);const{maxIteration:S,minMovement:_,onTick:k}=o;if(this.lastLayoutNodes=m,this.lastLayoutEdges=b,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=x,this.lastOptions=o,this.lastVelMap=w,typeof window>"u")return;let M=0;return new Promise(C=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&C({nodes:Kv(e,m),edges:s}),this.runOneStep(x,e,M,w,o),this.updatePosition(e,x,w,o),t&&m.forEach(P=>e.mergeNodeData(P.id,{x:P.data.x,y:P.data.y,z:l===3?P.data.z:void 0})),k==null||k({nodes:Kv(e,m),edges:s}),M++,(M>=S||this.judgingDistance<_)&&(window.clearInterval(this.timeInterval),C({nodes:Kv(e,m),edges:s}))},0),this.running=!0})})}formatOptions(t,e){const n=Object.assign({},t),{width:i,height:a,getMass:s}=t;n.width=!i&&typeof window<"u"?window.innerWidth:i,n.height=!a&&typeof window<"u"?window.innerHeight:a,t.center||(n.center=[n.width/2,n.height/2]),s||(n.getMass=l=>{let u=1;yt(l==null?void 0:l.data.mass)&&(u=l==null?void 0:l.data.mass);const c=e.getDegree(l.id,"both");return!c||c<5?u:c*5*u}),n.nodeSize=dE(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Ao(1,t.linkDistance):l=>1+n.nodeSize(e.getNode(l.source))+n.nodeSize(e.getNode(l.target));return n.linkDistance=o,n.nodeStrength=Ao(1,t.nodeStrength),n.edgeStrength=Ao(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:l,nodeClusterBy:u}=t,c=e.getAllNodes(),h=i||{leaf:2,single:2,others:1,center:b=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=b=>s);let d,g;if(o&&u&&(d=Lk(e,u),g=Array.from(new Set(c==null?void 0:c.map(b=>b.data[u])))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:b=>{const{siblingLeaves:w,sameTypeLeaves:x}=d[b.id]||{};return(x==null?void 0:x.length)===(w==null?void 0:w.length)||(g==null?void 0:g.length)===1?1:t.clusterNodeStrength(b)},others:1,center:b=>{const w=e.getDegree(b.id,"both");if(!w)return{x:100,y:100,z:0};let x;if(w===1){const{sameTypeLeaves:S=[]}=d[b.id]||{};S.length===1?x=void 0:S.length>1&&(x=Ik(S))}else x=void 0;return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})),l&&u){d||(d=Lk(e,u)),g||(g=Array.from(new Set(c.map(w=>w.data[u])))),g=g.filter(w=>w!==void 0);const b={};g.forEach(w=>{const x=c.filter(S=>S.data[u]===w).map(S=>e.getNode(S.id));b[w]=Ik(x)}),t.centripetalOptions=Object.assign(h,{single:w=>t.clusterNodeStrength(w),leaf:w=>t.clusterNodeStrength(w),others:w=>t.clusterNodeStrength(w),center:w=>{const x=b[w.data[u]];return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})}const{leaf:p,single:v,others:m}=t.centripetalOptions||{};p&&typeof p!="function"&&(t.centripetalOptions.leaf=()=>p),v&&typeof v!="function"&&(t.centripetalOptions.single=()=>v),m&&typeof m!="function"&&(t.centripetalOptions.others=()=>m)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),l=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:u}=a;if(this.calRepulsive(t,s,a),l&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),u){const c=this.calTotalEnergy(s,o);u({energy:c,nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(e!=null&&e.length))return 0;let n=0;return e.forEach((i,a)=>{const s=t[i.id].x,o=t[i.id].y,l=this.options.dimensions===3?t[i.id].z:0,u=s*s+o*o+l*l,{mass:c=1}=i.data;n+=c*u*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;rnt(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:l,target:u}=s,c=t.getNode(l),h=t.getNode(u);if(!c||!h)return;let d=h.data.x-c.data.x,g=h.data.y-c.data.y,p=i===3?h.data.z-c.data.z:0;!d&&!g&&(d=Math.random()*.01,g=Math.random()*.01,i===3&&!p&&(p=Math.random()*.01));const v=Math.sqrt(d*d+g*g+p*p);if(v<a(c)+a(h))return;const m=d/v,b=g/v,w=p/v,{linkDistance:x=200,edgeStrength:S=200}=s.data||{},k=(x-v)*S,M=c.data.mass||1,C=h.data.mass||1,P=1/M,T=1/C,A=m*k,R=b*k,L=w*k;e[l].x-=A*P,e[l].y-=R*P,e[l].z-=L*P,e[u].x+=A*T,e[u].y+=R*T,e[u].z+=L*T})}calGravity(t,e,n,i){const{getCenter:a}=i,s=t.getAllNodes(),o=e.getAllNodes(),l=e.getAllEdges(),{width:u,height:c,center:h,gravity:d,centripetalOptions:g}=i;s&&s.forEach(p=>{const{id:v,data:m}=p,{mass:b,x:w,y:x,z:S}=m,_=e.getNode(v);let k=0,M=0,C=0,P=d;const T=t.getDegree(v,"in"),A=t.getDegree(v,"out"),R=t.getDegree(v,"both"),L=a==null?void 0:a(_,R);if(L){const[$,q,j]=L;k=w-$,M=x-q,P=j}else k=w-h[0],M=x-h[1],C=S-h[2];if(P&&(n[v].x-=P*k/b,n[v].y-=P*M/b,n[v].z-=P*C/b),g){const{leaf:$,single:q,others:j,center:B}=g,{x:F,y:V,z:X,centerStrength:K}=(B==null?void 0:B(_,o,l,u,c))||{x:0,y:0,z:0,centerStrength:0};if(!yt(F)||!yt(V))return;const nt=(w-F)/b,ot=(x-V)/b,ct=(S-X)/b;if(K&&(n[v].x-=K*nt,n[v].y-=K*ot,n[v].z-=K*ct),R===0){const pt=q(_);if(!pt)return;n[v].x-=pt*nt,n[v].y-=pt*ot,n[v].z-=pt*ct;return}if(T===0||A===0){const pt=$(_,o,l);if(!pt)return;n[v].x-=pt*nt,n[v].y-=pt*ot,n[v].z-=pt*ct;return}const ht=j(_);if(!ht)return;n[v].x-=ht*nt,n[v].y-=ht*ot,n[v].z-=ht*ct}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:l}=i,u=t.getAllNodes();u!=null&&u.length&&u.forEach(c=>{const{id:h}=c;let d=(n[h].x+e[h].x*o)*a||.01,g=(n[h].y+e[h].y*o)*a||.01,p=l===3?(n[h].z+e[h].z*o)*a||.01:0;const v=Math.sqrt(d*d+g*g+p*p);if(v>s){const m=s/v;d=m*d,g=m*g,p=m*p}n[h]={x:d,y:g,z:p}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,l=e.getAllNodes();if(!(l!=null&&l.length)){this.judgingDistance=0;return}let u=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),l.forEach(c=>{const{id:h}=c,d=t.getNode(h);if(yt(d.data.fx)&&yt(d.data.fy)){e.mergeNodeData(h,{x:d.data.fx,y:d.data.fy,z:o===3?d.data.fz:void 0});return}const g=n[h].x*s,p=n[h].y*s,v=o===3?n[h].z*s:0;e.mergeNodeData(h,{x:c.data.x+g,y:c.data.y+p,z:c.data.z+v});const m=Math.sqrt(g*g+p*p+v*v);switch(a){case"max":this.judgingDistance<m&&(this.judgingDistance=m);break;case"min":this.judgingDistance>m&&(this.judgingDistance=m);break;default:u=u+m;break}}),(!a||a==="mean")&&(this.judgingDistance=u/l.length)}}const Lk=(r,t)=>{const e=r.getAllNodes();if(!(e!=null&&e.length))return{};const n={};return e.forEach((i,a)=>{r.getDegree(i.id,"both")===1&&(n[i.id]=lnt(r,"leaf",i,t))}),n},lnt=(r,t,e,n)=>{const i=r.getDegree(e.id,"in"),a=r.getDegree(e.id,"out");let s=e,o=[];i===0?(s=r.getSuccessors(e.id)[0],o=r.getNeighbors(s.id)):a===0&&(s=r.getPredecessors(e.id)[0],o=r.getNeighbors(s.id)),o=o.filter(u=>r.getDegree(u.id,"in")===0||r.getDegree(u.id,"out")===0);const l=unt(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:l}},unt=(r,t,e,n,i)=>{const a=n.data[e]||"";let s=(i==null?void 0:i.filter(o=>o.data[e]===a))||[];return s=s.filter(o=>r.getDegree(o.id,"in")===0||r.getDegree(o.id,"out")===0),s},Ik=r=>{const t={x:0,y:0};r.forEach(n=>{const{x:i,y:a}=n.data;t.x+=i||0,t.y+=a||0});const e=r.length||1;return{x:t.x/e,y:t.y/e}},Kv=(r,t)=>t.map(e=>{const{id:n,data:i}=e,a=r.getNode(n);return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign({},a.data),{x:i.x,y:i.y,z:i.z})})});var ne={};const cnt=Object.prototype.toString;function xc(r){const t=cnt.call(r);return t.endsWith("Array]")&&!t.includes("Big")}const hnt=Object.freeze(Object.defineProperty({__proto__:null,isAnyArray:xc},Symbol.toStringTag,{value:"Module"})),dnt=ER(hnt);function fnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!xc(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,n=e===void 0?0:e,i=t.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=r[n],o=n+1;o<a;o++)r[o]>s&&(s=r[o]);return s}function gnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!xc(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,n=e===void 0?0:e,i=t.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=r[n],o=n+1;o<a;o++)r[o]<s&&(s=r[o]);return s}function pnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(xc(r)){if(r.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var e;if(t.output!==void 0){if(!xc(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(r.length);var n=gnt(r),i=fnt(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=t.min,s=a===void 0?t.autoMinMax?n:0:a,o=t.max,l=o===void 0?t.autoMinMax?i:1:o;if(s>=l)throw new RangeError("min option must be smaller than max option");for(var u=(l-s)/(i-n),c=0;c<r.length;c++)e[c]=(r[c]-n)*u+s;return e}const vnt=Object.freeze(Object.defineProperty({__proto__:null,default:pnt},Symbol.toStringTag,{value:"Module"})),mnt=ER(vnt);Object.defineProperty(ne,"__esModule",{value:!0});var Er=dnt,Dk=mnt;const Od=" ".repeat(2),AI=" ".repeat(4);function ynt(){return PI(this)}function PI(r,t={}){const{maxRows:e=15,maxColumns:n=10,maxNumSize:i=8,padMinus:a="auto"}=t;return`${r.constructor.name} {
- ${Od}[
- ${AI}${bnt(r,e,n,i,a)}
- ${Od}]
- ${Od}rows: ${r.rows}
- ${Od}columns: ${r.columns}
- }`}function bnt(r,t,e,n,i){const{rows:a,columns:s}=r,o=Math.min(a,t),l=Math.min(s,e),u=[];if(i==="auto"){i=!1;t:for(let c=0;c<o;c++)for(let h=0;h<l;h++)if(r.get(c,h)<0){i=!0;break t}}for(let c=0;c<o;c++){let h=[];for(let d=0;d<l;d++)h.push(wnt(r.get(c,d),n,i));u.push(`${h.join(" ")}`)}return l!==s&&(u[u.length-1]+=` ... ${s-e} more columns`),o!==a&&u.push(`... ${a-t} more rows`),u.join(`
- ${AI}`)}function wnt(r,t,e){return(r>=0&&e?` ${Fk(r,t-1)}`:Fk(r,t)).padEnd(t)}function Fk(r,t){let e=r.toString();if(e.length<=t)return e;let n=r.toFixed(t);if(n.length>t&&(n=r.toFixed(Math.max(0,t-(n.length-t)))),n.length<=t&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let i=r.toExponential(t);return i.length>t&&(i=r.toExponential(Math.max(0,t-(i.length-t)))),i.slice(0)}function xnt(r,t){r.prototype.add=function(n){return typeof n=="number"?this.addS(n):this.addM(n)},r.prototype.addS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n);return this},r.prototype.addM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n.get(i,a));return this},r.add=function(n,i){return new t(n).add(i)},r.prototype.sub=function(n){return typeof n=="number"?this.subS(n):this.subM(n)},r.prototype.subS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n);return this},r.prototype.subM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n.get(i,a));return this},r.sub=function(n,i){return new t(n).sub(i)},r.prototype.subtract=r.prototype.sub,r.prototype.subtractS=r.prototype.subS,r.prototype.subtractM=r.prototype.subM,r.subtract=r.sub,r.prototype.mul=function(n){return typeof n=="number"?this.mulS(n):this.mulM(n)},r.prototype.mulS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n);return this},r.prototype.mulM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n.get(i,a));return this},r.mul=function(n,i){return new t(n).mul(i)},r.prototype.multiply=r.prototype.mul,r.prototype.multiplyS=r.prototype.mulS,r.prototype.multiplyM=r.prototype.mulM,r.multiply=r.mul,r.prototype.div=function(n){return typeof n=="number"?this.divS(n):this.divM(n)},r.prototype.divS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n);return this},r.prototype.divM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n.get(i,a));return this},r.div=function(n,i){return new t(n).div(i)},r.prototype.divide=r.prototype.div,r.prototype.divideS=r.prototype.divS,r.prototype.divideM=r.prototype.divM,r.divide=r.div,r.prototype.mod=function(n){return typeof n=="number"?this.modS(n):this.modM(n)},r.prototype.modS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n);return this},r.prototype.modM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n.get(i,a));return this},r.mod=function(n,i){return new t(n).mod(i)},r.prototype.modulus=r.prototype.mod,r.prototype.modulusS=r.prototype.modS,r.prototype.modulusM=r.prototype.modM,r.modulus=r.mod,r.prototype.and=function(n){return typeof n=="number"?this.andS(n):this.andM(n)},r.prototype.andS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n);return this},r.prototype.andM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n.get(i,a));return this},r.and=function(n,i){return new t(n).and(i)},r.prototype.or=function(n){return typeof n=="number"?this.orS(n):this.orM(n)},r.prototype.orS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n);return this},r.prototype.orM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n.get(i,a));return this},r.or=function(n,i){return new t(n).or(i)},r.prototype.xor=function(n){return typeof n=="number"?this.xorS(n):this.xorM(n)},r.prototype.xorS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n);return this},r.prototype.xorM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n.get(i,a));return this},r.xor=function(n,i){return new t(n).xor(i)},r.prototype.leftShift=function(n){return typeof n=="number"?this.leftShiftS(n):this.leftShiftM(n)},r.prototype.leftShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n);return this},r.prototype.leftShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n.get(i,a));return this},r.leftShift=function(n,i){return new t(n).leftShift(i)},r.prototype.signPropagatingRightShift=function(n){return typeof n=="number"?this.signPropagatingRightShiftS(n):this.signPropagatingRightShiftM(n)},r.prototype.signPropagatingRightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n);return this},r.prototype.signPropagatingRightShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n.get(i,a));return this},r.signPropagatingRightShift=function(n,i){return new t(n).signPropagatingRightShift(i)},r.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},r.prototype.rightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n);return this},r.prototype.rightShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n.get(i,a));return this},r.rightShift=function(n,i){return new t(n).rightShift(i)},r.prototype.zeroFillRightShift=r.prototype.rightShift,r.prototype.zeroFillRightShiftS=r.prototype.rightShiftS,r.prototype.zeroFillRightShiftM=r.prototype.rightShiftM,r.zeroFillRightShift=r.rightShift,r.prototype.not=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,~this.get(n,i));return this},r.not=function(n){return new t(n).not()},r.prototype.abs=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.abs(this.get(n,i)));return this},r.abs=function(n){return new t(n).abs()},r.prototype.acos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acos(this.get(n,i)));return this},r.acos=function(n){return new t(n).acos()},r.prototype.acosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acosh(this.get(n,i)));return this},r.acosh=function(n){return new t(n).acosh()},r.prototype.asin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asin(this.get(n,i)));return this},r.asin=function(n){return new t(n).asin()},r.prototype.asinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asinh(this.get(n,i)));return this},r.asinh=function(n){return new t(n).asinh()},r.prototype.atan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atan(this.get(n,i)));return this},r.atan=function(n){return new t(n).atan()},r.prototype.atanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atanh(this.get(n,i)));return this},r.atanh=function(n){return new t(n).atanh()},r.prototype.cbrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cbrt(this.get(n,i)));return this},r.cbrt=function(n){return new t(n).cbrt()},r.prototype.ceil=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.ceil(this.get(n,i)));return this},r.ceil=function(n){return new t(n).ceil()},r.prototype.clz32=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.clz32(this.get(n,i)));return this},r.clz32=function(n){return new t(n).clz32()},r.prototype.cos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cos(this.get(n,i)));return this},r.cos=function(n){return new t(n).cos()},r.prototype.cosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cosh(this.get(n,i)));return this},r.cosh=function(n){return new t(n).cosh()},r.prototype.exp=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.exp(this.get(n,i)));return this},r.exp=function(n){return new t(n).exp()},r.prototype.expm1=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.expm1(this.get(n,i)));return this},r.expm1=function(n){return new t(n).expm1()},r.prototype.floor=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.floor(this.get(n,i)));return this},r.floor=function(n){return new t(n).floor()},r.prototype.fround=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.fround(this.get(n,i)));return this},r.fround=function(n){return new t(n).fround()},r.prototype.log=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log(this.get(n,i)));return this},r.log=function(n){return new t(n).log()},r.prototype.log1p=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log1p(this.get(n,i)));return this},r.log1p=function(n){return new t(n).log1p()},r.prototype.log10=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log10(this.get(n,i)));return this},r.log10=function(n){return new t(n).log10()},r.prototype.log2=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log2(this.get(n,i)));return this},r.log2=function(n){return new t(n).log2()},r.prototype.round=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.round(this.get(n,i)));return this},r.round=function(n){return new t(n).round()},r.prototype.sign=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sign(this.get(n,i)));return this},r.sign=function(n){return new t(n).sign()},r.prototype.sin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sin(this.get(n,i)));return this},r.sin=function(n){return new t(n).sin()},r.prototype.sinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sinh(this.get(n,i)));return this},r.sinh=function(n){return new t(n).sinh()},r.prototype.sqrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sqrt(this.get(n,i)));return this},r.sqrt=function(n){return new t(n).sqrt()},r.prototype.tan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tan(this.get(n,i)));return this},r.tan=function(n){return new t(n).tan()},r.prototype.tanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tanh(this.get(n,i)));return this},r.tanh=function(n){return new t(n).tanh()},r.prototype.trunc=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.trunc(this.get(n,i)));return this},r.trunc=function(n){return new t(n).trunc()},r.pow=function(n,i){return new t(n).pow(i)},r.prototype.pow=function(n){return typeof n=="number"?this.powS(n):this.powM(n)},r.prototype.powS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)**n);return this},r.prototype.powM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)**n.get(i,a));return this}}function hi(r,t,e){let n=e?r.rows:r.rows-1;if(t<0||t>n)throw new RangeError("Row index out of range")}function di(r,t,e){let n=e?r.columns:r.columns-1;if(t<0||t>n)throw new RangeError("Column index out of range")}function Tl(r,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==r.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function Ol(r,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==r.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function pE(r,t){if(!Er.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=r.rows)throw new RangeError("row indices are out of range")}function vE(r,t){if(!Er.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=r.columns)throw new RangeError("column indices are out of range")}function tx(r,t,e,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Ad("startRow",t),Ad("endRow",e),Ad("startColumn",n),Ad("endColumn",i),t>e||n>i||t<0||t>=r.rows||e<0||e>=r.rows||n<0||n>=r.columns||i<0||i>=r.columns)throw new RangeError("Submatrix indices are out of range")}function z0(r,t=0){let e=[];for(let n=0;n<r;n++)e.push(t);return e}function Ad(r,t){if(typeof t!="number")throw new TypeError(`${r} must be a number`)}function bl(r){if(r.isEmpty())throw new Error("Empty matrix has no elements to index")}function Ent(r){let t=z0(r.rows);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[e]+=r.get(e,n);return t}function _nt(r){let t=z0(r.columns);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[n]+=r.get(e,n);return t}function Snt(r){let t=0;for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)t+=r.get(e,n);return t}function Mnt(r){let t=z0(r.rows,1);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[e]*=r.get(e,n);return t}function knt(r){let t=z0(r.columns,1);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[n]*=r.get(e,n);return t}function Cnt(r){let t=1;for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)t*=r.get(e,n);return t}function Tnt(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<n;s++){let o=0,l=0,u=0;for(let c=0;c<i;c++)u=r.get(s,c)-e[s],o+=u,l+=u*u;t?a.push((l-o*o/i)/(i-1)):a.push((l-o*o/i)/i)}return a}function Ont(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<i;s++){let o=0,l=0,u=0;for(let c=0;c<n;c++)u=r.get(c,s)-e[s],o+=u,l+=u*u;t?a.push((l-o*o/n)/(n-1)):a.push((l-o*o/n)/n)}return a}function Ant(r,t,e){const n=r.rows,i=r.columns,a=n*i;let s=0,o=0,l=0;for(let u=0;u<n;u++)for(let c=0;c<i;c++)l=r.get(u,c)-e,s+=l,o+=l*l;return t?(o-s*s/a)/(a-1):(o-s*s/a)/a}function Pnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t[e])}function Nnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t[n])}function Rnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t)}function Lnt(r){const t=[];for(let e=0;e<r.rows;e++){let n=0;for(let i=0;i<r.columns;i++)n+=r.get(e,i)**2/(r.columns-1);t.push(Math.sqrt(n))}return t}function Int(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[e])}function Dnt(r){const t=[];for(let e=0;e<r.columns;e++){let n=0;for(let i=0;i<r.rows;i++)n+=r.get(i,e)**2/(r.rows-1);t.push(Math.sqrt(n))}return t}function Fnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[n])}function Bnt(r){const t=r.size-1;let e=0;for(let n=0;n<r.columns;n++)for(let i=0;i<r.rows;i++)e+=r.get(i,n)**2/t;return Math.sqrt(e)}function znt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t)}class Vt{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let a=new mt(t,e);for(let s=0;s<t;s++)for(let o=0;o<e;o++)a.set(s,o,n[s*e+o]);return a}static rowVector(t){let e=new mt(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new mt(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new mt(t,e)}static ones(t,e){return new mt(t,e).fill(1)}static rand(t,e,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new mt(t,e);for(let s=0;s<t;s++)for(let o=0;o<e;o++)a.set(s,o,i());return a}static randInt(t,e,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:s=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");let o=a-i,l=new mt(t,e);for(let u=0;u<t;u++)for(let c=0;c<e;c++){let h=i+Math.round(s()*o);l.set(u,c,h)}return l}static eye(t,e,n){e===void 0&&(e=t),n===void 0&&(n=1);let i=Math.min(t,e),a=this.zeros(t,e);for(let s=0;s<i;s++)a.set(s,s,n);return a}static diag(t,e,n){let i=t.length;e===void 0&&(e=i),n===void 0&&(n=e);let a=Math.min(i,e,n),s=this.zeros(e,n);for(let o=0;o<a;o++)s.set(o,o,t[o]);return s}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,a=new mt(n,i);for(let s=0;s<n;s++)for(let o=0;o<i;o++)a.set(s,o,Math.min(t.get(s,o),e.get(s,o)));return a}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,a=new this(n,i);for(let s=0;s<n;s++)for(let o=0;o<i;o++)a.set(s,o,Math.max(t.get(s,o),e.get(s,o)));return a}static checkMatrix(t){return Vt.isMatrix(t)?t:new mt(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(this.get(t,t)!==0)return!1;return!0}isEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);for(let s=e+1;s<this.rows;s++)this.get(t,s)!==0&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let i=e;for(let a=e;a<t.rows;a++)t.get(a,n)>t.get(i,n)&&(i=a);if(t.get(i,n)===0)n++;else{t.swapRows(e,i);let a=t.get(e,n);for(let s=n;s<t.columns;s++)t.set(e,s,t.get(e,s)/a);for(let s=e+1;s<t.rows;s++){let o=t.get(s,n)/t.get(e,n);t.set(s,n,0);for(let l=n+1;l<t.columns;l++)t.set(s,l,t.get(s,l)-t.get(e,l)*o)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,i=n-1;for(;i>=0;)if(t.maxRow(i)===0)i--;else{let a=0,s=!1;for(;a<n&&s===!1;)t.get(i,a)===1?s=!0:a++;for(let o=0;o<i;o++){let l=t.get(o,a);for(let u=a;u<e;u++){let c=t.get(o,u)-l*t.get(i,u);t.set(o,u,c)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new mt(this.rows*e,this.columns*n);for(let a=0;a<e;a++)for(let s=0;s<n;s++)i.setSubMatrix(this,this.rows*a,this.columns*s);return i}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){hi(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return mt.rowVector(this.getRow(t))}setRow(t,e){hi(this,t),e=Tl(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){hi(this,t),hi(this,e);for(let n=0;n<this.columns;n++){let i=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,i)}return this}getColumn(t){di(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return mt.columnVector(this.getColumn(t))}setColumn(t,e){di(this,t),e=Ol(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){di(this,t),di(this,e);for(let n=0;n<this.rows;n++){let i=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,i)}return this}addRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=Ol(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=Ol(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=Ol(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=Ol(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){hi(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){di(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e[n]&&(e[n]=this.get(n,i));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e[i]&&(e[i]=this.get(n,i));return e}case void 0:{let e=this.get(0,0);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){bl(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e[n]&&(e[n]=this.get(n,i));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e[i]&&(e[i]=this.get(n,i));return e}case void 0:{let e=this.get(0,0);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e&&(e=this.get(n,i));return e}default:throw new Error(`invalid option: ${t}`)}}minIndex(){bl(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}maxRow(t){if(hi(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){hi(this,t),bl(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),n[1]=i);return n}minRow(t){if(hi(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){hi(this,t),bl(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),n[1]=i);return n}maxColumn(t){if(di(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){di(this,t),bl(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),n[0]=i);return n}minColumn(t){if(di(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){di(this,t),bl(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t),n[0]=i);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){Vt.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i];return n}mmul(t){t=mt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.columns,a=new mt(e,i),s=new Float64Array(n);for(let o=0;o<i;o++){for(let l=0;l<n;l++)s[l]=t.get(l,o);for(let l=0;l<e;l++){let u=0;for(let c=0;c<n;c++)u+=this.get(l,c)*s[c];a.set(l,o,u)}}return a}mpow(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");let e=mt.eye(this.rows),n=this;for(let i=t;i>1;i/=2)i&1&&(e=e.mmul(n)),n=n.mmul(n);return e}strassen2x2(t){t=mt.checkMatrix(t);let e=new mt(2,2);const n=this.get(0,0),i=t.get(0,0),a=this.get(0,1),s=t.get(0,1),o=this.get(1,0),l=t.get(1,0),u=this.get(1,1),c=t.get(1,1),h=(n+u)*(i+c),d=(o+u)*i,g=n*(s-c),p=u*(l-i),v=(n+a)*c,m=(o-n)*(i+s),b=(a-u)*(l+c),w=h+p-v+b,x=g+v,S=d+p,_=h-d+g+m;return e.set(0,0,w),e.set(0,1,x),e.set(1,0,S),e.set(1,1,_),e}strassen3x3(t){t=mt.checkMatrix(t);let e=new mt(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),s=this.get(1,0),o=this.get(1,1),l=this.get(1,2),u=this.get(2,0),c=this.get(2,1),h=this.get(2,2),d=t.get(0,0),g=t.get(0,1),p=t.get(0,2),v=t.get(1,0),m=t.get(1,1),b=t.get(1,2),w=t.get(2,0),x=t.get(2,1),S=t.get(2,2),_=(n+i+a-s-o-c-h)*m,k=(n-s)*(-g+m),M=o*(-d+g+v-m-b-w+S),C=(-n+s+o)*(d-g+m),P=(s+o)*(-d+g),T=n*d,A=(-n+u+c)*(d-p+b),R=(-n+u)*(p-b),L=(u+c)*(-d+p),$=(n+i+a-o-l-u-c)*b,q=c*(-d+p+v-m-b-w+x),j=(-a+c+h)*(m+w-x),B=(a-h)*(m-x),F=a*w,V=(c+h)*(-w+x),X=(-a+o+l)*(b+w-S),K=(a-l)*(b-S),nt=(o+l)*(-w+S),ot=i*v,ct=l*x,ht=s*p,pt=u*g,wt=h*S,zt=T+F+ot,Wt=_+C+P+T+j+F+V,Te=T+A+L+$+F+X+nt,Ge=k+M+C+T+F+X+K,Ve=k+C+P+T+ct,In=F+X+K+nt+ht,yn=T+A+R+q+j+B+F,te=j+B+F+V+pt,wi=T+A+R+L+wt;return e.set(0,0,zt),e.set(0,1,Wt),e.set(0,2,Te),e.set(1,0,Ge),e.set(1,1,Ve),e.set(1,2,In),e.set(2,0,yn),e.set(2,1,te),e.set(2,2,wi),e}mmulStrassen(t){t=mt.checkMatrix(t);let e=this.clone(),n=e.rows,i=e.columns,a=t.rows,s=t.columns;i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${s} matrix: dimensions do not match.`);function o(h,d,g){let p=h.rows,v=h.columns;if(p===d&&v===g)return h;{let m=Vt.zeros(d,g);return m=m.setSubMatrix(h,0,0),m}}let l=Math.max(n,a),u=Math.max(i,s);e=o(e,l,u),t=o(t,l,u);function c(h,d,g,p){if(g<=512||p<=512)return h.mmul(d);g%2===1&&p%2===1?(h=o(h,g+1,p+1),d=o(d,g+1,p+1)):g%2===1?(h=o(h,g+1,p),d=o(d,g+1,p)):p%2===1&&(h=o(h,g,p+1),d=o(d,g,p+1));let v=parseInt(h.rows/2,10),m=parseInt(h.columns/2,10),b=h.subMatrix(0,v-1,0,m-1),w=d.subMatrix(0,v-1,0,m-1),x=h.subMatrix(0,v-1,m,h.columns-1),S=d.subMatrix(0,v-1,m,d.columns-1),_=h.subMatrix(v,h.rows-1,0,m-1),k=d.subMatrix(v,d.rows-1,0,m-1),M=h.subMatrix(v,h.rows-1,m,h.columns-1),C=d.subMatrix(v,d.rows-1,m,d.columns-1),P=c(Vt.add(b,M),Vt.add(w,C),v,m),T=c(Vt.add(_,M),w,v,m),A=c(b,Vt.sub(S,C),v,m),R=c(M,Vt.sub(k,w),v,m),L=c(Vt.add(b,x),C,v,m),$=c(Vt.sub(_,b),Vt.add(w,S),v,m),q=c(Vt.sub(x,M),Vt.add(k,C),v,m),j=Vt.add(P,R);j.sub(L),j.add(q);let B=Vt.add(A,L),F=Vt.add(T,R),V=Vt.sub(P,T);V.add(A),V.add($);let X=Vt.zeros(2*j.rows,2*j.columns);return X=X.setSubMatrix(j,0,0),X=X.setSubMatrix(B,j.rows,0),X=X.setSubMatrix(F,0,j.columns),X=X.setSubMatrix(V,j.rows,j.columns),X.subMatrix(0,g-1,0,p-1)}return c(e,t,l,u)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new mt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const s=this.getRow(a);s.length>0&&Dk(s,{min:e,max:n,output:s}),i.setRow(a,s)}return i}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new mt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const s=this.getColumn(a);s.length&&Dk(s,{min:e,max:n,output:s}),i.setColumn(a,s)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let i=this.get(e,n),a=this.get(e,this.columns-1-n);this.set(e,n,a),this.set(e,this.columns-1-n,i)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let i=this.get(n,e),a=this.get(this.rows-1-n,e);this.set(n,e,a),this.set(this.rows-1-n,e,i)}return this}kroneckerProduct(t){t=mt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.rows,a=t.columns,s=new mt(e*i,n*a);for(let o=0;o<e;o++)for(let l=0;l<n;l++)for(let u=0;u<i;u++)for(let c=0;c<a;c++)s.set(i*o+u,a*l+c,this.get(o,l)*t.get(u,c));return s}kroneckerSum(t){if(t=mt.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,i=this.kroneckerProduct(mt.eye(n,n)),a=mt.eye(e,e).kroneckerProduct(t);return i.add(a)}transpose(){let t=new mt(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=Bk){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Bk){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,i){tx(this,t,e,n,i);let a=new mt(e-t+1,i-n+1);for(let s=t;s<=e;s++)for(let o=n;o<=i;o++)a.set(s-t,o-n,this.get(s,o));return a}subMatrixRow(t,e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new mt(t.length,n-e+1);for(let a=0;a<t.length;a++)for(let s=e;s<=n;s++){if(t[a]<0||t[a]>=this.rows)throw new RangeError(`Row index out of range: ${t[a]}`);i.set(a,s-e,this.get(t[a],s))}return i}subMatrixColumn(t,e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new mt(n-e+1,t.length);for(let a=0;a<t.length;a++)for(let s=e;s<=n;s++){if(t[a]<0||t[a]>=this.columns)throw new RangeError(`Column index out of range: ${t[a]}`);i.set(s-e,a,this.get(s,t[a]))}return i}setSubMatrix(t,e,n){if(t=mt.checkMatrix(t),t.isEmpty())return this;let i=e+t.rows-1,a=n+t.columns-1;tx(this,e,i,n,a);for(let s=0;s<t.rows;s++)for(let o=0;o<t.columns;o++)this.set(e+s,n+o,t.get(s,o));return this}selection(t,e){pE(this,t),vE(this,e);let n=new mt(t.length,e.length);for(let i=0;i<t.length;i++){let a=t[i];for(let s=0;s<e.length;s++){let o=e[s];n.set(i,s,this.get(a,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){return this.constructor.copy(this,new mt(this.rows,this.columns))}static copy(t,e){for(const[n,i,a]of t.entries())e.set(n,i,a);return e}sum(t){switch(t){case"row":return Ent(this);case"column":return _nt(this);case void 0:return Snt(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return Mnt(this);case"column":return knt(this);case void 0:return Cnt(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let n=0;n<this.rows;n++)e[n]/=this.columns;return e}case"column":{for(let n=0;n<this.columns;n++)e[n]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(t)}=e;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!Er.isAnyArray(i))throw new TypeError("mean must be an array");return Tnt(this,n,i)}case"column":{if(!Er.isAnyArray(i))throw new TypeError("mean must be an array");return Ont(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return Ant(this,n,i)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const n=this.variance(t,e);if(t===void 0)return Math.sqrt(n);for(let i=0;i<n.length;i++)n[i]=Math.sqrt(n[i]);return n}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":{if(!Er.isAnyArray(n))throw new TypeError("center must be an array");return Pnt(this,n),this}case"column":{if(!Er.isAnyArray(n))throw new TypeError("center must be an array");return Nnt(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return Rnt(this,n),this}default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":{if(n===void 0)n=Lnt(this);else if(!Er.isAnyArray(n))throw new TypeError("scale must be an array");return Int(this,n),this}case"column":{if(n===void 0)n=Dnt(this);else if(!Er.isAnyArray(n))throw new TypeError("scale must be an array");return Fnt(this,n),this}case void 0:{if(n===void 0)n=Bnt(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return znt(this,n),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return PI(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}Vt.prototype.klass="Matrix";typeof Symbol<"u"&&(Vt.prototype[Symbol.for("nodejs.util.inspect.custom")]=ynt);function Bk(r,t){return r-t}function $nt(r){return r.every(t=>typeof t=="number")}Vt.random=Vt.rand;Vt.randomInt=Vt.randInt;Vt.diagonal=Vt.diag;Vt.prototype.diagonal=Vt.prototype.diag;Vt.identity=Vt.eye;Vt.prototype.negate=Vt.prototype.neg;Vt.prototype.tensorProduct=Vt.prototype.kroneckerProduct;var Cc,ex,Ro;let mt=(Ro=class extends Vt{constructor(e,n){super();nv(this,Cc);oe(this,"data");if(Ro.isMatrix(e))rv(this,Cc,ex).call(this,e.rows,e.columns),Ro.copy(e,this);else if(Number.isInteger(e)&&e>=0)rv(this,Cc,ex).call(this,e,n);else if(Er.isAnyArray(e)){const i=e;if(e=i.length,n=e?i[0].length:0,typeof n!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let a=0;a<e;a++){if(i[a].length!==n)throw new RangeError("Inconsistent array dimensions");if(!$nt(i[a]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(i[a]))}this.rows=e,this.columns=n}else throw new TypeError("First argument must be a positive number or an array")}set(e,n,i){return this.data[e][n]=i,this}get(e,n){return this.data[e][n]}removeRow(e){return hi(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,n){return n===void 0&&(n=e,e=this.rows),hi(this,e,!0),n=Float64Array.from(Tl(this,n)),this.data.splice(e,0,n),this.rows+=1,this}removeColumn(e){di(this,e);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns-1);for(let a=0;a<e;a++)i[a]=this.data[n][a];for(let a=e+1;a<this.columns;a++)i[a-1]=this.data[n][a];this.data[n]=i}return this.columns-=1,this}addColumn(e,n){typeof n>"u"&&(n=e,e=this.columns),di(this,e,!0),n=Ol(this,n);for(let i=0;i<this.rows;i++){const a=new Float64Array(this.columns+1);let s=0;for(;s<e;s++)a[s]=this.data[i][s];for(a[s++]=n[i];s<this.columns+1;s++)a[s]=this.data[i][s-1];this.data[i]=a}return this.columns+=1,this}},Cc=new WeakSet,ex=function(e,n){if(this.data=[],Number.isInteger(n)&&n>=0)for(let i=0;i<e;i++)this.data.push(new Float64Array(n));else throw new TypeError("nColumns must be a positive integer");this.rows=e,this.columns=n},Ro);xnt(Vt,mt);var Xn;const Qf=class Qf extends Vt{constructor(e){super();nv(this,Xn);if(mt.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");jh(this,Xn,mt.copy(e,new mt(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)jh(this,Xn,new mt(e,e));else if(jh(this,Xn,new mt(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return Ci(this,Xn).size}get rows(){return Ci(this,Xn).rows}get columns(){return Ci(this,Xn).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return mt.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new Qf(this.diagonalSize);for(const[n,i,a]of this.upperRightEntries())e.set(n,i,a);return e}toMatrix(){return new mt(this)}get(e,n){return Ci(this,Xn).get(e,n)}set(e,n,i){return Ci(this,Xn).set(e,n,i),Ci(this,Xn).set(n,e,i),this}removeCross(e){return Ci(this,Xn).removeRow(e),Ci(this,Xn).removeColumn(e),this}addCross(e,n){n===void 0&&(n=e,e=this.diagonalSize);const i=n.slice();return i.splice(e,1),Ci(this,Xn).addRow(e,i),Ci(this,Xn).addColumn(e,n),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const n=[];for(const[i,a]of e.entries())a||n.push(i);n.reverse();for(const i of n)this.removeCross(i);return this}toCompact(){const{diagonalSize:e}=this,n=new Array(e*(e+1)/2);for(let i=0,a=0,s=0;s<n.length;s++)n[s]=this.get(a,i),++i>=e&&(i=++a);return n}static fromCompact(e){const n=e.length,i=(Math.sqrt(8*n+1)-1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const a=new Qf(i);for(let s=0,o=0,l=0;l<n;l++)a.set(s,o,e[l]),++s>=i&&(s=++o);return a}*upperRightEntries(){for(let e=0,n=0;e<this.diagonalSize;void 0){const i=this.get(e,n);yield[e,n,i],++n>=this.diagonalSize&&(n=++e)}}*upperRightValues(){for(let e=0,n=0;e<this.diagonalSize;void 0)yield this.get(e,n),++n>=this.diagonalSize&&(n=++e)}};Xn=new WeakMap;let Po=Qf;Po.prototype.klassType="SymmetricMatrix";class $0 extends Po{static isDistanceMatrix(t){return Po.isSymmetricMatrix(t)&&t.klassSubType==="DistanceMatrix"}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,n){return t===e&&(n=0),super.set(t,e,n)}addCross(t,e){return e===void 0&&(e=t,t=this.diagonalSize),e=e.slice(),e[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new Po(this)}clone(){const t=new $0(this.diagonalSize);for(const[e,n,i]of this.upperRightEntries())e!==n&&t.set(e,n,i);return t}toCompact(){const{diagonalSize:t}=this,e=(t-1)*t/2,n=new Array(e);for(let i=1,a=0,s=0;s<n.length;s++)n[s]=this.get(a,i),++i>=t&&(i=++a+1);return n}static fromCompact(t){const e=t.length;if(e===0)return new this(0);const n=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const i=new this(n);for(let a=1,s=0,o=0;o<e;o++)i.set(a,s,t[o]),++a>=n&&(a=++s+1);return i}}$0.prototype.klassSubType="DistanceMatrix";class Xa extends Vt{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class jnt extends Xa{constructor(t,e){di(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}}class qnt extends Xa{constructor(t,e){vE(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,n){return this.matrix.set(t,this.columnIndices[e],n),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class Wnt extends Xa{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class Gnt extends Xa{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class Vnt extends Xa{constructor(t,e){hi(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}}class Hnt extends Xa{constructor(t,e){pE(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,n){return this.matrix.set(this.rowIndices[t],e,n),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class ef extends Xa{constructor(t,e,n){pE(t,e),vE(t,n),super(t,e.length,n.length),this.rowIndices=e,this.columnIndices=n}set(t,e,n){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],n),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class Unt extends Xa{constructor(t,e,n,i,a){tx(t,e,n,i,a),super(t,n-e+1,a-i+1),this.startRow=e,this.startColumn=i}set(t,e,n){return this.matrix.set(this.startRow+t,this.startColumn+e,n),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class Ynt extends Xa{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}}class NI extends Vt{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let i=this._calculateIndex(t,e);return this.data[i]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class Ur extends Vt{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}function Xnt(r,t){if(Er.isAnyArray(r))return r[0]&&Er.isAnyArray(r[0])?new Ur(r):new NI(r,t);throw new Error("the argument is not an array")}class j0{constructor(t){t=Ur.checkMatrix(t);let e=t.clone(),n=e.rows,i=e.columns,a=new Float64Array(n),s=1,o,l,u,c,h,d,g,p,v;for(o=0;o<n;o++)a[o]=o;for(p=new Float64Array(n),l=0;l<i;l++){for(o=0;o<n;o++)p[o]=e.get(o,l);for(o=0;o<n;o++){for(v=Math.min(o,l),h=0,u=0;u<v;u++)h+=e.get(o,u)*p[u];p[o]-=h,e.set(o,l,p[o])}for(c=l,o=l+1;o<n;o++)Math.abs(p[o])>Math.abs(p[c])&&(c=o);if(c!==l){for(u=0;u<i;u++)d=e.get(c,u),e.set(c,u,e.get(l,u)),e.set(l,u,d);g=a[c],a[c]=a[l],a[l]=g,s=-s}if(l<n&&e.get(l,l)!==0)for(o=l+1;o<n;o++)e.set(o,l,e.get(o,l)/e.get(l,l))}this.LU=e,this.pivotVector=a,this.pivotSign=s}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(t.get(n,n)===0)return!0;return!1}solve(t){t=mt.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=t.columns,a=t.subMatrixRow(this.pivotVector,0,i-1),s=e.columns,o,l,u;for(u=0;u<s;u++)for(o=u+1;o<s;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u));for(u=s-1;u>=0;u--){for(l=0;l<i;l++)a.set(u,l,a.get(u,l)/e.get(u,u));for(o=0;o<u;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u))}return a}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let i=0;i<n;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new mt(e,n);for(let a=0;a<e;a++)for(let s=0;s<n;s++)a>s?i.set(a,s,t.get(a,s)):a===s?i.set(a,s,1):i.set(a,s,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new mt(e,n);for(let a=0;a<e;a++)for(let s=0;s<n;s++)a<=s?i.set(a,s,t.get(a,s)):i.set(a,s,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function ka(r,t){let e=0;return Math.abs(r)>Math.abs(t)?(e=t/r,Math.abs(r)*Math.sqrt(1+e*e)):t!==0?(e=r/t,Math.abs(t)*Math.sqrt(1+e*e)):0}class mE{constructor(t){t=Ur.checkMatrix(t);let e=t.clone(),n=t.rows,i=t.columns,a=new Float64Array(i),s,o,l,u;for(l=0;l<i;l++){let c=0;for(s=l;s<n;s++)c=ka(c,e.get(s,l));if(c!==0){for(e.get(l,l)<0&&(c=-c),s=l;s<n;s++)e.set(s,l,e.get(s,l)/c);for(e.set(l,l,e.get(l,l)+1),o=l+1;o<i;o++){for(u=0,s=l;s<n;s++)u+=e.get(s,l)*e.get(s,o);for(u=-u/e.get(l,l),s=l;s<n;s++)e.set(s,o,e.get(s,o)+u*e.get(s,l))}}a[l]=-c}this.QR=e,this.Rdiag=a}solve(t){t=mt.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=t.columns,a=t.clone(),s=e.columns,o,l,u,c;for(u=0;u<s;u++)for(l=0;l<i;l++){for(c=0,o=u;o<n;o++)c+=e.get(o,u)*a.get(o,l);for(c=-c/e.get(u,u),o=u;o<n;o++)a.set(o,l,a.get(o,l)+c*e.get(o,u))}for(u=s-1;u>=0;u--){for(l=0;l<i;l++)a.set(u,l,a.get(u,l)/this.Rdiag[u]);for(o=0;o<u;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u))}return a.subMatrix(0,s-1,0,i-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,n=new mt(e,e),i,a;for(i=0;i<e;i++)for(a=0;a<e;a++)i<a?n.set(i,a,t.get(i,a)):i===a?n.set(i,a,this.Rdiag[i]):n.set(i,a,0);return n}get orthogonalMatrix(){let t=this.QR,e=t.rows,n=t.columns,i=new mt(e,n),a,s,o,l;for(o=n-1;o>=0;o--){for(a=0;a<e;a++)i.set(a,o,0);for(i.set(o,o,1),s=o;s<n;s++)if(t.get(o,o)!==0){for(l=0,a=o;a<e;a++)l+=t.get(a,o)*i.get(a,s);for(l=-l/t.get(o,o),a=o;a<e;a++)i.set(a,s,i.get(a,s)+l*t.get(a,o))}}return i}}let eu=class{constructor(t,e={}){if(t=Ur.checkMatrix(t),t.isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,i=t.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:s=!0,autoTranspose:o=!1}=e;let l=!!a,u=!!s,c=!1,h;if(n<i)if(!o)h=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{h=t.transpose(),n=h.rows,i=h.columns,c=!0;let T=l;l=u,u=T}else h=t.clone();let d=Math.min(n,i),g=Math.min(n+1,i),p=new Float64Array(g),v=new mt(n,d),m=new mt(i,i),b=new Float64Array(i),w=new Float64Array(n),x=new Float64Array(g);for(let T=0;T<g;T++)x[T]=T;let S=Math.min(n-1,i),_=Math.max(0,Math.min(i-2,n)),k=Math.max(S,_);for(let T=0;T<k;T++){if(T<S){p[T]=0;for(let A=T;A<n;A++)p[T]=ka(p[T],h.get(A,T));if(p[T]!==0){h.get(T,T)<0&&(p[T]=-p[T]);for(let A=T;A<n;A++)h.set(A,T,h.get(A,T)/p[T]);h.set(T,T,h.get(T,T)+1)}p[T]=-p[T]}for(let A=T+1;A<i;A++){if(T<S&&p[T]!==0){let R=0;for(let L=T;L<n;L++)R+=h.get(L,T)*h.get(L,A);R=-R/h.get(T,T);for(let L=T;L<n;L++)h.set(L,A,h.get(L,A)+R*h.get(L,T))}b[A]=h.get(T,A)}if(l&&T<S)for(let A=T;A<n;A++)v.set(A,T,h.get(A,T));if(T<_){b[T]=0;for(let A=T+1;A<i;A++)b[T]=ka(b[T],b[A]);if(b[T]!==0){b[T+1]<0&&(b[T]=0-b[T]);for(let A=T+1;A<i;A++)b[A]/=b[T];b[T+1]+=1}if(b[T]=-b[T],T+1<n&&b[T]!==0){for(let A=T+1;A<n;A++)w[A]=0;for(let A=T+1;A<n;A++)for(let R=T+1;R<i;R++)w[A]+=b[R]*h.get(A,R);for(let A=T+1;A<i;A++){let R=-b[A]/b[T+1];for(let L=T+1;L<n;L++)h.set(L,A,h.get(L,A)+R*w[L])}}if(u)for(let A=T+1;A<i;A++)m.set(A,T,b[A])}}let M=Math.min(i,n+1);if(S<i&&(p[S]=h.get(S,S)),n<M&&(p[M-1]=0),_+1<M&&(b[_]=h.get(_,M-1)),b[M-1]=0,l){for(let T=S;T<d;T++){for(let A=0;A<n;A++)v.set(A,T,0);v.set(T,T,1)}for(let T=S-1;T>=0;T--)if(p[T]!==0){for(let A=T+1;A<d;A++){let R=0;for(let L=T;L<n;L++)R+=v.get(L,T)*v.get(L,A);R=-R/v.get(T,T);for(let L=T;L<n;L++)v.set(L,A,v.get(L,A)+R*v.get(L,T))}for(let A=T;A<n;A++)v.set(A,T,-v.get(A,T));v.set(T,T,1+v.get(T,T));for(let A=0;A<T-1;A++)v.set(A,T,0)}else{for(let A=0;A<n;A++)v.set(A,T,0);v.set(T,T,1)}}if(u)for(let T=i-1;T>=0;T--){if(T<_&&b[T]!==0)for(let A=T+1;A<i;A++){let R=0;for(let L=T+1;L<i;L++)R+=m.get(L,T)*m.get(L,A);R=-R/m.get(T+1,T);for(let L=T+1;L<i;L++)m.set(L,A,m.get(L,A)+R*m.get(L,T))}for(let A=0;A<i;A++)m.set(A,T,0);m.set(T,T,1)}let C=M-1,P=Number.EPSILON;for(;M>0;){let T,A;for(T=M-2;T>=-1&&T!==-1;T--){const R=Number.MIN_VALUE+P*Math.abs(p[T]+Math.abs(p[T+1]));if(Math.abs(b[T])<=R||Number.isNaN(b[T])){b[T]=0;break}}if(T===M-2)A=4;else{let R;for(R=M-1;R>=T&&R!==T;R--){let L=(R!==M?Math.abs(b[R]):0)+(R!==T+1?Math.abs(b[R-1]):0);if(Math.abs(p[R])<=P*L){p[R]=0;break}}R===T?A=3:R===M-1?A=1:(A=2,T=R)}switch(T++,A){case 1:{let R=b[M-2];b[M-2]=0;for(let L=M-2;L>=T;L--){let $=ka(p[L],R),q=p[L]/$,j=R/$;if(p[L]=$,L!==T&&(R=-j*b[L-1],b[L-1]=q*b[L-1]),u)for(let B=0;B<i;B++)$=q*m.get(B,L)+j*m.get(B,M-1),m.set(B,M-1,-j*m.get(B,L)+q*m.get(B,M-1)),m.set(B,L,$)}break}case 2:{let R=b[T-1];b[T-1]=0;for(let L=T;L<M;L++){let $=ka(p[L],R),q=p[L]/$,j=R/$;if(p[L]=$,R=-j*b[L],b[L]=q*b[L],l)for(let B=0;B<n;B++)$=q*v.get(B,L)+j*v.get(B,T-1),v.set(B,T-1,-j*v.get(B,L)+q*v.get(B,T-1)),v.set(B,L,$)}break}case 3:{const R=Math.max(Math.abs(p[M-1]),Math.abs(p[M-2]),Math.abs(b[M-2]),Math.abs(p[T]),Math.abs(b[T])),L=p[M-1]/R,$=p[M-2]/R,q=b[M-2]/R,j=p[T]/R,B=b[T]/R,F=(($+L)*($-L)+q*q)/2,V=L*q*(L*q);let X=0;(F!==0||V!==0)&&(F<0?X=0-Math.sqrt(F*F+V):X=Math.sqrt(F*F+V),X=V/(F+X));let K=(j+L)*(j-L)+X,nt=j*B;for(let ot=T;ot<M-1;ot++){let ct=ka(K,nt);ct===0&&(ct=Number.MIN_VALUE);let ht=K/ct,pt=nt/ct;if(ot!==T&&(b[ot-1]=ct),K=ht*p[ot]+pt*b[ot],b[ot]=ht*b[ot]-pt*p[ot],nt=pt*p[ot+1],p[ot+1]=ht*p[ot+1],u)for(let wt=0;wt<i;wt++)ct=ht*m.get(wt,ot)+pt*m.get(wt,ot+1),m.set(wt,ot+1,-pt*m.get(wt,ot)+ht*m.get(wt,ot+1)),m.set(wt,ot,ct);if(ct=ka(K,nt),ct===0&&(ct=Number.MIN_VALUE),ht=K/ct,pt=nt/ct,p[ot]=ct,K=ht*b[ot]+pt*p[ot+1],p[ot+1]=-pt*b[ot]+ht*p[ot+1],nt=pt*b[ot+1],b[ot+1]=ht*b[ot+1],l&&ot<n-1)for(let wt=0;wt<n;wt++)ct=ht*v.get(wt,ot)+pt*v.get(wt,ot+1),v.set(wt,ot+1,-pt*v.get(wt,ot)+ht*v.get(wt,ot+1)),v.set(wt,ot,ct)}b[M-2]=K;break}case 4:{if(p[T]<=0&&(p[T]=p[T]<0?-p[T]:0,u))for(let R=0;R<=C;R++)m.set(R,T,-m.get(R,T));for(;T<C&&!(p[T]>=p[T+1]);){let R=p[T];if(p[T]=p[T+1],p[T+1]=R,u&&T<i-1)for(let L=0;L<i;L++)R=m.get(L,T+1),m.set(L,T+1,m.get(L,T)),m.set(L,T,R);if(l&&T<n-1)for(let L=0;L<n;L++)R=v.get(L,T+1),v.set(L,T+1,v.get(L,T)),v.set(L,T,R);T++}M--;break}}}if(c){let T=m;m=v,v=T}this.m=n,this.n=i,this.s=p,this.U=v,this.V=m}solve(t){let e=t,n=this.threshold,i=this.s.length,a=mt.zeros(i,i);for(let d=0;d<i;d++)Math.abs(this.s[d])<=n?a.set(d,d,0):a.set(d,d,1/this.s[d]);let s=this.U,o=this.rightSingularVectors,l=o.mmul(a),u=o.rows,c=s.rows,h=mt.zeros(u,c);for(let d=0;d<u;d++)for(let g=0;g<c;g++){let p=0;for(let v=0;v<i;v++)p+=l.get(d,v)*s.get(g,v);h.set(d,g,p)}return h.mmul(e)}solveForDiagonal(t){return this.solve(mt.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,i=t.columns,a=new mt(n,this.s.length);for(let c=0;c<n;c++)for(let h=0;h<i;h++)Math.abs(this.s[h])>e&&a.set(c,h,t.get(c,h)/this.s[h]);let s=this.U,o=s.rows,l=s.columns,u=new mt(n,o);for(let c=0;c<n;c++)for(let h=0;h<o;h++){let d=0;for(let g=0;g<l;g++)d+=a.get(c,g)*s.get(h,g);u.set(c,h,d)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return mt.diag(this.s)}};function Knt(r,t=!1){return r=Ur.checkMatrix(r),t?new eu(r).inverse():RI(r,mt.eye(r.rows))}function RI(r,t,e=!1){return r=Ur.checkMatrix(r),t=Ur.checkMatrix(t),e?new eu(r).solve(t):r.isSquare()?new j0(r).solve(t):new mE(r).solve(t)}function nf(r){if(r=mt.checkMatrix(r),r.isSquare()){if(r.columns===0)return 1;let t,e,n,i;if(r.columns===2)return t=r.get(0,0),e=r.get(0,1),n=r.get(1,0),i=r.get(1,1),t*i-e*n;if(r.columns===3){let a,s,o;return a=new ef(r,[1,2],[1,2]),s=new ef(r,[1,2],[0,2]),o=new ef(r,[1,2],[0,1]),t=r.get(0,0),e=r.get(0,1),n=r.get(0,2),t*nf(a)-e*nf(s)+n*nf(o)}else return new j0(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Znt(r,t){let e=[];for(let n=0;n<r;n++)n!==t&&e.push(n);return e}function Jnt(r,t,e,n=1e-9,i=1e-9){if(r>i)return new Array(t.rows+1).fill(0);{let a=t.addRow(e,[0]);for(let s=0;s<a.rows;s++)Math.abs(a.get(s,0))<n&&a.set(s,0,0);return a.to1DArray()}}function Qnt(r,t={}){const{thresholdValue:e=1e-9,thresholdError:n=1e-9}=t;r=mt.checkMatrix(r);let i=r.rows,a=new mt(i,i);for(let s=0;s<i;s++){let o=mt.columnVector(r.getRow(s)),l=r.subMatrixRow(Znt(i,s)).transpose(),c=new eu(l).solve(o),h=mt.sub(o,l.mmul(c)).abs().max();a.setRow(s,Jnt(h,c,s,e,n))}return a}function trt(r,t=Number.EPSILON){if(r=mt.checkMatrix(r),r.isEmpty())return r.transpose();let e=new eu(r,{autoTranspose:!0}),n=e.leftSingularVectors,i=e.rightSingularVectors,a=e.diagonal;for(let s=0;s<a.length;s++)Math.abs(a[s])>t?a[s]=1/a[s]:a[s]=0;return i.mmul(mt.diag(a).mmul(n.transpose()))}function ert(r,t=r,e={}){r=new mt(r);let n=!1;if(typeof t=="object"&&!mt.isMatrix(t)&&!Er.isAnyArray(t)?(e=t,t=r,n=!0):t=new mt(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=e;i&&(r=r.center("column"),n||(t=t.center("column")));const a=r.transpose().mmul(t);for(let s=0;s<a.rows;s++)for(let o=0;o<a.columns;o++)a.set(s,o,a.get(s,o)*(1/(r.rows-1)));return a}function nrt(r,t=r,e={}){r=new mt(r);let n=!1;if(typeof t=="object"&&!mt.isMatrix(t)&&!Er.isAnyArray(t)?(e=t,t=r,n=!0):t=new mt(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:a=!0}=e;i&&(r.center("column"),n||t.center("column")),a&&(r.scale("column"),n||t.scale("column"));const s=r.standardDeviation("column",{unbiased:!0}),o=n?s:t.standardDeviation("column",{unbiased:!0}),l=r.transpose().mmul(t);for(let u=0;u<l.rows;u++)for(let c=0;c<l.columns;c++)l.set(u,c,l.get(u,c)*(1/(s[u]*o[c]))*(1/(r.rows-1)));return l}class LI{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(t=Ur.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let i=t.columns,a=new mt(i,i),s=new Float64Array(i),o=new Float64Array(i),l=t,u,c,h=!1;if(n?h=!0:h=t.isSymmetric(),h){for(u=0;u<i;u++)for(c=0;c<i;c++)a.set(u,c,l.get(u,c));rrt(i,o,s,a),irt(i,o,s,a)}else{let d=new mt(i,i),g=new Float64Array(i);for(c=0;c<i;c++)for(u=0;u<i;u++)d.set(u,c,l.get(u,c));art(i,d,g,a),srt(i,o,s,a,d)}this.n=i,this.e=o,this.d=s,this.V=a}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t=this.n,e=this.e,n=this.d,i=new mt(t,t),a,s;for(a=0;a<t;a++){for(s=0;s<t;s++)i.set(a,s,0);i.set(a,a,n[a]),e[a]>0?i.set(a,a+1,e[a]):e[a]<0&&i.set(a,a-1,e[a])}return i}}function rrt(r,t,e,n){let i,a,s,o,l,u,c,h;for(l=0;l<r;l++)e[l]=n.get(r-1,l);for(o=r-1;o>0;o--){for(h=0,s=0,u=0;u<o;u++)h=h+Math.abs(e[u]);if(h===0)for(t[o]=e[o-1],l=0;l<o;l++)e[l]=n.get(o-1,l),n.set(o,l,0),n.set(l,o,0);else{for(u=0;u<o;u++)e[u]/=h,s+=e[u]*e[u];for(i=e[o-1],a=Math.sqrt(s),i>0&&(a=-a),t[o]=h*a,s=s-i*a,e[o-1]=i-a,l=0;l<o;l++)t[l]=0;for(l=0;l<o;l++){for(i=e[l],n.set(l,o,i),a=t[l]+n.get(l,l)*i,u=l+1;u<=o-1;u++)a+=n.get(u,l)*e[u],t[u]+=n.get(u,l)*i;t[l]=a}for(i=0,l=0;l<o;l++)t[l]/=s,i+=t[l]*e[l];for(c=i/(s+s),l=0;l<o;l++)t[l]-=c*e[l];for(l=0;l<o;l++){for(i=e[l],a=t[l],u=l;u<=o-1;u++)n.set(u,l,n.get(u,l)-(i*t[u]+a*e[u]));e[l]=n.get(o-1,l),n.set(o,l,0)}}e[o]=s}for(o=0;o<r-1;o++){if(n.set(r-1,o,n.get(o,o)),n.set(o,o,1),s=e[o+1],s!==0){for(u=0;u<=o;u++)e[u]=n.get(u,o+1)/s;for(l=0;l<=o;l++){for(a=0,u=0;u<=o;u++)a+=n.get(u,o+1)*n.get(u,l);for(u=0;u<=o;u++)n.set(u,l,n.get(u,l)-a*e[u])}}for(u=0;u<=o;u++)n.set(u,o+1,0)}for(l=0;l<r;l++)e[l]=n.get(r-1,l),n.set(r-1,l,0);n.set(r-1,r-1,1),t[0]=0}function irt(r,t,e,n){let i,a,s,o,l,u,c,h,d,g,p,v,m,b,w,x;for(s=1;s<r;s++)t[s-1]=t[s];t[r-1]=0;let S=0,_=0,k=Number.EPSILON;for(u=0;u<r;u++){for(_=Math.max(_,Math.abs(e[u])+Math.abs(t[u])),c=u;c<r&&!(Math.abs(t[c])<=k*_);)c++;if(c>u)do{for(i=e[u],h=(e[u+1]-i)/(2*t[u]),d=ka(h,1),h<0&&(d=-d),e[u]=t[u]/(h+d),e[u+1]=t[u]*(h+d),g=e[u+1],a=i-e[u],s=u+2;s<r;s++)e[s]-=a;for(S=S+a,h=e[c],p=1,v=p,m=p,b=t[u+1],w=0,x=0,s=c-1;s>=u;s--)for(m=v,v=p,x=w,i=p*t[s],a=p*h,d=ka(h,t[s]),t[s+1]=w*d,w=t[s]/d,p=h/d,h=p*e[s]-w*i,e[s+1]=a+w*(p*i+w*e[s]),l=0;l<r;l++)a=n.get(l,s+1),n.set(l,s+1,w*n.get(l,s)+p*a),n.set(l,s,p*n.get(l,s)-w*a);h=-w*x*m*b*t[u]/g,t[u]=w*h,e[u]=p*h}while(Math.abs(t[u])>k*_);e[u]=e[u]+S,t[u]=0}for(s=0;s<r-1;s++){for(l=s,h=e[s],o=s+1;o<r;o++)e[o]<h&&(l=o,h=e[o]);if(l!==s)for(e[l]=e[s],e[s]=h,o=0;o<r;o++)h=n.get(o,s),n.set(o,s,n.get(o,l)),n.set(o,l,h)}}function art(r,t,e,n){let i=0,a=r-1,s,o,l,u,c,h,d;for(h=i+1;h<=a-1;h++){for(d=0,u=h;u<=a;u++)d=d+Math.abs(t.get(u,h-1));if(d!==0){for(l=0,u=a;u>=h;u--)e[u]=t.get(u,h-1)/d,l+=e[u]*e[u];for(o=Math.sqrt(l),e[h]>0&&(o=-o),l=l-e[h]*o,e[h]=e[h]-o,c=h;c<r;c++){for(s=0,u=a;u>=h;u--)s+=e[u]*t.get(u,c);for(s=s/l,u=h;u<=a;u++)t.set(u,c,t.get(u,c)-s*e[u])}for(u=0;u<=a;u++){for(s=0,c=a;c>=h;c--)s+=e[c]*t.get(u,c);for(s=s/l,c=h;c<=a;c++)t.set(u,c,t.get(u,c)-s*e[c])}e[h]=d*e[h],t.set(h,h-1,d*o)}}for(u=0;u<r;u++)for(c=0;c<r;c++)n.set(u,c,u===c?1:0);for(h=a-1;h>=i+1;h--)if(t.get(h,h-1)!==0){for(u=h+1;u<=a;u++)e[u]=t.get(u,h-1);for(c=h;c<=a;c++){for(o=0,u=h;u<=a;u++)o+=e[u]*n.get(u,c);for(o=o/e[h]/t.get(h,h-1),u=h;u<=a;u++)n.set(u,c,n.get(u,c)+o*e[u])}}}function srt(r,t,e,n,i){let a=r-1,s=0,o=r-1,l=Number.EPSILON,u=0,c=0,h=0,d=0,g=0,p=0,v=0,m=0,b,w,x,S,_,k,M,C,P,T,A,R,L,$,q;for(b=0;b<r;b++)for((b<s||b>o)&&(e[b]=i.get(b,b),t[b]=0),w=Math.max(b-1,0);w<r;w++)c=c+Math.abs(i.get(b,w));for(;a>=s;){for(S=a;S>s&&(p=Math.abs(i.get(S-1,S-1))+Math.abs(i.get(S,S)),p===0&&(p=c),!(Math.abs(i.get(S,S-1))<l*p));)S--;if(S===a)i.set(a,a,i.get(a,a)+u),e[a]=i.get(a,a),t[a]=0,a--,m=0;else if(S===a-1){if(M=i.get(a,a-1)*i.get(a-1,a),h=(i.get(a-1,a-1)-i.get(a,a))/2,d=h*h+M,v=Math.sqrt(Math.abs(d)),i.set(a,a,i.get(a,a)+u),i.set(a-1,a-1,i.get(a-1,a-1)+u),C=i.get(a,a),d>=0){for(v=h>=0?h+v:h-v,e[a-1]=C+v,e[a]=e[a-1],v!==0&&(e[a]=C-M/v),t[a-1]=0,t[a]=0,C=i.get(a,a-1),p=Math.abs(C)+Math.abs(v),h=C/p,d=v/p,g=Math.sqrt(h*h+d*d),h=h/g,d=d/g,w=a-1;w<r;w++)v=i.get(a-1,w),i.set(a-1,w,d*v+h*i.get(a,w)),i.set(a,w,d*i.get(a,w)-h*v);for(b=0;b<=a;b++)v=i.get(b,a-1),i.set(b,a-1,d*v+h*i.get(b,a)),i.set(b,a,d*i.get(b,a)-h*v);for(b=s;b<=o;b++)v=n.get(b,a-1),n.set(b,a-1,d*v+h*n.get(b,a)),n.set(b,a,d*n.get(b,a)-h*v)}else e[a-1]=C+h,e[a]=C+h,t[a-1]=v,t[a]=-v;a=a-2,m=0}else{if(C=i.get(a,a),P=0,M=0,S<a&&(P=i.get(a-1,a-1),M=i.get(a,a-1)*i.get(a-1,a)),m===10){for(u+=C,b=s;b<=a;b++)i.set(b,b,i.get(b,b)-C);p=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),C=P=.75*p,M=-.4375*p*p}if(m===30&&(p=(P-C)/2,p=p*p+M,p>0)){for(p=Math.sqrt(p),P<C&&(p=-p),p=C-M/((P-C)/2+p),b=s;b<=a;b++)i.set(b,b,i.get(b,b)-p);u+=p,C=P=M=.964}for(m=m+1,_=a-2;_>=S&&(v=i.get(_,_),g=C-v,p=P-v,h=(g*p-M)/i.get(_+1,_)+i.get(_,_+1),d=i.get(_+1,_+1)-v-g-p,g=i.get(_+2,_+1),p=Math.abs(h)+Math.abs(d)+Math.abs(g),h=h/p,d=d/p,g=g/p,!(_===S||Math.abs(i.get(_,_-1))*(Math.abs(d)+Math.abs(g))<l*(Math.abs(h)*(Math.abs(i.get(_-1,_-1))+Math.abs(v)+Math.abs(i.get(_+1,_+1))))));)_--;for(b=_+2;b<=a;b++)i.set(b,b-2,0),b>_+2&&i.set(b,b-3,0);for(x=_;x<=a-1&&($=x!==a-1,x!==_&&(h=i.get(x,x-1),d=i.get(x+1,x-1),g=$?i.get(x+2,x-1):0,C=Math.abs(h)+Math.abs(d)+Math.abs(g),C!==0&&(h=h/C,d=d/C,g=g/C)),C!==0);x++)if(p=Math.sqrt(h*h+d*d+g*g),h<0&&(p=-p),p!==0){for(x!==_?i.set(x,x-1,-p*C):S!==_&&i.set(x,x-1,-i.get(x,x-1)),h=h+p,C=h/p,P=d/p,v=g/p,d=d/h,g=g/h,w=x;w<r;w++)h=i.get(x,w)+d*i.get(x+1,w),$&&(h=h+g*i.get(x+2,w),i.set(x+2,w,i.get(x+2,w)-h*v)),i.set(x,w,i.get(x,w)-h*C),i.set(x+1,w,i.get(x+1,w)-h*P);for(b=0;b<=Math.min(a,x+3);b++)h=C*i.get(b,x)+P*i.get(b,x+1),$&&(h=h+v*i.get(b,x+2),i.set(b,x+2,i.get(b,x+2)-h*g)),i.set(b,x,i.get(b,x)-h),i.set(b,x+1,i.get(b,x+1)-h*d);for(b=s;b<=o;b++)h=C*n.get(b,x)+P*n.get(b,x+1),$&&(h=h+v*n.get(b,x+2),n.set(b,x+2,n.get(b,x+2)-h*g)),n.set(b,x,n.get(b,x)-h),n.set(b,x+1,n.get(b,x+1)-h*d)}}}if(c!==0){for(a=r-1;a>=0;a--)if(h=e[a],d=t[a],d===0)for(S=a,i.set(a,a,1),b=a-1;b>=0;b--){for(M=i.get(b,b)-h,g=0,w=S;w<=a;w++)g=g+i.get(b,w)*i.get(w,a);if(t[b]<0)v=M,p=g;else if(S=b,t[b]===0?i.set(b,a,M!==0?-g/M:-g/(l*c)):(C=i.get(b,b+1),P=i.get(b+1,b),d=(e[b]-h)*(e[b]-h)+t[b]*t[b],k=(C*p-v*g)/d,i.set(b,a,k),i.set(b+1,a,Math.abs(C)>Math.abs(v)?(-g-M*k)/C:(-p-P*k)/v)),k=Math.abs(i.get(b,a)),l*k*k>1)for(w=b;w<=a;w++)i.set(w,a,i.get(w,a)/k)}else if(d<0)for(S=a-1,Math.abs(i.get(a,a-1))>Math.abs(i.get(a-1,a))?(i.set(a-1,a-1,d/i.get(a,a-1)),i.set(a-1,a,-(i.get(a,a)-h)/i.get(a,a-1))):(q=Pd(0,-i.get(a-1,a),i.get(a-1,a-1)-h,d),i.set(a-1,a-1,q[0]),i.set(a-1,a,q[1])),i.set(a,a-1,0),i.set(a,a,1),b=a-2;b>=0;b--){for(T=0,A=0,w=S;w<=a;w++)T=T+i.get(b,w)*i.get(w,a-1),A=A+i.get(b,w)*i.get(w,a);if(M=i.get(b,b)-h,t[b]<0)v=M,g=T,p=A;else if(S=b,t[b]===0?(q=Pd(-T,-A,M,d),i.set(b,a-1,q[0]),i.set(b,a,q[1])):(C=i.get(b,b+1),P=i.get(b+1,b),R=(e[b]-h)*(e[b]-h)+t[b]*t[b]-d*d,L=(e[b]-h)*2*d,R===0&&L===0&&(R=l*c*(Math.abs(M)+Math.abs(d)+Math.abs(C)+Math.abs(P)+Math.abs(v))),q=Pd(C*g-v*T+d*A,C*p-v*A-d*T,R,L),i.set(b,a-1,q[0]),i.set(b,a,q[1]),Math.abs(C)>Math.abs(v)+Math.abs(d)?(i.set(b+1,a-1,(-T-M*i.get(b,a-1)+d*i.get(b,a))/C),i.set(b+1,a,(-A-M*i.get(b,a)-d*i.get(b,a-1))/C)):(q=Pd(-g-P*i.get(b,a-1),-p-P*i.get(b,a),v,d),i.set(b+1,a-1,q[0]),i.set(b+1,a,q[1]))),k=Math.max(Math.abs(i.get(b,a-1)),Math.abs(i.get(b,a))),l*k*k>1)for(w=b;w<=a;w++)i.set(w,a-1,i.get(w,a-1)/k),i.set(w,a,i.get(w,a)/k)}for(b=0;b<r;b++)if(b<s||b>o)for(w=b;w<r;w++)n.set(b,w,i.get(b,w));for(w=r-1;w>=s;w--)for(b=s;b<=o;b++){for(v=0,x=s;x<=Math.min(w,o);x++)v=v+n.get(b,x)*i.get(x,w);n.set(b,w,v)}}}function Pd(r,t,e,n){let i,a;return Math.abs(e)>Math.abs(n)?(i=n/e,a=e+i*n,[(r+i*t)/a,(t-i*r)/a]):(i=e/n,a=n+i*e,[(i*r+t)/a,(i*t-r)/a])}class II{constructor(t){if(t=Ur.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,n=e.rows,i=new mt(n,n),a=!0,s,o,l;for(o=0;o<n;o++){let u=0;for(l=0;l<o;l++){let c=0;for(s=0;s<l;s++)c+=i.get(l,s)*i.get(o,s);c=(e.get(o,l)-c)/i.get(l,l),i.set(o,l,c),u=u+c*c}for(u=e.get(o,o)-u,a&&(a=u>0),i.set(o,o,Math.sqrt(Math.max(u,0))),l=o+1;l<n;l++)i.set(o,l,0)}this.L=i,this.positiveDefinite=a}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=Ur.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=t.columns,a=t.clone(),s,o,l;for(l=0;l<n;l++)for(o=0;o<i;o++){for(s=0;s<l;s++)a.set(l,o,a.get(l,o)-a.get(s,o)*e.get(l,s));a.set(l,o,a.get(l,o)/e.get(l,l))}for(l=n-1;l>=0;l--)for(o=0;o<i;o++){for(s=l+1;s<n;s++)a.set(l,o,a.get(l,o)-a.get(s,o)*e.get(s,l));a.set(l,o,a.get(l,o)/e.get(l,l))}return a}get lowerTriangularMatrix(){return this.L}}class DI{constructor(t,e={}){t=Ur.checkMatrix(t);let{Y:n}=e;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:s=1e-10}=e;let o;if(n){if(Er.isAnyArray(n)&&typeof n[0]=="number"?n=mt.columnVector(n):n=Ur.checkMatrix(n),n.rows!==t.rows)throw new Error("Y should have the same number of rows as X");o=n.getColumnVector(0)}else o=t.getColumnVector(0);let l=1,u,c,h,d;for(let g=0;g<a&&l>s;g++)h=t.transpose().mmul(o).div(o.transpose().mmul(o).get(0,0)),h=h.div(h.norm()),u=t.mmul(h).div(h.transpose().mmul(h).get(0,0)),g>0&&(l=u.clone().sub(d).pow(2).sum()),d=u.clone(),n?(c=n.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),c=c.div(c.norm()),o=n.mmul(c).div(c.transpose().mmul(c).get(0,0))):o=u;if(n){let g=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));g=g.div(g.norm());let p=t.clone().sub(u.clone().mmul(g.transpose())),v=o.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),m=n.clone().sub(u.clone().mulS(v.get(0,0)).mmul(c.transpose()));this.t=u,this.p=g.transpose(),this.w=h.transpose(),this.q=c,this.u=o,this.s=u.transpose().mmul(u),this.xResidual=p,this.yResidual=m,this.betas=v}else this.w=h.transpose(),this.s=u.transpose().mmul(u).sqrt(),i?this.t=u.clone().div(this.s.get(0,0)):this.t=u,this.xResidual=t.sub(u.mmul(h.transpose()))}}ne.AbstractMatrix=Vt;ne.CHO=II;ne.CholeskyDecomposition=II;ne.DistanceMatrix=$0;ne.EVD=LI;ne.EigenvalueDecomposition=LI;ne.LU=j0;ne.LuDecomposition=j0;var FI=ne.Matrix=mt;ne.MatrixColumnSelectionView=qnt;ne.MatrixColumnView=jnt;ne.MatrixFlipColumnView=Wnt;ne.MatrixFlipRowView=Gnt;ne.MatrixRowSelectionView=Hnt;ne.MatrixRowView=Vnt;ne.MatrixSelectionView=ef;ne.MatrixSubView=Unt;ne.MatrixTransposeView=Ynt;ne.NIPALS=DI;ne.Nipals=DI;ne.QR=mE;ne.QrDecomposition=mE;ne.SVD=eu;var ort=ne.SingularValueDecomposition=eu;ne.SymmetricMatrix=Po;ne.WrapperMatrix1D=NI;ne.WrapperMatrix2D=Ur;ne.correlation=nrt;ne.covariance=ert;var zk=ne.default=mt;ne.determinant=nf;ne.inverse=Knt;ne.linearDependencies=Qnt;ne.pseudoInverse=trt;ne.solve=RI;ne.wrap=Xnt;const Ts=FI,BI=ort;zk.Matrix&&zk.Matrix;const lrt={center:[0,0],linkDistance:50};class zI{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},lrt),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a=[0,0],linkDistance:s=50}=i,o=e.getAllNodes(),l=e.getAllEdges();if(!(o!=null&&o.length)||o.length===1)return Uo(e,t,a);const u=MI({nodes:o,edges:l}),c=SI(u);urt(c);const h=uet(c,s),d=crt(h),g=[];return d.forEach((v,m)=>{const b=qr(o[m]);b.data.x=v[0]+a[0],b.data.y=v[1]+a[1],g.push(b)}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:l}})}}const urt=r=>{let t=-999999;r.forEach(e=>{e.forEach(n=>{n!==1/0&&t<n&&(t=n)})}),r.forEach((e,n)=>{e.forEach((i,a)=>{i===1/0&&(r[n][a]=t)})})},crt=r=>{const e=Ts.mul(Ts.pow(r,2),-.5),n=e.mean("row"),i=e.mean("column"),a=e.mean();e.add(a).subRowVector(n).subColumnVector(i);const s=new BI(e),o=Ts.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(l=>Ts.mul([l],[o]).toJSON()[0].splice(0,2))};function nx(r){return!!r.tick&&!!r.stop}const hrt={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},drt={center:[0,0],comboPadding:10,treeKey:"combo"};class frt{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},drt),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,l=e.getAllNodes().filter(C=>!C.data._isCombo),u=e.getAllNodes().filter(C=>C.data._isCombo),c=e.getAllEdges(),h=l==null?void 0:l.length;if(!h||h===1)return Uo(e,t,a);const d=[],g=new Map;l.forEach(C=>{g.set(C.id,C)});const p=new Map;u.forEach(C=>{p.set(C.id,C)});const v=new Map,m=this.getInnerGraphs(e,s,g,p,c,i,v);yield Promise.all(m);const b=new Map,w=[],x=new Map;let S=!0;e.getRoots(s).forEach(C=>{const P=v.get(C.id),T=p.get(C.id)||g.get(C.id),A={id:C.id,data:Object.assign(Object.assign({},C.data),{x:P.data.x||T.data.x,y:P.data.y||T.data.y,fx:P.data.fx||T.data.fx,fy:P.data.fy||T.data.fy,mass:P.data.mass||T.data.mass,size:P.data.size})};w.push(A),b.set(C.id,!0),!isNaN(A.data.x)&&A.data.x!==0&&!isNaN(A.data.y)&&A.data.y!==0?S=!1:(A.data.x=Math.random()*100,A.data.y=Math.random()*100),Zw(e,[C],R=>{R.id!==C.id&&x.set(R.id,C.id)},"TB",s)});const _=[];c.forEach(C=>{const P=x.get(C.source)||C.source,T=x.get(C.target)||C.target;P!==T&&b.has(P)&&b.has(T)&&_.push({id:C.id,source:P,target:T,data:{}})});let k;if(w!=null&&w.length){if(w.length===1)w[0].data.x=a[0],w[0].data.y=a[1];else{const C=new kn({nodes:w,edges:_}),P=o||new OI;S&&hrt[P.id]&&(yield(w.length<100?new zI:new Qw).assign(C));const T=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},P.id==="force"?{gravity:1,factor:4,linkDistance:(A,R,L)=>{const $=Math.max(...R.data.size)||32,q=Math.max(...L.data.size)||32;return $/2+q/2+200}}:{});k=yield $k(P,C,T)}v.forEach(C=>{var P;const T=k.nodes.find(L=>L.id===C.id);if(T){const{x:L,y:$}=T.data;C.data.visited=!0,C.data.x=L,C.data.y=$,d.push({id:C.id,data:{x:L,y:$}})}const{x:A,y:R}=C.data;(P=C.data.nodes)===null||P===void 0||P.forEach(L=>{d.push({id:L.id,data:{x:L.data.x+A,y:L.data.y+R}})})}),v.forEach(({data:C})=>{const{x:P,y:T,visited:A,nodes:R}=C;R==null||R.forEach(L=>{if(!A){const $=d.find(q=>q.id===L.id);$.data.x+=P||0,$.data.y+=T||0}})})}return t&&d.forEach(C=>{e.mergeNodeData(C.id,{x:C.data.x,y:C.data.y})}),{nodes:d,edges:c}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(yt(i)?o=()=>i:Et(i)?o=i:o=()=>0,e.spacing=o,!n)s=u=>{const c=o(u);return u.size?Pa(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+c)/2:un(u.size)?((u.size.width>u.size.height?u.size.width:u.size.height)+c)/2:(u.size+c)/2:32+c/2};else if(Et(n))s=u=>{const c=n(u),h=o(u);return Pa(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+h)/2:((c||32)+h)/2};else if(Pa(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=h=>c+o(h)/2}else{const u=n/2;s=c=>u+o(c)/2}e.nodeSize=s;let l;return yt(a)?l=()=>a:Pa(a)?l=()=>Math.max.apply(null,a):Et(a)?l=a:l=()=>0,e.comboPadding=l,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:l,comboPadding:u,spacing:c,innerLayout:h}=s,d=h||new Qw({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:c},p=[],v=m=>{let b=(u==null?void 0:u(m))||10;return Pa(b)&&(b=Math.max(...b)),{size:b?[b*2,b*2]:[30,30],padding:b}};return t.getRoots(e).forEach(m=>{o.set(m.id,{id:m.id,data:{nodes:[],size:v(m).size}});let b=Promise.resolve();Zw(t,[m],w=>{var x;if(!w.data._isCombo)return;const{size:S,padding:_}=v(w);if(!(!((x=t.getChildren(w.id,e))===null||x===void 0)&&x.length))o.set(w.id,{id:w.id,data:Object.assign(Object.assign({},w.data),{size:S})});else{const k=o.get(w.id);o.set(w.id,{id:w.id,data:Object.assign({nodes:[]},k==null?void 0:k.data)});const M=new Map,C=t.getChildren(w.id,e).map(A=>{if(A.data._isCombo)return o.has(A.id)||o.set(A.id,{id:A.id,data:Object.assign({},A.data)}),M.set(A.id,!0),o.get(A.id);const R=n.get(A.id)||i.get(A.id);return M.set(A.id,!0),{id:A.id,data:Object.assign(Object.assign({},R.data),A.data)}}),P={nodes:C,edges:a.filter(A=>M.has(A.source)&&M.has(A.target))};let T=1/0;C.forEach(A=>{var R;let{size:L}=A.data;L||(L=((R=o.get(A.id))===null||R===void 0?void 0:R.data.size)||(l==null?void 0:l(A))||[30,30]),yt(L)&&(L=[L,L]);const[$,q]=L;T>$&&(T=$),T>q&&(T=q),A.data.size=L}),b=b.then(()=>Ht(this,void 0,void 0,function*(){const A=new kn(P);yield $k(d,A,g,!0);const{minX:R,minY:L,maxX:$,maxY:q}=cet(C),j={x:($+R)/2,y:(q+L)/2};P.nodes.forEach(F=>{F.data.x-=j.x,F.data.y-=j.y});const B=[Math.max($-R,T)+_*2,Math.max(q-L,T)+_*2];o.get(w.id).data.size=B,o.get(w.id).data.nodes=C}))}return!0},"BT",e),p.push(b)}),p}}function $k(r,t,e,n){var i;return Ht(this,void 0,void 0,function*(){return nx(r)?(r.execute(t,e),r.stop(),r.tick((i=e.iterations)!==null&&i!==void 0?i:300)):n?yield r.assign(t,e):yield r.execute(t,e)})}function grt(r,t){var e,n=1;r==null&&(r=0),t==null&&(t=0);function i(){var a,s=e.length,o,l=0,u=0;for(a=0;a<s;++a)o=e[a],l+=o.x,u+=o.y;for(l=(l/s-r)*n,u=(u/s-t)*n,a=0;a<s;++a)o=e[a],o.x-=l,o.y-=u}return i.initialize=function(a){e=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(t=+a,i):t},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function Sn(r){return function(){return r}}function Os(r){return(r()-.5)*1e-6}function prt(r){return r.x+r.vx}function vrt(r){return r.y+r.vy}function mrt(r){var t,e,n,i=1,a=1;typeof r!="function"&&(r=Sn(r==null?1:+r));function s(){for(var u,c=t.length,h,d,g,p,v,m,b=0;b<a;++b)for(h=B0(t,prt,vrt).visitAfter(o),u=0;u<c;++u)d=t[u],v=e[d.index],m=v*v,g=d.x+d.vx,p=d.y+d.vy,h.visit(w);function w(x,S,_,k,M){var C=x.data,P=x.r,T=v+P;if(C){if(C.index>d.index){var A=g-C.x-C.vx,R=p-C.y-C.vy,L=A*A+R*R;L<T*T&&(A===0&&(A=Os(n),L+=A*A),R===0&&(R=Os(n),L+=R*R),L=(T-(L=Math.sqrt(L)))/L*i,d.vx+=(A*=L)*(T=(P*=P)/(m+P)),d.vy+=(R*=L)*T,C.vx-=A*(T=1-T),C.vy-=R*T)}return}return S>g+T||k<g-T||_>p+T||M<p-T}}function o(u){if(u.data)return u.r=e[u.data.index];for(var c=u.r=0;c<4;++c)u[c]&&u[c].r>u.r&&(u.r=u[c].r)}function l(){if(t){var u,c=t.length,h;for(e=new Array(c),u=0;u<c;++u)h=t[u],e[h.index]=+r(h,u,t)}}return s.initialize=function(u,c){t=u,n=c,l()},s.iterations=function(u){return arguments.length?(a=+u,s):a},s.strength=function(u){return arguments.length?(i=+u,s):i},s.radius=function(u){return arguments.length?(r=typeof u=="function"?u:Sn(+u),l(),s):r},s}function yrt(r){return r.index}function jk(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function brt(r){var t=yrt,e=h,n,i=Sn(30),a,s,o,l,u,c=1;r==null&&(r=[]);function h(m){return 1/Math.min(o[m.source.index],o[m.target.index])}function d(m){for(var b=0,w=r.length;b<c;++b)for(var x=0,S,_,k,M,C,P,T;x<w;++x)S=r[x],_=S.source,k=S.target,M=k.x+k.vx-_.x-_.vx||Os(u),C=k.y+k.vy-_.y-_.vy||Os(u),P=Math.sqrt(M*M+C*C),P=(P-a[x])/P*m*n[x],M*=P,C*=P,k.vx-=M*(T=l[x]),k.vy-=C*T,_.vx+=M*(T=1-T),_.vy+=C*T}function g(){if(s){var m,b=s.length,w=r.length,x=new Map(s.map((_,k)=>[t(_,k,s),_])),S;for(m=0,o=new Array(b);m<w;++m)S=r[m],S.index=m,typeof S.source!="object"&&(S.source=jk(x,S.source)),typeof S.target!="object"&&(S.target=jk(x,S.target)),o[S.source.index]=(o[S.source.index]||0)+1,o[S.target.index]=(o[S.target.index]||0)+1;for(m=0,l=new Array(w);m<w;++m)S=r[m],l[m]=o[S.source.index]/(o[S.source.index]+o[S.target.index]);n=new Array(w),p(),a=new Array(w),v()}}function p(){if(s)for(var m=0,b=r.length;m<b;++m)n[m]=+e(r[m],m,r)}function v(){if(s)for(var m=0,b=r.length;m<b;++m)a[m]=+i(r[m],m,r)}return d.initialize=function(m,b){s=m,u=b,g()},d.links=function(m){return arguments.length?(r=m,g(),d):r},d.id=function(m){return arguments.length?(t=m,d):t},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(e=typeof m=="function"?m:Sn(+m),p(),d):e},d.distance=function(m){return arguments.length?(i=typeof m=="function"?m:Sn(+m),v(),d):i},d}var wrt={value:()=>{}};function $I(){for(var r=0,t=arguments.length,e={},n;r<t;++r){if(!(n=arguments[r]+"")||n in e||/[\s.]/.test(n))throw new Error("illegal type: "+n);e[n]=[]}return new rf(e)}function rf(r){this._=r}function xrt(r,t){return r.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");if(i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}rf.prototype=$I.prototype={constructor:rf,on:function(r,t){var e=this._,n=xrt(r+"",e),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(r=n[a]).type)&&(i=Ert(e[i],r.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<s;)if(i=(r=n[a]).type)e[i]=qk(e[i],r.name,t);else if(t==null)for(i in e)e[i]=qk(e[i],r.name,null);return this},copy:function(){var r={},t=this._;for(var e in t)r[e]=t[e].slice();return new rf(r)},call:function(r,t){if((i=arguments.length-2)>0)for(var e=new Array(i),n=0,i,a;n<i;++n)e[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(a=this._[r],n=0,i=a.length;n<i;++n)a[n].value.apply(t,e)},apply:function(r,t,e){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],i=0,a=n.length;i<a;++i)n[i].value.apply(t,e)}};function Ert(r,t){for(var e=0,n=r.length,i;e<n;++e)if((i=r[e]).name===t)return i.value}function qk(r,t,e){for(var n=0,i=r.length;n<i;++n)if(r[n].name===t){r[n]=wrt,r=r.slice(0,n).concat(r.slice(n+1));break}return e!=null&&r.push({name:t,value:e}),r}var Xl=0,Wu=0,Nu=0,jI=1e3,zf,Gu,$f=0,jo=0,q0=0,Ec=typeof performance=="object"&&performance.now?performance:Date,qI=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function WI(){return jo||(qI(_rt),jo=Ec.now()+q0)}function _rt(){jo=0}function rx(){this._call=this._time=this._next=null}rx.prototype=GI.prototype={constructor:rx,restart:function(r,t,e){if(typeof r!="function")throw new TypeError("callback is not a function");e=(e==null?WI():+e)+(t==null?0:+t),!this._next&&Gu!==this&&(Gu?Gu._next=this:zf=this,Gu=this),this._call=r,this._time=e,ix()},stop:function(){this._call&&(this._call=null,this._time=1/0,ix())}};function GI(r,t,e){var n=new rx;return n.restart(r,t,e),n}function Srt(){WI(),++Xl;for(var r=zf,t;r;)(t=jo-r._time)>=0&&r._call.call(void 0,t),r=r._next;--Xl}function Wk(){jo=($f=Ec.now())+q0,Xl=Wu=0;try{Srt()}finally{Xl=0,krt(),jo=0}}function Mrt(){var r=Ec.now(),t=r-$f;t>jI&&(q0-=t,$f=r)}function krt(){for(var r,t=zf,e,n=1/0;t;)t._call?(n>t._time&&(n=t._time),r=t,t=t._next):(e=t._next,t._next=null,t=r?r._next=e:zf=e);Gu=r,ix(n)}function ix(r){if(!Xl){Wu&&(Wu=clearTimeout(Wu));var t=r-jo;t>24?(r<1/0&&(Wu=setTimeout(Wk,r-Ec.now()-q0)),Nu&&(Nu=clearInterval(Nu))):(Nu||($f=Ec.now(),Nu=setInterval(Mrt,jI)),Xl=1,qI(Wk))}}const Crt=1664525,Trt=1013904223,Gk=4294967296;function Ort(){let r=1;return()=>(r=(Crt*r+Trt)%Gk)/Gk}function Art(r){return r.x}function Prt(r){return r.y}var Nrt=10,Rrt=Math.PI*(3-Math.sqrt(5));function Lrt(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=GI(h),u=$I("tick","end"),c=Ort();r==null&&(r=[]);function h(){d(),u.call("tick",t),e<n&&(l.stop(),u.call("end",t))}function d(v){var m,b=r.length,w;v===void 0&&(v=1);for(var x=0;x<v;++x)for(e+=(a-e)*i,o.forEach(function(S){S(e)}),m=0;m<b;++m)w=r[m],w.fx==null?w.x+=w.vx*=s:(w.x=w.fx,w.vx=0),w.fy==null?w.y+=w.vy*=s:(w.y=w.fy,w.vy=0);return t}function g(){for(var v=0,m=r.length,b;v<m;++v){if(b=r[v],b.index=v,b.fx!=null&&(b.x=b.fx),b.fy!=null&&(b.y=b.fy),isNaN(b.x)||isNaN(b.y)){var w=Nrt*Math.sqrt(.5+v),x=v*Rrt;b.x=w*Math.cos(x),b.y=w*Math.sin(x)}(isNaN(b.vx)||isNaN(b.vy))&&(b.vx=b.vy=0)}}function p(v){return v.initialize&&v.initialize(r,c),v}return g(),t={tick:d,restart:function(){return l.restart(h),t},stop:function(){return l.stop(),t},nodes:function(v){return arguments.length?(r=v,g(),o.forEach(p),t):r},alpha:function(v){return arguments.length?(e=+v,t):e},alphaMin:function(v){return arguments.length?(n=+v,t):n},alphaDecay:function(v){return arguments.length?(i=+v,t):+i},alphaTarget:function(v){return arguments.length?(a=+v,t):a},velocityDecay:function(v){return arguments.length?(s=1-v,t):1-s},randomSource:function(v){return arguments.length?(c=v,o.forEach(p),t):c},force:function(v,m){return arguments.length>1?(m==null?o.delete(v):o.set(v,p(m)),t):o.get(v)},find:function(v,m,b){var w=0,x=r.length,S,_,k,M,C;for(b==null?b=1/0:b*=b,w=0;w<x;++w)M=r[w],S=v-M.x,_=m-M.y,k=S*S+_*_,k<b&&(C=M,b=k);return C},on:function(v,m){return arguments.length>1?(u.on(v,m),t):u.on(v)}}}function Irt(){var r,t,e,n,i=Sn(-30),a,s=1,o=1/0,l=.81;function u(g){var p,v=r.length,m=B0(r,Art,Prt).visitAfter(h);for(n=g,p=0;p<v;++p)t=r[p],m.visit(d)}function c(){if(r){var g,p=r.length,v;for(a=new Array(p),g=0;g<p;++g)v=r[g],a[v.index]=+i(v,g,r)}}function h(g){var p=0,v,m,b=0,w,x,S;if(g.length){for(w=x=S=0;S<4;++S)(v=g[S])&&(m=Math.abs(v.value))&&(p+=v.value,b+=m,w+=m*v.x,x+=m*v.y);g.x=w/b,g.y=x/b}else{v=g,v.x=v.data.x,v.y=v.data.y;do p+=a[v.data.index];while(v=v.next)}g.value=p}function d(g,p,v,m){if(!g.value)return!0;var b=g.x-t.x,w=g.y-t.y,x=m-p,S=b*b+w*w;if(x*x/l<S)return S<o&&(b===0&&(b=Os(e),S+=b*b),w===0&&(w=Os(e),S+=w*w),S<s&&(S=Math.sqrt(s*S)),t.vx+=b*g.value*n/S,t.vy+=w*g.value*n/S),!0;if(g.length||S>=o)return;(g.data!==t||g.next)&&(b===0&&(b=Os(e),S+=b*b),w===0&&(w=Os(e),S+=w*w),S<s&&(S=Math.sqrt(s*S)));do g.data!==t&&(x=a[g.data.index]*n/S,t.vx+=b*x,t.vy+=w*x);while(g=g.next)}return u.initialize=function(g,p){r=g,e=p,c()},u.strength=function(g){return arguments.length?(i=typeof g=="function"?g:Sn(+g),c(),u):i},u.distanceMin=function(g){return arguments.length?(s=g*g,u):Math.sqrt(s)},u.distanceMax=function(g){return arguments.length?(o=g*g,u):Math.sqrt(o)},u.theta=function(g){return arguments.length?(l=g*g,u):Math.sqrt(l)},u}function Drt(r,t,e){var n,i=Sn(.1),a,s;typeof r!="function"&&(r=Sn(+r)),t==null&&(t=0),e==null&&(e=0);function o(u){for(var c=0,h=n.length;c<h;++c){var d=n[c],g=d.x-t||1e-6,p=d.y-e||1e-6,v=Math.sqrt(g*g+p*p),m=(s[c]-v)*a[c]*u/v;d.vx+=g*m,d.vy+=p*m}}function l(){if(n){var u,c=n.length;for(a=new Array(c),s=new Array(c),u=0;u<c;++u)s[u]=+r(n[u],u,n),a[u]=isNaN(s[u])?0:+i(n[u],u,n)}}return o.initialize=function(u){n=u,l()},o.strength=function(u){return arguments.length?(i=typeof u=="function"?u:Sn(+u),l(),o):i},o.radius=function(u){return arguments.length?(r=typeof u=="function"?u:Sn(+u),l(),o):r},o.x=function(u){return arguments.length?(t=+u,o):t},o.y=function(u){return arguments.length?(e=+u,o):e},o}function Frt(r){var t=Sn(.1),e,n,i;typeof r!="function"&&(r=Sn(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vx+=(i[l]-c.x)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:Sn(+o),s(),a):t},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:Sn(+o),s(),a):r},a}function Brt(r){var t=Sn(.1),e,n,i;typeof r!="function"&&(r=Sn(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vy+=(i[l]-c.y)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:Sn(+o),s(),a):t},a.y=function(o){return arguments.length?(r=typeof o=="function"?o:Sn(+o),s(),a):r},a}class zrt{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:brt,manyBody:Irt,center:grt,collide:mrt,radial:Drt,x:Frt,y:Brt},this.options={link:{id:e=>e.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},cr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find(i=>i.id===t);n&&e.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(t){var e,n;const i=cr({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,n){var i;return Ht(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:c,data:h})=>Object.assign(Object.assign({id:c},h),Lo(h.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const l=new Promise(c=>{this.resolver=c}),u=this.setSimulation(a);return u.nodes(s),(i=u.force("link"))===null||i===void 0||i.links(o),l})}getResult(){const{assign:t,nodes:e,edges:n,graph:i}=this.context,a=e.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),Lo(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:l,target:u,data:c})=>({id:o,source:typeof l=="object"?l.id:l,target:typeof u=="object"?u.id:u,data:c}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return Lrt()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var n;return(n=t.onTick)===null||n===void 0?void 0:n.call(t,this.getResult())}).on("end",()=>{var n;return(n=this.resolver)===null||n===void 0?void 0:n.call(this,this.getResult())})),Vk(e,this.config.simulationAttrs.map(n=>[n,t[n]])),Object.entries(this.forceMap).forEach(([n,i])=>{const a=n;if(t[n]){let s=e.force(a);s||(s=i(),e.force(a,s)),Vk(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const Vk=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var Zv,Hk;function $rt(){if(Hk)return Zv;Hk=1;function r(){this.__data__=[],this.size=0}return Zv=r,Zv}var Jv,Uk;function nu(){if(Uk)return Jv;Uk=1;function r(t,e){return t===e||t!==t&&e!==e}return Jv=r,Jv}var Qv,Yk;function W0(){if(Yk)return Qv;Yk=1;var r=nu();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return Qv=t,Qv}var tm,Xk;function jrt(){if(Xk)return tm;Xk=1;var r=W0(),t=Array.prototype,e=t.splice;function n(i){var a=this.__data__,s=r(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():e.call(a,s,1),--this.size,!0}return tm=n,tm}var em,Kk;function qrt(){if(Kk)return em;Kk=1;var r=W0();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return em=t,em}var nm,Zk;function Wrt(){if(Zk)return nm;Zk=1;var r=W0();function t(e){return r(this.__data__,e)>-1}return nm=t,nm}var rm,Jk;function Grt(){if(Jk)return rm;Jk=1;var r=W0();function t(e,n){var i=this.__data__,a=r(i,e);return a<0?(++this.size,i.push([e,n])):i[a][1]=n,this}return rm=t,rm}var im,Qk;function G0(){if(Qk)return im;Qk=1;var r=$rt(),t=jrt(),e=qrt(),n=Wrt(),i=Grt();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,im=a,im}var am,tC;function Vrt(){if(tC)return am;tC=1;var r=G0();function t(){this.__data__=new r,this.size=0}return am=t,am}var sm,eC;function Hrt(){if(eC)return sm;eC=1;function r(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}return sm=r,sm}var om,nC;function Urt(){if(nC)return om;nC=1;function r(t){return this.__data__.get(t)}return om=r,om}var lm,rC;function Yrt(){if(rC)return lm;rC=1;function r(t){return this.__data__.has(t)}return lm=r,lm}var um,iC;function VI(){if(iC)return um;iC=1;var r=typeof Ca=="object"&&Ca&&Ca.Object===Object&&Ca;return um=r,um}var cm,aC;function Bi(){if(aC)return cm;aC=1;var r=VI(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return cm=e,cm}var hm,sC;function ru(){if(sC)return hm;sC=1;var r=Bi(),t=r.Symbol;return hm=t,hm}var dm,oC;function Xrt(){if(oC)return dm;oC=1;var r=ru(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function a(s){var o=e.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var c=n.call(s);return u&&(o?s[i]=l:delete s[i]),c}return dm=a,dm}var fm,lC;function Krt(){if(lC)return fm;lC=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return fm=e,fm}var gm,uC;function Yo(){if(uC)return gm;uC=1;var r=ru(),t=Xrt(),e=Krt(),n="[object Null]",i="[object Undefined]",a=r?r.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?t(o):e(o)}return gm=s,gm}var pm,cC;function yi(){if(cC)return pm;cC=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return pm=r,pm}var vm,hC;function Vc(){if(hC)return vm;hC=1;var r=Yo(),t=yi(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=r(o);return l==n||l==i||l==e||l==a}return vm=s,vm}var mm,dC;function Zrt(){if(dC)return mm;dC=1;var r=Bi(),t=r["__core-js_shared__"];return mm=t,mm}var ym,fC;function Jrt(){if(fC)return ym;fC=1;var r=Zrt(),t=function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function e(n){return!!t&&t in n}return ym=e,ym}var bm,gC;function HI(){if(gC)return bm;gC=1;var r=Function.prototype,t=r.toString;function e(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return bm=e,bm}var wm,pC;function Qrt(){if(pC)return wm;pC=1;var r=Vc(),t=Jrt(),e=yi(),n=HI(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,c=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(d){if(!e(d)||t(d))return!1;var g=r(d)?c:a;return g.test(n(d))}return wm=h,wm}var xm,vC;function tit(){if(vC)return xm;vC=1;function r(t,e){return t==null?void 0:t[e]}return xm=r,xm}var Em,mC;function Xo(){if(mC)return Em;mC=1;var r=Qrt(),t=tit();function e(n,i){var a=t(n,i);return r(a)?a:void 0}return Em=e,Em}var _m,yC;function yE(){if(yC)return _m;yC=1;var r=Xo(),t=Bi(),e=r(t,"Map");return _m=e,_m}var Sm,bC;function V0(){if(bC)return Sm;bC=1;var r=Xo(),t=r(Object,"create");return Sm=t,Sm}var Mm,wC;function eit(){if(wC)return Mm;wC=1;var r=V0();function t(){this.__data__=r?r(null):{},this.size=0}return Mm=t,Mm}var km,xC;function nit(){if(xC)return km;xC=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return km=r,km}var Cm,EC;function rit(){if(EC)return Cm;EC=1;var r=V0(),t="__lodash_hash_undefined__",e=Object.prototype,n=e.hasOwnProperty;function i(a){var s=this.__data__;if(r){var o=s[a];return o===t?void 0:o}return n.call(s,a)?s[a]:void 0}return Cm=i,Cm}var Tm,_C;function iit(){if(_C)return Tm;_C=1;var r=V0(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:e.call(a,i)}return Tm=n,Tm}var Om,SC;function ait(){if(SC)return Om;SC=1;var r=V0(),t="__lodash_hash_undefined__";function e(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=r&&i===void 0?t:i,this}return Om=e,Om}var Am,MC;function sit(){if(MC)return Am;MC=1;var r=eit(),t=nit(),e=rit(),n=iit(),i=ait();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Am=a,Am}var Pm,kC;function oit(){if(kC)return Pm;kC=1;var r=sit(),t=G0(),e=yE();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return Pm=n,Pm}var Nm,CC;function lit(){if(CC)return Nm;CC=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return Nm=r,Nm}var Rm,TC;function H0(){if(TC)return Rm;TC=1;var r=lit();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Rm=t,Rm}var Lm,OC;function uit(){if(OC)return Lm;OC=1;var r=H0();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return Lm=t,Lm}var Im,AC;function cit(){if(AC)return Im;AC=1;var r=H0();function t(e){return r(this,e).get(e)}return Im=t,Im}var Dm,PC;function hit(){if(PC)return Dm;PC=1;var r=H0();function t(e){return r(this,e).has(e)}return Dm=t,Dm}var Fm,NC;function dit(){if(NC)return Fm;NC=1;var r=H0();function t(e,n){var i=r(this,e),a=i.size;return i.set(e,n),this.size+=i.size==a?0:1,this}return Fm=t,Fm}var Bm,RC;function bE(){if(RC)return Bm;RC=1;var r=oit(),t=uit(),e=cit(),n=hit(),i=dit();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Bm=a,Bm}var zm,LC;function fit(){if(LC)return zm;LC=1;var r=G0(),t=yE(),e=bE(),n=200;function i(a,s){var o=this.__data__;if(o instanceof r){var l=o.__data__;if(!t||l.length<n-1)return l.push([a,s]),this.size=++o.size,this;o=this.__data__=new e(l)}return o.set(a,s),this.size=o.size,this}return zm=i,zm}var $m,IC;function U0(){if(IC)return $m;IC=1;var r=G0(),t=Vrt(),e=Hrt(),n=Urt(),i=Yrt(),a=fit();function s(o){var l=this.__data__=new r(o);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=a,$m=s,$m}var jm,DC;function wE(){if(DC)return jm;DC=1;function r(t,e){for(var n=-1,i=t==null?0:t.length;++n<i&&e(t[n],n,t)!==!1;);return t}return jm=r,jm}var qm,FC;function UI(){if(FC)return qm;FC=1;var r=Xo(),t=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch{}}();return qm=t,qm}var Wm,BC;function Y0(){if(BC)return Wm;BC=1;var r=UI();function t(e,n,i){n=="__proto__"&&r?r(e,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[n]=i}return Wm=t,Wm}var Gm,zC;function X0(){if(zC)return Gm;zC=1;var r=Y0(),t=nu(),e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o){var l=a[s];(!(n.call(a,s)&&t(l,o))||o===void 0&&!(s in a))&&r(a,s,o)}return Gm=i,Gm}var Vm,$C;function Hc(){if($C)return Vm;$C=1;var r=X0(),t=Y0();function e(n,i,a,s){var o=!a;a||(a={});for(var l=-1,u=i.length;++l<u;){var c=i[l],h=s?s(a[c],n[c],c,a,n):void 0;h===void 0&&(h=n[c]),o?t(a,c,h):r(a,c,h)}return a}return Vm=e,Vm}var Hm,jC;function git(){if(jC)return Hm;jC=1;function r(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}return Hm=r,Hm}var Um,qC;function da(){if(qC)return Um;qC=1;function r(t){return t!=null&&typeof t=="object"}return Um=r,Um}var Ym,WC;function pit(){if(WC)return Ym;WC=1;var r=Yo(),t=da(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return Ym=n,Ym}var Xm,GC;function Uc(){if(GC)return Xm;GC=1;var r=pit(),t=da(),e=Object.prototype,n=e.hasOwnProperty,i=e.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(s){return t(s)&&n.call(s,"callee")&&!i.call(s,"callee")};return Xm=a,Xm}var Km,VC;function mn(){if(VC)return Km;VC=1;var r=Array.isArray;return Km=r,Km}var Vu={exports:{}},Zm,HC;function vit(){if(HC)return Zm;HC=1;function r(){return!1}return Zm=r,Zm}Vu.exports;var UC;function iu(){return UC||(UC=1,function(r,t){var e=Bi(),n=vit(),i=t&&!t.nodeType&&t,a=i&&!0&&r&&!r.nodeType&&r,s=a&&a.exports===i,o=s?e.Buffer:void 0,l=o?o.isBuffer:void 0,u=l||n;r.exports=u}(Vu,Vu.exports)),Vu.exports}var Jm,YC;function K0(){if(YC)return Jm;YC=1;var r=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(n,i){var a=typeof n;return i=i??r,!!i&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Jm=e,Jm}var Qm,XC;function xE(){if(XC)return Qm;XC=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Qm=t,Qm}var ty,KC;function mit(){if(KC)return ty;KC=1;var r=Yo(),t=xE(),e=da(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",u="[object Map]",c="[object Number]",h="[object Object]",d="[object RegExp]",g="[object Set]",p="[object String]",v="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",S="[object Int8Array]",_="[object Int16Array]",k="[object Int32Array]",M="[object Uint8Array]",C="[object Uint8ClampedArray]",P="[object Uint16Array]",T="[object Uint32Array]",A={};A[w]=A[x]=A[S]=A[_]=A[k]=A[M]=A[C]=A[P]=A[T]=!0,A[n]=A[i]=A[m]=A[a]=A[b]=A[s]=A[o]=A[l]=A[u]=A[c]=A[h]=A[d]=A[g]=A[p]=A[v]=!1;function R(L){return e(L)&&t(L.length)&&!!A[r(L)]}return ty=R,ty}var ey,ZC;function Z0(){if(ZC)return ey;ZC=1;function r(t){return function(e){return t(e)}}return ey=r,ey}var Hu={exports:{}};Hu.exports;var JC;function EE(){return JC||(JC=1,function(r,t){var e=VI(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a&&e.process,o=function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}}();r.exports=o}(Hu,Hu.exports)),Hu.exports}var ny,QC;function Yc(){if(QC)return ny;QC=1;var r=mit(),t=Z0(),e=EE(),n=e&&e.isTypedArray,i=n?t(n):r;return ny=i,ny}var ry,tT;function YI(){if(tT)return ry;tT=1;var r=git(),t=Uc(),e=mn(),n=iu(),i=K0(),a=Yc(),s=Object.prototype,o=s.hasOwnProperty;function l(u,c){var h=e(u),d=!h&&t(u),g=!h&&!d&&n(u),p=!h&&!d&&!g&&a(u),v=h||d||g||p,m=v?r(u.length,String):[],b=m.length;for(var w in u)(c||o.call(u,w))&&!(v&&(w=="length"||g&&(w=="offset"||w=="parent")||p&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||i(w,b)))&&m.push(w);return m}return ry=l,ry}var iy,eT;function J0(){if(eT)return iy;eT=1;var r=Object.prototype;function t(e){var n=e&&e.constructor,i=typeof n=="function"&&n.prototype||r;return e===i}return iy=t,iy}var ay,nT;function XI(){if(nT)return ay;nT=1;function r(t,e){return function(n){return t(e(n))}}return ay=r,ay}var sy,rT;function yit(){if(rT)return sy;rT=1;var r=XI(),t=r(Object.keys,Object);return sy=t,sy}var oy,iT;function _E(){if(iT)return oy;iT=1;var r=J0(),t=yit(),e=Object.prototype,n=e.hasOwnProperty;function i(a){if(!r(a))return t(a);var s=[];for(var o in Object(a))n.call(a,o)&&o!="constructor"&&s.push(o);return s}return oy=i,oy}var ly,aT;function Ka(){if(aT)return ly;aT=1;var r=Vc(),t=xE();function e(n){return n!=null&&t(n.length)&&!r(n)}return ly=e,ly}var uy,sT;function to(){if(sT)return uy;sT=1;var r=YI(),t=_E(),e=Ka();function n(i){return e(i)?r(i):t(i)}return uy=n,uy}var cy,oT;function bit(){if(oT)return cy;oT=1;var r=Hc(),t=to();function e(n,i){return n&&r(i,t(i),n)}return cy=e,cy}var hy,lT;function wit(){if(lT)return hy;lT=1;function r(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}return hy=r,hy}var dy,uT;function xit(){if(uT)return dy;uT=1;var r=yi(),t=J0(),e=wit(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return e(s);var o=t(s),l=[];for(var u in s)u=="constructor"&&(o||!i.call(s,u))||l.push(u);return l}return dy=a,dy}var fy,cT;function Ko(){if(cT)return fy;cT=1;var r=YI(),t=xit(),e=Ka();function n(i){return e(i)?r(i,!0):t(i)}return fy=n,fy}var gy,hT;function Eit(){if(hT)return gy;hT=1;var r=Hc(),t=Ko();function e(n,i){return n&&r(i,t(i),n)}return gy=e,gy}var Uu={exports:{}};Uu.exports;var dT;function KI(){return dT||(dT=1,function(r,t){var e=Bi(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a?e.Buffer:void 0,o=s?s.allocUnsafe:void 0;function l(u,c){if(c)return u.slice();var h=u.length,d=o?o(h):new u.constructor(h);return u.copy(d),d}r.exports=l}(Uu,Uu.exports)),Uu.exports}var py,fT;function ZI(){if(fT)return py;fT=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}return py=r,py}var vy,gT;function JI(){if(gT)return vy;gT=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,a=0,s=[];++n<i;){var o=t[n];e(o,n,t)&&(s[a++]=o)}return s}return vy=r,vy}var my,pT;function QI(){if(pT)return my;pT=1;function r(){return[]}return my=r,my}var yy,vT;function SE(){if(vT)return yy;vT=1;var r=JI(),t=QI(),e=Object.prototype,n=e.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),r(i(s),function(o){return n.call(s,o)}))}:t;return yy=a,yy}var by,mT;function _it(){if(mT)return by;mT=1;var r=Hc(),t=SE();function e(n,i){return r(n,t(n),i)}return by=e,by}var wy,yT;function ME(){if(yT)return wy;yT=1;function r(t,e){for(var n=-1,i=e.length,a=t.length;++n<i;)t[a+n]=e[n];return t}return wy=r,wy}var xy,bT;function Q0(){if(bT)return xy;bT=1;var r=XI(),t=r(Object.getPrototypeOf,Object);return xy=t,xy}var Ey,wT;function tD(){if(wT)return Ey;wT=1;var r=ME(),t=Q0(),e=SE(),n=QI(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var o=[];s;)r(o,e(s)),s=t(s);return o}:n;return Ey=a,Ey}var _y,xT;function Sit(){if(xT)return _y;xT=1;var r=Hc(),t=tD();function e(n,i){return r(n,t(n),i)}return _y=e,_y}var Sy,ET;function eD(){if(ET)return Sy;ET=1;var r=ME(),t=mn();function e(n,i,a){var s=i(n);return t(n)?s:r(s,a(n))}return Sy=e,Sy}var My,_T;function nD(){if(_T)return My;_T=1;var r=eD(),t=SE(),e=to();function n(i){return r(i,e,t)}return My=n,My}var ky,ST;function Mit(){if(ST)return ky;ST=1;var r=eD(),t=tD(),e=Ko();function n(i){return r(i,e,t)}return ky=n,ky}var Cy,MT;function kit(){if(MT)return Cy;MT=1;var r=Xo(),t=Bi(),e=r(t,"DataView");return Cy=e,Cy}var Ty,kT;function Cit(){if(kT)return Ty;kT=1;var r=Xo(),t=Bi(),e=r(t,"Promise");return Ty=e,Ty}var Oy,CT;function rD(){if(CT)return Oy;CT=1;var r=Xo(),t=Bi(),e=r(t,"Set");return Oy=e,Oy}var Ay,TT;function Tit(){if(TT)return Ay;TT=1;var r=Xo(),t=Bi(),e=r(t,"WeakMap");return Ay=e,Ay}var Py,OT;function au(){if(OT)return Py;OT=1;var r=kit(),t=yE(),e=Cit(),n=rD(),i=Tit(),a=Yo(),s=HI(),o="[object Map]",l="[object Object]",u="[object Promise]",c="[object Set]",h="[object WeakMap]",d="[object DataView]",g=s(r),p=s(t),v=s(e),m=s(n),b=s(i),w=a;return(r&&w(new r(new ArrayBuffer(1)))!=d||t&&w(new t)!=o||e&&w(e.resolve())!=u||n&&w(new n)!=c||i&&w(new i)!=h)&&(w=function(x){var S=a(x),_=S==l?x.constructor:void 0,k=_?s(_):"";if(k)switch(k){case g:return d;case p:return o;case v:return u;case m:return c;case b:return h}return S}),Py=w,Py}var Ny,AT;function Oit(){if(AT)return Ny;AT=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&t.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return Ny=e,Ny}var Ry,PT;function iD(){if(PT)return Ry;PT=1;var r=Bi(),t=r.Uint8Array;return Ry=t,Ry}var Ly,NT;function kE(){if(NT)return Ly;NT=1;var r=iD();function t(e){var n=new e.constructor(e.byteLength);return new r(n).set(new r(e)),n}return Ly=t,Ly}var Iy,RT;function Ait(){if(RT)return Iy;RT=1;var r=kE();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}return Iy=t,Iy}var Dy,LT;function Pit(){if(LT)return Dy;LT=1;var r=/\w*$/;function t(e){var n=new e.constructor(e.source,r.exec(e));return n.lastIndex=e.lastIndex,n}return Dy=t,Dy}var Fy,IT;function Nit(){if(IT)return Fy;IT=1;var r=ru(),t=r?r.prototype:void 0,e=t?t.valueOf:void 0;function n(i){return e?Object(e.call(i)):{}}return Fy=n,Fy}var By,DT;function aD(){if(DT)return By;DT=1;var r=kE();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}return By=t,By}var zy,FT;function Rit(){if(FT)return zy;FT=1;var r=kE(),t=Ait(),e=Pit(),n=Nit(),i=aD(),a="[object Boolean]",s="[object Date]",o="[object Map]",l="[object Number]",u="[object RegExp]",c="[object Set]",h="[object String]",d="[object Symbol]",g="[object ArrayBuffer]",p="[object DataView]",v="[object Float32Array]",m="[object Float64Array]",b="[object Int8Array]",w="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",_="[object Uint8ClampedArray]",k="[object Uint16Array]",M="[object Uint32Array]";function C(P,T,A){var R=P.constructor;switch(T){case g:return r(P);case a:case s:return new R(+P);case p:return t(P,A);case v:case m:case b:case w:case x:case S:case _:case k:case M:return i(P,A);case o:return new R;case l:case h:return new R(P);case u:return e(P);case c:return new R;case d:return n(P)}}return zy=C,zy}var $y,BT;function sD(){if(BT)return $y;BT=1;var r=yi(),t=Object.create,e=function(){function n(){}return function(i){if(!r(i))return{};if(t)return t(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}}();return $y=e,$y}var jy,zT;function oD(){if(zT)return jy;zT=1;var r=sD(),t=Q0(),e=J0();function n(i){return typeof i.constructor=="function"&&!e(i)?r(t(i)):{}}return jy=n,jy}var qy,$T;function Lit(){if($T)return qy;$T=1;var r=au(),t=da(),e="[object Map]";function n(i){return t(i)&&r(i)==e}return qy=n,qy}var Wy,jT;function Iit(){if(jT)return Wy;jT=1;var r=Lit(),t=Z0(),e=EE(),n=e&&e.isMap,i=n?t(n):r;return Wy=i,Wy}var Gy,qT;function Dit(){if(qT)return Gy;qT=1;var r=au(),t=da(),e="[object Set]";function n(i){return t(i)&&r(i)==e}return Gy=n,Gy}var Vy,WT;function Fit(){if(WT)return Vy;WT=1;var r=Dit(),t=Z0(),e=EE(),n=e&&e.isSet,i=n?t(n):r;return Vy=i,Vy}var Hy,GT;function lD(){if(GT)return Hy;GT=1;var r=U0(),t=wE(),e=X0(),n=bit(),i=Eit(),a=KI(),s=ZI(),o=_it(),l=Sit(),u=nD(),c=Mit(),h=au(),d=Oit(),g=Rit(),p=oD(),v=mn(),m=iu(),b=Iit(),w=yi(),x=Fit(),S=to(),_=Ko(),k=1,M=2,C=4,P="[object Arguments]",T="[object Array]",A="[object Boolean]",R="[object Date]",L="[object Error]",$="[object Function]",q="[object GeneratorFunction]",j="[object Map]",B="[object Number]",F="[object Object]",V="[object RegExp]",X="[object Set]",K="[object String]",nt="[object Symbol]",ot="[object WeakMap]",ct="[object ArrayBuffer]",ht="[object DataView]",pt="[object Float32Array]",wt="[object Float64Array]",zt="[object Int8Array]",Wt="[object Int16Array]",Te="[object Int32Array]",Ge="[object Uint8Array]",Ve="[object Uint8ClampedArray]",In="[object Uint16Array]",yn="[object Uint32Array]",te={};te[P]=te[T]=te[ct]=te[ht]=te[A]=te[R]=te[pt]=te[wt]=te[zt]=te[Wt]=te[Te]=te[j]=te[B]=te[F]=te[V]=te[X]=te[K]=te[nt]=te[Ge]=te[Ve]=te[In]=te[yn]=!0,te[L]=te[$]=te[ot]=!1;function wi(Gt,Xr,Tr,qi,bn,Dn){var $e,fa=Xr&k,Cn=Xr&M,xi=Xr&C;if(Tr&&($e=bn?Tr(Gt,qi,bn,Dn):Tr(Gt)),$e!==void 0)return $e;if(!w(Gt))return Gt;var Wi=v(Gt);if(Wi){if($e=d(Gt),!fa)return s(Gt,$e)}else{var tr=h(Gt),Qa=tr==$||tr==q;if(m(Gt))return a(Gt,fa);if(tr==F||tr==P||Qa&&!bn){if($e=Cn||Qa?{}:p(Gt),!fa)return Cn?l(Gt,i($e,Gt)):o(Gt,n($e,Gt))}else{if(!te[tr])return bn?Gt:{};$e=g(Gt,tr,fa)}}Dn||(Dn=new r);var ts=Dn.get(Gt);if(ts)return ts;Dn.set(Gt,$e),x(Gt)?Gt.forEach(function(Kr){$e.add(wi(Kr,Xr,Tr,Kr,Gt,Dn))}):b(Gt)&&Gt.forEach(function(Kr,Ei){$e.set(Ei,wi(Kr,Xr,Tr,Ei,Gt,Dn))});var cu=xi?Cn?c:u:Cn?_:S,Qo=Wi?void 0:cu(Gt);return t(Qo||Gt,function(Kr,Ei){Qo&&(Ei=Kr,Kr=Gt[Ei]),e($e,Ei,wi(Kr,Xr,Tr,Ei,Gt,Dn))}),$e}return Hy=wi,Hy}var Uy,VT;function Bit(){if(VT)return Uy;VT=1;var r=lD(),t=4;function e(n){return r(n,t)}return Uy=e,Uy}var Yy,HT;function CE(){if(HT)return Yy;HT=1;function r(t){return function(){return t}}return Yy=r,Yy}var Xy,UT;function zit(){if(UT)return Xy;UT=1;function r(t){return function(e,n,i){for(var a=-1,s=Object(e),o=i(e),l=o.length;l--;){var u=o[t?l:++a];if(n(s[u],u,s)===!1)break}return e}}return Xy=r,Xy}var Ky,YT;function TE(){if(YT)return Ky;YT=1;var r=zit(),t=r();return Ky=t,Ky}var Zy,XT;function OE(){if(XT)return Zy;XT=1;var r=TE(),t=to();function e(n,i){return n&&r(n,i,t)}return Zy=e,Zy}var Jy,KT;function $it(){if(KT)return Jy;KT=1;var r=Ka();function t(e,n){return function(i,a){if(i==null)return i;if(!r(i))return e(i,a);for(var s=i.length,o=n?s:-1,l=Object(i);(n?o--:++o<s)&&a(l[o],o,l)!==!1;);return i}}return Jy=t,Jy}var Qy,ZT;function tg(){if(ZT)return Qy;ZT=1;var r=OE(),t=$it(),e=t(r);return Qy=e,Qy}var t1,JT;function Zo(){if(JT)return t1;JT=1;function r(t){return t}return t1=r,t1}var e1,QT;function uD(){if(QT)return e1;QT=1;var r=Zo();function t(e){return typeof e=="function"?e:r}return e1=t,e1}var n1,tO;function cD(){if(tO)return n1;tO=1;var r=wE(),t=tg(),e=uD(),n=mn();function i(a,s){var o=n(a)?r:t;return o(a,e(s))}return n1=i,n1}var r1,eO;function hD(){return eO||(eO=1,r1=cD()),r1}var i1,nO;function jit(){if(nO)return i1;nO=1;var r=tg();function t(e,n){var i=[];return r(e,function(a,s,o){n(a,s,o)&&i.push(a)}),i}return i1=t,i1}var a1,rO;function qit(){if(rO)return a1;rO=1;var r="__lodash_hash_undefined__";function t(e){return this.__data__.set(e,r),this}return a1=t,a1}var s1,iO;function Wit(){if(iO)return s1;iO=1;function r(t){return this.__data__.has(t)}return s1=r,s1}var o1,aO;function dD(){if(aO)return o1;aO=1;var r=bE(),t=qit(),e=Wit();function n(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new r;++a<s;)this.add(i[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=e,o1=n,o1}var l1,sO;function Git(){if(sO)return l1;sO=1;function r(t,e){for(var n=-1,i=t==null?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1}return l1=r,l1}var u1,oO;function fD(){if(oO)return u1;oO=1;function r(t,e){return t.has(e)}return u1=r,u1}var c1,lO;function gD(){if(lO)return c1;lO=1;var r=dD(),t=Git(),e=fD(),n=1,i=2;function a(s,o,l,u,c,h){var d=l&n,g=s.length,p=o.length;if(g!=p&&!(d&&p>g))return!1;var v=h.get(s),m=h.get(o);if(v&&m)return v==o&&m==s;var b=-1,w=!0,x=l&i?new r:void 0;for(h.set(s,o),h.set(o,s);++b<g;){var S=s[b],_=o[b];if(u)var k=d?u(_,S,b,o,s,h):u(S,_,b,s,o,h);if(k!==void 0){if(k)continue;w=!1;break}if(x){if(!t(o,function(M,C){if(!e(x,C)&&(S===M||c(S,M,l,u,h)))return x.push(C)})){w=!1;break}}else if(!(S===_||c(S,_,l,u,h))){w=!1;break}}return h.delete(s),h.delete(o),w}return c1=a,c1}var h1,uO;function Vit(){if(uO)return h1;uO=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i,a){n[++e]=[a,i]}),n}return h1=r,h1}var d1,cO;function AE(){if(cO)return d1;cO=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i){n[++e]=i}),n}return d1=r,d1}var f1,hO;function Hit(){if(hO)return f1;hO=1;var r=ru(),t=iD(),e=nu(),n=gD(),i=Vit(),a=AE(),s=1,o=2,l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Map]",d="[object Number]",g="[object RegExp]",p="[object Set]",v="[object String]",m="[object Symbol]",b="[object ArrayBuffer]",w="[object DataView]",x=r?r.prototype:void 0,S=x?x.valueOf:void 0;function _(k,M,C,P,T,A,R){switch(C){case w:if(k.byteLength!=M.byteLength||k.byteOffset!=M.byteOffset)return!1;k=k.buffer,M=M.buffer;case b:return!(k.byteLength!=M.byteLength||!A(new t(k),new t(M)));case l:case u:case d:return e(+k,+M);case c:return k.name==M.name&&k.message==M.message;case g:case v:return k==M+"";case h:var L=i;case p:var $=P&s;if(L||(L=a),k.size!=M.size&&!$)return!1;var q=R.get(k);if(q)return q==M;P|=o,R.set(k,M);var j=n(L(k),L(M),P,T,A,R);return R.delete(k),j;case m:if(S)return S.call(k)==S.call(M)}return!1}return f1=_,f1}var g1,dO;function Uit(){if(dO)return g1;dO=1;var r=nD(),t=1,e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o,l,u,c){var h=o&t,d=r(a),g=d.length,p=r(s),v=p.length;if(g!=v&&!h)return!1;for(var m=g;m--;){var b=d[m];if(!(h?b in s:n.call(s,b)))return!1}var w=c.get(a),x=c.get(s);if(w&&x)return w==s&&x==a;var S=!0;c.set(a,s),c.set(s,a);for(var _=h;++m<g;){b=d[m];var k=a[b],M=s[b];if(l)var C=h?l(M,k,b,s,a,c):l(k,M,b,a,s,c);if(!(C===void 0?k===M||u(k,M,o,l,c):C)){S=!1;break}_||(_=b=="constructor")}if(S&&!_){var P=a.constructor,T=s.constructor;P!=T&&"constructor"in a&&"constructor"in s&&!(typeof P=="function"&&P instanceof P&&typeof T=="function"&&T instanceof T)&&(S=!1)}return c.delete(a),c.delete(s),S}return g1=i,g1}var p1,fO;function Yit(){if(fO)return p1;fO=1;var r=U0(),t=gD(),e=Hit(),n=Uit(),i=au(),a=mn(),s=iu(),o=Yc(),l=1,u="[object Arguments]",c="[object Array]",h="[object Object]",d=Object.prototype,g=d.hasOwnProperty;function p(v,m,b,w,x,S){var _=a(v),k=a(m),M=_?c:i(v),C=k?c:i(m);M=M==u?h:M,C=C==u?h:C;var P=M==h,T=C==h,A=M==C;if(A&&s(v)){if(!s(m))return!1;_=!0,P=!1}if(A&&!P)return S||(S=new r),_||o(v)?t(v,m,b,w,x,S):e(v,m,M,b,w,x,S);if(!(b&l)){var R=P&&g.call(v,"__wrapped__"),L=T&&g.call(m,"__wrapped__");if(R||L){var $=R?v.value():v,q=L?m.value():m;return S||(S=new r),x($,q,b,w,S)}}return A?(S||(S=new r),n(v,m,b,w,x,S)):!1}return p1=p,p1}var v1,gO;function pD(){if(gO)return v1;gO=1;var r=Yit(),t=da();function e(n,i,a,s,o){return n===i?!0:n==null||i==null||!t(n)&&!t(i)?n!==n&&i!==i:r(n,i,a,s,e,o)}return v1=e,v1}var m1,pO;function Xit(){if(pO)return m1;pO=1;var r=U0(),t=pD(),e=1,n=2;function i(a,s,o,l){var u=o.length,c=u,h=!l;if(a==null)return!c;for(a=Object(a);u--;){var d=o[u];if(h&&d[2]?d[1]!==a[d[0]]:!(d[0]in a))return!1}for(;++u<c;){d=o[u];var g=d[0],p=a[g],v=d[1];if(h&&d[2]){if(p===void 0&&!(g in a))return!1}else{var m=new r;if(l)var b=l(p,v,g,a,s,m);if(!(b===void 0?t(v,p,e|n,l,m):b))return!1}}return!0}return m1=i,m1}var y1,vO;function vD(){if(vO)return y1;vO=1;var r=yi();function t(e){return e===e&&!r(e)}return y1=t,y1}var b1,mO;function Kit(){if(mO)return b1;mO=1;var r=vD(),t=to();function e(n){for(var i=t(n),a=i.length;a--;){var s=i[a],o=n[s];i[a]=[s,o,r(o)]}return i}return b1=e,b1}var w1,yO;function mD(){if(yO)return w1;yO=1;function r(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}return w1=r,w1}var x1,bO;function Zit(){if(bO)return x1;bO=1;var r=Xit(),t=Kit(),e=mD();function n(i){var a=t(i);return a.length==1&&a[0][2]?e(a[0][0],a[0][1]):function(s){return s===i||r(s,i,a)}}return x1=n,x1}var E1,wO;function su(){if(wO)return E1;wO=1;var r=Yo(),t=da(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return E1=n,E1}var _1,xO;function PE(){if(xO)return _1;xO=1;var r=mn(),t=su(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(r(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:n.test(a)||!e.test(a)||s!=null&&a in Object(s)}return _1=i,_1}var S1,EO;function Jit(){if(EO)return S1;EO=1;var r=bE(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=n.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(e.Cache||r),a}return e.Cache=r,S1=e,S1}var M1,_O;function Qit(){if(_O)return M1;_O=1;var r=Jit(),t=500;function e(n){var i=r(n,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return M1=e,M1}var k1,SO;function tat(){if(SO)return k1;SO=1;var r=Qit(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(e,"$1"):o||s)}),a});return k1=n,k1}var C1,MO;function eg(){if(MO)return C1;MO=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=e(t[n],n,t);return a}return C1=r,C1}var T1,kO;function eat(){if(kO)return T1;kO=1;var r=ru(),t=eg(),e=mn(),n=su(),i=r?r.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(e(o))return t(o,s)+"";if(n(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return T1=s,T1}var O1,CO;function yD(){if(CO)return O1;CO=1;var r=eat();function t(e){return e==null?"":r(e)}return O1=t,O1}var A1,TO;function ng(){if(TO)return A1;TO=1;var r=mn(),t=PE(),e=tat(),n=yD();function i(a,s){return r(a)?a:t(a,s)?[a]:e(n(a))}return A1=i,A1}var P1,OO;function Xc(){if(OO)return P1;OO=1;var r=su();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return P1=t,P1}var N1,AO;function rg(){if(AO)return N1;AO=1;var r=ng(),t=Xc();function e(n,i){i=r(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[t(i[a++])];return a&&a==s?n:void 0}return N1=e,N1}var R1,PO;function nat(){if(PO)return R1;PO=1;var r=rg();function t(e,n,i){var a=e==null?void 0:r(e,n);return a===void 0?i:a}return R1=t,R1}var L1,NO;function rat(){if(NO)return L1;NO=1;function r(t,e){return t!=null&&e in Object(t)}return L1=r,L1}var I1,RO;function bD(){if(RO)return I1;RO=1;var r=ng(),t=Uc(),e=mn(),n=K0(),i=xE(),a=Xc();function s(o,l,u){l=r(l,o);for(var c=-1,h=l.length,d=!1;++c<h;){var g=a(l[c]);if(!(d=o!=null&&u(o,g)))break;o=o[g]}return d||++c!=h?d:(h=o==null?0:o.length,!!h&&i(h)&&n(g,h)&&(e(o)||t(o)))}return I1=s,I1}var D1,LO;function wD(){if(LO)return D1;LO=1;var r=rat(),t=bD();function e(n,i){return n!=null&&t(n,i,r)}return D1=e,D1}var F1,IO;function iat(){if(IO)return F1;IO=1;var r=pD(),t=nat(),e=wD(),n=PE(),i=vD(),a=mD(),s=Xc(),o=1,l=2;function u(c,h){return n(c)&&i(h)?a(s(c),h):function(d){var g=t(d,c);return g===void 0&&g===h?e(d,c):r(h,g,o|l)}}return F1=u,F1}var B1,DO;function xD(){if(DO)return B1;DO=1;function r(t){return function(e){return e==null?void 0:e[t]}}return B1=r,B1}var z1,FO;function aat(){if(FO)return z1;FO=1;var r=rg();function t(e){return function(n){return r(n,e)}}return z1=t,z1}var $1,BO;function sat(){if(BO)return $1;BO=1;var r=xD(),t=aat(),e=PE(),n=Xc();function i(a){return e(a)?r(n(a)):t(a)}return $1=i,$1}var j1,zO;function Za(){if(zO)return j1;zO=1;var r=Zit(),t=iat(),e=Zo(),n=mn(),i=sat();function a(s){return typeof s=="function"?s:s==null?e:typeof s=="object"?n(s)?t(s[0],s[1]):r(s):i(s)}return j1=a,j1}var q1,$O;function ED(){if($O)return q1;$O=1;var r=JI(),t=jit(),e=Za(),n=mn();function i(a,s){var o=n(a)?r:t;return o(a,e(s,3))}return q1=i,q1}var W1,jO;function oat(){if(jO)return W1;jO=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n,i){return n!=null&&t.call(n,i)}return W1=e,W1}var G1,qO;function _D(){if(qO)return G1;qO=1;var r=oat(),t=bD();function e(n,i){return n!=null&&t(n,i,r)}return G1=e,G1}var V1,WO;function lat(){if(WO)return V1;WO=1;var r=_E(),t=au(),e=Uc(),n=mn(),i=Ka(),a=iu(),s=J0(),o=Yc(),l="[object Map]",u="[object Set]",c=Object.prototype,h=c.hasOwnProperty;function d(g){if(g==null)return!0;if(i(g)&&(n(g)||typeof g=="string"||typeof g.splice=="function"||a(g)||o(g)||e(g)))return!g.length;var p=t(g);if(p==l||p==u)return!g.size;if(s(g))return!r(g).length;for(var v in g)if(h.call(g,v))return!1;return!0}return V1=d,V1}var H1,GO;function SD(){if(GO)return H1;GO=1;function r(t){return t===void 0}return H1=r,H1}var U1,VO;function MD(){if(VO)return U1;VO=1;var r=tg(),t=Ka();function e(n,i){var a=-1,s=t(n)?Array(n.length):[];return r(n,function(o,l,u){s[++a]=i(o,l,u)}),s}return U1=e,U1}var Y1,HO;function kD(){if(HO)return Y1;HO=1;var r=eg(),t=Za(),e=MD(),n=mn();function i(a,s){var o=n(a)?r:e;return o(a,t(s,3))}return Y1=i,Y1}var X1,UO;function uat(){if(UO)return X1;UO=1;function r(t,e,n,i){var a=-1,s=t==null?0:t.length;for(i&&s&&(n=t[++a]);++a<s;)n=e(n,t[a],a,t);return n}return X1=r,X1}var K1,YO;function cat(){if(YO)return K1;YO=1;function r(t,e,n,i,a){return a(t,function(s,o,l){n=i?(i=!1,s):e(n,s,o,l)}),n}return K1=r,K1}var Z1,XO;function CD(){if(XO)return Z1;XO=1;var r=uat(),t=tg(),e=Za(),n=cat(),i=mn();function a(s,o,l){var u=i(s)?r:n,c=arguments.length<3;return u(s,e(o,4),l,c,t)}return Z1=a,Z1}var J1,KO;function hat(){if(KO)return J1;KO=1;var r=Yo(),t=mn(),e=da(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&e(a)&&r(a)==n}return J1=i,J1}var Q1,ZO;function dat(){if(ZO)return Q1;ZO=1;var r=xD(),t=r("length");return Q1=t,Q1}var t2,JO;function fat(){if(JO)return t2;JO=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+r+i+a+"]");function l(u){return o.test(u)}return t2=l,t2}var e2,QO;function gat(){if(QO)return e2;QO=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="["+r+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",p=u+"?",v="["+a+"]?",m="(?:"+g+"(?:"+[c,h,d].join("|")+")"+v+p+")*",b=v+p+m,w="(?:"+[c+o+"?",o,h,d,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+w+b,"g");function S(_){for(var k=x.lastIndex=0;x.test(_);)++k;return k}return e2=S,e2}var n2,tA;function pat(){if(tA)return n2;tA=1;var r=dat(),t=fat(),e=gat();function n(i){return t(i)?e(i):r(i)}return n2=n,n2}var r2,eA;function vat(){if(eA)return r2;eA=1;var r=_E(),t=au(),e=Ka(),n=hat(),i=pat(),a="[object Map]",s="[object Set]";function o(l){if(l==null)return 0;if(e(l))return n(l)?i(l):l.length;var u=t(l);return u==a||u==s?l.size:r(l).length}return r2=o,r2}var i2,nA;function mat(){if(nA)return i2;nA=1;var r=wE(),t=sD(),e=OE(),n=Za(),i=Q0(),a=mn(),s=iu(),o=Vc(),l=yi(),u=Yc();function c(h,d,g){var p=a(h),v=p||s(h)||u(h);if(d=n(d,4),g==null){var m=h&&h.constructor;v?g=p?new m:[]:l(h)?g=o(m)?t(i(h)):{}:g={}}return(v?r:e)(h,function(b,w,x){return d(g,b,w,x)}),g}return i2=c,i2}var a2,rA;function yat(){if(rA)return a2;rA=1;var r=ru(),t=Uc(),e=mn(),n=r?r.isConcatSpreadable:void 0;function i(a){return e(a)||t(a)||!!(n&&a&&a[n])}return a2=i,a2}var s2,iA;function NE(){if(iA)return s2;iA=1;var r=ME(),t=yat();function e(n,i,a,s,o){var l=-1,u=n.length;for(a||(a=t),o||(o=[]);++l<u;){var c=n[l];i>0&&a(c)?i>1?e(c,i-1,a,s,o):r(o,c):s||(o[o.length]=c)}return o}return s2=e,s2}var o2,aA;function bat(){if(aA)return o2;aA=1;function r(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}return o2=r,o2}var l2,sA;function TD(){if(sA)return l2;sA=1;var r=bat(),t=Math.max;function e(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),u=Array(l);++o<l;)u[o]=s[i+o];o=-1;for(var c=Array(i+1);++o<i;)c[o]=s[o];return c[i]=a(u),r(n,this,c)}}return l2=e,l2}var u2,oA;function wat(){if(oA)return u2;oA=1;var r=CE(),t=UI(),e=Zo(),n=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:r(a),writable:!0})}:e;return u2=n,u2}var c2,lA;function xat(){if(lA)return c2;lA=1;var r=800,t=16,e=Date.now;function n(i){var a=0,s=0;return function(){var o=e(),l=t-(o-s);if(s=o,l>0){if(++a>=r)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return c2=n,c2}var h2,uA;function OD(){if(uA)return h2;uA=1;var r=wat(),t=xat(),e=t(r);return h2=e,h2}var d2,cA;function ig(){if(cA)return d2;cA=1;var r=Zo(),t=TD(),e=OD();function n(i,a){return e(t(i,a,r),i+"")}return d2=n,d2}var f2,hA;function AD(){if(hA)return f2;hA=1;function r(t,e,n,i){for(var a=t.length,s=n+(i?1:-1);i?s--:++s<a;)if(e(t[s],s,t))return s;return-1}return f2=r,f2}var g2,dA;function Eat(){if(dA)return g2;dA=1;function r(t){return t!==t}return g2=r,g2}var p2,fA;function _at(){if(fA)return p2;fA=1;function r(t,e,n){for(var i=n-1,a=t.length;++i<a;)if(t[i]===e)return i;return-1}return p2=r,p2}var v2,gA;function Sat(){if(gA)return v2;gA=1;var r=AD(),t=Eat(),e=_at();function n(i,a,s){return a===a?e(i,a,s):r(i,t,s)}return v2=n,v2}var m2,pA;function Mat(){if(pA)return m2;pA=1;var r=Sat();function t(e,n){var i=e==null?0:e.length;return!!i&&r(e,n,0)>-1}return m2=t,m2}var y2,vA;function kat(){if(vA)return y2;vA=1;function r(t,e,n){for(var i=-1,a=t==null?0:t.length;++i<a;)if(n(e,t[i]))return!0;return!1}return y2=r,y2}var b2,mA;function Cat(){if(mA)return b2;mA=1;function r(){}return b2=r,b2}var w2,yA;function Tat(){if(yA)return w2;yA=1;var r=rD(),t=Cat(),e=AE(),n=1/0,i=r&&1/e(new r([,-0]))[1]==n?function(a){return new r(a)}:t;return w2=i,w2}var x2,bA;function Oat(){if(bA)return x2;bA=1;var r=dD(),t=Mat(),e=kat(),n=fD(),i=Tat(),a=AE(),s=200;function o(l,u,c){var h=-1,d=t,g=l.length,p=!0,v=[],m=v;if(c)p=!1,d=e;else if(g>=s){var b=u?null:i(l);if(b)return a(b);p=!1,d=n,m=new r}else m=u?[]:v;t:for(;++h<g;){var w=l[h],x=u?u(w):w;if(w=c||w!==0?w:0,p&&x===x){for(var S=m.length;S--;)if(m[S]===x)continue t;u&&m.push(x),v.push(w)}else d(m,x,c)||(m!==v&&m.push(x),v.push(w))}return v}return x2=o,x2}var E2,wA;function PD(){if(wA)return E2;wA=1;var r=Ka(),t=da();function e(n){return t(n)&&r(n)}return E2=e,E2}var _2,xA;function Aat(){if(xA)return _2;xA=1;var r=NE(),t=ig(),e=Oat(),n=PD(),i=t(function(a){return e(r(a,1,n,!0))});return _2=i,_2}var S2,EA;function Pat(){if(EA)return S2;EA=1;var r=eg();function t(e,n){return r(n,function(i){return e[i]})}return S2=t,S2}var M2,_A;function ND(){if(_A)return M2;_A=1;var r=Pat(),t=to();function e(n){return n==null?[]:r(n,t(n))}return M2=e,M2}var k2,SA;function bi(){if(SA)return k2;SA=1;var r;if(typeof Sx=="function")try{r={clone:Bit(),constant:CE(),each:hD(),filter:ED(),has:_D(),isArray:mn(),isEmpty:lat(),isFunction:Vc(),isUndefined:SD(),keys:to(),map:kD(),reduce:CD(),size:vat(),transform:mat(),union:Aat(),values:ND()}}catch{}return r||(r=window._),k2=r,k2}var C2,MA;function RE(){if(MA)return C2;MA=1;var r=bi();C2=i;var t="\0",e="\0",n="";function i(c){this._isDirected=r.has(c,"directed")?c.directed:!0,this._isMultigraph=r.has(c,"multigraph")?c.multigraph:!1,this._isCompound=r.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._in[h])})},i.prototype.sinks=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._out[h])})},i.prototype.setNodes=function(c,h){var d=arguments,g=this;return r.each(c,function(p){d.length>1?g.setNode(p,h):g.setNode(p)}),this},i.prototype.setNode=function(c,h){return r.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=h),this):(this._nodes[c]=arguments.length>1?h:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=e,this._children[c]={},this._children[e][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return r.has(this._nodes,c)},i.prototype.removeNode=function(c){var h=this;if(r.has(this._nodes,c)){var d=function(g){h.removeEdge(h._edgeObjs[g])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],r.each(this.children(c),function(g){h.setParent(g)}),delete this._children[c]),r.each(r.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],r.each(r.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(h))h=e;else{h+="";for(var d=h;!r.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+h+" as parent of "+c+" would create a cycle");this.setNode(h)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=h,this._children[h][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var h=this._parent[c];if(h!==e)return h}},i.prototype.children=function(c){if(r.isUndefined(c)&&(c=e),this._isCompound){var h=this._children[c];if(h)return r.keys(h)}else{if(c===e)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var h=this._preds[c];if(h)return r.keys(h)},i.prototype.successors=function(c){var h=this._sucs[c];if(h)return r.keys(h)},i.prototype.neighbors=function(c){var h=this.predecessors(c);if(h)return r.union(h,this.successors(c))},i.prototype.isLeaf=function(c){var h;return this.isDirected()?h=this.successors(c):h=this.neighbors(c),h.length===0},i.prototype.filterNodes=function(c){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var d=this;r.each(this._nodes,function(v,m){c(m)&&h.setNode(m,v)}),r.each(this._edgeObjs,function(v){h.hasNode(v.v)&&h.hasNode(v.w)&&h.setEdge(v,d.edge(v))});var g={};function p(v){var m=d.parent(v);return m===void 0||h.hasNode(m)?(g[v]=m,m):m in g?g[m]:p(m)}return this._isCompound&&r.each(h.nodes(),function(v){h.setParent(v,p(v))}),h},i.prototype.setDefaultEdgeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(c,h){var d=this,g=arguments;return r.reduce(c,function(p,v){return g.length>1?d.setEdge(p,v,h):d.setEdge(p,v),v}),this},i.prototype.setEdge=function(){var c,h,d,g,p=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(c=v.v,h=v.w,d=v.name,arguments.length===2&&(g=arguments[1],p=!0)):(c=v,h=arguments[1],d=arguments[3],arguments.length>2&&(g=arguments[2],p=!0)),c=""+c,h=""+h,r.isUndefined(d)||(d=""+d);var m=o(this._isDirected,c,h,d);if(r.has(this._edgeLabels,m))return p&&(this._edgeLabels[m]=g),this;if(!r.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(h),this._edgeLabels[m]=p?g:this._defaultEdgeLabelFn(c,h,d);var b=l(this._isDirected,c,h,d);return c=b.v,h=b.w,Object.freeze(b),this._edgeObjs[m]=b,a(this._preds[h],c),a(this._sucs[c],h),this._in[h][m]=b,this._out[c][m]=b,this._edgeCount++,this},i.prototype.edge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return this._edgeLabels[g]},i.prototype.hasEdge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return r.has(this._edgeLabels,g)},i.prototype.removeEdge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d),p=this._edgeObjs[g];return p&&(c=p.v,h=p.w,delete this._edgeLabels[g],delete this._edgeObjs[g],s(this._preds[h],c),s(this._sucs[c],h),delete this._in[h][g],delete this._out[c][g],this._edgeCount--),this},i.prototype.inEdges=function(c,h){var d=this._in[c];if(d){var g=r.values(d);return h?r.filter(g,function(p){return p.v===h}):g}},i.prototype.outEdges=function(c,h){var d=this._out[c];if(d){var g=r.values(d);return h?r.filter(g,function(p){return p.w===h}):g}},i.prototype.nodeEdges=function(c,h){var d=this.inEdges(c,h);if(d)return d.concat(this.outEdges(c,h))};function a(c,h){c[h]?c[h]++:c[h]=1}function s(c,h){--c[h]||delete c[h]}function o(c,h,d,g){var p=""+h,v=""+d;if(!c&&p>v){var m=p;p=v,v=m}return p+n+v+n+(r.isUndefined(g)?t:g)}function l(c,h,d,g){var p=""+h,v=""+d;if(!c&&p>v){var m=p;p=v,v=m}var b={v:p,w:v};return g&&(b.name=g),b}function u(c,h){return o(c,h.v,h.w,h.name)}return C2}var T2,kA;function Nat(){return kA||(kA=1,T2="2.1.8"),T2}var O2,CA;function Rat(){return CA||(CA=1,O2={Graph:RE(),version:Nat()}),O2}var A2,TA;function Lat(){if(TA)return A2;TA=1;var r=bi(),t=RE();A2={write:e,read:a};function e(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return r.isUndefined(s.graph())||(o.value=r.clone(s.graph())),o}function n(s){return r.map(s.nodes(),function(o){var l=s.node(o),u=s.parent(o),c={v:o};return r.isUndefined(l)||(c.value=l),r.isUndefined(u)||(c.parent=u),c})}function i(s){return r.map(s.edges(),function(o){var l=s.edge(o),u={v:o.v,w:o.w};return r.isUndefined(o.name)||(u.name=o.name),r.isUndefined(l)||(u.value=l),u})}function a(s){var o=new t(s.options).setGraph(s.value);return r.each(s.nodes,function(l){o.setNode(l.v,l.value),l.parent&&o.setParent(l.v,l.parent)}),r.each(s.edges,function(l){o.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),o}return A2}var P2,OA;function Iat(){if(OA)return P2;OA=1;var r=bi();P2=t;function t(e){var n={},i=[],a;function s(o){r.has(n,o)||(n[o]=!0,a.push(o),r.each(e.successors(o),s),r.each(e.predecessors(o),s))}return r.each(e.nodes(),function(o){a=[],s(o),a.length&&i.push(a)}),i}return P2}var N2,AA;function RD(){if(AA)return N2;AA=1;var r=bi();N2=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(e){return e.key})},t.prototype.has=function(e){return r.has(this._keyIndices,e)},t.prototype.priority=function(e){var n=this._keyIndices[e];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(e,n){var i=this._keyIndices;if(e=String(e),!r.has(i,e)){var a=this._arr,s=a.length;return i[e]=s,a.push({key:e,priority:n}),this._decrease(s),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},t.prototype.decrease=function(e,n){var i=this._keyIndices[e];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(e){var n=this._arr,i=2*e,a=i+1,s=e;i<n.length&&(s=n[i].priority<n[s].priority?i:s,a<n.length&&(s=n[a].priority<n[s].priority?a:s),s!==e&&(this._swap(e,s),this._heapify(s)))},t.prototype._decrease=function(e){for(var n=this._arr,i=n[e].priority,a;e!==0&&(a=e>>1,!(n[a].priority<i));)this._swap(e,a),e=a},t.prototype._swap=function(e,n){var i=this._arr,a=this._keyIndices,s=i[e],o=i[n];i[e]=o,i[n]=s,a[o.key]=e,a[s.key]=n},N2}var R2,PA;function LD(){if(PA)return R2;PA=1;var r=bi(),t=RD();R2=n;var e=r.constant(1);function n(a,s,o,l){return i(a,String(s),o||e,l||function(u){return a.outEdges(u)})}function i(a,s,o,l){var u={},c=new t,h,d,g=function(p){var v=p.v!==h?p.v:p.w,m=u[v],b=o(p),w=d.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+b);w<m.distance&&(m.distance=w,m.predecessor=h,c.decrease(v,w))};for(a.nodes().forEach(function(p){var v=p===s?0:Number.POSITIVE_INFINITY;u[p]={distance:v},c.add(p,v)});c.size()>0&&(h=c.removeMin(),d=u[h],d.distance!==Number.POSITIVE_INFINITY);)l(h).forEach(g);return u}return R2}var L2,NA;function Dat(){if(NA)return L2;NA=1;var r=LD(),t=bi();L2=e;function e(n,i,a){return t.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return L2}var I2,RA;function ID(){if(RA)return I2;RA=1;var r=bi();I2=t;function t(e){var n=0,i=[],a={},s=[];function o(l){var u=a[l]={onStack:!0,lowlink:n,index:n++};if(i.push(l),e.successors(l).forEach(function(d){r.has(a,d)?a[d].onStack&&(u.lowlink=Math.min(u.lowlink,a[d].index)):(o(d),u.lowlink=Math.min(u.lowlink,a[d].lowlink))}),u.lowlink===u.index){var c=[],h;do h=i.pop(),a[h].onStack=!1,c.push(h);while(l!==h);s.push(c)}}return e.nodes().forEach(function(l){r.has(a,l)||o(l)}),s}return I2}var D2,LA;function Fat(){if(LA)return D2;LA=1;var r=bi(),t=ID();D2=e;function e(n){return r.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return D2}var F2,IA;function Bat(){if(IA)return F2;IA=1;var r=bi();F2=e;var t=r.constant(1);function e(i,a,s){return n(i,a||t,s||function(o){return i.outEdges(o)})}function n(i,a,s){var o={},l=i.nodes();return l.forEach(function(u){o[u]={},o[u][u]={distance:0},l.forEach(function(c){u!==c&&(o[u][c]={distance:Number.POSITIVE_INFINITY})}),s(u).forEach(function(c){var h=c.v===u?c.w:c.v,d=a(c);o[u][h]={distance:d,predecessor:u}})}),l.forEach(function(u){var c=o[u];l.forEach(function(h){var d=o[h];l.forEach(function(g){var p=d[u],v=c[g],m=d[g],b=p.distance+v.distance;b<m.distance&&(m.distance=b,m.predecessor=v.predecessor)})})}),o}return F2}var B2,DA;function DD(){if(DA)return B2;DA=1;var r=bi();B2=t,t.CycleException=e;function t(n){var i={},a={},s=[];function o(l){if(r.has(a,l))throw new e;r.has(i,l)||(a[l]=!0,i[l]=!0,r.each(n.predecessors(l),o),delete a[l],s.push(l))}if(r.each(n.sinks(),o),r.size(i)!==n.nodeCount())throw new e;return s}function e(){}return e.prototype=new Error,B2}var z2,FA;function zat(){if(FA)return z2;FA=1;var r=DD();z2=t;function t(e){try{r(e)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return z2}var $2,BA;function FD(){if(BA)return $2;BA=1;var r=bi();$2=t;function t(n,i,a){r.isArray(i)||(i=[i]);var s=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],l={};return r.each(i,function(u){if(!n.hasNode(u))throw new Error("Graph does not have node: "+u);e(n,u,a==="post",l,s,o)}),o}function e(n,i,a,s,o,l){r.has(s,i)||(s[i]=!0,a||l.push(i),r.each(o(i),function(u){e(n,u,a,s,o,l)}),a&&l.push(i))}return $2}var j2,zA;function $at(){if(zA)return j2;zA=1;var r=FD();j2=t;function t(e,n){return r(e,n,"post")}return j2}var q2,$A;function jat(){if($A)return q2;$A=1;var r=FD();q2=t;function t(e,n){return r(e,n,"pre")}return q2}var W2,jA;function qat(){if(jA)return W2;jA=1;var r=bi(),t=RE(),e=RD();W2=n;function n(i,a){var s=new t,o={},l=new e,u;function c(d){var g=d.v===u?d.w:d.v,p=l.priority(g);if(p!==void 0){var v=a(d);v<p&&(o[g]=u,l.decrease(g,v))}}if(i.nodeCount()===0)return s;r.each(i.nodes(),function(d){l.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),l.decrease(i.nodes()[0],0);for(var h=!1;l.size()>0;){if(u=l.removeMin(),r.has(o,u))s.setEdge(u,o[u]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(u).forEach(c)}return s}return W2}var G2,qA;function Wat(){return qA||(qA=1,G2={components:Iat(),dijkstra:LD(),dijkstraAll:Dat(),findCycles:Fat(),floydWarshall:Bat(),isAcyclic:zat(),postorder:$at(),preorder:jat(),prim:qat(),tarjan:ID(),topsort:DD()}),G2}var V2,WA;function Gat(){if(WA)return V2;WA=1;var r=Rat();return V2={Graph:r.Graph,json:Lat(),alg:Wat(),version:r.version},V2}var jf;if(typeof Sx=="function")try{jf=Gat()}catch{}jf||(jf=window.graphlib);var zi=jf,H2,GA;function Vat(){if(GA)return H2;GA=1;var r=lD(),t=1,e=4;function n(i){return r(i,t|e)}return H2=n,H2}var U2,VA;function ag(){if(VA)return U2;VA=1;var r=nu(),t=Ka(),e=K0(),n=yi();function i(a,s,o){if(!n(o))return!1;var l=typeof s;return(l=="number"?t(o)&&e(s,o.length):l=="string"&&s in o)?r(o[s],a):!1}return U2=i,U2}var Y2,HA;function Hat(){if(HA)return Y2;HA=1;var r=ig(),t=nu(),e=ag(),n=Ko(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,l){o=Object(o);var u=-1,c=l.length,h=c>2?l[2]:void 0;for(h&&e(l[0],l[1],h)&&(c=1);++u<c;)for(var d=l[u],g=n(d),p=-1,v=g.length;++p<v;){var m=g[p],b=o[m];(b===void 0||t(b,i[m])&&!a.call(o,m))&&(o[m]=d[m])}return o});return Y2=s,Y2}var X2,UA;function Uat(){if(UA)return X2;UA=1;var r=Za(),t=Ka(),e=to();function n(i){return function(a,s,o){var l=Object(a);if(!t(a)){var u=r(s,3);a=e(a),s=function(h){return u(l[h],h,l)}}var c=i(a,s,o);return c>-1?l[u?a[c]:c]:void 0}}return X2=n,X2}var K2,YA;function Yat(){if(YA)return K2;YA=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return K2=t,K2}var Z2,XA;function Xat(){if(XA)return Z2;XA=1;var r=Yat(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Z2=e,Z2}var J2,KA;function Kat(){if(KA)return J2;KA=1;var r=Xat(),t=yi(),e=su(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(e(u))return n;if(t(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=t(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=r(u);var h=a.test(u);return h||s.test(u)?o(u.slice(2),h?2:8):i.test(u)?n:+u}return J2=l,J2}var Q2,ZA;function BD(){if(ZA)return Q2;ZA=1;var r=Kat(),t=1/0,e=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===t||i===-1/0){var a=i<0?-1:1;return a*e}return i===i?i:0}return Q2=n,Q2}var tb,JA;function Zat(){if(JA)return tb;JA=1;var r=BD();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return tb=t,tb}var eb,QA;function Jat(){if(QA)return eb;QA=1;var r=AD(),t=Za(),e=Zat(),n=Math.max;function i(a,s,o){var l=a==null?0:a.length;if(!l)return-1;var u=o==null?0:e(o);return u<0&&(u=n(l+u,0)),r(a,t(s,3),u)}return eb=i,eb}var nb,tP;function Qat(){if(tP)return nb;tP=1;var r=Uat(),t=Jat(),e=r(t);return nb=e,nb}var rb,eP;function zD(){if(eP)return rb;eP=1;var r=NE();function t(e){var n=e==null?0:e.length;return n?r(e,1):[]}return rb=t,rb}var ib,nP;function tst(){if(nP)return ib;nP=1;var r=TE(),t=uD(),e=Ko();function n(i,a){return i==null?i:r(i,t(a),e)}return ib=n,ib}var ab,rP;function est(){if(rP)return ab;rP=1;function r(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return ab=r,ab}var sb,iP;function nst(){if(iP)return sb;iP=1;var r=Y0(),t=OE(),e=Za();function n(i,a){var s={};return a=e(a,3),t(i,function(o,l,u){r(s,l,a(o,l,u))}),s}return sb=n,sb}var ob,aP;function LE(){if(aP)return ob;aP=1;var r=su();function t(e,n,i){for(var a=-1,s=e.length;++a<s;){var o=e[a],l=n(o);if(l!=null&&(u===void 0?l===l&&!r(l):i(l,u)))var u=l,c=o}return c}return ob=t,ob}var lb,sP;function rst(){if(sP)return lb;sP=1;function r(t,e){return t>e}return lb=r,lb}var ub,oP;function ist(){if(oP)return ub;oP=1;var r=LE(),t=rst(),e=Zo();function n(i){return i&&i.length?r(i,e,t):void 0}return ub=n,ub}var cb,lP;function $D(){if(lP)return cb;lP=1;var r=Y0(),t=nu();function e(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return cb=e,cb}var hb,uP;function ast(){if(uP)return hb;uP=1;var r=Yo(),t=Q0(),e=da(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,l=s.call(Object);function u(c){if(!e(c)||r(c)!=n)return!1;var h=t(c);if(h===null)return!0;var d=o.call(h,"constructor")&&h.constructor;return typeof d=="function"&&d instanceof d&&s.call(d)==l}return hb=u,hb}var db,cP;function jD(){if(cP)return db;cP=1;function r(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return db=r,db}var fb,hP;function sst(){if(hP)return fb;hP=1;var r=Hc(),t=Ko();function e(n){return r(n,t(n))}return fb=e,fb}var gb,dP;function ost(){if(dP)return gb;dP=1;var r=$D(),t=KI(),e=aD(),n=ZI(),i=oD(),a=Uc(),s=mn(),o=PD(),l=iu(),u=Vc(),c=yi(),h=ast(),d=Yc(),g=jD(),p=sst();function v(m,b,w,x,S,_,k){var M=g(m,w),C=g(b,w),P=k.get(C);if(P){r(m,w,P);return}var T=_?_(M,C,w+"",m,b,k):void 0,A=T===void 0;if(A){var R=s(C),L=!R&&l(C),$=!R&&!L&&d(C);T=C,R||L||$?s(M)?T=M:o(M)?T=n(M):L?(A=!1,T=t(C,!0)):$?(A=!1,T=e(C,!0)):T=[]:h(C)||a(C)?(T=M,a(M)?T=p(M):(!c(M)||u(M))&&(T=i(C))):A=!1}A&&(k.set(C,T),S(T,C,x,_,k),k.delete(C)),r(m,w,T)}return gb=v,gb}var pb,fP;function lst(){if(fP)return pb;fP=1;var r=U0(),t=$D(),e=TE(),n=ost(),i=yi(),a=Ko(),s=jD();function o(l,u,c,h,d){l!==u&&e(u,function(g,p){if(d||(d=new r),i(g))n(l,u,p,c,o,h,d);else{var v=h?h(s(l,p),g,p+"",l,u,d):void 0;v===void 0&&(v=g),t(l,p,v)}},a)}return pb=o,pb}var vb,gP;function ust(){if(gP)return vb;gP=1;var r=ig(),t=ag();function e(n){return r(function(i,a){var s=-1,o=a.length,l=o>1?a[o-1]:void 0,u=o>2?a[2]:void 0;for(l=n.length>3&&typeof l=="function"?(o--,l):void 0,u&&t(a[0],a[1],u)&&(l=o<3?void 0:l,o=1),i=Object(i);++s<o;){var c=a[s];c&&n(i,c,s,l)}return i})}return vb=e,vb}var mb,pP;function cst(){if(pP)return mb;pP=1;var r=lst(),t=ust(),e=t(function(n,i,a){r(n,i,a)});return mb=e,mb}var yb,vP;function qD(){if(vP)return yb;vP=1;function r(t,e){return t<e}return yb=r,yb}var bb,mP;function hst(){if(mP)return bb;mP=1;var r=LE(),t=qD(),e=Zo();function n(i){return i&&i.length?r(i,e,t):void 0}return bb=n,bb}var wb,yP;function dst(){if(yP)return wb;yP=1;var r=LE(),t=Za(),e=qD();function n(i,a){return i&&i.length?r(i,t(a,2),e):void 0}return wb=n,wb}var xb,bP;function fst(){if(bP)return xb;bP=1;var r=Bi(),t=function(){return r.Date.now()};return xb=t,xb}var Eb,wP;function gst(){if(wP)return Eb;wP=1;var r=X0(),t=ng(),e=K0(),n=yi(),i=Xc();function a(s,o,l,u){if(!n(s))return s;o=t(o,s);for(var c=-1,h=o.length,d=h-1,g=s;g!=null&&++c<h;){var p=i(o[c]),v=l;if(p==="__proto__"||p==="constructor"||p==="prototype")return s;if(c!=d){var m=g[p];v=u?u(m,p,g):void 0,v===void 0&&(v=n(m)?m:e(o[c+1])?[]:{})}r(g,p,v),g=g[p]}return s}return Eb=a,Eb}var _b,xP;function pst(){if(xP)return _b;xP=1;var r=rg(),t=gst(),e=ng();function n(i,a,s){for(var o=-1,l=a.length,u={};++o<l;){var c=a[o],h=r(i,c);s(h,c)&&t(u,e(c,i),h)}return u}return _b=n,_b}var Sb,EP;function vst(){if(EP)return Sb;EP=1;var r=pst(),t=wD();function e(n,i){return r(n,i,function(a,s){return t(n,s)})}return Sb=e,Sb}var Mb,_P;function mst(){if(_P)return Mb;_P=1;var r=zD(),t=TD(),e=OD();function n(i){return e(t(i,void 0,r),i+"")}return Mb=n,Mb}var kb,SP;function yst(){if(SP)return kb;SP=1;var r=vst(),t=mst(),e=t(function(n,i){return n==null?{}:r(n,i)});return kb=e,kb}var Cb,MP;function bst(){if(MP)return Cb;MP=1;var r=Math.ceil,t=Math.max;function e(n,i,a,s){for(var o=-1,l=t(r((i-n)/(a||1)),0),u=Array(l);l--;)u[s?l:++o]=n,n+=a;return u}return Cb=e,Cb}var Tb,kP;function wst(){if(kP)return Tb;kP=1;var r=bst(),t=ag(),e=BD();function n(i){return function(a,s,o){return o&&typeof o!="number"&&t(a,s,o)&&(s=o=void 0),a=e(a),s===void 0?(s=a,a=0):s=e(s),o=o===void 0?a<s?1:-1:e(o),r(a,s,o,i)}}return Tb=n,Tb}var Ob,CP;function xst(){if(CP)return Ob;CP=1;var r=wst(),t=r();return Ob=t,Ob}var Ab,TP;function Est(){if(TP)return Ab;TP=1;function r(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}return Ab=r,Ab}var Pb,OP;function _st(){if(OP)return Pb;OP=1;var r=su();function t(e,n){if(e!==n){var i=e!==void 0,a=e===null,s=e===e,o=r(e),l=n!==void 0,u=n===null,c=n===n,h=r(n);if(!u&&!h&&!o&&e>n||o&&l&&c&&!u&&!h||a&&l&&c||!i&&c||!s)return 1;if(!a&&!o&&!h&&e<n||h&&i&&s&&!a&&!o||u&&i&&s||!l&&s||!c)return-1}return 0}return Pb=t,Pb}var Nb,AP;function Sst(){if(AP)return Nb;AP=1;var r=_st();function t(e,n,i){for(var a=-1,s=e.criteria,o=n.criteria,l=s.length,u=i.length;++a<l;){var c=r(s[a],o[a]);if(c){if(a>=u)return c;var h=i[a];return c*(h=="desc"?-1:1)}}return e.index-n.index}return Nb=t,Nb}var Rb,PP;function Mst(){if(PP)return Rb;PP=1;var r=eg(),t=rg(),e=Za(),n=MD(),i=Est(),a=Z0(),s=Sst(),o=Zo(),l=mn();function u(c,h,d){h.length?h=r(h,function(v){return l(v)?function(m){return t(m,v.length===1?v[0]:v)}:v}):h=[o];var g=-1;h=r(h,a(e));var p=n(c,function(v,m,b){var w=r(h,function(x){return x(v)});return{criteria:w,index:++g,value:v}});return i(p,function(v,m){return s(v,m,d)})}return Rb=u,Rb}var Lb,NP;function kst(){if(NP)return Lb;NP=1;var r=NE(),t=Mst(),e=ig(),n=ag(),i=e(function(a,s){if(a==null)return[];var o=s.length;return o>1&&n(a,s[0],s[1])?s=[]:o>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(a,r(s,1),[])});return Lb=i,Lb}var Ib,RP;function Cst(){if(RP)return Ib;RP=1;var r=yD(),t=0;function e(n){var i=++t;return r(n)+i}return Ib=e,Ib}var Db,LP;function Tst(){if(LP)return Db;LP=1;function r(t,e,n){for(var i=-1,a=t.length,s=e.length,o={};++i<a;){var l=i<s?e[i]:void 0;n(o,t[i],l)}return o}return Db=r,Db}var Fb,IP;function Ost(){if(IP)return Fb;IP=1;var r=X0(),t=Tst();function e(n,i){return t(n||[],i||[],r)}return Fb=e,Fb}var qf;if(typeof Sx=="function")try{qf={cloneDeep:Vat(),constant:CE(),defaults:Hat(),each:hD(),filter:ED(),find:Qat(),flatten:zD(),forEach:cD(),forIn:tst(),has:_D(),isUndefined:SD(),last:est(),map:kD(),mapValues:nst(),max:ist(),merge:cst(),min:hst(),minBy:dst(),now:fst(),pick:yst(),range:xst(),reduce:CD(),sortBy:kst(),uniqueId:Cst(),values:ND(),zipObject:Ost()}}catch{}qf||(qf=window._);var We=qf,Ast=sg;function sg(){var r={};r._next=r._prev=r,this._sentinel=r}sg.prototype.dequeue=function(){var r=this._sentinel,t=r._prev;if(t!==r)return WD(t),t};sg.prototype.enqueue=function(r){var t=this._sentinel;r._prev&&r._next&&WD(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t};sg.prototype.toString=function(){for(var r=[],t=this._sentinel,e=t._prev;e!==t;)r.push(JSON.stringify(e,Pst)),e=e._prev;return"["+r.join(", ")+"]"};function WD(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function Pst(r,t){if(r!=="_next"&&r!=="_prev")return t}var Da=We,Nst=zi.Graph,Rst=Ast,Lst=Dst,Ist=Da.constant(1);function Dst(r,t){if(r.nodeCount()<=1)return[];var e=Bst(r,t||Ist),n=Fst(e.graph,e.buckets,e.zeroIdx);return Da.flatten(Da.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)}function Fst(r,t,e){for(var n=[],i=t[t.length-1],a=t[0],s;r.nodeCount();){for(;s=a.dequeue();)Bb(r,t,e,s);for(;s=i.dequeue();)Bb(r,t,e,s);if(r.nodeCount()){for(var o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(Bb(r,t,e,s,!0));break}}}return n}function Bb(r,t,e,n,i){var a=i?[]:void 0;return Da.forEach(r.inEdges(n.v),function(s){var o=r.edge(s),l=r.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,ax(t,e,l)}),Da.forEach(r.outEdges(n.v),function(s){var o=r.edge(s),l=s.w,u=r.node(l);u.in-=o,ax(t,e,u)}),r.removeNode(n.v),a}function Bst(r,t){var e=new Nst,n=0,i=0;Da.forEach(r.nodes(),function(o){e.setNode(o,{v:o,in:0,out:0})}),Da.forEach(r.edges(),function(o){var l=e.edge(o.v,o.w)||0,u=t(o),c=l+u;e.setEdge(o.v,o.w,c),i=Math.max(i,e.node(o.v).out+=u),n=Math.max(n,e.node(o.w).in+=u)});var a=Da.range(i+n+3).map(function(){return new Rst}),s=n+1;return Da.forEach(e.nodes(),function(o){ax(a,s,e.node(o))}),{graph:e,buckets:a,zeroIdx:s}}function ax(r,t,e){e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)}var So=We,zst=Lst,$st={run:jst,undo:Wst};function jst(r){var t=r.graph().acyclicer==="greedy"?zst(r,e(r)):qst(r);So.forEach(t,function(n){var i=r.edge(n);r.removeEdge(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,So.uniqueId("rev"))});function e(n){return function(i){return n.edge(i).weight}}}function qst(r){var t=[],e={},n={};function i(a){So.has(n,a)||(n[a]=!0,e[a]=!0,So.forEach(r.outEdges(a),function(s){So.has(e,s.w)?t.push(s):i(s.w)}),delete e[a])}return So.forEach(r.nodes(),i),t}function Wst(r){So.forEach(r.edges(),function(t){var e=r.edge(t);if(e.reversed){r.removeEdge(t);var n=e.forwardName;delete e.reversed,delete e.forwardName,r.setEdge(t.w,t.v,e,n)}})}var de=We,GD=zi.Graph,kr={addDummyNode:VD,simplify:Gst,asNonCompoundGraph:Vst,successorWeights:Hst,predecessorWeights:Ust,intersectRect:Yst,buildLayerMatrix:Xst,normalizeRanks:Kst,removeEmptyRanks:Zst,addBorderNode:Jst,maxRank:HD,partition:Qst,time:tot,notime:eot};function VD(r,t,e,n){var i;do i=de.uniqueId(n);while(r.hasNode(i));return e.dummy=t,r.setNode(i,e),i}function Gst(r){var t=new GD().setGraph(r.graph());return de.forEach(r.nodes(),function(e){t.setNode(e,r.node(e))}),de.forEach(r.edges(),function(e){var n=t.edge(e.v,e.w)||{weight:0,minlen:1},i=r.edge(e);t.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function Vst(r){var t=new GD({multigraph:r.isMultigraph()}).setGraph(r.graph());return de.forEach(r.nodes(),function(e){r.children(e).length||t.setNode(e,r.node(e))}),de.forEach(r.edges(),function(e){t.setEdge(e,r.edge(e))}),t}function Hst(r){var t=de.map(r.nodes(),function(e){var n={};return de.forEach(r.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return de.zipObject(r.nodes(),t)}function Ust(r){var t=de.map(r.nodes(),function(e){var n={};return de.forEach(r.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return de.zipObject(r.nodes(),t)}function Yst(r,t){var e=r.x,n=r.y,i=t.x-e,a=t.y-n,s=r.width/2,o=r.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:e+l,y:n+u}}function Xst(r){var t=de.map(de.range(HD(r)+1),function(){return[]});return de.forEach(r.nodes(),function(e){var n=r.node(e),i=n.rank;de.isUndefined(i)||(t[i][n.order]=e)}),t}function Kst(r){var t=de.min(de.map(r.nodes(),function(e){return r.node(e).rank}));de.forEach(r.nodes(),function(e){var n=r.node(e);de.has(n,"rank")&&(n.rank-=t)})}function Zst(r){var t=de.min(de.map(r.nodes(),function(a){return r.node(a).rank})),e=[];de.forEach(r.nodes(),function(a){var s=r.node(a).rank-t;e[s]||(e[s]=[]),e[s].push(a)});var n=0,i=r.graph().nodeRankFactor;de.forEach(e,function(a,s){de.isUndefined(a)&&s%i!==0?--n:n&&de.forEach(a,function(o){r.node(o).rank+=n})})}function Jst(r,t,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),VD(r,"border",i,t)}function HD(r){return de.max(de.map(r.nodes(),function(t){var e=r.node(t).rank;if(!de.isUndefined(e))return e}))}function Qst(r,t){var e={lhs:[],rhs:[]};return de.forEach(r,function(n){t(n)?e.lhs.push(n):e.rhs.push(n)}),e}function tot(r,t){var e=de.now();try{return t()}finally{console.log(r+" time: "+(de.now()-e)+"ms")}}function eot(r,t){return t()}var UD=We,not=kr,rot={run:iot,undo:sot};function iot(r){r.graph().dummyChains=[],UD.forEach(r.edges(),function(t){aot(r,t)})}function aot(r,t){var e=t.v,n=r.node(e).rank,i=t.w,a=r.node(i).rank,s=t.name,o=r.edge(t),l=o.labelRank;if(a!==n+1){r.removeEdge(t);var u,c,h;for(h=0,++n;n<a;++h,++n)o.points=[],c={width:0,height:0,edgeLabel:o,edgeObj:t,rank:n},u=not.addDummyNode(r,"edge",c,"_d"),n===l&&(c.width=o.width,c.height=o.height,c.dummy="edge-label",c.labelpos=o.labelpos),r.setEdge(e,u,{weight:o.weight},s),h===0&&r.graph().dummyChains.push(u),e=u;r.setEdge(e,i,{weight:o.weight},s)}}function sot(r){UD.forEach(r.graph().dummyChains,function(t){var e=r.node(t),n=e.edgeLabel,i;for(r.setEdge(e.edgeObj,n);e.dummy;)i=r.successors(t)[0],r.removeNode(t),n.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(n.x=e.x,n.y=e.y,n.width=e.width,n.height=e.height),t=i,e=r.node(t)})}var Nd=We,og={longestPath:oot,slack:lot};function oot(r){var t={};function e(n){var i=r.node(n);if(Nd.has(t,n))return i.rank;t[n]=!0;var a=Nd.min(Nd.map(r.outEdges(n),function(s){return e(s.w)-r.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}Nd.forEach(r.sources(),e)}function lot(r,t){return r.node(t.w).rank-r.node(t.v).rank-r.edge(t).minlen}var Wf=We,uot=zi.Graph,Gf=og.slack,YD=cot;function cot(r){var t=new uot({directed:!1}),e=r.nodes()[0],n=r.nodeCount();t.setNode(e,{});for(var i,a;hot(t,r)<n;)i=dot(t,r),a=t.hasNode(i.v)?Gf(r,i):-Gf(r,i),fot(t,r,a);return t}function hot(r,t){function e(n){Wf.forEach(t.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!r.hasNode(s)&&!Gf(t,i)&&(r.setNode(s,{}),r.setEdge(n,s,{}),e(s))})}return Wf.forEach(r.nodes(),e),r.nodeCount()}function dot(r,t){return Wf.minBy(t.edges(),function(e){if(r.hasNode(e.v)!==r.hasNode(e.w))return Gf(t,e)})}function fot(r,t,e){Wf.forEach(r.nodes(),function(n){t.node(n).rank+=e})}var Va=We,got=YD,pot=og.slack,vot=og.longestPath,mot=zi.alg.preorder,yot=zi.alg.postorder,bot=kr.simplify,wot=Jo;Jo.initLowLimValues=DE;Jo.initCutValues=IE;Jo.calcCutValue=XD;Jo.leaveEdge=ZD;Jo.enterEdge=JD;Jo.exchangeEdges=QD;function Jo(r){r=bot(r),vot(r);var t=got(r);DE(t),IE(t,r);for(var e,n;e=ZD(t);)n=JD(t,r,e),QD(t,r,e,n)}function IE(r,t){var e=yot(r,r.nodes());e=e.slice(0,e.length-1),Va.forEach(e,function(n){xot(r,t,n)})}function xot(r,t,e){var n=r.node(e),i=n.parent;r.edge(e,i).cutvalue=XD(r,t,e)}function XD(r,t,e){var n=r.node(e),i=n.parent,a=!0,s=t.edge(e,i),o=0;return s||(a=!1,s=t.edge(i,e)),o=s.weight,Va.forEach(t.nodeEdges(e),function(l){var u=l.v===e,c=u?l.w:l.v;if(c!==i){var h=u===a,d=t.edge(l).weight;if(o+=h?d:-d,_ot(r,e,c)){var g=r.edge(e,c).cutvalue;o+=h?-g:g}}}),o}function DE(r,t){arguments.length<2&&(t=r.nodes()[0]),KD(r,{},1,t)}function KD(r,t,e,n,i){var a=e,s=r.node(n);return t[n]=!0,Va.forEach(r.neighbors(n),function(o){Va.has(t,o)||(e=KD(r,t,e,o,n))}),s.low=a,s.lim=e++,i?s.parent=i:delete s.parent,e}function ZD(r){return Va.find(r.edges(),function(t){return r.edge(t).cutvalue<0})}function JD(r,t,e){var n=e.v,i=e.w;t.hasEdge(n,i)||(n=e.w,i=e.v);var a=r.node(n),s=r.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=Va.filter(t.edges(),function(c){return l===DP(r,r.node(c.v),o)&&l!==DP(r,r.node(c.w),o)});return Va.minBy(u,function(c){return pot(t,c)})}function QD(r,t,e,n){var i=e.v,a=e.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),DE(r),IE(r,t),Eot(r,t)}function Eot(r,t){var e=Va.find(r.nodes(),function(i){return!t.node(i).parent}),n=mot(r,e);n=n.slice(1),Va.forEach(n,function(i){var a=r.node(i).parent,s=t.edge(i,a),o=!1;s||(s=t.edge(a,i),o=!0),t.node(i).rank=t.node(a).rank+(o?s.minlen:-s.minlen)})}function _ot(r,t,e){return r.hasEdge(t,e)}function DP(r,t,e){return e.low<=t.lim&&t.lim<=e.lim}var Sot=og,t5=Sot.longestPath,Mot=YD,kot=wot,Cot=Tot;function Tot(r){switch(r.graph().ranker){case"network-simplex":FP(r);break;case"tight-tree":Aot(r);break;case"longest-path":Oot(r);break;default:FP(r)}}var Oot=t5;function Aot(r){t5(r),Mot(r)}function FP(r){kot(r)}var sx=We,Pot=Not;function Not(r){var t=Lot(r);sx.forEach(r.graph().dummyChains,function(e){for(var n=r.node(e),i=n.edgeObj,a=Rot(r,t,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],c=!0;e!==i.w;){if(n=r.node(e),c){for(;(u=s[l])!==o&&r.node(u).maxRank<n.rank;)l++;u===o&&(c=!1)}if(!c){for(;l<s.length-1&&r.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}r.setParent(e,u),e=r.successors(e)[0]}})}function Rot(r,t,e,n){var i=[],a=[],s=Math.min(t[e].low,t[n].low),o=Math.max(t[e].lim,t[n].lim),l,u;l=e;do l=r.parent(l),i.push(l);while(l&&(t[l].low>s||o>t[l].lim));for(u=l,l=n;(l=r.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function Lot(r){var t={},e=0;function n(i){var a=e;sx.forEach(r.children(i),n),t[i]={low:a,lim:e++}}return sx.forEach(r.children(),n),t}var Fa=We,ox=kr,Iot={run:Dot,cleanup:zot};function Dot(r){var t=ox.addDummyNode(r,"root",{},"_root"),e=Fot(r),n=Fa.max(Fa.values(e))-1,i=2*n+1;r.graph().nestingRoot=t,Fa.forEach(r.edges(),function(s){r.edge(s).minlen*=i});var a=Bot(r)+1;Fa.forEach(r.children(),function(s){e5(r,t,i,a,n,e,s)}),r.graph().nodeRankFactor=i}function e5(r,t,e,n,i,a,s){var o=r.children(s);if(!o.length){s!==t&&r.setEdge(t,s,{weight:0,minlen:e});return}var l=ox.addBorderNode(r,"_bt"),u=ox.addBorderNode(r,"_bb"),c=r.node(s);r.setParent(l,s),c.borderTop=l,r.setParent(u,s),c.borderBottom=u,Fa.forEach(o,function(h){e5(r,t,e,n,i,a,h);var d=r.node(h),g=d.borderTop?d.borderTop:h,p=d.borderBottom?d.borderBottom:h,v=d.borderTop?n:2*n,m=g!==p?1:i-a[s]+1;r.setEdge(l,g,{weight:v,minlen:m,nestingEdge:!0}),r.setEdge(p,u,{weight:v,minlen:m,nestingEdge:!0})}),r.parent(s)||r.setEdge(t,l,{weight:0,minlen:i+a[s]})}function Fot(r){var t={};function e(n,i){var a=r.children(n);a&&a.length&&Fa.forEach(a,function(s){e(s,i+1)}),t[n]=i}return Fa.forEach(r.children(),function(n){e(n,1)}),t}function Bot(r){return Fa.reduce(r.edges(),function(t,e){return t+r.edge(e).weight},0)}function zot(r){var t=r.graph();r.removeNode(t.nestingRoot),delete t.nestingRoot,Fa.forEach(r.edges(),function(e){var n=r.edge(e);n.nestingEdge&&r.removeEdge(e)})}var zb=We,$ot=kr,jot=qot;function qot(r){function t(e){var n=r.children(e),i=r.node(e);if(n.length&&zb.forEach(n,t),zb.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)BP(r,"borderLeft","_bl",e,i,a),BP(r,"borderRight","_br",e,i,a)}}zb.forEach(r.children(),t)}function BP(r,t,e,n,i,a){var s={width:0,height:0,rank:a,borderType:t},o=i[t][a-1],l=$ot.addDummyNode(r,"border",s,e);i[t][a]=l,r.setParent(l,n),o&&r.setEdge(o,l,{weight:1})}var ra=We,Wot={adjust:Got,undo:Vot};function Got(r){var t=r.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&n5(r)}function Vot(r){var t=r.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&Hot(r),(t==="lr"||t==="rl")&&(Uot(r),n5(r))}function n5(r){ra.forEach(r.nodes(),function(t){zP(r.node(t))}),ra.forEach(r.edges(),function(t){zP(r.edge(t))})}function zP(r){var t=r.width;r.width=r.height,r.height=t}function Hot(r){ra.forEach(r.nodes(),function(t){$b(r.node(t))}),ra.forEach(r.edges(),function(t){var e=r.edge(t);ra.forEach(e.points,$b),ra.has(e,"y")&&$b(e)})}function $b(r){r.y=-r.y}function Uot(r){ra.forEach(r.nodes(),function(t){jb(r.node(t))}),ra.forEach(r.edges(),function(t){var e=r.edge(t);ra.forEach(e.points,jb),ra.has(e,"x")&&jb(e)})}function jb(r){var t=r.x;r.x=r.y,r.y=t}var _a=We,Yot=Xot;function Xot(r){var t={},e=_a.filter(r.nodes(),function(o){return!r.children(o).length}),n=_a.max(_a.map(e,function(o){return r.node(o).rank})),i=_a.map(_a.range(n+1),function(){return[]});function a(o){if(!_a.has(t,o)){t[o]=!0;var l=r.node(o);i[l.rank].push(o),_a.forEach(r.successors(o),a)}}var s=_a.sortBy(e,function(o){return r.node(o).rank});return _a.forEach(s,a),i}var ds=We,Kot=Zot;function Zot(r,t){for(var e=0,n=1;n<t.length;++n)e+=Jot(r,t[n-1],t[n]);return e}function Jot(r,t,e){for(var n=ds.zipObject(e,ds.map(e,function(u,c){return c})),i=ds.flatten(ds.map(t,function(u){return ds.sortBy(ds.map(r.outEdges(u),function(c){return{pos:n[c.w],weight:r.edge(c).weight}}),"pos")}),!0),a=1;a<e.length;)a<<=1;var s=2*a-1;a-=1;var o=ds.map(new Array(s),function(){return 0}),l=0;return ds.forEach(i.forEach(function(u){var c=u.pos+a;o[c]+=u.weight;for(var h=0;c>0;)c%2&&(h+=o[c+1]),c=c-1>>1,o[c]+=u.weight;l+=u.weight*h})),l}var $P=We,Qot=tlt;function tlt(r,t){return $P.map(t,function(e){var n=r.inEdges(e);if(n.length){var i=$P.reduce(n,function(a,s){var o=r.edge(s),l=r.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}var Br=We,elt=nlt;function nlt(r,t){var e={};Br.forEach(r,function(i,a){var s=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};Br.isUndefined(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),Br.forEach(t.edges(),function(i){var a=e[i.v],s=e[i.w];!Br.isUndefined(a)&&!Br.isUndefined(s)&&(s.indegree++,a.out.push(e[i.w]))});var n=Br.filter(e,function(i){return!i.indegree});return rlt(n)}function rlt(r){var t=[];function e(a){return function(s){s.merged||(Br.isUndefined(s.barycenter)||Br.isUndefined(a.barycenter)||s.barycenter>=a.barycenter)&&ilt(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&r.push(s)}}for(;r.length;){var i=r.pop();t.push(i),Br.forEach(i.in.reverse(),e(i)),Br.forEach(i.out,n(i))}return Br.map(Br.filter(t,function(a){return!a.merged}),function(a){return Br.pick(a,["vs","i","barycenter","weight"])})}function ilt(r,t){var e=0,n=0;r.weight&&(e+=r.barycenter*r.weight,n+=r.weight),t.weight&&(e+=t.barycenter*t.weight,n+=t.weight),r.vs=t.vs.concat(r.vs),r.barycenter=e/n,r.weight=n,r.i=Math.min(t.i,r.i),t.merged=!0}var Yu=We,alt=kr,slt=olt;function olt(r,t){var e=alt.partition(r,function(c){return Yu.has(c,"barycenter")}),n=e.lhs,i=Yu.sortBy(e.rhs,function(c){return-c.i}),a=[],s=0,o=0,l=0;n.sort(llt(!!t)),l=jP(a,i,l),Yu.forEach(n,function(c){l+=c.vs.length,a.push(c.vs),s+=c.barycenter*c.weight,o+=c.weight,l=jP(a,i,l)});var u={vs:Yu.flatten(a,!0)};return o&&(u.barycenter=s/o,u.weight=o),u}function jP(r,t,e){for(var n;t.length&&(n=Yu.last(t)).i<=e;)t.pop(),r.push(n.vs),e++;return e}function llt(r){return function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i}}var xs=We,ult=Qot,clt=elt,hlt=slt,dlt=r5;function r5(r,t,e,n){var i=r.children(t),a=r.node(t),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=xs.filter(i,function(p){return p!==s&&p!==o}));var u=ult(r,i);xs.forEach(u,function(p){if(r.children(p.v).length){var v=r5(r,p.v,e,n);l[p.v]=v,xs.has(v,"barycenter")&&glt(p,v)}});var c=clt(u,e);flt(c,l);var h=hlt(c,n);if(s&&(h.vs=xs.flatten([s,h.vs,o],!0),r.predecessors(s).length)){var d=r.node(r.predecessors(s)[0]),g=r.node(r.predecessors(o)[0]);xs.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+g.order)/(h.weight+2),h.weight+=2}return h}function flt(r,t){xs.forEach(r,function(e){e.vs=xs.flatten(e.vs.map(function(n){return t[n]?t[n].vs:n}),!0)})}function glt(r,t){xs.isUndefined(r.barycenter)?(r.barycenter=t.barycenter,r.weight=t.weight):(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight)}var Xu=We,plt=zi.Graph,vlt=mlt;function mlt(r,t,e){var n=ylt(r),i=new plt({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return Xu.forEach(r.nodes(),function(a){var s=r.node(a),o=r.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),Xu.forEach(r[e](a),function(l){var u=l.v===a?l.w:l.v,c=i.edge(u,a),h=Xu.isUndefined(c)?0:c.weight;i.setEdge(u,a,{weight:r.edge(l).weight+h})}),Xu.has(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i}function ylt(r){for(var t;r.hasNode(t=Xu.uniqueId("_root")););return t}var blt=We,wlt=xlt;function xlt(r,t,e){var n={},i;blt.forEach(e,function(a){for(var s=r.parent(a),o,l;s;){if(o=r.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=o}})}var Ds=We,Elt=Yot,_lt=Kot,Slt=dlt,Mlt=vlt,klt=wlt,Clt=zi.Graph,qP=kr,Tlt=Olt;function Olt(r){var t=qP.maxRank(r),e=WP(r,Ds.range(1,t+1),"inEdges"),n=WP(r,Ds.range(t-1,-1,-1),"outEdges"),i=Elt(r);GP(r,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){Alt(o%2?e:n,o%4>=2),i=qP.buildLayerMatrix(r);var u=_lt(r,i);u<a&&(l=0,s=Ds.cloneDeep(i),a=u)}GP(r,s)}function WP(r,t,e){return Ds.map(t,function(n){return Mlt(r,n,e)})}function Alt(r,t){var e=new Clt;Ds.forEach(r,function(n){var i=n.graph().root,a=Slt(n,i,e,t);Ds.forEach(a.vs,function(s,o){n.node(s).order=o}),klt(n,e,a.vs)})}function GP(r,t){Ds.forEach(t,function(e){Ds.forEach(e,function(n,i){r.node(n).order=i})})}var Ft=We,Plt=zi.Graph,Nlt=kr,Rlt={positionX:Glt};function Llt(r,t){var e={};function n(i,a){var s=0,o=0,l=i.length,u=Ft.last(a);return Ft.forEach(a,function(c,h){var d=Dlt(r,c),g=d?r.node(d).order:l;(d||c===u)&&(Ft.forEach(a.slice(o,h+1),function(p){Ft.forEach(r.predecessors(p),function(v){var m=r.node(v),b=m.order;(b<s||g<b)&&!(m.dummy&&r.node(p).dummy)&&i5(e,v,p)})}),o=h+1,s=g)}),a}return Ft.reduce(t,n),e}function Ilt(r,t){var e={};function n(a,s,o,l,u){var c;Ft.forEach(Ft.range(s,o),function(h){c=a[h],r.node(c).dummy&&Ft.forEach(r.predecessors(c),function(d){var g=r.node(d);g.dummy&&(g.order<l||g.order>u)&&i5(e,d,c)})})}function i(a,s){var o=-1,l,u=0;return Ft.forEach(s,function(c,h){if(r.node(c).dummy==="border"){var d=r.predecessors(c);d.length&&(l=r.node(d[0]).order,n(s,u,h,o,l),u=h,o=l)}n(s,u,s.length,l,a.length)}),s}return Ft.reduce(t,i),e}function Dlt(r,t){if(r.node(t).dummy)return Ft.find(r.predecessors(t),function(e){return r.node(e).dummy})}function i5(r,t,e){if(t>e){var n=t;t=e,e=n}var i=r[t];i||(r[t]=i={}),i[e]=!0}function Flt(r,t,e){if(t>e){var n=t;t=e,e=n}return Ft.has(r[t],e)}function Blt(r,t,e,n){var i={},a={},s={};return Ft.forEach(t,function(o){Ft.forEach(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),Ft.forEach(t,function(o){var l=-1;Ft.forEach(o,function(u){var c=n(u);if(c.length){c=Ft.sortBy(c,function(v){return s[v]});for(var h=(c.length-1)/2,d=Math.floor(h),g=Math.ceil(h);d<=g;++d){var p=c[d];a[u]===u&&l<s[p]&&!Flt(e,u,p)&&(a[p]=u,a[u]=i[u]=i[p],l=s[p])}}})}),{root:i,align:a}}function zlt(r,t,e,n,i){var a={},s=$lt(r,t,e,i),o=i?"borderLeft":"borderRight";function l(h,d){for(var g=s.nodes(),p=g.pop(),v={};p;)v[p]?h(p):(v[p]=!0,g.push(p),g=g.concat(d(p))),p=g.pop()}function u(h){a[h]=s.inEdges(h).reduce(function(d,g){return Math.max(d,a[g.v]+s.edge(g))},0)}function c(h){var d=s.outEdges(h).reduce(function(p,v){return Math.min(p,a[v.w]-s.edge(v))},Number.POSITIVE_INFINITY),g=r.node(h);d!==Number.POSITIVE_INFINITY&&g.borderType!==o&&(a[h]=Math.max(a[h],d))}return l(u,s.predecessors.bind(s)),l(c,s.successors.bind(s)),Ft.forEach(n,function(h){a[h]=a[e[h]]}),a}function $lt(r,t,e,n){var i=new Plt,a=r.graph(),s=Vlt(a.nodesep,a.edgesep,n);return Ft.forEach(t,function(o){var l;Ft.forEach(o,function(u){var c=e[u];if(i.setNode(c),l){var h=e[l],d=i.edge(h,c);i.setEdge(h,c,Math.max(s(r,u,l),d||0))}l=u})}),i}function jlt(r,t){return Ft.minBy(Ft.values(t),function(e){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Ft.forIn(e,function(a,s){var o=Hlt(r,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function qlt(r,t){var e=Ft.values(t),n=Ft.min(e),i=Ft.max(e);Ft.forEach(["u","d"],function(a){Ft.forEach(["l","r"],function(s){var o=a+s,l=r[o],u;if(l!==t){var c=Ft.values(l);u=s==="l"?n-Ft.min(c):i-Ft.max(c),u&&(r[o]=Ft.mapValues(l,function(h){return h+u}))}})})}function Wlt(r,t){return Ft.mapValues(r.ul,function(e,n){if(t)return r[t.toLowerCase()][n];var i=Ft.sortBy(Ft.map(r,n));return(i[1]+i[2])/2})}function Glt(r){var t=Nlt.buildLayerMatrix(r),e=Ft.merge(Llt(r,t),Ilt(r,t)),n={},i;Ft.forEach(["u","d"],function(s){i=s==="u"?t:Ft.values(t).reverse(),Ft.forEach(["l","r"],function(o){o==="r"&&(i=Ft.map(i,function(h){return Ft.values(h).reverse()}));var l=(s==="u"?r.predecessors:r.successors).bind(r),u=Blt(r,i,e,l),c=zlt(r,i,u.root,u.align,o==="r");o==="r"&&(c=Ft.mapValues(c,function(h){return-h})),n[s+o]=c})});var a=jlt(r,n);return qlt(n,a),Wlt(n,r.graph().align)}function Vlt(r,t,e){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,u;if(l+=s.width/2,Ft.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=e?u:-u),u=0,l+=(s.dummy?t:r)/2,l+=(o.dummy?t:r)/2,l+=o.width/2,Ft.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(l+=e?u:-u),u=0,l}}function Hlt(r,t){return r.node(t).width}var Ku=We,a5=kr,Ult=Rlt.positionX,Ylt=Xlt;function Xlt(r){r=a5.asNonCompoundGraph(r),Klt(r),Ku.forEach(Ult(r),function(t,e){r.node(e).x=t})}function Klt(r){var t=a5.buildLayerMatrix(r),e=r.graph().ranksep,n=0;Ku.forEach(t,function(i){var a=Ku.max(Ku.map(i,function(s){return r.node(s).height}));Ku.forEach(i,function(s){r.node(s).y=n+a/2}),n+=a+e})}var Jt=We,VP=$st,HP=rot,Zlt=Cot,Jlt=kr.normalizeRanks,Qlt=Pot,tut=kr.removeEmptyRanks,UP=Iot,eut=jot,YP=Wot,nut=Tlt,rut=Ylt,Ws=kr,iut=zi.Graph,aut=sut;function sut(r,t){var e=t&&t.debugTiming?Ws.time:Ws.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return mut(r)});e(" runLayout",function(){out(n,e)}),e(" updateInputGraph",function(){lut(r,n)})})}function out(r,t){t(" makeSpaceForEdgeLabels",function(){yut(r)}),t(" removeSelfEdges",function(){Cut(r)}),t(" acyclic",function(){VP.run(r)}),t(" nestingGraph.run",function(){UP.run(r)}),t(" rank",function(){Zlt(Ws.asNonCompoundGraph(r))}),t(" injectEdgeLabelProxies",function(){but(r)}),t(" removeEmptyRanks",function(){tut(r)}),t(" nestingGraph.cleanup",function(){UP.cleanup(r)}),t(" normalizeRanks",function(){Jlt(r)}),t(" assignRankMinMax",function(){wut(r)}),t(" removeEdgeLabelProxies",function(){xut(r)}),t(" normalize.run",function(){HP.run(r)}),t(" parentDummyChains",function(){Qlt(r)}),t(" addBorderSegments",function(){eut(r)}),t(" order",function(){nut(r)}),t(" insertSelfEdges",function(){Tut(r)}),t(" adjustCoordinateSystem",function(){YP.adjust(r)}),t(" position",function(){rut(r)}),t(" positionSelfEdges",function(){Out(r)}),t(" removeBorderNodes",function(){kut(r)}),t(" normalize.undo",function(){HP.undo(r)}),t(" fixupEdgeLabelCoords",function(){Sut(r)}),t(" undoCoordinateSystem",function(){YP.undo(r)}),t(" translateGraph",function(){Eut(r)}),t(" assignNodeIntersects",function(){_ut(r)}),t(" reversePoints",function(){Mut(r)}),t(" acyclic.undo",function(){VP.undo(r)})}function lut(r,t){Jt.forEach(r.nodes(),function(e){var n=r.node(e),i=t.node(e);n&&(n.x=i.x,n.y=i.y,t.children(e).length&&(n.width=i.width,n.height=i.height))}),Jt.forEach(r.edges(),function(e){var n=r.edge(e),i=t.edge(e);n.points=i.points,Jt.has(i,"x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=t.graph().width,r.graph().height=t.graph().height}var uut=["nodesep","edgesep","ranksep","marginx","marginy"],cut={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},hut=["acyclicer","ranker","rankdir","align"],dut=["width","height"],fut={width:0,height:0},gut=["minlen","weight","width","height","labeloffset"],put={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},vut=["labelpos"];function mut(r){var t=new iut({multigraph:!0,compound:!0}),e=Wb(r.graph());return t.setGraph(Jt.merge({},cut,qb(e,uut),Jt.pick(e,hut))),Jt.forEach(r.nodes(),function(n){var i=Wb(r.node(n));t.setNode(n,Jt.defaults(qb(i,dut),fut)),t.setParent(n,r.parent(n))}),Jt.forEach(r.edges(),function(n){var i=Wb(r.edge(n));t.setEdge(n,Jt.merge({},put,qb(i,gut),Jt.pick(i,vut)))}),t}function yut(r){var t=r.graph();t.ranksep/=2,Jt.forEach(r.edges(),function(e){var n=r.edge(e);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function but(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);if(e.width&&e.height){var n=r.node(t.v),i=r.node(t.w),a={rank:(i.rank-n.rank)/2+n.rank,e:t};Ws.addDummyNode(r,"edge-proxy",a,"_ep")}})}function wut(r){var t=0;Jt.forEach(r.nodes(),function(e){var n=r.node(e);n.borderTop&&(n.minRank=r.node(n.borderTop).rank,n.maxRank=r.node(n.borderBottom).rank,t=Jt.max(t,n.maxRank))}),r.graph().maxRank=t}function xut(r){Jt.forEach(r.nodes(),function(t){var e=r.node(t);e.dummy==="edge-proxy"&&(r.edge(e.e).labelRank=e.rank,r.removeNode(t))})}function Eut(r){var t=Number.POSITIVE_INFINITY,e=0,n=Number.POSITIVE_INFINITY,i=0,a=r.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var c=u.x,h=u.y,d=u.width,g=u.height;t=Math.min(t,c-d/2),e=Math.max(e,c+d/2),n=Math.min(n,h-g/2),i=Math.max(i,h+g/2)}Jt.forEach(r.nodes(),function(u){l(r.node(u))}),Jt.forEach(r.edges(),function(u){var c=r.edge(u);Jt.has(c,"x")&&l(c)}),t-=s,n-=o,Jt.forEach(r.nodes(),function(u){var c=r.node(u);c.x-=t,c.y-=n}),Jt.forEach(r.edges(),function(u){var c=r.edge(u);Jt.forEach(c.points,function(h){h.x-=t,h.y-=n}),Jt.has(c,"x")&&(c.x-=t),Jt.has(c,"y")&&(c.y-=n)}),a.width=e-t+s,a.height=i-n+o}function _ut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t),n=r.node(t.v),i=r.node(t.w),a,s;e.points?(a=e.points[0],s=e.points[e.points.length-1]):(e.points=[],a=i,s=n),e.points.unshift(Ws.intersectRect(n,a)),e.points.push(Ws.intersectRect(i,s))})}function Sut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);if(Jt.has(e,"x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})}function Mut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);e.reversed&&e.points.reverse()})}function kut(r){Jt.forEach(r.nodes(),function(t){if(r.children(t).length){var e=r.node(t),n=r.node(e.borderTop),i=r.node(e.borderBottom),a=r.node(Jt.last(e.borderLeft)),s=r.node(Jt.last(e.borderRight));e.width=Math.abs(s.x-a.x),e.height=Math.abs(i.y-n.y),e.x=a.x+e.width/2,e.y=n.y+e.height/2}}),Jt.forEach(r.nodes(),function(t){r.node(t).dummy==="border"&&r.removeNode(t)})}function Cut(r){Jt.forEach(r.edges(),function(t){if(t.v===t.w){var e=r.node(t.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:t,label:r.edge(t)}),r.removeEdge(t)}})}function Tut(r){var t=Ws.buildLayerMatrix(r);Jt.forEach(t,function(e){var n=0;Jt.forEach(e,function(i,a){var s=r.node(i);s.order=a+n,Jt.forEach(s.selfEdges,function(o){Ws.addDummyNode(r,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function Out(r){Jt.forEach(r.nodes(),function(t){var e=r.node(t);if(e.dummy==="selfedge"){var n=r.node(e.e.v),i=n.x+n.width/2,a=n.y,s=e.x-i,o=n.height/2;r.setEdge(e.e,e.label),r.removeNode(t),e.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],e.label.x=e.x,e.label.y=e.y}})}function qb(r,t){return Jt.mapValues(Jt.pick(r,t),Number)}function Wb(r){var t={};return Jt.forEach(r,function(e,n){t[n.toLowerCase()]=e}),t}var Rd=We,Aut=kr,Put=zi.Graph,Nut={debugOrdering:Rut};function Rut(r){var t=Aut.buildLayerMatrix(r),e=new Put({compound:!0,multigraph:!0}).setGraph({});return Rd.forEach(r.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+r.node(n).rank)}),Rd.forEach(r.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),Rd.forEach(t,function(n,i){var a="layer"+i;e.setNode(a,{rank:"same"}),Rd.reduce(n,function(s,o){return e.setEdge(s,o,{style:"invis"}),o})}),e}var Lut="0.8.5",s5={graphlib:zi,layout:aut,debug:Nut,util:{time:kr.time,notime:kr.notime},version:Lut};const Iut=i0(s5);class lg{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,lg.defaultOptions,t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new s5.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:u})=>yt(u))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(u=>{const{id:c}=u,h=Object.assign({},u.data);if(i!==void 0){const[d,g]=Gc(Et(i)?i(u):i);Object.assign(h,{width:d,height:g})}a.setNode(c.toString(),h)}),e.getAllEdges().forEach(({id:u,source:c,target:h})=>{a.setEdge(c.toString(),h.toString(),{id:u})}),Iut.layout(a);const l={nodes:[],edges:[]};return a.nodes().forEach(u=>{const c=a.node(u);l.nodes.push({id:u,data:c}),t&&e.mergeNodeData(u,c)}),a.edges().forEach(u=>{const c=a.edge(u),{id:h}=c,d=en(c,["id"]),{v:g,w:p}=u;l.edges.push({id:h,source:g,target:p,data:d}),t&&e.mergeEdgeData(h,d)}),l})}}lg.defaultOptions={};class FE{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let i=Math.hypot(e,n);i=i<1e-4?1e-4:i;const a=this.g*(this.degree+1)*(t.degree+1)/i;this.fx+=a*e/i,this.fy+=a*n/i}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,i=(this.ry*this.mass+t.ry*t.mass)/e,a=this.degree+t.degree,s={rx:n,ry:i,mass:e,degree:a};return new FE(s)}}class Rl{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Rl(i)}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Rl(i)}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Rl(i)}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Rl(i)}}class Ll{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,t!=null&&(this.quad=t)}insert(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new Ll(this.quad.NW()),this.NE=new Ll(this.quad.NE()),this.SW=new Ll(this.quad.SW()),this.SE=new Ll(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{const e=this.quad?this.quad.getLength():0,n=this.body.distanceTo(t);e/n<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}const Dut={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class Fut{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},Dut),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=e.getAllEdges(),a=e.getAllNodes(),s=this.formatOptions(n,a.length),{width:o,height:l,prune:u,maxIteration:c,nodeSize:h,center:d}=s;if(!(a!=null&&a.length)||a.length===1)return Uo(e,t,d);const g=a.map(b=>qr(b,[o,l])),p=i.filter(b=>{const{source:w,target:x}=b;return w!==x}),v=new kn({nodes:g,edges:p}),m=this.getSizes(v,h);if(this.run(v,e,c,m,t,s),u){for(let w=0;w<p.length;w+=1){const{source:x,target:S}=p[w],_=v.getDegree(x),k=v.getDegree(x);if(_<=1){const M=v.getNode(S);v.mergeNodeData(x,{x:M.data.x,y:M.data.y})}else if(k<=1){const M=v.getNode(x);v.mergeNodeData(S,{x:M.data.x,y:M.data.y})}}const b=Object.assign(Object.assign({},s),{prune:!1,barnesHut:!1});this.run(v,e,100,m,t,b)}return{nodes:g,edges:i}})}getSizes(t,e){const n=t.getAllNodes(),i={};for(let a=0;a<n.length;a+=1){const s=n[a];i[s.id]=dE(e,void 0)(s)}return i}formatOptions(t={},e){const n=Object.assign(Object.assign({},this.options),t),{center:i,width:a,height:s,barnesHut:o,prune:l,maxIteration:u,kr:c,kg:h}=n;return n.width=!a&&typeof window<"u"?window.innerWidth:a,n.height=!s&&typeof window<"u"?window.innerHeight:s,n.center=i||[n.width/2,n.height/2],o===void 0&&e>250&&(n.barnesHut=!0),l===void 0&&e>100&&(n.prune=!0),u===0&&!l?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):u===0&&l&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),h||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,i,a,s){const{kr:o,barnesHut:l,onTick:u}=s,c=t.getAllNodes();let h=0,d=n;const g={},p={},v={};for(let m=0;m<c.length;m+=1){const{data:b,id:w}=c[m];if(g[w]=[0,0],l){const x={id:m,rx:b.x,ry:b.y,mass:1,g:o,degree:t.getDegree(w)};v[w]=new FE(x)}}for(;d>0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:g,preForces:p,bodies:v,sizes:i},s),d--,u==null||u({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:l,bodies:u,sizes:c}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:g}=n,p=t.getAllNodes();for(let v=0;v<p.length;v+=1){const{id:m}=p[v];l[m]=[...h[m]],h[m]=[0,0]}return h=this.getAttrForces(t,i,a,c,h,n),g&&(d&&i>a||!d)?h=this.getOptRepGraForces(t,h,u,n):h=this.getRepGraForces(t,i,a,h,s,c,n),this.updatePos(t,h,l,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:l,mode:u,prune:c}=s,h=t.getAllEdges();for(let d=0;d<h.length;d+=1){const{source:g,target:p}=h[d],v=t.getNode(g),m=t.getNode(p),b=t.getDegree(g),w=t.getDegree(p);if(c&&(b<=1||w<=1))continue;const x=[m.data.x-v.data.x,m.data.y-v.data.y];let S=Math.hypot(x[0],x[1]);S=S<1e-4?1e-4:S,x[0]=x[0]/S,x[1]=x[1]/S,o&&e<n&&(S=S-i[g]-i[p]);let _=S,k=_;u==="linlog"&&(_=Math.log(1+S),k=_),l&&(_=S/b,k=S/w),o&&e<n&&S<=0?(_=0,k=0):o&&e<n&&S>0&&(_=S,k=S),a[g][0]+=_*x[0],a[p][0]-=k*x[0],a[g][1]+=_*x[1],a[p][1]-=k*x[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,l=t.getAllNodes(),u=l.length;let c=9e10,h=-9e10,d=9e10,g=-9e10;for(let w=0;w<u;w+=1){const{id:x,data:S}=l[w];o&&t.getDegree(x)<=1||(n[x].setPos(S.x,S.y),S.x>=h&&(h=S.x),S.x<=c&&(c=S.x),S.y>=g&&(g=S.y),S.y<=d&&(d=S.y))}const p=Math.max(h-c,g-d),v={xmid:(h+c)/2,ymid:(g+d)/2,length:p,massCenter:s,mass:u},m=new Rl(v),b=new Ll(m);for(let w=0;w<u;w+=1){const{id:x}=l[w];o&&t.getDegree(x)<=1||n[x].in(m)&&b.insert(n[x])}for(let w=0;w<u;w+=1){const{id:x,data:S}=l[w],_=t.getDegree(x);if(o&&_<=1)continue;n[x].resetForce(),b.updateForce(n[x]),e[x][0]-=n[x].fx,e[x][1]-=n[x].fy;const k=[S.x-s[0],S.y-s[1]];let M=Math.hypot(k[0],k[1]);M=M<1e-4?1e-4:M,k[0]=k[0]/M,k[1]=k[1]/M;const C=a*(_+1);e[x][0]-=C*k[0],e[x][1]-=C*k[1]}return e}getRepGraForces(t,e,n,i,a,s,o){const{preventOverlap:l,kr:u,kg:c,center:h,prune:d}=o,g=t.getAllNodes(),p=g.length;for(let v=0;v<p;v+=1){const m=g[v],b=t.getDegree(m.id);for(let _=v+1;_<p;_+=1){const k=g[_],M=t.getDegree(k.id);if(d&&(b<=1||M<=1))continue;const C=[k.data.x-m.data.x,k.data.y-m.data.y];let P=Math.hypot(C[0],C[1]);P=P<1e-4?1e-4:P,C[0]=C[0]/P,C[1]=C[1]/P,l&&e<n&&(P=P-s[m.id]-s[k.id]);let T=u*(b+1)*(M+1)/P;l&&e<n&&P<0?T=a*(b+1)*(M+1):l&&e<n&&P===0?T=0:l&&e<n&&P>0&&(T=u*(b+1)*(M+1)/P),i[m.id][0]-=T*C[0],i[k.id][0]+=T*C[0],i[m.id][1]-=T*C[1],i[k.id][1]+=T*C[1]}const w=[m.data.x-h[0],m.data.y-h[1]],x=Math.hypot(w[0],w[1]);w[0]=w[0]/x,w[1]=w[1]/x;const S=c*(b+1);i[m.id][0]-=S*w[0],i[m.id][1]-=S*w[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:l,ksmax:u}=a,c=t.getAllNodes(),h=c.length,d=[],g=[];let p=0,v=0,m=i;for(let w=0;w<h;w+=1){const{id:x}=c[w],S=t.getDegree(x);if(l&&S<=1)continue;const _=[e[x][0]-n[x][0],e[x][1]-n[x][1]],k=Math.hypot(_[0],_[1]),M=[e[x][0]+n[x][0],e[x][1]+n[x][1]],C=Math.hypot(M[0],M[1]);d[w]=k,g[w]=C/2,p+=(S+1)*d[w],v+=(S+1)*g[w]}const b=m;m=o*v/p,b!==0&&(m=m>1.5*b?1.5*b:m);for(let w=0;w<h;w+=1){const{id:x,data:S}=c[w],_=t.getDegree(x);if(l&&_<=1||yt(S.fx)&&yt(S.fy))continue;let k=s*m/(1+m*Math.sqrt(d[w])),M=Math.hypot(e[x][0],e[x][1]);M=M<1e-4?1e-4:M;const C=u/M;k=k>C?C:k;const P=k*e[x][0],T=k*e[x][1];t.mergeNodeData(x,{x:S.x+P,y:S.y+T})}return m}}const But={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},zut=800;class $ut{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},But),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;n<t;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericFruchtermanLayout(t,e,n){return Ht(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:l,clustering:u,nodeClusterBy:c,maxIteration:h,onTick:d}=i,g=e.getAllNodes(),p=e.getAllEdges();if(!(g!=null&&g.length)){const x={nodes:[],edges:p};return this.lastResult=x,x}if(g.length===1){t&&e.mergeNodeData(g[0].id,{x:l[0],y:l[1],z:a===3?l[2]:void 0});const x={nodes:[Object.assign(Object.assign({},g[0]),{data:Object.assign(Object.assign({},g[0].data),{x:l[0],y:l[1],z:a===3?l[2]:void 0})})],edges:p};return this.lastResult=x,x}const v=g.map(x=>qr(x,[s,o])),m=new kn({nodes:v,edges:p}),b={};if(u&&v.forEach(x=>{const S=x.data[c];b[S]||(b[S]={name:S,cx:0,cy:0,count:0})}),this.lastLayoutNodes=v,this.lastLayoutEdges=p,this.lastAssign=t,this.lastGraph=m,this.lastOptions=i,this.lastClusterMap=b,typeof window>"u")return;let w=0;return new Promise(x=>{this.timeInterval=window.setInterval(()=>{if(!this.running){x({nodes:v,edges:p});return}this.runOneStep(m,b,i),t&&v.forEach(({id:S,data:_})=>e.mergeNodeData(S,{x:_.x,y:_.y,z:a===3?_.z:void 0})),d==null||d({nodes:v,edges:p}),w++,w>=h&&(window.clearInterval(this.timeInterval),x({nodes:v,edges:p}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:i}=e,{center:a,width:s,height:o}=e;return e.width=!s&&typeof window<"u"?window.innerWidth:s,e.height=!o&&typeof window<"u"?window.innerHeight:o,e.center=a||[e.width/2,e.height/2],e.clustering=n&&!!i,e}runOneStep(t,e,n){const{dimensions:i,height:a,width:s,gravity:o,center:l,speed:u,clustering:c,nodeClusterBy:h,clusterGravity:d}=n,g=a*s,p=Math.sqrt(g)/10,v=t.getAllNodes(),m=g/(v.length+1),b=Math.sqrt(m),w={};if(this.applyCalculate(t,w,b,m),c){for(const S in e)e[S].cx=0,e[S].cy=0,e[S].count=0;v.forEach(S=>{const{data:_}=S,k=e[_[h]];yt(_.x)&&(k.cx+=_.x),yt(_.y)&&(k.cy+=_.y),k.count++});for(const S in e)e[S].cx/=e[S].count,e[S].cy/=e[S].count;const x=d||o;v.forEach((S,_)=>{const{id:k,data:M}=S;if(!yt(M.x)||!yt(M.y))return;const C=e[M[h]],P=Math.sqrt((M.x-C.cx)*(M.x-C.cx)+(M.y-C.cy)*(M.y-C.cy)),T=b*x;w[k].x-=T*(M.x-C.cx)/P,w[k].y-=T*(M.y-C.cy)/P})}v.forEach((x,S)=>{const{id:_,data:k}=x;if(!yt(k.x)||!yt(k.y))return;const M=.01*b*o;w[_].x-=M*(k.x-l[0]),w[_].y-=M*(k.y-l[1]),i===3&&(w[_].z-=M*(k.z-l[2]))}),v.forEach((x,S)=>{const{id:_,data:k}=x;if(yt(k.fx)&&yt(k.fy)){k.x=k.fx,k.y=k.fy,i===3&&(k.z=k.fz);return}if(!yt(k.x)||!yt(k.y))return;const M=Math.sqrt(w[_].x*w[_].x+w[_].y*w[_].y+(i===3?w[_].z*w[_].z:0));if(M>0){const C=Math.min(p*(u/zut),M);t.mergeNodeData(_,{x:k.x+w[_].x/M*C,y:k.y+w[_].y/M*C,z:i===3?k.z+w[_].z/M*C:void 0})}})}applyCalculate(t,e,n,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const i=t.getAllNodes();i.forEach(({data:a,id:s},o)=>{e[s]={x:0,y:0,z:0},i.forEach(({data:l,id:u},c)=>{if(o<=c||!yt(a.x)||!yt(l.x)||!yt(a.y)||!yt(l.y))return;let h=a.x-l.x,d=a.y-l.y,g=this.options.dimensions===3?a.z-l.z:0,p=h*h+d*d+g*g;p===0&&(p=1,h=.01,d=.01,g=.01);const v=n/p,m=h*v,b=d*v,w=g*v;e[s].x+=m,e[s].y+=b,e[u].x-=m,e[u].y-=b,this.options.dimensions===3&&(e[s].z+=w,e[u].z-=w)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:l}=t.getNode(s),{data:u}=t.getNode(o);if(!yt(u.x)||!yt(l.x)||!yt(u.y)||!yt(l.y))return;const c=u.x-l.x,h=u.y-l.y,d=this.options.dimensions===3?u.z-l.z:0,g=Math.sqrt(c*c+h*h+d*d)/n,p=c*g,v=h*g,m=d*g;e[s].x+=p,e[s].y+=v,e[o].x-=p,e[o].y-=v,this.options.dimensions===3&&(e[s].z+=m,e[o].z-=m)})}}const jut={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class qut{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},jut),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:l,rows:u,cols:c,nodeSpacing:h,nodeSize:d,width:g,height:p,position:v}=i;let{sortBy:m}=i;const b=e.getAllNodes(),w=e.getAllEdges(),x=b==null?void 0:b.length;if(!x||x===1)return Uo(e,t,a);const S=b.map(q=>qr(q));m!=="id"&&(!se(m)||S[0].data[m]===void 0)&&(m="degree"),m==="degree"?S.sort((q,j)=>e.getDegree(j.id,"both")-e.getDegree(q.id,"both")):m==="id"?S.sort((q,j)=>yt(j.id)&&yt(q.id)?j.id-q.id:`${q.id}`.localeCompare(`${j.id}`)):S.sort((q,j)=>j.data[m]-q.data[m]);const _=!g&&typeof window<"u"?window.innerWidth:g,k=!p&&typeof window<"u"?window.innerHeight:p,M=x,C={rows:u,cols:c};if(u!=null&&c!=null)C.rows=u,C.cols=c;else if(u!=null&&c==null)C.rows=u,C.cols=Math.ceil(M/C.rows);else if(u==null&&c!=null)C.cols=c,C.rows=Math.ceil(M/C.cols);else{const q=Math.sqrt(M*k/_);C.rows=Math.round(q),C.cols=Math.round(_/k*q)}if(C.rows=Math.max(C.rows,1),C.cols=Math.max(C.cols,1),C.cols*C.rows>M){const q=Ld(C),j=Id(C);(q-1)*j>=M?Ld(C,q-1):(j-1)*q>=M&&Id(C,j-1)}else for(;C.cols*C.rows<M;){const q=Ld(C),j=Id(C);(j+1)*q>=M?Id(C,j+1):Ld(C,q+1)}let P=s?0:_/C.cols,T=s?0:k/C.rows;if(l||h){const q=Ao(10,h),j=hE(30,d,!1);S.forEach(B=>{(!B.data.x||!B.data.y)&&(B.data.x=0,B.data.y=0);const F=e.getNode(B.id),[V,X]=Gc(j(F)||30),K=q!==void 0?q(B):o,nt=V+K,ot=X+K;P=Math.max(P,nt),T=Math.max(T,ot)})}const A={},R={row:0,col:0},L={};for(let q=0;q<S.length;q++){const j=S[q];let B;if(v&&(B=v(e.getNode(j.id))),B&&(B.row!==void 0||B.col!==void 0)){const F={row:B.row,col:B.col};if(F.col===void 0)for(F.col=0;lx(A,F);)F.col++;else if(F.row===void 0)for(F.row=0;lx(A,F);)F.row++;L[j.id]=F,o5(A,F)}Wut(j,a,P,T,L,C,R,A)}const $={nodes:S,edges:w};return t&&S.forEach(q=>{e.mergeNodeData(q.id,{x:q.data.x,y:q.data.y})}),$})}}const Ld=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.min(n,i):Math.min(n,i)===r.rows?r.rows=t:r.cols=t,e},Id=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.max(n,i):Math.max(n,i)===r.rows?r.rows=t:r.cols=t,e},lx=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,o5=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,XP=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},Wut=(r,t,e,n,i,a,s,o)=>{let l,u;const c=i[r.id];if(c)l=c.col*e+e/2+t[0],u=c.row*n+n/2+t[1];else{for(;lx(o,s);)XP(a,s);l=s.col*e+e/2+t[0],u=s.row*n+n/2+t[1],o5(o,s),XP(a,s)}r.data.x=l,r.data.y=u},Gut=(r,t,e)=>{try{const n=Ts.mul(Ts.pow(t,2),-.5),i=n.mean("row"),a=n.mean("column"),s=n.mean();n.add(s).subRowVector(i).subColumnVector(a);const o=new BI(n),l=Ts.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(u=>Ts.mul([u],[l]).toJSON()[0].splice(0,r))}catch{const i=[];for(let a=0;a<t.length;a++){const s=Math.random()*e,o=Math.random()*e;i.push([s,o])}return i}},Vut=800,Hut={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Uut=(r,t)=>{const e=Object.assign(Object.assign({},Hut),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:l,focusIdx:u,radii:c=[],nodeSizeFunc:h}=e,d=r.getAllNodes(),g=[],p=a/10;for(let v=0;v<i;v++)n.forEach((m,b)=>{g[b]={x:0,y:0}}),Yut(d,n,g,s,c,h),Xut(n,g,o,l,u,p,a,c);return n},Yut=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((l,u)=>{if(o===u||i[o]!==i[u])return;let c=s.x-l.x,h=s.y-l.y,d=Math.sqrt(c*c+h*h);if(d===0){d=1;const g=o>u?1:-1;c=.01*g,h=.01*g}if(d<a(r[o])/2+a(r[u])/2){const g=n*n/d;e[o].x+=c/d*g,e[o].y+=h/d*g}})})},Xut=(r,t,e,n,i,a,s,o)=>{const l=a||s/10;return n&&t.forEach((u,c)=>{const h=r[c].x-r[i].x,d=r[c].y-r[i].y,g=Math.sqrt(h*h+d*d);let p=d/g,v=-h/g;const m=Math.sqrt(u.x*u.x+u.y*u.y);let b=Math.acos((p*u.x+v*u.y)/m);b>Math.PI/2&&(b-=Math.PI/2,p*=-1,v*=-1);const w=Math.cos(b)*m;u.x=p*w,u.y=v*w}),r.forEach((u,c)=>{if(c===i)return;const h=Math.sqrt(t[c].x*t[c].x+t[c].y*t[c].y);if(h>0&&c!==i){const d=Math.min(l*(e/Vut),h);if(u.x+=t[c].x/h*d,u.y+=t[c].y/h*d,n){let g=u.x-r[i].x,p=u.y-r[i].y;const v=Math.sqrt(g*g+p*p);g=g/v*o[c],p=p/v*o[c],u.x=r[i].x+g,u.y=r[i].y+p}}}),r},Kut={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class Zut{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},Kut),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:l,unitRadius:u,nodeSize:c,nodeSpacing:h,strictRadial:d,preventOverlap:g,maxPreventOverlapIteration:p,sortBy:v,linkDistance:m=50,sortStrength:b=10,maxIteration:w=1e3}=i,x=e.getAllNodes(),S=e.getAllEdges(),_=!a&&typeof window<"u"?window.innerWidth:a,k=!s&&typeof window<"u"?window.innerHeight:s,M=o||[_/2,k/2];if(!(x!=null&&x.length)||x.length===1)return Uo(e,t,M);let C=x[0];if(se(l)){for(let wt=0;wt<x.length;wt++)if(x[wt].id===l){C=x[wt];break}}else C=l||x[0];const P=tct(x,C.id),T=MI({nodes:x,edges:S}),A=SI(T),R=nct(A,P);ect(A,P,R+1);const L=A[P];let $=_-M[0]>M[0]?M[0]:_-M[0],q=k-M[1]>M[1]?M[1]:k-M[1];$===0&&($=_/2),q===0&&(q=k/2);const j=Math.min($,q),B=Math.max(...L),F=[],V=u||j/B;L.forEach((wt,zt)=>{F[zt]=wt*V});const X=Jut(x,A,m,F,V,v,b),K=Qut(X),nt=Gut(m,X,m);let ot=nt.map(([wt,zt])=>({x:(isNaN(wt)?Math.random()*m:wt)-nt[P][0],y:(isNaN(zt)?Math.random()*m:zt)-nt[P][1]}));this.run(w,ot,K,X,F,P);let ct;if(g){ct=dE(c,h);const wt={nodes:x,nodeSizeFunc:ct,positions:ot,radii:F,height:k,width:_,strictRadial:!!d,focusIdx:P,iterations:p||200,k:ot.length/4.5};ot=Uut(e,wt)}const ht=[];return ot.forEach((wt,zt)=>{const Wt=qr(x[zt]);Wt.data.x=wt.x+M[0],Wt.data.y=wt.y+M[1],ht.push(Wt)}),t&&ht.forEach(wt=>e.mergeNodeData(wt.id,{x:wt.data.x,y:wt.data.y})),{nodes:ht,edges:S}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const l=o/t;this.oneIteration(l,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((l,u)=>{const c=Ak(l,{x:0,y:0}),h=c===0?0:1/c;if(u===s)return;let d=0,g=0,p=0;e.forEach((m,b)=>{if(u===b)return;const w=Ak(l,m),x=w===0?0:1/w,S=i[b][u];p+=a[u][b],d+=a[u][b]*(m.x+S*(l.x-m.x)*x),g+=a[u][b]*(m.y+S*(l.y-m.y)*x)});const v=n[u]===0?0:1/n[u];p*=o,p+=t*v*v,d*=o,d+=t*v*l.x*h,l.x=d/p,g*=o,g+=t*v*l.y*h,l.y=g/p})}}const Jut=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const l={};t.forEach((u,c)=>{const h=[];u.forEach((d,g)=>{var p,v;if(c===g)h.push(0);else if(n[c]===n[g])if(a==="data")h.push(d*(Math.abs(c-g)*s)/(n[c]/i));else if(a){let m,b;if(l[r[c].id])m=l[r[c].id];else{const w=(a==="id"?r[c].id:(p=r[c].data)===null||p===void 0?void 0:p[a])||0;se(w)?m=w.charCodeAt(0):m=w,l[r[c].id]=m}if(l[r[g].id])b=l[r[g].id];else{const w=(a==="id"?r[g].id:(v=r[g].data)===null||v===void 0?void 0:v[a])||0;se(w)?b=w.charCodeAt(0):b=w,l[r[g].id]=b}h.push(d*(Math.abs(m-b)*s)/(n[c]/i))}else h.push(d*e/(n[c]/i));else{const m=(e+i)/2;h.push(d*m)}}),o.push(h)})}return o},Qut=r=>{const t=r.length,e=r[0].length,n=[];for(let i=0;i<t;i++){const a=[];for(let s=0;s<e;s++)r[i][s]!==0?a.push(1/(r[i][s]*r[i][s])):a.push(0);n.push(a)}return n},tct=(r,t)=>{let e=-1;return r.forEach((n,i)=>{n.id===t&&(e=i)}),Math.max(e,0)},ect=(r,t,e)=>{const n=r.length;for(let i=0;i<n;i++)if(r[t][i]===1/0){r[t][i]=e,r[i][t]=e;for(let a=0;a<n;a++)r[i][a]!==1/0&&r[t][a]===1/0&&(r[t][a]=e+r[i][a],r[a][t]=e+r[i][a])}for(let i=0;i<n;i++)if(i!==t){for(let a=0;a<n;a++)if(r[i][a]===1/0){let s=Math.abs(r[t][i]-r[t][a]);s=s===0?1:s,r[i][a]=s}}},nct=(r,t)=>{let e=0;for(let n=0;n<r[t].length;n++)r[t][n]!==1/0&&(e=r[t][n]>e?r[t][n]:e);return e},rct={center:[0,0],width:300,height:300};class ict{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},rct),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,l=e.getAllNodes(),u=.9,c=!s&&typeof window<"u"?window.innerWidth:s,h=!o&&typeof window<"u"?window.innerHeight:o,d=a||[c/2,h/2],g=[];return l&&l.forEach(v=>{g.push({id:v.id,data:{x:(Math.random()-.5)*u*c+d[0],y:(Math.random()-.5)*u*h+d[1]}})}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:e.getAllEdges()}})}}/**
- * @license
- * Copyright 2019 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */const l5=Symbol("Comlink.proxy"),act=Symbol("Comlink.endpoint"),u5=Symbol("Comlink.releaseProxy"),Gb=Symbol("Comlink.finalizer"),af=Symbol("Comlink.thrown"),c5=r=>typeof r=="object"&&r!==null||typeof r=="function",sct={canHandle:r=>c5(r)&&r[l5],serialize(r){const{port1:t,port2:e}=new MessageChannel;return d5(r,t),[e,[e]]},deserialize(r){return r.start(),g5(r)}},oct={canHandle:r=>c5(r)&&af in r,serialize({value:r}){let t;return r instanceof Error?t={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:t={isError:!1,value:r},[t,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},h5=new Map([["proxy",sct],["throw",oct]]);function lct(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function d5(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!lct(e,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(bo);let u;try{const c=o.slice(0,-1).reduce((d,g)=>d[g],r),h=o.reduce((d,g)=>d[g],r);switch(s){case"GET":u=h;break;case"SET":c[o.slice(-1)[0]]=bo(i.data.value),u=!0;break;case"APPLY":u=h.apply(c,l);break;case"CONSTRUCT":{const d=new h(...l);u=gct(d)}break;case"ENDPOINT":{const{port1:d,port2:g}=new MessageChannel;d5(r,g),u=fct(d,[d])}break;case"RELEASE":u=void 0;break;default:return}}catch(c){u={value:c,[af]:0}}Promise.resolve(u).catch(c=>({value:c,[af]:0})).then(c=>{const[h,d]=Uf(c);t.postMessage(Object.assign(Object.assign({},h),{id:a}),d),s==="RELEASE"&&(t.removeEventListener("message",n),f5(t),Gb in r&&typeof r[Gb]=="function"&&r[Gb]())}).catch(c=>{const[h,d]=Uf({value:new TypeError("Unserializable return value"),[af]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),d)})}),t.start&&t.start()}function uct(r){return r.constructor.name==="MessagePort"}function f5(r){uct(r)&&r.close()}function g5(r,t){const e=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=e.get(a.id);if(s)try{s(a)}finally{e.delete(a.id)}}),ux(r,e,[],t)}function Dd(r){if(r)throw new Error("Proxy has been released and is not useable")}function p5(r){return Al(r,new Map,{type:"RELEASE"}).then(()=>{f5(r)})}const Vf=new WeakMap,Hf="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(Vf.get(r)||0)-1;Vf.set(r,t),t===0&&p5(r)});function cct(r,t){const e=(Vf.get(t)||0)+1;Vf.set(t,e),Hf&&Hf.register(r,t,r)}function hct(r){Hf&&Hf.unregister(r)}function ux(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(Dd(i),o===u5)return()=>{hct(a),p5(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const l=Al(r,t,{type:"GET",path:e.map(u=>u.toString())}).then(bo);return l.then.bind(l)}return ux(r,t,[...e,o])},set(s,o,l){Dd(i);const[u,c]=Uf(l);return Al(r,t,{type:"SET",path:[...e,o].map(h=>h.toString()),value:u},c).then(bo)},apply(s,o,l){Dd(i);const u=e[e.length-1];if(u===act)return Al(r,t,{type:"ENDPOINT"}).then(bo);if(u==="bind")return ux(r,t,e.slice(0,-1));const[c,h]=KP(l);return Al(r,t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:c},h).then(bo)},construct(s,o){Dd(i);const[l,u]=KP(o);return Al(r,t,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:l},u).then(bo)}});return cct(a,r),a}function dct(r){return Array.prototype.concat.apply([],r)}function KP(r){const t=r.map(Uf);return[t.map(e=>e[0]),dct(t.map(e=>e[1]))]}const v5=new WeakMap;function fct(r,t){return v5.set(r,t),r}function gct(r){return Object.assign(r,{[l5]:!0})}function Uf(r){for(const[t,e]of h5)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},v5.get(r)||[]]}function bo(r){switch(r.type){case"HANDLER":return h5.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Al(r,t,e,n){return new Promise(i=>{const a=pct();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function pct(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class vct extends O0{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=g5(new Worker(new URL("/assets/worker-oDIEKZfz.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return Ht(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,i=en(e,["onTick"]),a={};Object.keys(i).forEach(u=>{Et(i[u])||(a[u]=i[u])});const s={layout:{id:this.layout.id,options:a,iterations:(t=this.options)===null||t===void 0?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[l]=yield this.proxy.calculateLayout(s,[o]);return l})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[u5]()}isRunning(){return this.running}}var mct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class ug extends A0{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Ji(t)||t.length>2))return t[0]}formatSize(t){const e=typeof t=="function"?t:()=>t;return n=>Vr(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:l}=this.context,u=this.formatSize(s);let c=u(t)[0]+i(t);const h=(x,S=0)=>{var _;return S+=n*((x.children||[]).length+1),(_=x.children)===null||_===void 0||_.forEach(k=>{var M;(M=l.getNodeLikeDatum(k).children)===null||M===void 0||M.forEach(P=>{const T=l.getNodeLikeDatum(P);S=h(T,S)})}),S},d=x=>{if(x.depth===1)return c;const S=l.getParentData(x.id,"tree");if(wl(x)){const _=l.getParentData(S.id,"tree"),k=v(x)-v(_);return d(S)+k*n/a}else{const _=(S.children||[]).indexOf(x.id),k=l.getNodeData((S.children||[]).slice(_));return g(S)-k.reduce((M,C)=>M+h(C),0)-u(S)[0]/2}},g=dw(x=>{if(Vb(x))return u(x)[0]/2;const S=l.getParentData(x.id,"tree");if(wl(x))return d(x)+h(x)+u(x)[0]/2;{const _=v(x)-v(S),k=n/a;return d(x)+_*k}},x=>x.id),p=x=>v(l.getParentData(x,"tree")),v=dw(x=>{if(Vb(x))return o/2;if(wl(x)){const S=l.getParentData(x.id,"tree"),_=S.children.indexOf(x.id);if(_===0)return p(S.id)+a;const k=l.getNodeLikeDatum(S.children[_-1]);if(Ji(k.children))return v(k)+a;const M=l.getDescendantsData(k.id);return Math.max(...M.map(C=>wl(C)?p(C.id):v(C)))+a}else{if(Ji(x.children))return p(x.id)+a;const S=l.getNodeLikeDatum(x.children.slice(-1)[0]);if(Ji(S.children))return v(S)+a;const _=l.getDescendantsData(x.id).slice(-1)[0];return(wl(_)?p(_.id):v(_))+a}},x=>x.id);let m=0;const b={nodes:[],edges:[]},w=x=>{var S;(S=x.children)===null||S===void 0||S.forEach(P=>w(l.getNodeLikeDatum(P)));const _=v(x),k=g(x);if(b.nodes.push({id:x.id,x:k,y:_}),Vb(x))return;const M=l.getRelatedEdgesData(x.id,"in")[0],C=[d(x),wl(x)?_:p(x.id)];b.edges.push({id:H(M),controlPoints:[C],relatedNodeId:x.id}),m=Math.max(m,k+i(x)),x.depth===1&&(c=m)};return w(t),b}placeAlterative(t,e){const n=(e.children||[]).filter((o,l)=>l%2!==0);if(n.length===0)return t;const{model:i}=this.context,a=t.nodes.find(o=>o.id===e.id).y,s=o=>{const l=i.getAncestorsData(o,"tree");if(Ji(l))return!1;const u=l.length===1?o:l[l.length-2].id;return n.includes(u)};t.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),t.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(l=>[l[0],2*a-l[1]]))})}rightToLeft(t,e){return t.nodes.forEach(n=>n.x=e.width-n.x),t.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[e.width-i[0],i[1]])}),t}execute(t,e){return mct(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},ug.defaultOptions),this.options),e),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return t;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(d=>o(d)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(d=>o(d)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:u}=this.context,c=[],h=[];return l.nodes.forEach(d=>{const{id:g,x:p,y:v}=d,m=u.getNodeLikeDatum(g);c.push(ZP(m,{x:p,y:v}))}),l.edges.forEach(d=>{const{id:g,controlPoints:p}=d,v=u.getEdgeDatum(g);h.push(ZP(v,{controlPoints:p}))}),{nodes:c,edges:h}})}}ug.defaultOptions={direction:"RL",getRibSep:()=>60};const ZP=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),Vb=r=>r.depth===0,wl=r=>(r.depth||(r.depth=0))%2===0;var yct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class cg extends A0{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=Vr(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,i={},a={},s={};e.forEach(d=>{i[d.id]=0,a[d.id]=0,s[d.id]=[]}),n.forEach(d=>{i[d.target]++,a[d.source]++,s[d.source].push(d.target)});const o=new Set,l=d=>{o.has(d)||(o.add(d),s[d].forEach(l))};if(l(e[0].id),o.size!==e.length)return!1;const u=e.filter(d=>i[d.id]===0),c=e.filter(d=>a[d.id]===0);return!(u.length!==1||c.length!==1||e.filter(d=>i[d.id]===1&&a[d.id]===1).length!==e.length-2)}execute(t,e){return yct(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:u,clockwise:c,width:h,height:d}=Object.assign({},cg.defaultOptions,this.options,e),[g,p,v,m]=ua(a),b=this.formatSize(t.nodes||[],i),w=Math.ceil((t.nodes||[]).length/o);let x=l||(h-m-p-o*b[0])/(o-1),S=u||(d-g-v-w*b[1])/(w-1);return(S===1/0||S<0)&&(S=0),(x===1/0||x<0)&&(x=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):bct(t))||[]).map((M,C)=>{const P=Math.floor(C/o),T=C%o,A=c?P%2===0?T:o-1-T:P%2===0?o-1-T:T,R=m+A*(b[0]+x)+b[0]/2,L=g+P*(b[1]+S)+b[1]/2;return{id:M.id,style:{x:R,y:L}}})}})}}cg.defaultOptions={padding:0,cols:5,clockwise:!0};function bct(r){const{nodes:t=[],edges:e=[]}=r,n={},i={};t.forEach(o=>{n[o.id]=0,i[o.id]=[]}),e.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(t.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),l=t.find(u=>u.id===o);s.push(l),i[o].forEach(u=>{n[u]--,n[u]===0&&a.push(u)})}return s}const wct=["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)"],xct=["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)"],Ect=["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)"],_ct=["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)"],Sct=["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)"];class Vn extends Xx{}function ou(r,t=!0,e){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),t&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),e&&Object.assign(n.style,e),n}function cx(r,t="div",e={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(t);return s.innerHTML=n,s.id=r,Object.assign(s.style,e),i.appendChild(s),s}var Mct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class hg extends Vn{constructor(t,e){super(t,Object.assign({},hg.defaultOptions,e)),this.$element=ou("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Mct(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Px(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}hg.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function BE(r,t,e,n,i,a){const s=r,o=t,l=e-s,u=n-o;let c=i-s,h=a-o,d=c*l+h*u,g=0;d<=0?g=0:(c=l-c,h=u-h,d=c*l+h*u,d<=0?g=0:g=d*d/(l*l+u*u));const p=c*c+h*h-g;return p<0?0:p}function As(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function JP(r,t,e,n,i){return As(r,t,e,n)<i*i}function kct(r){if(!Number.isFinite(r))return e=>e;if(r===0)return Math.round;const t=Math.pow(10,r);return e=>Math.round(e*t)/t}function m5(r){const t=Math.min(r.x1,r.x2),e=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:t,y:n,x2:e,y2:i,width:e-t,height:i-n}}class Pn{constructor(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i}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 Pn(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2||e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2||t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;const n=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return t<=n}distSquare(t,e){return BE(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 Qe;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Qe||(Qe={}));class Hb{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function Fd(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new Hb(Qe.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Hb(Qe.NONE)}return new Hb(e===0||n===0?Qe.COINCIDENT:Qe.PARALLEL)}function y5(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function Cct(r,t){function e(i,a,s,o){let l=y5(t,new Pn(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=1?1:0}let n=e(r.x,r.y,r.x2,r.y);return n+=e(r.x,r.y,r.x,r.y2),n>1||(n+=e(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=e(r.x2,r.y,r.x2,r.y2),n>0)}var tn;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(tn||(tn={}));function sf(r,t,e){const n=new Set;return r.width<=0?(n.add(tn.LEFT),n.add(tn.RIGHT)):t<r.x?n.add(tn.LEFT):t>r.x+r.width&&n.add(tn.RIGHT),r.height<=0?(n.add(tn.TOP),n.add(tn.BOTTOM)):e<r.y?n.add(tn.TOP):e>r.y+r.height&&n.add(tn.BOTTOM),n}function b5(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(sf(r,i,a));if(s.length===0)return!0;let o=sf(r,e,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(tn.RIGHT)||o.has(tn.LEFT)){let l=r.x;o.has(tn.RIGHT)&&(l+=r.width),n=n+(l-e)*(a-n)/(i-e),e=l}else{let l=r.y;o.has(tn.BOTTOM)&&(l+=r.height),e=e+(l-n)*(i-e)/(a-n),n=l}o=sf(r,e,n)}return!0}function Tct(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let u=y5(t,new Pn(a,s,o,l));u=Math.abs(u-.5),u>=0&&u<=1&&(n++,u<e&&(e=u))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?e:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:e)}function Oct(r,t){let e=0;const n=Fd(r,new Pn(t.x,t.y,t.x2,t.y));e+=n.state===Qe.POINT?1:0;const i=Fd(r,new Pn(t.x,t.y,t.x,t.y2));e+=i.state===Qe.POINT?1:0;const a=Fd(r,new Pn(t.x,t.y2,t.x2,t.y2));e+=a.state===Qe.POINT?1:0;const s=Fd(r,new Pn(t.x2,t.y,t.x2,t.y2));return e+=s.state===Qe.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Kn{constructor(t,e,n,i){this.x=t,this.y=e,this.width=n,this.height=i}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 Kn(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 Kn(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),i=Math.max(this.x2,t.x+t.width),a=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=i-e,this.height=a-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x),a=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=i-e,this.height=a-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?!1: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=sf(this,t,e);return n.has(tn.TOP)?n.has(tn.LEFT)?As(t,e,this.x,this.y):n.has(tn.RIGHT)?As(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(tn.BOTTOM)?n.has(tn.LEFT)?As(t,e,this.x,this.y2):n.has(tn.RIGHT)?As(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(tn.LEFT)?(this.x-t)*(this.x-t):n.has(tn.RIGHT)?(t-this.x2)*(t-this.x2):0}}function Act(r){if(r.length===0)return null;const t=r[0],e=new Kn(t.x,t.y,0,0);for(const n of r)e.addPoint(n);return e}class Yf{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 this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(t){return new Yf(t.cx,t.cy,t.radius)}containsPt(t,e){return As(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=As(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const i=Math.sqrt(n)-this.radius;return i*i}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class No{constructor(t,e=0,n=0,i=0,a=0,s=10,o=10,l=new Float32Array(Math.max(0,s*o)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=i,this.pixelY=a,this.width=s,this.height=o,this.area=l}createSub(t,e){return new No(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new No(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new No(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),i=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup)),s=i-e,o=a-n;return new Kn(e,n,s,o)}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),i=this.boundX(t.x-n),a=this.boundY(t.y-n),s=this.boundX(t.x2+n),o=this.boundY(t.y2+n),l=s-i,u=o-a;return new Kn(i,a,l,u)}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||e===0)return;const n=this.width,i=t.width,a=Math.max(0,t.i),s=Math.max(0,t.j),o=Math.min(t.i+t.width,n),l=Math.min(t.j+t.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let u=s;u<l;u++){const c=(u-t.j)*i,h=u*n;for(let d=a;d<o;d++){const g=t.area[d-t.i+c];g!==0&&(this.area[d+h]+=e*g)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let i=0;i<t.height;i++){const a=n+i*this.width;this.area.fill(e,a,a+t.width)}}fillHorizontalLine(t,e,n,i){const a=t+e*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(t,e,n,i){const a=t+e*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];t+=a.toFixed(1).padStart(6),t+=" "}t+=`
- `}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((s,o)=>Math.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);t.scale(this.pixelGroup,this.pixelGroup);for(let s=0;s<this.width;s++)for(let o=0;o<this.height;o++){const l=this.area[s+o*this.width];t.fillStyle=`rgba(0, 0, 0, ${a(l)})`,t.fillRect(s,o,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 i=0;i<this.width;i++)for(let a=0;a<this.height;a++){const s=this.area[i+a*this.width];t.fillStyle=s>e?"black":"white",t.fillRect(i,a,1,1)}t.restore()}}}function w5(r,t){const e=n=>({x:n.x-t,y:n.y-t,width:n.width+2*t,height:n.height+2*t});return Array.isArray(r)?r.map(e):e(r)}function QP(r,t,e){return x5(Object.assign(m5(r),{distSquare:(n,i)=>BE(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function x5(r,t,e){const n=w5(r,e),i=t.scale(n),a=t.createSub(i,n);return Pct(a,t,e,(s,o)=>r.distSquare(s,o)),a}function Pct(r,t,e,n){const i=e*e;for(let a=0;a<r.height;a++)for(let s=0;s<r.width;s++){const o=t.invertScaleX(r.i+s),l=t.invertScaleY(r.j+a),u=n(o,l);if(u===0){r.set(s,a,i);continue}if(u<i){const c=e-Math.sqrt(u);r.set(s,a,c*c)}}return r}function Nct(r,t,e){const n=t.scale(r),i=t.addPadding(n,e),a=t.createSub(i,{x:r.x-e,y:r.y-e}),s=n.x-i.x,o=n.y-i.y,l=i.x2-n.x2,u=i.y2-n.y2,c=i.width-s-l,h=i.height-o-u,d=e*e;a.fillArea({x:s,y:o,width:c+1,height:h+1},d);const g=[0],p=Math.max(o,s,l,u);{const w=t.invertScaleX(n.x+n.width/2);for(let x=1;x<p;x++){const S=t.invertScaleY(n.y-x),_=r.distSquare(w,S);if(_<d){const k=e-Math.sqrt(_);g.push(k*k)}else break}}const v=[],m=Math.max(s,l),b=Math.max(o,l);for(let w=1;w<m;w++){const x=t.invertScaleX(n.x-w),S=[];for(let _=1;_<b;_++){const k=t.invertScaleY(n.y-_),M=r.distSquare(x,k);if(M<d){const C=e-Math.sqrt(M);S.push(C*C)}else S.push(0)}v.push(S)}for(let w=1;w<Math.min(o,g.length);w++){const x=g[w];a.fillHorizontalLine(s,o-w,c+1,x)}for(let w=1;w<Math.min(u,g.length);w++){const x=g[w];a.fillHorizontalLine(s,o+h+w,c+1,x)}for(let w=1;w<Math.min(s,g.length);w++){const x=g[w];a.fillVerticalLine(s-w,o,h+1,x)}for(let w=1;w<Math.min(u,g.length);w++){const x=g[w];a.fillVerticalLine(s+c+w,o,h+1,x)}for(let w=1;w<s;w++){const x=v[w-1],S=s-w;for(let _=1;_<o;_++)a.set(S,o-_,x[_-1]);for(let _=1;_<u;_++)a.set(S,o+h+_,x[_-1])}for(let w=1;w<l;w++){const x=v[w-1],S=s+c+w;for(let _=1;_<o;_++)a.set(S,o-_,x[_-1]);for(let _=1;_<u;_++)a.set(S,o+h+_,x[_-1])}return a}function Ie(r,t){return{x:r,y:t}}function Rct(r,t,e,n){if(r.length===0)return[];const i=Bct(r);return i.map((a,s)=>{const o=i.slice(0,s);return Lct(t,a,o,e,n)}).flat()}function Lct(r,t,e,n,i){const a=Ie(t.cx,t.cy),s=Fct(a,e,r);if(s==null)return[];const o=new Pn(a.x,a.y,s.cx,s.cy),l=Ict(o,r,n,i);return Dct(l,r)}function Ict(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o<e&&s;o++)for(s=!1;!s&&a.length>0;){const l=a.pop(),u=E5(t,l),c=u?Oct(l,u):null;if(!u||!c||c.count!==2){s||i.push(l);continue}let h=n,d=zd(u,h,c,!0),g=fs(d,a)||fs(d,i),p=Bd(d,t);for(;!g&&p&&h>=1;)h/=1.5,d=zd(u,h,c,!0),g=fs(d,a)||fs(d,i),p=Bd(d,t);if(d&&!g&&!p&&(a.push(new Pn(l.x1,l.y1,d.x,d.y)),a.push(new Pn(d.x,d.y,l.x2,l.y2)),s=!0),s)continue;h=n,d=zd(u,h,c,!1);let v=fs(d,a)||fs(d,i);for(p=Bd(d,t);!v&&p&&h>=1;)h/=1.5,d=zd(u,h,c,!1),v=fs(d,a)||fs(d,i),p=Bd(d,t);d&&!v&&(a.push(new Pn(l.x1,l.y1,d.x,d.y)),a.push(new Pn(d.x,d.y,l.x2,l.y2)),s=!0),s||i.push(l)}for(;a.length>0;)i.push(a.pop());return i}function Dct(r,t){const e=[];for(;r.length>0;){const n=r.pop();if(r.length===0){e.push(n);break}const i=r.pop(),a=new Pn(n.x1,n.y1,i.x2,i.y2);E5(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function Fct(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=As(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new Pn(r.x,r.y,a.cx,a.cy),l=zct(e,o);return s*(l+1)*(l+1)<n&&(i=a,n=s*(l+1)*(l+1)),i},null)}function Bct(r){if(r.length<2)return r;let t=0,e=0;return r.forEach(n=>{t+=n.cx,e+=n.cy}),t/=r.length,e/=r.length,r.map(n=>{const i=t-n.cx,a=e-n.cy,s=i*i+a*a;return[n,s]}).sort((n,i)=>n[1]-i[1]).map(n=>n[0])}function Bd(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function fs(r,t){return t.some(e=>!!(JP(e.x1,e.y1,r.x,r.y,.001)||JP(e.x2,e.y2,r.x,r.y,.001)))}function E5(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!b5(i,t))continue;const a=Tct(i,t);a>=0&&a<e&&(n=i,e=a)}return n}function zct(r,t){return r.reduce((e,n)=>b5(n,t)&&Cct(n,t)?e+1:e,0)}function zd(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===Qe.POINT){if(i.state===Qe.POINT)return Ie(r.x-t,r.y-t);if(s.state===Qe.POINT)return Ie(r.x-t,r.y2+t);const d=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)<d*.5?a.y>o.y?Ie(r.x-t,r.y-t):Ie(r.x2+t,r.y-t):a.y<o.y?Ie(r.x-t,r.y2+t):Ie(r.x2+t,r.y2+t)}if(o.state===Qe.POINT){if(i.state===Qe.POINT)return Ie(r.x2+t,r.y-t);if(s.state===Qe.POINT)return Ie(r.x2+t,r.y2+t)}const c=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<c*.5?i.x>s.x?Ie(r.x-t,r.y-t):Ie(r.x-t,r.y2+t):i.x<s.x?Ie(r.x2+t,r.y-t):Ie(r.x2+t,r.y2+t)}if(a.state===Qe.POINT){if(i.state===Qe.POINT)return Ie(r.x2+t,r.y2+t);if(s.state===Qe.POINT)return Ie(r.x2+t,r.y-t);const c=r.height*r.width;return r.width*((a.y-r.y+(o.y-r.y))*.5)<c*.5?a.y>o.y?Ie(r.x2+t,r.y2+t):Ie(r.x-t,r.y2+t):a.y<o.y?Ie(r.x2+t,r.y-t):Ie(r.x-t,r.y-t)}if(o.state===Qe.POINT){if(i.state===Qe.POINT)return Ie(r.x-t,r.y2+t);if(s.state===Qe.POINT)return Ie(r.x-t,r.y-t)}const l=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<l*.5?i.x>s.x?Ie(r.x2+t,r.y2+t):Ie(r.x2+t,r.y-t):i.x<s.x?Ie(r.x-t,r.y2+t):Ie(r.x-t,r.y-t)}function $ct(r,t,e,n){if(!(r.closed?e<r.length:e<r.length-1))return!1;const a=r.get(t),s=r.get(e+1);for(let o=t+1;o<=e;o++){const l=r.get(o);if(BE(a.x,a.y,s.x,s.y,l.x,l.y)>n)return!1}return!0}function jct(r=0){return t=>{if(r<0||t.length<3)return t;const e=[];let n=0;const i=r*r;for(;n<t.length;){let a=n+1;for(;$ct(t,n,a,i);)a++;e.push(t.get(n)),n=a}return new lu(e)}}function qct(r,t){switch(r){case-2:return(((-t+3)*t-3)*t+1)/6;case-1:return((3*t-6)*t*t+4)/6;case 0:return(((-3*t+3)*t+3)*t+1)/6;case 1:return t*t*t/6;default:throw new Error("unknown error")}}function Wct(r=6){function a(s,o,l){let u=0,c=0;for(let h=-2;h<=1;h++){const d=s.get(o+h),g=qct(h,l);u+=g*d.x,c+=g*d.y}return{x:u,y:c}}return s=>{if(s.length<3)return s;const o=[],l=s.closed,u=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let c=2-(l?0:2);c<u;c++)for(let h=1;h<=r;h++)o.push(a(s,c,h/r));return new lu(o)}}function Gct(r=8){return t=>{let e=r,n=t.length;if(e>1)for(n=Math.floor(t.length/e);n<3&&e>1;)e-=1,n=Math.floor(t.length/e);const i=[];for(let a=0,s=0;s<n;s++,a+=e)i.push(t.get(a));return new lu(i)}}class lu{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(e.length===0)return"";const n=typeof t=="function"?t:kct(t);let i="M";for(const a of e)i+=`${n(a.x)},${n(a.y)} L`;return i=i.slice(0,-1),this.closed&&(i+=" Z"),i}draw(t){const e=this.points;if(e.length!==0){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 Gct(t)(this)}simplify(t){return jct(t)(this)}bSplines(t){return Wct(t)(this)}apply(t){return t(this)}containsElements(t){const e=Act(this.points);return e?t.every(n=>e.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(t,e){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new Pn(i.x,i.y,i.x,i.y);for(let s=1;s<this.points.length;s++){const o=this.points[s];a.x1=a.x2,a.y1=a.y2,a.x2=o.x,a.y2=o.y,a.cuts(t,e)&&n++}return a.x1=a.x2,a.y1=a.y2,a.x2=i.x,a.y2=i.y,a.cuts(t,e)&&n++,n%2===1}}class Vct{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(this.count===0)return!1;const e=this.arr[0];return e!=null&&e.x===t.x&&e.y===t.y}path(){return new lu(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 Ru=0,$d=1,jd=2,Ub=3;function Hct(r,t){const e=(Math.floor(r.width)+Math.floor(r.height))*2,n=new Vct(e);function i(l,u,c,h){const d=r.get(l,u);return Number.isNaN(d)?Number.NaN:d>t?c+h:c}function a(l,u){let c=Ru;return c=i(l,u,c,1),c=i(l+1,u,c,2),c=i(l,u+1,c,4),c=i(l+1,u+1,c,8),Number.isNaN(c)?-1:c}let s=$d;function o(l,u){let c=l,h=u,d=r.invertScaleX(c),g=r.invertScaleY(h);for(let p=0;p<r.width*r.height;p++){const v={x:d,y:g};if(n.contains(v)){if(n.isFirst(v))return!0}else n.add(v);const m=a(c,h);switch(m){case-1:return!0;case 0:case 3:case 2:case 7:s=jd;break;case 12:case 14:case 4:s=Ub;break;case 6:s=s===Ru?Ub:jd;break;case 1:case 13:case 5:s=Ru;break;case 9:s=s===jd?Ru:$d;break;case 10:case 8:case 11:s=$d;break;default:return console.warn("Marching squares invalid state: "+m),!0}switch(s){case Ru:h--,g-=r.pixelGroup;break;case $d:h++,g+=r.pixelGroup;break;case Ub:c--,d-=r.pixelGroup;break;case jd:c++,d+=r.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+m),!0}}return!0}for(let l=0;l<r.width;l++)for(let u=0;u<r.height;u++){if(r.get(l,u)<=t)continue;const c=a(l,u);if(!(c<0||c===15)&&o(l,u))return n.path()}return null}const dg={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 sc(r){return r!=null&&typeof r.radius=="number"}function tN(r,t){if(sc(r)!==sc(t))return!1;if(sc(r)){const n=t;return r.cx===n.cx&&r.cy===n.cy&&r.radius===n.radius}const e=t;return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}var Ai;(function(r){r[r.MEMBERS=0]="MEMBERS",r[r.NON_MEMBERS=1]="NON_MEMBERS",r[r.EDGES=2]="EDGES"})(Ai||(Ai={}));let eN=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new Kn(0,0,0,0),this.potentialArea=new No(1,0,0,0,0,0,0),this.o=Object.assign({},dg,t)}pushMember(...t){if(t.length!==0){this.dirty.add(Ai.MEMBERS);for(const e of t)this.members.push({raw:e,obj:sc(e)?Yf.from(e):Kn.from(e),area:null})}}removeMember(t){const e=this.members.findIndex(n=>tN(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(Ai.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>tN(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(Ai.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex(n=>n.obj.equals(t));return e<0?!1:(this.edges.splice(e,1),this.dirty.add(Ai.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(Ai.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:sc(e)?Yf.from(e):Kn.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(Ai.EDGES);for(const e of t)this.edges.push({raw:e,obj:Pn.from(e),area:null})}}update(){const t=this.dirty.has(Ai.MEMBERS),e=this.dirty.has(Ai.NON_MEMBERS);let n=this.dirty.has(Ai.EDGES);this.dirty.clear();const i=this.members.map(u=>u.obj);if(this.o.virtualEdges&&(t||e)){const u=this.nonMembers.map(d=>d.obj),c=Rct(i,u,this.o.maxRoutingIterations,this.o.morphBuffer),h=new Map(this.virtualEdges.map(d=>[d.obj.toString(),d.area]));this.virtualEdges=c.map(d=>{var g;return{raw:d,obj:d,area:(g=h.get(d.toString()))!==null&&g!==void 0?g:null}}),n=!0}let a=!1;if(t||n){const u=this.virtualEdges.concat(this.edges).map(g=>g.obj),c=Yct(i,u),h=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,d=Kn.from(w5(c,h));d.equals(this.activeRegion)||(a=!0,this.activeRegion=d)}if(a){const u=Math.ceil(this.activeRegion.width/this.o.pixelGroup),c=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=No.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(h=>h.area=null),this.nonMembers.forEach(h=>h.area=null),this.edges.forEach(h=>h.area=null),this.virtualEdges.forEach(h=>h.area=null)):(u!==this.potentialArea.width||c!==this.potentialArea.height)&&(this.potentialArea=No.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=u=>{if(u.area){const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof Kn?"R":"C"}`;s.set(c,u.area)}},l=u=>{if(u.area)return;const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof Kn?"R":"C"}`;if(s.has(c)){const d=s.get(c);u.area=this.potentialArea.copy(d,{x:u.obj.x-this.o.nodeR1,y:u.obj.y-this.o.nodeR1});return}const h=u.obj instanceof Kn?Nct(u.obj,this.potentialArea,this.o.nodeR1):x5(u.obj,this.potentialArea,this.o.nodeR1);u.area=h,s.set(c,h)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(l),this.nonMembers.forEach(u=>{this.activeRegion.intersects(u.obj)?l(u):u.area=null}),this.edges.forEach(u=>{u.area||(u.area=QP(u.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(u=>{u.area||(u.area=QP(u.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(this.members.length===0)return new lu([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map(o=>o.area),i=this.virtualEdges.concat(this.edges).map(o=>o.area),a=this.nonMembers.filter(o=>o.area!=null).map(o=>o.area),s=this.members.map(o=>o.obj);return Uct(e,n,i,a,o=>o.containsElements(s),t)}};function Uct(r,t,e,n,i,a={}){const s=Object.assign({},dg,a);let o=s.threshold,l=s.memberInfluenceFactor,u=s.edgeInfluenceFactor,c=s.nonMemberInfluenceFactor;const h=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),d=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let g=0;g<s.maxMarchingIterations;g++){if(r.clear(),l!==0){const v=l/h;for(const m of t)r.incArea(m,v)}if(u!==0){const v=u/d;for(const m of e)r.incArea(m,v)}if(c!==0){const v=c/h;for(const m of n)r.incArea(m,v)}const p=Hct(r,o);if(p&&i(p))return p;if(o*=.95,g<=s.maxMarchingIterations*.5)l*=1.2,u*=1.2;else if(c!==0&&n.length>0)c*=.8;else break}return new lu([])}function Yct(r,t){if(r.length===0)return new Kn(0,0,0,0);const e=Kn.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(m5(n));return e}var Xct=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class fg extends Vn{constructor(t,e){super(t,cr({},fg.defaultOptions,e)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:n,bubbleSetOptions:i}=this.parseOptions();Ze(this.bubbleSetOptions,i)||this.init(),this.bubbleSetOptions=Object.assign({},i);const a=Object.assign(Object.assign({},n),{d:this.getPath()});this.shape?this.shape.update(a):(this.shape=new zc({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=H(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,l=[...this.avoidMembers.keys()];if(!n&&Ze(a,s)&&Ze(o,l))return this.path;const{enter:u=[],exit:c=[]}=Ls(s,a,m=>m),{enter:h=[],exit:d=[]}=Ls(l,o,m=>m);n&&(c.push(n),u.push(n));const g=(m,b,w)=>{m.forEach(x=>{const S=w?this.members:this.avoidMembers,_=w?"pushMember":"pushNonMember",k=w?"removeMember":"removeNonMember";if(b){let M;i.getElementType(x)==="edge"?([M]=Zct(i,x),this.bubbleSets.pushEdge(M)):([M]=Kct(i,x),this.bubbleSets[_](M)),S.set(x,M)}else{const M=S.get(x);M&&(i.getElementType(x)==="edge"?this.bubbleSets.removeEdge(M):this.bubbleSets[k](M),S.delete(x))}})};g(c,!1,!0),g(u,!0,!0),g(d,!1,!1),g(h,!0,!1);const v=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=T6(v.points.map(jn)),this.path},this.bindEvents(),this.bubbleSets=new eN(this.options)}bindEvents(){this.context.graph.on(dt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(dt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new eN(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const t=this.options,{type:e,key:n,members:i,avoidMembers:a}=t,s=Xct(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,u)=>(u in dg?l.bubbleSetOptions[u]=s[u]:l.style[u]=s[u],l),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:i,avoidMembers:a},o)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n))),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(n=>!e.includes(n)),this.drawBubbleSets()}updateMember(t){this.options.members=Et(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!e.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(n=>e.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(dt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(dt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}fg.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},dg);const Kct=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Kn(i.min[0],i.min[1],ca(i),ha(i))}),Zct=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return Pn.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function Jct(r){return`
- <ul class="g6-contextmenu-ul">
- ${r.map(t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`).join("")}
- </ul>
- `}const Qct=`
- .g6-contextmenu {
- font-size: 12px;
- background-color: rgba(255, 255, 255, 0.96);
- border-radius: 4px;
- overflow: hidden;
- box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;
- 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;
- }
- .g6-contextmenu-ul {
- max-width: 256px;
- min-width: 96px;
- list-style: none;
- padding: 0;
- margin: 0;
- }
- .g6-contextmenu-li {
- padding: 8px 12px;
- cursor: pointer;
- user-select: none;
- }
- .g6-contextmenu-li:hover {
- background-color: #f5f5f5;
- cursor: pointer;
- }
- `;var nN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class gg extends Vn{constructor(t,e){super(t,Object.assign({},gg.defaultOptions,e)),this.targetElement=null,this.onTriggerEvent=n=>{var i;(i=n.preventDefault)===null||i===void 0||i.call(n),this.show(n)},this.onMenuItemClick=n=>{const{onClick:i,trigger:a}=this.options;if(n.target instanceof HTMLElement&&n.target.className.includes("g6-contextmenu-li")){const s=n.target.getAttribute("value");i==null||i(s,n.target,this.targetElement),this.hide()}a!=="click"&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=ou("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),cx("g6-contextmenu-css","style",{},Qct,document.head)}show(t){return nN(this,void 0,void 0,function*(){const{enable:e,offset:n}=this.options;if(typeof e=="function"&&!e(t)||!e){this.hide();return}const i=yield this.getDOMContent(t);i instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(i)):this.$element.innerHTML=i;const a=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-a.left+n[0]}px`,this.$element.style.top=`${t.client.y-a.top+n[1]}px`,this.$element.style.display="block",this.targetElement=t.target})}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return nN(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?Jct(yield n(t)):yield 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)}}gg.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class pg extends Vn{constructor(t,e){super(t,Object.assign({},pg.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:n,element:i}=this.context,a=n.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:s,iterRate:o,divRate:l}=this.options;let{lambda:u,divisions:c,iterations:h}=this.options;for(let d=0;d<s;d++){for(let g=0;g<h;g++){const p={};a.forEach(v=>{var m;if(v.source===v.target)return;const b=H(v);p[b]=this.getEdgeForces(v,c,u);for(let w=0;w<c+1;w++)(m=this.edgePoints)[b]||(m[b]=[]),this.edgePoints[b][w]=It(this.edgePoints[b][w],p[b][w])})}u/=2,c*=l,h*=o,this.divideEdges(c)}a.forEach(d=>{const g=H(d),p=i.getElement(g);p==null||p.update({d:iE(this.edgePoints[g])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[H(e),zo(cn(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=H(n);(i=this.edgePoints)[a]||(i[a]=[]);const s=this.nodeMap[n.source],o=this.nodeMap[n.target];if(t===1)this.edgePoints[a].push(s),this.edgePoints[a].push(Fi(It(s,o),2)),this.edgePoints[a].push(o);else{const u=(this.edgePoints[a].length===0?Ne(s,o):iht(this.edgePoints[a]))/(t+1);let c=u;const h=[s];for(let d=1;d<this.edgePoints[a].length;d++){const g=this.edgePoints[a][d-1],p=this.edgePoints[a][d];let v=Ne(p,g);for(;v>c;){const m=c/v,b=It(g,Oa(be(p,g),m));h.push(b),v-=c,c=u}c-=v}h.push(o),this.edgePoints[a]=h}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=be(n,e),s=Ne(e,n);return{source:e,target:n,vx:i,vy:a,length:s}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),i=this.getVectorPosition(e),a=tht(n,i),s=eht(n,i),o=nht(n,i),l=rht(n,i);return a*s*o*l}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var l,u;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[l=H(i)]||(t[l]=[]),t[H(i)].push(s),t[u=H(s)]||(t[u]=[]),t[H(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Oa(be(It(n,a),Oa(i,2)),e)}getElectrostaticForce(t,e){Ji(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[H(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[H(a)][t],o=this.edgePoints[H(e)][t],l=be(s,o),u=Ne(s,o);i=It(i,Oa(l,1/u))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(Ne(i,a)*(e+1)),o=[[0,0]],l=H(t);for(let u=1;u<e;u++){const c=this.getSpringForce({pre:this.edgePoints[l][u-1],cur:this.edgePoints[l][u],next:this.edgePoints[l][u+1]||[0,0]},s),h=this.getElectrostaticForce(u,t);o.push(Oa(It(c,h),n))}return o.push([0,0]),o}bindEvents(){const{graph:t}=this.context;t.on(dt.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:t}=this.context;t.off(dt.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}pg.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const tht=(r,t)=>Math.abs(DX([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),eht=(r,t)=>{const e=(r.length+t.length)/2;return 2/(e/Math.min(r.length,t.length)+Math.max(r.length,t.length)/e)},nht=(r,t)=>{const e=(r.length+t.length)/2,n=Fi(It(r.source,r.target),2),i=Fi(It(t.source,t.target),2);return e/(e+Ne(n,i))},rN=(r,t)=>{if(t.source[0]===t.target[0])return[t.source[0],r[1]];if(t.source[1]===t.target[1])return[r[0],t.source[1]];const e=(t.source[1]-t.target[1])/(t.source[0]-t.target[0]),n=(e*e*t.source[0]+e*(r[1]-t.source[1])+r[0])/(e*e+1),i=e*(n-t.source[0])+t.source[1];return[n,i]},iN=(r,t)=>{const e=rN(t.source,r),n=rN(t.target,r),i=Fi(It(e,n),2),a=Fi(It(r.source,r.target),2);return Ne(e,n)===0?0:Math.max(0,1-2*Ne(a,i)/Ne(e,n))},rht=(r,t)=>Math.min(iN(r,t),iN(t,r)),iht=r=>{let t=0;for(let e=1;e<r.length;e++)t+=Ne(r[e],r[e-1]);return t},aht={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0},aN=.05;class vg extends Vn{constructor(t,e){super(t,Object.assign({},vg.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=jn(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},aht,this.options.style);this.isLensOn||(this.lens=new $c({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Ri(n),{size:this.r*2}),this.lens.update(i)},this.getFilterData=()=>{const{filter:n}=this.options,{model:i}=this.context,a=i.getData();if(!n)return a;const{nodes:s,edges:o,combos:l}=a;return{nodes:s.filter(u=>n(H(u),"node")),edges:o.filter(u=>n(H(u),"edge")),combos:l.filter(u=>n(H(u),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(u=>Ne(cn(u),n)<this.r),o=s.map(u=>H(u)),l=a.filter(u=>{const{source:c,target:h}=u,d=o.includes(c),g=o.includes(h);switch(this.options.nodeType){case"both":return d&&g;case"either":return d!==g;case"source":return d&&!g;case"target":return!d&&g;default:return!1}});return{nodes:s,edges:l}},this.renderFocusElements=()=>{const{element:n,graph:i}=this.context;if(!this.isLensOn)return;const a=this.lens.getCenter(),{nodes:s,edges:o}=this.getFocusElements(a),l=new Set,u=c=>{const h=H(c);l.add(h);const d=n.getElement(h);if(!d)return;const g=this.shapes.get(h)||d.cloneNode();g.setPosition(d.getPosition()),g.id=d.id,this.shapes.has(h)?Object.entries(d.attributes).forEach(([m,b])=>{g.style[m]!==b&&(g.style[m]=b)}):(this.canvas.appendChild(g),this.shapes.set(h,g));const p=i.getElementType(h),v=this.getElementStyle(p,c);g.update(v)};s.forEach(u),o.forEach(u),this.shapes.forEach((c,h)=>{l.has(h)||(c.destroy(),this.shapes.delete(h))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:l}=n,{graph:u,canvas:c}=this.context,h=u.getCanvasByClient([a,s]),d=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||Ne(h,d)>this.r)return;const{maxR:g,minR:p}=this.options,v=o+l>0?1/(1-aN):1-aN,m=Math.min(...c.getSize())/2;this.r=Math.max(p||0,Math.min(g||m,this.r*v)),this.renderLens(d),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=jn(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||Ne(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=jn(n.canvas);this.renderLens(i),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n=t==="node"?this.options.nodeStyle:this.options.edgeStyle;return typeof n=="function"?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.addEventListener(J.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(J.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(J.DRAG_START,this.onDragStart),a.addEventListener(J.DRAG,this.onDrag),a.addEventListener(J.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(J.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.removeEventListener(J.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(J.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(J.DRAG_START,this.onDragStart),a.removeEventListener(J.DRAG,this.onDrag),a.removeEventListener(J.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.scaleRByWheel))}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}vg.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const sht={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},sN=.05,oN=.1;class mg extends Vn{constructor(t,e){super(t,Object.assign({},mg.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=jn(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},sht,this.options.style);this.isLensOn||(this.lens=new $c({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Ri(n),{size:this.r*2,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(i)},this.getDPercent=()=>{const{minD:n,maxD:i}=this.options;return`${Math.round((this.d-n)/(i-n)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:n}=this.context,i=this.lens.getCenter(),a=(this.d+1)*this.r,s=new Map,o=new Map;n.getNodeData().forEach(u=>{const c=cn(u),h=Ne(c,i);if(h>this.r)return;const d=a*h/(this.d*h+this.r),[g,p]=c,[v,m]=i,b=(g-v)/h,w=(p-m)/h,x=[v+d*b,m+d*w],S=H(u),_=this.getNodeStyle(u),k=Lo(n.getElementRenderStyle(S),Object.keys(_));s.set(S,Object.assign(Object.assign({},Ri(x)),_)),o.set(S,Object.assign(Object.assign({},Ri(c)),k))}),this.updateStyle(s,o)},this.getNodeStyle=n=>{const{nodeStyle:i}=this.options;return typeof i=="function"?i(n):i},this.updateStyle=(n,i)=>{const{graph:a,element:s}=this.context,{enter:o,exit:l,keep:u}=Ls(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),d=>d),c=new Set,h=(d,g)=>{const p=s.getElement(d);p==null||p.update(g),a.getRelatedEdgesData(d).forEach(v=>{c.add(H(v))})};[...o,...u].forEach(d=>{h(d,n.get(d))}),l.forEach(d=>{h(d,this.prevOriginStyleMap.get(d)),this.prevOriginStyleMap.delete(d)}),c.forEach(d=>{const g=s.getElement(d);g==null||g.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((d,g)=>{this.prevOriginStyleMap.has(g)||this.prevOriginStyleMap.set(g,d)})},this.isWheelValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const{clientX:i,clientY:a}=n,s=this.context.graph.getCanvasByClient([i,a]),o=this.lens.getCenter();return!(Ne(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-sN):1-sN,o=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(a||0,Math.min(i||o,this.r*s))},this.scaleD=n=>{const{maxD:i,minD:a}=this.options,s=n?this.d+oN:this.d-oN;this.d=Math.max(a,Math.min(i,s))},this.scaleRByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleR(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleD(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.isDragValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const i=jn(n.canvas),a=this.lens.getCenter();return!(Ne(i,a)>this.r)},this.isLensDragging=!1,this.onDragStart=n=>{this.isDragValid(n)&&(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=jn(n.canvas);this.onMagnify(i)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleR(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleD(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.addEventListener(J.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(J.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(J.DRAG_START,this.onDragStart),s.addEventListener(J.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(J.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(J.WHEEL,o,{passive:!1})}}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.removeEventListener(J.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(J.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(J.DRAG_START,this.onDragStart),s.removeEventListener(J.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(J.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,o)}}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&((t=this.lens)===null||t===void 0||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}mg.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class yg extends Vn{constructor(t,e){super(t,Object.assign({},yg.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var n,i,a,s;const o=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(o),o?(i=(n=this.options).onEnter)===null||i===void 0||i.call(n):(s=(a=this.options).onExit)===null||s===void 0||s.call(a)},this.shortcut=new Jl(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML=`
- :not(:root):fullscreen::backdrop {
- background: transparent;
- }
- `}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(i=>{document.addEventListener(i,this.onFullscreenChange,!1)})}unbindEvents(){this.shortcut.unbindAll(),["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(e=>{document.removeEventListener(e,this.onFullscreenChange,!1)})}setGraphSize(t=!0){var e,n;let i,a;t?(i=((e=globalThis.screen)===null||e===void 0?void 0:e.width)||0,a=((n=globalThis.screen)===null||n===void 0?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[i,a]=this.graphSize,this.context.graph.setSize(i,a),this.context.graph.render()}request(){document.fullscreenElement||!oht()||this.$el.requestFullscreen().catch(t=>{la.warn(`Error attempting to enable full-screen: ${t.message} (${t.name})`)})}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.exit(),this.style.remove(),super.destroy()}}yg.defaultOptions={trigger:{},autoFit:!0};function oht(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class bg extends Vn{constructor(t,e){super(t,Object.assign({},bg.defaultOptions,e)),this.$element=ou("grid-line",!0),this.offset=[0,0],this.onTransform=i=>{if(!this.options.follow)return;const{data:{translate:a}}=i;a&&this.updateOffset(a)},this.context.canvas.getContainer().prepend(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:t}=this.context;t.on(dt.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:i,borderLineWidth:a,borderStroke:s,borderStyle:o}=this.options;Object.assign(this.$element.style,{border:i?`${a}px ${o} ${s}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`,backgroundRepeat:"repeat"})}updateOffset(t){this.offset=BX(It(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(dt.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}bg.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function zE(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=H(i);if(n==="NodeAdded"||n==="EdgeAdded"||n==="ComboAdded")t.Added.set(a,e);else if(n==="NodeUpdated"||n==="EdgeUpdated"||n==="ComboUpdated")if(t.Added.has(a))t.Added.set(a,{type:n.replace("Updated","Added"),value:i});else if(t.Updated.has(a)){const{original:s}=t.Updated.get(a);t.Updated.set(a,{type:n,value:i,original:s})}else t.Removed.has(a)||t.Updated.set(a,e);else(n==="NodeRemoved"||n==="EdgeRemoved"||n==="ComboRemoved")&&(t.Added.has(a)?t.Added.delete(a):(t.Updated.has(a)&&t.Updated.delete(a),t.Removed.set(a,e)))}),[...Array.from(t.Added.values()),...Array.from(t.Updated.values()),...Array.from(t.Removed.values())]}function _5(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:l=[],ComboRemoved:u=[]}=s0(r,c=>c.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:l},remove:{nodes:n,edges:s,combos:u}}}function S5(r,t){for(const e in r)un(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),S5(r[e],t[e])):t[e]===void 0&&(t[e]=pc(e))}function lht(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=_5(zE(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);let d=Object.assign({},l.original);if(e){const g=e.graph.getElementType(H(l.original)),p=g==="edge"?"stroke":"fill",v=e.element.getElementComputedStyle(g,l.original);d=Object.assign(Object.assign({},l.original),{style:Object.assign({[p]:v[p]},l.original.style)})}S5(h,d),(u=n.current.update)[o]||(u[o]=[]),n.current.update[o].push(h),(c=n.original.update)[o]||(c[o]=[]),n.original.update[o].push(d)}),i[o]&&i[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.add)[o]||(u[o]=[]),n.current.add[o].push(h),(c=n.original.remove)[o]||(c[o]=[]),n.original.remove[o].push(h)}),s[o]&&s[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.remove)[o]||(u[o]=[]),n.current.remove[o].push(h),(c=n.original.add)[o]||(c[o]=[]),n.original.add[o].push(h)})}),n}class wg extends Vn{constructor(t,e){super(t,Object.assign({},wg.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,l;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const u=a?i.original:i.current;this.context.graph.addData(u.add),this.context.graph.updateData(u.update),this.context.graph.removeData(d6(u.remove,!1)),(l=this.context.element)===null||l===void 0||l.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===dt.AFTER_DRAW){const{dataChanges:s=[],animation:o=!0}=i.data;if(!((a=this.context.batch)===null||a===void 0)&&a.isBatching){if(!this.batchChanges)return;this.batchChanges.push(s),this.batchAnimation&&(this.batchAnimation=o);return}this.batchChanges=[s],this.batchAnimation=o}this.undoStackPush(lht(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(bs.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=i=>{const{initiate:a}=i.data;this.batchAnimation=!1,a?this.batchChanges=[]:this.undoStack.pop()||(this.batchChanges=null)},this.emitter=new O0;const{graph:n}=this.context;n.on(dt.AFTER_DRAW,this.addCommand),n.on(dt.BATCH_START,this.initBatchCommand),n.on(dt.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var t,e,n,i;const a=this.undoStack.pop();if(a){if(this.executeCommand(a),((e=(t=this.options).beforeAddCommand)===null||e===void 0?void 0:e.call(t,a,!1))===!1)return;this.redoStack.push(a),(i=(n=this.options).afterAddCommand)===null||i===void 0||i.call(n,a,!1),this.notify(bs.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(bs.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(bs.CANCEL,t)),this}undoStackPush(t){var e,n,i,a;const{stackSize:s}=this.options;s!==0&&this.undoStack.length>=s&&this.undoStack.shift(),((n=(e=this.options).beforeAddCommand)===null||n===void 0?void 0:n.call(e,t,!0))!==!1&&(this.undoStack.push(t),(a=(i=this.options).afterAddCommand)===null||a===void 0||a.call(i,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(bs.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(bs.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(dt.AFTER_DRAW,this.addCommand),t.off(dt.BATCH_START,this.initBatchCommand),t.off(dt.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}wg.defaultOptions={stackSize:0};function qd(r,t,e,n,i,a){const s=(a-t)*(e-r)-(n-t)*(i-r);return s>0?!0:!(s<0)}function uht(r,t){const e=r[0][0],n=r[0][1],i=r[1][0],a=r[1][1],s=t[0][0],o=t[0][1],l=t[1][0],u=t[1][1];return qd(e,n,s,o,l,u)!==qd(i,a,s,o,l,u)&&qd(e,n,i,a,s,o)!==qd(e,n,i,a,l,u)}var cht=uht;function M5(r,t){this._cells=[],this._cellSize=t,this._reverseCellSize=1/t;for(let e=0;e<r.length;e++){const n=r[e],i=this.coordToCellNum(n[0]),a=this.coordToCellNum(n[1]);if(this._cells[i])this._cells[i][a]?this._cells[i][a].push(n):this._cells[i][a]=[n];else{const s=[];s[a]=[n],this._cells[i]=s}}}M5.prototype={cellPoints:function(r,t){return this._cells[r]!==void 0&&this._cells[r][t]!==void 0?this._cells[r][t]:[]},rangePoints:function(r){const t=this.coordToCellNum(r[0]),e=this.coordToCellNum(r[1]),n=this.coordToCellNum(r[2]),i=this.coordToCellNum(r[3]),a=[];for(let s=t;s<=n;s++)for(let o=e;o<=i;o++)for(let l=0;l<this.cellPoints(s,o).length;l++)a.push(this.cellPoints(s,o)[l]);return a},removePoint:function(r){const t=this.coordToCellNum(r[0]),e=this.coordToCellNum(r[1]),n=this._cells[t][e];let i;for(let a=0;a<n.length;a++)if(n[a][0]===r[0]&&n[a][1]===r[1]){i=a;break}return n.splice(i,1),n},trunc:Math.trunc||function(r){return r-r%1},coordToCellNum:function(r){return this.trunc(r*this._reverseCellSize)},extendBbox:function(r,t){return[r[0]-t*this._cellSize,r[1]-t*this._cellSize,r[2]+t*this._cellSize,r[3]+t*this._cellSize]}};function hht(r,t){return new M5(r,t)}var dht=hht,fht={toXy:function(r,t){return t===void 0?r.slice():r.map(function(e){return new Function("pt","return [pt"+t[0]+",pt"+t[1]+"];")(e)})},fromXy:function(r,t){return t===void 0?r.slice():r.map(function(e){return new Function("pt","const o = {}; o"+t[0]+"= pt[0]; o"+t[1]+"= pt[1]; return o;")(e)})}};function k5(r,t,e){return(t[0]-r[0])*(e[1]-r[1])-(t[1]-r[1])*(e[0]-r[0])}function ght(r){const t=[];for(let e=0;e<r.length;e++){for(;t.length>=2&&k5(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}return t.pop(),t}function pht(r){const t=r.reverse(),e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&k5(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}function vht(r){const t=ght(r),n=pht(r).concat(t);return n.push(r[0]),n}var mht=vht;const yht=cht,bht=dht,Yb=fht,wht=mht;function xht(r){const t=[r[0]];let e=r[0];for(let n=1;n<r.length;n++){const i=r[n];(e[0]!==i[0]||e[1]!==i[1])&&t.push(i),e=i}return t}function Eht(r){return r.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]})}function hx(r,t){return Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2)}function lN(r,t,e){const n=[t[0]-r[0],t[1]-r[1]],i=[e[0]-r[0],e[1]-r[1]],a=hx(r,t),s=hx(r,e);return(n[0]*i[0]+n[1]*i[1])/Math.sqrt(a*s)}function uN(r,t){for(let e=0;e<t.length-1;e++){const n=[t[e],t[e+1]];if(!(r[0][0]===n[0][0]&&r[0][1]===n[0][1]||r[0][0]===n[1][0]&&r[0][1]===n[1][1])&&yht(r,n))return!0}return!1}function _ht(r){let t=1/0,e=1/0,n=-1/0,i=-1/0;for(let a=r.length-1;a>=0;a--)r[a][0]<t&&(t=r[a][0]),r[a][1]<e&&(e=r[a][1]),r[a][0]>n&&(n=r[a][0]),r[a][1]>i&&(i=r[a][1]);return[n-t,i-e]}function Sht(r){return[Math.min(r[0][0],r[1][0]),Math.min(r[0][1],r[1][1]),Math.max(r[0][0],r[1][0]),Math.max(r[0][1],r[1][1])]}function Mht(r,t,e){let n=null,i=cN,a=cN,s,o;for(let l=0;l<t.length;l++)s=lN(r[0],r[1],t[l]),o=lN(r[1],r[0],t[l]),s>i&&o>a&&!uN([r[0],t[l]],e)&&!uN([r[1],t[l]],e)&&(i=s,a=o,n=t[l]);return n}function C5(r,t,e,n,i){let a=!1;for(let s=0;s<r.length-1;s++){const o=[r[s],r[s+1]],l=o[0][0]+","+o[0][1]+","+o[1][0]+","+o[1][1];if(hx(o[0],o[1])<t||i.has(l))continue;let u=0,c=Sht(o),h,d,g;do c=n.extendBbox(c,u),h=c[2]-c[0],d=c[3]-c[1],g=Mht(o,n.rangePoints(c),r),u++;while(g===null&&(e[0]>h||e[1]>d));h>=e[0]&&d>=e[1]&&i.add(l),g!==null&&(r.splice(s+1,0,g),n.removePoint(g),a=!0)}return a?C5(r,t,e,n,i):r}function kht(r,t,e){let n=t||20;const i=xht(Eht(Yb.toXy(r,e)));if(i.length<4){const h=i.concat([i[0]]);return e?Yb.fromXy(h,e):h}const a=_ht(i),s=[a[0]*hN,a[1]*hN],o=wht(i),l=i.filter(function(h){return o.indexOf(h)<0}),u=Math.ceil(1/(i.length/(a[0]*a[1]))),c=C5(o,Math.pow(n,2),s,bht(l,u),new Set);return e?Yb.fromXy(c,e):c}const cN=Math.cos(90/(180/Math.PI)),hN=.6;var Cht=kht;const Tht=i0(Cht);function Oht(r,t,e){if(r.length===1)return Aht(r[0],t,e);if(r.length===2)return dN(r,t,e);if(r.length===3){const[n,i,a]=Jx(r);if(b6(n,i,a))return dN([n,a],t,e)}switch(e){case"smooth":return Nht(r,t);case"sharp":return Rht(r,t);case"rounded":default:return Pht(r,t)}}const Aht=(r,t,e)=>{if(e==="sharp")return[["M",r[0]-t,r[1]-t],["L",r[0]+t,r[1]-t],["L",r[0]+t,r[1]+t],["L",r[0]-t,r[1]+t],["Z"]];const n=[t,t,0,0,0];return[["M",r[0],r[1]-t],["A",...n,r[0],r[1]+t],["A",...n,r[0],r[1]-t]]},dN=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?It(r[0],ks($a(be(r[0],r[1])),t)):r[0],a=e==="sharp"?It(r[1],ks($a(be(r[1],r[0])),t)):r[1],s=ks($a(f0(be(i,a),!1)),t),o=ks(s,-1),l=It(i,s),u=It(a,s),c=It(a,o),h=It(i,o);return e==="sharp"?[["M",l[0],l[1]],["L",u[0],u[1]],["L",c[0],c[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",u[0],u[1]],["A",...n,c[0],c[1]],["L",h[0],h[1]],["A",...n,l[0],l[1]]]},Pht=(r,t)=>{const e=Jx(r).map((o,l)=>{const u=(l-2+r.length)%r.length,c=(l-1+r.length)%r.length,h=(l+1)%r.length,d=r[u],g=r[c],p=r[h],v=be(d,g),m=be(g,o),b=be(o,p),w=(M,C)=>Kx(M,C,!0)<Math.PI,x=w(v,m),S=w(m,b),_=M=>ks($a(f0(M,!1)),t),k=_(m);return[{p:zo(x?It(g,_(v)):It(g,k)),concave:x&&g},{p:zo(S?It(o,_(b)):It(o,k)),concave:S&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,l)=>!e[(l-1+e.length)%e.length][0].concave&&!e[(l-1+e.length)%e.length][1].concave&&!o[0].concave&&!o[0].concave&&!o[1].concave),a=e.slice(i).concat(e.slice(0,i));let s=[];return a.flatMap((o,l)=>{const u=[],c=a[e.length-1];return l===0&&u.push(["M",...c[1].p]),o[0].concave?s.push(o[0].p,o[1].p):u.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):u.push(["L",...o[1].p]),s.length===3&&(u.pop(),u.push(["C",...s.flat()]),s=[]),u})},Nht=(r,t)=>{const e=Jx(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:$a(be(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=$a(It(s,ks(n.v,Kx(s,n.v,!0)<Math.PI?1:-1)));n.p=It(n.p,ks(o,t))}),T6(e.map(n=>n.p))},Rht=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],l=vc(ks($a(f0(be(o,a),!1)),t));return[It(o,l),It(a,l)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],l=[n[(s+1)%n.length],n[(s+2)%n.length]];return Zx(o,l,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var Lht=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class xg extends Vn{constructor(t,e){super(t,Object.assign({},xg.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(!this.shape)this.shape=new zc({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!Ze(this.optionsCache,this.options);this.shape.update(this.getHullStyle(n))}this.optionsCache=Object.assign({},this.options)},this.updateHullPath=n=>{this.shape&&this.options.members.includes(H(n.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(n=!1)=>{const{graph:i}=this.context,a=this.getMember();if(a.length===0)return"";const s=a.map(u=>i.getNodeData(u)),o=Tht(s.map(cn),this.options.concavity).slice(1).reverse(),l=o.flatMap(u=>s.filter(c=>Ze(cn(c),u)).map(H));return Ze(l,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=l,this.path=Oht(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(dt.AFTER_RENDER,this.drawHull),this.context.graph.on(dt.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=Lht(e,["members","padding","corner"]);return Object.assign(Object.assign({},s),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context;return this.hullMemberIds.reduce((n,i)=>{const{halfExtents:a}=t.getElementRenderBounds(i),s=Math.max(a[0],a[1]);return Math.max(n,s)},0)+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(n=>!e.includes(n)),e.some(n=>this.hullMemberIds.includes(n))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Et(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(dt.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}xg.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function T5(r,t){t(r),r.children&&r.children.forEach(function(e){e&&T5(e,t)})}function Kc(r){Eg(r,!0)}function Li(r){Eg(r,!1)}function Eg(r,t){var e=t?"visible":"hidden";T5(r,function(n){n.attr("visibility",e)})}var Iht=function(r){Ut(t,r);function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=r.apply(this,vt([],z(e),!1))||this;return i.isMutationObserved=!0,i.addEventListener(Xt.INSERTED,function(){Li(i)}),i}return t}(Mn);function O5(r){var t=r.appendChild(new Iht({class:"offscreen"}));return Li(t),t}function Dht(r){for(var t=r;t;){if(t.className==="offscreen")return!0;t=t.parent}return!1}var $E=function(r){Ut(t,r);function t(e){e===void 0&&(e={});var n=e.style,i=en(e,["style"]);return r.call(this,et({style:et({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},i))||this}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=O5(this)),this._offscreen},enumerable:!1,configurable:!0}),t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t}(Ys);function Kl(r){return r*Math.PI/180}function A5(r){return Number((r*180/Math.PI).toPrecision(5))}var ur=function(){function r(t,e,n,i){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=i}return Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),r.fromRect=function(t){return new r(t.x,t.y,t.width,t.height)},r.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}},r.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function pi(r,t){return Et(r)?r.apply(void 0,vt([],z(t),!1)):r}var $i=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=z(i,2),s=a[0],o=a[1],l=e(o);return[s,{name:l,class:".".concat(l),id:"#".concat(l),toString:function(){return l}}]}));return Object.assign(n,{prefix:e}),n},Fht=5,P5=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=Fht),Object.entries(t).forEach(function(i){var a=z(i,2),s=a[0],o=a[1],l=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?Vl(o)?(Vl(r[s])||(l[s]={}),e<n?P5(r[s],o,e+1,n):l[s]=t[s]):Yr(o)?(l[s]=[],l[s]=l[s].concat(o)):l[s]=o:l[s]=o)})},Rn=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)P5(r,t[n]);return r},N5=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},Wd,Bht=dw(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return Wd||(Wd=lt.offscreenCanvasCreator.getOrCreateContext(void 0)),Wd.font=[a,s,i,"".concat(e,"px"),n].join(" "),Wd.measureText(r).width},function(r,t){return[r,Object.values(t||R5(r)).join()].join("")},4096),R5=function(r){var t=r.style.fontFamily||"sans-serif",e=r.style.fontWeight||"normal",n=r.style.fontStyle||"normal",i=r.style.fontVariant,a=r.style.fontSize;return a=typeof a=="object"?a.value:a,{fontSize:a,fontFamily:t,fontWeight:e,fontStyle:n,fontVariant:i}};function L5(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function I5(r,t){var e=L5(r);e&&e.attr(t)}function dx(r,t,e){e===void 0&&(e="..."),I5(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function zht(r,t,e,n){e===void 0&&(e=2),n===void 0&&(n="top"),I5(r,{wordWrap:!0,wordWrapWidth:t,maxLines:e,textBaseline:n})}function fN(r){var t=r.canvas,e=r.touches,n=r.offsetX,i=r.offsetY;if(t){var a=t.x,s=t.y;return[a,s]}if(e){var o=e[0],l=o.clientX,u=o.clientY;return[l,u]}return n&&i?[n,i]:[0,0]}function Ha(r){return typeof r=="function"?r():se(r)||yt(r)?new $E({style:{text:String(r)}}):r}function $ht(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function Hr(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=function(a){a.node().removeChildren()}),r?e(t):(n&&i(t),null)}function zn(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=!1),n&&r===t||i&&r===e?!0:r>t&&r<e}var jht=function(r,t){return function(e){return r*(1-e)+t*e}};function qht(r,t){var e=t?t.length:0,n=r?Math.min(e,r.length):0;return function(i){var a=new Array(n),s=new Array(e),o=0;for(o=0;o<n;++o)a[o]=jE(r[o],t[o]);for(;o<e;++o)s[o]=t[o];for(o=0;o<n;++o)s[o]=a[o](i);return s}}function Wht(r,t){r===void 0&&(r={}),t===void 0&&(t={});var e={},n={};return Object.entries(t).forEach(function(i){var a=z(i,2),s=a[0],o=a[1];s in r?e[s]=jE(r[s],o):n[s]=o}),function(i){return Object.entries(e).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];return n[o]=l(i)}),n}}function jE(r,t){return typeof r=="number"&&typeof t=="number"?jht(r,t):Array.isArray(r)&&Array.isArray(t)?qht(r,t):typeof r=="object"&&typeof t=="object"?Wht(r,t):function(e){return r}}function Ght(r,t,e,n){if(!n)return r.attr("__keyframe_data__",e),null;var i=n.duration,a=i===void 0?0:i,s=jE(t,e),o=Math.ceil(+a/16),l=new Array(o).fill(0).map(function(u,c,h){return{__keyframe_data__:s(c/(h.length-1))}});return r.animate(l,et({fill:"both"},n))}function Na(r,t){return[r[0]*t,r[1]*t]}function Zu(r,t){return[r[0]+t[0],r[1]+t[1]]}function Xb(r,t){return[r[0]-t[0],r[1]-t[1]]}function go(r,t){return[Math.min(r[0],t[0]),Math.min(r[1],t[1])]}function po(r,t){return[Math.max(r[0],t[0]),Math.max(r[1],t[1])]}function _c(r,t){return Math.sqrt(Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2))}function D5(r){if(r[0]===0&&r[1]===0)return[0,0];var t=Math.sqrt(Math.pow(r[0],2)+Math.pow(r[1],2));return[r[0]/t,r[1]/t]}function Vht(r,t){return t?[r[1],-r[0]]:[-r[1],r[0]]}function gN(r,t){return+r.toPrecision(t)}function pN(r,t){var e={},n=Array.isArray(t)?t:[t];for(var i in r)n.includes(i)||(e[i]=r[i]);return e}function Hht(r,t,e,n){var i,a=[],s=!!n,o,l,u=[1/0,1/0],c=[-1/0,-1/0],h,d,g;if(s){i=z(n,2),u=i[0],c=i[1];for(var p=0,v=r.length;p<v;p+=1){var m=r[p];u=go(u,m),c=po(c,m)}}for(var p=0,b=r.length;p<b;p+=1){var m=r[p];if(p===0)g=m;else if(p===b-1)d=m,a.push(g),a.push(d);else{var w=[p?p-1:b-1,p-1][1];o=r[w],l=r[p+1];var x=[0,0];x=Xb(l,o),x=Na(x,t);var S=_c(m,o),_=_c(m,l),k=S+_;k!==0&&(S/=k,_/=k);var M=Na(x,-S),C=Na(x,_);d=Zu(m,M),h=Zu(m,C),h=go(h,po(l,m)),h=po(h,go(l,m)),M=Xb(h,m),M=Na(M,-S/_),d=Zu(m,M),d=go(d,po(o,m)),d=po(d,go(o,m)),C=Xb(m,d),C=Na(C,_/S),h=Zu(m,C),s&&(d=po(d,u),d=go(d,c),h=po(h,u),h=go(h,c)),a.push(g),a.push(d),g=h}}return a}function Uht(r,t,e){e===void 0&&(e=[[0,0],[1,1]]);for(var n=!1,i=[],a=0,s=r.length;a<s;a+=2)i.push([r[a],r[a+1]]);for(var o=Hht(i,.4,n,e),l=i.length,u=[],c,h,d,a=0;a<l-1;a+=1)c=o[a*2],h=o[a*2+1],d=i[a+1],u.push(["C",c[0],c[1],h[0],h[1],d[0],d[1]]);return u}var Yht=["$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 Xht(r){return Yht.includes(r)}function vN(r){var t={};for(var e in r)Xht(e)&&(t[e]=r[e]);return t}function Kht(r,t){if(r.length<=t)return r;for(var e=Math.floor(r.length/t),n=[],i=0;i<r.length;i+=e)n.push(r[i]);return n}function qE(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=t/Math.max(i,a);return r.style.transform="scale(".concat(s,")"),s}function Zht(r,t){var e=new Map;return r.forEach(function(n){var i=t(n);e.has(i)||e.set(i,[]),e.get(i).push(n)}),e}function Jht(r){throw new Error(r)}var Qht=function(){function r(i,a,s,o,l,u,c){i===void 0&&(i=null),a===void 0&&(a=null),s===void 0&&(s=null),o===void 0&&(o=null),l===void 0&&(l=[null,null,null,null,null]),u===void 0&&(u=[]),c===void 0&&(c=[]),t.add(this),this._elements=Array.from(i),this._data=a,this._parent=s,this._document=o,this._enter=l[0],this._update=l[1],this._exit=l[2],this._merge=l[3],this._split=l[4],this._transitions=u,this._facetElements=c}r.prototype.selectAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(a,null,this._elements[0],this._document)},r.prototype.selectFacetAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(this._elements,null,this._parent,this._document,void 0,void 0,a)},r.prototype.select=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i)[0]||null:i;return new e([a],null,a,this._document)},r.prototype.append=function(i){var a=this,s=typeof i=="function"?i:function(){return a.createElement(i)},o=[];if(this._data!==null){for(var l=0;l<this._data.length;l++){var u=this._data[l],c=z(Array.isArray(u)?u:[u,null],2),h=c[0],d=c[1],g=s(h,l);g.__data__=h,d!==null&&(g.__fromElements__=d),this._parent.appendChild(g),o.push(g)}return new e(o,null,this._parent,this._document)}for(var l=0;l<this._elements.length;l++){var p=this._elements[l],h=p.__data__,g=s(h,l);p.appendChild(g),o.push(g)}return new e(o,null,o[0],this._document)},r.prototype.maybeAppend=function(i,a){var s=mv(this,t,"m",n).call(this,i[0]==="#"?i:"#".concat(i),a);return s.attr("id",i),s},r.prototype.maybeAppendByClassName=function(i,a){var s=i.toString(),o=mv(this,t,"m",n).call(this,s[0]==="."?s:".".concat(s),a);return o.attr("className",s),o},r.prototype.maybeAppendByName=function(i,a){var s=mv(this,t,"m",n).call(this,'[name="'.concat(i,'"]'),a);return s.attr("name",i),s},r.prototype.data=function(i,a,s){var o,l;a===void 0&&(a=function(T){return T}),s===void 0&&(s=function(){return null});for(var u=[],c=[],h=new Set(this._elements),d=[],g=new Set,p=new Map(this._elements.map(function(T,A){return[a(T.__data__,A),T]})),v=new Map(this._facetElements.map(function(T,A){return[a(T.__data__,A),T]})),m=Zht(this._elements,function(T){return s(T.__data__)}),b=0;b<i.length;b++){var w=i[b],x=a(w,b),S=s(w,b);if(p.has(x)){var _=p.get(x);_.__data__=w,_.__facet__=!1,c.push(_),h.delete(_),p.delete(x)}else if(v.has(x)){var _=v.get(x);_.__data__=w,_.__facet__=!0,c.push(_),v.delete(x)}else if(m.has(x)){var k=m.get(x);d.push([w,k]);try{for(var M=(o=void 0,Ac(k)),C=M.next();!C.done;C=M.next()){var _=C.value;h.delete(_)}}catch(T){o={error:T}}finally{try{C&&!C.done&&(l=M.return)&&l.call(M)}finally{if(o)throw o.error}}m.delete(x)}else if(p.has(S)){var _=p.get(S);_.__toData__?_.__toData__.push(w):_.__toData__=[w],g.add(_),h.delete(_)}else u.push(w)}var P=[new e([],u,this._parent,this._document),new e(c,null,this._parent,this._document),new e(h,null,this._parent,this._document),new e([],d,this._parent,this._document),new e(g,null,this._parent,this._document)];return new e(this._elements,null,this._parent,this._document,P)},r.prototype.merge=function(i){var a=vt(vt([],z(this._elements),!1),z(i._elements),!1),s=vt(vt([],z(this._transitions),!1),z(i._transitions),!1);return new e(a,null,this._parent,this._document,void 0,s)},r.prototype.createElement=function(i){if(this._document)return this._document.createElement(i,{});var a=e.registry[i];return a?new a:Jht("Unknown node type: ".concat(i))},r.prototype.join=function(i,a,s,o,l){i===void 0&&(i=function(p){return p}),a===void 0&&(a=function(p){return p}),s===void 0&&(s=function(p){return p.remove()}),o===void 0&&(o=function(p){return p}),l===void 0&&(l=function(p){return p.remove()});var u=i(this._enter),c=a(this._update),h=s(this._exit),d=o(this._merge),g=l(this._split);return c.merge(u).merge(h).merge(d).merge(g)},r.prototype.remove=function(){for(var i=function(o){var l=a._elements[o],u=a._transitions[o];u?u.then(function(){return l.remove()}):l.remove()},a=this,s=0;s<this._elements.length;s++)i(s);return new e([],null,this._parent,this._document,void 0,this._transitions)},r.prototype.each=function(i){for(var a=0;a<this._elements.length;a++){var s=this._elements[a],o=s.__data__;i.call(s,o,a)}return this},r.prototype.attr=function(i,a){var s=typeof a!="function"?function(){return a}:a;return this.each(function(o,l){a!==void 0&&(this[i]=s.call(this,o,l))})},r.prototype.style=function(i,a,s){s===void 0&&(s=!0);var o=typeof a!="function"||!s?function(){return a}:a;return this.each(function(l,u){a!==void 0&&(this.style[i]=o.call(this,l,u))})},r.prototype.styles=function(i,a){return i===void 0&&(i={}),a===void 0&&(a=!0),this.each(function(s,o){var l=this;Object.entries(i).forEach(function(u){var c=z(u,2),h=c[0],d=c[1],g=typeof d!="function"||!a?function(){return d}:d;d!==void 0&&l.attr(h,g.call(l,s,o))})})},r.prototype.update=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.maybeUpdate=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.transition=function(i){var a=this._transitions;return this.each(function(s,o){a[o]=i.call(this,s,o)})},r.prototype.on=function(i,a){return this.each(function(){this.addEventListener(i,a)}),this},r.prototype.call=function(i){for(var a=[],s=1;s<arguments.length;s++)a[s-1]=arguments[s];return i.call.apply(i,vt([this._parent,this],z(a),!1)),this},r.prototype.node=function(){return this._elements[0]},r.prototype.nodes=function(){return this._elements},r.prototype.transitions=function(){return this._transitions.filter(function(i){return!!i})},r.prototype.parent=function(){return this._parent};var t,e,n;return e=r,t=new WeakSet,n=function(a,s){var o=this._elements[0],l=o.querySelector(a);if(l)return new e([l],null,this._parent,this._document);var u=typeof s=="string"?this.createElement(s):s();return o.appendChild(u),new e([u],null,this._parent,this._document)},r.registry={g:Mn,rect:Nn,circle:Ya,path:jr,text:$E,ellipse:Rc,image:Ic,line:Fo,polygon:Vo,polyline:c0,html:Lc},r}();function _t(r){return new Qht([r],null,r,r.ownerDocument)}function tdt(r,t,e){return r.querySelector(t)?_t(r).select(t):_t(r).append(e)}function Wn(r){if(yt(r))return[r,r,r,r];if(Yr(r)){var t=r.length;if(t===1)return[r[0],r[0],r[0],r[0]];if(t===2)return[r[0],r[1],r[0],r[1]];if(t===3)return[r[0],r[1],r[2],r[1]];if(t===4)return r}return[0,0,0,0]}function mN(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=z([e,n],2),a=z(i[0],2),s=a[0],o=a[1],l=z(i[1],2),u=l[0],c=l[1];return{x:s,y:o,width:u-s,height:c-o,left:s,bottom:c,top:o,right:u}}function edt(r,t){var e=z(r,2),n=e[0],i=e[1],a=z(t,2),s=a[0],o=a[1];return n!==s&&i===o}function ndt(r,t){var e,n,i=t.attributes;try{for(var a=Ac(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=z(s.value,2),l=o[0],u=o[1];l!=="id"&&l!=="className"&&r.attr(l,u)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function WE(r){return r.toString().charAt(0).toUpperCase()+r.toString().slice(1)}function rdt(r){return r.toString().charAt(0).toLowerCase()+r.toString().slice(1)}function idt(r,t){return"".concat(t).concat(WE(r))}function yN(r,t,e){var n;e===void 0&&(e=!0);var i=t||((n=r.match(/^([a-z][a-z0-9]+)/))===null||n===void 0?void 0:n[0])||"",a=r.replace(new RegExp("^(".concat(i,")")),"");return e?rdt(a):a}function adt(r,t){Object.entries(t).forEach(function(e){var n=z(e,2),i=n[0],a=n[1];vt([r],z(r.querySelectorAll(i)),!1).filter(function(s){return s.matches(i)}).forEach(function(s){if(s){var o=s;o.style.cssText+=Object.entries(a).reduce(function(l,u){return"".concat(l).concat(u.join(":"),";")},"")}})})}var Gd=function(r,t){if(!(r!=null&&r.startsWith(t)))return!1;var e=r[t.length];return e>="A"&&e<="Z"};function Rt(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=z(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(Gd(s,"show")&&Gd(yN(s,"show"),t)!==e)s===idt(t,"show")?n[s]=o:n[s.replace(new RegExp(WE(t)),"")]=o;else if(!Gd(s,"show")&&Gd(s,t)!==e){var l=yN(s,t);l==="filter"&&typeof o=="function"||(n[l]=o)}}}),n}function Pl(r,t){return Object.entries(r).reduce(function(e,n){var i=z(n,2),a=i[0],s=i[1];return a.startsWith("show")?e["show".concat(t).concat(a.slice(4))]=s:e["".concat(t).concat(WE(a))]=s,e},{})}function Ua(r,t){t===void 0&&(t=["x","y","class","className"]);var e=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],n={},i={};return Object.entries(r).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=l:n[o]=l)}),[n,i]}function mr(r,t){var e={YYYY:r.getFullYear(),MM:r.getMonth()+1,DD:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds()},n=t;return Object.keys(e).forEach(function(i){var a=e[i];n=n.replace(i,i==="YYYY"?"".concat(a):"".concat(a).padStart(2,"0"))}),n}function sdt(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=z([t,e].map(function(u,c){var h;return u.includes("%")?parseFloat(((h=u.match(/[+-]?([0-9]*[.])?[0-9]+/))===null||h===void 0?void 0:h[0])||"0")/100*(c===0?i:a):u}),2),o=s[0],l=s[1];return[o,l]}function F5(r,t){if(t)try{var e=/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,n=t.replace(e,function(i,a,s){return"translate(".concat(sdt(r,a,s),")")});r.attr("transform",n)}catch{}}function odt(r){var t;return((t=r[0])===null||t===void 0?void 0:t.map(function(e,n){return r.map(function(i){return i[n]})}))||[]}var bN=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,vt([],z(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function ldt(){Eg(this,this.attributes.visibility!=="hidden")}var nn=function(r){Ut(t,r);function t(e,n){n===void 0&&(n={});var i=r.call(this,Rn({},{style:n},e))||this;return i.initialized=!1,i._defaultOptions=n,i}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=O5(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),t.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t.prototype.attributeChangedCallback=function(e){e==="visibility"&&ldt.call(this)},t.prototype.update=function(e,n){var i;return this.attr(Rn({},this.attributes,e||{})),(i=this.render)===null||i===void 0?void 0:i.call(this,this.attributes,this,n)},t.prototype.clear=function(){this.removeChildren()},t.prototype.bindEvents=function(e,n){},t.prototype.getSubShapeStyle=function(e){e.x,e.y,e.transform,e.transformOrigin,e.class,e.className,e.zIndex;var n=en(e,["x","y","transform","transformOrigin","class","className","zIndex"]);return n},t}(jx),B5=function(r,t,e){return[["M",r-e,t],["A",e,e,0,1,0,r+e,t],["A",e,e,0,1,0,r-e,t],["Z"]]},udt=B5,cdt=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t-e],["L",r+e,t+e],["L",r-e,t+e],["Z"]]},hdt=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},ddt=function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t+n],["L",r,t-n],["L",r+e,t+n],["Z"]]},fdt=function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t-n],["L",r+e,t-n],["L",r,t+n],["Z"]]},gdt=function(r,t,e){var n=e/2*Math.sqrt(3);return[["M",r,t-e],["L",r+n,t-e/2],["L",r+n,t+e/2],["L",r,t+e],["L",r-n,t+e/2],["L",r-n,t-e/2],["Z"]]},pdt=function(r,t,e){var n=e-1.5;return[["M",r-e,t-n],["L",r+e,t+n],["L",r+e,t-n],["L",r-e,t+n],["Z"]]},z5=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},vdt=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t+e],["M",r+e,t-e],["L",r-e,t+e]]},mdt=function(r,t,e){return[["M",r-e/2,t-e],["L",r+e/2,t-e],["M",r,t-e],["L",r,t+e],["M",r-e/2,t+e],["L",r+e/2,t+e]]},ydt=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},bdt=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},$5=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},wdt=$5,xdt=function(r,t,e){return[["M",r-e,t],["A",e/2,e/2,0,1,1,r,t],["A",e/2,e/2,0,1,0,r+e,t]]},Edt=function(r,t,e){return[["M",r-e-1,t-2.5],["L",r,t-2.5],["L",r,t+2.5],["L",r+e+1,t+2.5]]},_dt=function(r,t,e){return[["M",r-e-1,t+2.5],["L",r,t+2.5],["L",r,t-2.5],["L",r+e+1,t-2.5]]},Sdt=function(r,t,e){return[["M",r-(e+1),t+2.5],["L",r-e/2,t+2.5],["L",r-e/2,t-2.5],["L",r+e/2,t-2.5],["L",r+e/2,t+2.5],["L",r+e+1,t+2.5]]};function Mdt(r,t){return[["M",r-5,t+2.5],["L",r-5,t],["L",r,t],["L",r,t-3],["L",r,t+3],["L",r+6.5,t+3]]}var kdt=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]};function Cdt(r){var t="default";if(un(r)&&r instanceof Image)t="image";else if(Et(r))t="symbol";else if(se(r)){var e=new RegExp("data:(image|text)");r.match(e)?t="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(r)?t="url":t="symbol"}return t}function Tdt(r){var t=Cdt(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var xe=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=this.getSubShapeStyle(e),u=l.symbol,c=l.size,h=c===void 0?16:c,d=en(l,["symbol","size"]),g=Tdt(u);Hr(!!g,_t(n),function(p){p.maybeAppendByClassName("marker",g).attr("className","marker ".concat(g,"-marker")).call(function(v){if(g==="image"){var m=h*2;v.styles({img:u,width:m,height:m,x:a-h,y:o-h})}else{var m=h/2,b=Et(u)?u:t.getSymbol(u);v.styles(et({d:b==null?void 0:b(a,o,m)},d))}})})},t.MARKER_SYMBOL_MAP=new Map,t.registerSymbol=function(e,n){t.MARKER_SYMBOL_MAP.set(e,n)},t.getSymbol=function(e){return t.MARKER_SYMBOL_MAP.get(e)},t.getSymbols=function(){return Array.from(t.MARKER_SYMBOL_MAP.keys())},t}(nn);xe.registerSymbol("cross",vdt);xe.registerSymbol("hyphen",bdt);xe.registerSymbol("line",z5);xe.registerSymbol("plus",ydt);xe.registerSymbol("tick",mdt);xe.registerSymbol("circle",B5);xe.registerSymbol("point",udt);xe.registerSymbol("bowtie",pdt);xe.registerSymbol("hexagon",gdt);xe.registerSymbol("square",cdt);xe.registerSymbol("diamond",hdt);xe.registerSymbol("triangle",ddt);xe.registerSymbol("triangle-down",fdt);xe.registerSymbol("line",z5);xe.registerSymbol("dot",$5);xe.registerSymbol("dash",wdt);xe.registerSymbol("smooth",xdt);xe.registerSymbol("hv",Edt);xe.registerSymbol("vh",_dt);xe.registerSymbol("hvh",Sdt);xe.registerSymbol("vhv",Mdt);function Xf(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function fx(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function Odt(r,t){const e=t<r?t:r,n=r>t?r:t;return i=>Math.min(Math.max(e,i),n)}function Adt(r,t,e,n,i){let a=e,s=n||r.length;const o=l=>l;for(;a<s;){const l=Math.floor((a+s)/2);o(r[l])>t?s=l:a=l+1}return a}const wN=Math.sqrt(50),xN=Math.sqrt(10),EN=Math.sqrt(2);function of(r,t,e){const n=(t-r)/Math.max(0,e),i=Math.floor(Math.log(n)/Math.LN10),a=n/10**i;return i>=0?(a>=wN?10:a>=xN?5:a>=EN?2:1)*10**i:-(10**-i)/(a>=wN?10:a>=xN?5:a>=EN?2:1)}const Pdt=(r,t,e=5)=>{const n=[r,t];let i=0,a=n.length-1,s=n[i],o=n[a],l;return o<s&&([s,o]=[o,s],[i,a]=[a,i]),l=of(s,o,e),l>0?(s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l,l=of(s,o,e)):l<0&&(s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l,l=of(s,o,e)),l>0?(n[i]=Math.floor(s/l)*l,n[a]=Math.ceil(o/l)*l):l<0&&(n[i]=Math.ceil(s*l)/l,n[a]=Math.floor(o*l)/l),n};function _N(r){return!Nt(r)&&!PW(r)&&!Number.isNaN(r)}var j5={exports:{}},Ndt={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]},q5={exports:{}},Rdt=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")},Ldt=Rdt,Idt=Array.prototype.concat,Ddt=Array.prototype.slice,SN=q5.exports=function(t){for(var e=[],n=0,i=t.length;n<i;n++){var a=t[n];Ldt(a)?e=Idt.call(e,Ddt.call(a)):e.push(a)}return e};SN.wrap=function(r){return function(){return r(SN(arguments))}};var Fdt=q5.exports,oc=Ndt,Zc=Fdt,W5=Object.hasOwnProperty,G5=Object.create(null);for(var Kb in oc)W5.call(oc,Kb)&&(G5[oc[Kb]]=Kb);var Wr=j5.exports={to:{},get:{}};Wr.get=function(r){var t=r.substring(0,3).toLowerCase(),e,n;switch(t){case"hsl":e=Wr.get.hsl(r),n="hsl";break;case"hwb":e=Wr.get.hwb(r),n="hwb";break;default:e=Wr.get.rgb(r),n="rgb";break}return e?{model:n,value:e}:null};Wr.get.rgb=function(r){if(!r)return null;var t=/^#([a-f0-9]{3,4})$/i,e=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,s=[0,0,0,1],o,l,u;if(o=r.match(e)){for(u=o[2],o=o[1],l=0;l<3;l++){var c=l*2;s[l]=parseInt(o.slice(c,c+2),16)}u&&(s[3]=parseInt(u,16)/255)}else if(o=r.match(t)){for(o=o[1],u=o[3],l=0;l<3;l++)s[l]=parseInt(o[l]+o[l],16);u&&(s[3]=parseInt(u+u,16)/255)}else if(o=r.match(n)){for(l=0;l<3;l++)s[l]=parseInt(o[l+1],0);o[4]&&(o[5]?s[3]=parseFloat(o[4])*.01:s[3]=parseFloat(o[4]))}else if(o=r.match(i)){for(l=0;l<3;l++)s[l]=Math.round(parseFloat(o[l+1])*2.55);o[4]&&(o[5]?s[3]=parseFloat(o[4])*.01:s[3]=parseFloat(o[4]))}else return(o=r.match(a))?o[1]==="transparent"?[0,0,0,0]:W5.call(oc,o[1])?(s=oc[o[1]],s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=Fs(s[l],0,255);return s[3]=Fs(s[3],0,1),s};Wr.get.hsl=function(r){if(!r)return null;var t=/^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*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Fs(parseFloat(e[2]),0,100),s=Fs(parseFloat(e[3]),0,100),o=Fs(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};Wr.get.hwb=function(r){if(!r)return null;var t=/^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*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Fs(parseFloat(e[2]),0,100),s=Fs(parseFloat(e[3]),0,100),o=Fs(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};Wr.to.hex=function(){var r=Zc(arguments);return"#"+Vd(r[0])+Vd(r[1])+Vd(r[2])+(r[3]<1?Vd(Math.round(r[3]*255)):"")};Wr.to.rgb=function(){var r=Zc(arguments);return r.length<4||r[3]===1?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"};Wr.to.rgb.percent=function(){var r=Zc(arguments),t=Math.round(r[0]/255*100),e=Math.round(r[1]/255*100),n=Math.round(r[2]/255*100);return r.length<4||r[3]===1?"rgb("+t+"%, "+e+"%, "+n+"%)":"rgba("+t+"%, "+e+"%, "+n+"%, "+r[3]+")"};Wr.to.hsl=function(){var r=Zc(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"};Wr.to.hwb=function(){var r=Zc(arguments),t="";return r.length>=4&&r[3]!==1&&(t=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+t+")"};Wr.to.keyword=function(r){return G5[r.slice(0,3)]};function Fs(r,t,e){return Math.min(Math.max(t,r),e)}function Vd(r){var t=Math.round(r).toString(16).toUpperCase();return t.length<2?"0"+t:t}var Bdt=j5.exports;const zdt=i0(Bdt);function Zb(r,t,e){let n=e;return n<0&&(n+=1),n>1&&(n-=1),n<1/6?r+(t-r)*6*n:n<1/2?t:n<2/3?r+(t-r)*(2/3-n)*6:r}function $dt(r){const t=r[0]/360,e=r[1]/100,n=r[2]/100,i=r[3];if(e===0)return[n*255,n*255,n*255,i];const a=n<.5?n*(1+e):n+e-n*e,s=2*n-a,o=Zb(s,a,t+1/3),l=Zb(s,a,t),u=Zb(s,a,t-1/3);return[o*255,l*255,u*255,i]}function MN(r){const t=zdt.get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?$dt(n):null}const Kf=(r,t)=>e=>r*(1-e)+t*e,jdt=(r,t)=>{const e=MN(r),n=MN(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let c=0;c<4;c+=1){const h=e[c],d=n[c];a[c]=h*(1-i)+d*i}const[s,o,l,u]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(l)}, ${u})`}},qdt=(r,t)=>typeof r=="number"&&typeof t=="number"?Kf(r,t):typeof r=="string"&&typeof t=="string"?jdt(r,t):()=>r,Wdt=(r,t)=>{const e=Kf(r,t);return n=>Math.round(e(n))};function kN({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):e}function Gdt({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):(r.set(n,e),e)}function Vdt({map:r,initKey:t},e){const n=t(e);return r.has(n)&&(e=r.get(n),r.delete(n)),e}function Hdt(r){return typeof r=="object"?r.valueOf():r}class CN extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=Hdt,t!==null)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(kN({map:this.map,initKey:this.initKey},t))}has(t){return super.has(kN({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(Gdt({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(Vdt({map:this.map,initKey:this.initKey},t))}}class V5{constructor(t){this.options=cr({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=cr({},this.options,t),this.rescale(t)}rescale(t){}}const GE=Symbol("defaultUnknown");function TN(r,t,e){for(let n=0;n<t.length;n+=1)r.has(t[n])||r.set(e(t[n]),n)}function ON(r){const{value:t,from:e,to:n,mapper:i,notFoundReturn:a}=r;let s=i.get(t);if(s===void 0){if(a!==GE)return a;s=e.push(t)-1,i.set(t,s)}return n[s%n.length]}function AN(r){return r instanceof Date?t=>`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class VE extends V5{getDefaultOptions(){return{domain:[],range:[],unknown:GE}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&TN(this.domainIndexMap,this.getDomain(),this.domainKey),ON({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&TN(this.rangeIndexMap,this.getRange(),this.rangeKey),ON({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=AN(e),this.rangeKey=AN(n),!this.rangeIndexMap){this.rangeIndexMap=new Map,this.domainIndexMap=new Map;return}(!t||t.range)&&this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new VE(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 Udt(r){const t=Math.min(...r);return r.map(e=>e/t)}function Ydt(r,t){const e=r.length,n=t-e;return n>0?[...r,...new Array(n).fill(1)]:n<0?r.slice(0,t):r}function Xdt(r){return Math.round(r*1e12)/1e12}function Kdt(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,l=t.length,u=Ydt(a,l),[c,h]=e,d=h-c,g=2/l*n+1-1/l*i,p=d/g,v=p*i/l,m=p-l*v,b=Udt(u),w=b.reduce((R,L)=>R+L),x=m/w,S=new CN(t.map((R,L)=>{const $=b[L]*x;return[R,s?Math.floor($):$]})),_=new CN(t.map((R,L)=>{const q=b[L]*x+v;return[R,s?Math.floor(q):q]})),k=Array.from(_.values()).reduce((R,L)=>R+L),C=(d-(k-k/l*i))*o,P=c+C;let T=s?Math.round(P):P;const A=new Array(l);for(let R=0;R<l;R+=1){A[R]=Xdt(T);const L=t[R];T+=_.get(L)}return{valueBandWidth:S,valueStep:_,adjustedRange:A}}function Zdt(r){var t;const{domain:e}=r,n=e.length;if(n===0)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(!!(!((t=r.flex)===null||t===void 0)&&t.length))return Kdt(r);const{range:a,paddingOuter:s,paddingInner:o,round:l,align:u}=r;let c,h,d=a[0];const p=a[1]-d,v=s*2,m=n-o;c=p/Math.max(1,v+m),l&&(c=Math.floor(c)),d+=(p-c*(n-o))*u,h=c*(1-o),l&&(d=Math.round(d),h=Math.round(h));const b=new Array(n).fill(0).map((w,x)=>d+x*c);return{valueStep:c,valueBandWidth:h,adjustedRange:b}}class HE extends VE{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:GE,flex:[]}}constructor(t){super(t)}clone(){return new HE(this.options)}getStep(t){return this.valueStep===void 0?1:typeof this.valueStep=="number"?this.valueStep:t===void 0?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return this.valueBandWidth===void 0?1:typeof this.valueBandWidth=="number"?this.valueBandWidth:t===void 0?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:i,flex:a}=this.options,{adjustedRange:s,valueBandWidth:o,valueStep:l}=Zdt({align:t,range:n,round:i,flex:a,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=l,this.valueBandWidth=o,this.adjustedRange=s}}const Jdt=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=of(a,s,e);if(o===0||!Number.isFinite(o))return[];if(o>0){a=Math.ceil(a/o),s=Math.floor(s/o),i=new Array(n=Math.ceil(s-a+1));for(let l=0;l<n;l+=1)i[l]=(a+l)*o}else{o=-o,a=Math.ceil(a*o),s=Math.floor(s*o),i=new Array(n=Math.ceil(s-a+1));for(let l=0;l<n;l+=1)i[l]=(a+l)/o}return i},Qdt=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,l;return n<i?(o=fx(n,i),l=e(a,s)):(o=fx(i,n),l=e(s,a)),Xf(l,o)},tft=(r,t,e)=>{const n=Math.min(r.length,t.length)-1,i=new Array(n),a=new Array(n),s=r[0]>r[n],o=s?[...r].reverse():r,l=s?[...t].reverse():t;for(let u=0;u<n;u+=1)i[u]=fx(o[u],o[u+1]),a[u]=e(l[u],l[u+1]);return u=>{const c=Adt(r,u,1,n)-1,h=i[c],d=a[c];return Xf(d,h)(u)}},PN=(r,t,e,n)=>(Math.min(r.length,t.length)>2?tft:Qdt)(r,t,n?Wdt:e);class eft extends V5{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Kf,tickCount:5}}map(t){return _N(t)?this.output(t):this.options.unknown}invert(t){return _N(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...i]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...i)}getTicks(){const{tickMethod:t}=this.options,[e,n,i,...a]=this.getTickMethodOptions();return t(e,n,i,...a)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options,n=t[0],i=t[t.length-1];return[n,i,e]}chooseNice(){return Pdt}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,i=this.options.domain.map(t),a=Math.min(i.length,n.length);return e?Odt(i[0],i[a-1]):fw}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=PN(n.map(t),i,s,a);this.output=Xf(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=PN(a,i.map(t),Kf);this.input=Xf(e,n,s)}}class lc extends eft{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:qdt,tickMethod:Jdt,tickCount:5}}chooseTransforms(){return[fw,fw]}clone(){return new lc(this.options)}}var nft=function(r){Ut(t,r);function t(e){var n=this,i=e.style,a=en(e,["style"]);return n=r.call(this,cr({},{type:"column"},et({style:i},a)))||this,n.columnsGroup=new Mn({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.columns,i=e.x,a=e.y;this.columnsGroup.style.transform="translate(".concat(i,", ").concat(a,")"),_t(this.columnsGroup).selectAll(".column").data(n.flat()).join(function(s){return s.append("rect").attr("className","column").each(function(o){this.attr(o)})},function(s){return s.each(function(o){this.attr(o)})},function(s){return s.remove()})},t.prototype.update=function(e){this.attr(Rn({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(Re),rft=function(r){Ut(t,r);function t(e){var n=this,i=e.style,a=en(e,["style"]);return n=r.call(this,cr({},{type:"lines"},et({style:i},a)))||this,n.linesGroup=n.appendChild(new Mn),n.areasGroup=n.appendChild(new Mn),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.lines,i=e.areas,a=e.x,s=e.y;this.style.transform="translate(".concat(a,", ").concat(s,")"),n&&this.renderLines(n),i&&this.renderAreas(i)},t.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},t.prototype.update=function(e){this.attr(Rn({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){_t(this.linesGroup).selectAll(".line").data(e).join(function(n){return n.append("path").attr("className","line").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.attr(i)})},function(n){return n.remove()})},t.prototype.renderAreas=function(e){_t(this.linesGroup).selectAll(".area").data(e).join(function(n){return n.append("path").attr("className","area").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.style(i)})},function(n){return n.remove()})},t}(Re);function ift(r,t){var e,n=t.x,i=t.y,a=z(i.getOptions().range||[0,0],2),s=a[0],o=a[1];return o>s&&(e=z([s,o],2),o=e[0],s=e[1]),r.map(function(l){var u=l.map(function(c,h){return[n.map(h),Ke(i.map(c),o,s)]});return u})}function Sc(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return vt([a===e?"M":"L"],z(i),!1)});return t?n.reverse():n}function Zf(r,t){if(t===void 0&&(t=!1),r.length<=2)return Sc(r);for(var e=[],n=r.length,i=0;i<n;i+=1){var a=t?r[n-i-1]:r[i];Ze(a,e.slice(-2))||e.push.apply(e,vt([],z(a),!1))}var s=Uht(e);return t?s.unshift(vt(["M"],z(r[n-1]),!1)):s.unshift(vt(["M"],z(r[0]),!1)),s}function UE(r,t,e){var n=$s(r);return n.push(["L",t,e],["L",0,e],["Z"]),n}function aft(r,t,e,n){return r.map(function(i){return UE(t?Zf(i):Sc(i),e,n)})}function sft(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Sc(a),o=void 0;if(i===0)o=UE(s,t,e);else{var l=r[i-1],u=Sc(l,!0);u[0][0]="L",o=vt(vt(vt([],z(s),!1),z(u),!1),[["Z"]],!1)}n.push(o)}return n}function oft(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Zf(a),o=void 0;if(i===0)o=UE(s,t,e);else{var l=r[i-1],u=Zf(l,!0),c=a[0];u[0][0]="L",o=vt(vt(vt([],z(s),!1),z(u),!1),[vt(["M"],z(c),!1),["Z"]],!1)}n.push(o)}return n}function NN(r){return r.length===0?[0,0]:[vf(MW(r,function(t){return vf(t)||0})),pf(SW(r,function(t){return pf(t)||0}))]}function RN(r){for(var t=$s(r),e=t[0].length,n=z([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s<t.length;s+=1)for(var o=t[s],l=0;l<e;l+=1)o[l]>=0?(o[l]+=i[l],i[l]=o[l]):(o[l]+=a[l],a[l]=o[l]);return t}var lft=function(r){Ut(t,r);function t(e){return r.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 Object.defineProperty(t.prototype,"rawData",{get:function(){var e=this.attributes.data;if(!e||(e==null?void 0:e.length)===0)return[[]];var n=$s(e);return yt(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?RN(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseline",{get:function(){var e=this.scales.y,n=z(e.getOptions().domain||[0,0],2),i=n[0],a=n[1];return a<0?e.map(a):e.map(i<0?0:i)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"containerShape",{get:function(){var e=this.attributes,n=e.width,i=e.height;return{width:n,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linesStyle",{get:function(){var e=this,n=this.attributes,i=n.type,a=n.isStack,s=n.smooth;if(i!=="line")throw new Error("linesStyle can only be used in line type");var o=Rt(this.attributes,"area"),l=Rt(this.attributes,"line"),u=this.containerShape.width,c=this.data;if(c[0].length===0)return{lines:[],areas:[]};var h=this.scales,d=h.x,g=h.y,p=ift(c,{x:d,y:g}),v=[];if(o){var m=this.baseline;a?v=s?oft(p,u,m):sft(p,u,m):v=aft(p,s,u,m)}return{lines:p.map(function(b,w){return et({stroke:e.getColor(w),d:s?Zf(b):Sc(b)},l)}),areas:v.map(function(b,w){return et({d:b,fill:e.getColor(w)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=Rt(this.attributes,"column"),i=this.attributes,a=i.isStack,s=i.type,o=i.scale;if(s!=="column")throw new Error("columnsStyle can only be used in column type");var l=this.containerShape.height,u=this.rawData;if(!u)return{columns:[]};a&&(u=RN(u));var c=this.createScales(u),h=c.x,d=c.y,g=z(NN(u),2),p=g[0],v=g[1],m=new lc({domain:[0,v-(p>0?0:p)],range:[0,l*o]}),b=h.getBandWidth(),w=this.rawData;return{columns:u.map(function(x,S){return x.map(function(_,k){var M=b/u.length,C=function(){return{x:h.map(k)+M*S,y:_>=0?d.map(_):d.map(0),width:M,height:m.map(Math.abs(_))}},P=function(){return{x:h.map(k),y:d.map(_),width:b,height:m.map(w[S][k])}};return et(et({fill:e.getColor(S)},n),a?P():C())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){tdt(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),l=et({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);_t(n).selectAll(".spark").data([i]).join(function(u){return u.append(function(c){return c==="line"?new rft({className:o,style:l}):new nft({className:o,style:l})}).attr("className","spark ".concat(o))},function(u){return u.update(l)},function(u){return u.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Yr(n)?n[e%n.length]:Et(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,l=a.range,u=l===void 0?[]:l,c=a.spacing,h=this.containerShape,d=h.width,g=h.height,p=z(NN(e),2),v=p[0],m=p[1],b=new lc({domain:[(n=u[0])!==null&&n!==void 0?n:v,(i=u[1])!==null&&i!==void 0?i:m],range:[g,g*(1-o)]});return s==="line"?{type:s,x:new lc({domain:[0,e[0].length-1],range:[0,d]}),y:b}:{type:s,x:new HE({domain:e[0].map(function(w,x){return x}),range:[0,d],paddingInner:c,paddingOuter:c/2,align:.5}),y:b}},t.tag="sparkline",t}(nn);function uft(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function LN(r){if(!r)return{enter:!1,update:!1,exit:!1};var t=["enter","update","exit"],e=Object.fromEntries(Object.entries(r).filter(function(n){var i=z(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return uft(r)?r[n]===!1?[n,!1]:[n,et(et({},r[n]),e)]:[n,e]}))}function uu(r,t){r?r.finished.then(t):t()}function cft(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function H5(r,t){"update"in r?r.update(t):r.attr(t)}function U5(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return H5(r,{style:n}),null}return r.animate(t,e)}function hft(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function dft(r,t,e,n){if(n===void 0&&(n="destroy"),hft(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&Li(r),t.isVisible()&&Kc(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,l=o===void 0?0:o,u=Math.ceil(+s/2),c=+s/4,h=z(r.getGeometryBounds().center,2),d=h[0],g=h[1],p=z(t.getGeometryBounds().center,2),v=p[0],m=p[1],b=z([(d+v)/2-d,(g+m)/2-g],2),w=b[0],x=b[1],S=r.style.opacity,_=S===void 0?1:S,k=t.style.opacity,M=k===void 0?1:k,C=r.style.transform||"",P=t.style.transform||"",T=r.animate([{opacity:_,transform:"translate(0, 0) ".concat(C)},{opacity:0,transform:"translate(".concat(w,", ").concat(x,") ").concat(C)}],et(et({fill:"both"},e),{duration:l+u+c})),A=t.animate([{opacity:0,transform:"translate(".concat(-w,", ").concat(-x,") ").concat(P),offset:.01},{opacity:M,transform:"translate(0, 0) ".concat(P)}],et(et({fill:"both"},e),{duration:u+c,delay:l+u-c}));return uu(A,i),[T,A]}function Ii(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];if(!kt(l)){var u=r.style[o]||r.parsedStyle[o]||0;u!==l&&(n[o]=u,i[o]=l)}}),e?U5(r,[n,i],et({fill:"both"},e)):(H5(r,i),null)}function _g(r,t){return r.style.opacity||(r.style.opacity=1),Ii(r,{opacity:0},t)}var Y5={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},X5={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},K5={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},Xi=$i({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),Es=$i({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),fft=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=e.y,s=e.size,o=s===void 0?10:s,l=e.radius,u=l===void 0?o/4:l,c=e.orientation,h=en(e,["x","y","size","radius","orientation"]),d=o,g=d*2.4,p=_t(n).maybeAppendByClassName(Es.iconRect,"rect").styles(et(et({},h),{width:d,height:g,radius:u,x:i-d/2,y:a-g/2,transformOrigin:"center"})),v=i+1/3*d-d/2,m=i+2/3*d-d/2,b=a+1/4*g-g/2,w=a+3/4*g-g/2;p.maybeAppendByClassName("".concat(Es.iconLine,"-1"),"line").styles(et({x1:v,x2:v,y1:b,y2:w},h)),p.maybeAppendByClassName("".concat(Es.iconLine,"-2"),"line").styles(et({x1:m,x2:m,y1:b,y2:w},h)),c==="vertical"&&(p.node().style.transform="rotate(90)")},t}(nn),gft=function(r){Ut(t,r);function t(e){return r.call(this,e,K5)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,l=Rt(this.attributes,"label"),u=l.x,c=u===void 0?0:u,h=l.y,d=h===void 0?0:h,g=l.transform,p=l.transformOrigin,v=en(l,["x","y","transform","transformOrigin"]),m=z(Ua(v,[]),2),b=m[0],w=m[1],x=_t(e).maybeAppendByClassName(Es.labelGroup,"g").styles(w),S=et(et({},X5),b),_=S.text,k=en(S,["text"]);Hr(!!o,x,function(M){n.label=M.maybeAppendByClassName(Es.label,"text").styles(et(et({},k),{x:a+c,y:s+d,transform:g,transformOrigin:p,text:"".concat(_)})),n.label.on("mousedown",function(C){C.stopPropagation()}),n.label.on("touchstart",function(C){C.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,l=et(et({x:i,y:a,orientation:s},Y5),Rt(this.attributes,"icon")),u=this.attributes.iconShape,c=u===void 0?function(){return new fft({style:l})}:u,h=_t(e).maybeAppendByClassName(Es.iconGroup,"g");h.selectAll(Es.icon.class).data([c]).join(function(d){return d.append(typeof c=="string"?c:function(){return c(o)}).attr("className",Es.icon.name)},function(d){return d.update(l)},function(d){return d.remove()})},t.prototype.render=function(e,n){this.renderIcon(n),this.renderLabel(n)},t}(nn),pft=function(r){Ut(t,r);function t(e){var n=r.call(this,e,et(et(et({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(i){return i.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},Pl(K5,"handle")),Pl(Y5,"handleIcon")),Pl(X5,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(fN(a));var s=n.availableSpace,o=s.x,l=s.y,u=n.getBBox(),c=u.x,h=u.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,l])-n.getOrientVal([+c,+h])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(i){var a=n.attributes,s=a.slidable,o=a.brushable,l=a.type;i.stopPropagation();var u=n.getOrientVal(fN(i)),c=u-n.prevPos;if(c){var h=n.getRatio(c);switch(n.target){case"start":s&&n.setValuesOffset(h);break;case"end":s&&n.setValuesOffset(0,h);break;case"selection":s&&n.setValuesOffset(h,h);break;case"track":if(!o)return;n.selectionWidth+=h,l==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break}n.prevPos=u}},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(i){var a=n.attributes,s=a.onChange,o=a.type,l=o==="range"?i:i[1],u=o==="range"?n.getValues():n.getValues()[1],c=new dn("valuechange",{detail:{oldValue:l,value:u}});n.dispatchEvent(c),s==null||s(u)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Object.defineProperty(t.prototype,"values",{get:function(){return this.attributes.values},set:function(e){this.attributes.values=this.clampValues(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sparklineStyle",{get:function(){var e=this.attributes.orientation;if(e!=="horizontal")return null;var n=Rt(this.attributes,"sparkline");return et(et({zIndex:0},this.availableSpace),n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e=this.attributes,n=e.trackLength,i=e.trackSize,a=z(this.getOrientVal([[n,i],[i,n]]),2),s=a[0],o=a[1];return{width:s,height:o}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes;e.x,e.y;var n=e.padding,i=z(Wn(n),4),a=i[0],s=i[1],o=i[2],l=i[3],u=this.shape,c=u.width,h=u.height;return{x:l,y:a,width:c-(l+s),height:h-(a+o)}},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.values},t.prototype.setValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1),this.attributes.values=e;var i=n===!1?!1:this.attributes.animate;this.updateSelectionArea(i),this.updateHandlesPosition(i)},t.prototype.updateSelectionArea=function(e){var n=this.calcSelectionArea();this.foregroundGroup.selectAll(Xi.selection.class).each(function(i,a){Ii(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&Ii(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&Ii(this.endHandle,this.getHandleStyle("end"),e))},t.prototype.innerSetValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1);var i=this.values,a=this.clampValues(e);this.attributes.values=a,this.setValues(a),n&&this.onValueChange(i)},t.prototype.renderTrack=function(e){var n=this.attributes,i=n.x,a=n.y,s=Rt(this.attributes,"track");this.trackShape=_t(e).maybeAppendByClassName(Xi.track,"rect").styles(et(et({x:i,y:a},this.shape),s))},t.prototype.renderBrushArea=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.brushable;this.brushArea=_t(e).maybeAppendByClassName(Xi.brushArea,"rect").styles(et({x:i,y:a,fill:"transparent",cursor:s?"crosshair":"default"},this.shape))},t.prototype.renderSparkline=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.orientation,l=_t(e).maybeAppendByClassName(Xi.sparklineGroup,"g");Hr(o==="horizontal",l,function(u){var c=et(et({},n.sparklineStyle),{x:a,y:s});u.maybeAppendByClassName(Xi.sparkline,function(){return new lft({style:c})}).update(c)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],l=a?o:[],u=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(Xi.handle.class).data(l.map(function(c){return{type:c}}),function(c){return c.type}).join(function(c){return c.append(function(h){var d=h.type;return new gft({style:e.getHandleStyle(d)})}).each(function(h){var d=h.type;this.attr("class","".concat(Xi.handle.name," ").concat(d,"-handle"));var g="".concat(d,"Handle");u[g]=this,this.addEventListener("pointerdown",u.onDragStart(d))})},function(c){return c.each(function(h){var d=h.type;this.update(u.getHandleStyle(d))})},function(c){return c.each(function(h){var d=h.type,g="".concat(d,"Handle");u[g]=void 0}).remove()})},t.prototype.renderSelection=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.type,o=n.selectionType;this.foregroundGroup=_t(e).maybeAppendByClassName(Xi.foreground,"g");var l=Rt(this.attributes,"selection"),u=function(h){return h.style("visibility",function(d){return d.show?"visible":"hidden"}).style("cursor",function(d){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles(et(et({},l),{transform:"translate(".concat(i,", ").concat(a,")")}))},c=this;this.foregroundGroup.selectAll(Xi.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(h,d){return{style:et({},h),index:d,show:o==="select"?d===1:d!==1}}),function(h){return h.index}).join(function(h){return h.append("rect").attr("className",Xi.selection.name).call(u).each(function(d,g){var p=this;g===1?(c.selectionShape=_t(this),this.on("pointerdown",function(v){p.attr("cursor","grabbing"),c.onDragStart("selection")(v)}),c.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),c.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),c.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){p.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){p.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){p.attr("cursor","pointer")})):this.on("pointerdown",c.onDragStart("track"))})},function(h){return h.call(u)},function(h){return h.remove()}),this.updateSelectionArea(!1),this.renderHandles()},t.prototype.render=function(e,n){this.renderTrack(n),this.renderSparkline(n),this.renderBrushArea(n),this.renderSelection(n)},t.prototype.clampValues=function(e,n){var i;n===void 0&&(n=4);var a=z(this.range,2),s=a[0],o=a[1],l=z(this.getValues().map(function(m){return gN(m,n)}),2),u=l[0],c=l[1],h=Array.isArray(e)?e:[u,e??c],d=z((h||[u,c]).map(function(m){return gN(m,n)}),2),g=d[0],p=d[1];if(this.attributes.type==="value")return[0,Ke(p,s,o)];g>p&&(i=z([p,g],2),g=i[0],p=i[1]);var v=p-g;return v>o-s?[s,o]:g<s?u===s&&c===p?[s,p]:[s,v+s]:p>o?c===o&&u===g?[g,o]:[o-v,o]:[g,p]},t.prototype.calcSelectionArea=function(e){var n=z(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,l=s.y,u=s.width,c=s.height;return this.getOrientVal([[{y:l,height:c,x:o,width:i*u},{y:l,height:c,x:i*u+o,width:(a-i)*u},{y:l,height:c,x:a*u,width:(1-a)*u}],[{x:o,width:u,y:l,height:i*c},{x:o,width:u,y:i*c+l,height:(a-i)*c},{x:o,width:u,y:a*c,height:(1-a)*c}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,l=i.height,u=z(this.clampValues(),2),c=u[0],h=u[1],d=e==="start"?-n:n,g=(e==="start"?c:h)*this.getOrientVal([o,l])+d;return{x:a+this.getOrientVal([g,o/2]),y:s+this.getOrientVal([l/2,g])}},t.prototype.inferTextStyle=function(e){var n=this.attributes.orientation;return n==="horizontal"?{}:e==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:e==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},t.prototype.calcHandleText=function(e){var n,i=this.attributes,a=i.type,s=i.orientation,o=i.formatter,l=i.autoFitLabel,u=Rt(this.attributes,"handle"),c=Rt(u,"label"),h=u.spacing,d=this.getHandleSize(),g=this.clampValues(),p=e==="start"?g[0]:g[1],v=o(p),m=new $E({style:et(et(et({},c),this.inferTextStyle(e)),{text:v})}),b=m.getBBox(),w=b.width,x=b.height;if(m.destroy(),!l){if(a==="value")return{text:v,x:0,y:-x-h};var S=h+d+(s==="horizontal"?w/2:0);return n={text:v},n[s==="horizontal"?"x":"y"]=e==="start"?-S:S,n}var _=0,k=0,M=this.availableSpace,C=M.width,P=M.height,T=this.calcSelectionArea()[1],A=T.x,R=T.y,L=T.width,$=T.height,q=h+d;if(s==="horizontal"){var j=q+w/2;if(e==="start"){var B=A-q-w;_=B>0?-j:j}else{var F=C-A-L-q>w;_=F?j:-j}}else{var V=q,X=x+q;e==="start"?k=R-d>x?-X:V:k=P-(R+$)-d>x?X:-V}return{x:_,y:k,text:v}},t.prototype.getHandleLabelStyle=function(e){var n=Rt(this.attributes,"handleLabel");return et(et(et({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=Rt(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return et({cursor:i,shape:e,size:a},n)},t.prototype.getHandleStyle=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.showLabel,o=n.showLabelOnInteraction,l=n.orientation,u=this.calcHandlePosition(e),c=u.x,h=u.y,d=this.calcHandleText(e),g=s;return!s&&o&&(this.target?g=!0:g=!1),et(et(et({},Pl(this.getHandleIconStyle(),"icon")),Pl(et(et({},this.getHandleLabelStyle(e)),d),"label")),{transform:"translate(".concat(c+i,", ").concat(h+a,")"),orientation:l,showLabel:g,type:e,zIndex:3})},t.prototype.getHandleSize=function(){var e=this.attributes,n=e.handleIconSize,i=e.width,a=e.height;return n||Math.floor((this.getOrientVal([+a,+i])+4)/2.4)},t.prototype.getOrientVal=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes.orientation;return s==="horizontal"?i:a},t.prototype.setValuesOffset=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var a=this.attributes.type,s=z(this.getValues(),2),o=s[0],l=s[1],u=a==="range"?e:0,c=[o+u,l+n].sort();i?this.setValues(c):this.innerSetValues(c,!0)},t.prototype.getRatio=function(e){var n=this.availableSpace,i=n.width,a=n.height;return e/this.getOrientVal([i,a])},t.prototype.dispatchCustomEvent=function(e,n,i){var a=this;e.on(n,function(s){s.stopPropagation(),a.dispatchEvent(new dn(i,{detail:s}))})},t.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var e=this.brushArea;this.dispatchCustomEvent(e,"click","trackClick"),this.dispatchCustomEvent(e,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(e,"pointerleave","trackMouseleave"),e.on("pointerdown",this.onDragStart("track"))},t.prototype.onScroll=function(e){var n=this.attributes.scrollable;if(n){var i=e.deltaX,a=e.deltaY,s=a||i,o=this.getRatio(s);this.setValuesOffset(o,o,!0)}},t.tag="slider",t}(nn),YE={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 jr({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:[]};cr({},YE,{style:{type:"arc"}});cr({},YE,{style:{}});var ye=$i({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"),Zl=$i({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function Z5(r){return r.reduce(function(t,e,n){return t.push(vt([n===0?"M":"L"],z(e),!1)),t},[])}function vft(r,t,e){var n=t.connect,i=n===void 0?"line":n,a=t.center;if(i==="line")return Z5(r);if(!a)return[];var s=_c(r[0],a),o=e?0:1;return r.reduce(function(l,u,c){return c===0?l.push(vt(["M"],z(u),!1)):l.push(vt(["A",s,s,0,0,o],z(u),!1)),l},[])}function gx(r,t,e){return t.type==="surround"?vft(r,t,e):Z5(r)}function mft(r,t,e){var n=e.type,i=e.connect,a=e.center,s=e.closed,o=s?[["Z"]]:[],l=z([gx(r,e),gx(t.slice().reverse(),e,!0)],2),u=l[0],c=l[1],h=z([r[0],t.slice(-1)[0]],2),d=h[0],g=h[1],p=function(w,x){return[u,w,c,x,o].flat()};if(i==="line"||n==="surround")return p([vt(["L"],z(g),!1)],[vt(["L"],z(d),!1)]);if(!a)throw new Error("Arc grid need to specified center");var v=z([_c(g,a),_c(d,a)],2),m=v[0],b=v[1];return p([vt(["A",m,m,0,0,1],z(g),!1),vt(["L"],z(g),!1)],[vt(["A",b,b,0,0,0],z(d),!1),vt(["L"],z(d),!1)])}function yft(r,t,e,n){var i=e.animate,a=e.isBillboard,s=t.map(function(o,l){return{id:o.id||"grid-line-".concat(l),d:gx(o.points,e)}});return r.selectAll(Zl.line.class).data(s,function(o){return o.id}).join(function(o){return o.append("path").each(function(l,u){var c=pi(vN(et({d:l.d},n)),[l,u,s]);this.attr(et({class:Zl.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},c))})},function(o){return o.transition(function(l,u){var c=pi(vN(et({d:l.d},n)),[l,u,s]);return Ii(this,c,i.update)})},function(o){return o.transition(function(){var l=this,u=_g(this,i.exit);return uu(u,function(){return l.remove()}),u})}).transitions()}function bft(r,t,e){var n=e.animate,i=e.connect,a=e.areaFill;if(t.length<2||!a||!i)return[];for(var s=Array.isArray(a)?a:[a,"transparent"],o=function(p){return s[p%s.length]},l=[],u=0;u<t.length-1;u++){var c=z([t[u].points,t[u+1].points],2),h=c[0],d=c[1],g=mft(h,d,e);l.push({d:g,fill:o(u)})}return r.selectAll(Zl.region.class).data(l,function(p,v){return v}).join(function(p){return p.append("path").each(function(v,m){var b=pi(v,[v,m,l]);this.attr(b)}).attr("className",Zl.region.name)},function(p){return p.transition(function(v,m){var b=pi(v,[v,m,l]);return Ii(this,b,n.update)})},function(p){return p.transition(function(){var v=this,m=_g(this,n.exit);return uu(m,function(){return v.remove()}),m})}).transitions()}function wft(r){var t=r.data,e=t===void 0?[]:t,n=r.closed;return n?e.map(function(i){var a=i.points,s=z(a,1),o=s[0];return et(et({},i),{points:vt(vt([],z(a),!1),[o],!1)})}):e}var xft=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){e.type,e.center,e.areaFill,e.closed;var i=en(e,["type","center","areaFill","closed"]),a=wft(e),s=_t(n).maybeAppendByClassName(Zl.lineGroup,"g"),o=_t(n).maybeAppendByClassName(Zl.regionGroup,"g"),l=yft(s,a,e,i),u=bft(o,a,e);return vt(vt([],z(l),!1),z(u),!1)},t}(nn);function J5(r,t){return Object.fromEntries(Object.entries(r).map(function(e){var n=z(e,2),i=n[0],a=n[1];return[i,pi(a,t)]}))}function XE(r,t){return t&&Et(t)?r.filter(t):r}function Q5(r,t){var e=t.startAngle,n=t.endAngle;return(n-e)*r+e}function Sg(r,t){if(t.type==="linear"){var e=z(t.startPos,2),n=e[0],i=e[1],a=z(t.endPos,2),s=a[0],o=a[1],l=z([s-n,o-i],2),u=l[0],c=l[1];return D5([u,c])}var h=Kl(Q5(r,t));return[-Math.sin(h),Math.cos(h)]}function KE(r,t,e){var n=Sg(r,e);return Vht(n,t!=="positive")}function Jc(r,t){return KE(r,t.labelDirection,t)}function Eft(r,t){var e=z(t.startPos,2),n=e[0],i=e[1],a=z(t.endPos,2),s=a[0],o=a[1],l=z([s-n,o-i],2),u=l[0],c=l[1];return[n+u*r,i+c*r]}function _ft(r,t){var e=t.radius,n=z(t.center,2),i=n[0],a=n[1],s=Kl(Q5(r,t));return[i+e*Math.cos(s),a+e*Math.sin(s)]}function Mg(r,t){return t.type==="linear"?Eft(r,t):_ft(r,t)}function t4(r){return Sg(0,r)[1]===0}function e4(r){return Sg(0,r)[0]===0}function n4(r,t){return t-r===360}function IN(r,t,e,n,i){var a=t-r,s=z([i,i],2),o=s[0],l=s[1],u=z([Kl(r),Kl(t)],2),c=u[0],h=u[1],d=function(P){return[e+i*Math.cos(P),n+i*Math.sin(P)]},g=z(d(c),2),p=g[0],v=g[1],m=z(d(h),2),b=m[0],w=m[1];if(n4(r,t)){var x=(h+c)/2,S=z(d(x),2),_=S[0],k=S[1];return[["M",p,v],["A",o,l,0,1,0,_,k],["A",o,l,0,1,0,b,w]]}var M=a>180?1:0,C=r>t?0:1;return"M".concat(p,",").concat(v,",A").concat(o,",").concat(l,",0,").concat(M,",").concat(C,",").concat(b,",").concat(w)}function Sft(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return vt(vt([e,n],z(i),!1),[a],!1)}function Mft(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius;return r.selectAll(ye.line.class).data([{d:IN.apply(void 0,vt(vt([i,a],z(s),!1),[o],!1))}],function(l,u){return u}).join(function(l){return l.append("path").attr("className",ye.line.name).styles(t).styles({d:function(u){return u.d}})},function(l){return l.transition(function(){var u=this,c=Ght(this,Sft(this),vt(vt([i,a],z(s),!1),[o],!1),n.update);if(c){var h=function(){var d=sr(u.attributes,"__keyframe_data__");u.style.d=IN.apply(void 0,vt([],z(d),!1))};c.onframe=h,c.onfinish=h}return c}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function kft(r,t){t.truncRange,t.truncShape,t.lineExtension}function Cft(r,t,e){e===void 0&&(e=[0,0]);var n=z([r,t,e],3),i=z(n[0],2),a=i[0],s=i[1],o=z(n[1],2),l=o[0],u=o[1],c=z(n[2],2),h=c[0],d=c[1],g=z([l-a,u-s],2),p=g[0],v=g[1],m=Math.sqrt(Math.pow(p,2)+Math.pow(v,2)),b=z([-h/m,d/m],2),w=b[0],x=b[1];return[w*p,w*v,x*p,x*v]}function DN(r){var t=z(r,2),e=z(t[0],2),n=e[0],i=e[1],a=z(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function Tft(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,l=t.lineExtension,u=z([a,s],2),c=z(u[0],2),h=c[0],d=c[1],g=z(u[1],2),p=g[0],v=g[1],m=z(l?Cft(a,s,l):new Array(4).fill(0),4),b=m[0],w=m[1],x=m[2],S=m[3],_=function(F){return r.selectAll(ye.line.class).data(F,function(V,X){return X}).join(function(V){return V.append("line").attr("className",function(X){return"".concat(ye.line.name," ").concat(X.className)}).styles(e).transition(function(X){return Ii(this,DN(X.line),!1)})},function(V){return V.styles(e).transition(function(X){var K=X.line;return Ii(this,DN(K),n.update)})},function(V){return V.remove()}).transitions()};if(!i||!o)return _([{line:[[h+b,d+w],[p+x,v+S]],className:ye.line.name}]);var k=z(o,2),M=k[0],C=k[1],P=p-h,T=v-d,A=z([h+P*M,d+T*M],2),R=A[0],L=A[1],$=z([h+P*C,d+T*C],2),q=$[0],j=$[1],B=_([{line:[[h+b,d+w],[R,L]],className:ye.lineFirst.name},{line:[[q,j],[p+x,v+S]],className:ye.lineSecond.name}]);return kft(r,t),B}function Oft(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,l=e.lineArrowSize,u;if(t==="arc"?u=r.select(ye.line.class):a?u=r.select(ye.lineSecond.class):u=r.select(ye.line.class),!i||!s||e.type==="arc"&&n4(e.startAngle,e.endAngle)){var c=u.node();c&&(c.style.markerEnd=void 0);return}var h=Ha(s);h.attr(n),qE(h,l),u.style("markerEnd",h).style("markerEndOffset",-o)}function Aft(r,t,e){var n=t.type,i,a=Rt(t,"line");return n==="linear"?i=Tft(r,t,pN(a,"arrow"),e):i=Mft(r,t,pN(a,"arrow"),e),Oft(r,n,t,a),i}function Pft(r,t){return KE(r,t.gridDirection,t)}function r4(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function Nft(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=z(Mg(a,t),2),o=s[0],l=s[1],u=z(Na(Pft(a,t),e),2),c=u[0],h=u[1];return{id:i,points:[[o,l],[o+c,l+h]]}})}function Rft(r,t){var e=t.gridControlAngles,n=r4(t);if(!n)throw new Error("grid center is not provide");if(r.length<2)throw new Error("Invalid grid data");if(!e||e.length===0)throw new Error("Invalid gridControlAngles");var i=z(n,2),a=i[0],s=i[1];return r.map(function(o,l){var u=o.value,c=z(Mg(u,t),2),h=c[0],d=c[1],g=z([h-a,d-s],2),p=g[0],v=g[1],m=[];return e.forEach(function(b){var w=Kl(b),x=z([Math.cos(w),Math.sin(w)],2),S=x[0],_=x[1],k=p*S-v*_+a,M=p*_+v*S+s;m.push([k,M])}),{points:m,id:l}})}function Lft(r,t,e,n){var i=Rt(e,"grid"),a=i.type,s=i.areaFill,o=r4(e),l=XE(t,e.gridFilter),u=a==="segment"?Nft(l,e):Rft(l,e),c=et(et({},i),{center:o,areaFill:Et(s)?l.map(function(h,d){return pi(s,[h,d,l])}):s,animate:n,data:u});return r.selectAll(ye.grid.class).data([1]).join(function(h){return h.append(function(){return new xft({style:c})}).attr("className",ye.grid.name)},function(h){return h.transition(function(){return this.update(c)})},function(h){return h.remove()}).transitions()}var px=function(){function r(t,e,n,i){this.set(t,e,n,i)}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),r.prototype.rotatedPoints=function(t,e,n){var i=this,a=i.x1,s=i.y1,o=i.x2,l=i.y2,u=Math.cos(t),c=Math.sin(t),h=e-e*u+n*c,d=n-e*c-n*u,g=[[u*a-c*l+h,c*a+u*l+d],[u*o-c*l+h,c*o+u*l+d],[u*a-c*s+h,c*a+u*s+d],[u*o-c*s+h,c*o+u*s+d]];return g},r.prototype.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},r.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},r}();function vx(r,t){var e=r.getEulerAngles()||0;r.setEulerAngles(0);var n=r.getBounds(),i=z(n.min,2),a=i[0],s=i[1],o=z(n.max,2),l=o[0],u=o[1],c=r.getBBox(),h=c.width,d=c.height,g=d,p=0,v=0,m=a,b=s,w=L5(r);if(w){g-=1.5;var x=w.style.textAlign,S=w.style.textBaseline;x==="center"?m=(a+l)/2:(x==="right"||x==="end")&&(m=l),S==="middle"?b=(s+u)/2:S==="bottom"&&(b=u)}var _=z(Wn(t),4),k=_[0],M=k===void 0?0:k,C=_[1],P=C===void 0?0:C,T=_[2],A=T===void 0?M:T,R=_[3],L=R===void 0?P:R,$=new px((p+=a)-L,(v+=s)-M,p+h+P,v+g+A);return r.setEulerAngles(e),$.rotatedPoints(Kl(e),m,b)}function Ju(r,t){return t[0]<=Math.max(r[0][0],r[1][0])&&t[0]<=Math.min(r[0][0],r[1][0])&&t[1]<=Math.max(r[0][1],r[1][1])&&t[1]<=Math.min(r[0][1],r[1][1])}function Qu(r,t,e){var n=(t[1]-r[1])*(e[0]-t[0])-(t[0]-r[0])*(e[1]-t[1]);return n===0?0:n<0?2:1}function Ift(r,t){var e=Qu(r[0],r[1],t[0]),n=Qu(r[0],r[1],t[1]),i=Qu(t[0],t[1],r[0]),a=Qu(t[0],t[1],r[1]);return!!(e!==n&&i!==a||e===0&&Ju(r,t[0])||n===0&&Ju(r,t[1])||i===0&&Ju(t,r[0])||a===0&&Ju(t,r[1]))}function Dft(r,t){var e=r.length;if(e<3)return!1;var n=[t,[9999,t[1]]],i=0,a=0;do{var s=[r[a],r[(a+1)%e]];if(Ift(s,n)){if(Qu(s[0],t,s[1])===0)return Ju(s,t);i++}a=(a+1)%e}while(a!==0);return!!(i&1)}function Fft(r,t){return t.every(function(e){return Dft(r,e)})}function Bft(r,t,e){var n=r.x1,i=r.x2,a=r.y1,s=r.y2,o=[[n,a],[i,a],[i,s],[n,s]],l=vx(t,e);return Fft(o,l)}function zft(r,t){var e=z(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=z(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=a-n,g=s-i,p=c-l,v=h-u,m=d*v-p*g;if(m===0)return!1;var b=m>0,w=n-l,x=i-u,S=d*x-g*w;if(S<0===b)return!1;var _=p*x-v*w;return!(_<0===b||S>m===b||_>m===b)}function $ft(r,t){var e=[[r[0],r[1],r[2],r[3]],[r[2],r[3],r[4],r[5]],[r[4],r[5],r[6],r[7]],[r[6],r[7],r[0],r[1]]];return e.some(function(n){return zft(t,n)})}function jft(r,t,e){var n,i,a=vx(r,e).flat(1),s=vx(t,e).flat(1),o=[[a[0],a[1],a[2],a[3]],[a[0],a[1],a[4],a[5]],[a[4],a[5],a[6],a[7]],[a[2],a[3],a[6],a[7]]];try{for(var l=Ac(o),u=l.next();!u.done;u=l.next()){var c=u.value;if($ft(s,c))return!0}}catch(h){n={error:h}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return!1}function qft(r,t){var e=r.type,n=r.labelDirection,i=r.crossSize;if(!i)return!1;if(e==="arc"){var a=r.center,s=r.radius,o=z(a,2),l=o[0],u=o[1],c=n==="negative"?0:i,h=-s-c,d=s+c,g=z(Wn(t),4),p=g[0],v=g[1],m=g[2],b=g[3];return new px(l+h-b,u+h-p,l+d+v,u+d+m)}var w=z(r.startPos,2),x=w[0],S=w[1],_=z(r.endPos,2),k=_[0],M=_[1],C=z(e4(r)?[-t,0,t,0]:[0,t,0,-t],4),P=C[0],T=C[1],A=C[2],R=C[3],L=Jc(0,r),$=Na(L,i),q=new px(x,S,k,M);return q.x1+=R,q.y1+=P,q.x2+=T+$[0],q.y2+=A+$[1],q}function kg(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,l=qft(t,a),u=function(p){return l?Bft(l,p):!0},c=function(p,v){return!p||!p.firstChild?!0:!jft(p.firstChild,v.firstChild,Wn(e))};try{for(var h=Ac(r),d=h.next();!d.done;d=h.next()){var g=d.value;u(g)?!o||c(o,g)?o=g:(s.add(o),s.add(g)):s.add(g)}}catch(p){n={error:p}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return Array.from(s)}function Jb(r,t){return t===void 0&&(t={}),kt(r)?0:typeof r=="number"?r:Math.floor(Bht(r,t))}function Wft(r,t,e,n){if(!(r.length<=1)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,l=o===void 0?1/0:o,u=t.step,c=u===void 0?" ":u,h=t.margin,d=h===void 0?[0,0,0,0]:h,g=R5(n.getTextShape(r[0])),p=Jb(c,g),v=s?Jb(s,g):p,m=Jb(l,g);(kt(m)||m===1/0)&&(m=Math.max.apply(null,r.map(function(k){return k.getBBox().width})));var b=r.slice(),w=z(d,4);w[0],w[1],w[2],w[3];for(var x=function(k){if(b.forEach(function(M){n.ellipsis(n.getTextShape(M),k,a)}),b=kg(r,e,d),b.length<1)return{value:void 0}},S=m;S>v+p;S-=p){var _=x(S);if(typeof _=="object")return _.value}}}var Gft={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(Li(i),!1):!0})}},Vft=function(r){return r.filter(N5)};function Hft(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=Gft.parity,l=function(x){return x.forEach(n.show),x},u=2,c=r.slice(),h=r.slice(),d=Math.min.apply(Math,vt([1],z(r.map(function(x){return x.getBBox().width})),!1));if(e.type==="linear"&&(t4(e)||e4(e))){var g=mN(r[0]).left,p=mN(r[i-1]).right,v=Math.abs(p-g)||1;u=Math.max(Math.floor(i*d/v),u)}var m,b;for(a&&(m=c.splice(0,1)[0]),s&&(b=c.splice(-1,1)[0],c.reverse()),l(c);u<r.length&&kg(Vft(b?vt(vt([b],z(h),!1),[m],!1):vt([m],z(h),!1)),e,t==null?void 0:t.margin).length;){if(b&&!m&&u%2===0){var w=c.splice(0,1);w.forEach(n.hide)}else if(b&&m){var w=c.splice(0,1);w.forEach(n.hide)}h=o(l(c),{seq:u}),u++}}}function Uft(r,t,e,n){var i,a,s=t.optionalAngles,o=s===void 0?[0,45,90]:s,l=t.margin,u=t.recoverWhenFailed,c=u===void 0?!0:u,h=r.map(function(b){return b.getLocalEulerAngles()}),d=function(){return kg(r,e,l).length<1},g=function(b){return r.forEach(function(w,x){var S=Array.isArray(b)?b[x]:b;n.rotate(w,+S)})};try{for(var p=Ac(o),v=p.next();!v.done;v=p.next()){var m=v.value;if(g(m),d())return}}catch(b){i={error:b}}finally{try{v&&!v.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}c&&g(h)}function Yft(r){var t=r.type,e=r.labelDirection;return t==="linear"&&t4(r)?e==="negative"?"bottom":"top":"middle"}function Xft(r,t,e,n){var i=t.wordWrapWidth,a=i===void 0?50:i,s=t.maxLines,o=s===void 0?3:s,l=t.recoverWhenFailed,u=l===void 0?!0:l,c=t.margin,h=c===void 0?[0,0,0,0]:c,d=r.map(function(w){return w.attr("maxLines")||1}),g=Math.min.apply(Math,vt([],z(d),!1)),p=function(){return kg(r,e,h).length<1},v=Yft(e),m=function(w){return r.forEach(function(x,S){var _=Array.isArray(w)?w[S]:w;n.wrap(x,a,_,v)})};if(!(g>o)){for(var b=g;b<=o;b++)if(m(b),p())return;u&&m(d)}}var Kft=new Map([["hide",Hft],["rotate",Uft],["ellipsis",Wft],["wrap",Xft]]);function Zft(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!Dht(r[0]):e==="rotate"?!r.some(function(n){var i;return!!(!((i=n.attr("transform"))===null||i===void 0)&&i.includes("rotate"))}):e==="ellipsis"||e==="wrap"?r.filter(function(n){return n.querySelector("text")}).length>1:!0}function Jft(r,t,e){var n=t.labelOverlap,i=n===void 0?[]:n;i.length&&i.forEach(function(a){var s=a.type,o=Kft.get(s);Zft(r,t,s)&&(o==null||o(r,a,t,e))})}function Qft(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=function(n){return n==="positive"?-1:1};return r.reduce(function(n,i){return n*e(i)},1)}function FN(r){for(var t=r;t<0;)t+=360;return Math.round(t%360)}function mx(r,t){var e=z(r,2),n=e[0],i=e[1],a=z(t,2),s=a[0],o=a[1],l=z([n*s+i*o,n*o-i*s],2),u=l[0],c=l[1];return Math.atan2(c,u)}function t0t(r){var t=(r+360)%180;return zn(t,-90,90)||(t+=180),t}function e0t(r,t,e){var n,i=e.labelAlign,a=(n=t.style.transform)===null||n===void 0?void 0:n.includes("rotate");if(a)return t.getLocalEulerAngles();var s=0,o=Jc(r.value,e),l=Sg(r.value,e);return i==="horizontal"?0:(i==="perpendicular"?s=mx([1,0],o):s=mx([l[0]<0?-1:1,0],l),t0t(A5(s)))}function i4(r,t,e){var n=e.type,i=e.labelAlign,a=Jc(r,e),s=FN(t),o=FN(A5(mx([1,0],a))),l="center",u="middle";return n==="linear"?[90,270].includes(o)&&s===0?(l="center",u=a[1]===1?"top":"bottom"):!(o%180)&&[90,270].includes(s)?l="center":o===0?(zn(s,0,90,!1,!0)||zn(s,0,90)||zn(s,270,360))&&(l="start"):o===90?zn(s,0,90,!1,!0)?l="start":(zn(s,90,180)||zn(s,270,360))&&(l="end"):o===270?zn(s,0,90,!1,!0)?l="end":(zn(s,90,180)||zn(s,270,360))&&(l="start"):o===180&&(s===90?l="start":(zn(s,0,90)||zn(s,270,360))&&(l="end")):i==="parallel"?zn(o,0,180,!0)?u="top":u="bottom":i==="horizontal"?zn(o,90,270,!1)?l="end":(zn(o,270,360,!1)||zn(o,0,90))&&(l="start"):i==="perpendicular"&&(zn(o,90,270)?l="end":l="start"),{textAlign:l,textBaseline:u}}function n0t(r,t,e){t.setLocalEulerAngles(r);var n=t.__data__.value,i=i4(n,r,e),a=t.querySelector(ye.labelItem.class);a&&a4(a,i)}function BN(r,t,e){var n=e.showTick,i=e.tickLength,a=e.tickDirection,s=e.labelDirection,o=e.labelSpacing,l=t.indexOf(r),u=pi(o,[r,l,t]),c=z([Jc(r.value,e),Qft(s,a)],2),h=c[0],d=c[1],g=d===1?pi(n?i:0,[r,l,t]):0,p=z(Zu(Na(h,u+g),Mg(r.value,e)),2),v=p[0],m=p[1];return{x:v,y:m}}function r0t(r,t,e,n){var i=n.labelFormatter,a=Et(i)?function(){return Ha(pi(i,[r,t,e,Jc(r.value,n)]))}:function(){return Ha(r.label||"")};return a}function a4(r,t){r.nodeName==="text"&&r.attr(t)}function zN(r){Jft(this.node().childNodes,r,{hide:Li,show:Kc,rotate:function(t,e){n0t(+e,t,r)},ellipsis:function(t,e,n){t&&dx(t,e||1/0,n)},wrap:function(t,e,n){t&&zht(t,e,n)},getTextShape:function(t){return t.querySelector("text")}})}function $N(r,t,e,n,i){var a=e.indexOf(t),s=_t(r).append(r0t(t,a,e,i)).attr("className",ye.labelItem.name).node(),o=z(Ua(J5(n,[t,a,e])),2),l=o[0],u=o[1],c=u.transform,h=en(u,["transform"]);F5(s,c);var d=e0t(t,s,i);return s.getLocalEulerAngles()||s.setLocalEulerAngles(d),a4(s,et(et({},i4(t.value,d,i)),l)),r.attr(h),s}function i0t(r,t,e,n){var i=XE(t,e.labelFilter),a=Rt(e,"label");return r.selectAll(ye.label.class).data(i,function(s,o){return o}).join(function(s){return s.append("g").attr("className",ye.label.name).transition(function(o){$N(this,o,t,a,e);var l=BN(o,t,e),u=l.x,c=l.y;return this.style.transform="translate(".concat(u,", ").concat(c,")"),null}).call(function(){zN.call(r,e)})},function(s){return s.transition(function(o){var l=this.querySelector(ye.labelItem.class),u=$N(this,o,t,a,e),c=dft(l,u,n.update),h=BN(o,t,e),d=h.x,g=h.y,p=Ii(this,{transform:"translate(".concat(d,", ").concat(g,")")},n.update);return vt(vt([],z(c),!1),[p],!1)}).call(function(o){var l=sr(o,"_transitions").flat().filter(N5);cft(l,function(){zN.call(r,e)})})},function(s){return s.transition(function(){var o=this,l=_g(this.childNodes[0],n.exit);return uu(l,function(){return _t(o).remove()}),l})}).transitions()}function s4(r,t){return KE(r,t.tickDirection,t)}function a0t(r,t){var e=z(r,2),n=e[0],i=e[1];return[[0,0],[n*t,i*t]]}function s0t(r,t,e,n,i){var a=i.tickLength,s=z(a0t(n,pi(a,[r,t,e])),2),o=z(s[0],2),l=o[0],u=o[1],c=z(s[1],2),h=c[0],d=c[1];return{x1:l,x2:h,y1:u,y2:d}}function o0t(r,t,e,n,i){var a=i.tickFormatter,s=s4(t.value,i),o="line";return Et(a)&&(o=function(){return pi(a,[t,e,n,s])}),r.append(o).attr("className",ye.tickItem.name)}function l0t(r,t,e,n,i,a,s){var o=s4(r.value,a),l=s0t(r,t,e,o,a),u=l.x1,c=l.x2,h=l.y1,d=l.y2,g=z(Ua(J5(s,[r,t,e,o])),2),p=g[0],v=g[1];n.node().nodeName==="line"&&n.styles(et({x1:u,x2:c,y1:h,y2:d},p)),i.attr(v),n.styles(p)}function jN(r,t,e,n,i,a){var s=o0t(_t(this),r,t,e,n);l0t(r,t,e,s,this,n,i);var o=z(Mg(r.value,n),2),l=o[0],u=o[1];return Ii(this,{transform:"translate(".concat(l,", ").concat(u,")")},a)}function u0t(r,t,e,n){var i=XE(t,e.tickFilter),a=Rt(e,"tick");return r.selectAll(ye.tick.class).data(i,function(s){return s.id||s.label}).join(function(s){return s.append("g").attr("className",ye.tick.name).transition(function(o,l){return jN.call(this,o,l,i,e,a,!1)})},function(s){return s.transition(function(o,l){return this.removeChildren(),jN.call(this,o,l,i,e,a,n.update)})},function(s){return s.transition(function(){var o=this,l=_g(this.childNodes[0],n.exit);return uu(l,function(){return o.remove()}),l})}).transitions()}var qN=$i({text:"text"},"title");function Cg(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function c0t(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),l=t.getBBox(),u=Cg(n),c=z(Wn(s?i:0),4),h=c[0],d=c[1],g=c[2],p=c[3],v=z(Wn(a),4),m=v[0],b=v[1],w=v[2],x=v[3],S=z([p+d,h+g],2),_=S[0],k=S[1],M=z([x+b,m+w],2),C=M[0],P=M[1];if(u[0]==="l")return new ur(o.x,o.y,l.width+o.width+_+C,Math.max(l.height+P,o.height));if(u[0]==="t")return new ur(o.x,o.y,Math.max(l.width+C,o.width),l.height+o.height+k+P);var T=z([t.attributes.width||l.width,t.attributes.height||l.height],2),A=T[0],R=T[1];return new ur(l.x,l.y,A+o.width+_+C,R+o.height+k+P)}function h0t(r,t){var e=Object.entries(t).reduce(function(n,i){var a=z(i,2),s=a[0],o=a[1],l=r.node().attr(s);return l||(n[s]=o),n},{});r.styles(e)}function d0t(r){var t,e,n,i,a=r,s=a.width,o=a.height,l=a.position,u=z([+s/2,+o/2],2),c=u[0],h=u[1],d=z([+c,+h,"center","middle"],4),g=d[0],p=d[1],v=d[2],m=d[3],b=Cg(l);return b.includes("l")&&(t=z([0,"start"],2),g=t[0],v=t[1]),b.includes("r")&&(e=z([+s,"end"],2),g=e[0],v=e[1]),b.includes("t")&&(n=z([0,"top"],2),p=n[0],m=n[1]),b.includes("b")&&(i=z([+o,"bottom"],2),p=i[0],m=i[1]),{x:g,y:p,textAlign:v,textBaseline:m}}var f0t=function(r){Ut(t,r);function t(e){return r.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 t.prototype.getAvailableSpace=function(){var e=this,n=this.attributes,i=n.width,a=n.height,s=n.position,o=n.spacing,l=n.inset,u=e.querySelector(qN.text.class);if(!u)return new ur(0,0,+i,+a);var c=u.getBBox(),h=c.width,d=c.height,g=z(Wn(o),4),p=g[0],v=g[1],m=g[2],b=g[3],w=z([0,0,+i,+a],4),x=w[0],S=w[1],_=w[2],k=w[3],M=Cg(s);if(M.includes("i"))return new ur(x,S,_,k);M.forEach(function(j,B){var F,V,X,K;j==="t"&&(F=z(B===0?[d+m,+a-d-m]:[0,+a],2),S=F[0],k=F[1]),j==="r"&&(V=z([+i-h-b],1),_=V[0]),j==="b"&&(X=z([+a-d-p],1),k=X[0]),j==="l"&&(K=z(B===0?[h+v,+i-h-v]:[0,+i],2),x=K[0],_=K[1])});var C=z(Wn(l),4),P=C[0],T=C[1],A=C[2],R=C[3],L=z([R+T,P+A],2),$=L[0],q=L[1];return new ur(x+R,S+P,_-$,k-q)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new ur(0,0,0,0)},t.prototype.render=function(e,n){var i=this;e.width,e.height,e.position,e.spacing;var a=en(e,["width","height","position","spacing"]),s=z(Ua(a),1),o=s[0],l=d0t(e),u=l.x,c=l.y,h=l.textAlign,d=l.textBaseline;Hr(!!a.text,_t(n),function(g){i.title=g.maybeAppendByClassName(qN.text,"text").styles(o).call(h0t,{x:u,y:c,textAlign:h,textBaseline:d}).node()})},t}(nn);function g0t(r,t,e){var n=e.titlePosition,i=n===void 0?"lb":n,a=e.titleSpacing,s=Cg(i),o=r.node().getLocalBounds(),l=z(o.min,2),u=l[0],c=l[1],h=z(o.halfExtents,2),d=h[0],g=h[1],p=z(t.node().getLocalBounds().halfExtents,2),v=p[0],m=p[1],b=z([u+d,c+g],2),w=b[0],x=b[1],S=z(Wn(a),4),_=S[0],k=S[1],M=S[2],C=S[3];if(["start","end"].includes(i)&&e.type==="linear"){var P=e.startPos,T=e.endPos,A=z(i==="start"?[P,T]:[T,P],2),R=A[0],L=A[1],$=D5([-L[0]+R[0],-L[1]+R[1]]),q=z(Na($,_),2),j=q[0],B=q[1];return{x:R[0]+j,y:R[1]+B}}return s.includes("t")&&(x-=g+m+_),s.includes("r")&&(w+=d+v+k),s.includes("l")&&(w-=d+v+C),s.includes("b")&&(x+=g+m+M),{x:w,y:x}}function p0t(r,t,e){var n=r.getGeometryBounds().halfExtents,i=n[1]*2;if(t==="vertical"){if(e==="left")return"rotate(-90) translate(0, ".concat(i/2,")");if(e==="right")return"rotate(-90) translate(0, -".concat(i/2,")")}return""}function WN(r,t,e,n,i){var a=Rt(n,"title"),s=z(Ua(a),2),o=s[0],l=s[1],u=l.transform,c=l.transformOrigin,h=en(l,["transform","transformOrigin"]);t.styles(h);var d=u||p0t(r.node(),o.direction,o.position);r.styles(et(et({},o),{transformOrigin:c})),F5(r.node(),d);var g=g0t(_t(e._offscreen||e.querySelector(ye.mainGroup.class)),t,n),p=g.x,v=g.y,m=Ii(t.node(),{transform:"translate(".concat(p,", ").concat(v,")")},i);return m}function v0t(r,t,e,n){var i=e.titleText;return r.selectAll(ye.title.class).data([{title:i}].filter(function(a){return!!a.title}),function(a,s){return a.title}).join(function(a){return a.append(function(){return Ha(i)}).attr("className",ye.title.name).transition(function(){return WN(_t(this),r,t,e,n.enter)})},function(a){return a.transition(function(){return WN(_t(this),r,t,e,n.update)})},function(a){return a.remove()}).transitions()}function GN(r,t,e,n){var i=r.showLine,a=r.showTick,s=r.showLabel,o=t.maybeAppendByClassName(ye.lineGroup,"g"),l=Hr(i,o,function(g){return Aft(g,r,n)})||[],u=t.maybeAppendByClassName(ye.tickGroup,"g"),c=Hr(a,u,function(g){return u0t(g,e,r,n)})||[],h=t.maybeAppendByClassName(ye.labelGroup,"g"),d=Hr(s,h,function(g){return i0t(g,e,r,n)})||[];return vt(vt(vt([],z(l),!1),z(c),!1),z(d),!1).filter(function(g){return!!g})}var m0t=function(r){Ut(t,r);function t(e){return r.call(this,e,YE)||this}return t.prototype.render=function(e,n,i){var a=this,s=e.titleText,o=e.data,l=e.animate,u=e.showTitle,c=e.showGrid,h=e.dataThreshold,d=e.truncRange,g=Kht(o,h).filter(function(_){var k=_.value;return!(d&&k>d[0]&&k<d[1])}),p=LN(i===void 0?l:i),v=_t(n).maybeAppendByClassName(ye.gridGroup,"g"),m=Hr(c,v,function(_){return Lft(_,g,e,p)})||[],b=_t(n).maybeAppendByClassName(ye.mainGroup,"g");s&&(!this.initialized&&p.enter||this.initialized&&p.update)&&GN(e,_t(this.offscreenGroup),g,LN(!1));var w=GN(e,_t(b.node()),g,p),x=_t(n).maybeAppendByClassName(ye.titleGroup,"g"),S=Hr(u,x,function(_){return v0t(_,a,e,p)})||[];return vt(vt(vt([],z(m),!1),z(w),!1),z(S),!1).flat().filter(function(_){return!!_})},t}(nn),li=$i({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"),y0t=function(r){Ut(t,r);function t(e){var n=r.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:kdt(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(i,a){return"".concat(i,"/").concat(a)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new Mn({class:li.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Mn({class:li.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return Ke(e,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageShape",{get:function(){var e=this.pageViews,n=z(odt(e.map(function(h){var d=h.getBBox(),g=d.width,p=d.height;return[g,p]})).map(function(h){return Math.max.apply(Math,vt([],z(h),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,l=o===void 0?i:o,u=s.pageHeight,c=u===void 0?a:u;return{pageWidth:l,pageHeight:c}},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e=r.prototype.getBBox.call(this),n=e.x,i=e.y,a=this.controllerShape,s=this.pageShape,o=s.pageWidth,l=s.pageHeight;return new ur(n,i,o+a.width,l)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,l=a.playWindow,u=a.pageViews;if(o!=="idle"||e<0||u.length<=0||e>=u.length)return null;u[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var c=z(this.getFollowingPageDiff(e),2),h=c[0],d=c[1];this.playState="running";var g=U5(l,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-h,", ").concat(-d,")")}],i);return uu(g,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),g},t.prototype.prev=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i<=0)return null;var a=e?(i-1+n)%n:Ke(i-1,0,n);return this.goTo(a)},t.prototype.next=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i>=n-1)return null;var a=e?(i+1)%n:Ke(i+1,0,n);return this.goTo(a)},t.prototype.renderClipPath=function(e){var n=this.pageShape,i=n.pageWidth,a=n.pageHeight;if(!i||!a){this.contentGroup.style.clipPath=void 0;return}this.clipPath=e.maybeAppendByClassName(li.clipPath,"rect").styles({width:i,height:a}),this.contentGroup.attr("clipPath",this.clipPath.node())},t.prototype.setVisiblePages=function(e){this.playWindow.children.forEach(function(n,i){e.includes(i)?Kc(n):Li(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,l=s.controllerPadding,u=a.getBBox(),c=u.width;u.height;var h=z(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],g=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(g);var p=n.getBBox(),v=p.width,m=p.height,b=i.getBBox(),w=b.width,x=b.height,S=Math.max(v,c,w),_=o==="horizontal"?{offset:[[0,0],[v/2+l,0],[v+c+l*2,0]],textAlign:"start"}:{offset:[[S/2,-m-l],[S/2,0],[S/2,x+l]],textAlign:"center"},k=z(_.offset,3),M=z(k[0],2),C=M[0],P=M[1],T=z(k[1],2),A=T[0],R=T[1],L=z(k[2],2),$=L[0],q=L[1],j=_.textAlign,B=a.querySelector("text");B&&(B.style.textAlign=j),n.setLocalPosition(C,P),a.setLocalPosition(A,R),i.setLocalPosition($,q)},t.prototype.updatePageInfo=function(){var e,n=this,i=n.currPage,a=n.pageViews,s=n.attributes.formatter;a.length<2||((e=this.pageInfoGroup.querySelector(li.pageInfo.class))===null||e===void 0||e.attr("text",s(i+1,a.length)),this.adjustControllerLayout())},t.prototype.getFollowingPageDiff=function(e){var n=this.currPage;if(n===e)return[0,0];var i=this.attributes.orientation,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=e<n?-1:1;return i==="horizontal"?[l*s,0]:[0,l*o]},t.prototype.prepareFollowingPage=function(e){var n=this,i=n.currPage,a=n.pageViews;if(this.setVisiblePages([e,i]),e!==i){var s=z(this.getFollowingPageDiff(e),2),o=s[0],l=s[1];a[e].setLocalPosition(o,l)}},t.prototype.renderController=function(e){var n=this,i=this.attributes.controllerSpacing,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=this.pageViews.length>=2,u=e.maybeAppendByClassName(li.controller,"g");if(Eg(u.node(),l),!!l){var c=Rt(this.attributes,"button"),h=Rt(this.attributes,"pageNum"),d=z(Ua(c),2),g=d[0],p=d[1],v=g.size,m=en(g,["size"]),b=!u.select(li.prevBtnGroup.class).node(),w=u.maybeAppendByClassName(li.prevBtnGroup,"g").styles(p);this.prevBtnGroup=w.node();var x=w.maybeAppendByClassName(li.prevBtn,"path"),S=u.maybeAppendByClassName(li.nextBtnGroup,"g").styles(p);this.nextBtnGroup=S.node();var _=S.maybeAppendByClassName(li.nextBtn,"path");[x,_].forEach(function(M){M.styles(et(et({},m),{transformOrigin:"center"})),qE(M.node(),v)});var k=u.maybeAppendByClassName(li.pageInfoGroup,"g");this.pageInfoGroup=k.node(),k.maybeAppendByClassName(li.pageInfo,"text").styles(h),this.updatePageInfo(),u.node().setLocalPosition(s+i,o/2),b&&(this.prevBtnGroup.addEventListener("click",function(){n.prev()}),this.nextBtnGroup.addEventListener("click",function(){n.next()}))}},t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s;this.attr("transform","translate(".concat(a,", ").concat(o,")"));var l=_t(n);this.renderClipPath(l),this.renderController(l),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Oc(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(Xt.INSERTED,n),this.playWindow.addEventListener(Xt.REMOVED,n)},t}(nn);function b0t(r,t,e){var n=1.4,i=n*e;return[["M",r-e,t-i],["L",r+e,t-i],["L",r+e,t+i],["L",r-e,t+i],["Z"]]}var o4=1.4,l4=.4;function w0t(r,t,e){var n=e,i=n*o4,a=n/2,s=n/6,o=r+i*l4;return[["M",r,t],["L",o,t+a],["L",r+i,t+a],["L",r+i,t-a],["L",o,t-a],["Z"],["M",o,t+s],["L",r+i-2,t+s],["M",o,t-s],["L",r+i-2,t-s]]}function x0t(r,t,e){var n=e,i=n*o4,a=n/2,s=n/6,o=t+i*l4;return[["M",r,t],["L",r-a,o],["L",r-a,t+i],["L",r+a,t+i],["L",r+a,o],["Z"],["M",r-s,o],["L",r-s,t+i-2],["M",r+s,o],["L",r+s,t+i-2]]}xe.registerSymbol("hiddenHandle",b0t);xe.registerSymbol("verticalHandle",w0t);xe.registerSymbol("horizontalHandle",x0t);function yx(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}var Dr=$i({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");function E0t(r){var t=r.querySelector(Dr.marker.class);return t?t.style:{}}var _0t=function(r){Ut(t,r);function t(e){return r.call(this,e,{span:[1,1],marker:function(){return new Ya({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return Object.defineProperty(t.prototype,"showValue",{get:function(){var e=this.attributes.valueText;return e?typeof e=="string"||typeof e=="number"?e!=="":typeof e=="function"?!0:e.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actualSpace",{get:function(){var e=this.labelGroup,n=this.valueGroup,i=this.attributes.markerSize,a=e.node().getBBox(),s=a.width,o=a.height,l=n.node().getBBox(),u=l.width,c=l.height;return{markerWidth:i,labelWidth:s,valueWidth:u,height:Math.max(i,o,c)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=z(Wn(e),2),i=n[0],a=n[1],s=this.showValue?a:0,o=i+s;return[i/o,s/o]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e,n=this.attributes,i=n.markerSize,a=n.width,s=this.actualSpace,o=s.markerWidth,l=s.height,u=this.actualSpace,c=u.labelWidth,h=u.valueWidth,d=z(this.spacing,2),g=d[0],p=d[1];if(a){var v=a-i-g-p,m=z(this.span,2),b=m[0],w=m[1];e=z([b*v,w*v],2),c=e[0],h=e[1]}var x=o+c+h+g+p;return{width:x,height:l,markerWidth:o,labelWidth:c,valueWidth:h}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){var e=this.attributes.spacing;if(!e)return[0,0];var n=z(Wn(e),2),i=n[0],a=n[1];return this.showValue?[i,a]:[i,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){var e=this.shape,n=e.markerWidth,i=e.labelWidth,a=e.valueWidth,s=e.width,o=e.height,l=z(this.spacing,2),u=l[0],c=l[1];return{height:o,width:s,markerWidth:n,labelWidth:i,valueWidth:a,position:[n/2,n+u,n+i+u+c]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=E0t(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,l=o===void 0?e.lineWidth:o,u=n.markerStroke,c=u===void 0?e.stroke:u,h=+(s||l||(c?1:0))*Math.sqrt(2),d=this.markerGroup.node().getBBox(),g=d.width,p=d.height;return(1-h/Math.max(g,p))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes.marker,a=Rt(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Dr.markerGroup,"g").style("zIndex",0),Hr(!!i,this.markerGroup,function(){var s,o=n.markerGroup.node(),l=(s=o.childNodes)===null||s===void 0?void 0:s[0],u=typeof i=="string"?new xe({style:{symbol:i},className:Dr.marker.name}):i();l?u.nodeName===l.nodeName?l instanceof xe?l.update(et(et({},a),{symbol:i})):(ndt(l,u),_t(l).styles(a)):(l.remove(),_t(u).attr("className",Dr.marker.name).styles(a),o.appendChild(u)):(u instanceof xe||_t(u).attr("className",Dr.marker.name).styles(a),o.appendChild(u)),n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var c=qE(n.markerGroup.node(),n.scaleSize);n.markerGroup.node().style._transform="scale(".concat(c,")")})},t.prototype.renderLabel=function(e){var n=Rt(this.attributes,"label"),i=n.text,a=en(n,["text"]);this.labelGroup=e.maybeAppendByClassName(Dr.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(Dr.label,function(){return Ha(i)}).styles(a)},t.prototype.renderValue=function(e){var n=this,i=Rt(this.attributes,"value"),a=i.text,s=en(i,["text"]);this.valueGroup=e.maybeAppendByClassName(Dr.valueGroup,"g").style("zIndex",0),Hr(this.showValue,this.valueGroup,function(){n.valueGroup.maybeAppendByClassName(Dr.value,function(){return Ha(a)}).styles(s)})},t.prototype.renderBackground=function(e){var n=this.shape,i=n.width,a=n.height,s=Rt(this.attributes,"background");this.background=e.maybeAppendByClassName(Dr.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(Dr.background,"rect").styles(et({width:i,height:a},s))},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=z(e.position,3),o=s[0],l=s[1],u=s[2],c=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(l,", ").concat(c,")")}),dx(this.labelGroup.select(Dr.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(u,", ").concat(c,")")}),dx(this.valueGroup.select(Dr.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=_t(n),a=e.x,s=a===void 0?0:a,o=e.y,l=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(l,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.adjustLayout()},t}(nn),vo=$i({page:"item-page",navigator:"navigator",item:"item"},"items"),VN=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},S0t=function(r){Ut(t,r);function t(e){var n=r.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:vv,mouseenter:vv,mouseleave:vv})||this;return n.navigatorShape=[0,0],n}return Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grid",{get:function(){var e=this.attributes,n=e.gridRow,i=e.gridCol,a=e.data;if(!n&&!i)throw new Error("gridRow and gridCol can not be set null at the same time");return n&&i?[n,i]:n?[n,a.length]:[a.length,i]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderData",{get:function(){var e=this.attributes,n=e.data,i=e.layout,a=Rt(this.attributes,"item"),s=n.map(function(o,l){var u=o.id,c=u===void 0?l:u,h=o.label,d=o.value;return{id:"".concat(c),index:l,style:et({layout:i,labelText:h,valueText:d},Object.fromEntries(Object.entries(a).map(function(g){var p=z(g,2),v=p[0],m=p[1];return[v,pi(m,[o,l,n])]})))}});return s},enumerable:!1,configurable:!0}),t.prototype.getGridLayout=function(){var e=this,n=this.attributes,i=n.orientation,a=n.width,s=n.rowPadding,o=n.colPadding,l=z(this.navigatorShape,1),u=l[0],c=z(this.grid,2),h=c[0],d=c[1],g=d*h,p=0;return this.pageViews.children.map(function(v,m){var b,w,x=Math.floor(m/g),S=m%g,_=e.ifHorizontal(d,h),k=[Math.floor(S/_),S%_];i==="vertical"&&k.reverse();var M=z(k,2),C=M[0],P=M[1],T=(a-u-(d-1)*o)/d,A=v.getBBox().height,R=z([0,0],2),L=R[0],$=R[1];return i==="horizontal"?(b=z([p,C*(A+s)],2),L=b[0],$=b[1],p=P===d-1?0:p+T+o):(w=z([P*(T+o),p],2),L=w[0],$=w[1],p=C===h-1?0:p+A+s),{page:x,index:m,row:C,col:P,pageIndex:S,width:T,height:A,x:L,y:$}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=z(this.navigatorShape,1),l=o[0],u=z(this.grid,2),c=u[0],h=u[1],d=z([n-l,i],2),g=d[0],p=d[1],v=z([0,0,0,0,0,0,0,0],8),m=v[0],b=v[1],w=v[2],x=v[3],S=v[4],_=v[5],k=v[6],M=v[7];return this.pageViews.children.map(function(C,P){var T,A,R,L,$=C.getBBox(),q=$.width,j=$.height,B=k===0?0:s,F=k+B+q;if(F<=g&&VN(S,function(X){return X<h}))return T=z([k+B,M,F],3),m=T[0],b=T[1],k=T[2],{width:q,height:j,x:m,y:b,page:w,index:P,pageIndex:x++,row:_,col:S++};A=z([_+1,0,0,M+j+a],4),_=A[0],S=A[1],k=A[2],M=A[3];var V=M+j;return V<=p&&VN(_,function(X){return X<c})?(R=z([k,M,q],3),m=R[0],b=R[1],k=R[2],{width:q,height:j,x:m,y:b,page:w,index:P,pageIndex:x++,row:_,col:S++}):(L=z([0,0,q,0,w+1,0,0,0],8),m=L[0],b=L[1],k=L[2],M=L[3],w=L[4],x=L[5],_=L[6],S=L[7],{width:q,height:j,x:m,y:b,page:w,index:P,pageIndex:x++,row:_,col:S++})})},Object.defineProperty(t.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var e=this.attributes.layout==="grid"?this.getGridLayout:this.getFlexLayout,n=e.call(this);return n.slice(-1)[0].page>0?(this.navigatorShape=[55,0],e.call(this)):n},enumerable:!1,configurable:!0}),t.prototype.ifHorizontal=function(e,n){var i=this.attributes.orientation;return yx(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(vo.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(vo.page.class).forEach(function(n){var i=e.removeChild(n);i.destroy()})},t.prototype.renderItems=function(e){var n=this.attributes,i=n.click,a=n.mouseenter,s=n.mouseleave;this.flattenPage(e);var o=this.dispatchCustomEvent.bind(this);_t(e).selectAll(vo.item.class).data(this.renderData,function(l){return l.id}).join(function(l){return l.append(function(u){var c=u.style;return new _0t({style:c})}).attr("className",vo.item.name).on("click",function(){i==null||i(this),o("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),o("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),o("itemMouseleave",{item:this})})},function(l){return l.each(function(u){var c=u.style;this.update(c)})},function(l){return l.remove()})},t.prototype.relayoutNavigator=function(){var e,n=this.attributes,i=n.layout,a=n.width,s=((e=this.pageViews.children[0])===null||e===void 0?void 0:e.getBBox().height)||0,o=z(this.navigatorShape,2),l=o[0],u=o[1];this.navigator.update(i==="grid"?{pageWidth:a-l,pageHeight:s-u}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries($ht(this.itemsLayout,"page")).map(function(a){var s=z(a,2),o=s[0],l=s[1];return{page:o,layouts:l}}),i=vt([],z(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new Mn({className:vo.page.name}));s.forEach(function(l){var u=l.x,c=l.y,h=l.index,d=l.width,g=l.height,p=i[h];o.appendChild(p),hc(p,"__layout__",l),p.update({x:u,y:c,width:d,height:g})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes.orientation,i=Rt(this.attributes,"nav"),a=Rn({orientation:n},i),s=this;return e.selectAll(vo.navigator.class).data(["nav"]).join(function(o){return o.append(function(){return new y0t({style:a})}).attr("className",vo.navigator.name).each(function(){s.navigator=this})},function(o){return o.each(function(){this.update(a)})},function(o){return o.remove()}),this.navigator},t.prototype.getBBox=function(){return this.navigator.getBBox()},t.prototype.render=function(e,n){var i=this.attributes.data;if(!(!i||i.length===0)){var a=this.renderNavigator(_t(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new dn(e,{detail:n});this.dispatchEvent(i)},t}(nn),Lu=$i({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),u4={showLabel:!0,formatter:function(r){return r.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};(function(r){Ut(t,r);function t(e){return r.call(this,e,u4)||this}return t.prototype.render=function(e,n){var i=_t(n).maybeAppendByClassName(Lu.markerGroup,"g");this.renderMarker(i);var a=_t(n).maybeAppendByClassName(Lu.labelGroup,"g");this.renderLabel(a)},t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.orientation,s=i.markerSymbol,o=s===void 0?yx(a,"horizontalHandle","verticalHandle"):s;Hr(!!o,e,function(l){var u=Rt(n.attributes,"marker"),c=et({symbol:o},u);n.marker=l.maybeAppendByClassName(Lu.marker,function(){return new xe({style:c})}).update(c)})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,l=o===void 0?0:o,u=i.formatter;Hr(a,e,function(c){var h,d=Rt(n.attributes,"label"),g=d.text,p=en(d,["text"]),v=((h=c.select(Lu.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},m=v.width,b=m===void 0?0:m,w=v.height,x=w===void 0?0:w,S=z(yx(s,[0,x+l,"center","top"],[b+l,0,"start","middle"]),4),_=S[0],k=S[1],M=S[2],C=S[3];c.maybeAppendByClassName(Lu.label,"text").styles(et(et({},p),{x:_,y:k,text:u(g).toString(),textAlign:M,textBaseline:C}))})},t})(nn);var c4={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},M0t=Rn({},c4,{});Rn({},c4,Pl(u4,"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 Iu=$i({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"),k0t=function(r){Ut(t,r);function t(e){return r.call(this,e,M0t)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,l=Rt(this.attributes,"title"),u=z(Ua(l),2),c=u[0],h=u[1];this.titleGroup=e.maybeAppendByClassName(Iu.titleGroup,"g").styles(h);var d=et(et({width:n,height:i},c),{text:s?o:""});this.title=this.titleGroup.maybeAppendByClassName(Iu.title,function(){return new f0t({style:d})}).update(d)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,l=Rt(this.attributes,"title",!0),u=z(Ua(l),2),c=u[0],h=u[1],d=et(et({},c),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(Iu.itemsGroup,"g").styles(et(et({},h),{transform:"translate(".concat(i,", ").concat(a,")")}));var g=this;this.itemsGroup.selectAll(Iu.items.class).data(["items"]).join(function(p){return p.append(function(){return new S0t({style:d})}).attr("className",Iu.items.name).each(function(){g.items=_t(this)})},function(p){return p.update(d)},function(p){return p.remove()})},t.prototype.adjustLayout=function(){var e=this.attributes.showTitle;if(e){var n=this.title.node().getAvailableSpace(),i=n.x,a=n.y;this.itemsGroup.node().style.transform="translate(".concat(i,", ").concat(a,")")}},Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.showTitle,i=e.width,a=e.height;return n?this.title.node().getAvailableSpace():new ur(0,0,i,a)},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e,n,i=(e=this.title)===null||e===void 0?void 0:e.node(),a=(n=this.items)===null||n===void 0?void 0:n.node();return!i||!a?r.prototype.getBBox.call(this):c0t(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,l=o===void 0?0:o,u=i.y,c=u===void 0?0:u,h=_t(n);n.style.transform="translate(".concat(l,", ").concat(c,")"),this.renderTitle(h,a,s),this.renderItems(h,this.availableSpace),this.adjustLayout()},t}(nn),C0t={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(r){return r.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},Qb=$i({background:"background",labelGroup:"label-group",label:"label"},"indicator"),T0t=function(r){Ut(t,r);function t(e){var n=r.call(this,e,C0t)||this;return n.point=[0,0],n.group=n.appendChild(new Mn({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=z(Wn(i),4),s=a[0],o=a[1],l=a[2],u=a[3],c=this.label.node().getLocalBounds(),h=c.min,d=c.max,g=new ur(h[0]-u,h[1]-s,d[0]+o-h[0]+u,d[1]+l-h[1]+s),p=this.getPath(n,g),v=Rt(this.attributes,"background");this.background=_t(this.group).maybeAppendByClassName(Qb.background,"path").styles(et(et({},v),{d:p})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=Rt(this.attributes,"label"),s=z(Ua(a),2),o=s[0],l=s[1];o.text;var u=en(o,["text"]);if(this.label=_t(this.group).maybeAppendByClassName(Qb.labelGroup,"g").styles(l),!!i){var c=this.label.maybeAppendByClassName(Qb.label,function(){return Ha(n(i))}).style("text",n(i).toString());c.selectAll("text").styles(u)}},t.prototype.adjustLayout=function(){var e=z(this.point,2),n=e[0],i=e[1],a=this.attributes,s=a.x,o=a.y;this.group.attr("transform","translate(".concat(s-n,", ").concat(o-i,")"))},t.prototype.getPath=function(e,n){var i=this.attributes.radius,a=n.x,s=n.y,o=n.width,l=n.height,u=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+l-i],["A",i,i,0,0,1,a+o-i,s+l],["L",a+i,s+l],["A",i,i,0,0,1,a,s+l-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],c={top:4,right:6,bottom:0,left:2},h=c[e],d=this.createCorner([u[h].slice(-2),u[h+1].slice(-2)]);return u.splice.apply(u,vt([h+1,1],z(d),!1)),u[0][0]="M",u},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=edt.apply(void 0,vt([],z(e),!1)),s=z(e,2),o=z(s[0],2),l=o[0],u=o[1],c=z(s[1],2),h=c[0],d=c[1],g=z(a?[h-l,[l,h]]:[d-u,[u,d]],2),p=g[0],v=z(g[1],2),m=v[0],b=v[1],w=p/2,x=p/Math.abs(p),S=n*x,_=S/2,k=S*Math.sqrt(3)/2*i,M=z([m,m+w-_,m+w,m+w+_,b],5),C=M[0],P=M[1],T=M[2],A=M[3],R=M[4];return a?(this.point=[T,u-k],[["L",C,u],["L",P,u],["L",T,u-k],["L",A,u],["L",R,u]]):(this.point=[l+k,T],[["L",l,C],["L",l,P],["L",l+k,T],["L",l,A],["L",l,R]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?Li(this):Kc(this)},t.prototype.bindEvents=function(){this.label.on(Xt.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(nn);function bx(r){return r===void 0&&(r=""),{CONTAINER:"".concat(r,"tooltip"),TITLE:"".concat(r,"tooltip-title"),LIST:"".concat(r,"tooltip-list"),LIST_ITEM:"".concat(r,"tooltip-list-item"),NAME:"".concat(r,"tooltip-list-item-name"),MARKER:"".concat(r,"tooltip-list-item-marker"),NAME_LABEL:"".concat(r,"tooltip-list-item-name-label"),VALUE:"".concat(r,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(r,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(r,"tooltip-crosshair-y")}}var HN={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function O0t(r){var t;r===void 0&&(r="");var e=bx(r);return t={},t[".".concat(e.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"},t[".".concat(e.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},t[".".concat(e.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},t[".".concat(e.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},t[".".concat(e.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},t[".".concat(e.NAME)]={display:"flex","align-items":"center","max-width":"216px"},t[".".concat(e.NAME_LABEL)]=et({flex:1},HN),t[".".concat(e.VALUE)]=et({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},HN),t[".".concat(e.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t[".".concat(e.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t}var A0t=function(r){Ut(t,r);function t(e){var n=this,i,a,s=(a=(i=e.style)===null||i===void 0?void 0:i.template)===null||a===void 0?void 0:a.prefixCls,o=bx(s);return n=r.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(o.CONTAINER,'"></div>'),title:'<div class="'.concat(o.TITLE,'"></div>'),item:'<li class="'.concat(o.LIST_ITEM,`" data-index={index}>
- <span class="`).concat(o.NAME,`">
- <span class="`).concat(o.MARKER,`" style="background:{color}"></span>
- <span class="`).concat(o.NAME_LABEL,`" title="{name}">{name}</span>
- </span>
- <span class="`).concat(o.VALUE,`" title="{value}">{value}</span>
- </li>`)},style:O0t(s)})||this,n.timestamp=-1,n.prevCustomContentKey=n.attributes.contentKey,n.initShape(),n.render(n.attributes,n),n}return Object.defineProperty(t.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.element},Object.defineProperty(t.prototype,"elementSize",{get:function(){var e=this.element.offsetWidth,n=this.element.offsetHeight;return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HTMLTooltipItemsElements",{get:function(){var e=this.attributes,n=e.data,i=e.template;return n.map(function(a,s){var o=a.name,l=o===void 0?"":o,u=a.color,c=u===void 0?"black":u,h=a.index,d=en(a,["name","color","index"]),g=et({name:l,color:c,index:h??s},d);return mw(CW(i.item,g))})},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){this.renderHTMLTooltipElement(),this.updatePosition()},t.prototype.destroy=function(){var e;(e=this.element)===null||e===void 0||e.remove(),r.prototype.destroy.call(this)},t.prototype.show=function(e,n){var i=this;if(e!==void 0&&n!==void 0){var a=this.element.style.visibility==="hidden",s=function(){i.attributes.x=e??i.attributes.x,i.attributes.y=n??i.attributes.y,i.updatePosition()};a?this.closeTransition(s):s()}this.element.style.visibility="visible"},t.prototype.hide=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.attributes.enterable;i&&this.isCursorEntered(e,n)||(this.element.style.visibility="hidden")},t.prototype.initShape=function(){var e=this.attributes.template;this.element=mw(e.container),this.id&&this.element.setAttribute("id",this.id)},t.prototype.renderCustomContent=function(){if(!(this.prevCustomContentKey!==void 0&&this.prevCustomContentKey===this.attributes.contentKey)){this.prevCustomContentKey=this.attributes.contentKey;var e=this.attributes.content;e&&(typeof e=="string"?this.element.innerHTML=e:bN(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,l=i.style,u=i.content,c=bx(a.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",u)this.renderCustomContent();else{s?(h.innerHTML=a.title,h.getElementsByClassName(c.TITLE)[0].innerHTML=s):(n=(e=h.getElementsByClassName(c.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var d=this.HTMLTooltipItemsElements,g=document.createElement("ul");g.className=c.LIST,bN(g,d);var p=this.element.querySelector(".".concat(c.LIST));p?p.replaceWith(g):h.appendChild(g)}adt(h,l)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),l={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},u=this.elementSize,c=u.width,h=u.height,d=[-c/2,-h/2];return o.forEach(function(g){var p=z(d,2),v=p[0],m=p[1],b=z(l[g],2),w=b[0],x=b[1];d=[v+(c/2+a[0])*w,m+(h/2+a[1])*x]}),d},t.prototype.setOffsetPosition=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=o===void 0?0:o,u=s.y,c=u===void 0?0:u,h=s.container,d=h.x,g=h.y;this.element.style.left="".concat(+l+d+i,"px"),this.element.style.top="".concat(+c+g+a,"px")},t.prototype.updatePosition=function(){var e=this.attributes.showDelay,n=e===void 0?60:e,i=Date.now();this.timestamp>0&&i-this.timestamp<n||(this.timestamp=i,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},t.prototype.autoPosition=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=s.y,u=s.bounding,c=s.position;if(!u)return[i,a];var h=this.element,d=h.offsetWidth,g=h.offsetHeight,p=z([+o+i,+l+a],2),v=p[0],m=p[1],b={left:"right",right:"left",top:"bottom",bottom:"top"},w=u.x,x=u.y,S=u.width,_=u.height,k={left:v<w,right:v+d>w+S,top:m<x,bottom:m+g>x+_},M=[];c.split("-").forEach(function(P){k[P]?M.push(b[P]):M.push(P)});var C=M.join("-");return this.getRelativeOffsetFromCursor(C)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,l=i.height;return new ur(a,s,o,l).isPointIn(e,n)}return!1},t.prototype.closeTransition=function(e){var n=this,i=this.element.style.transition;this.element.style.transition="none",e(),setTimeout(function(){n.element.style.transition=i},10)},t.tag="tooltip",t}(nn),P0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new Nn({})),n.label=n.background.appendChild(new Mn({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return Wn(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=Rt(this.attributes,"label");_t(this.label).maybeAppend(".label",function(){return Ha(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=z(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],l=e.width,u=e.height,c=l+o+a,h=u+i+s,d=Rt(this.attributes,"background"),g=this.style,p=g.width,v=p===void 0?0:p,m=g.height,b=m===void 0?0:m,w=g.selected;this.background.attr(et(et({},d),{width:Math.max(c,v),height:Math.max(h,b),fill:w?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((h-u)/2,")")})},t.prototype.render=function(){this.renderLabel(),this.renderBackground()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("pointerenter",function(){e.style.selected||e.background.attr("fill",e.hoverColor)}),this.addEventListener("pointerleave",function(){e.style.selected||e.background.attr("fill",e.style.backgroundFill)});var n=this;this.addEventListener("click",function(){var i=e.style,a=i.label,s=i.value,o=i.onClick;o==null||o(s,{label:a,value:s},n)})},t.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},t}(nn),N0t=function(r){Ut(t,r);function t(e){var n,i,a=r.call(this,Rn({},t.defaultOptions,e))||this;a.currentValue=(n=t.defaultOptions.style)===null||n===void 0?void 0:n.defaultValue,a.isPointerInSelect=!1,a.select=a.appendChild(new Nn({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new Nn({className:"dropdown"}));var s=a.style.defaultValue;return s&&(!((i=a.style.options)===null||i===void 0)&&i.some(function(o){return o.value===s}))&&(a.currentValue=s),a}return t.prototype.setValue=function(e){this.currentValue=e,this.render()},t.prototype.getValue=function(){return this.currentValue},Object.defineProperty(t.prototype,"dropdownPadding",{get:function(){return Wn(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),t.prototype.renderSelect=function(){var e=this,n,i=this.style,a=i.x,s=i.y,o=i.width,l=i.height,u=i.bordered,c=i.showDropdownIcon,h=Rt(this.attributes,"select"),d=Rt(this.attributes,"placeholder");this.select.attr(et(et({x:a,y:s,width:o,height:l},h),{fill:"#fff",strokeWidth:u?1:0}));var g=this.dropdownPadding,p=10;c&&_t(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-p-g[1]-g[3],", ").concat(s+l/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var v=(n=this.style.options)===null||n===void 0?void 0:n.find(function(x){return x.value===e.currentValue}),m=et({x:a+g[3]},d);_t(this.select).selectAll(".placeholder").data(v?[]:[1]).join(function(x){return x.append("text").attr("className","placeholder").styles(m).style("y",function(){var S=this.getBBox();return s+(l-S.height)/2})},function(x){return x.styles(m)},function(x){return x.remove()});var b=Rt(this.attributes,"optionLabel"),w=et({x:a+g[3]},b);_t(this.select).selectAll(".value").data(v?[v]:[]).join(function(x){return x.append(function(S){return Ha(S.label)}).attr("className","value").styles(w).style("y",function(){var S=this.getBBox();return s+(l-S.height)/2})},function(x){return x.styles(w)},function(x){return x.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,l=a.width,u=a.height,c=a.options,h=a.onSelect,d=a.open,g=Rt(this.attributes,"dropdown"),p=Rt(this.attributes,"option"),v=this.dropdownPadding;_t(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(c,function(w){return w.value}).join(function(w){return w.append(function(x){return new P0t({className:"dropdown-item",style:et(et(et({},x),p),{width:l-v[1]-v[3],selected:x.value===e.currentValue,onClick:function(S,_,k){e.setValue(S),h==null||h(S,_,k),e.dispatchEvent(new dn("change",{detail:{value:S,option:_,item:k}})),Li(e.dropdown)}})})}).each(function(x,S){var _,k=(_=this.parentNode)===null||_===void 0?void 0:_.children,M=k.reduce(function(C,P,T){return T<S&&(C+=P.getBBox().height),C},0);this.attr("transform","translate(".concat(v[3],", ").concat(v[0]+M,")"))})},function(w){return w.update(function(x){return{selected:x.value===e.currentValue}})},function(w){return w.remove()});var m=(i=(n=this.dropdown.getElementsByClassName("dropdown-container"))===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.getBBox(),b=g.spacing;this.dropdown.attr(et({transform:"translate(".concat(s,", ").concat(o+u+b,")"),width:m.width+v[1]+v[3],height:m.height+v[0]+v[2]},g)),!d&&Li(this.dropdown)},t.prototype.render=function(){this.renderSelect(),this.renderDropdown()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("click",function(n){n.stopPropagation()}),this.select.addEventListener("click",function(){e.dropdown.style.visibility==="visible"?Li(e.dropdown):Kc(e.dropdown)}),this.addEventListener("pointerenter",function(){e.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){e.isPointerInSelect=!1}),document==null||document.addEventListener("click",function(){e.isPointerInSelect||Li(e.dropdown)})},t.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"}},t}(nn),ji=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},{style:{backgroundOpacity:t.backgroundOpacities.default}},t.defaultOptions,e))||this;return n.showBackground=!0,n.background=n.appendChild(new Nn({})),n.icon=n.appendChild(new Mn({})),n}return Object.defineProperty(t.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return Wn(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconSize",{get:function(){var e=this.attributes.size,n=z(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3];return Math.max(e-Math.max(o+a,i+s),this.lineWidth*2+1)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.size,s=a/2,o=Rt(this.attributes,"background");this.background.attr(et({x:n-s,y:i-s,width:a,height:a},o))},t.prototype.showIndicator=function(){if(this.label){var e=this.attributes.size,n=this.background.getBBox(),i=n.x,a=n.y;this.indicator.update({x:i+e/2,y:a-5,labelText:this.label,visibility:"visible"})}},t.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},t.prototype.connectedCallback=function(){var e;r.prototype.connectedCallback.call(this);var n=this.attributes.size,i=this.background.getBBox(),a=i.x,s=i.y,o=(e=this.ownerDocument)===null||e===void 0?void 0:e.defaultView;o&&(this.indicator=o.appendChild(new T0t({style:{x:a+n/2,y:s-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},t.prototype.disconnectedCallback=function(){this.indicator.destroy()},t.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onClick;if(this.addEventListener("click",function(){n==null||n(e)}),this.showBackground){var i=function(){return e.background.attr({opacity:t.backgroundOpacities.default})},a=function(){return e.background.attr({opacity:t.backgroundOpacities.hover})},s=function(){return e.background.attr({opacity:t.backgroundOpacities.active})};this.addEventListener("pointerenter",function(){a(),e.showIndicator()}),this.addEventListener("pointerleave",function(){i(),e.hideIndicator()}),this.addEventListener("pointerdown",function(){s()}),this.addEventListener("pointerup",function(){i()})}},t.tag="IconBase",t.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},t.backgroundOpacities={default:0,hover:.8,active:1},t}(nn),Mc=function(r,t){return t===void 0&&(t="#565758"),new jr({style:{fill:t,d:"M ".concat(r,",").concat(r," L -").concat(r,",0 L ").concat(r,",-").concat(r," Z"),transformOrigin:"center"}})},R0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.arcPath=function(e,n,i){var a=z([i,i],2),s=a[0],o=a[1],l=function(v){return[e+i*Math.cos(v),n+i*Math.sin(v)]},u=z(l(-5/4*Math.PI),2),c=u[0],h=u[1],d=z(l(1/4*Math.PI),2),g=d[0],p=d[1];return"M".concat(c,",").concat(h,",A").concat(s,",").concat(o,",0,1,1,").concat(g,",").concat(p)},Object.defineProperty(t.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=this.lineWidth,l=o+.5;_t(this.icon).maybeAppend(".reset","path").styles({stroke:a,lineWidth:o,d:this.arcPath(n,i,s/2-o),markerStart:Mc(l,a)})},t}(ji),L0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n-o,i],[n,i+l],[n,i],[n+o,i-l],[n+o,i+l],[n,i]];_t(this.icon).maybeAppend(".backward","polygon").styles({points:u,fill:a})},t}(ji),I0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n+o,i],[n,i+l],[n,i],[n-o,i-l],[n-o,i+l],[n,i]];_t(this.icon).maybeAppend(".forward","polygon").styles({points:u,fill:a})},t}(ji),D0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3*Math.pow(3,.5)*.8,l=[[n+o,i],[n-o/2,i-s/2*.8],[n-o/2,i+s/2*.8],[n+o,i]];_t(this.icon).maybeAppend(".play","polygon").styles({points:l,fill:a})},t}(ji),F0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3,l=[[n-o,i-s/2],[n-o,i+s/2],[n-o/2,i+s/2],[n-o/2,i-s/2],[n-o,i-s/2],[n+o/2,i-s/2],[n+o/2,i+s/2],[n+o,i+s/2],[n+o,i-s/2]];_t(this.icon).maybeAppend(".pause","polygon").styles({points:l,fill:a})},t}(ji),B0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l;_t(this.icon).maybeAppend(".left-line","line").styles({x1:n-o/2,y1:i-o/2,x2:n-o/2,y2:i+o/2,stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".right-line","line").styles({x1:n+o/2,y1:i-o/2,x2:n+o/2,y2:i+o/2,stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".left-arrow","line").styles({x1:n,y1:i,x2:n-o/2+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)}),_t(this.icon).maybeAppend(".right-arrow","line").styles({x1:n,y1:i,x2:n+o/2-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)})},t}(ji),z0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;_t(this.icon).maybeAppend(".line","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l});var u=l;_t(this.icon).maybeAppend(".left-arrow","line").styles({x1:n-o/2-u*2,y1:i,x2:n-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)}),_t(this.icon).maybeAppend(".right-arrow","line").styles({x1:n+o/2+u*2,y1:i,x2:n+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)})},t}(ji),h4=function(r){return[[-r/2,-r/2],[-r/2,r/2],[r/2,r/2]]},$0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l,c=(o-u*2-l)/4,h=(o-u*2-l)/2,d=z([n-o/2+u,i+o/2-u*2],2),g=d[0],p=d[1];_t(this.icon).maybeAppend(".coordinate","polyline").styles({points:h4(o).map(function(v){var m=z(v,2),b=m[0],w=m[1];return[b+n,w+i]}),stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".line","polyline").styles({points:[[g,p],[g+c,p-h],[g+c*2,p],[g+c*4,p-h*2]],stroke:a,lineWidth:l})},t}(ji),j0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.data,n=this.attributes,i=n.x,a=n.y,s=n.color,o=this,l=o.iconSize,u=o.lineWidth,c=u,h=(l-c)/e.length,d=(l-c*2)/4,g=z([i-l/2+c*2,a+l/2-c],2),p=g[0],v=g[1];_t(this.icon).maybeAppend(".coordinate","polyline").styles({points:h4(l).map(function(m){var b=z(m,2),w=b[0],x=b[1];return[w+i,x+a]}),stroke:s,lineWidth:u}),_t(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(m,b){return{value:m,index:b}})).join(function(m){return m.append("line").attr("className","column").style("x1",function(b){var w=b.index;return p+h*w}).style("y1",v).style("x2",function(b){var w=b.index;return p+h*w}).style("y2",function(b){var w=b.value;return v-d*w}).styles({y1:v,stroke:s,lineWidth:u})})},t}(ji),q0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;_t(this.icon).maybeAppend(".split","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l})},t}(ji),wx=function(r){Ut(t,r);function t(){var e=r.apply(this,vt([],z(arguments),!1))||this;return e.showBackground=!1,e}return Object.defineProperty(t.prototype,"padding",{get:function(){return Wn(0)},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.iconSize,n=this.attributes,i=n.x,a=n.y,s=n.speed,o=s===void 0?1:s,l=Px(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),u=Ke(e,20,1/0),c=20,h=et(et({},l),{x:i-u/2,y:a-c/2,width:u,height:c,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:e/5,placeholderFontSize:e/2,optionPadding:0,optionLabelFontSize:e/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});_t(this.icon).maybeAppend(".speed",function(){return new N0t({style:h})}).attr("className","speed").each(function(){this.update(h)})},t.tag="SpeedSelect",t}(ji),ZE=function(r){Ut(t,r);function t(e){var n=r.call(this,e)||this;return n.icon=n.appendChild(new Mn({})),n.currentType=n.attributes.type,n}return t.prototype.getType=function(){return this.currentType},t.prototype.render=function(){var e=this,n=this.attributes;n.onChange;var i=en(n,["onChange"]);_t(this.icon).selectAll(".icon").data([this.currentType]).join(function(a){return a.append(function(s){var o,l=(o=e.toggles.find(function(u){var c=z(u,1),h=c[0];return h===s}))===null||o===void 0?void 0:o[1];if(!l)throw new Error("Invalid type: ".concat(s));return new l({})}).attr("className","icon").styles(i,!1).update({})},function(a){return a.styles({restStyles:i}).update({})},function(a){return a.remove()})},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onChange;this.addEventListener("click",function(i){i.preventDefault(),i.stopPropagation();var a=(e.toggles.findIndex(function(o){var l=z(o,1),u=l[0];return u===e.currentType})+1)%e.toggles.length,s=e.toggles[a][0];n==null||n(e.currentType),e.currentType=s,e.render()})},t.tag="ToggleIcon",t}(nn),xx=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},{style:{type:"play"}},e))||this;return n.toggles=[["play",D0t],["pause",F0t]],n}return t}(ZE),Ex=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},{style:{type:"range"}},e))||this;return n.toggles=[["range",B0t],["value",z0t]],n}return t}(ZE),_x=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},{style:{type:"column"}},e))||this;return n.toggles=[["line",$0t],["column",j0t]],n}return t}(ZE),W0t={reset:R0t,speed:wx,backward:L0t,playPause:xx,forward:I0t,selectionType:Ex,chartType:_x,split:q0t},G0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},t.defaultOptions,e))||this;return n.background=n.appendChild(new Nn({})),n.functions=n.appendChild(new Mn({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return Wn(this.attributes.padding)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.style,n=e.x,i=e.y,a=e.width,s=e.height,o=Rt(this.attributes,"background");this.background.attr(et({x:n,y:i,width:a,height:s},o))},t.prototype.renderFunctions=function(){var e=this,n,i=this.attributes,a=i.functions,s=i.iconSize,o=i.iconSpacing,l=i.x,u=i.y,c=i.width,h=i.height,d=i.align,g=z(this.padding,4),p=g[1],v=g[3],m=a.reduce(function(x,S){return x.length&&S.length?x.concat.apply(x,vt(["split"],z(S),!1)):x.concat.apply(x,vt([],z(S),!1))},[]),b=m.length*(s+o)-o,w={left:v+s/2,center:(c-b)/2+s/2,right:c-b-v-p+s/2}[d]||0;(n=this.speedSelect)===null||n===void 0||n.destroy(),this.functions.removeChildren(),m.forEach(function(x,S){var _,k=W0t[x],M={x:l+S*(s+o)+w,y:u+h/2,size:s};if(k===wx?(M.speed=e.attributes.speed,M.onSelect=function(P){return e.handleFunctionChange(x,{value:P})}):[xx,Ex,_x].includes(k)?(M.onChange=function(P){return e.handleFunctionChange(x,{value:P})},k===xx&&(M.type=e.attributes.state==="play"?"pause":"play"),k===Ex&&(M.type=e.attributes.selectionType==="range"?"value":"range"),k===_x&&(M.type=e.attributes.chartType==="line"?"column":"line")):M.onClick=function(){return e.handleFunctionChange(x,{value:x})},k===wx){var C=(_=e.ownerDocument)===null||_===void 0?void 0:_.defaultView;C&&(e.speedSelect=new k({style:et(et({},M),{zIndex:100})}),C.appendChild(e.speedSelect))}else e.functions.appendChild(new k({style:M}))})},t.prototype.disconnectedCallback=function(){var e;r.prototype.disconnectedCallback.call(this),(e=this.speedSelect)===null||e===void 0||e.destroy()},t.prototype.render=function(){this.renderBackground(),this.renderFunctions()},t.prototype.handleFunctionChange=function(e,n){var i=this.attributes.onChange;i==null||i(e,n)},t.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"]]}},t}(nn),V0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},t.defaultOptions,e))||this;return n.bindEvents(),n}return t.prototype.bindEvents=function(){var e=this;this.addEventListener("mouseenter",function(){e.attr("lineWidth",Math.ceil(+(e.style.r||0)/2))}),this.addEventListener("mouseleave",function(){e.attr("lineWidth",0)})},t.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},t}(Ya),H0t=function(r){Ut(t,r);function t(e){return r.call(this,Rn({},t.defaultOptions,e))||this}return t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=Rt(this.attributes,"background");_t(this).maybeAppend("background","rect").attr("className","background").styles(et({x:n-a/2,y:i-s/2,width:a,height:s},o))},t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.iconSize,s=Rt(this.attributes,"icon"),o=1,l=a/2;_t(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(et({x1:n-o,y1:i-l,x2:n-o,y2:i+l},s)),_t(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(et({x1:n+o,y1:i-l,x2:n+o,y2:i+l},s))},t.prototype.renderBorder=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=Rt(this.attributes,"border"),u=o==="start"?+a/2:-a/2;_t(this).maybeAppend("border","line").attr("className","border").styles(et({x1:u+n,y1:i-s/2,x2:u+n,y2:i+s/2},l))},t.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},t.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}},t}(nn);function U0t(r,t){return typeof r=="number"?d4(r):Y0t(r,t)}function Y0t(r,t){var e=new Date(r);switch(t){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(e.getHours())&&e.getMinutes()===0?mr(e,`HH:mm
- YYYY-MM-DD`):mr(e,"HH:mm");case"half-day":return e.getHours()<12?`AM
- `.concat(mr(e,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(e.getDate())?mr(e,`DD
- YYYY-MM`):mr(e,"DD");case"week":return e.getDate()<=7?mr(e,`DD
- YYYY-MM`):mr(e,"DD");case"month":return[0,6].includes(e.getMonth())?mr(e,`MM月
- YYYY`):mr(e,"MM月");case"season":return[0].includes(e.getMonth())?mr(e,`MM月
- YYYY`):mr(e,"MM月");case"year":return mr(e,"YYYY");default:return mr(e,"YYYY-MM-DD HH:mm")}}function d4(r){var t=String(Math.floor(r/3600)).padStart(2,"0"),e=String(Math.floor(r%3600/60)).padStart(2,"0"),n=String(Math.floor(r%60)).padStart(2,"0");return r<3600?"".concat(e,":").concat(n):"".concat(t,":").concat(e,":").concat(n)}var X0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Rn({},t.defaultOptions,e))||this;n.axis=n.appendChild(new m0t({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),n.timeline=n.appendChild(new pft({style:{onChange:function(h){n.handleSliderChange(h)}}})),n.controller=n.appendChild(new G0t({})),n.states={},n.handleSliderChange=function(h){var d=function(){var g=n.states.values;return Array.isArray(g)?vt([],z(g),!1):g}();n.setBySliderValues(h),n.dispatchOnChange(d)};var i=n.attributes,a=i.selectionType,s=i.chartType,o=i.speed,l=i.state,u=i.playMode,c=i.values;return n.states={chartType:s,playMode:u,selectionType:a,speed:o,state:l},n.setByTimebarValues(c),n}return Object.defineProperty(t.prototype,"data",{get:function(){var e=this.attributes.data,n=function(i,a){return i.time<a.time?-1:i.time>a.time?1:0};return e.sort(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"space",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=e.controllerHeight,u=Ke(+s-l,0,+s),c=new ur(n,i+ +s-l,+a,l),h,d=0;o==="chart"?(d=35,h=new ur(n,i+u-d,+a,d)):h=new ur;var g=o==="time"?10:u,p=new ur(n,i+(o==="time"?u:u-g),+a,g-d);return{axisBBox:h,controllerBBox:c,timelineBBox:p}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=z(Array.isArray(e)?e:[0,e],2),o=s[0],l=s[1],u=a.length,c=a[Math.floor(o*u)],h=a[Math.ceil(l*u)-(Array.isArray(e)?0:1)];this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:a[0].time,(i=h==null?void 0:h.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=z(Array.isArray(e)?e:[void 0,e],2),l=o[0],u=o[1],c=s.find(function(d){var g=d.time;return g===l}),h=s.find(function(d){var g=d.time;return g===u});this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=h==null?void 0:h.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,l=z(e,2),u=l[0],c=l[1];this.states.values=[(i=(n=o[u])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[c])===null||a===void 0?void 0:a.time)!==null&&s!==void 0?s:1/0]},Object.defineProperty(t.prototype,"sliderValues",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=z(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],l=this.data,u=l.length,c=i==="value",h=function(){var g=l.findIndex(function(p){var v=p.time;return v===s});return c?0:g>-1?g/u:0},d=function(){if(o===1/0)return 1;var g=l.findIndex(function(p){var v=p.time;return v===o});return g>-1?g/u:c?.5:1};return[h(),d()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=z(Array.isArray(n)?n:[this.data[0].time,n],2),s=a[0],o=a[1];return i==="value"?o:[s,o]},enumerable:!1,configurable:!0}),t.prototype.getDatumByRatio=function(e){var n=this.data,i=n.length,a=Math.floor(e*(i-1));return n[a]},Object.defineProperty(t.prototype,"chartHandleIconShape",{get:function(){var e=this.states.selectionType,n=this.space.timelineBBox.height;return e==="range"?function(i){return new H0t({style:{type:i,height:n,iconSize:n/6}})}:function(){return new Fo({style:{x1:0,y1:-n/2,x2:0,y2:n/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),t.prototype.getChartStyle=function(e){var n=this,i=e.x,a=e.y,s=e.width,o=e.height,l=this.states,u=l.selectionType,c=l.chartType,h=this.data,d=this.attributes,g=d.type,p=d.labelFormatter,v=Rt(this.attributes,"chart");v.type;var m=en(v,["type"]),b=u==="range";if(g==="time")return et({handleIconShape:function(){return new V0t({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:b?-15:0,autoFitLabel:b,handleSpacing:b?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:u,values:this.sliderValues,formatter:function(S){if(p)return p(S);var _=n.getDatumByRatio(S).time;return typeof _=="number"?d4(_):mr(_,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m);var w=u==="range"?5:0,x=h.map(function(S){var _=S.value;return _});return et({handleIconOffset:w,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:x,sparklineType:c,sparklineScale:.8,trackLength:s,trackSize:o,type:u,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m)},t.prototype.renderChart=function(e){e===void 0&&(e=this.space.timelineBBox),this.timeline.update(this.getChartStyle(e))},t.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},t.prototype.getAxisStyle=function(e){var n=this.data,i=this.attributes,a=i.interval,s=i.labelFormatter,o=Rt(this.attributes,"axis"),l=e.x,u=e.y,c=e.width,h=vt(vt([],z(n),!1),[{time:0}],!1).map(function(g,p,v){var m=g.time;return{label:"".concat(m),value:p/(v.length-1),time:m}}),d=et({startPos:[l,u],endPos:[l+c,u],data:h,labelFilter:function(g,p){return p<h.length-1},labelFormatter:function(g){var p=g.time;return s?s(p):U0t(p,a)}},o);return d},t.prototype.renderAxis=function(e){e===void 0&&(e=this.space.axisBBox);var n=this.attributes.type;n==="chart"&&this.axis.update(this.getAxisStyle(e))},t.prototype.renderController=function(e){e===void 0&&(e=this.space.controllerBBox);var n=this.attributes.type,i=this.states,a=i.state,s=i.speed,o=i.selectionType,l=i.chartType,u=Rt(this.attributes,"controller"),c=this,h=et(et(et({},e),{iconSize:20,speed:s,state:a,selectionType:o,chartType:l,onChange:function(d,g){var p=g.value;switch(d){case"reset":c.internalReset();break;case"speed":c.handleSpeedChange(p);break;case"backward":c.internalBackward();break;case"playPause":p==="play"?c.internalPlay():c.internalPause();break;case"forward":c.internalForward();break;case"selectionType":c.handleSelectionTypeChange(p);break;case"chartType":c.handleChartTypeChange(p);break}}}),u);n==="time"&&(h.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(h)},t.prototype.dispatchOnChange=function(e){var n=this.data,i=this.attributes.onChange,a=this.states,s=a.values,o=a.selectionType,l=z(s,2),u=l[0],c=l[1],h=c===1/0?n.at(-1).time:c,d=o==="range"?[u,h]:h,g=function(p,v){return Array.isArray(p)?Array.isArray(v)?p[0]===v[0]&&(p[1]===v[1]||p[1]===1/0||v[1]===1/0):!1:Array.isArray(v)?!1:p===v};(!e||!g(e,d))&&(i==null||i(o==="range"?[u,h]:h))},t.prototype.internalReset=function(e){var n,i,a=this.states.selectionType;this.internalPause(),this.setBySliderValues(a==="range"?[0,1]:[0,0]),this.renderController(),this.updateSelection(),e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onReset)===null||i===void 0||i.call(n),this.dispatchOnChange())},t.prototype.reset=function(){this.internalReset()},t.prototype.moveSelection=function(e,n){var i=this.data,a=i.length,s=this.states,o=s.values,l=s.selectionType,u=s.playMode,c=z(o,2),h=c[0],d=c[1],g=i.findIndex(function(x){var S=x.time;return S===h}),p=i.findIndex(function(x){var S=x.time;return S===d});p===-1&&(p=a);var v=e==="backward"?-1:1,m;l==="range"?u==="acc"?(m=[g,p+v],v===-1&&g===p&&(m=[g,a])):m=[g+v,p+v]:m=[g,p+v];var b=function(x){var S=z(x.sort(function(C,P){return C-P}),2),_=S[0],k=S[1],M=function(C){return Ke(C,0,a)};return k>a?l==="value"?[0,0]:u==="acc"?[M(_),M(_)]:[0,M(k-_)]:_<0?u==="acc"?[0,M(k)]:[M(_+a-k),a]:[M(_),M(k)]},w=b(m);return this.setByIndex(w),this.updateSelection(),w},t.prototype.internalBackward=function(e){var n,i,a=this.moveSelection("backward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onBackward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.backward=function(){this.internalBackward()},t.prototype.internalPlay=function(e){var n=this,i,a,s=this.data,o=this.attributes.loop,l=this.states.speed,u=l===void 0?1:l;this.playInterval=window.setInterval(function(){var c=n.internalForward();c[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/u),this.states.state="play",!e&&((a=(i=this.attributes)===null||i===void 0?void 0:i.onPlay)===null||a===void 0||a.call(i))},t.prototype.play=function(){this.internalPlay()},t.prototype.internalPause=function(e){var n,i;clearInterval(this.playInterval),this.states.state="pause",!e&&((i=(n=this.attributes)===null||n===void 0?void 0:n.onPause)===null||i===void 0||i.call(n))},t.prototype.pause=function(){this.internalPause()},t.prototype.internalForward=function(e){var n,i,a=this.moveSelection("forward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onForward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.forward=function(){this.internalForward()},t.prototype.handleSpeedChange=function(e){var n,i;this.states.speed=e;var a=this.states.state;a==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSpeedChange)===null||i===void 0||i.call(n,e)},t.prototype.handleSelectionTypeChange=function(e){var n,i;this.states.selectionType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSelectionTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.handleChartTypeChange=function(e){var n,i;this.states.chartType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onChartTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.render=function(){var e=this.space,n=e.axisBBox,i=e.controllerBBox,a=e.timelineBBox;this.renderController(i),this.renderAxis(n),this.renderChart(a),this.states.state==="play"&&this.internalPlay()},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.internalPause(!0)},t.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"}},t}(nn);function JE(r){const{width:t,height:e,renderer:n}=r,i=K0t(r),a=new Rw({width:t,height:e,container:i,renderer:n||new mc});return[i,a]}function K0t(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=ou(n,!1),{width:s,height:o,containerStyle:l}=r,[u,c]=Z0t(r);return Object.assign(a.style,Object.assign({position:"absolute",left:u+"px",top:c+"px",width:s+"px",height:o+"px"},l)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function Z0t(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,l]=m6(n);return[o*(a-t),l*(s-e)]}var J0t=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Tg extends Vn{constructor(t,e){super(t,Object.assign({},Tg.defaultOptions,e)),this.typePrefix="__data__",this.draw=!1,this.fieldMap={node:new Map,edge:new Map,combo:new Map},this.selectedItems=[],this.bindEvents=()=>{const{graph:n}=this.context;n.on(dt.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=sr(n,[s,"id"]),l=sr(n,[s,"style","labelText"]),[u]=o.split("__"),c=this.fieldMap[u].get(l)||[];a.setElementState(Object.fromEntries(c==null?void 0:c.map(h=>[h,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=sr(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?(this.selectedItems=this.selectedItems.filter(a=>a!==i),this.changeState(n,[])):(this.selectedItems.push(i),this.changeState(n,"selected"))},this.mouseleave=n=>{this.options.trigger!=="click"&&(this.selectedItems=[],this.changeState(n,[]))},this.mouseenter=n=>{if(this.options.trigger==="click")return;const i=sr(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?this.selectedItems=this.selectedItems.filter(a=>a!==i):(this.selectedItems.push(i),this.changeState(n,"active"))},this.setFieldMap=(n,i,a)=>{if(!n)return;const s=this.fieldMap[a];if(s)if(!s.has(n))s.set(n,[i]);else{const o=s.get(n);o&&(o.push(i),s.set(n,o))}},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(n,i)=>{if(!n)return[];const{model:a,element:s}=this.context,{nodes:o,edges:l,combos:u}=a.getData(),c={},h=m=>Et(n)?n(m):n,d={node:"circle",edge:"line",combo:"rect"},g={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"},p=(m,b)=>s==null?void 0:s.getElementComputedStyle(m,b),v=(m,b)=>{m.forEach(w=>{const{id:x}=w,S=sr(w,["data",h(w)]),_=(s==null?void 0:s.getElementType(b,w))||"circle",k=p(b,w),M=(b==="edge"?k==null?void 0:k.stroke:k==null?void 0:k.fill)||"#1783ff";x&&S&&S.replace(/\s+/g,"")&&(this.setFieldMap(S,x,b),c[S]||(c[S]={id:`${b}__${x}`,label:S,marker:g[_]||d[b],elementType:b,lineWidth:1,stroke:M,fill:M}))})};switch(i){case"node":v(o,"node");break;case"edge":v(l,"edge");break;case"combo":v(u,"combo");break;default:return[]}return Object.values(c)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:l,trigger:u,position:c,container:h,containerStyle:d,className:g}=n,p=J0t(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),v=this.getMarkerData(s,"node"),m=this.getMarkerData(o,"edge"),b=this.getMarkerData(l,"combo"),w=[...v,...b,...m],x=Object.assign({width:i,height:a,data:w,itemMarkerLineWidth:({lineWidth:k})=>k,itemMarker:({marker:k})=>k,itemMarkerStroke:({stroke:k})=>k,itemMarkerFill:({fill:k})=>k,gridCol:v.length},p,this.getEvents()),S=new k0t({className:"legend",style:x});this.category=S,this.upsertCanvas().appendChild(S),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.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})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:i=e,height:a=n,position:s,container:o,containerStyle:l,className:u}=this.options,[c,h]=JE({width:i,height:a,graphCanvas:t,container:o,containerStyle:l,placement:s,className:"legend"});return this.container=c,u&&c.classList.add(u),this.canvas=h,this.canvas}destroy(){this.clear(),this.context.graph.off(dt.AFTER_DRAW,this.createElement),super.destroy()}}Tg.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class Og extends Vn{constructor(t,e){super(t,Object.assign({},Og.defaultOptions,e)),this.onDraw=n=>{var i;!((i=n==null?void 0:n.data)===null||i===void 0)&&i.render||this.onRender()},this.shapes=new Map,this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=n=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(n.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=n=>{if(!this.mask||!this.isMaskDragging)return;const{size:[i,a]}=this.options,{movementX:s,movementY:o}=n,{left:l,top:u,width:c,height:h}=this.mask.style,[,,d,g]=this.maskBBox;let p=parseInt(l)+s,v=parseInt(u)+o,m=parseInt(c),b=parseInt(h);p<0&&(p=0),v<0&&(v=0),p+m>i&&(p=ps(i-m,0)),v+b>a&&(v=ps(a-b,0)),m<d&&(s>0?(p=ps(p-s,0),m=gs(m+s,i)):s<0&&(m=gs(m-s,i))),b<g&&(o>0?(v=ps(v-o,0),b=gs(b+o,a)):o<0&&(b=gs(b-o,a))),Object.assign(this.mask.style,{left:p+"px",top:v+"px",width:m+"px",height:b+"px"});const w=parseInt(l)-p,x=parseInt(u)-v;if(w===0&&x===0)return;const S=this.context.canvas.getCamera().getZoom(),_=this.canvas.getCamera().getZoom(),k=S/_;this.context.graph.translateBy([w*k,x*k],!1)},this.onMaskDragEnd=n=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(n.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=tL(()=>{this.isMaskDragging||(this.updateMask(),this.setCamera())},32,{leading:!0}),this.setOnRender(),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),"delay"in t&&this.setOnRender(),this.bindEvents()}setOnRender(){this.onRender=Oc(()=>{this.renderMinimap(),this.renderMask()},this.options.delay,!0)}bindEvents(){const{graph:t}=this.context;t.on(dt.AFTER_DRAW,this.onDraw),t.on(dt.AFTER_RENDER,this.onRender),t.on(dt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(dt.AFTER_DRAW,this.onDraw),t.off(dt.AFTER_RENDER,this.onRender),t.off(dt.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:i,edges:a,combos:s}=n;return{nodes:i.filter(o=>t(H(o),"node")),edges:a.filter(o=>t(H(o),"edge")),combos:s.filter(o=>t(H(o),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context;if(s==="key"){const u=new Set,c=h=>{const d=H(h);u.add(d);const g=o.getElement(d);if(!g)return;const p=g.getShape("key"),v=this.shapes.get(d)||p.cloneNode();v.setPosition(p.getPosition()),g.style.zIndex&&(v.style.zIndex=g.style.zIndex),v.id=g.id,this.shapes.has(d)?Object.entries(p.attributes).forEach(([m,b])=>{v.style[m]!==b&&(v.style[m]=b)}):(t.appendChild(v),this.shapes.set(d,v))};i.forEach(c),a.forEach(c),n.forEach(c),this.shapes.forEach((h,d)=>{u.has(d)||(t.removeChild(h),this.shapes.delete(d))});return}const l=(u,c)=>{const d=o.getElement(u).getPosition();return c.setPosition(d),c};t.removeChildren(),i.forEach(u=>t.appendChild(s(H(u),"edge"))),a.forEach(u=>{t.appendChild(l(H(u),s(H(u),"combo")))}),n.forEach(u=>{t.appendChild(l(H(u),s(H(u),"node")))})}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:i,height:a}=this.canvas.getConfig();(e!==i||n!==a)&&this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:i,position:a,container:s,containerStyle:o}=this.options,[l,u]=JE({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&l.classList.add(i),this.container=l,this.canvas=u}return this.setCamera(),this.canvas}createLandmark(t,e,n){const i=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(i))return this.landmarkMap.get(i);const s=this.canvas.getCamera().createLandmark(i,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(i,s),s}setCamera(){var t;const{canvas:e}=this.context,n=(t=this.canvas)===null||t===void 0?void 0:t.getCamera();if(!n)return;const{size:[i,a],padding:s}=this.options,[o,l,u,c]=ua(s),{min:h,max:d,center:g}=e.getBounds("elements"),p=d[0]-h[0],v=d[1]-h[1],m=i-c-l,b=a-o-u,w=m/p,x=b/v,S=Math.min(w,x),_=this.createLandmark(g,g,S);n.gotoLandmark(_,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(Ri(n)),s=this.canvas.canvas2Viewport(Ri(i)),o=s.x-a.x,l=s.y-a.y;return[a.x,a.y,o,l]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=gs(a+n,t),n=0),i<0&&(s=gs(s+i,e),i=0),n+a>t&&(a=ps(t-n,0)),i+s>e&&(s=ps(e-i,0)),[gs(n,t),gs(i,e),ps(a,0),ps(s,0)]}renderMask(){const{maskStyle:t}=this.options;this.mask||(this.mask=document.createElement("div"),this.mask.addEventListener("pointerdown",this.onMaskDragStart)),this.container.appendChild(this.mask),Object.assign(this.mask.style,Object.assign(Object.assign({},t),{cursor:"move",position:"absolute",pointerEvents:"auto"})),this.updateMask()}updateMask(){if(!this.mask)return;const[t,e,n,i]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:i+"px"})}destroy(){var t;this.unbindEvents(),this.canvas.destroy(),(t=this.mask)===null||t===void 0||t.remove(),super.destroy()}}Og.defaultOptions={size:[240,160],shape:"key",padding:10,position:"right-bottom",maskStyle:{border:"1px solid #ddd",background:"rgba(0, 0, 0, 0.1)"},containerStyle:{border:"1px solid #ddd",background:"#fff"},delay:128};const gs=(r,t)=>Math.min(r,t),ps=(r,t)=>Math.max(r,t);var tw=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const ew={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class Ag extends Vn{constructor(t,e){super(t,Object.assign({},Ag.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new Fo({style:Object.assign(Object.assign({},ew),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new Fo({style:Object.assign(Object.assign({},ew),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>tw(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:l}=this.options,{min:[u,c],max:[h,d],center:[g,p]}=i;let v=0,m=0;s!==null&&(Yn(h,s)<l&&(v=s-h),Yn(u,s)<l&&(v=s-u),Yn(g,s)<l&&(v=s-g),v!==0&&(this.isVerticalSticking=!0)),o!==null&&(Yn(d,o)<l&&(m=o-d),Yn(c,o)<l&&(m=o-c),Yn(p,o)<l&&(m=o-p),m!==0&&(this.isHorizontalSticking=!0)),(v!==0||m!==0)&&(yield this.context.graph.translateElementBy({[n]:[v,m]},!1))}),this.enableSnap=n=>{const{target:i}=n,a=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[s,o]=this.getDelta(n);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(s)<=a&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,-o]},!1),!1;if(this.isHorizontalSticking&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[0,-o]},!1),!1;if(this.isVerticalSticking&&Math.abs(s)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(n,i)=>{const{tolerance:a,shape:s}=this.options,{min:[o,l],max:[u,c],center:[h,d]}=i;let g=null,p=null,v=null,m=null,b=null,w=null;return this.getNodes().some(x=>{if(Ze(n.id,x.id))return!1;const S=UN(x,s).getRenderBounds(),{min:[_,k],max:[M,C],center:[P,T]}=S;return g===null&&(Yn(P,h)<a?g=P:Yn(_,o)<a||Yn(_,u)<a?g=_:(Yn(M,u)<a||Yn(M,o)<a)&&(g=M),g!==null&&(p=Math.min(k,l),v=Math.max(C,c))),m===null&&(Yn(T,d)<a?m=T:Yn(k,l)<a||Yn(k,c)<a?m=k:(Yn(C,c)<a||Yn(C,l)<a)&&(m=C),m!==null&&(b=Math.min(_,o),w=Math.max(M,u))),g!==null&&m!==null}),{verticalX:g,verticalMinY:p,verticalMaxY:v,horizontalY:m,horizontalMinX:b,horizontalMaxX:w}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=n=>tw(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=UN(i,this.options.shape).getRenderBounds(),s=this.calcSnaplineMetadata(i,a);this.hideSnapline(),(s.verticalX!==null||s.horizontalY!==null)&&this.updateSnapline(s),this.options.autoSnap&&(yield this.autoSnapToLine(i.id,a,s))}),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,i=(((t=this.context.element)===null||t===void 0?void 0:t.getNodes())||[]).filter(a=>{var s;return ZZ(a)&&((s=this.context.viewport)===null||s===void 0?void 0:s.isInViewport(a.getRenderBounds()))});return e?i.filter(a=>e(a)):i}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||ew.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[l,u]=this.context.canvas.getSize(),{offset:c}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:s-c,y1:a,x2:c===1/0?l:o+c,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?u:i+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return Fi([t.dx,t.dy],e)}bindEvents(){return tw(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(fi.DRAG_START,this.onDragStart),t.on(fi.DRAG,this.onDrag),t.on(fi.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(fi.DRAG_START,this.onDragStart),t.off(fi.DRAG,this.onDrag),t.off(fi.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;(t=this.horizontalLine)===null||t===void 0||t.destroy(),(e=this.verticalLine)===null||e===void 0||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}Ag.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const Yn=(r,t)=>Math.abs(r-t),UN=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var Q0t=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},tgt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};const egt=["timestamp","time","date","datetime"];class Pg extends Vn{get padding(){return ua(this.options.padding)}constructor(t,e){super(t,Object.assign({},Pg.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){var t;(t=this.timebar)===null||t===void 0||t.play()}pause(){var t;(t=this.timebar)===null||t===void 0||t.pause()}forward(){var t;(t=this.timebar)===null||t===void 0||t.forward()}backward(){var t;(t=this.timebar)===null||t===void 0||t.backward()}reset(){var t;(t=this.timebar)===null||t===void 0||t.reset()}update(t){super.update(t),this.backup(),this.upsertTimebar()}backup(){this.originalData=YN(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:i,data:a,x:s,y:o,width:l,height:u,mode:c}=e,h=tgt(e,["onChange","timebarType","data","x","y","width","height","mode"]),d=t.getSize(),[g]=this.padding;this.upsertCanvas().ready.then(()=>{var p;const v=Object.assign(Object.assign({x:d[0]/2-l/2,y:g,onChange:m=>{const b=(Yr(m)?m:[m,m]).map(w=>AW(w)?w.getTime():w);this.options.mode==="modify"?this.filterElements(b):this.hiddenElements(b),n==null||n(b)}},h),{data:a.map(m=>yt(m)?{time:m,value:0}:m),width:l,height:u,type:i});this.timebar?this.timebar.update(v):(this.timebar=new X0t({style:v}),(p=this.canvas)===null||p===void 0||p.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,i=this.context.canvas,[a]=i.getSize(),[s,,o]=this.padding,[l,u]=JE({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=l,t&&l.classList.add(t),this.canvas=u,this.canvas}filterElements(t){return Q0t(this,void 0,void 0,function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:i}=this.options,{graph:a,element:s}=this.context,o=YN(this.originalData);n.forEach(u=>{const c=`${u}s`;o[c]=(this.originalData[c]||[]).filter(h=>{const d=i(h);return!!XN(d,t)})});const l=[...o.nodes,...o.combos].map(u=>H(u));o.edges=o.edges.filter(u=>{const c=u.source,h=u.target;return l.includes(c)&&l.includes(h)}),a.setData(o),yield(e=s.draw({animation:!1,silence:!0}))===null||e===void 0?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:i}=this.options,a=[],s=[];n.forEach(o=>{var l;const u=`${o}s`;(((l=this.originalData)===null||l===void 0?void 0:l[u])||[]).forEach(h=>{const d=H(h),g=i(h);XN(g,t)?s.push(d):a.push(d)})}),e.hideElement(a,!1),e.showElement(s,!1)}destroy(){var t,e,n;const{graph:i}=this.context;this.originalData&&i.setData(Object.assign({},this.originalData)),(t=this.timebar)===null||t===void 0||t.destroy(),(e=this.canvas)===null||e===void 0||e.destroy(),(n=this.container)===null||n===void 0||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}Pg.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>ngt(r,egt,void 0),loop:!1};const YN=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},XN=(r,t)=>{if(yt(t))return r===t;const[e,n]=t;return r>=e&&r<=n},ngt=(r,t,e)=>{var n;for(let i=0;i<t.length;i++){const a=t[i],s=(n=r.data)===null||n===void 0?void 0:n[a];if(s)return s}return e};function rgt(r){const t={top:"unset",right:"unset",bottom:"unset",left:"unset"};return r.split("-").forEach(n=>{t[n]="8px"}),t.flexDirection=r.startsWith("top")||r.startsWith("bottom")?"row":"column",t}const igt=`
- .g6-toolbar {
- position: absolute;
- z-index: 100;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
- opacity: 0.65;
- }
- .g6-toolbar .g6-toolbar-item {
- display: inline-block;
- width: 16px;
- height: 16px;
- padding: 4px;
- cursor: pointer;
- box-sizing: content-box;
- }
- .g6-toolbar .g6-toolbar-item:hover {
- background-color: #f0f0f0;
- }
- .g6-toolbar .g6-toolbar-item svg {
- display: inline-block;
- width: 100%;
- height: 100%;
- pointer-events: none;
- }
- `,agt=`
- <svg>
- <symbol id="zoom-in" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="zoom-out" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="edit" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="delete" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="redo" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="undo" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="export" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="auto-fit" viewBox="64 64 896 896">
- <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>
- <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>
- </symbol>
- <symbol id="reset" viewBox="64 64 896 896">
- <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>
- </symbol>
- <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">
- <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>
- <symbol id="request-fullscreen" viewBox="0 0 1024 1024">
- <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>
- </svg>
- `;var KN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Ng extends Vn{constructor(t,e){super(t,Object.assign({},Ng.defaultOptions,e)),this.$element=ou("toolbar",!1),this.onToolbarItemClick=i=>{const{onClick:a}=this.options;if(i.target instanceof Element&&i.target.className.includes("g6-toolbar-item")){const s=i.target.getAttribute("value");a==null||a(s,i.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),cx("g6-toolbar-css","style",{},igt,document.head),cx("g6-toolbar-svgicon","div",{display:"none"},agt),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return KN(this,void 0,void 0,function*(){e.update.call(this,t);const{className:n,position:i,style:a}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,a,rgt(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return KN(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(e=>`
- <div class="g6-toolbar-item" value="${e.value}">
- <svg aria-hidden="true" focusable="false">
- <use xlink:href="#${e.id}"></use>
- </svg>
- </div>`).join("")})}}Ng.defaultOptions={position:"top-left"};var ZN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Rg extends Vn{constructor(t,e){super(t,Object.assign({},Rg.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=(n,i)=>{const{enable:a}=this.options;return typeof a=="function"?a(n,i):a},this.onClick=n=>{const{target:{id:i}}=n;this.currentTarget===i?this.hide(n):this.show(n)},this.onPointerMove=n=>{const{target:i}=n;!this.currentTarget||i.id===this.currentTarget||this.show(n)},this.onPointerLeave=n=>{this.hide(n)},this.onCanvasMove=n=>{this.hide(n)},this.onPointerEnter=n=>{this.show(n)},this.showById=n=>ZN(this,void 0,void 0,function*(){const i={target:{id:n}};yield this.show(i)}),this.getElementData=(n,i)=>{const{model:a}=this.context;switch(i){case"node":return a.getNodeData([n]);case"edge":return a.getEdgeData([n]);case"combo":return a.getComboData([n]);default:return[]}},this.show=n=>ZN(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(M0(n.target))return;const l=this.context.graph.getElementType(o),{getContent:u,title:c}=this.options,h=this.getElementData(o,l);if(!this.tooltipElement||!this.isEnable(n,h))return;let d={};if(u){if(d.content=yield u(n,h),!d.content)return}else{const v=this.context.graph.getElementRenderStyle(o),m=l==="node"?v.fill:v.stroke;d={title:c||l,data:h.map(b=>({name:"ID",value:b.id||`${b.source} -> ${b.target}`,color:m}))}}this.currentTarget=o;let g,p;if(s)g=s.x,p=s.y;else{const v=sr(h,"0.style",{x:0,y:0});g=v.x,p=v.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:g,y:p,style:{".tooltip":{visibility:"visible"}}}),d))}),this.hide=n=>{var i,a,s,o,l;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:u,y:c}}=n;(l=(o=this.options).onOpenChange)===null||l===void 0||l.call(o,!1),this.tooltipElement.hide(u,c),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new A0t({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"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){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&((e=this.container)===null||e===void 0||e.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])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:l,container:u={x:-a,y:-i},title:c,offset:h}=this.options,[d,g]=e,[p,v]=t.getSize();return{x:d,y:g,container:u,title:c,bounding:{x:0,y:0,width:p,height:v},position:o,enterable:l,offset:h,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}Rg.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var f4=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};let xl;function g4(r,t){return xl||(xl=document.createElement("canvas")),xl.width=r,xl.height=t,xl.getContext("2d").clearRect(0,0,r,t),xl}function sgt(r,t,e,n){return f4(this,void 0,void 0,function*(){const i=g4(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:l,textFontSize:u,textFontFamily:c,textFontVariant:h,textFontWeight:d,textAlign:g,textBaseline:p}=n;return a.textAlign=g,a.textBaseline=p,a.translate(r/2,t/2),a.font=`${u}px ${c} ${h} ${d}`,s&&a.rotate(s),o&&(a.globalAlpha=o),l&&(a.fillStyle=l,a.fillText(`${e}`,0,0)),i.toDataURL()})}function ogt(r,t,e,n){return f4(this,void 0,void 0,function*(){const i=g4(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const l=new Image;return l.crossOrigin="anonymous",l.src=e,new Promise(u=>{l.onload=function(){const c=r>l.width?(r-l.width)/2:0,h=t>l.height?(t-l.height)/2:0;a.drawImage(l,0,0,l.width,l.height,c,h,r-c*2,t-h*2),u(i.toDataURL())}})})}var lgt=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},ugt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Lg extends Vn{constructor(t,e){super(t,Object.assign({},Lg.defaultOptions,e)),this.$element=ou("watermark"),this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return lgt(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:i,height:a,text:s,imageURL:o}=n,l=ugt(n,["width","height","text","imageURL"]);Object.keys(l).forEach(c=>{c.startsWith("background")&&(this.$element.style[c]=t[c])});const u=o?yield ogt(i,a,o,l):yield sgt(i,a,s,l);this.$element.style.backgroundImage=`url(${u})`})}destroy(){super.destroy(),this.$element.remove()}}Lg.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const cgt=["#7E92B5","#F4664A","#FFBE3A"],hgt={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},dgt={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function p4(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:h=cgt,nodePaletteOptions:d=hgt,edgeColor:g,edgeColorDisabled:p,edgePaletteOptions:v=dgt,comboColor:m,comboColorDisabled:b,comboStroke:w,comboStrokeDisabled:x,edgeColorInactive:S}=r;return{background:t,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:e,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:u,labelFill:e,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:l}},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:v,style:{badgeBackgroundFill:g,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:g,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:S,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:t,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:m,halo:!1,haloLineWidth:12,haloStroke:w,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:w},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:b,fillOpacity:.25,labelOpacity:.25,stroke:x,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 fgt={type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},ggt={bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:fgt,nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"},pgt=p4(ggt),vgt={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"},mgt=p4(vgt);class Ja extends Xx{beforeDraw(t,e){return t}afterLayout(t,e){}}class ygt extends Ja{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,l)=>{const c=e.getAncestorsData(l,"combo").map(h=>H(h)).reverse();s.push([l,o,c.length])}),new Map(s.sort(([,,o],[,,l])=>l-o).map(([o,l])=>[o,l]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function Gr(r,t,e,n,i){const a=H(n),s=`${e}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([l,u])=>{t===l?u[s].set(a,o):u[s].delete(a)})}function lf(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class bgt extends Ja{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(we))return t;const{model:n}=this.context,{add:i,update:a}=t,s=[...t.update.combos.entries(),...t.add.combos.entries()];for(;s.length;){const[o,l]=s.pop();if(_r(l)){const u=n.getDescendantsData(o),c=u.map(H),{internal:h,external:d}=qw(c,g=>n.getRelatedEdgesData(g));u.forEach(g=>{const p=H(g),v=s.findIndex(([b])=>b===p);v!==-1&&s.splice(v,1);const m=n.getElementType(p);Gr(t,"remove",m,g)}),h.forEach(g=>Gr(t,"remove","edge",g)),d.forEach(g=>{var p;const v=H(g);((p=this.context.element)===null||p===void 0?void 0:p.getElement(v))?a.edges.set(v,g):i.edges.set(v,g)})}else{const u=n.getChildrenData(o),c=u.map(H),{edges:h}=qw(c,d=>n.getRelatedEdgesData(d));[...u,...h].forEach(d=>{var g;const p=H(d),v=n.getElementType(p);((g=this.context.element)===null||g===void 0?void 0:g.getElement(p))?Gr(t,"update",v,d):Gr(t,"add",v,d),v==="combo"&&s.push([p,d])})}}return t}}const JN=(r,t,e,n)=>{const i=`${e}s`,a=H(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(H(n),n)};class wgt extends Ja{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(JN(e,"add","node",t),_r(t))return;const n=H(t);JN(e,"add","node",t),this.context.model.getRelatedEdgesData(n,"out").forEach(s=>{Gr(e,"add","edge",s)}),this.context.model.getChildrenData(n).forEach(s=>{this.handleExpand(s,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure($r))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,l=new Map;i.forEach((c,h)=>{_r(c)&&o.set(h,c)}),a.forEach(c=>{if(e.getElementType(c.source)!=="node")return;const h=e.getNodeData(c.source);_r(h)&&o.set(c.source,h)}),s.forEach((c,h)=>{const d=this.getElement(h);if(!d)return;const g=d.attributes.collapsed;_r(c)?g||o.set(h,c):g&&l.set(h,c)});const u=new Set;return o.forEach((c,h)=>{n.getDescendantsData(h).forEach(g=>{const p=H(g);if(u.has(p))return;Gr(t,"remove","node",g),n.getRelatedEdgesData(p).forEach(m=>{Gr(t,"remove","edge",m)}),u.add(p)})}),l.forEach((c,h)=>{if(n.getAncestorsData(h,$r).some(_r)){Gr(t,"remove","node",c);return}this.handleExpand(c,t)}),t}}function tc(r,t,e,n=!1){const i=Lw[r][t];!n&&i?i!==e&&la.warn(`The extension ${t} of ${r} has been registered before.`):Object.assign(Lw[r],{[t]:e})}/*!
- * @antv/g-plugin-dragndrop
- * @description A G plugin for Drag n Drop implemented with PointerEvents
- * @version 2.0.32
- * @date 1/23/2025, 8:33:12 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var v4=function(){function r(t){st(this,r),this.dragndropPluginOptions=t}return at(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(c){var h=c.target,d=h===s,g=d&&n.dragndropPluginOptions.isDocumentDraggable?s:h.closest&&h.closest("[draggable=true]");if(g){var p=!1,v=c.timeStamp,m=[c.clientX,c.clientY],b=null,w=[c.clientX,c.clientY],x=function(){var _=Bs(qn().mark(function k(M){var C,P,T,A,R,L;return qn().wrap(function(q){for(;;)switch(q.prev=q.next){case 0:if(p){q.next=8;break}if(C=M.timeStamp-v,P=br([M.clientX,M.clientY],m),!(C<=n.dragndropPluginOptions.dragstartTimeThreshold||P<=n.dragndropPluginOptions.dragstartDistanceThreshold)){q.next=5;break}return q.abrupt("return");case 5:M.type="dragstart",g.dispatchEvent(M),p=!0;case 8:if(M.type="drag",M.dx=M.clientX-w[0],M.dy=M.clientY-w[1],g.dispatchEvent(M),w=[M.clientX,M.clientY],d){q.next=21;break}return T=n.dragndropPluginOptions.overlap==="pointer"?[M.canvasX,M.canvasY]:h.getBounds().center,q.next=17,s.elementsFromPoint(T[0],T[1]);case 17:A=q.sent,R=A[A.indexOf(h)+1],L=(R==null?void 0:R.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),b!==L&&(b&&(M.type="dragleave",M.target=b,b.dispatchEvent(M)),L&&(M.type="dragenter",M.target=L,L.dispatchEvent(M)),b=L,b&&(M.type="dragover",M.target=b,b.dispatchEvent(M)));case 21:case"end":return q.stop()}},k)}));return function(M){return _.apply(this,arguments)}}();o.addEventListener("pointermove",x);var S=function(k){if(p){k.detail={preventClick:!0};var M=k.clone();b&&(M.type="drop",M.target=b,b.dispatchEvent(M)),M.type="dragend",g.dispatchEvent(M),p=!1}o.removeEventListener("pointermove",x)};h.addEventListener("pointerup",S,{once:!0}),h.addEventListener("pointerupoutside",S,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",l)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",l)})}}])}();v4.tag="Dragndrop";var xgt=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return st(this,t),e=qt(this,t),e.name="dragndrop",e.options=n,e}return jt(t,r),at(t,[{key:"init",value:function(){this.addRenderingPlugin(new v4(Bt({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(n){Object.assign(this.plugins[0].dragndropPluginOptions,n)}}])}(Us),QN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},tR=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};const eR=["main"],nR=["background","main","label","transient"];function Egt(r){return r.main}class rR{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||Egt(this.getLayers())}getLayers(){return this.extends.layers}getRenderer(t){return this.extends.renderers[t]}getCamera(t="main"){return this.getLayer(t).getCamera()}getRoot(t="main"){return this.getLayer(t).getRoot()}getContextService(t="main"){return this.getLayer(t).getContextService()}setCursor(t){this.config.cursor=t,this.getLayer().setCursor(t)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(t){this.config={enableMultiLayer:!0},Object.assign(this.config,t);const e=this.config,{renderer:n,background:i,cursor:a,enableMultiLayer:s}=e,o=tR(e,["renderer","background","cursor","enableMultiLayer"]),l=s?nR:eR,u=iR(n,l),c=Object.fromEntries(l.map(h=>{const d=new Rw(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:u[h],background:s?h==="background"?i:void 0:i}));return[h,d]}));aR(c),this.extends={config:this.config,renderer:n,renderers:u,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(t,e),i.setPosition(a),i.setFocalPoint(s)})}getBounds(t){return Dc(Object.values(this.getLayers()).map(e=>t?e.getRoot().childNodes.find(i=>i.classList.includes(t)):e.getRoot()).filter(e=>(e==null?void 0:e.childNodes.length)>0).map(e=>e.getBounds()))}getContainer(){const t=this.extends.config.container;return typeof t=="string"?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const i=((n=t.style)===null||n===void 0?void 0:n.$layer)||"main";return this.getLayer(i).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=iR(t,this.config.enableMultiLayer?nR:eR);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),aR(this.getLayers())}getCanvasByViewport(t){return jn(this.getLayer().viewport2Canvas(Ri(t)))}getViewportByCanvas(t){return jn(this.getLayer().canvas2Viewport(Ri(t)))}getViewportByClient(t){return jn(this.getLayer().client2Viewport(Ri(t)))}getClientByViewport(t){return jn(this.getLayer().viewport2Client(Ri(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(Ri(t));return jn(e.viewport2Canvas(n))}toDataURL(){return QN(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=tR(t,["mode"]);let[a,s,o,l]=[0,0,0,0];if(n==="viewport")[o,l]=this.getSize();else if(n==="overall"){const b=this.getBounds(),w=Xs(b);[a,s]=b.min,[o,l]=w}const u=mw('<div id="virtual-image"></div>'),c=new Rw({width:o,height:l,renderer:new mc,devicePixelRatio:e,container:u,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const h=this.getLayer("label").getRoot().cloneNode(!0),d=c.viewport2Canvas({x:0,y:0}),g=this.getCanvasByViewport([0,0]);h.translate([g[0]-d.x,g[1]-d.y]),h.scale(1/this.getCamera().getZoom()),c.appendChild(h),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const p=this.getCamera(),v=c.getCamera();if(n==="viewport")v.setZoom(p.getZoom()),v.setPosition(p.getPosition()),v.setFocalPoint(p.getFocalPoint());else if(n==="overall"){const[b,w,x]=v.getPosition(),[S,_,k]=v.getFocalPoint();v.setPosition([b+a,w+s,x]),v.setFocalPoint([S+a,_+s,k])}const m=c.getContextService();return new Promise(b=>{c.addEventListener(zr.RERENDER,()=>QN(this,void 0,void 0,function*(){yield new Promise(x=>setTimeout(x,300));const w=yield m.toDataURL(i);b(w)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function iR(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new mc;return n instanceof mc&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new xgt({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function aR(r){Object.entries(r).forEach(([t,e])=>{const n=e.getContextService().getDomElement();n!=null&&n.style&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,t!=="main"&&(n.style.pointerEvents="none")),n!=null&&n.parentElement&&(n.parentElement.style.display="grid")})}const El=r=>r?parseInt(r):0;function _gt(r){const t=getComputedStyle(r),e=r.clientWidth||El(t.width),n=r.clientHeight||El(t.height),i=El(t.paddingLeft)+El(t.paddingRight),a=El(t.paddingTop)+El(t.paddingBottom);return[e-i,n-a]}function sR(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=_gt(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(yt(t)?t:a,a),Math.max(yt(e)?e:s,s)]}class Ig{constructor(t){this.type=t}}class fn extends Ig{constructor(t,e){super(t),this.data=e}}class ci extends Ig{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class _l extends Ig{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class Hd extends Ig{constructor(t,e){super(t),this.data=e}}function _n(r,t){r.emit(t.type,t)}function Sgt(r){if(!r)return null;if(r instanceof WL)return{type:"canvas",element:r};let t=r;for(;t;){if(qc(t))return{type:"node",element:t};if(K6(t))return{type:"edge",element:t};if(aE(t))return{type:"combo",element:t};t=t.parentElement}return null}function oR(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const uc="cachedStyle",QE=r=>`__${r}__`;function Mgt(r,t){const e=Array.isArray(t)?t:[t];sr(r,uc)||hc(r,uc,{}),e.forEach(n=>{hc(sr(r,uc),QE(n),r.attributes[n])})}function lR(r,t){return sr(r,[uc,QE(t)])}function kgt(r,t){return QE(t)in(sr(r,uc)||{})}class Cgt{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var i,a,s;(i=e==null?void 0:e.before)===null||i===void 0||i.call(e);const o=this.getTasks().map(([u,c])=>{var h,d,g;const{element:p,elementType:v,stage:m}=u,b=JY(this.context.options,v,m,t);(h=c==null?void 0:c.before)===null||h===void 0||h.call(c);const w=b.length?tX(p,this.inferStyle(u,n),b):null;return w?((d=c==null?void 0:c.beforeAnimate)===null||d===void 0||d.call(c,w),w.finished.then(()=>{var x,S;(x=c==null?void 0:c.afterAnimate)===null||x===void 0||x.call(c,w),(S=c==null?void 0:c.after)===null||S===void 0||S.call(c),this.animations.delete(w)})):(g=c==null?void 0:c.after)===null||g===void 0||g.call(c),w}).filter(Boolean);o.forEach(u=>this.animations.add(u));const l=Vx(o);return l?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,l),l.finished.then(()=>{var u,c;(u=e==null?void 0:e.afterAnimate)===null||u===void 0||u.call(e,l),(c=e==null?void 0:e.after)===null||c===void 0||c.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),l}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:u={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},l),u));const{modifiedStyle:c}=t,h={},d={};if(o==="enter")Object.assign(h,{opacity:0});else if(o==="exit")Object.assign(d,{opacity:0});else if(o==="show")Object.assign(h,{opacity:0}),Object.assign(d,{opacity:(n=lR(a,"opacity"))!==null&&n!==void 0?n:pc("opacity")});else if(o==="hide")Object.assign(h,{opacity:(i=lR(a,"opacity"))!==null&&i!==void 0?i:pc("opacity")}),Object.assign(d,{opacity:0});else if(o==="collapse"){const{collapse:g}=e||{},{target:p,descendants:v,position:m}=g;if(s==="node"){if(v.includes(a.id)){const[b,w,x]=m;Object.assign(d,{x:b,y:w,z:x})}}else if(s==="combo"){if(a.id===p||v.includes(a.id)){const[b,w]=m;Object.assign(d,{x:b,y:w,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if(o==="expand"){const{expand:g}=e||{},{target:p,descendants:v,position:m}=g;if(s==="node"){if(a.id===p||v.includes(a.id)){const[b,w,x]=m;Object.assign(h,{x:b,y:w,z:x})}}else if(s==="combo"){if(a.id===p||v.includes(a.id)){const[b,w,x]=m;Object.assign(h,{x:b,y:w,z:x,childrenNode:c.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(h).length>0?Object.assign({},l,h):l,Object.keys(d).length>0?Object.assign({},c,d):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,i=(e=(t=n.document)===null||t===void 0?void 0:t.timeline)===null||e===void 0?void 0:e.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class Tgt{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(t=!0){this.batchCount++,this.batchCount===1&&this.emit(new fn(dt.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new fn(dt.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class Ogt extends Yx{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=Sgt(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(M0(l)||l.destroyed))return;const{type:u,detail:c,button:h}=e,d=Object.assign(Object.assign({},e),{target:l,targetType:o,originalTarget:n});u===J.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${J.POINTER_LEAVE}`,Object.assign(Object.assign({},d),{type:J.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(d,{type:J.POINTER_ENTER}),a.emit(`${o}:${J.POINTER_ENTER}`,d))),this.currentTarget=l,this.currentTargetType=o),u===J.CLICK&&h===2||(a.emit(`${o}:${u}`,d),a.emit(u,d)),u===J.CLICK&&c===2&&(Object.assign(d,{type:J.DBLCLICK}),a.emit(`${o}:${J.DBLCLICK}`,d),a.emit(J.DBLCLICK,d)),u===J.POINTER_DOWN&&h===2&&(Object.assign(d,{type:J.CONTEXT_MENU,preventDefault:()=>{var g;(g=s.getContainer())===null||g===void 0||g.addEventListener(J.CONTEXT_MENU,p=>p.preventDefault(),{once:!0})}}),a.emit(`${o}:${J.CONTEXT_MENU}`,d),a.emit(J.CONTEXT_MENU,d))},this.forwardContainerEvents=e=>{this.context.graph.emit(e.type,e)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const t=this.context.canvas.getContainer();t&&[Nl.KEY_DOWN,Nl.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[J.CLICK,J.DBLCLICK,J.POINTER_OVER,J.POINTER_LEAVE,J.POINTER_ENTER,J.POINTER_MOVE,J.POINTER_OUT,J.POINTER_DOWN,J.POINTER_UP,J.CONTEXT_MENU,J.DRAG_START,J.DRAG,J.DRAG_END,J.DRAG_ENTER,J.DRAG_OVER,J.DRAG_LEAVE,J.DROP,J.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[Nl.KEY_DOWN,Nl.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var kc=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function vs(r,t){const{data:e,style:n}=r,i=kc(r,["data","style"]),{data:a,style:s}=t,o=kc(t,["data","style"]),l=Object.assign(Object.assign({},i),o);return(e||a)&&Object.assign(l,{data:Object.assign(Object.assign({},e),a)}),(n||s)&&Object.assign(l,{style:Object.assign(Object.assign({},n),s)}),l}function nw(r){const{data:t,style:e}=r,i=kc(r,["data","style"]);return t&&(i.data=Object.assign({},t)),e&&(i.style=Object.assign({},e)),i}function Sl(r={},t={}){const{states:e=[],data:n={},style:i={},children:a=[]}=r,s=kc(r,["states","data","style","children"]),{states:o=[],data:l={},style:u={},children:c=[]}=t,h=kc(t,["states","data","style","children"]),d=(p,v)=>p.length!==v.length?!1:p.every((m,b)=>m===v[b]),g=(p,v)=>{const m=Object.keys(p),b=Object.keys(v);return m.length!==b.length?!1:m.every(w=>p[w]===v[w])};return!(!g(s,h)||!d(a,c)||!d(e,o)||!g(n,l)||!g(i,u))}var Agt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function rw(r){const{id:t=H(r),style:e,data:n}=r,i=Agt(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},e),data:Object.assign({},n)});return sX(r)?Object.assign({id:t,data:a},i):{id:t,data:a}}function On(r){return r.data}function Pgt(r){if(r.hasTreeStructure($r))return;r.attachTreeStructure($r);const t=r.getAllEdges();for(const e of t){const{source:n,target:i}=e;r.setParent(i,n,$r)}}class Ngt{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new kn}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===De.NodeUpdated||e===De.EdgeUpdated||e===De.ComboUpdated){const{value:n,original:i}=t;this.changes.push({value:nw(n),original:nw(i),type:e})}else this.changes.push({value:nw(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}isBatching(){return this.batchCount>0}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 i=On(n);return this.isCombo(H(i))||(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getEdgeDatum(t){return On(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=On(n);return(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=On(n);return this.isCombo(H(i))&&(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getRootsData(t=$r){return this.model.getRoots(t).map(On)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(On)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Oo(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(H(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){la.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const i=n.getParent(t,e);return i?On(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?$r:we,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(On)}getElementsDataByType(t){return t==="node"?this.getNodeData():t==="edge"?this.getEdgeData():t==="combo"?this.getComboData():[]}getElementDataById(t){return this.getElementType(t)==="edge"?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){const e=this.model.getNode(t);return On(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=On(n);return t?t.includes(H(i))&&e.push(i):e.push(i),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(e)})}getElementState(t){var e;return((e=this.getElementDataById(t))===null||e===void 0?void 0:e.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(On)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(On)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),l=Ls(a,e,h=>H(h),Sl),u=Ls(s,n,h=>H(h),Sl),c=Ls(o,i,h=>H(h),Sl);this.batch(()=>{const h={nodes:l.enter,edges:u.enter,combos:c.enter};this.addData(h),this.computeZIndex(h,"add",!0);const d={nodes:l.update,edges:u.update,combos:c.update};this.updateData(d),this.computeZIndex(d,"update",!0);const g={nodes:l.exit.map(H),edges:u.exit.map(H),combos:c.exit.map(H)};this.removeData(g)})}addData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.addComboData(i),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(e=>(this.pushChange({value:e,type:De.NodeAdded}),rw(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:De.EdgeAdded}),rw(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(we)||e.attachTreeStructure(we),e.addNodes(t.map(n=>(this.comboIds.add(H(n)),this.pushChange({value:n,type:De.ComboAdded}),rw(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(H);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:t,target:a})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=t;s.forEach(o=>{var l,u,c;const h=H(o);if(e==="add"&&yt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o))return;const d=this.getParentData(h,we),g=d?((c=(u=d.style)===null||u===void 0?void 0:u.zIndex)!==null&&c!==void 0?c:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:h,style:{zIndex:g}}])})}),i.forEach(o=>{var l,u,c;const h=H(o);if(e==="add"&&yt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let d=0;const g=this.getParentData(h,we);if(g)d=(((u=g.style)===null||u===void 0?void 0:u.zIndex)||0)+1;else{const p=this.getParentData(h,$r);p&&(d=((c=p==null?void 0:p.style)===null||c===void 0?void 0:c.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:h,style:{zIndex:d}}])})}),a.forEach(o=>{var l,u,c,h,d;if(yt((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:g,source:p,target:v}=o;if(!g)g=H(o);else{const w=this.getEdgeDatum(g);p=w.source,v=w.target}if(!p||!v)return;const m=((c=(u=this.getNodeLikeDatum(p))===null||u===void 0?void 0:u.style)===null||c===void 0?void 0:c.zIndex)||0,b=((d=(h=this.getNodeLikeDatum(v))===null||h===void 0?void 0:h.style)===null||d===void 0?void 0:d.zIndex)||0;this.updateEdgeData([{id:H(o),style:{zIndex:Math.max(m,b)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),i=this.getElementDataById(t),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>H(s)!==t)}),n==="combo"&&!_r(i)){const s=new Set(this.getAncestorsData(t,we).map(H));a.nodes=a.nodes.filter(o=>!s.has(H(o))),a.combos=a.combos.filter(o=>!s.has(H(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}return Math.max(((e=i.style)===null||e===void 0?void 0:e.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(n=>{const i=H(n),a=vd(n);a!==void 0&&(e.hasTreeStructure(we)||e.attachTreeStructure(we),a===null&&this.refreshComboData(i),this.setParent(i,vd(n),we));const s=n.children||[];if(s.length){e.hasTreeStructure($r)||e.attachTreeStructure($r);const o=s.filter(l=>e.hasNode(l));o.forEach(l=>this.setParent(l,i,$r)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(i=>{const a=H(i),s=On(e.getNode(a));if(Sl(s,i))return;const o=vs(s,i);this.pushChange({value:o,original:s,type:De.NodeUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach(i=>{this.pushChange({value:i,original:i,type:De.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:De.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:De.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=H(t);if(!e.hasNode(n))return;const i=On(e.getNode(n)),a=vs(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=H(t);if(!e.hasEdge(n))return;const i=On(e.getEdge(n)),a=vs(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=H(n),a=On(e.getEdge(i));if(Sl(a,n))return;n.source&&a.source!==n.source&&e.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&e.updateEdgeTarget(i,n.target);const s=vs(a,n);this.pushChange({value:s,original:a,type:De.EdgeUpdated}),e.mergeEdgeData(i,s)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(i=>{const a=H(i),s=On(e.getNode(a));if(Sl(s,i))return;const o=vs(s,i);this.pushChange({value:o,original:s,type:De.ComboUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:t},"update")}setParent(t,e,n,i=!0){if(t===e)return;const a=this.getNodeLikeDatum(t),s=vd(a);if(s!==e&&n===we){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===we&&xW([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,we);e&&this.pushChange({value:e,original:e,type:De.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:De.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return cn(e)}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=this.getElementPosition(t),i=It(n,[...e,0].slice(0,3));this.translateNodeTo(t,i)}translateNodeTo(t,e){const[n=0,i=0,a=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:i,z:a}}])})}translateComboBy(t,e){const[n=0,i=0,a=0]=e;if([n,i,a].some(isNaN)||[n,i,a].every(l=>l===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;Oo(s,l=>{const u=H(l);if(o.has(u))return;o.add(u);const[c,h,d]=cn(l),g=vs(l,{style:{x:c+n,y:h+i,z:d+a}});this.pushChange({value:g,original:l,type:this.isCombo(u)?De.ComboUpdated:De.NodeUpdated}),this.model.mergeNodeData(u,g)},l=>this.getChildrenData(H(l)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[i=0,a=0,s=0]=e,o=(n=this.getComboData([t]))===null||n===void 0?void 0:n[0];if(!o)return;const[l,u,c]=cn(o),h=i-l,d=a-u,g=s-c;Oo(o,p=>{const v=H(p),[m,b,w]=cn(p),x=vs(p,{style:{x:m+h,y:b+d,z:w+g}});this.pushChange({value:x,original:p,type:this.isCombo(v)?De.ComboUpdated:De.NodeUpdated}),this.model.mergeNodeData(v,x)},p=>this.getChildrenData(H(p)),"BT")}removeData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.removeEdgeData(this.getRelatedEdgesData(e).map(H)),this.pushChange({value:this.getNodeData([e])[0],type:De.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:De.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:De.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(we)){const e=vd(this.getNodeLikeDatum(t));this.setParent(t,void 0,we,!1),this.model.getChildren(t,we).forEach(n=>{const i=On(n),a=H(i);this.setParent(H(i),e,we,!1);const s=vs(i,{id:H(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?De.ComboUpdated:De.NodeUpdated}),this.model.mergeNodeData(H(i),s)}),kt(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(Ia(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map(i=>i.id)),t.removeNodes(e.map(i=>i.id)),this.context={}}}var Du=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Rgt{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new Mn({className:"elements"}))}}emit(t,e){e.silence||_n(this.context.graph,t)}forEachElementData(t){$o.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:i,graph:a}=this.context,s=((n=i[t])===null||n===void 0?void 0:n.type)||e.type;return s?typeof s=="string"?s:s.call(a,e):t==="edge"?"line":"circle"}getTheme(t){return e6(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(i=>n[i]||{}))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData((e,n)=>{var i,a;const s=Object.assign({},jM((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),jM((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,nK(n,s))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?t==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:i}=this.context,a=((n=i[t])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[H(e.datum)]=$M(a,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];(t===void 0||t.includes(H(o)))&&this.computeElementDefaultStyle(n,{datum:o,graph:e})}})}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}getElementStateStyle(t,e,n){var i,a;const{options:s}=this.context,o=((a=(i=s[t])===null||i===void 0?void 0:i.state)===null||a===void 0?void 0:a[e])||{};return $M(o,n)}computeElementStatesStyle(t,e,n){this.stateStyle[H(n.datum)]=Object.assign({},...e.map(i=>this.getElementStateStyle(t,i,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];if(t===void 0||t.includes(H(o))){const l=this.getElementState(H(o));this.computeElementStatesStyle(n,l,{datum:o,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]}getNodes(){return this.context.model.getNodeData().map(({id:t})=>this.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[H(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=H(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(t,this.getElementState(n)),u=this.getStateStyle(n),c=Object.assign({},i,a,s,o,l,u);if(t==="combo"){const h=this.context.model.getChildrenData(n),g=!!c.collapsed?[]:h.map(H).filter(p=>this.getElement(p));Object.assign(c,{childrenNode:g,childrenData:h})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:i=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(i),{type:n,stage:i,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:i,remove:a}}}=e;return this.destroyElements(a,t),this.createElements(n,t),this.updateElements(i,t),this.setAnimationTask(t,e)}preLayoutDraw(){return Du(this,arguments,void 0,function*(t={animation:!0}){var e,n;const i=this.getDrawData(t);if(!i)return;const{data:{drawData:a}}=i;yield(n=(e=this.context.layout)===null||e===void 0?void 0:e.preLayout)===null||n===void 0?void 0:n.call(e,a);const{add:s,update:o,remove:l}=a;return this.destroyElements(l,t),this.createElements(s,t),this.updateElements(o,t),this.setAnimationTask(t,i)})}setAnimationTask(t,e){const{animation:n,silence:i}=t,{data:{dataChanges:a,drawData:s},stage:o,type:l}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new fn(dt.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),t),beforeAnimate:u=>this.emit(new ci(dt.BEFORE_ANIMATE,yr.DRAW,u,s),t),afterAnimate:u=>this.emit(new ci(dt.AFTER_ANIMATE,yr.DRAW,u,s),t),after:()=>this.emit(new fn(dt.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render",firstRender:this.context.graph.rendered===!1}),t)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),i=zE(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:u=[],EdgeRemoved:c=[],ComboAdded:h=[],ComboUpdated:d=[],ComboRemoved:g=[]}=s0(i,b=>b.type),p=b=>new Map(b.map(w=>{const x=w.value;return[H(x),x]})),v={add:{nodes:p(a),edges:p(l),combos:p(h)},update:{nodes:p(s),edges:p(u),combos:p(d)},remove:{nodes:p(o),edges:p(c),combos:p(g)}},m=this.transformData(v,t);return e.clearChanges(),{dataChanges:n,drawData:m}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,e),t)}createElement(t,e,n){var i;const a=H(e);if(this.getElement(a))return;const o=this.getElementType(t,e),l=this.getElementComputedStyle(t,e),u=Wa(t,o);if(!u)return la.warn(`The element ${o} of ${t} is not registered.`);this.emit(new _l(dt.BEFORE_ELEMENT_CREATE,t,e),n);const c=this.container.appendChild(new u({id:a,context:this.context,style:l}));this.shapeTypeMap[a]=o,this.elementMap[a]=c;const{stage:h="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:c,elementType:t,stage:h,originalStyle:Object.assign({},c.attributes),updatedStyle:l},{after:()=>{var d;this.emit(new _l(dt.AFTER_ELEMENT_CREATE,t,e),n),(d=c.onCreate)===null||d===void 0||d.call(c)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.createElement(o,u,e))})}getUpdateStageStyle(t,e,n){const{stage:i="update"}=n;if(i==="translate")if(t==="node"||t==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=e;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(t,e)}updateElement(t,e,n){var i;const a=H(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new _l(dt.BEFORE_ELEMENT_UPDATE,t,e),n);const l=this.getElementType(t,e),u=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const c=s!=="visibility"?s:u.visibility==="hidden"?"hide":"show";c==="hide"&&delete u.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:c,originalStyle:Object.assign({},o.attributes),updatedStyle:u},{before:()=>{const h=this.elementMap[a];s!=="collapse"&&Gw(h,u),s==="visibility"&&(kgt(h,"opacity")||Mgt(h,"opacity"),this.visibilityCache.set(h,c==="show"?"visible":"hidden"),c==="show"&&Bo(h,"visible"))},after:()=>{var h;const d=this.elementMap[a];s==="collapse"&&Gw(d,u),c==="hide"&&Bo(d,this.visibilityCache.get(d)),this.emit(new _l(dt.AFTER_ELEMENT_UPDATE,t,e),n),(h=d.onUpdate)===null||h===void 0||h.call(d)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.updateElement(o,u,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=H(n),a=this.getElement(i);a&&tJ(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=H(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new _l(dt.BEFORE_ELEMENT_DESTROY,t,e),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:a,originalStyle:Object.assign({},o.attributes),updatedStyle:{}},{after:()=>{var l;this.clearElement(s),o.destroy(),(l=o.onDestroy)===null||l===void 0||l.call(o),this.emit(new _l(dt.AFTER_ELEMENT_DESTROY,t,e),n)}})}destroyElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["combo",a],["edge",i],["node",n]].forEach(([o,l])=>{l.forEach(u=>this.destroyElement(o,u,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,i;const a=(n=t.nodes)===null||n===void 0?void 0:n.find(s=>H(s)===e);if(a){const s=cn(this.context.model.getNodeLikeDatum(e)),o=cn(a),l=be(s,o);(i=t.nodes)===null||i===void 0||i.forEach(u=>{var c,h,d;!((c=u.style)===null||c===void 0)&&c.x&&(u.style.x+=l[0]),!((h=u.style)===null||h===void 0)&&h.y&&(u.style.y+=l[1]),!((d=u.style)===null||d===void 0)&&d.z&&(u.style.z+=l[2]||0)})}}collapseNode(t,e){return Du(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=e,{model:s,layout:o}=this.context,l=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!l)return;this.markDestroyElement(l.drawData);const u=yield o.simulate();a&&this.alignLayoutResultToElement(u,t),s.updateData(u);const c=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!c)return;const{drawData:h}=c,{add:d,remove:g,update:p}=h;this.markDestroyElement(h);const v={animation:i,stage:"collapse",data:h};this.destroyElements(g,v),this.createElements(d,v),this.updateElements(p,v),yield(n=this.context.animation.animate(i,{beforeAnimate:m=>this.emit(new ci(dt.BEFORE_ANIMATE,yr.COLLAPSE,m,h),v),afterAnimate:m=>this.emit(new ci(dt.AFTER_ANIMATE,yr.COLLAPSE,m,h),v)},{collapse:{target:t,descendants:Array.from(g.nodes).map(([,m])=>H(m)),position:cn(p.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return Du(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=e,l=cn(i.getNodeData([t])[0]),u=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!u)return;const{drawData:{add:c}}=u;this.createElements(c,{animation:!1,stage:"expand",target:t}),this.context.animation.clear();const h=yield a.simulate();o&&this.alignLayoutResultToElement(h,t),i.updateData(h),this.computeStyle("expand");const d=this.computeChangesAndDrawData({stage:"collapse",animation:s});if(!d)return;const{drawData:g}=d,{update:p}=g,v={animation:s,stage:"expand",data:g};c.edges.forEach(m=>p.edges.set(H(m),m)),c.nodes.forEach(m=>p.nodes.set(H(m),m)),this.updateElements(p,v),yield(n=this.context.animation.animate(s,{beforeAnimate:m=>this.emit(new ci(dt.BEFORE_ANIMATE,yr.EXPAND,m,g),v),afterAnimate:m=>this.emit(new ci(dt.AFTER_ANIMATE,yr.EXPAND,m,g),v)},{expand:{target:t,descendants:Array.from(c.nodes).map(([,m])=>H(m)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return Du(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,we).some(v=>_r(v)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!l)return;const{dataChanges:u,drawData:c}=l;this.markDestroyElement(c);const{update:h,remove:d}=c,g={animation:e,stage:"collapse",data:c};this.destroyElements(d,g),this.updateElements(h,g);const p=v=>Array.from(v).map(([,m])=>H(m));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new fn(dt.BEFORE_DRAW,{dataChanges:u,animation:e}),g),beforeAnimate:v=>this.emit(new ci(dt.BEFORE_ANIMATE,yr.COLLAPSE,v,c),g),afterAnimate:v=>this.emit(new ci(dt.AFTER_ANIMATE,yr.COLLAPSE,v,c),g),after:()=>this.emit(new fn(dt.AFTER_DRAW,{dataChanges:u,animation:e}),g)},{collapse:{target:t,descendants:[...p(d.nodes),...p(d.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return Du(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=cn(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:u,update:c}=l,h={animation:e,stage:"expand",data:l,target:t};this.createElements(u,h),this.updateElements(c,h);const d=g=>Array.from(g).map(([,p])=>H(p));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new fn(dt.BEFORE_DRAW,{dataChanges:o,animation:e}),h),beforeAnimate:g=>this.emit(new ci(dt.BEFORE_ANIMATE,yr.EXPAND,g,l),h),afterAnimate:g=>this.emit(new ci(dt.AFTER_ANIMATE,yr.EXPAND,g,l),h),after:()=>this.emit(new fn(dt.AFTER_DRAW,{dataChanges:o,animation:e}),h)},{expand:{target:t,descendants:[...d(u.nodes),...d(u.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}var Ml=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},Lgt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Igt{get presetOptions(){return{animation:!!n6(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.instances=[],this.context=t}getLayoutInstance(){return this.instances}preLayout(t){return Ml(this,void 0,void 0,function*(){var e,n,i,a;const{graph:s,model:o}=this.context,{add:l}=t;_n(s,new fn(dt.BEFORE_LAYOUT,{type:"pre"}));const u=yield(e=this.context.layout)===null||e===void 0?void 0:e.simulate();(n=u==null?void 0:u.nodes)===null||n===void 0||n.forEach(c=>{const h=H(c),d=l.nodes.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),(i=u==null?void 0:u.edges)===null||i===void 0||i.forEach(c=>{const h=H(c),d=l.edges.get(h);o.syncEdgeDatum(c),d&&Object.assign(d.style,c.style)}),(a=u==null?void 0:u.combos)===null||a===void 0||a.forEach(c=>{const h=H(c),d=l.combos.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),_n(s,new fn(dt.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return Ml(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;_n(n,new fn(dt.BEFORE_LAYOUT,{type:"post"}));for(const i of e){const a=e.indexOf(i),s=this.getLayoutData(i),o=Object.assign(Object.assign({},this.presetOptions),i);_n(n,new fn(dt.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);_n(n,new fn(dt.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}_n(n,new fn(dt.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(t,e){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(i=>i.afterLayout(t,e))}simulate(){return Ml(this,void 0,void 0,function*(){if(!this.options)return{};const t=Array.isArray(this.options)?this.options:[this.options];let e={};for(const n of t){const i=t.indexOf(n),a=this.getLayoutData(n);e=yield this.stepLayout(a,Object.assign(Object.assign(Object.assign({},this.presetOptions),n),{animation:!1}),i)}return e})}stepLayout(t,e,n){return Ml(this,void 0,void 0,function*(){return oJ(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return Ml(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=e,o=this.initGraphLayout(e);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const u=o;return this.supervisor=new vct(u.graphData2LayoutModel(t),u.instance,{iterations:s}),tf(yield this.supervisor.execute())}if(nx(o))return i?yield o.execute(t,{onTick:u=>{this.updateElementPosition(u,!1)}}):(o.execute(t),o.stop(),o.tick(s));const l=yield o.execute(t);if(i){const u=this.updateElementPosition(l,i);yield u==null?void 0:u.finished}return l})}treeLayout(t,e,n){return Ml(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=Wa("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=t,u=new kn({nodes:o.map(p=>({id:H(p),data:p.data||{}})),edges:l.map(p=>({id:H(p),source:p.source,target:p.target,data:p.data||{}}))});Pgt(u);const c={nodes:[],edges:[]},h={nodes:[],edges:[]};u.getRoots($r).forEach(p=>{Oo(p,x=>{x.children=u.getSuccessors(x.id)},x=>u.getSuccessors(x.id),"TB");const v=s(p,e),{x:m,y:b,z:w=0}=v;Oo(v,x=>{const{id:S,x:_,y:k,z:M=0}=x;c.nodes.push({id:S,style:{x:m,y:b,z:w}}),h.nodes.push({id:S,style:{x:_,y:k,z:M}})},x=>x.children,"TB")});const g=this.inferTreeLayoutOffset(h);if(uR(h,g),a){uR(c,g),this.updateElementPosition(c,!1);const p=this.updateElementPosition(h,a);yield p==null?void 0:p.finished}return h})}inferTreeLayoutOffset(t){var e;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(e=t.nodes)===null||e===void 0||e.forEach(v=>{const{x:m=0,y:b=0}=v.style||{};n=Math.min(n,m),i=Math.max(i,m),a=Math.min(a,b),s=Math.max(s,b)});const{canvas:o}=this.context,l=o.getSize(),[u,c]=o.getCanvasByViewport([0,0]),[h,d]=o.getCanvasByViewport(l);if(n>=u&&i<=h&&a>=c&&s<=d)return[0,0];const g=(u+h)/2,p=(c+d)/2;return[g-(n+i)/2,p-(a+s)/2]}stopLayout(){this.instance&&nx(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,preLayout:n=!1,isLayoutInvisibleNodes:i=!1}=t,{nodes:a,edges:s,combos:o}=this.context.model.getData(),{element:l,model:u}=this.context,c=v=>l.getElement(v),h=n?v=>{var m;return!i&&(((m=v.style)===null||m===void 0?void 0:m.visibility)==="hidden"||u.getAncestorsData(v.id,$r).some(_r)||u.getAncestorsData(v.id,we).some(_r))?!1:e(v)}:v=>{const m=H(v),b=c(m);return!b||M0(b)?!1:e(v)},d=a.filter(h),g=new Map(d.map(v=>[H(v),v]));o.forEach(v=>g.set(H(v),v));const p=s.filter(({source:v,target:m})=>g.has(v)&&g.has(m));return{nodes:d,edges:p,combos:o}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=t,u=Lgt(t,["type","enableWorker","animation","iterations"]),[c,h]=i.getCanvasSize(),d=[c/2,h/2],g=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:w=>{const x=n==null?void 0:n.getElement(w.id);return x?x.attributes.size:n==null?void 0:n.getElementComputedStyle("node",w).size},p=Wa("layout",a);if(!p)return la.warn(`The layout of ${a} is not registered.`);const v=Object.getPrototypeOf(p.prototype)===A0.prototype?p:uJ(p,this.context),m=new v(this.context),b={nodeSize:g,width:c,height:h,center:d};switch(m.id){case"d3-force":case"d3-force-3d":Object.assign(b,{center:{x:c/2,y:h/2,z:0}});break}return cr(m.options,b,u),m}updateElementPosition(t,e){const{model:n,element:i}=this.context;return i?(n.updateData(t),i.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},(t=this.supervisor)===null||t===void 0||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const uR=(r,t)=>{var e;const[n,i]=t;(e=r.nodes)===null||e===void 0||e.forEach(a=>{if(a.style){const{x:s=0,y:o=0}=a.style;a.style.x=s+n,a.style.y=o+i}else a.style={x:n,y:i}})};function Dgt(r){return[Fgt].reduce((e,n)=>n(e),r)}function Fgt(r){return!r.layout||Array.isArray(r.layout)||"preLayout"in r.layout||["antv-dagre","combo-combined","compact-box","circular","concentric","dagre","fishbone","grid","indented","mds","radial","random","snake","dendrogram","mindmap"].includes(r.layout.type)&&(r.layout.preLayout=!0),r}class Bgt extends Yx{constructor(t){super(t),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){const e=this.extensionMap[t];if(e)return e;la.warn(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===t);if(n)return this.extensionMap[n.key]}}const Ud=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class zgt extends Yx{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...Ud.slice(0,Ud.length-1),...t,Ud[Ud.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var Fu=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class $gt{get padding(){return ua(this.context.options.padding)}get paddingOffset(){const[t,e,n,i]=this.padding,[a,s,o]=[(i-e)/2,(t-n)/2,0];return[a,s,o]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=e,y:o=n}=t.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const a=Object.entries(t.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=e[n];if(typeof s=="function")return(...o)=>{const l=s.apply(e,o);return a.forEach(u=>{u[n].apply(u,o)}),l}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=n6(this.context.options,t);return e?Lo(Object.assign({},e),["easing","duration"]):!1}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:i=[]}=t,a=this.getZoom(),s=e.getPosition(),o=e.getFocalPoint(),[l,u]=this.getCanvasCenter(),[c=0,h=0,d=0]=i,g=Fi([-c,-h,-d],a);return n==="relative"?{position:It(s,g),focalPoint:It(o,g)}:{position:It([l,u,s[2]],g),focalPoint:It([l,u,o[2]],g)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:e==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=t;return Ke(i==="relative"?n*a:a,...e)}transform(t,e){return Fu(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const l=this.getAnimation(e);if(_n(n,new Hd(dt.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),_n(n,new Hd(dt.AFTER_TRANSFORM,t));return}const u={};if(i&&Object.assign(u,this.getTranslateOptions(t)),yt(a)&&Object.assign(u,this.getRotateOptions(t)),yt(s)&&Object.assign(u,{zoom:this.getZoomOptions(t)}),l)return _n(n,new ci(dt.BEFORE_ANIMATE,yr.TRANSFORM,null,t)),new Promise(c=>{this.transformResolver=c,this.camera.gotoLandmark(this.createLandmark(u),Object.assign(Object.assign({},l),{onfinish:()=>{_n(n,new ci(dt.AFTER_ANIMATE,yr.TRANSFORM,null,t)),_n(n,new Hd(dt.AFTER_TRANSFORM,t)),this.transformResolver=void 0,c()}}))});this.camera.gotoLandmark(this.createLandmark(u),{duration:0}),_n(n,new Hd(dt.AFTER_TRANSFORM,t))})}fitView(t,e){return Fu(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=t||{},[u,c]=this.context.canvas.getSize(),h=u-s-i,d=c-n-a,g=this.context.canvas.getBounds(),p=this.getBBoxInViewport(g),[v,m]=Xs(p),b=l==="x"&&v>=h||l==="y"&&m>=d||l==="both"&&v>=h&&m>=d;if(o==="overflow"&&!b)return yield this.fitCenter({animation:e});const w=h/v,x=d/m,S=l==="x"?w:l==="y"?x:Math.min(w,x),_=this.getAnimation(e);yield this.transform({mode:"relative",scale:S,translate:It(be(this.getCanvasCenter(),this.getBBoxInViewport(g).center),Fi(this.paddingOffset,S))},_)})}fitCenter(t){return Fu(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return Fu(this,arguments,void 0,function*(e,n={}){const{element:i}=this.context;if(!i)return;const a=o=>n.shapes?o.getShape(n.shapes).getRenderBounds():o.getRenderBounds(),s=Dc(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return Fu(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=be(i,n);yield this.transform({mode:"relative",translate:It(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,l]=i.getViewportByCanvas(n),u=new Me;return u.setMinMax([a,s,0],[o,l,0]),u}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[l,u]=i.getCanvasByViewport(a);let c=new Me;return c.setMinMax([s,o,0],[l,u,0]),n&&(c=Ks(c,n)),Yl(t)?Di(t,c):e?uX(t,c):c.intersects(t)}cancelAnimation(){var t,e;!((t=this.camera.landmarks)===null||t===void 0)&&t.length&&this.camera.cancelLandmarkAnimation(),(e=this.transformResolver)===null||e===void 0||e.call(this)}}var _e=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Dg extends O0{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new Ngt},this.isCollapsingExpanding=!1,this.onResize=Oc(()=>{this.resize()},300),this._setOptions(Object.assign({},Dg.defaultOptions,t),!0),this.context.graph=this,this.options.autoResize&&((e=globalThis.addEventListener)===null||e===void 0||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),Object.assign(this.options,Dgt(t)),e){const{data:d}=t;d&&this.addData(d);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:u,theme:c,transforms:h}=t;n&&this.setBehaviors(n),a&&this.setData(a),l&&this.setNode(l),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),c&&this.setTheme(c),u&&this.setPlugins(u),h&&this.setTransforms(h)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.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=Et(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Et(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Et(t)?t(this.getBehaviors()):t,(e=this.context.behavior)===null||e===void 0||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Et(t)?t(this.getPlugins()):t,(e=this.context.plugin)===null||e===void 0||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Et(t)?t(this.getTransforms()):t,(e=this.context.transform)===null||e===void 0||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map(e=>this.context.model.getElementDataById(e)):this.context.model.getElementDataById(t)}getNodeData(t){var e;return t===void 0?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):(e=this.context.model.getNodeData([t]))===null||e===void 0?void 0:e[0]}getEdgeData(t){var e;return t===void 0?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):(e=this.context.model.getEdgeData([t]))===null||e===void 0?void 0:e[0]}getComboData(t){var e;return t===void 0?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):(e=this.context.model.getComboData([t]))===null||e===void 0?void 0:e[0]}setData(t){this.context.model.setData(Et(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Et(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Et(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Et(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Et(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Et(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Et(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Et(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Et(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Et(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Et(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Et(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Et(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)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return _e(this,void 0,void 0,function*(){var t;if(this.context.canvas)return yield this.context.canvas.ready;const{container:e="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:l,devicePixelRatio:u=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof rR)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const c=se(e)?document.getElementById(e):e,h=sR(c);this.emit(dt.BEFORE_CANVAS_INIT,{container:c,width:n,height:i});const d=Object.assign(Object.assign({},l),{container:c,width:n||h[0],height:i||h[1],background:o,renderer:a,cursor:s,devicePixelRatio:u}),g=new rR(d);this.context.canvas=g,yield g.ready,this.emit(dt.AFTER_CANVAS_INIT,{canvas:g})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,l=this.context.canvas;l&&(i&&(this.emit(dt.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(dt.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(yt(o)||yt(s))&&this.setSize((e=o??this.options.width)!==null&&e!==void 0?e:0,(n=s??this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new Tgt(this.context)),this.context.plugin||(this.context.plugin=new Bgt(this.context)),this.context.viewport||(this.context.viewport=new $gt(this.context)),this.context.transform||(this.context.transform=new zgt(this.context)),this.context.element||(this.context.element=new Rgt(this.context)),this.context.animation||(this.context.animation=new Cgt(this.context)),this.context.layout||(this.context.layout=new Igt(this.context)),this.context.behavior||(this.context.behavior=new Ogt(this.context))}prepare(){return _e(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Ia("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return _e(this,void 0,void 0,function*(){if(yield this.prepare(),_n(this,new fn(dt.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&lJ(this.options.layout)){const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}this.rendered=!0,_n(this,new fn(dt.AFTER_RENDER))})}draw(){return _e(this,void 0,void 0,function*(){var t;yield this.prepare(),yield(t=this.context.element.draw())===null||t===void 0?void 0:t.finished})}layout(t){return _e(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return _e(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;_n(this,new fn(dt.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.destroy(),o==null||o.destroy(),e==null||e.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(t=globalThis.removeEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize),this.destroyed=!0,_n(this,new fn(dt.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=sR((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[t||i[0],e||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();Ze(a,s)||(_n(this,new fn(dt.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),_n(this,new fn(dt.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return _e(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(t,e)})}fitCenter(t){return _e(this,void 0,void 0,function*(){var e;yield(e=this.context.viewport)===null||e===void 0?void 0:e.fitCenter({animation:t})})}autoFit(){return _e(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(se(t))t==="view"?yield this.fitView():t==="center"&&(yield this.fitCenter());else{const{type:e,animation:n}=t;e==="view"?yield this.fitView(t.options,n):e==="center"&&(yield this.fitCenter(n))}})}focusElement(t,e){return _e(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return _e(this,void 0,void 0,function*(){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return be([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeBy(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeTo(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Px(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([g,p])=>{const v=this.getElementType(g);c[`${v}s`].push({id:g,style:{visibility:p}})});const{model:h,element:d}=this.context;h.preventUpdateNodeLikeHierarchy(()=>{h.updateData(c)}),yield(o=d.draw({animation:u,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return _e(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),e)})}hideElement(t,e){return _e(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),e)})}getElementVisibility(t){var e,n;const i=this.context.element.getElement(t);return(n=(e=i==null?void 0:i.style)===null||e===void 0?void 0:e.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(t,e){return _e(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=un(t)?t:{[t]:e};Object.entries(a).forEach(([l,u])=>{const c=this.getElementType(l);i[`${c}s`].push({id:l,style:{zIndex:u}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(t){return _e(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,i={};e.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const l=n.getAncestorsData(a,we).at(-1)||this.getComboData(a),u=[l,...n.getDescendantsData(H(l))],c=s-oR(l);u.forEach(d=>{i[H(d)]=this.getElementZIndex(H(d))+c});const{internal:h}=qw(u.map(H),d=>n.getRelatedEdgesData(d));h.forEach(d=>{const g=H(d);i[g]=this.getElementZIndex(g)+c})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return oR(this.context.model.getElementDataById(t))}setElementState(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=un(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c=d=>d?Array.isArray(d)?d:[d]:[],h={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([d,g])=>{const p=this.getElementType(d);h[`${p}s`].push({id:d,states:c(g)})}),this.updateData(h),yield(o=this.context.element.draw({animation:u,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return _e(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(_r(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);yield this.frontElement(e),this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!0),s==="node"?yield a.collapseNode(e,n):s==="combo"&&(yield a.collapseCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return _e(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!_r(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!1),s==="node"?yield a.expandNode(e,n):s==="combo"&&(yield a.expandCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);n==="node"?this.updateNodeData([{id:t,style:{collapsed:e}}]):n==="combo"&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return _e(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}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)}}Dg.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var jgt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function qgt(r,t){const{getNodeData:e=(o,l)=>{if(o.depth=l,!o.children)return o;const{children:u}=o,c=jgt(o,["children"]);return Object.assign(Object.assign({},c),{children:u.map(h=>h.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return Oo(r,(o,l)=>{a.push(e(o,l));const u=i(o);for(const c of u)s.push(n(o,c))},o=>i(o),"TB"),{nodes:a,edges:s}}class Wgt extends Ja{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{m4(i,a)}),t}}const m4=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=QM(i,h=>r.getParentData(h,we)),o=QM(a,h=>r.getParentData(h,we)),l=H(s),u=H(o),c={sourceNode:l,targetNode:u};return t.style?Object.assign(t.style,c):t.style=c,t},Ggt=(r,t,e)=>{const[n,i]=t,[a,s]=e;if(i===n)return a;const o=(r-n)/(i-n);return a+o*(s-a)},Vgt=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.log(r-n+1)/Math.log(i-n+1);return a+o*(s-a)},Hgt=(r,t,e,n=2)=>{const[i,a]=t,[s,o]=e,l=Math.pow((r-i)/(a-i),n);return s+l*(o-s)},Ugt=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class Fg extends Ja{constructor(t,e){super(t,cr({},Fg.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const u=[i,a],c=[s[0],o[0]],h=[s[1],o[1]],d=[s[2],o[2]],g=(p,v)=>{if(typeof l=="function")return l(p,u,v);switch(l){case"linear":return Ggt(p,u,v);case"log":return Vgt(p,u,v);case"pow":return Hgt(p,u,v,2);case"sqrt":return Ugt(p,u,v);default:return v[0]}};return[g(n,c),g(n,h),g(n,d)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=Vr(this.options.maxSize),a=Vr(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,l=s.size>0?Math.min(...s.values()):0;return n.forEach(u=>{var c;const h=this.assignSizeByCentrality(s.get(H(u))||0,l,o,a,i,this.options.scale),d=(c=this.context.element)===null||c===void 0?void 0:c.getElement(H(u)),g={size:h};this.assignLabelStyle(g,h,u,d),(!d||!lf(g,d.attributes))&&Gr(t,d?"update":"add","node",cr(u,{style:g}),!0)}),t}assignLabelStyle(t,e,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(t,Lo(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+lX(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const i=Math.min(...t)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(s,Math.max(i,a))}getCentralities(t){const{model:e}=this.context,n=e.getData();if(typeof t=="function")return t(n);const i=e.getRelatedEdgesData.bind(e);return f6(n,i,t)}}Fg.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class Bg extends Ja{constructor(t,e){super(t,Object.assign({},Bg.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=cn(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(H(s)===H(this.ref))return;const l=p6(be(cn(s),e)),u=Math.abs(l)>Math.PI/2,c=!s.children||s.children.length===0,h=H(s),d=(o=this.context.element)===null||o===void 0?void 0:o.getElement(h);if(!d||!d.isVisible())return;const g=Vr(n.getElementRenderStyle(h).size)[0]/2,p=(c?1:-1)*(g+this.options.offset),v=[["translate",p*Math.cos(l),p*Math.sin(l)],["rotate",u?wr(l)+180:wr(l)]];i.updateNodeData([{id:H(s),style:{labelTextAlign:u===c?"right":"left",labelTextBaseline:"middle",labelTransform:v}}])}),n.draw()}}Bg.defaultOptions={offset:5};const Ygt="quadratic",cR=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class zg extends Ja{constructor(t,e){super(t,Object.assign({},zg.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:l}}=n,{model:u}=this.context,c=new Map,h=(p,v)=>{u.getRelatedEdgesData(v).forEach(b=>!c.has(H(b))&&c.set(H(b),b))};a.forEach(h),o.forEach(h);const d=p=>{const v=u.getEdgeData().map(b=>m4(u,b));Xgt(p,v).forEach(b=>!c.has(H(b))&&c.set(H(b),b))};if(l.size&&l.forEach(d),i.size&&i.forEach(d),s.size){const p=_5(zE(u.getChanges())).update.edges;s.forEach(v=>{var m;d(v);const b=(m=p.find(w=>H(w.value)===H(v)))===null||m===void 0?void 0:m.original;b&&!t_(v,b)&&d(b)})}Ji(this.options.edges)||c.forEach((p,v)=>!this.options.edges.includes(v)&&c.delete(v));const g=u.getEdgeData().map(H);return new Map([...c].sort((p,v)=>g.indexOf(p[0])-g.indexOf(v[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=hR(i);s.forEach(l=>{l.forEach((u,c,h)=>{var d;const g=h.length,p=u.style||{};if(u.source===u.target){const b=cR.length;p.loopPlacement=cR[c%b],p.loopDist=Math.floor(c/b)*a+50}else if(g===1)p.curveOffset=0;else{const b=(c%2===0?1:-1)*(o[`${u.source}|${u.target}|${c}`]?-1:1);p.curveOffset=g%2===1?b*Math.ceil(c/2)*a*2:b*(Math.floor(c/2)*a*2+a)}const v=Object.assign(u,{type:Ygt,style:p}),m=(d=this.context.element)===null||d===void 0?void 0:d.getElement(H(u));(!m||!lf(v.style,m.attributes))&&Gr(n,m?"update":"add","edge",v,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(H(n))||{};return Object.keys(a).forEach(s=>{Ze(i[s],a[s])&&(n[s]?i[s]=n[s]:delete i[s])}),Object.assign(n,{style:i})},this.applyMergingStyle=(n,i)=>{const{edgeMap:a,reverses:s}=hR(i);a.forEach(o=>{var l;if(o.length===1){const c=o[0],h=(l=this.context.element)===null||l===void 0?void 0:l.getElement(H(c)),d=this.resetEdgeStyle(c);(!h||!lf(d,h.attributes))&&Gr(n,h?"update":"add","edge",d);return}const u=o.map(({source:c,target:h,style:d={}},g)=>{const{startArrow:p,endArrow:v}=d,m={},[b,w]=s[`${c}|${h}|${g}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return yf(p)&&(m[b]=p),yf(v)&&(m[w]=v),m}).reduce((c,h)=>Object.assign(Object.assign({},c),h),{});o.forEach((c,h,d)=>{var g;if(h!==0){Gr(n,"remove","edge",c);return}const p=Object.assign({},Et(this.options.style)?this.options.style(d):this.options.style,{childrenData:d});this.cacheMergeStyle.set(H(c),p);const v=Object.assign(Object.assign({},c),{type:"line",style:Object.assign(Object.assign(Object.assign({},c.style),u),p)}),m=(g=this.context.element)===null||g===void 0?void 0:g.getElement(H(c));(!m||!lf(v.style,m.attributes))&&Gr(n,m?"update":"add","edge",v,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return e.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}zg.defaultOptions={mode:"bundle",distance:15};const hR=r=>{const t=new Map,e=new Set,n={};for(const[i,a]of r){if(e.has(i))continue;const{source:s,target:o}=a,l=`${s}-${o}`;t.has(l)||t.set(l,[]),t.get(l).push(a),e.add(i);for(const[u,c]of r)e.has(u)||t_(a,c)&&(t.get(l).push(c),e.add(u),s===c.target&&o===c.source&&(n[`${c.source}|${c.target}|${t.get(l).length-1}`]=!0))}return{edgeMap:t,reverses:n}},Xgt=(r,t,e)=>t.filter(n=>t_(n,r)),t_=(r,t)=>{const{sourceNode:e,targetNode:n}=r.style||{},{sourceNode:i,targetNode:a}=t.style||{};return e===i&&n===a||e===a&&n===i};class Kgt extends Ja{beforeDraw(t,e){const{stage:n}=e;if(n==="visibility")return t;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=t,l=(u,c)=>{i.getRelatedEdgesData(c).forEach(d=>!s.has(H(d))&&s.set(H(d),d))};return a.forEach(l),o.forEach(l),t}}const Zgt={animation:{"combo-collapse":s6,"combo-expand":aX,"node-collapse":i6,"node-expand":rX,"path-in":a6,"path-out":iX,fade:eX,translate:nX},behavior:{"brush-select":Fc,"click-select":p0,"collapse-expand":k0,"create-edge":C0,"drag-canvas":T0,"drag-element-force":hJ,"drag-element":Wc,"fix-element-size":P0,"focus-element":N0,"hover-activate":R0,"lasso-select":fJ,"auto-adapt-label":d0,"optimize-viewport-transform":L0,"scroll-canvas":I0,"zoom-canvas":D0},combo:{circle:cZ,rect:hZ},edge:{cubic:Ho,line:U6,polyline:_0,quadratic:S0,"cubic-horizontal":jc,"cubic-radial":x0,"cubic-vertical":E0},layout:{"antv-dagre":det,"combo-combined":frt,"compact-box":Td.compactBox,"d3-force":zrt,"force-atlas2":Fut,circular:pet,concentric:Qw,dagre:lg,dendrogram:Td.dendrogram,fishbone:ug,force:OI,fruchterman:$ut,grid:qut,indented:Td.indented,mds:zI,mindmap:Td.mindmap,radial:Zut,random:ict,snake:cg},node:{circle:$c,diamond:fK,ellipse:y0,hexagon:yK,html:b0,image:$6,rect:lZ,star:uZ,donut:m0,triangle:w0},palette:{spectral:wct,tableau:xct,oranges:Ect,greens:_ct,blues:Sct},theme:{dark:pgt,light:mgt},plugin:{"bubble-sets":fg,"edge-bundling":pg,"edge-filter-lens":vg,"grid-line":bg,background:hg,contextmenu:gg,fisheye:mg,fullscreen:yg,history:wg,hull:xg,legend:Tg,minimap:Og,snapline:Ag,timebar:Pg,toolbar:Ng,tooltip:Rg,watermark:Lg},transform:{"arrange-draw-order":ygt,"collapse-expand-combo":bgt,"collapse-expand-node":wgt,"get-edge-actual-ends":Wgt,"map-node-size":Fg,"place-radial-labels":Bg,"process-parallel-edges":zg,"update-related-edges":Kgt},shape:{circle:Ya,ellipse:Rc,group:Mn,html:Lc,image:Qx,line:Fo,path:jr,polygon:Vo,polyline:c0,rect:Nn,text:Ys,label:Zs,badge:ja}};function Jgt(){Object.entries(Zgt).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{tc(r,e,n)})})}Jgt();const Qgt={class:"progress"},tpt={__name:"MindMapping",props:{data:Object,loading:Boolean},setup(r){const t=r,e=ue(null),n=ue(0),i=ue(null),a=()=>{i.value=setInterval(()=>{n.value+=Math.random()>.5?3:2,n.value>98&&(n.value=98,clearInterval(i.value))},1e3)};n0(()=>{t.loading&&!t.data&&a()}),r0(()=>{clearInterval(i.value)}),uf(()=>t.loading,_=>{_&&!t.data?a():clearInterval(i.value)}),uf(()=>t.data,_=>{_&&w(_)});const s={fill:"#EFF0F0",labelFill:"#262626",labelFontSize:24,labelFontWeight:600,labelOffsetY:8,labelPlacement:"center",ports:[{placement:"right"},{placement:"left"}],radius:8},o={fill:"transparent",labelPlacement:"center",labelFontSize:16,ports:[{placement:"right-bottom"},{placement:"left-bottom"}]},l={COLLAPSE_EXPAND:"collapse-expand",ADD_CHILD:"add-child"};let u;const c=_=>(u||(u=new Ys({style:_})),u.attr(_),u.getBBox().width),h=(_,k)=>{const M=k?40:30;return c({text:_,fontSize:(k?s:o).labelFontSize,fontFamily:"Gill Sans"})+M},d=(_,k)=>[h(_,k),k?48:32],x=class x extends mi{constructor(k){Object.assign(k.style,x.defaultStyleProps),super(k)}get childrenData(){return this.context.model.getChildrenData(this.id)}get rootId(){return H(this.context.model.getRootsData()[0])}isShowCollapse(k){const{collapsed:M,showIcon:C}=k;return!M&&C&&this.childrenData.length>0}getCollapseStyle(k){const{color:M,direction:C}=k;if(!this.isShowCollapse(k))return!1;const[P,T]=this.getSize(k);return{backgroundFill:M,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",stroke:M,lineWidth:4,fontSize:0,text:"",textAlign:"center",transform:[],visibility:"visible",x:C==="left"?-6:P+6,y:T}}drawCollapseShape(k,M){const C=this.getCollapseStyle(k),P=this.upsert("collapse-expand",ja,C,M);this.forwardEvent(P,J.CLICK,T=>{T.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!k.collapsed})})}getCountStyle(k){const{collapsed:M,color:C,direction:P}=k,T=this.context.model.getDescendantsData(this.id).length;if(!M||T===0)return!1;const[A,R]=this.getSize(k);return{backgroundFill:C,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",fill:"#fff",fontSize:8,text:T.toString(),textAlign:"center",x:P==="left"?-4:A+4,y:R}}drawCountShape(k,M){const C=this.getCountStyle(k),P=this.upsert("count",ja,C,M);this.forwardEvent(P,J.CLICK,T=>{T.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!1})})}getAddStyle(k){const{collapsed:M,showIcon:C,direction:P}=k,T=this.childrenData.length===0;if(M||!C||!T)return!1;const[A,R]=this.getSize(k),L=this.isShowCollapse(k)?24:12,$=this.id===this.rootId;return{backgroundFill:"#1783FF",backgroundHeight:14,backgroundLineWidth:1,backgroundStroke:"#1783FF",backgroundWidth:14,cursor:"pointer",fill:"#fff",fontSize:14,text:"+",textAlign:"center",x:$?A+12:P==="left"?-L:A+L,y:$?R/2:R}}drawAddShape(k,M){const C=this.getAddStyle(k),P=this.upsert("add",ja,C,M);this.forwardEvent(P,J.CLICK,T=>{T.stopPropagation(),this.context.graph.emit(l.ADD_CHILD,{id:this.id,direction:k.direction})})}forwardEvent(k,M,C){k&&!Reflect.has(k,"__bind__")&&(Reflect.set(k,"__bind__",!0),k.addEventListener(M,C))}getKeyStyle(k){const[M,C]=this.getSize(k),P=super.getKeyStyle(k);return{width:M,height:C,...P}}drawKeyShape(k,M){const C=this.getKeyStyle(k);return this.upsert("key",Nn,C,M)}render(k=this.parsedAttributes,M=this){super.render(k,M),this.drawCollapseShape(k,M),this.drawAddShape(k,M),this.drawCountShape(k,M)}};oe(x,"defaultStyleProps",{showIcon:!0});let g=x;class p extends jc{get rootId(){return H(this.context.model.getRootsData()[0])}getKeyPath(k){const M=super.getKeyPath(k),C=this.targetNode.id===this.rootId,P=h(this.targetNode.id,C),[,T]=this.getEndpoints(k),A=this.sourceNode.getCenter()[0]<this.targetNode.getCenter()[0]?1:-1;return[...M,["L",T[0]+P*A,T[1]]]}}class v extends Cr{constructor(M,C){super(M,C);oe(this,"status","idle");oe(this,"showIcon",M=>{this.setIcon(M,!0)});oe(this,"hideIcon",M=>{this.setIcon(M,!1)});oe(this,"setIcon",(M,C)=>{if(this.status!=="idle")return;const{target:P}=M,T=P.id,{graph:A,element:R}=this.context;A.updateNodeData([{id:T,style:{showIcon:C}}]),R.draw({animation:!1,silence:!0})});oe(this,"onCollapseExpand",async M=>{this.status="busy";const{id:C,collapsed:P}=M,{graph:T}=this.context;await T.frontElement(C),P?await T.collapseElement(C):await T.expandElement(C),this.status="idle"});oe(this,"addChild",async M=>{this.status="busy";const{onCreateChild:C=()=>({id:`新节点 in ${new Date(Date.now()).toLocaleString()}`})}=this.options,{graph:P}=this.context,T=C(M.id),A=P.getNodeData(M.id);P.addNodeData([T]),P.addEdgeData([{source:M.id,target:T.id}]),P.updateNodeData([{id:M.id,children:[...A.children||[],T.id],style:{collapsed:!1,showIcon:!1}}]),await P.render(),await P.focusElement(T.id),this.status="idle"});this.bindEvents()}update(M){this.unbindEvents(),super.update(M),this.bindEvents()}bindEvents(){const{graph:M}=this.context;M.on(l.COLLAPSE_EXPAND,this.onCollapseExpand),M.on(l.ADD_CHILD,this.addChild)}unbindEvents(){const{graph:M}=this.context;M.off(l.COLLAPSE_EXPAND,this.onCollapseExpand),M.off(l.ADD_CHILD,this.addChild)}}const S=class S extends Ja{constructor(k,M){super(k,Object.assign({},S.defaultOptions,M))}beforeDraw(k){const M=this.context.model.getNodeData(),C=this.context.model.getEdgeData();if(M.length===0)return k;let P=0;return M.forEach(T=>{T.style||(T.style={}),T.style.color=this.options.colors[P++%this.options.colors.length]}),C.forEach(T=>{const A=M.find(R=>R.id===T.target);A&&(T.style||(T.style={}),T.style.stroke=A.style.color)}),k}};oe(S,"defaultOptions",{colors:["#80B4FF","#FFC8A2","#E6C8FF","#A2E6E6","#C8B4FF","#FFD878","#A2E680","#FFA2D8","#80C8D8","#80E6A2","#FFD878","#D880D8","#80C880","#FFA280","#80E6E6","#FFA2D8","#C8C8D8","#FFC8C8","#FFD878","#C8FF80"]});let m=S;tc(La.NODE,"mindmap",g),tc(La.EDGE,"mindmap",p),tc(La.BEHAVIOR,"collapse-expand-tree",v),tc(La.TRANSFORM,"assign-color-by-branch",m);const b=(_,k)=>{if(!k)return"center";const M=cn(_)[0];return cn(k)[0]>M?"left":"right"},w=_=>{var C,P;const k=_.id,M=new Dg({container:e.value,width:((C=e.value)==null?void 0:C.clientWidth)||1e3,height:((P=e.value)==null?void 0:P.clientHeight)||800,fitView:!0,fitCenter:!0,data:qgt(_),node:{type:"mindmap",style:function(T){const A=b(T,this.getParentData(H(T),"tree")),R=H(T)===k;return{direction:A,labelText:H(T),size:d(H(T),R),labelFontFamily:"Gill Sans",labelBackground:!0,labelBackgroundFill:"transparent",labelPadding:A==="left"?[2,0,10,40]:[2,40,10,0],color:T.style.color,...R?s:o}}},edge:{type:"mindmap",style:{lineWidth:3,stroke:function(T){return this.getNodeData(T.target).style.color||"#99ADD1"}}},layout:{type:"mindmap",direction:"H",getHeight:()=>80,getWidth:T=>h(T.id,T.id===k),getVGap:()=>6,getHGap:()=>60,animation:!1,getSide:()=>"right"},behaviors:["drag-canvas","zoom-canvas","collapse-expand-tree"],transforms:["assign-color-by-branch"],animation:{duration:200}});M.once(dt.AFTER_RENDER,()=>{M.fitView()}),M.render()};return(_,k)=>{const M=Lj;return Pt(),Xe(jl,null,[fj(Pe("div",Qgt,[le(M,{type:"circle",width:"250","stroke-width":"10",percent:n.value/100,"show-text":!1},null,8,["percent"]),Pe("h1",null,Il(`${n.value}%`),1)],512),[[gj,!r.data&&r.loading]]),Pe("div",{ref_key:"container",ref:e,class:"mindmap-container"},null,512)],64)}}},ept=Vs(tpt,[["__scopeId","data-v-524c2b35"]]),npt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='29'%20height='16'%20rx='2'%20fill='%23155EEF'%20/%3e%3cpath%20d='M7.40163%2030H4.82351V22.7273H7.42294C8.15447%2022.7273%208.78421%2022.8729%209.31214%2023.1641C9.84008%2023.4529%2010.2461%2023.8684%2010.5302%2024.4105C10.8166%2024.9527%2010.9599%2025.6013%2010.9599%2026.3565C10.9599%2027.1141%2010.8166%2027.7652%2010.5302%2028.3097C10.2461%2028.8542%209.83771%2029.272%209.30504%2029.5632C8.77474%2029.8544%208.14027%2030%207.40163%2030ZM6.36115%2028.6825H7.33771C7.79226%2028.6825%208.1746%2028.602%208.48473%2028.4411C8.79723%2028.2777%209.03161%2028.0256%209.18786%2027.6847C9.34647%2027.3414%209.42578%2026.8987%209.42578%2026.3565C9.42578%2025.8191%209.34647%2025.38%209.18786%2025.0391C9.03161%2024.6982%208.79841%2024.4472%208.48828%2024.2862C8.17815%2024.1252%207.79581%2024.0447%207.34126%2024.0447H6.36115V28.6825ZM18.7821%2026.3636C18.7821%2027.1567%2018.6318%2027.8314%2018.3311%2028.3878C18.0328%2028.9441%2017.6257%2029.3691%2017.1096%2029.6626C16.5958%2029.9538%2016.0182%2030.0994%2015.3766%2030.0994C14.7303%2030.0994%2014.1503%2029.9527%2013.6365%2029.6591C13.1228%2029.3655%2012.7168%2028.9406%2012.4185%2028.3842C12.1202%2027.8279%2011.9711%2027.1544%2011.9711%2026.3636C11.9711%2025.5705%2012.1202%2024.8958%2012.4185%2024.3395C12.7168%2023.7831%2013.1228%2023.3594%2013.6365%2023.0682C14.1503%2022.7746%2014.7303%2022.6278%2015.3766%2022.6278C16.0182%2022.6278%2016.5958%2022.7746%2017.1096%2023.0682C17.6257%2023.3594%2018.0328%2023.7831%2018.3311%2024.3395C18.6318%2024.8958%2018.7821%2025.5705%2018.7821%2026.3636ZM17.2232%2026.3636C17.2232%2025.8499%2017.1462%2025.4167%2016.9924%2025.0639C16.8408%2024.7112%2016.6266%2024.4437%2016.3496%2024.2614C16.0726%2024.0791%2015.7483%2023.9879%2015.3766%2023.9879C15.0049%2023.9879%2014.6806%2024.0791%2014.4036%2024.2614C14.1266%2024.4437%2013.9112%2024.7112%2013.7573%2025.0639C13.6058%2025.4167%2013.53%2025.8499%2013.53%2026.3636C13.53%2026.8774%2013.6058%2027.3106%2013.7573%2027.6634C13.9112%2028.0161%2014.1266%2028.2836%2014.4036%2028.4659C14.6806%2028.6482%2015.0049%2028.7393%2015.3766%2028.7393C15.7483%2028.7393%2016.0726%2028.6482%2016.3496%2028.4659C16.6266%2028.2836%2016.8408%2028.0161%2016.9924%2027.6634C17.1462%2027.3106%2017.2232%2026.8774%2017.2232%2026.3636ZM26.3381%2025.2734H24.7827C24.7543%2025.0722%2024.6963%2024.8935%2024.6087%2024.7372C24.5211%2024.5786%2024.4086%2024.4437%2024.2713%2024.3324C24.134%2024.2211%2023.9754%2024.1359%2023.7955%2024.0767C23.6179%2024.0175%2023.425%2023.9879%2023.2166%2023.9879C22.8402%2023.9879%2022.5123%2024.0814%2022.233%2024.2685C21.9536%2024.4531%2021.737%2024.723%2021.5831%2025.0781C21.4292%2025.4309%2021.3523%2025.8594%2021.3523%2026.3636C21.3523%2026.8821%2021.4292%2027.3177%2021.5831%2027.6705C21.7393%2028.0232%2021.9571%2028.2895%2022.2365%2028.4695C22.5159%2028.6494%2022.839%2028.7393%2023.206%2028.7393C23.4119%2028.7393%2023.6025%2028.7121%2023.7777%2028.6577C23.9553%2028.6032%2024.1127%2028.5239%2024.25%2028.4197C24.3873%2028.3132%2024.5009%2028.1842%2024.5909%2028.0327C24.6832%2027.8812%2024.7472%2027.7083%2024.7827%2027.5142L26.3381%2027.5213C26.2978%2027.8551%2026.1972%2028.1771%2026.0362%2028.4872C25.8776%2028.795%2025.6634%2029.0708%2025.3935%2029.3146C25.1259%2029.5561%2024.8063%2029.7479%2024.4347%2029.8899C24.0653%2030.0296%2023.6475%2030.0994%2023.1811%2030.0994C22.5324%2030.0994%2021.9524%2029.9527%2021.4411%2029.6591C20.9321%2029.3655%2020.5296%2028.9406%2020.2337%2028.3842C19.9401%2027.8279%2019.7933%2027.1544%2019.7933%2026.3636C19.7933%2025.5705%2019.9425%2024.8958%2020.2408%2024.3395C20.5391%2023.7831%2020.9439%2023.3594%2021.4553%2023.0682C21.9666%2022.7746%2022.5419%2022.6278%2023.1811%2022.6278C23.6025%2022.6278%2023.9931%2022.687%2024.353%2022.8054C24.7152%2022.9238%2025.036%2023.0966%2025.3153%2023.3239C25.5947%2023.5488%2025.822%2023.8246%2025.9972%2024.1513C26.1747%2024.478%2026.2884%2024.852%2026.3381%2025.2734Z'%20fill='white'%20/%3e%3c/svg%3e",rpt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='36'%20height='16'%20rx='2'%20fill='%23155EEF'%20/%3e%3cpath%20d='M7.40554%2030H4.82741V22.7273H7.42685C8.15838%2022.7273%208.78812%2022.8729%209.31605%2023.1641C9.84399%2023.4529%2010.25%2023.8684%2010.5341%2024.4105C10.8205%2024.9527%2010.9638%2025.6013%2010.9638%2026.3565C10.9638%2027.1141%2010.8205%2027.7652%2010.5341%2028.3097C10.25%2028.8542%209.84162%2029.272%209.30895%2029.5632C8.77865%2029.8544%208.14418%2030%207.40554%2030ZM6.36506%2028.6825H7.34162C7.79616%2028.6825%208.1785%2028.602%208.48864%2028.4411C8.80114%2028.2777%209.03551%2028.0256%209.19176%2027.6847C9.35038%2027.3414%209.42969%2026.8987%209.42969%2026.3565C9.42969%2025.8191%209.35038%2025.38%209.19176%2025.0391C9.03551%2024.6982%208.80232%2024.4472%208.49219%2024.2862C8.18205%2024.1252%207.79972%2024.0447%207.34517%2024.0447H6.36506V28.6825ZM18.786%2026.3636C18.786%2027.1567%2018.6357%2027.8314%2018.335%2028.3878C18.0368%2028.9441%2017.6296%2029.3691%2017.1135%2029.6626C16.5997%2029.9538%2016.0221%2030.0994%2015.3805%2030.0994C14.7342%2030.0994%2014.1542%2029.9527%2013.6404%2029.6591C13.1267%2029.3655%2012.7207%2028.9406%2012.4224%2028.3842C12.1241%2027.8279%2011.975%2027.1544%2011.975%2026.3636C11.975%2025.5705%2012.1241%2024.8958%2012.4224%2024.3395C12.7207%2023.7831%2013.1267%2023.3594%2013.6404%2023.0682C14.1542%2022.7746%2014.7342%2022.6278%2015.3805%2022.6278C16.0221%2022.6278%2016.5997%2022.7746%2017.1135%2023.0682C17.6296%2023.3594%2018.0368%2023.7831%2018.335%2024.3395C18.6357%2024.8958%2018.786%2025.5705%2018.786%2026.3636ZM17.2271%2026.3636C17.2271%2025.8499%2017.1502%2025.4167%2016.9963%2025.0639C16.8448%2024.7112%2016.6305%2024.4437%2016.3535%2024.2614C16.0765%2024.0791%2015.7522%2023.9879%2015.3805%2023.9879C15.0088%2023.9879%2014.6845%2024.0791%2014.4075%2024.2614C14.1305%2024.4437%2013.9151%2024.7112%2013.7612%2025.0639C13.6097%2025.4167%2013.5339%2025.8499%2013.5339%2026.3636C13.5339%2026.8774%2013.6097%2027.3106%2013.7612%2027.6634C13.9151%2028.0161%2014.1305%2028.2836%2014.4075%2028.4659C14.6845%2028.6482%2015.0088%2028.7393%2015.3805%2028.7393C15.7522%2028.7393%2016.0765%2028.6482%2016.3535%2028.4659C16.6305%2028.2836%2016.8448%2028.0161%2016.9963%2027.6634C17.1502%2027.3106%2017.2271%2026.8774%2017.2271%2026.3636ZM26.342%2025.2734H24.7866C24.7582%2025.0722%2024.7002%2024.8935%2024.6126%2024.7372C24.525%2024.5786%2024.4125%2024.4437%2024.2752%2024.3324C24.1379%2024.2211%2023.9793%2024.1359%2023.7994%2024.0767C23.6218%2024.0175%2023.4289%2023.9879%2023.2205%2023.9879C22.8441%2023.9879%2022.5162%2024.0814%2022.2369%2024.2685C21.9575%2024.4531%2021.7409%2024.723%2021.587%2025.0781C21.4331%2025.4309%2021.3562%2025.8594%2021.3562%2026.3636C21.3562%2026.8821%2021.4331%2027.3177%2021.587%2027.6705C21.7433%2028.0232%2021.9611%2028.2895%2022.2404%2028.4695C22.5198%2028.6494%2022.8429%2028.7393%2023.2099%2028.7393C23.4158%2028.7393%2023.6064%2028.7121%2023.7816%2028.6577C23.9592%2028.6032%2024.1166%2028.5239%2024.2539%2028.4197C24.3912%2028.3132%2024.5049%2028.1842%2024.5948%2028.0327C24.6871%2027.8812%2024.7511%2027.7083%2024.7866%2027.5142L26.342%2027.5213C26.3017%2027.8551%2026.2011%2028.1771%2026.0401%2028.4872C25.8815%2028.795%2025.6673%2029.0708%2025.3974%2029.3146C25.1299%2029.5561%2024.8103%2029.7479%2024.4386%2029.8899C24.0692%2030.0296%2023.6514%2030.0994%2023.185%2030.0994C22.5363%2030.0994%2021.9563%2029.9527%2021.445%2029.6591C20.936%2029.3655%2020.5335%2028.9406%2020.2376%2028.3842C19.944%2027.8279%2019.7972%2027.1544%2019.7972%2026.3636C19.7972%2025.5705%2019.9464%2024.8958%2020.2447%2024.3395C20.543%2023.7831%2020.9478%2023.3594%2021.4592%2023.0682C21.9705%2022.7746%2022.5458%2022.6278%2023.185%2022.6278C23.6064%2022.6278%2023.997%2022.687%2024.3569%2022.8054C24.7191%2022.9238%2025.0399%2023.0966%2025.3192%2023.3239C25.5986%2023.5488%2025.8259%2023.8246%2026.0011%2024.1513C26.1786%2024.478%2026.2923%2024.852%2026.342%2025.2734ZM28.7301%2022.7273L30.1967%2025.206H30.2536L31.7273%2022.7273H33.4638L31.2443%2026.3636L33.5135%2030H31.745L30.2536%2027.5178H30.1967L28.7053%2030H26.9439L29.2202%2026.3636L26.9865%2022.7273H28.7301Z'%20fill='white'%20/%3e%3c/svg%3e",ipt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='26'%20height='16'%20rx='2'%20fill='%23D92D20'%20/%3e%3cpath%20d='M4.8323%2030V22.7273H7.70162C8.25323%2022.7273%208.72316%2022.8326%209.11142%2023.0433C9.49967%2023.2517%209.7956%2023.5417%209.9992%2023.9134C10.2052%2024.2827%2010.3082%2024.7088%2010.3082%2025.1918C10.3082%2025.6747%2010.204%2026.1009%209.99565%2026.4702C9.78732%2026.8395%209.48547%2027.1271%209.09011%2027.3331C8.69712%2027.5391%208.22127%2027.642%207.66255%2027.642H5.83372V26.4098H7.41397C7.7099%2026.4098%207.95375%2026.3589%208.14551%2026.2571C8.33964%2026.1529%208.48405%2026.0097%208.57875%2025.8274C8.67581%2025.6428%208.72434%2025.4309%208.72434%2025.1918C8.72434%2024.9503%208.67581%2024.7396%208.57875%2024.5597C8.48405%2024.3774%208.33964%2024.2365%208.14551%2024.1371C7.95138%2024.0353%207.70517%2023.9844%207.40687%2023.9844H6.36994V30H4.8323ZM13.885%2030H11.3069V22.7273H13.9063C14.6379%2022.7273%2015.2676%2022.8729%2015.7955%2023.1641C16.3235%2023.4529%2016.7295%2023.8684%2017.0136%2024.4105C17.3%2024.9527%2017.4433%2025.6013%2017.4433%2026.3565C17.4433%2027.1141%2017.3%2027.7652%2017.0136%2028.3097C16.7295%2028.8542%2016.3211%2029.272%2015.7884%2029.5632C15.2581%2029.8544%2014.6237%2030%2013.885%2030ZM12.8445%2028.6825H13.8211C14.2757%2028.6825%2014.658%2028.602%2014.9681%2028.4411C15.2806%2028.2777%2015.515%2028.0256%2015.6713%2027.6847C15.8299%2027.3414%2015.9092%2026.8987%2015.9092%2026.3565C15.9092%2025.8191%2015.8299%2025.38%2015.6713%2025.0391C15.515%2024.6982%2015.2818%2024.4472%2014.9717%2024.2862C14.6615%2024.1252%2014.2792%2024.0447%2013.8247%2024.0447H12.8445V28.6825ZM18.5823%2030V22.7273H23.3976V23.995H20.1199V25.728H23.078V26.9957H20.1199V30H18.5823Z'%20fill='white'%20/%3e%3c/svg%3e",apt="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.66667%2010H13.3333M6.5%2017.5H13.5C14.9001%2017.5%2015.6002%2017.5%2016.135%2017.2275C16.6054%2016.9878%2016.9878%2016.6054%2017.2275%2016.135C17.5%2015.6002%2017.5%2014.9001%2017.5%2013.5V6.5C17.5%205.09987%2017.5%204.3998%2017.2275%203.86502C16.9878%203.39462%2016.6054%203.01217%2016.135%202.77248C15.6002%202.5%2014.9001%202.5%2013.5%202.5H6.5C5.09987%202.5%204.3998%202.5%203.86502%202.77248C3.39462%203.01217%203.01217%203.39462%202.77248%203.86502C2.5%204.3998%202.5%205.09987%202.5%206.5V13.5C2.5%2014.9001%202.5%2015.6002%202.77248%2016.135C3.01217%2016.6054%203.39462%2016.9878%203.86502%2017.2275C4.3998%2017.5%205.09987%2017.5%206.5%2017.5Z'%20stroke='%237F56D9'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3c/svg%3e",spt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='26'%20height='16'%20rx='2'%20fill='%23079455'%20/%3e%3cpath%20d='M6.38636%2022.7273L7.85298%2025.206H7.9098L9.38352%2022.7273H11.12L8.90057%2026.3636L11.1697%2030H9.40128L7.9098%2027.5178H7.85298L6.36151%2030H4.60014L6.87642%2026.3636L4.64276%2022.7273H6.38636ZM12.093%2030V22.7273H13.6307V28.7322H16.7486V30H12.093ZM21.7122%2024.8189C21.6838%2024.5324%2021.5618%2024.3099%2021.3464%2024.1513C21.131%2023.9927%2020.8386%2023.9134%2020.4693%2023.9134C20.2183%2023.9134%2020.0065%2023.9489%2019.8336%2024.0199C19.6608%2024.0885%2019.5282%2024.1844%2019.4359%2024.3075C19.3459%2024.4306%2019.301%2024.5703%2019.301%2024.7266C19.2962%2024.8568%2019.3234%2024.9704%2019.3826%2025.0675C19.4442%2025.1645%2019.5282%2025.2486%2019.6348%2025.3196C19.7413%2025.3883%2019.8644%2025.4486%2020.0041%2025.5007C20.1438%2025.5504%2020.2929%2025.593%2020.4515%2025.6286L21.1049%2025.7848C21.4222%2025.8558%2021.7134%2025.9505%2021.9785%2026.0689C22.2437%2026.1873%2022.4733%2026.3329%2022.6674%2026.5057C22.8616%2026.6785%2023.0119%2026.8821%2023.1184%2027.1165C23.2273%2027.3509%2023.283%2027.6196%2023.2853%2027.9226C23.283%2028.3677%2023.1693%2028.7536%2022.9444%2029.0803C22.7219%2029.4046%2022.3999%2029.6567%2021.9785%2029.8366C21.5595%2030.0142%2021.054%2030.103%2020.4622%2030.103C19.8751%2030.103%2019.3637%2030.013%2018.9281%2029.8331C18.4949%2029.6532%2018.1563%2029.3868%2017.9125%2029.0341C17.671%2028.679%2017.5443%2028.2398%2017.5325%2027.7166H19.0204C19.037%2027.9605%2019.1068%2028.1641%2019.2299%2028.3274C19.3554%2028.4884%2019.5223%2028.6103%2019.7306%2028.6932C19.9413%2028.7737%2020.1793%2028.8139%2020.4444%2028.8139C20.7048%2028.8139%2020.9309%2028.776%2021.1227%2028.7003C21.3168%2028.6245%2021.4672%2028.5192%2021.5737%2028.3842C21.6802%2028.2493%2021.7335%2028.0942%2021.7335%2027.919C21.7335%2027.7557%2021.685%2027.6184%2021.5879%2027.5071C21.4932%2027.3958%2021.3535%2027.3011%2021.1689%2027.223C20.9866%2027.1449%2020.7628%2027.0739%2020.4977%2027.0099L19.7058%2026.8111C19.0926%2026.6619%2018.6085%2026.4287%2018.2534%2026.1115C17.8983%2025.7943%2017.7219%2025.367%2017.7243%2024.8295C17.7219%2024.3892%2017.8391%2024.0045%2018.0758%2023.6754C18.3149%2023.3464%2018.6428%2023.0895%2019.0595%2022.9048C19.4761%2022.7202%2019.9496%2022.6278%2020.4799%2022.6278C21.0197%2022.6278%2021.4908%2022.7202%2021.8933%2022.9048C22.2981%2023.0895%2022.613%2023.3464%2022.8379%2023.6754C23.0628%2024.0045%2023.1788%2024.3857%2023.1859%2024.8189H21.7122Z'%20fill='white'%20/%3e%3c/svg%3e",opt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='33'%20height='16'%20rx='2'%20fill='%23079455'%20/%3e%3cpath%20d='M6.31214%2022.7273L7.77876%2025.206H7.83558L9.3093%2022.7273H11.0458L8.82635%2026.3636L11.0955%2030H9.32706L7.83558%2027.5178H7.77876L6.28729%2030H4.52592L6.8022%2026.3636L4.56854%2022.7273H6.31214ZM12.0188%2030V22.7273H13.5565V28.7322H16.6744V30H12.0188ZM21.638%2024.8189C21.6096%2024.5324%2021.4876%2024.3099%2021.2722%2024.1513C21.0568%2023.9927%2020.7644%2023.9134%2020.3951%2023.9134C20.1441%2023.9134%2019.9322%2023.9489%2019.7594%2024.0199C19.5866%2024.0885%2019.454%2024.1844%2019.3617%2024.3075C19.2717%2024.4306%2019.2267%2024.5703%2019.2267%2024.7266C19.222%2024.8568%2019.2492%2024.9704%2019.3084%2025.0675C19.37%2025.1645%2019.454%2025.2486%2019.5605%2025.3196C19.6671%2025.3883%2019.7902%2025.4486%2019.9299%2025.5007C20.0695%2025.5504%2020.2187%2025.593%2020.3773%2025.6286L21.0307%2025.7848C21.348%2025.8558%2021.6391%2025.9505%2021.9043%2026.0689C22.1694%2026.1873%2022.3991%2026.3329%2022.5932%2026.5057C22.7873%2026.6785%2022.9377%2026.8821%2023.0442%2027.1165C23.1531%2027.3509%2023.2087%2027.6196%2023.2111%2027.9226C23.2087%2028.3677%2023.0951%2028.7536%2022.8702%2029.0803C22.6477%2029.4046%2022.3257%2029.6567%2021.9043%2029.8366C21.4853%2030.0142%2020.9798%2030.103%2020.388%2030.103C19.8008%2030.103%2019.2895%2030.013%2018.8539%2029.8331C18.4206%2029.6532%2018.0821%2029.3868%2017.8382%2029.0341C17.5968%2028.679%2017.4701%2028.2398%2017.4583%2027.7166H18.9462C18.9628%2027.9605%2019.0326%2028.1641%2019.1557%2028.3274C19.2812%2028.4884%2019.4481%2028.6103%2019.6564%2028.6932C19.8671%2028.7737%2020.1051%2028.8139%2020.3702%2028.8139C20.6306%2028.8139%2020.8567%2028.776%2021.0485%2028.7003C21.2426%2028.6245%2021.3929%2028.5192%2021.4995%2028.3842C21.606%2028.2493%2021.6593%2028.0942%2021.6593%2027.919C21.6593%2027.7557%2021.6107%2027.6184%2021.5137%2027.5071C21.419%2027.3958%2021.2793%2027.3011%2021.0946%2027.223C20.9123%2027.1449%2020.6886%2027.0739%2020.4235%2027.0099L19.6316%2026.8111C19.0184%2026.6619%2018.5343%2026.4287%2018.1792%2026.1115C17.824%2025.7943%2017.6477%2025.367%2017.65%2024.8295C17.6477%2024.3892%2017.7649%2024.0045%2018.0016%2023.6754C18.2407%2023.3464%2018.5686%2023.0895%2018.9853%2022.9048C19.4019%2022.7202%2019.8754%2022.6278%2020.4057%2022.6278C20.9455%2022.6278%2021.4166%2022.7202%2021.8191%2022.9048C22.2239%2023.0895%2022.5388%2023.3464%2022.7637%2023.6754C22.9886%2024.0045%2023.1046%2024.3857%2023.1117%2024.8189H21.638ZM25.6871%2022.7273L27.1538%2025.206H27.2106L28.6843%2022.7273H30.4208L28.2013%2026.3636L30.4705%2030H28.7021L27.2106%2027.5178H27.1538L25.6623%2030H23.9009L26.1772%2026.3636L23.9435%2022.7273H25.6871Z'%20fill='white'%20/%3e%3c/svg%3e",lpt=["src","alt"],upt={__name:"FileIcon",props:{name:String},setup(r){const t=r,e=i=>(i==null?void 0:i.slice(i.lastIndexOf(".")+1).toLowerCase())??"",n=ln(()=>new URL(Object.assign({"../../assets/AISearch/doc.svg":npt,"../../assets/AISearch/docx.svg":rpt,"../../assets/AISearch/pdf.svg":ipt,"../../assets/AISearch/selected-files-collapse.svg":apt,"../../assets/AISearch/xls.svg":spt,"../../assets/AISearch/xlsx.svg":opt})[`../../assets/AISearch/${e(t.name)}.svg`],import.meta.url).href);return(i,a)=>(Pt(),Xe("img",{src:n.value,alt:i.file_type,class:"file-icon"},null,8,lpt))}},cpt=Vs(upt,[["__scopeId","data-v-f564ce99"]]),hpt={class:"image-aside-btn-container"},dpt=["src"],fpt=["src"],gpt={__name:"PopoverImage",props:{src:String},setup(r){return(t,e)=>{const n=SR;return Pt(),Be(n,null,{content:he(()=>[Pe("img",{src:r.src,class:"image-large-view"},null,8,fpt)]),default:he(()=>[Pe("div",hpt,[Pe("img",{src:r.src,class:"image-aside-btn"},null,8,dpt)])]),_:1})}}},ppt=Vs(gpt,[["__scopeId","data-v-b97a17e3"]]),vpt={class:"chunk-list"},mpt={key:1},ypt={class:"card"},bpt={class:"document-reference"},wpt={class:"popup-markdown"},xpt=["innerHTML"],Ept=["innerHTML"],_pt=["onClick"],Spt={key:0},Mpt={__name:"ChunkList",props:{chunks:Array,total:{type:Number,required:!0},highlight_word:String,page_size:{type:Number,default:10},loading:Boolean},emits:["clickDocumentButton","pageChange","pageSizeChange"],setup(r,{emit:t}){const e=r,n=t,i=c=>{n("clickDocumentButton",c)},a=c=>{if(!e.highlight_word)return c;const h=new RegExp(`(${e.highlight_word})`,"gi");return c.replace(h,'<span class="highlighted">$1</span>')},s=ue(1),o=ue(10),l=c=>{s.value=c,n("pageChange",c)},u=c=>{c.value=c,n("pageSizeChange",c)};return(c,h)=>{const d=fR,g=SR,p=t0,v=gR,m=Pj;return Pt(),Xe("div",vpt,[r.loading?(Pt(),Be(d,{key:0,dot:"",loading:r.loading},null,8,["loading"])):(Pt(),Xe("div",mpt,[(Pt(!0),Xe(jl,null,e0(r.chunks,(b,w)=>(Pt(),Xe("div",{key:w},[Pe("div",ypt,[b.image_url?(Pt(),Be(ppt,{key:0,src:b.image_url},null,8,["src"])):gi("",!0),Pe("div",bpt,[le(g,{trigger:"hover"},{content:he(()=>[Pe("div",wpt,[Pe("div",{innerHTML:a(b.content_with_weight)},null,8,xpt)])]),default:he(()=>[Pe("div",{innerHTML:a(b.highlight),class:"highlight-content"},null,8,Ept)]),_:2},1024),Pe("div",{class:"file-btn",onClick:x=>i(b)},[le(p,null,{default:he(()=>[le(cpt,{name:b.docnm_kwd},null,8,["name"]),Pe("div",null,Il(b.docnm_kwd),1)]),_:2},1024)],8,_pt)])]),w<r.chunks.length-1?(Pt(),Be(v,{key:0,margin:12})):gi("",!0)]))),128)),r.chunks.length>1?(Pt(),Xe("div",Spt,[le(v),le(m,{current:s.value,total:r.total,"page-size":o.value,"show-total":"","show-page-size":"",onChange:l,onPageSizeChange:u},null,8,["current","total","page-size"])])):gi("",!0)]))])}}},kpt=Vs(Mpt,[["__scopeId","data-v-a895a47a"]]);var Cpt=Object.defineProperty,Tpt=(r,t,e)=>t in r?Cpt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Yd=(r,t,e)=>Tpt(r,typeof t!="symbol"?t+"":t,e);class dR extends Error{constructor(t,e){super(t),Yd(this,"type"),Yd(this,"field"),Yd(this,"value"),Yd(this,"line"),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}}function iw(r){}function Opt(r){const{onEvent:t=iw,onError:e=iw,onRetry:n=iw,onComment:i}=r;let a="",s=!0,o,l="",u="";function c(v){const m=s?v.replace(/^\xEF\xBB\xBF/,""):v,[b,w]=Apt(`${a}${m}`);for(const x of b)h(x);a=w,s=!1}function h(v){if(v===""){g();return}if(v.startsWith(":")){i&&i(v.slice(v.startsWith(": ")?2:1));return}const m=v.indexOf(":");if(m!==-1){const b=v.slice(0,m),w=v[m+1]===" "?2:1,x=v.slice(m+w);d(b,x,v);return}d(v,"",v)}function d(v,m,b){switch(v){case"event":u=m;break;case"data":l=`${l}${m}
- `;break;case"id":o=m.includes("\0")?void 0:m;break;case"retry":/^\d+$/.test(m)?n(parseInt(m,10)):e(new dR(`Invalid \`retry\` value: "${m}"`,{type:"invalid-retry",value:m,line:b}));break;default:e(new dR(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:m,line:b}));break}}function g(){l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(`
- `)?l.slice(0,-1):l}),o=void 0,l="",u=""}function p(v={}){a&&v.consume&&h(a),o=void 0,l="",u="",a=""}return{feed:c,reset:p}}function Apt(r){const t=[];let e="";const n=r.length;for(let i=0;i<n;i++){const a=r[i];a==="\r"&&r[i+1]===`
- `?(t.push(e),e="",i++):a==="\r"||a===`
- `?(t.push(e),e=""):e+=a}return[t,e]}class Ppt extends TransformStream{constructor({onError:t,onRetry:e,onComment:n}={}){let i;super({start(a){i=Opt({onEvent:s=>{a.enqueue(s)},onError(s){t==="terminate"?a.error(s):typeof t=="function"&&t(s)},onRetry:e,onComment:n})},transform(a){i.feed(a)}})}}function Npt(r){return kx({url:"/rgflow/v1/chunk/retrieval_test",method:"post",data:r})}function Rpt(r){return kx({url:"/rgflow/v1/conversation/related_questions",method:"post",data:r})}function Lpt(r){return kx({url:"/rgflow/v1/conversation/mindmap",method:"post",data:r})}function Ipt(){var s;const r=ue({chunks:[],documents:[],total:0}),t=ue(!1),e=pj(),n=((s=e==null?void 0:e.query)==null?void 0:s.id)||"",{getFileUrl:i}=y4(),a=async o=>{t.value=!0;try{const{data:l,code:u}=await Npt({...o,kb_id:o.kb_id??n});u===0?r.value={chunks:l.chunks.map(c=>({...c,image_url:i(c.image_id,"image")})),documents:l.doc_aggs,total:l.total}:r.value={chunks:[],documents:[],total:0}}catch{r.value={chunks:[],documents:[],total:0},a0.error("检索失败")}finally{t.value=!1}};return{chunks_data:ln(()=>r.value),loading:ln(()=>t.value),testChunk:a}}function Dpt(){const r=ue([]),t=ue(!1);return{data:r,loading:t,fetchRelatedQuestions:async n=>{t.value=!0;try{const{data:i}=await Rpt({question:n});r.value=(i==null?void 0:i.slice(0,5))??[]}catch(i){a0.error(i.message)}finally{t.value=!1}}}}function Fpt(){const r=ue({}),t=ue(!0),e=ue(null),n=()=>{e.value&&clearTimeout(e.value),e.value=setTimeout(()=>{r.value={},clearTimeout(e.value)},1e3)},i=async(a,s)=>{var o;try{t.value=!1;const l=Sj.get(),c=`${_R("RGFLOW_BASE_URL")}/v1/conversation/ask`,h=await fetch(c,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(a),signal:s==null?void 0:s.signal}),d=h.clone().json(),g=(o=h==null?void 0:h.body)==null?void 0:o.pipeThrough(new TextDecoderStream).pipeThrough(new Ppt).getReader();for(;;){const p=await(g==null?void 0:g.read());if(p){const{done:v,value:m}=p;if(v){console.info("done"),n();break}try{const b=JSON.parse((m==null?void 0:m.data)||""),w=b==null?void 0:b.data;typeof w!="boolean"&&(r.value={...w,conversation_id:a==null?void 0:a.conversation_id})}catch(b){console.warn(b)}}}return console.info("done?"),t.value=!0,n(),{data:await d,response:h}}catch(l){t.value=!0,n(),console.warn(l)}};return r0(()=>{e.value&&clearTimeout(e.value)}),{send:i,answer:r,done:t,resetAnswer:n}}function Bpt(){const r=ue(null),t=ue(!1);return{data:r,loading:t,fetchMindmap:async n=>{t.value=!0;try{const{data:i}=await Lpt(n);r.value=i}catch{a0.error("获取思维导图失败")}finally{t.value=!1}}}}function y4(){return{getFileUrl:(t,e)=>{if(!t||!e)return"";const n=_R("RGFLOW_BASE_URL");let i="";switch(e){case"doc":case"docx":i=`${n}/document/${t}?ext=docx&prefix=document`;break;case"pdf":i=`${n}/v1/document/get/${t}`;break;case"image":i=`${n}/v1/document/image/${t}`;break;default:i=""}return i}}}var Jf={exports:{}};/**
- * @license
- * Lodash <https://lodash.com/>
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */Jf.exports;(function(r,t){(function(){var e,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",o="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",h=1,d=2,g=4,p=1,v=2,m=1,b=2,w=4,x=8,S=16,_=32,k=64,M=128,C=256,P=512,T=30,A="...",R=800,L=16,$=1,q=2,j=3,B=1/0,F=9007199254740991,V=17976931348623157e292,X=NaN,K=4294967295,nt=K-1,ot=K>>>1,ct=[["ary",M],["bind",m],["bindKey",b],["curry",x],["curryRight",S],["flip",P],["partial",_],["partialRight",k],["rearg",C]],ht="[object Arguments]",pt="[object Array]",wt="[object AsyncFunction]",zt="[object Boolean]",Wt="[object Date]",Te="[object DOMException]",Ge="[object Error]",Ve="[object Function]",In="[object GeneratorFunction]",yn="[object Map]",te="[object Number]",wi="[object Null]",Gt="[object Object]",Xr="[object Promise]",Tr="[object Proxy]",qi="[object RegExp]",bn="[object Set]",Dn="[object String]",$e="[object Symbol]",fa="[object Undefined]",Cn="[object WeakMap]",xi="[object WeakSet]",Wi="[object ArrayBuffer]",tr="[object DataView]",Qa="[object Float32Array]",ts="[object Float64Array]",cu="[object Int8Array]",Qo="[object Int16Array]",Kr="[object Int32Array]",Ei="[object Uint8Array]",$g="[object Uint8ClampedArray]",jg="[object Uint16Array]",qg="[object Uint32Array]",b4=/\b__p \+= '';/g,w4=/\b(__p \+=) '' \+/g,x4=/(__e\(.*?\)|\b__t\)) \+\n'';/g,e_=/&(?:amp|lt|gt|quot|#39);/g,n_=/[&<>"']/g,E4=RegExp(e_.source),_4=RegExp(n_.source),S4=/<%-([\s\S]+?)%>/g,M4=/<%([\s\S]+?)%>/g,r_=/<%=([\s\S]+?)%>/g,k4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,C4=/^\w*$/,T4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wg=/[\\^$.*+?()[\]{}|]/g,O4=RegExp(Wg.source),Gg=/^\s+/,A4=/\s/,P4=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,N4=/\{\n\/\* \[wrapped with (.+)\] \*/,R4=/,? & /,L4=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,I4=/[()=,{}\[\]\/\s]/,D4=/\\(\\)?/g,F4=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,i_=/\w*$/,B4=/^[-+]0x[0-9a-f]+$/i,z4=/^0b[01]+$/i,$4=/^\[object .+?Constructor\]$/,j4=/^0o[0-7]+$/i,q4=/^(?:0|[1-9]\d*)$/,W4=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qc=/($^)/,G4=/['\n\r\u2028\u2029\\]/g,th="\\ud800-\\udfff",V4="\\u0300-\\u036f",H4="\\ufe20-\\ufe2f",U4="\\u20d0-\\u20ff",a_=V4+H4+U4,s_="\\u2700-\\u27bf",o_="a-z\\xdf-\\xf6\\xf8-\\xff",Y4="\\xac\\xb1\\xd7\\xf7",X4="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",K4="\\u2000-\\u206f",Z4=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",l_="A-Z\\xc0-\\xd6\\xd8-\\xde",u_="\\ufe0e\\ufe0f",c_=Y4+X4+K4+Z4,Vg="['’]",J4="["+th+"]",h_="["+c_+"]",eh="["+a_+"]",d_="\\d+",Q4="["+s_+"]",f_="["+o_+"]",g_="[^"+th+c_+d_+s_+o_+l_+"]",Hg="\\ud83c[\\udffb-\\udfff]",t8="(?:"+eh+"|"+Hg+")",p_="[^"+th+"]",Ug="(?:\\ud83c[\\udde6-\\uddff]){2}",Yg="[\\ud800-\\udbff][\\udc00-\\udfff]",tl="["+l_+"]",v_="\\u200d",m_="(?:"+f_+"|"+g_+")",e8="(?:"+tl+"|"+g_+")",y_="(?:"+Vg+"(?:d|ll|m|re|s|t|ve))?",b_="(?:"+Vg+"(?:D|LL|M|RE|S|T|VE))?",w_=t8+"?",x_="["+u_+"]?",n8="(?:"+v_+"(?:"+[p_,Ug,Yg].join("|")+")"+x_+w_+")*",r8="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",i8="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",E_=x_+w_+n8,a8="(?:"+[Q4,Ug,Yg].join("|")+")"+E_,s8="(?:"+[p_+eh+"?",eh,Ug,Yg,J4].join("|")+")",o8=RegExp(Vg,"g"),l8=RegExp(eh,"g"),Xg=RegExp(Hg+"(?="+Hg+")|"+s8+E_,"g"),u8=RegExp([tl+"?"+f_+"+"+y_+"(?="+[h_,tl,"$"].join("|")+")",e8+"+"+b_+"(?="+[h_,tl+m_,"$"].join("|")+")",tl+"?"+m_+"+"+y_,tl+"+"+b_,i8,r8,d_,a8].join("|"),"g"),c8=RegExp("["+v_+th+a_+u_+"]"),h8=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,d8=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],f8=-1,Le={};Le[Qa]=Le[ts]=Le[cu]=Le[Qo]=Le[Kr]=Le[Ei]=Le[$g]=Le[jg]=Le[qg]=!0,Le[ht]=Le[pt]=Le[Wi]=Le[zt]=Le[tr]=Le[Wt]=Le[Ge]=Le[Ve]=Le[yn]=Le[te]=Le[Gt]=Le[qi]=Le[bn]=Le[Dn]=Le[Cn]=!1;var Oe={};Oe[ht]=Oe[pt]=Oe[Wi]=Oe[tr]=Oe[zt]=Oe[Wt]=Oe[Qa]=Oe[ts]=Oe[cu]=Oe[Qo]=Oe[Kr]=Oe[yn]=Oe[te]=Oe[Gt]=Oe[qi]=Oe[bn]=Oe[Dn]=Oe[$e]=Oe[Ei]=Oe[$g]=Oe[jg]=Oe[qg]=!0,Oe[Ge]=Oe[Ve]=Oe[Cn]=!1;var g8={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},p8={"&":"&","<":"<",">":">",'"':""","'":"'"},v8={"&":"&","<":"<",">":">",""":'"',"'":"'"},m8={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},y8=parseFloat,b8=parseInt,__=typeof Ca=="object"&&Ca&&Ca.Object===Object&&Ca,w8=typeof self=="object"&&self&&self.Object===Object&&self,Fn=__||w8||Function("return this")(),Kg=t&&!t.nodeType&&t,eo=Kg&&!0&&r&&!r.nodeType&&r,S_=eo&&eo.exports===Kg,Zg=S_&&__.process,Zr=function(){try{var U=eo&&eo.require&&eo.require("util").types;return U||Zg&&Zg.binding&&Zg.binding("util")}catch{}}(),M_=Zr&&Zr.isArrayBuffer,k_=Zr&&Zr.isDate,C_=Zr&&Zr.isMap,T_=Zr&&Zr.isRegExp,O_=Zr&&Zr.isSet,A_=Zr&&Zr.isTypedArray;function Or(U,tt,Z){switch(Z.length){case 0:return U.call(tt);case 1:return U.call(tt,Z[0]);case 2:return U.call(tt,Z[0],Z[1]);case 3:return U.call(tt,Z[0],Z[1],Z[2])}return U.apply(tt,Z)}function x8(U,tt,Z,St){for(var Dt=-1,ce=U==null?0:U.length;++Dt<ce;){var wn=U[Dt];tt(St,wn,Z(wn),U)}return St}function Jr(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St&&tt(U[Z],Z,U)!==!1;);return U}function E8(U,tt){for(var Z=U==null?0:U.length;Z--&&tt(U[Z],Z,U)!==!1;);return U}function P_(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St;)if(!tt(U[Z],Z,U))return!1;return!0}function es(U,tt){for(var Z=-1,St=U==null?0:U.length,Dt=0,ce=[];++Z<St;){var wn=U[Z];tt(wn,Z,U)&&(ce[Dt++]=wn)}return ce}function nh(U,tt){var Z=U==null?0:U.length;return!!Z&&el(U,tt,0)>-1}function Jg(U,tt,Z){for(var St=-1,Dt=U==null?0:U.length;++St<Dt;)if(Z(tt,U[St]))return!0;return!1}function je(U,tt){for(var Z=-1,St=U==null?0:U.length,Dt=Array(St);++Z<St;)Dt[Z]=tt(U[Z],Z,U);return Dt}function ns(U,tt){for(var Z=-1,St=tt.length,Dt=U.length;++Z<St;)U[Dt+Z]=tt[Z];return U}function Qg(U,tt,Z,St){var Dt=-1,ce=U==null?0:U.length;for(St&&ce&&(Z=U[++Dt]);++Dt<ce;)Z=tt(Z,U[Dt],Dt,U);return Z}function _8(U,tt,Z,St){var Dt=U==null?0:U.length;for(St&&Dt&&(Z=U[--Dt]);Dt--;)Z=tt(Z,U[Dt],Dt,U);return Z}function tp(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St;)if(tt(U[Z],Z,U))return!0;return!1}var S8=ep("length");function M8(U){return U.split("")}function k8(U){return U.match(L4)||[]}function N_(U,tt,Z){var St;return Z(U,function(Dt,ce,wn){if(tt(Dt,ce,wn))return St=ce,!1}),St}function rh(U,tt,Z,St){for(var Dt=U.length,ce=Z+(St?1:-1);St?ce--:++ce<Dt;)if(tt(U[ce],ce,U))return ce;return-1}function el(U,tt,Z){return tt===tt?B8(U,tt,Z):rh(U,R_,Z)}function C8(U,tt,Z,St){for(var Dt=Z-1,ce=U.length;++Dt<ce;)if(St(U[Dt],tt))return Dt;return-1}function R_(U){return U!==U}function L_(U,tt){var Z=U==null?0:U.length;return Z?rp(U,tt)/Z:X}function ep(U){return function(tt){return tt==null?e:tt[U]}}function np(U){return function(tt){return U==null?e:U[tt]}}function I_(U,tt,Z,St,Dt){return Dt(U,function(ce,wn,Ee){Z=St?(St=!1,ce):tt(Z,ce,wn,Ee)}),Z}function T8(U,tt){var Z=U.length;for(U.sort(tt);Z--;)U[Z]=U[Z].value;return U}function rp(U,tt){for(var Z,St=-1,Dt=U.length;++St<Dt;){var ce=tt(U[St]);ce!==e&&(Z=Z===e?ce:Z+ce)}return Z}function ip(U,tt){for(var Z=-1,St=Array(U);++Z<U;)St[Z]=tt(Z);return St}function O8(U,tt){return je(tt,function(Z){return[Z,U[Z]]})}function D_(U){return U&&U.slice(0,$_(U)+1).replace(Gg,"")}function Ar(U){return function(tt){return U(tt)}}function ap(U,tt){return je(tt,function(Z){return U[Z]})}function hu(U,tt){return U.has(tt)}function F_(U,tt){for(var Z=-1,St=U.length;++Z<St&&el(tt,U[Z],0)>-1;);return Z}function B_(U,tt){for(var Z=U.length;Z--&&el(tt,U[Z],0)>-1;);return Z}function A8(U,tt){for(var Z=U.length,St=0;Z--;)U[Z]===tt&&++St;return St}var P8=np(g8),N8=np(p8);function R8(U){return"\\"+m8[U]}function L8(U,tt){return U==null?e:U[tt]}function nl(U){return c8.test(U)}function I8(U){return h8.test(U)}function D8(U){for(var tt,Z=[];!(tt=U.next()).done;)Z.push(tt.value);return Z}function sp(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St,Dt){Z[++tt]=[Dt,St]}),Z}function z_(U,tt){return function(Z){return U(tt(Z))}}function rs(U,tt){for(var Z=-1,St=U.length,Dt=0,ce=[];++Z<St;){var wn=U[Z];(wn===tt||wn===c)&&(U[Z]=c,ce[Dt++]=Z)}return ce}function ih(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St){Z[++tt]=St}),Z}function F8(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St){Z[++tt]=[St,St]}),Z}function B8(U,tt,Z){for(var St=Z-1,Dt=U.length;++St<Dt;)if(U[St]===tt)return St;return-1}function z8(U,tt,Z){for(var St=Z+1;St--;)if(U[St]===tt)return St;return St}function rl(U){return nl(U)?j8(U):S8(U)}function _i(U){return nl(U)?q8(U):M8(U)}function $_(U){for(var tt=U.length;tt--&&A4.test(U.charAt(tt)););return tt}var $8=np(v8);function j8(U){for(var tt=Xg.lastIndex=0;Xg.test(U);)++tt;return tt}function q8(U){return U.match(Xg)||[]}function W8(U){return U.match(u8)||[]}var G8=function U(tt){tt=tt==null?Fn:il.defaults(Fn.Object(),tt,il.pick(Fn,d8));var Z=tt.Array,St=tt.Date,Dt=tt.Error,ce=tt.Function,wn=tt.Math,Ee=tt.Object,op=tt.RegExp,V8=tt.String,Qr=tt.TypeError,ah=Z.prototype,H8=ce.prototype,al=Ee.prototype,sh=tt["__core-js_shared__"],oh=H8.toString,ge=al.hasOwnProperty,U8=0,j_=function(){var f=/[^.]+$/.exec(sh&&sh.keys&&sh.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""}(),lh=al.toString,Y8=oh.call(Ee),X8=Fn._,K8=op("^"+oh.call(ge).replace(Wg,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),uh=S_?tt.Buffer:e,is=tt.Symbol,ch=tt.Uint8Array,q_=uh?uh.allocUnsafe:e,hh=z_(Ee.getPrototypeOf,Ee),W_=Ee.create,G_=al.propertyIsEnumerable,dh=ah.splice,V_=is?is.isConcatSpreadable:e,du=is?is.iterator:e,no=is?is.toStringTag:e,fh=function(){try{var f=oo(Ee,"defineProperty");return f({},"",{}),f}catch{}}(),Z8=tt.clearTimeout!==Fn.clearTimeout&&tt.clearTimeout,J8=St&&St.now!==Fn.Date.now&&St.now,Q8=tt.setTimeout!==Fn.setTimeout&&tt.setTimeout,gh=wn.ceil,ph=wn.floor,lp=Ee.getOwnPropertySymbols,t9=uh?uh.isBuffer:e,H_=tt.isFinite,e9=ah.join,n9=z_(Ee.keys,Ee),xn=wn.max,Hn=wn.min,r9=St.now,i9=tt.parseInt,U_=wn.random,a9=ah.reverse,up=oo(tt,"DataView"),fu=oo(tt,"Map"),cp=oo(tt,"Promise"),sl=oo(tt,"Set"),gu=oo(tt,"WeakMap"),pu=oo(Ee,"create"),vh=gu&&new gu,ol={},s9=lo(up),o9=lo(fu),l9=lo(cp),u9=lo(sl),c9=lo(gu),mh=is?is.prototype:e,vu=mh?mh.valueOf:e,Y_=mh?mh.toString:e;function I(f){if(Je(f)&&!$t(f)&&!(f instanceof re)){if(f instanceof ti)return f;if(ge.call(f,"__wrapped__"))return XS(f)}return new ti(f)}var ll=function(){function f(){}return function(y){if(!He(y))return{};if(W_)return W_(y);f.prototype=y;var E=new f;return f.prototype=e,E}}();function yh(){}function ti(f,y){this.__wrapped__=f,this.__actions__=[],this.__chain__=!!y,this.__index__=0,this.__values__=e}I.templateSettings={escape:S4,evaluate:M4,interpolate:r_,variable:"",imports:{_:I}},I.prototype=yh.prototype,I.prototype.constructor=I,ti.prototype=ll(yh.prototype),ti.prototype.constructor=ti;function re(f){this.__wrapped__=f,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=K,this.__views__=[]}function h9(){var f=new re(this.__wrapped__);return f.__actions__=dr(this.__actions__),f.__dir__=this.__dir__,f.__filtered__=this.__filtered__,f.__iteratees__=dr(this.__iteratees__),f.__takeCount__=this.__takeCount__,f.__views__=dr(this.__views__),f}function d9(){if(this.__filtered__){var f=new re(this);f.__dir__=-1,f.__filtered__=!0}else f=this.clone(),f.__dir__*=-1;return f}function f9(){var f=this.__wrapped__.value(),y=this.__dir__,E=$t(f),O=y<0,N=E?f.length:0,D=M7(0,N,this.__views__),W=D.start,G=D.end,Y=G-W,rt=O?G:W-1,it=this.__iteratees__,ut=it.length,xt=0,Mt=Hn(Y,this.__takeCount__);if(!E||!O&&N==Y&&Mt==Y)return yS(f,this.__actions__);var Tt=[];t:for(;Y--&&xt<Mt;){rt+=y;for(var Kt=-1,Ot=f[rt];++Kt<ut;){var ee=it[Kt],ie=ee.iteratee,Rr=ee.type,rr=ie(Ot);if(Rr==q)Ot=rr;else if(!rr){if(Rr==$)continue t;break t}}Tt[xt++]=Ot}return Tt}re.prototype=ll(yh.prototype),re.prototype.constructor=re;function ro(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var O=f[y];this.set(O[0],O[1])}}function g9(){this.__data__=pu?pu(null):{},this.size=0}function p9(f){var y=this.has(f)&&delete this.__data__[f];return this.size-=y?1:0,y}function v9(f){var y=this.__data__;if(pu){var E=y[f];return E===l?e:E}return ge.call(y,f)?y[f]:e}function m9(f){var y=this.__data__;return pu?y[f]!==e:ge.call(y,f)}function y9(f,y){var E=this.__data__;return this.size+=this.has(f)?0:1,E[f]=pu&&y===e?l:y,this}ro.prototype.clear=g9,ro.prototype.delete=p9,ro.prototype.get=v9,ro.prototype.has=m9,ro.prototype.set=y9;function ga(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var O=f[y];this.set(O[0],O[1])}}function b9(){this.__data__=[],this.size=0}function w9(f){var y=this.__data__,E=bh(y,f);if(E<0)return!1;var O=y.length-1;return E==O?y.pop():dh.call(y,E,1),--this.size,!0}function x9(f){var y=this.__data__,E=bh(y,f);return E<0?e:y[E][1]}function E9(f){return bh(this.__data__,f)>-1}function _9(f,y){var E=this.__data__,O=bh(E,f);return O<0?(++this.size,E.push([f,y])):E[O][1]=y,this}ga.prototype.clear=b9,ga.prototype.delete=w9,ga.prototype.get=x9,ga.prototype.has=E9,ga.prototype.set=_9;function pa(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var O=f[y];this.set(O[0],O[1])}}function S9(){this.size=0,this.__data__={hash:new ro,map:new(fu||ga),string:new ro}}function M9(f){var y=Ph(this,f).delete(f);return this.size-=y?1:0,y}function k9(f){return Ph(this,f).get(f)}function C9(f){return Ph(this,f).has(f)}function T9(f,y){var E=Ph(this,f),O=E.size;return E.set(f,y),this.size+=E.size==O?0:1,this}pa.prototype.clear=S9,pa.prototype.delete=M9,pa.prototype.get=k9,pa.prototype.has=C9,pa.prototype.set=T9;function io(f){var y=-1,E=f==null?0:f.length;for(this.__data__=new pa;++y<E;)this.add(f[y])}function O9(f){return this.__data__.set(f,l),this}function A9(f){return this.__data__.has(f)}io.prototype.add=io.prototype.push=O9,io.prototype.has=A9;function Si(f){var y=this.__data__=new ga(f);this.size=y.size}function P9(){this.__data__=new ga,this.size=0}function N9(f){var y=this.__data__,E=y.delete(f);return this.size=y.size,E}function R9(f){return this.__data__.get(f)}function L9(f){return this.__data__.has(f)}function I9(f,y){var E=this.__data__;if(E instanceof ga){var O=E.__data__;if(!fu||O.length<i-1)return O.push([f,y]),this.size=++E.size,this;E=this.__data__=new pa(O)}return E.set(f,y),this.size=E.size,this}Si.prototype.clear=P9,Si.prototype.delete=N9,Si.prototype.get=R9,Si.prototype.has=L9,Si.prototype.set=I9;function X_(f,y){var E=$t(f),O=!E&&uo(f),N=!E&&!O&&us(f),D=!E&&!O&&!N&&dl(f),W=E||O||N||D,G=W?ip(f.length,V8):[],Y=G.length;for(var rt in f)(y||ge.call(f,rt))&&!(W&&(rt=="length"||N&&(rt=="offset"||rt=="parent")||D&&(rt=="buffer"||rt=="byteLength"||rt=="byteOffset")||ba(rt,Y)))&&G.push(rt);return G}function K_(f){var y=f.length;return y?f[xp(0,y-1)]:e}function D9(f,y){return Nh(dr(f),ao(y,0,f.length))}function F9(f){return Nh(dr(f))}function hp(f,y,E){(E!==e&&!Mi(f[y],E)||E===e&&!(y in f))&&va(f,y,E)}function mu(f,y,E){var O=f[y];(!(ge.call(f,y)&&Mi(O,E))||E===e&&!(y in f))&&va(f,y,E)}function bh(f,y){for(var E=f.length;E--;)if(Mi(f[E][0],y))return E;return-1}function B9(f,y,E,O){return as(f,function(N,D,W){y(O,N,E(N),W)}),O}function Z_(f,y){return f&&Vi(y,Tn(y),f)}function z9(f,y){return f&&Vi(y,gr(y),f)}function va(f,y,E){y=="__proto__"&&fh?fh(f,y,{configurable:!0,enumerable:!0,value:E,writable:!0}):f[y]=E}function dp(f,y){for(var E=-1,O=y.length,N=Z(O),D=f==null;++E<O;)N[E]=D?e:Hp(f,y[E]);return N}function ao(f,y,E){return f===f&&(E!==e&&(f=f<=E?f:E),y!==e&&(f=f>=y?f:y)),f}function ei(f,y,E,O,N,D){var W,G=y&h,Y=y&d,rt=y&g;if(E&&(W=N?E(f,O,N,D):E(f)),W!==e)return W;if(!He(f))return f;var it=$t(f);if(it){if(W=C7(f),!G)return dr(f,W)}else{var ut=Un(f),xt=ut==Ve||ut==In;if(us(f))return xS(f,G);if(ut==Gt||ut==ht||xt&&!N){if(W=Y||xt?{}:$S(f),!G)return Y?v7(f,z9(W,f)):p7(f,Z_(W,f))}else{if(!Oe[ut])return N?f:{};W=T7(f,ut,G)}}D||(D=new Si);var Mt=D.get(f);if(Mt)return Mt;D.set(f,W),p3(f)?f.forEach(function(Ot){W.add(ei(Ot,y,E,Ot,f,D))}):f3(f)&&f.forEach(function(Ot,ee){W.set(ee,ei(Ot,y,E,ee,f,D))});var Tt=rt?Y?Np:Pp:Y?gr:Tn,Kt=it?e:Tt(f);return Jr(Kt||f,function(Ot,ee){Kt&&(ee=Ot,Ot=f[ee]),mu(W,ee,ei(Ot,y,E,ee,f,D))}),W}function $9(f){var y=Tn(f);return function(E){return J_(E,f,y)}}function J_(f,y,E){var O=E.length;if(f==null)return!O;for(f=Ee(f);O--;){var N=E[O],D=y[N],W=f[N];if(W===e&&!(N in f)||!D(W))return!1}return!0}function Q_(f,y,E){if(typeof f!="function")throw new Qr(s);return Su(function(){f.apply(e,E)},y)}function yu(f,y,E,O){var N=-1,D=nh,W=!0,G=f.length,Y=[],rt=y.length;if(!G)return Y;E&&(y=je(y,Ar(E))),O?(D=Jg,W=!1):y.length>=i&&(D=hu,W=!1,y=new io(y));t:for(;++N<G;){var it=f[N],ut=E==null?it:E(it);if(it=O||it!==0?it:0,W&&ut===ut){for(var xt=rt;xt--;)if(y[xt]===ut)continue t;Y.push(it)}else D(y,ut,O)||Y.push(it)}return Y}var as=kS(Gi),tS=kS(gp,!0);function j9(f,y){var E=!0;return as(f,function(O,N,D){return E=!!y(O,N,D),E}),E}function wh(f,y,E){for(var O=-1,N=f.length;++O<N;){var D=f[O],W=y(D);if(W!=null&&(G===e?W===W&&!Nr(W):E(W,G)))var G=W,Y=D}return Y}function q9(f,y,E,O){var N=f.length;for(E=Yt(E),E<0&&(E=-E>N?0:N+E),O=O===e||O>N?N:Yt(O),O<0&&(O+=N),O=E>O?0:m3(O);E<O;)f[E++]=y;return f}function eS(f,y){var E=[];return as(f,function(O,N,D){y(O,N,D)&&E.push(O)}),E}function Bn(f,y,E,O,N){var D=-1,W=f.length;for(E||(E=A7),N||(N=[]);++D<W;){var G=f[D];y>0&&E(G)?y>1?Bn(G,y-1,E,O,N):ns(N,G):O||(N[N.length]=G)}return N}var fp=CS(),nS=CS(!0);function Gi(f,y){return f&&fp(f,y,Tn)}function gp(f,y){return f&&nS(f,y,Tn)}function xh(f,y){return es(y,function(E){return wa(f[E])})}function so(f,y){y=os(y,f);for(var E=0,O=y.length;f!=null&&E<O;)f=f[Hi(y[E++])];return E&&E==O?f:e}function rS(f,y,E){var O=y(f);return $t(f)?O:ns(O,E(f))}function er(f){return f==null?f===e?fa:wi:no&&no in Ee(f)?S7(f):F7(f)}function pp(f,y){return f>y}function W9(f,y){return f!=null&&ge.call(f,y)}function G9(f,y){return f!=null&&y in Ee(f)}function V9(f,y,E){return f>=Hn(y,E)&&f<xn(y,E)}function vp(f,y,E){for(var O=E?Jg:nh,N=f[0].length,D=f.length,W=D,G=Z(D),Y=1/0,rt=[];W--;){var it=f[W];W&&y&&(it=je(it,Ar(y))),Y=Hn(it.length,Y),G[W]=!E&&(y||N>=120&&it.length>=120)?new io(W&&it):e}it=f[0];var ut=-1,xt=G[0];t:for(;++ut<N&&rt.length<Y;){var Mt=it[ut],Tt=y?y(Mt):Mt;if(Mt=E||Mt!==0?Mt:0,!(xt?hu(xt,Tt):O(rt,Tt,E))){for(W=D;--W;){var Kt=G[W];if(!(Kt?hu(Kt,Tt):O(f[W],Tt,E)))continue t}xt&&xt.push(Tt),rt.push(Mt)}}return rt}function H9(f,y,E,O){return Gi(f,function(N,D,W){y(O,E(N),D,W)}),O}function bu(f,y,E){y=os(y,f),f=GS(f,y);var O=f==null?f:f[Hi(ri(y))];return O==null?e:Or(O,f,E)}function iS(f){return Je(f)&&er(f)==ht}function U9(f){return Je(f)&&er(f)==Wi}function Y9(f){return Je(f)&&er(f)==Wt}function wu(f,y,E,O,N){return f===y?!0:f==null||y==null||!Je(f)&&!Je(y)?f!==f&&y!==y:X9(f,y,E,O,wu,N)}function X9(f,y,E,O,N,D){var W=$t(f),G=$t(y),Y=W?pt:Un(f),rt=G?pt:Un(y);Y=Y==ht?Gt:Y,rt=rt==ht?Gt:rt;var it=Y==Gt,ut=rt==Gt,xt=Y==rt;if(xt&&us(f)){if(!us(y))return!1;W=!0,it=!1}if(xt&&!it)return D||(D=new Si),W||dl(f)?FS(f,y,E,O,N,D):E7(f,y,Y,E,O,N,D);if(!(E&p)){var Mt=it&&ge.call(f,"__wrapped__"),Tt=ut&&ge.call(y,"__wrapped__");if(Mt||Tt){var Kt=Mt?f.value():f,Ot=Tt?y.value():y;return D||(D=new Si),N(Kt,Ot,E,O,D)}}return xt?(D||(D=new Si),_7(f,y,E,O,N,D)):!1}function K9(f){return Je(f)&&Un(f)==yn}function mp(f,y,E,O){var N=E.length,D=N,W=!O;if(f==null)return!D;for(f=Ee(f);N--;){var G=E[N];if(W&&G[2]?G[1]!==f[G[0]]:!(G[0]in f))return!1}for(;++N<D;){G=E[N];var Y=G[0],rt=f[Y],it=G[1];if(W&&G[2]){if(rt===e&&!(Y in f))return!1}else{var ut=new Si;if(O)var xt=O(rt,it,Y,f,y,ut);if(!(xt===e?wu(it,rt,p|v,O,ut):xt))return!1}}return!0}function aS(f){if(!He(f)||N7(f))return!1;var y=wa(f)?K8:$4;return y.test(lo(f))}function Z9(f){return Je(f)&&er(f)==qi}function J9(f){return Je(f)&&Un(f)==bn}function Q9(f){return Je(f)&&Bh(f.length)&&!!Le[er(f)]}function sS(f){return typeof f=="function"?f:f==null?pr:typeof f=="object"?$t(f)?uS(f[0],f[1]):lS(f):T3(f)}function yp(f){if(!_u(f))return n9(f);var y=[];for(var E in Ee(f))ge.call(f,E)&&E!="constructor"&&y.push(E);return y}function t7(f){if(!He(f))return D7(f);var y=_u(f),E=[];for(var O in f)O=="constructor"&&(y||!ge.call(f,O))||E.push(O);return E}function bp(f,y){return f<y}function oS(f,y){var E=-1,O=fr(f)?Z(f.length):[];return as(f,function(N,D,W){O[++E]=y(N,D,W)}),O}function lS(f){var y=Lp(f);return y.length==1&&y[0][2]?qS(y[0][0],y[0][1]):function(E){return E===f||mp(E,f,y)}}function uS(f,y){return Dp(f)&&jS(y)?qS(Hi(f),y):function(E){var O=Hp(E,f);return O===e&&O===y?Up(E,f):wu(y,O,p|v)}}function Eh(f,y,E,O,N){f!==y&&fp(y,function(D,W){if(N||(N=new Si),He(D))e7(f,y,W,E,Eh,O,N);else{var G=O?O(Bp(f,W),D,W+"",f,y,N):e;G===e&&(G=D),hp(f,W,G)}},gr)}function e7(f,y,E,O,N,D,W){var G=Bp(f,E),Y=Bp(y,E),rt=W.get(Y);if(rt){hp(f,E,rt);return}var it=D?D(G,Y,E+"",f,y,W):e,ut=it===e;if(ut){var xt=$t(Y),Mt=!xt&&us(Y),Tt=!xt&&!Mt&&dl(Y);it=Y,xt||Mt||Tt?$t(G)?it=G:rn(G)?it=dr(G):Mt?(ut=!1,it=xS(Y,!0)):Tt?(ut=!1,it=ES(Y,!0)):it=[]:Mu(Y)||uo(Y)?(it=G,uo(G)?it=y3(G):(!He(G)||wa(G))&&(it=$S(Y))):ut=!1}ut&&(W.set(Y,it),N(it,Y,O,D,W),W.delete(Y)),hp(f,E,it)}function cS(f,y){var E=f.length;if(E)return y+=y<0?E:0,ba(y,E)?f[y]:e}function hS(f,y,E){y.length?y=je(y,function(D){return $t(D)?function(W){return so(W,D.length===1?D[0]:D)}:D}):y=[pr];var O=-1;y=je(y,Ar(Ct()));var N=oS(f,function(D,W,G){var Y=je(y,function(rt){return rt(D)});return{criteria:Y,index:++O,value:D}});return T8(N,function(D,W){return g7(D,W,E)})}function n7(f,y){return dS(f,y,function(E,O){return Up(f,O)})}function dS(f,y,E){for(var O=-1,N=y.length,D={};++O<N;){var W=y[O],G=so(f,W);E(G,W)&&xu(D,os(W,f),G)}return D}function r7(f){return function(y){return so(y,f)}}function wp(f,y,E,O){var N=O?C8:el,D=-1,W=y.length,G=f;for(f===y&&(y=dr(y)),E&&(G=je(f,Ar(E)));++D<W;)for(var Y=0,rt=y[D],it=E?E(rt):rt;(Y=N(G,it,Y,O))>-1;)G!==f&&dh.call(G,Y,1),dh.call(f,Y,1);return f}function fS(f,y){for(var E=f?y.length:0,O=E-1;E--;){var N=y[E];if(E==O||N!==D){var D=N;ba(N)?dh.call(f,N,1):Sp(f,N)}}return f}function xp(f,y){return f+ph(U_()*(y-f+1))}function i7(f,y,E,O){for(var N=-1,D=xn(gh((y-f)/(E||1)),0),W=Z(D);D--;)W[O?D:++N]=f,f+=E;return W}function Ep(f,y){var E="";if(!f||y<1||y>F)return E;do y%2&&(E+=f),y=ph(y/2),y&&(f+=f);while(y);return E}function Zt(f,y){return zp(WS(f,y,pr),f+"")}function a7(f){return K_(fl(f))}function s7(f,y){var E=fl(f);return Nh(E,ao(y,0,E.length))}function xu(f,y,E,O){if(!He(f))return f;y=os(y,f);for(var N=-1,D=y.length,W=D-1,G=f;G!=null&&++N<D;){var Y=Hi(y[N]),rt=E;if(Y==="__proto__"||Y==="constructor"||Y==="prototype")return f;if(N!=W){var it=G[Y];rt=O?O(it,Y,G):e,rt===e&&(rt=He(it)?it:ba(y[N+1])?[]:{})}mu(G,Y,rt),G=G[Y]}return f}var gS=vh?function(f,y){return vh.set(f,y),f}:pr,o7=fh?function(f,y){return fh(f,"toString",{configurable:!0,enumerable:!1,value:Xp(y),writable:!0})}:pr;function l7(f){return Nh(fl(f))}function ni(f,y,E){var O=-1,N=f.length;y<0&&(y=-y>N?0:N+y),E=E>N?N:E,E<0&&(E+=N),N=y>E?0:E-y>>>0,y>>>=0;for(var D=Z(N);++O<N;)D[O]=f[O+y];return D}function u7(f,y){var E;return as(f,function(O,N,D){return E=y(O,N,D),!E}),!!E}function _h(f,y,E){var O=0,N=f==null?O:f.length;if(typeof y=="number"&&y===y&&N<=ot){for(;O<N;){var D=O+N>>>1,W=f[D];W!==null&&!Nr(W)&&(E?W<=y:W<y)?O=D+1:N=D}return N}return _p(f,y,pr,E)}function _p(f,y,E,O){var N=0,D=f==null?0:f.length;if(D===0)return 0;y=E(y);for(var W=y!==y,G=y===null,Y=Nr(y),rt=y===e;N<D;){var it=ph((N+D)/2),ut=E(f[it]),xt=ut!==e,Mt=ut===null,Tt=ut===ut,Kt=Nr(ut);if(W)var Ot=O||Tt;else rt?Ot=Tt&&(O||xt):G?Ot=Tt&&xt&&(O||!Mt):Y?Ot=Tt&&xt&&!Mt&&(O||!Kt):Mt||Kt?Ot=!1:Ot=O?ut<=y:ut<y;Ot?N=it+1:D=it}return Hn(D,nt)}function pS(f,y){for(var E=-1,O=f.length,N=0,D=[];++E<O;){var W=f[E],G=y?y(W):W;if(!E||!Mi(G,Y)){var Y=G;D[N++]=W===0?0:W}}return D}function vS(f){return typeof f=="number"?f:Nr(f)?X:+f}function Pr(f){if(typeof f=="string")return f;if($t(f))return je(f,Pr)+"";if(Nr(f))return Y_?Y_.call(f):"";var y=f+"";return y=="0"&&1/f==-1/0?"-0":y}function ss(f,y,E){var O=-1,N=nh,D=f.length,W=!0,G=[],Y=G;if(E)W=!1,N=Jg;else if(D>=i){var rt=y?null:w7(f);if(rt)return ih(rt);W=!1,N=hu,Y=new io}else Y=y?[]:G;t:for(;++O<D;){var it=f[O],ut=y?y(it):it;if(it=E||it!==0?it:0,W&&ut===ut){for(var xt=Y.length;xt--;)if(Y[xt]===ut)continue t;y&&Y.push(ut),G.push(it)}else N(Y,ut,E)||(Y!==G&&Y.push(ut),G.push(it))}return G}function Sp(f,y){return y=os(y,f),f=GS(f,y),f==null||delete f[Hi(ri(y))]}function mS(f,y,E,O){return xu(f,y,E(so(f,y)),O)}function Sh(f,y,E,O){for(var N=f.length,D=O?N:-1;(O?D--:++D<N)&&y(f[D],D,f););return E?ni(f,O?0:D,O?D+1:N):ni(f,O?D+1:0,O?N:D)}function yS(f,y){var E=f;return E instanceof re&&(E=E.value()),Qg(y,function(O,N){return N.func.apply(N.thisArg,ns([O],N.args))},E)}function Mp(f,y,E){var O=f.length;if(O<2)return O?ss(f[0]):[];for(var N=-1,D=Z(O);++N<O;)for(var W=f[N],G=-1;++G<O;)G!=N&&(D[N]=yu(D[N]||W,f[G],y,E));return ss(Bn(D,1),y,E)}function bS(f,y,E){for(var O=-1,N=f.length,D=y.length,W={};++O<N;){var G=O<D?y[O]:e;E(W,f[O],G)}return W}function kp(f){return rn(f)?f:[]}function Cp(f){return typeof f=="function"?f:pr}function os(f,y){return $t(f)?f:Dp(f,y)?[f]:YS(fe(f))}var c7=Zt;function ls(f,y,E){var O=f.length;return E=E===e?O:E,!y&&E>=O?f:ni(f,y,E)}var wS=Z8||function(f){return Fn.clearTimeout(f)};function xS(f,y){if(y)return f.slice();var E=f.length,O=q_?q_(E):new f.constructor(E);return f.copy(O),O}function Tp(f){var y=new f.constructor(f.byteLength);return new ch(y).set(new ch(f)),y}function h7(f,y){var E=y?Tp(f.buffer):f.buffer;return new f.constructor(E,f.byteOffset,f.byteLength)}function d7(f){var y=new f.constructor(f.source,i_.exec(f));return y.lastIndex=f.lastIndex,y}function f7(f){return vu?Ee(vu.call(f)):{}}function ES(f,y){var E=y?Tp(f.buffer):f.buffer;return new f.constructor(E,f.byteOffset,f.length)}function _S(f,y){if(f!==y){var E=f!==e,O=f===null,N=f===f,D=Nr(f),W=y!==e,G=y===null,Y=y===y,rt=Nr(y);if(!G&&!rt&&!D&&f>y||D&&W&&Y&&!G&&!rt||O&&W&&Y||!E&&Y||!N)return 1;if(!O&&!D&&!rt&&f<y||rt&&E&&N&&!O&&!D||G&&E&&N||!W&&N||!Y)return-1}return 0}function g7(f,y,E){for(var O=-1,N=f.criteria,D=y.criteria,W=N.length,G=E.length;++O<W;){var Y=_S(N[O],D[O]);if(Y){if(O>=G)return Y;var rt=E[O];return Y*(rt=="desc"?-1:1)}}return f.index-y.index}function SS(f,y,E,O){for(var N=-1,D=f.length,W=E.length,G=-1,Y=y.length,rt=xn(D-W,0),it=Z(Y+rt),ut=!O;++G<Y;)it[G]=y[G];for(;++N<W;)(ut||N<D)&&(it[E[N]]=f[N]);for(;rt--;)it[G++]=f[N++];return it}function MS(f,y,E,O){for(var N=-1,D=f.length,W=-1,G=E.length,Y=-1,rt=y.length,it=xn(D-G,0),ut=Z(it+rt),xt=!O;++N<it;)ut[N]=f[N];for(var Mt=N;++Y<rt;)ut[Mt+Y]=y[Y];for(;++W<G;)(xt||N<D)&&(ut[Mt+E[W]]=f[N++]);return ut}function dr(f,y){var E=-1,O=f.length;for(y||(y=Z(O));++E<O;)y[E]=f[E];return y}function Vi(f,y,E,O){var N=!E;E||(E={});for(var D=-1,W=y.length;++D<W;){var G=y[D],Y=O?O(E[G],f[G],G,E,f):e;Y===e&&(Y=f[G]),N?va(E,G,Y):mu(E,G,Y)}return E}function p7(f,y){return Vi(f,Ip(f),y)}function v7(f,y){return Vi(f,BS(f),y)}function Mh(f,y){return function(E,O){var N=$t(E)?x8:B9,D=y?y():{};return N(E,f,Ct(O,2),D)}}function ul(f){return Zt(function(y,E){var O=-1,N=E.length,D=N>1?E[N-1]:e,W=N>2?E[2]:e;for(D=f.length>3&&typeof D=="function"?(N--,D):e,W&&nr(E[0],E[1],W)&&(D=N<3?e:D,N=1),y=Ee(y);++O<N;){var G=E[O];G&&f(y,G,O,D)}return y})}function kS(f,y){return function(E,O){if(E==null)return E;if(!fr(E))return f(E,O);for(var N=E.length,D=y?N:-1,W=Ee(E);(y?D--:++D<N)&&O(W[D],D,W)!==!1;);return E}}function CS(f){return function(y,E,O){for(var N=-1,D=Ee(y),W=O(y),G=W.length;G--;){var Y=W[f?G:++N];if(E(D[Y],Y,D)===!1)break}return y}}function m7(f,y,E){var O=y&m,N=Eu(f);function D(){var W=this&&this!==Fn&&this instanceof D?N:f;return W.apply(O?E:this,arguments)}return D}function TS(f){return function(y){y=fe(y);var E=nl(y)?_i(y):e,O=E?E[0]:y.charAt(0),N=E?ls(E,1).join(""):y.slice(1);return O[f]()+N}}function cl(f){return function(y){return Qg(k3(M3(y).replace(o8,"")),f,"")}}function Eu(f){return function(){var y=arguments;switch(y.length){case 0:return new f;case 1:return new f(y[0]);case 2:return new f(y[0],y[1]);case 3:return new f(y[0],y[1],y[2]);case 4:return new f(y[0],y[1],y[2],y[3]);case 5:return new f(y[0],y[1],y[2],y[3],y[4]);case 6:return new f(y[0],y[1],y[2],y[3],y[4],y[5]);case 7:return new f(y[0],y[1],y[2],y[3],y[4],y[5],y[6])}var E=ll(f.prototype),O=f.apply(E,y);return He(O)?O:E}}function y7(f,y,E){var O=Eu(f);function N(){for(var D=arguments.length,W=Z(D),G=D,Y=hl(N);G--;)W[G]=arguments[G];var rt=D<3&&W[0]!==Y&&W[D-1]!==Y?[]:rs(W,Y);if(D-=rt.length,D<E)return RS(f,y,kh,N.placeholder,e,W,rt,e,e,E-D);var it=this&&this!==Fn&&this instanceof N?O:f;return Or(it,this,W)}return N}function OS(f){return function(y,E,O){var N=Ee(y);if(!fr(y)){var D=Ct(E,3);y=Tn(y),E=function(G){return D(N[G],G,N)}}var W=f(y,E,O);return W>-1?N[D?y[W]:W]:e}}function AS(f){return ya(function(y){var E=y.length,O=E,N=ti.prototype.thru;for(f&&y.reverse();O--;){var D=y[O];if(typeof D!="function")throw new Qr(s);if(N&&!W&&Ah(D)=="wrapper")var W=new ti([],!0)}for(O=W?O:E;++O<E;){D=y[O];var G=Ah(D),Y=G=="wrapper"?Rp(D):e;Y&&Fp(Y[0])&&Y[1]==(M|x|_|C)&&!Y[4].length&&Y[9]==1?W=W[Ah(Y[0])].apply(W,Y[3]):W=D.length==1&&Fp(D)?W[G]():W.thru(D)}return function(){var rt=arguments,it=rt[0];if(W&&rt.length==1&&$t(it))return W.plant(it).value();for(var ut=0,xt=E?y[ut].apply(this,rt):it;++ut<E;)xt=y[ut].call(this,xt);return xt}})}function kh(f,y,E,O,N,D,W,G,Y,rt){var it=y&M,ut=y&m,xt=y&b,Mt=y&(x|S),Tt=y&P,Kt=xt?e:Eu(f);function Ot(){for(var ee=arguments.length,ie=Z(ee),Rr=ee;Rr--;)ie[Rr]=arguments[Rr];if(Mt)var rr=hl(Ot),Lr=A8(ie,rr);if(O&&(ie=SS(ie,O,N,Mt)),D&&(ie=MS(ie,D,W,Mt)),ee-=Lr,Mt&&ee<rt){var an=rs(ie,rr);return RS(f,y,kh,Ot.placeholder,E,ie,an,G,Y,rt-ee)}var ki=ut?E:this,Ea=xt?ki[f]:f;return ee=ie.length,G?ie=B7(ie,G):Tt&&ee>1&&ie.reverse(),it&&Y<ee&&(ie.length=Y),this&&this!==Fn&&this instanceof Ot&&(Ea=Kt||Eu(Ea)),Ea.apply(ki,ie)}return Ot}function PS(f,y){return function(E,O){return H9(E,f,y(O),{})}}function Ch(f,y){return function(E,O){var N;if(E===e&&O===e)return y;if(E!==e&&(N=E),O!==e){if(N===e)return O;typeof E=="string"||typeof O=="string"?(E=Pr(E),O=Pr(O)):(E=vS(E),O=vS(O)),N=f(E,O)}return N}}function Op(f){return ya(function(y){return y=je(y,Ar(Ct())),Zt(function(E){var O=this;return f(y,function(N){return Or(N,O,E)})})})}function Th(f,y){y=y===e?" ":Pr(y);var E=y.length;if(E<2)return E?Ep(y,f):y;var O=Ep(y,gh(f/rl(y)));return nl(y)?ls(_i(O),0,f).join(""):O.slice(0,f)}function b7(f,y,E,O){var N=y&m,D=Eu(f);function W(){for(var G=-1,Y=arguments.length,rt=-1,it=O.length,ut=Z(it+Y),xt=this&&this!==Fn&&this instanceof W?D:f;++rt<it;)ut[rt]=O[rt];for(;Y--;)ut[rt++]=arguments[++G];return Or(xt,N?E:this,ut)}return W}function NS(f){return function(y,E,O){return O&&typeof O!="number"&&nr(y,E,O)&&(E=O=e),y=xa(y),E===e?(E=y,y=0):E=xa(E),O=O===e?y<E?1:-1:xa(O),i7(y,E,O,f)}}function Oh(f){return function(y,E){return typeof y=="string"&&typeof E=="string"||(y=ii(y),E=ii(E)),f(y,E)}}function RS(f,y,E,O,N,D,W,G,Y,rt){var it=y&x,ut=it?W:e,xt=it?e:W,Mt=it?D:e,Tt=it?e:D;y|=it?_:k,y&=~(it?k:_),y&w||(y&=-4);var Kt=[f,y,N,Mt,ut,Tt,xt,G,Y,rt],Ot=E.apply(e,Kt);return Fp(f)&&VS(Ot,Kt),Ot.placeholder=O,HS(Ot,f,y)}function Ap(f){var y=wn[f];return function(E,O){if(E=ii(E),O=O==null?0:Hn(Yt(O),292),O&&H_(E)){var N=(fe(E)+"e").split("e"),D=y(N[0]+"e"+(+N[1]+O));return N=(fe(D)+"e").split("e"),+(N[0]+"e"+(+N[1]-O))}return y(E)}}var w7=sl&&1/ih(new sl([,-0]))[1]==B?function(f){return new sl(f)}:Jp;function LS(f){return function(y){var E=Un(y);return E==yn?sp(y):E==bn?F8(y):O8(y,f(y))}}function ma(f,y,E,O,N,D,W,G){var Y=y&b;if(!Y&&typeof f!="function")throw new Qr(s);var rt=O?O.length:0;if(rt||(y&=-97,O=N=e),W=W===e?W:xn(Yt(W),0),G=G===e?G:Yt(G),rt-=N?N.length:0,y&k){var it=O,ut=N;O=N=e}var xt=Y?e:Rp(f),Mt=[f,y,E,O,N,it,ut,D,W,G];if(xt&&I7(Mt,xt),f=Mt[0],y=Mt[1],E=Mt[2],O=Mt[3],N=Mt[4],G=Mt[9]=Mt[9]===e?Y?0:f.length:xn(Mt[9]-rt,0),!G&&y&(x|S)&&(y&=-25),!y||y==m)var Tt=m7(f,y,E);else y==x||y==S?Tt=y7(f,y,G):(y==_||y==(m|_))&&!N.length?Tt=b7(f,y,E,O):Tt=kh.apply(e,Mt);var Kt=xt?gS:VS;return HS(Kt(Tt,Mt),f,y)}function IS(f,y,E,O){return f===e||Mi(f,al[E])&&!ge.call(O,E)?y:f}function DS(f,y,E,O,N,D){return He(f)&&He(y)&&(D.set(y,f),Eh(f,y,e,DS,D),D.delete(y)),f}function x7(f){return Mu(f)?e:f}function FS(f,y,E,O,N,D){var W=E&p,G=f.length,Y=y.length;if(G!=Y&&!(W&&Y>G))return!1;var rt=D.get(f),it=D.get(y);if(rt&&it)return rt==y&&it==f;var ut=-1,xt=!0,Mt=E&v?new io:e;for(D.set(f,y),D.set(y,f);++ut<G;){var Tt=f[ut],Kt=y[ut];if(O)var Ot=W?O(Kt,Tt,ut,y,f,D):O(Tt,Kt,ut,f,y,D);if(Ot!==e){if(Ot)continue;xt=!1;break}if(Mt){if(!tp(y,function(ee,ie){if(!hu(Mt,ie)&&(Tt===ee||N(Tt,ee,E,O,D)))return Mt.push(ie)})){xt=!1;break}}else if(!(Tt===Kt||N(Tt,Kt,E,O,D))){xt=!1;break}}return D.delete(f),D.delete(y),xt}function E7(f,y,E,O,N,D,W){switch(E){case tr:if(f.byteLength!=y.byteLength||f.byteOffset!=y.byteOffset)return!1;f=f.buffer,y=y.buffer;case Wi:return!(f.byteLength!=y.byteLength||!D(new ch(f),new ch(y)));case zt:case Wt:case te:return Mi(+f,+y);case Ge:return f.name==y.name&&f.message==y.message;case qi:case Dn:return f==y+"";case yn:var G=sp;case bn:var Y=O&p;if(G||(G=ih),f.size!=y.size&&!Y)return!1;var rt=W.get(f);if(rt)return rt==y;O|=v,W.set(f,y);var it=FS(G(f),G(y),O,N,D,W);return W.delete(f),it;case $e:if(vu)return vu.call(f)==vu.call(y)}return!1}function _7(f,y,E,O,N,D){var W=E&p,G=Pp(f),Y=G.length,rt=Pp(y),it=rt.length;if(Y!=it&&!W)return!1;for(var ut=Y;ut--;){var xt=G[ut];if(!(W?xt in y:ge.call(y,xt)))return!1}var Mt=D.get(f),Tt=D.get(y);if(Mt&&Tt)return Mt==y&&Tt==f;var Kt=!0;D.set(f,y),D.set(y,f);for(var Ot=W;++ut<Y;){xt=G[ut];var ee=f[xt],ie=y[xt];if(O)var Rr=W?O(ie,ee,xt,y,f,D):O(ee,ie,xt,f,y,D);if(!(Rr===e?ee===ie||N(ee,ie,E,O,D):Rr)){Kt=!1;break}Ot||(Ot=xt=="constructor")}if(Kt&&!Ot){var rr=f.constructor,Lr=y.constructor;rr!=Lr&&"constructor"in f&&"constructor"in y&&!(typeof rr=="function"&&rr instanceof rr&&typeof Lr=="function"&&Lr instanceof Lr)&&(Kt=!1)}return D.delete(f),D.delete(y),Kt}function ya(f){return zp(WS(f,e,JS),f+"")}function Pp(f){return rS(f,Tn,Ip)}function Np(f){return rS(f,gr,BS)}var Rp=vh?function(f){return vh.get(f)}:Jp;function Ah(f){for(var y=f.name+"",E=ol[y],O=ge.call(ol,y)?E.length:0;O--;){var N=E[O],D=N.func;if(D==null||D==f)return N.name}return y}function hl(f){var y=ge.call(I,"placeholder")?I:f;return y.placeholder}function Ct(){var f=I.iteratee||Kp;return f=f===Kp?sS:f,arguments.length?f(arguments[0],arguments[1]):f}function Ph(f,y){var E=f.__data__;return P7(y)?E[typeof y=="string"?"string":"hash"]:E.map}function Lp(f){for(var y=Tn(f),E=y.length;E--;){var O=y[E],N=f[O];y[E]=[O,N,jS(N)]}return y}function oo(f,y){var E=L8(f,y);return aS(E)?E:e}function S7(f){var y=ge.call(f,no),E=f[no];try{f[no]=e;var O=!0}catch{}var N=lh.call(f);return O&&(y?f[no]=E:delete f[no]),N}var Ip=lp?function(f){return f==null?[]:(f=Ee(f),es(lp(f),function(y){return G_.call(f,y)}))}:Qp,BS=lp?function(f){for(var y=[];f;)ns(y,Ip(f)),f=hh(f);return y}:Qp,Un=er;(up&&Un(new up(new ArrayBuffer(1)))!=tr||fu&&Un(new fu)!=yn||cp&&Un(cp.resolve())!=Xr||sl&&Un(new sl)!=bn||gu&&Un(new gu)!=Cn)&&(Un=function(f){var y=er(f),E=y==Gt?f.constructor:e,O=E?lo(E):"";if(O)switch(O){case s9:return tr;case o9:return yn;case l9:return Xr;case u9:return bn;case c9:return Cn}return y});function M7(f,y,E){for(var O=-1,N=E.length;++O<N;){var D=E[O],W=D.size;switch(D.type){case"drop":f+=W;break;case"dropRight":y-=W;break;case"take":y=Hn(y,f+W);break;case"takeRight":f=xn(f,y-W);break}}return{start:f,end:y}}function k7(f){var y=f.match(N4);return y?y[1].split(R4):[]}function zS(f,y,E){y=os(y,f);for(var O=-1,N=y.length,D=!1;++O<N;){var W=Hi(y[O]);if(!(D=f!=null&&E(f,W)))break;f=f[W]}return D||++O!=N?D:(N=f==null?0:f.length,!!N&&Bh(N)&&ba(W,N)&&($t(f)||uo(f)))}function C7(f){var y=f.length,E=new f.constructor(y);return y&&typeof f[0]=="string"&&ge.call(f,"index")&&(E.index=f.index,E.input=f.input),E}function $S(f){return typeof f.constructor=="function"&&!_u(f)?ll(hh(f)):{}}function T7(f,y,E){var O=f.constructor;switch(y){case Wi:return Tp(f);case zt:case Wt:return new O(+f);case tr:return h7(f,E);case Qa:case ts:case cu:case Qo:case Kr:case Ei:case $g:case jg:case qg:return ES(f,E);case yn:return new O;case te:case Dn:return new O(f);case qi:return d7(f);case bn:return new O;case $e:return f7(f)}}function O7(f,y){var E=y.length;if(!E)return f;var O=E-1;return y[O]=(E>1?"& ":"")+y[O],y=y.join(E>2?", ":" "),f.replace(P4,`{
- /* [wrapped with `+y+`] */
- `)}function A7(f){return $t(f)||uo(f)||!!(V_&&f&&f[V_])}function ba(f,y){var E=typeof f;return y=y??F,!!y&&(E=="number"||E!="symbol"&&q4.test(f))&&f>-1&&f%1==0&&f<y}function nr(f,y,E){if(!He(E))return!1;var O=typeof y;return(O=="number"?fr(E)&&ba(y,E.length):O=="string"&&y in E)?Mi(E[y],f):!1}function Dp(f,y){if($t(f))return!1;var E=typeof f;return E=="number"||E=="symbol"||E=="boolean"||f==null||Nr(f)?!0:C4.test(f)||!k4.test(f)||y!=null&&f in Ee(y)}function P7(f){var y=typeof f;return y=="string"||y=="number"||y=="symbol"||y=="boolean"?f!=="__proto__":f===null}function Fp(f){var y=Ah(f),E=I[y];if(typeof E!="function"||!(y in re.prototype))return!1;if(f===E)return!0;var O=Rp(E);return!!O&&f===O[0]}function N7(f){return!!j_&&j_ in f}var R7=sh?wa:tv;function _u(f){var y=f&&f.constructor,E=typeof y=="function"&&y.prototype||al;return f===E}function jS(f){return f===f&&!He(f)}function qS(f,y){return function(E){return E==null?!1:E[f]===y&&(y!==e||f in Ee(E))}}function L7(f){var y=Dh(f,function(O){return E.size===u&&E.clear(),O}),E=y.cache;return y}function I7(f,y){var E=f[1],O=y[1],N=E|O,D=N<(m|b|M),W=O==M&&E==x||O==M&&E==C&&f[7].length<=y[8]||O==(M|C)&&y[7].length<=y[8]&&E==x;if(!(D||W))return f;O&m&&(f[2]=y[2],N|=E&m?0:w);var G=y[3];if(G){var Y=f[3];f[3]=Y?SS(Y,G,y[4]):G,f[4]=Y?rs(f[3],c):y[4]}return G=y[5],G&&(Y=f[5],f[5]=Y?MS(Y,G,y[6]):G,f[6]=Y?rs(f[5],c):y[6]),G=y[7],G&&(f[7]=G),O&M&&(f[8]=f[8]==null?y[8]:Hn(f[8],y[8])),f[9]==null&&(f[9]=y[9]),f[0]=y[0],f[1]=N,f}function D7(f){var y=[];if(f!=null)for(var E in Ee(f))y.push(E);return y}function F7(f){return lh.call(f)}function WS(f,y,E){return y=xn(y===e?f.length-1:y,0),function(){for(var O=arguments,N=-1,D=xn(O.length-y,0),W=Z(D);++N<D;)W[N]=O[y+N];N=-1;for(var G=Z(y+1);++N<y;)G[N]=O[N];return G[y]=E(W),Or(f,this,G)}}function GS(f,y){return y.length<2?f:so(f,ni(y,0,-1))}function B7(f,y){for(var E=f.length,O=Hn(y.length,E),N=dr(f);O--;){var D=y[O];f[O]=ba(D,E)?N[D]:e}return f}function Bp(f,y){if(!(y==="constructor"&&typeof f[y]=="function")&&y!="__proto__")return f[y]}var VS=US(gS),Su=Q8||function(f,y){return Fn.setTimeout(f,y)},zp=US(o7);function HS(f,y,E){var O=y+"";return zp(f,O7(O,z7(k7(O),E)))}function US(f){var y=0,E=0;return function(){var O=r9(),N=L-(O-E);if(E=O,N>0){if(++y>=R)return arguments[0]}else y=0;return f.apply(e,arguments)}}function Nh(f,y){var E=-1,O=f.length,N=O-1;for(y=y===e?O:y;++E<y;){var D=xp(E,N),W=f[D];f[D]=f[E],f[E]=W}return f.length=y,f}var YS=L7(function(f){var y=[];return f.charCodeAt(0)===46&&y.push(""),f.replace(T4,function(E,O,N,D){y.push(N?D.replace(D4,"$1"):O||E)}),y});function Hi(f){if(typeof f=="string"||Nr(f))return f;var y=f+"";return y=="0"&&1/f==-1/0?"-0":y}function lo(f){if(f!=null){try{return oh.call(f)}catch{}try{return f+""}catch{}}return""}function z7(f,y){return Jr(ct,function(E){var O="_."+E[0];y&E[1]&&!nh(f,O)&&f.push(O)}),f.sort()}function XS(f){if(f instanceof re)return f.clone();var y=new ti(f.__wrapped__,f.__chain__);return y.__actions__=dr(f.__actions__),y.__index__=f.__index__,y.__values__=f.__values__,y}function $7(f,y,E){(E?nr(f,y,E):y===e)?y=1:y=xn(Yt(y),0);var O=f==null?0:f.length;if(!O||y<1)return[];for(var N=0,D=0,W=Z(gh(O/y));N<O;)W[D++]=ni(f,N,N+=y);return W}function j7(f){for(var y=-1,E=f==null?0:f.length,O=0,N=[];++y<E;){var D=f[y];D&&(N[O++]=D)}return N}function q7(){var f=arguments.length;if(!f)return[];for(var y=Z(f-1),E=arguments[0],O=f;O--;)y[O-1]=arguments[O];return ns($t(E)?dr(E):[E],Bn(y,1))}var W7=Zt(function(f,y){return rn(f)?yu(f,Bn(y,1,rn,!0)):[]}),G7=Zt(function(f,y){var E=ri(y);return rn(E)&&(E=e),rn(f)?yu(f,Bn(y,1,rn,!0),Ct(E,2)):[]}),V7=Zt(function(f,y){var E=ri(y);return rn(E)&&(E=e),rn(f)?yu(f,Bn(y,1,rn,!0),e,E):[]});function H7(f,y,E){var O=f==null?0:f.length;return O?(y=E||y===e?1:Yt(y),ni(f,y<0?0:y,O)):[]}function U7(f,y,E){var O=f==null?0:f.length;return O?(y=E||y===e?1:Yt(y),y=O-y,ni(f,0,y<0?0:y)):[]}function Y7(f,y){return f&&f.length?Sh(f,Ct(y,3),!0,!0):[]}function X7(f,y){return f&&f.length?Sh(f,Ct(y,3),!0):[]}function K7(f,y,E,O){var N=f==null?0:f.length;return N?(E&&typeof E!="number"&&nr(f,y,E)&&(E=0,O=N),q9(f,y,E,O)):[]}function KS(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=E==null?0:Yt(E);return N<0&&(N=xn(O+N,0)),rh(f,Ct(y,3),N)}function ZS(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=O-1;return E!==e&&(N=Yt(E),N=E<0?xn(O+N,0):Hn(N,O-1)),rh(f,Ct(y,3),N,!0)}function JS(f){var y=f==null?0:f.length;return y?Bn(f,1):[]}function Z7(f){var y=f==null?0:f.length;return y?Bn(f,B):[]}function J7(f,y){var E=f==null?0:f.length;return E?(y=y===e?1:Yt(y),Bn(f,y)):[]}function Q7(f){for(var y=-1,E=f==null?0:f.length,O={};++y<E;){var N=f[y];O[N[0]]=N[1]}return O}function QS(f){return f&&f.length?f[0]:e}function tF(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=E==null?0:Yt(E);return N<0&&(N=xn(O+N,0)),el(f,y,N)}function eF(f){var y=f==null?0:f.length;return y?ni(f,0,-1):[]}var nF=Zt(function(f){var y=je(f,kp);return y.length&&y[0]===f[0]?vp(y):[]}),rF=Zt(function(f){var y=ri(f),E=je(f,kp);return y===ri(E)?y=e:E.pop(),E.length&&E[0]===f[0]?vp(E,Ct(y,2)):[]}),iF=Zt(function(f){var y=ri(f),E=je(f,kp);return y=typeof y=="function"?y:e,y&&E.pop(),E.length&&E[0]===f[0]?vp(E,e,y):[]});function aF(f,y){return f==null?"":e9.call(f,y)}function ri(f){var y=f==null?0:f.length;return y?f[y-1]:e}function sF(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=O;return E!==e&&(N=Yt(E),N=N<0?xn(O+N,0):Hn(N,O-1)),y===y?z8(f,y,N):rh(f,R_,N,!0)}function oF(f,y){return f&&f.length?cS(f,Yt(y)):e}var lF=Zt(t3);function t3(f,y){return f&&f.length&&y&&y.length?wp(f,y):f}function uF(f,y,E){return f&&f.length&&y&&y.length?wp(f,y,Ct(E,2)):f}function cF(f,y,E){return f&&f.length&&y&&y.length?wp(f,y,e,E):f}var hF=ya(function(f,y){var E=f==null?0:f.length,O=dp(f,y);return fS(f,je(y,function(N){return ba(N,E)?+N:N}).sort(_S)),O});function dF(f,y){var E=[];if(!(f&&f.length))return E;var O=-1,N=[],D=f.length;for(y=Ct(y,3);++O<D;){var W=f[O];y(W,O,f)&&(E.push(W),N.push(O))}return fS(f,N),E}function $p(f){return f==null?f:a9.call(f)}function fF(f,y,E){var O=f==null?0:f.length;return O?(E&&typeof E!="number"&&nr(f,y,E)?(y=0,E=O):(y=y==null?0:Yt(y),E=E===e?O:Yt(E)),ni(f,y,E)):[]}function gF(f,y){return _h(f,y)}function pF(f,y,E){return _p(f,y,Ct(E,2))}function vF(f,y){var E=f==null?0:f.length;if(E){var O=_h(f,y);if(O<E&&Mi(f[O],y))return O}return-1}function mF(f,y){return _h(f,y,!0)}function yF(f,y,E){return _p(f,y,Ct(E,2),!0)}function bF(f,y){var E=f==null?0:f.length;if(E){var O=_h(f,y,!0)-1;if(Mi(f[O],y))return O}return-1}function wF(f){return f&&f.length?pS(f):[]}function xF(f,y){return f&&f.length?pS(f,Ct(y,2)):[]}function EF(f){var y=f==null?0:f.length;return y?ni(f,1,y):[]}function _F(f,y,E){return f&&f.length?(y=E||y===e?1:Yt(y),ni(f,0,y<0?0:y)):[]}function SF(f,y,E){var O=f==null?0:f.length;return O?(y=E||y===e?1:Yt(y),y=O-y,ni(f,y<0?0:y,O)):[]}function MF(f,y){return f&&f.length?Sh(f,Ct(y,3),!1,!0):[]}function kF(f,y){return f&&f.length?Sh(f,Ct(y,3)):[]}var CF=Zt(function(f){return ss(Bn(f,1,rn,!0))}),TF=Zt(function(f){var y=ri(f);return rn(y)&&(y=e),ss(Bn(f,1,rn,!0),Ct(y,2))}),OF=Zt(function(f){var y=ri(f);return y=typeof y=="function"?y:e,ss(Bn(f,1,rn,!0),e,y)});function AF(f){return f&&f.length?ss(f):[]}function PF(f,y){return f&&f.length?ss(f,Ct(y,2)):[]}function NF(f,y){return y=typeof y=="function"?y:e,f&&f.length?ss(f,e,y):[]}function jp(f){if(!(f&&f.length))return[];var y=0;return f=es(f,function(E){if(rn(E))return y=xn(E.length,y),!0}),ip(y,function(E){return je(f,ep(E))})}function e3(f,y){if(!(f&&f.length))return[];var E=jp(f);return y==null?E:je(E,function(O){return Or(y,e,O)})}var RF=Zt(function(f,y){return rn(f)?yu(f,y):[]}),LF=Zt(function(f){return Mp(es(f,rn))}),IF=Zt(function(f){var y=ri(f);return rn(y)&&(y=e),Mp(es(f,rn),Ct(y,2))}),DF=Zt(function(f){var y=ri(f);return y=typeof y=="function"?y:e,Mp(es(f,rn),e,y)}),FF=Zt(jp);function BF(f,y){return bS(f||[],y||[],mu)}function zF(f,y){return bS(f||[],y||[],xu)}var $F=Zt(function(f){var y=f.length,E=y>1?f[y-1]:e;return E=typeof E=="function"?(f.pop(),E):e,e3(f,E)});function n3(f){var y=I(f);return y.__chain__=!0,y}function jF(f,y){return y(f),f}function Rh(f,y){return y(f)}var qF=ya(function(f){var y=f.length,E=y?f[0]:0,O=this.__wrapped__,N=function(D){return dp(D,f)};return y>1||this.__actions__.length||!(O instanceof re)||!ba(E)?this.thru(N):(O=O.slice(E,+E+(y?1:0)),O.__actions__.push({func:Rh,args:[N],thisArg:e}),new ti(O,this.__chain__).thru(function(D){return y&&!D.length&&D.push(e),D}))});function WF(){return n3(this)}function GF(){return new ti(this.value(),this.__chain__)}function VF(){this.__values__===e&&(this.__values__=v3(this.value()));var f=this.__index__>=this.__values__.length,y=f?e:this.__values__[this.__index__++];return{done:f,value:y}}function HF(){return this}function UF(f){for(var y,E=this;E instanceof yh;){var O=XS(E);O.__index__=0,O.__values__=e,y?N.__wrapped__=O:y=O;var N=O;E=E.__wrapped__}return N.__wrapped__=f,y}function YF(){var f=this.__wrapped__;if(f instanceof re){var y=f;return this.__actions__.length&&(y=new re(this)),y=y.reverse(),y.__actions__.push({func:Rh,args:[$p],thisArg:e}),new ti(y,this.__chain__)}return this.thru($p)}function XF(){return yS(this.__wrapped__,this.__actions__)}var KF=Mh(function(f,y,E){ge.call(f,E)?++f[E]:va(f,E,1)});function ZF(f,y,E){var O=$t(f)?P_:j9;return E&&nr(f,y,E)&&(y=e),O(f,Ct(y,3))}function JF(f,y){var E=$t(f)?es:eS;return E(f,Ct(y,3))}var QF=OS(KS),tB=OS(ZS);function eB(f,y){return Bn(Lh(f,y),1)}function nB(f,y){return Bn(Lh(f,y),B)}function rB(f,y,E){return E=E===e?1:Yt(E),Bn(Lh(f,y),E)}function r3(f,y){var E=$t(f)?Jr:as;return E(f,Ct(y,3))}function i3(f,y){var E=$t(f)?E8:tS;return E(f,Ct(y,3))}var iB=Mh(function(f,y,E){ge.call(f,E)?f[E].push(y):va(f,E,[y])});function aB(f,y,E,O){f=fr(f)?f:fl(f),E=E&&!O?Yt(E):0;var N=f.length;return E<0&&(E=xn(N+E,0)),zh(f)?E<=N&&f.indexOf(y,E)>-1:!!N&&el(f,y,E)>-1}var sB=Zt(function(f,y,E){var O=-1,N=typeof y=="function",D=fr(f)?Z(f.length):[];return as(f,function(W){D[++O]=N?Or(y,W,E):bu(W,y,E)}),D}),oB=Mh(function(f,y,E){va(f,E,y)});function Lh(f,y){var E=$t(f)?je:oS;return E(f,Ct(y,3))}function lB(f,y,E,O){return f==null?[]:($t(y)||(y=y==null?[]:[y]),E=O?e:E,$t(E)||(E=E==null?[]:[E]),hS(f,y,E))}var uB=Mh(function(f,y,E){f[E?0:1].push(y)},function(){return[[],[]]});function cB(f,y,E){var O=$t(f)?Qg:I_,N=arguments.length<3;return O(f,Ct(y,4),E,N,as)}function hB(f,y,E){var O=$t(f)?_8:I_,N=arguments.length<3;return O(f,Ct(y,4),E,N,tS)}function dB(f,y){var E=$t(f)?es:eS;return E(f,Fh(Ct(y,3)))}function fB(f){var y=$t(f)?K_:a7;return y(f)}function gB(f,y,E){(E?nr(f,y,E):y===e)?y=1:y=Yt(y);var O=$t(f)?D9:s7;return O(f,y)}function pB(f){var y=$t(f)?F9:l7;return y(f)}function vB(f){if(f==null)return 0;if(fr(f))return zh(f)?rl(f):f.length;var y=Un(f);return y==yn||y==bn?f.size:yp(f).length}function mB(f,y,E){var O=$t(f)?tp:u7;return E&&nr(f,y,E)&&(y=e),O(f,Ct(y,3))}var yB=Zt(function(f,y){if(f==null)return[];var E=y.length;return E>1&&nr(f,y[0],y[1])?y=[]:E>2&&nr(y[0],y[1],y[2])&&(y=[y[0]]),hS(f,Bn(y,1),[])}),Ih=J8||function(){return Fn.Date.now()};function bB(f,y){if(typeof y!="function")throw new Qr(s);return f=Yt(f),function(){if(--f<1)return y.apply(this,arguments)}}function a3(f,y,E){return y=E?e:y,y=f&&y==null?f.length:y,ma(f,M,e,e,e,e,y)}function s3(f,y){var E;if(typeof y!="function")throw new Qr(s);return f=Yt(f),function(){return--f>0&&(E=y.apply(this,arguments)),f<=1&&(y=e),E}}var qp=Zt(function(f,y,E){var O=m;if(E.length){var N=rs(E,hl(qp));O|=_}return ma(f,O,y,E,N)}),o3=Zt(function(f,y,E){var O=m|b;if(E.length){var N=rs(E,hl(o3));O|=_}return ma(y,O,f,E,N)});function l3(f,y,E){y=E?e:y;var O=ma(f,x,e,e,e,e,e,y);return O.placeholder=l3.placeholder,O}function u3(f,y,E){y=E?e:y;var O=ma(f,S,e,e,e,e,e,y);return O.placeholder=u3.placeholder,O}function c3(f,y,E){var O,N,D,W,G,Y,rt=0,it=!1,ut=!1,xt=!0;if(typeof f!="function")throw new Qr(s);y=ii(y)||0,He(E)&&(it=!!E.leading,ut="maxWait"in E,D=ut?xn(ii(E.maxWait)||0,y):D,xt="trailing"in E?!!E.trailing:xt);function Mt(an){var ki=O,Ea=N;return O=N=e,rt=an,W=f.apply(Ea,ki),W}function Tt(an){return rt=an,G=Su(ee,y),it?Mt(an):W}function Kt(an){var ki=an-Y,Ea=an-rt,O3=y-ki;return ut?Hn(O3,D-Ea):O3}function Ot(an){var ki=an-Y,Ea=an-rt;return Y===e||ki>=y||ki<0||ut&&Ea>=D}function ee(){var an=Ih();if(Ot(an))return ie(an);G=Su(ee,Kt(an))}function ie(an){return G=e,xt&&O?Mt(an):(O=N=e,W)}function Rr(){G!==e&&wS(G),rt=0,O=Y=N=G=e}function rr(){return G===e?W:ie(Ih())}function Lr(){var an=Ih(),ki=Ot(an);if(O=arguments,N=this,Y=an,ki){if(G===e)return Tt(Y);if(ut)return wS(G),G=Su(ee,y),Mt(Y)}return G===e&&(G=Su(ee,y)),W}return Lr.cancel=Rr,Lr.flush=rr,Lr}var wB=Zt(function(f,y){return Q_(f,1,y)}),xB=Zt(function(f,y,E){return Q_(f,ii(y)||0,E)});function EB(f){return ma(f,P)}function Dh(f,y){if(typeof f!="function"||y!=null&&typeof y!="function")throw new Qr(s);var E=function(){var O=arguments,N=y?y.apply(this,O):O[0],D=E.cache;if(D.has(N))return D.get(N);var W=f.apply(this,O);return E.cache=D.set(N,W)||D,W};return E.cache=new(Dh.Cache||pa),E}Dh.Cache=pa;function Fh(f){if(typeof f!="function")throw new Qr(s);return function(){var y=arguments;switch(y.length){case 0:return!f.call(this);case 1:return!f.call(this,y[0]);case 2:return!f.call(this,y[0],y[1]);case 3:return!f.call(this,y[0],y[1],y[2])}return!f.apply(this,y)}}function _B(f){return s3(2,f)}var SB=c7(function(f,y){y=y.length==1&&$t(y[0])?je(y[0],Ar(Ct())):je(Bn(y,1),Ar(Ct()));var E=y.length;return Zt(function(O){for(var N=-1,D=Hn(O.length,E);++N<D;)O[N]=y[N].call(this,O[N]);return Or(f,this,O)})}),Wp=Zt(function(f,y){var E=rs(y,hl(Wp));return ma(f,_,e,y,E)}),h3=Zt(function(f,y){var E=rs(y,hl(h3));return ma(f,k,e,y,E)}),MB=ya(function(f,y){return ma(f,C,e,e,e,y)});function kB(f,y){if(typeof f!="function")throw new Qr(s);return y=y===e?y:Yt(y),Zt(f,y)}function CB(f,y){if(typeof f!="function")throw new Qr(s);return y=y==null?0:xn(Yt(y),0),Zt(function(E){var O=E[y],N=ls(E,0,y);return O&&ns(N,O),Or(f,this,N)})}function TB(f,y,E){var O=!0,N=!0;if(typeof f!="function")throw new Qr(s);return He(E)&&(O="leading"in E?!!E.leading:O,N="trailing"in E?!!E.trailing:N),c3(f,y,{leading:O,maxWait:y,trailing:N})}function OB(f){return a3(f,1)}function AB(f,y){return Wp(Cp(y),f)}function PB(){if(!arguments.length)return[];var f=arguments[0];return $t(f)?f:[f]}function NB(f){return ei(f,g)}function RB(f,y){return y=typeof y=="function"?y:e,ei(f,g,y)}function LB(f){return ei(f,h|g)}function IB(f,y){return y=typeof y=="function"?y:e,ei(f,h|g,y)}function DB(f,y){return y==null||J_(f,y,Tn(y))}function Mi(f,y){return f===y||f!==f&&y!==y}var FB=Oh(pp),BB=Oh(function(f,y){return f>=y}),uo=iS(function(){return arguments}())?iS:function(f){return Je(f)&&ge.call(f,"callee")&&!G_.call(f,"callee")},$t=Z.isArray,zB=M_?Ar(M_):U9;function fr(f){return f!=null&&Bh(f.length)&&!wa(f)}function rn(f){return Je(f)&&fr(f)}function $B(f){return f===!0||f===!1||Je(f)&&er(f)==zt}var us=t9||tv,jB=k_?Ar(k_):Y9;function qB(f){return Je(f)&&f.nodeType===1&&!Mu(f)}function WB(f){if(f==null)return!0;if(fr(f)&&($t(f)||typeof f=="string"||typeof f.splice=="function"||us(f)||dl(f)||uo(f)))return!f.length;var y=Un(f);if(y==yn||y==bn)return!f.size;if(_u(f))return!yp(f).length;for(var E in f)if(ge.call(f,E))return!1;return!0}function GB(f,y){return wu(f,y)}function VB(f,y,E){E=typeof E=="function"?E:e;var O=E?E(f,y):e;return O===e?wu(f,y,e,E):!!O}function Gp(f){if(!Je(f))return!1;var y=er(f);return y==Ge||y==Te||typeof f.message=="string"&&typeof f.name=="string"&&!Mu(f)}function HB(f){return typeof f=="number"&&H_(f)}function wa(f){if(!He(f))return!1;var y=er(f);return y==Ve||y==In||y==wt||y==Tr}function d3(f){return typeof f=="number"&&f==Yt(f)}function Bh(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=F}function He(f){var y=typeof f;return f!=null&&(y=="object"||y=="function")}function Je(f){return f!=null&&typeof f=="object"}var f3=C_?Ar(C_):K9;function UB(f,y){return f===y||mp(f,y,Lp(y))}function YB(f,y,E){return E=typeof E=="function"?E:e,mp(f,y,Lp(y),E)}function XB(f){return g3(f)&&f!=+f}function KB(f){if(R7(f))throw new Dt(a);return aS(f)}function ZB(f){return f===null}function JB(f){return f==null}function g3(f){return typeof f=="number"||Je(f)&&er(f)==te}function Mu(f){if(!Je(f)||er(f)!=Gt)return!1;var y=hh(f);if(y===null)return!0;var E=ge.call(y,"constructor")&&y.constructor;return typeof E=="function"&&E instanceof E&&oh.call(E)==Y8}var Vp=T_?Ar(T_):Z9;function QB(f){return d3(f)&&f>=-9007199254740991&&f<=F}var p3=O_?Ar(O_):J9;function zh(f){return typeof f=="string"||!$t(f)&&Je(f)&&er(f)==Dn}function Nr(f){return typeof f=="symbol"||Je(f)&&er(f)==$e}var dl=A_?Ar(A_):Q9;function tz(f){return f===e}function ez(f){return Je(f)&&Un(f)==Cn}function nz(f){return Je(f)&&er(f)==xi}var rz=Oh(bp),iz=Oh(function(f,y){return f<=y});function v3(f){if(!f)return[];if(fr(f))return zh(f)?_i(f):dr(f);if(du&&f[du])return D8(f[du]());var y=Un(f),E=y==yn?sp:y==bn?ih:fl;return E(f)}function xa(f){if(!f)return f===0?f:0;if(f=ii(f),f===B||f===-1/0){var y=f<0?-1:1;return y*V}return f===f?f:0}function Yt(f){var y=xa(f),E=y%1;return y===y?E?y-E:y:0}function m3(f){return f?ao(Yt(f),0,K):0}function ii(f){if(typeof f=="number")return f;if(Nr(f))return X;if(He(f)){var y=typeof f.valueOf=="function"?f.valueOf():f;f=He(y)?y+"":y}if(typeof f!="string")return f===0?f:+f;f=D_(f);var E=z4.test(f);return E||j4.test(f)?b8(f.slice(2),E?2:8):B4.test(f)?X:+f}function y3(f){return Vi(f,gr(f))}function az(f){return f?ao(Yt(f),-9007199254740991,F):f===0?f:0}function fe(f){return f==null?"":Pr(f)}var sz=ul(function(f,y){if(_u(y)||fr(y)){Vi(y,Tn(y),f);return}for(var E in y)ge.call(y,E)&&mu(f,E,y[E])}),b3=ul(function(f,y){Vi(y,gr(y),f)}),$h=ul(function(f,y,E,O){Vi(y,gr(y),f,O)}),oz=ul(function(f,y,E,O){Vi(y,Tn(y),f,O)}),lz=ya(dp);function uz(f,y){var E=ll(f);return y==null?E:Z_(E,y)}var cz=Zt(function(f,y){f=Ee(f);var E=-1,O=y.length,N=O>2?y[2]:e;for(N&&nr(y[0],y[1],N)&&(O=1);++E<O;)for(var D=y[E],W=gr(D),G=-1,Y=W.length;++G<Y;){var rt=W[G],it=f[rt];(it===e||Mi(it,al[rt])&&!ge.call(f,rt))&&(f[rt]=D[rt])}return f}),hz=Zt(function(f){return f.push(e,DS),Or(w3,e,f)});function dz(f,y){return N_(f,Ct(y,3),Gi)}function fz(f,y){return N_(f,Ct(y,3),gp)}function gz(f,y){return f==null?f:fp(f,Ct(y,3),gr)}function pz(f,y){return f==null?f:nS(f,Ct(y,3),gr)}function vz(f,y){return f&&Gi(f,Ct(y,3))}function mz(f,y){return f&&gp(f,Ct(y,3))}function yz(f){return f==null?[]:xh(f,Tn(f))}function bz(f){return f==null?[]:xh(f,gr(f))}function Hp(f,y,E){var O=f==null?e:so(f,y);return O===e?E:O}function wz(f,y){return f!=null&&zS(f,y,W9)}function Up(f,y){return f!=null&&zS(f,y,G9)}var xz=PS(function(f,y,E){y!=null&&typeof y.toString!="function"&&(y=lh.call(y)),f[y]=E},Xp(pr)),Ez=PS(function(f,y,E){y!=null&&typeof y.toString!="function"&&(y=lh.call(y)),ge.call(f,y)?f[y].push(E):f[y]=[E]},Ct),_z=Zt(bu);function Tn(f){return fr(f)?X_(f):yp(f)}function gr(f){return fr(f)?X_(f,!0):t7(f)}function Sz(f,y){var E={};return y=Ct(y,3),Gi(f,function(O,N,D){va(E,y(O,N,D),O)}),E}function Mz(f,y){var E={};return y=Ct(y,3),Gi(f,function(O,N,D){va(E,N,y(O,N,D))}),E}var kz=ul(function(f,y,E){Eh(f,y,E)}),w3=ul(function(f,y,E,O){Eh(f,y,E,O)}),Cz=ya(function(f,y){var E={};if(f==null)return E;var O=!1;y=je(y,function(D){return D=os(D,f),O||(O=D.length>1),D}),Vi(f,Np(f),E),O&&(E=ei(E,h|d|g,x7));for(var N=y.length;N--;)Sp(E,y[N]);return E});function Tz(f,y){return x3(f,Fh(Ct(y)))}var Oz=ya(function(f,y){return f==null?{}:n7(f,y)});function x3(f,y){if(f==null)return{};var E=je(Np(f),function(O){return[O]});return y=Ct(y),dS(f,E,function(O,N){return y(O,N[0])})}function Az(f,y,E){y=os(y,f);var O=-1,N=y.length;for(N||(N=1,f=e);++O<N;){var D=f==null?e:f[Hi(y[O])];D===e&&(O=N,D=E),f=wa(D)?D.call(f):D}return f}function Pz(f,y,E){return f==null?f:xu(f,y,E)}function Nz(f,y,E,O){return O=typeof O=="function"?O:e,f==null?f:xu(f,y,E,O)}var E3=LS(Tn),_3=LS(gr);function Rz(f,y,E){var O=$t(f),N=O||us(f)||dl(f);if(y=Ct(y,4),E==null){var D=f&&f.constructor;N?E=O?new D:[]:He(f)?E=wa(D)?ll(hh(f)):{}:E={}}return(N?Jr:Gi)(f,function(W,G,Y){return y(E,W,G,Y)}),E}function Lz(f,y){return f==null?!0:Sp(f,y)}function Iz(f,y,E){return f==null?f:mS(f,y,Cp(E))}function Dz(f,y,E,O){return O=typeof O=="function"?O:e,f==null?f:mS(f,y,Cp(E),O)}function fl(f){return f==null?[]:ap(f,Tn(f))}function Fz(f){return f==null?[]:ap(f,gr(f))}function Bz(f,y,E){return E===e&&(E=y,y=e),E!==e&&(E=ii(E),E=E===E?E:0),y!==e&&(y=ii(y),y=y===y?y:0),ao(ii(f),y,E)}function zz(f,y,E){return y=xa(y),E===e?(E=y,y=0):E=xa(E),f=ii(f),V9(f,y,E)}function $z(f,y,E){if(E&&typeof E!="boolean"&&nr(f,y,E)&&(y=E=e),E===e&&(typeof y=="boolean"?(E=y,y=e):typeof f=="boolean"&&(E=f,f=e)),f===e&&y===e?(f=0,y=1):(f=xa(f),y===e?(y=f,f=0):y=xa(y)),f>y){var O=f;f=y,y=O}if(E||f%1||y%1){var N=U_();return Hn(f+N*(y-f+y8("1e-"+((N+"").length-1))),y)}return xp(f,y)}var jz=cl(function(f,y,E){return y=y.toLowerCase(),f+(E?S3(y):y)});function S3(f){return Yp(fe(f).toLowerCase())}function M3(f){return f=fe(f),f&&f.replace(W4,P8).replace(l8,"")}function qz(f,y,E){f=fe(f),y=Pr(y);var O=f.length;E=E===e?O:ao(Yt(E),0,O);var N=E;return E-=y.length,E>=0&&f.slice(E,N)==y}function Wz(f){return f=fe(f),f&&_4.test(f)?f.replace(n_,N8):f}function Gz(f){return f=fe(f),f&&O4.test(f)?f.replace(Wg,"\\$&"):f}var Vz=cl(function(f,y,E){return f+(E?"-":"")+y.toLowerCase()}),Hz=cl(function(f,y,E){return f+(E?" ":"")+y.toLowerCase()}),Uz=TS("toLowerCase");function Yz(f,y,E){f=fe(f),y=Yt(y);var O=y?rl(f):0;if(!y||O>=y)return f;var N=(y-O)/2;return Th(ph(N),E)+f+Th(gh(N),E)}function Xz(f,y,E){f=fe(f),y=Yt(y);var O=y?rl(f):0;return y&&O<y?f+Th(y-O,E):f}function Kz(f,y,E){f=fe(f),y=Yt(y);var O=y?rl(f):0;return y&&O<y?Th(y-O,E)+f:f}function Zz(f,y,E){return E||y==null?y=0:y&&(y=+y),i9(fe(f).replace(Gg,""),y||0)}function Jz(f,y,E){return(E?nr(f,y,E):y===e)?y=1:y=Yt(y),Ep(fe(f),y)}function Qz(){var f=arguments,y=fe(f[0]);return f.length<3?y:y.replace(f[1],f[2])}var t$=cl(function(f,y,E){return f+(E?"_":"")+y.toLowerCase()});function e$(f,y,E){return E&&typeof E!="number"&&nr(f,y,E)&&(y=E=e),E=E===e?K:E>>>0,E?(f=fe(f),f&&(typeof y=="string"||y!=null&&!Vp(y))&&(y=Pr(y),!y&&nl(f))?ls(_i(f),0,E):f.split(y,E)):[]}var n$=cl(function(f,y,E){return f+(E?" ":"")+Yp(y)});function r$(f,y,E){return f=fe(f),E=E==null?0:ao(Yt(E),0,f.length),y=Pr(y),f.slice(E,E+y.length)==y}function i$(f,y,E){var O=I.templateSettings;E&&nr(f,y,E)&&(y=e),f=fe(f),y=$h({},y,O,IS);var N=$h({},y.imports,O.imports,IS),D=Tn(N),W=ap(N,D),G,Y,rt=0,it=y.interpolate||Qc,ut="__p += '",xt=op((y.escape||Qc).source+"|"+it.source+"|"+(it===r_?F4:Qc).source+"|"+(y.evaluate||Qc).source+"|$","g"),Mt="//# sourceURL="+(ge.call(y,"sourceURL")?(y.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++f8+"]")+`
- `;f.replace(xt,function(Ot,ee,ie,Rr,rr,Lr){return ie||(ie=Rr),ut+=f.slice(rt,Lr).replace(G4,R8),ee&&(G=!0,ut+=`' +
- __e(`+ee+`) +
- '`),rr&&(Y=!0,ut+=`';
- `+rr+`;
- __p += '`),ie&&(ut+=`' +
- ((__t = (`+ie+`)) == null ? '' : __t) +
- '`),rt=Lr+Ot.length,Ot}),ut+=`';
- `;var Tt=ge.call(y,"variable")&&y.variable;if(!Tt)ut=`with (obj) {
- `+ut+`
- }
- `;else if(I4.test(Tt))throw new Dt(o);ut=(Y?ut.replace(b4,""):ut).replace(w4,"$1").replace(x4,"$1;"),ut="function("+(Tt||"obj")+`) {
- `+(Tt?"":`obj || (obj = {});
- `)+"var __t, __p = ''"+(G?", __e = _.escape":"")+(Y?`, __j = Array.prototype.join;
- function print() { __p += __j.call(arguments, '') }
- `:`;
- `)+ut+`return __p
- }`;var Kt=C3(function(){return ce(D,Mt+"return "+ut).apply(e,W)});if(Kt.source=ut,Gp(Kt))throw Kt;return Kt}function a$(f){return fe(f).toLowerCase()}function s$(f){return fe(f).toUpperCase()}function o$(f,y,E){if(f=fe(f),f&&(E||y===e))return D_(f);if(!f||!(y=Pr(y)))return f;var O=_i(f),N=_i(y),D=F_(O,N),W=B_(O,N)+1;return ls(O,D,W).join("")}function l$(f,y,E){if(f=fe(f),f&&(E||y===e))return f.slice(0,$_(f)+1);if(!f||!(y=Pr(y)))return f;var O=_i(f),N=B_(O,_i(y))+1;return ls(O,0,N).join("")}function u$(f,y,E){if(f=fe(f),f&&(E||y===e))return f.replace(Gg,"");if(!f||!(y=Pr(y)))return f;var O=_i(f),N=F_(O,_i(y));return ls(O,N).join("")}function c$(f,y){var E=T,O=A;if(He(y)){var N="separator"in y?y.separator:N;E="length"in y?Yt(y.length):E,O="omission"in y?Pr(y.omission):O}f=fe(f);var D=f.length;if(nl(f)){var W=_i(f);D=W.length}if(E>=D)return f;var G=E-rl(O);if(G<1)return O;var Y=W?ls(W,0,G).join(""):f.slice(0,G);if(N===e)return Y+O;if(W&&(G+=Y.length-G),Vp(N)){if(f.slice(G).search(N)){var rt,it=Y;for(N.global||(N=op(N.source,fe(i_.exec(N))+"g")),N.lastIndex=0;rt=N.exec(it);)var ut=rt.index;Y=Y.slice(0,ut===e?G:ut)}}else if(f.indexOf(Pr(N),G)!=G){var xt=Y.lastIndexOf(N);xt>-1&&(Y=Y.slice(0,xt))}return Y+O}function h$(f){return f=fe(f),f&&E4.test(f)?f.replace(e_,$8):f}var d$=cl(function(f,y,E){return f+(E?" ":"")+y.toUpperCase()}),Yp=TS("toUpperCase");function k3(f,y,E){return f=fe(f),y=E?e:y,y===e?I8(f)?W8(f):k8(f):f.match(y)||[]}var C3=Zt(function(f,y){try{return Or(f,e,y)}catch(E){return Gp(E)?E:new Dt(E)}}),f$=ya(function(f,y){return Jr(y,function(E){E=Hi(E),va(f,E,qp(f[E],f))}),f});function g$(f){var y=f==null?0:f.length,E=Ct();return f=y?je(f,function(O){if(typeof O[1]!="function")throw new Qr(s);return[E(O[0]),O[1]]}):[],Zt(function(O){for(var N=-1;++N<y;){var D=f[N];if(Or(D[0],this,O))return Or(D[1],this,O)}})}function p$(f){return $9(ei(f,h))}function Xp(f){return function(){return f}}function v$(f,y){return f==null||f!==f?y:f}var m$=AS(),y$=AS(!0);function pr(f){return f}function Kp(f){return sS(typeof f=="function"?f:ei(f,h))}function b$(f){return lS(ei(f,h))}function w$(f,y){return uS(f,ei(y,h))}var x$=Zt(function(f,y){return function(E){return bu(E,f,y)}}),E$=Zt(function(f,y){return function(E){return bu(f,E,y)}});function Zp(f,y,E){var O=Tn(y),N=xh(y,O);E==null&&!(He(y)&&(N.length||!O.length))&&(E=y,y=f,f=this,N=xh(y,Tn(y)));var D=!(He(E)&&"chain"in E)||!!E.chain,W=wa(f);return Jr(N,function(G){var Y=y[G];f[G]=Y,W&&(f.prototype[G]=function(){var rt=this.__chain__;if(D||rt){var it=f(this.__wrapped__),ut=it.__actions__=dr(this.__actions__);return ut.push({func:Y,args:arguments,thisArg:f}),it.__chain__=rt,it}return Y.apply(f,ns([this.value()],arguments))})}),f}function _$(){return Fn._===this&&(Fn._=X8),this}function Jp(){}function S$(f){return f=Yt(f),Zt(function(y){return cS(y,f)})}var M$=Op(je),k$=Op(P_),C$=Op(tp);function T3(f){return Dp(f)?ep(Hi(f)):r7(f)}function T$(f){return function(y){return f==null?e:so(f,y)}}var O$=NS(),A$=NS(!0);function Qp(){return[]}function tv(){return!1}function P$(){return{}}function N$(){return""}function R$(){return!0}function L$(f,y){if(f=Yt(f),f<1||f>F)return[];var E=K,O=Hn(f,K);y=Ct(y),f-=K;for(var N=ip(O,y);++E<f;)y(E);return N}function I$(f){return $t(f)?je(f,Hi):Nr(f)?[f]:dr(YS(fe(f)))}function D$(f){var y=++U8;return fe(f)+y}var F$=Ch(function(f,y){return f+y},0),B$=Ap("ceil"),z$=Ch(function(f,y){return f/y},1),$$=Ap("floor");function j$(f){return f&&f.length?wh(f,pr,pp):e}function q$(f,y){return f&&f.length?wh(f,Ct(y,2),pp):e}function W$(f){return L_(f,pr)}function G$(f,y){return L_(f,Ct(y,2))}function V$(f){return f&&f.length?wh(f,pr,bp):e}function H$(f,y){return f&&f.length?wh(f,Ct(y,2),bp):e}var U$=Ch(function(f,y){return f*y},1),Y$=Ap("round"),X$=Ch(function(f,y){return f-y},0);function K$(f){return f&&f.length?rp(f,pr):0}function Z$(f,y){return f&&f.length?rp(f,Ct(y,2)):0}return I.after=bB,I.ary=a3,I.assign=sz,I.assignIn=b3,I.assignInWith=$h,I.assignWith=oz,I.at=lz,I.before=s3,I.bind=qp,I.bindAll=f$,I.bindKey=o3,I.castArray=PB,I.chain=n3,I.chunk=$7,I.compact=j7,I.concat=q7,I.cond=g$,I.conforms=p$,I.constant=Xp,I.countBy=KF,I.create=uz,I.curry=l3,I.curryRight=u3,I.debounce=c3,I.defaults=cz,I.defaultsDeep=hz,I.defer=wB,I.delay=xB,I.difference=W7,I.differenceBy=G7,I.differenceWith=V7,I.drop=H7,I.dropRight=U7,I.dropRightWhile=Y7,I.dropWhile=X7,I.fill=K7,I.filter=JF,I.flatMap=eB,I.flatMapDeep=nB,I.flatMapDepth=rB,I.flatten=JS,I.flattenDeep=Z7,I.flattenDepth=J7,I.flip=EB,I.flow=m$,I.flowRight=y$,I.fromPairs=Q7,I.functions=yz,I.functionsIn=bz,I.groupBy=iB,I.initial=eF,I.intersection=nF,I.intersectionBy=rF,I.intersectionWith=iF,I.invert=xz,I.invertBy=Ez,I.invokeMap=sB,I.iteratee=Kp,I.keyBy=oB,I.keys=Tn,I.keysIn=gr,I.map=Lh,I.mapKeys=Sz,I.mapValues=Mz,I.matches=b$,I.matchesProperty=w$,I.memoize=Dh,I.merge=kz,I.mergeWith=w3,I.method=x$,I.methodOf=E$,I.mixin=Zp,I.negate=Fh,I.nthArg=S$,I.omit=Cz,I.omitBy=Tz,I.once=_B,I.orderBy=lB,I.over=M$,I.overArgs=SB,I.overEvery=k$,I.overSome=C$,I.partial=Wp,I.partialRight=h3,I.partition=uB,I.pick=Oz,I.pickBy=x3,I.property=T3,I.propertyOf=T$,I.pull=lF,I.pullAll=t3,I.pullAllBy=uF,I.pullAllWith=cF,I.pullAt=hF,I.range=O$,I.rangeRight=A$,I.rearg=MB,I.reject=dB,I.remove=dF,I.rest=kB,I.reverse=$p,I.sampleSize=gB,I.set=Pz,I.setWith=Nz,I.shuffle=pB,I.slice=fF,I.sortBy=yB,I.sortedUniq=wF,I.sortedUniqBy=xF,I.split=e$,I.spread=CB,I.tail=EF,I.take=_F,I.takeRight=SF,I.takeRightWhile=MF,I.takeWhile=kF,I.tap=jF,I.throttle=TB,I.thru=Rh,I.toArray=v3,I.toPairs=E3,I.toPairsIn=_3,I.toPath=I$,I.toPlainObject=y3,I.transform=Rz,I.unary=OB,I.union=CF,I.unionBy=TF,I.unionWith=OF,I.uniq=AF,I.uniqBy=PF,I.uniqWith=NF,I.unset=Lz,I.unzip=jp,I.unzipWith=e3,I.update=Iz,I.updateWith=Dz,I.values=fl,I.valuesIn=Fz,I.without=RF,I.words=k3,I.wrap=AB,I.xor=LF,I.xorBy=IF,I.xorWith=DF,I.zip=FF,I.zipObject=BF,I.zipObjectDeep=zF,I.zipWith=$F,I.entries=E3,I.entriesIn=_3,I.extend=b3,I.extendWith=$h,Zp(I,I),I.add=F$,I.attempt=C3,I.camelCase=jz,I.capitalize=S3,I.ceil=B$,I.clamp=Bz,I.clone=NB,I.cloneDeep=LB,I.cloneDeepWith=IB,I.cloneWith=RB,I.conformsTo=DB,I.deburr=M3,I.defaultTo=v$,I.divide=z$,I.endsWith=qz,I.eq=Mi,I.escape=Wz,I.escapeRegExp=Gz,I.every=ZF,I.find=QF,I.findIndex=KS,I.findKey=dz,I.findLast=tB,I.findLastIndex=ZS,I.findLastKey=fz,I.floor=$$,I.forEach=r3,I.forEachRight=i3,I.forIn=gz,I.forInRight=pz,I.forOwn=vz,I.forOwnRight=mz,I.get=Hp,I.gt=FB,I.gte=BB,I.has=wz,I.hasIn=Up,I.head=QS,I.identity=pr,I.includes=aB,I.indexOf=tF,I.inRange=zz,I.invoke=_z,I.isArguments=uo,I.isArray=$t,I.isArrayBuffer=zB,I.isArrayLike=fr,I.isArrayLikeObject=rn,I.isBoolean=$B,I.isBuffer=us,I.isDate=jB,I.isElement=qB,I.isEmpty=WB,I.isEqual=GB,I.isEqualWith=VB,I.isError=Gp,I.isFinite=HB,I.isFunction=wa,I.isInteger=d3,I.isLength=Bh,I.isMap=f3,I.isMatch=UB,I.isMatchWith=YB,I.isNaN=XB,I.isNative=KB,I.isNil=JB,I.isNull=ZB,I.isNumber=g3,I.isObject=He,I.isObjectLike=Je,I.isPlainObject=Mu,I.isRegExp=Vp,I.isSafeInteger=QB,I.isSet=p3,I.isString=zh,I.isSymbol=Nr,I.isTypedArray=dl,I.isUndefined=tz,I.isWeakMap=ez,I.isWeakSet=nz,I.join=aF,I.kebabCase=Vz,I.last=ri,I.lastIndexOf=sF,I.lowerCase=Hz,I.lowerFirst=Uz,I.lt=rz,I.lte=iz,I.max=j$,I.maxBy=q$,I.mean=W$,I.meanBy=G$,I.min=V$,I.minBy=H$,I.stubArray=Qp,I.stubFalse=tv,I.stubObject=P$,I.stubString=N$,I.stubTrue=R$,I.multiply=U$,I.nth=oF,I.noConflict=_$,I.noop=Jp,I.now=Ih,I.pad=Yz,I.padEnd=Xz,I.padStart=Kz,I.parseInt=Zz,I.random=$z,I.reduce=cB,I.reduceRight=hB,I.repeat=Jz,I.replace=Qz,I.result=Az,I.round=Y$,I.runInContext=U,I.sample=fB,I.size=vB,I.snakeCase=t$,I.some=mB,I.sortedIndex=gF,I.sortedIndexBy=pF,I.sortedIndexOf=vF,I.sortedLastIndex=mF,I.sortedLastIndexBy=yF,I.sortedLastIndexOf=bF,I.startCase=n$,I.startsWith=r$,I.subtract=X$,I.sum=K$,I.sumBy=Z$,I.template=i$,I.times=L$,I.toFinite=xa,I.toInteger=Yt,I.toLength=m3,I.toLower=a$,I.toNumber=ii,I.toSafeInteger=az,I.toString=fe,I.toUpper=s$,I.trim=o$,I.trimEnd=l$,I.trimStart=u$,I.truncate=c$,I.unescape=h$,I.uniqueId=D$,I.upperCase=d$,I.upperFirst=Yp,I.each=r3,I.eachRight=i3,I.first=QS,Zp(I,function(){var f={};return Gi(I,function(y,E){ge.call(I.prototype,E)||(f[E]=y)}),f}(),{chain:!1}),I.VERSION=n,Jr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){I[f].placeholder=I}),Jr(["drop","take"],function(f,y){re.prototype[f]=function(E){E=E===e?1:xn(Yt(E),0);var O=this.__filtered__&&!y?new re(this):this.clone();return O.__filtered__?O.__takeCount__=Hn(E,O.__takeCount__):O.__views__.push({size:Hn(E,K),type:f+(O.__dir__<0?"Right":"")}),O},re.prototype[f+"Right"]=function(E){return this.reverse()[f](E).reverse()}}),Jr(["filter","map","takeWhile"],function(f,y){var E=y+1,O=E==$||E==j;re.prototype[f]=function(N){var D=this.clone();return D.__iteratees__.push({iteratee:Ct(N,3),type:E}),D.__filtered__=D.__filtered__||O,D}}),Jr(["head","last"],function(f,y){var E="take"+(y?"Right":"");re.prototype[f]=function(){return this[E](1).value()[0]}}),Jr(["initial","tail"],function(f,y){var E="drop"+(y?"":"Right");re.prototype[f]=function(){return this.__filtered__?new re(this):this[E](1)}}),re.prototype.compact=function(){return this.filter(pr)},re.prototype.find=function(f){return this.filter(f).head()},re.prototype.findLast=function(f){return this.reverse().find(f)},re.prototype.invokeMap=Zt(function(f,y){return typeof f=="function"?new re(this):this.map(function(E){return bu(E,f,y)})}),re.prototype.reject=function(f){return this.filter(Fh(Ct(f)))},re.prototype.slice=function(f,y){f=Yt(f);var E=this;return E.__filtered__&&(f>0||y<0)?new re(E):(f<0?E=E.takeRight(-f):f&&(E=E.drop(f)),y!==e&&(y=Yt(y),E=y<0?E.dropRight(-y):E.take(y-f)),E)},re.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},re.prototype.toArray=function(){return this.take(K)},Gi(re.prototype,function(f,y){var E=/^(?:filter|find|map|reject)|While$/.test(y),O=/^(?:head|last)$/.test(y),N=I[O?"take"+(y=="last"?"Right":""):y],D=O||/^find/.test(y);N&&(I.prototype[y]=function(){var W=this.__wrapped__,G=O?[1]:arguments,Y=W instanceof re,rt=G[0],it=Y||$t(W),ut=function(ee){var ie=N.apply(I,ns([ee],G));return O&&xt?ie[0]:ie};it&&E&&typeof rt=="function"&&rt.length!=1&&(Y=it=!1);var xt=this.__chain__,Mt=!!this.__actions__.length,Tt=D&&!xt,Kt=Y&&!Mt;if(!D&&it){W=Kt?W:new re(this);var Ot=f.apply(W,G);return Ot.__actions__.push({func:Rh,args:[ut],thisArg:e}),new ti(Ot,xt)}return Tt&&Kt?f.apply(this,G):(Ot=this.thru(ut),Tt?O?Ot.value()[0]:Ot.value():Ot)})}),Jr(["pop","push","shift","sort","splice","unshift"],function(f){var y=ah[f],E=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",O=/^(?:pop|shift)$/.test(f);I.prototype[f]=function(){var N=arguments;if(O&&!this.__chain__){var D=this.value();return y.apply($t(D)?D:[],N)}return this[E](function(W){return y.apply($t(W)?W:[],N)})}}),Gi(re.prototype,function(f,y){var E=I[y];if(E){var O=E.name+"";ge.call(ol,O)||(ol[O]=[]),ol[O].push({name:y,func:E})}}),ol[kh(e,b).name]=[{name:"wrapper",func:e}],re.prototype.clone=h9,re.prototype.reverse=d9,re.prototype.value=f9,I.prototype.at=qF,I.prototype.chain=WF,I.prototype.commit=GF,I.prototype.next=VF,I.prototype.plant=UF,I.prototype.reverse=YF,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=XF,I.prototype.first=I.prototype.head,du&&(I.prototype[du]=HF),I},il=G8();eo?((eo.exports=il)._=il,Kg._=il):Fn._=il}).call(Ca)})(Jf,Jf.exports);var kl=Jf.exports;const zpt={class:"ai-search-container"},$pt={key:0,class:"search-results"},jpt={__name:"index",setup(r){const{t}=wR(),e=ue(""),n=ue(!1),i=ue(!1),a=ue(1e3),s=ue(t("ai_search.mindmap_title")),o=ue(!1),l=ue(!0),u=ue([]),c=Ps({page:1,page_size:10}),h=ue(!1),d=ue([]),g=ue([]),p=ue(""),v=Ps({doc_id:"",doc_name:"",drawer_url:"",image_url:"",positions:[]});n0(async()=>{try{const{data:{rows:nt}}=await Ij();d.value=nt,g.value=nt.map(ot=>ot.id)}catch(nt){console.error(nt)}});const{send:b,answer:w,done:x}=Fpt(),{chunks_data:S,testChunk:_}=Ipt(),{fetchRelatedQuestions:k,data:M}=Dpt(),{data:C,loading:P,fetchMindmap:T}=Bpt(),{getFileUrl:A}=y4(),R=async nt=>{const ot=kl.trim(nt);kl.isEmpty(ot)||(S.value={documents:[],chunks:[]},u.value=[],M.value=[],l.value=!1,o.value=!0,b({kb_ids:g.value,question:ot}),_({kb_id:g.value,highlight:!0,question:ot,page:1,size:c.page_size}),await k(ot))},L=nt=>{o.value||(e.value=nt,R(nt))},$=async(nt,ot=1,ct=10)=>{const ht=kl.trim(e.value);o.value||kl.isEmpty(ht)||(h.value=!0,await _({kb_id:g.value,highlight:!0,question:ht,doc_ids:nt??u.value,page:ot,size:ct}),h.value=!1)};uf(x,nt=>{nt&&(o.value=!1)});const q=nt=>{const{doc_id:ot,docnm_kwd:ct,image_id:ht,positions:pt}=nt;s.value=ct,i.value=!0;const wt=ct.split(".").pop().toLowerCase();switch(v.doc_id=ot,v.doc_name=ct,v.drawer_url=A(ot,wt),v.image_url=A(ht,"image"),v.positions=pt,wt){case"pdf":p.value="pdf";break;case"doc":case"docx":p.value="doc";break}},j=()=>{s.value=t("ai_search.mindmap_title"),p.value="mindmap",i.value=!0,T({question:e.value,kb_ids:g.value})},B=nt=>{g.value=nt},F=nt=>{const ot=kl.trim(nt);if(kl.isEmpty(ot)){a0.warning(t("ai_search.enter_search_content"));return}R(ot),n.value=!0},V=nt=>{F(nt.target.value)},X=nt=>{c.page=nt,$(u.value,nt,c.page_size)},K=nt=>{c.page_size=nt,$(u.value,c.page,nt)};return(nt,ot)=>{const ct=lj,ht=gR,pt=oj,wt=t0,zt=sj,Wt=xR,Te=aj;return Pt(),Xe(jl,null,[Pe("div",zpt,[le(_q,{model_list:d.value,onUpdateCheckedList:B},null,8,["model_list"]),Pe("div",{class:Sr(["content-box",{"search-active":n.value}])},[le(ct,{class:"input-search",modelValue:e.value,"onUpdate:modelValue":ot[0]||(ot[0]=Ge=>e.value=Ge),placeholder:nt.$t("ai_search.placeholder"),"search-button":"",loading:o.value,onPressEnter:V,onSearch:F},null,8,["modelValue","placeholder","loading"]),le(vj,{name:"fade"},{default:he(()=>{var Ge,Ve;return[n.value?(Pt(),Xe("div",$pt,[le(Pq,{content:(Ge=Ki(w))==null?void 0:Ge.answer},null,8,["content"]),le(ht),le(Cq,{documents:Ki(S).documents,selected_document_ids:u.value,onOnFilesSelected:$},null,8,["documents","selected_document_ids"]),le(ht),le(kpt,{chunks:Ki(S).chunks,total:Ki(S).total,highlight_word:e.value,loading:h.value,onClickDocumentButton:q,onPageChange:X,onPageSizeChange:K},null,8,["chunks","total","highlight_word","loading"]),le(ht),((Ve=Ki(M))==null?void 0:Ve.length)>0?(Pt(),Be(zt,{key:0,title:nt.$t("ai_search.related_questions")},{default:he(()=>[le(wt,{wrap:""},{default:he(()=>[(Pt(!0),Xe(jl,null,e0(Ki(M),(In,yn)=>(Pt(),Be(pt,{key:yn,onClick:te=>L(In),class:"related-question-tag"},{default:he(()=>[mR(Il(In),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["title"])):gi("",!0),le(ht),le(Wt,{class:"floating-btn",shape:"circle",onClick:j},{default:he(()=>[le(Ki(jj),{size:"32"})]),_:1})])):gi("",!0)]}),_:1})],2)]),le(Te,{visible:i.value,"onUpdate:visible":ot[1]||(ot[1]=Ge=>i.value=Ge),title:s.value,width:a.value,footer:!1},{default:he(()=>[p.value==="mindmap"?(Pt(),Be(ept,{key:0,loading:Ki(P),data:Ki(C)},null,8,["loading","data"])):gi("",!0),p.value==="pdf"?(Pt(),Be(rj,{key:1,url:v.drawer_url,doc_width:a.value-20,positions:v.positions,'"':""},null,8,["url","doc_width","positions"])):gi("",!0),p.value==="doc"?(Pt(),Be(ij,{key:2,url:v.drawer_url,doc_width:a.value-20},null,8,["url","doc_width"])):gi("",!0)]),_:1},8,["visible","title","width"])],64)}}},qpt=Vs(jpt,[["__scopeId","data-v-5cddb34b"]]),Lvt={__name:"AISearch",setup(r){return(t,e)=>(Pt(),Be(tj,null,{default:he(()=>[le(ej,null,{default:he(()=>[le(qpt)]),_:1})]),_:1}))}};export{Lvt as default};
|