@decocms/mesh 1.0.0-alpha.31 → 1.0.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{alert-dialog-lT7fjsnS.js → alert-dialog-Bj3sxji2.js} +1 -1
- package/dist/client/assets/{auth-B4DV4YJb.js → auth-bF2_ysdG.js} +1 -1
- package/dist/client/assets/{auth-catchall-BXXli3-E.js → auth-catchall-BRnZAoYY.js} +1 -1
- package/dist/client/assets/{avatar-DrbrX3Fb.js → avatar-B9zSDca0.js} +1 -1
- package/dist/client/assets/{badge-Sw-5Fjm_.js → badge-Ba7oj8pn.js} +1 -1
- package/dist/client/assets/{button-De8TtfIc.js → button-8a8UdvyR.js} +1 -1
- package/dist/client/assets/{card-Clgs1Ler.js → card-Cyeg7tCo.js} +1 -1
- package/dist/client/assets/{checkbox-BZTG8MjG.js → checkbox-DCjoNloy.js} +1 -1
- package/dist/client/assets/{circle-alert-Bo6PdNJA.js → circle-alert-DVLBfxyX.js} +1 -1
- package/dist/client/assets/{collection-detail-bCm7IhzQ.js → collection-detail-ieEvVULW.js} +1 -1
- package/dist/client/assets/{collection-display-button-CANVxM78.js → collection-display-button-CGcY64sw.js} +1 -1
- package/dist/client/assets/{collection-header-DWpT3ZvE.js → collection-header-B92Inaku.js} +1 -1
- package/dist/client/assets/{collection-page-BDYpmZx2.js → collection-page-BfXTrpEI.js} +1 -1
- package/dist/client/assets/{collection-search-7dvS8CPU.js → collection-search-C7G2QK3t.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DFImlrAn.js → collection-table-wrapper-DdGYlOCN.js} +1 -1
- package/dist/client/assets/{connection-card-Dgd2qOAx.js → connection-card-xMF7zskf.js} +1 -1
- package/dist/client/assets/{connection-detail-B5XIo4jJ.js → connection-detail-CKuTnq-B.js} +1 -1
- package/dist/client/assets/{connections-DgVq2Zi4.js → connections-Bm36z6Kn.js} +1 -1
- package/dist/client/assets/{core-6UZH86ZU.js → core-DHnxmqjc.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DpintAfW.js → create-organization-dialog-Cz9P_oQD.js} +1 -1
- package/dist/client/assets/{dialog-CcWkQ3-q.js → dialog-DOdwpjqP.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BMBTO1aI.js → dropdown-menu-BTTzlaf4.js} +1 -1
- package/dist/client/assets/{empty-state-WuOT2hFn.js → empty-state-CwiQR0XJ.js} +1 -1
- package/dist/client/assets/{error-boundary-Sj1-czrQ.js → error-boundary-8a3_at8W.js} +1 -1
- package/dist/client/assets/{extract-connection-data-q7cQAIMM.js → extract-connection-data-BpMaEsIX.js} +1 -1
- package/dist/client/assets/{form-CTTDgzck.js → form-DU90-O_I.js} +1 -1
- package/dist/client/assets/{gateway-detail-DrTM5RUx.js → gateway-detail-B2bI_bIU.js} +1 -1
- package/dist/client/assets/{gateways-C0TCQRt5.js → gateways-BxMjTmO6.js} +1 -1
- package/dist/client/assets/{home-Dy-_EeTf.js → home-CSzEs1Rf.js} +1 -1
- package/dist/client/assets/{icon-Dk9j-Z4d.js → icon-CzxeHWBl.js} +1 -1
- package/dist/client/assets/{index-GY3GXADp.js → index-Bgo9U3qs.js} +1 -1
- package/dist/client/assets/index-ChN7etWB.css +1 -0
- package/dist/client/assets/{index-Dss36SHE.js → index-DCY07ujJ.js} +1 -1
- package/dist/client/assets/{index-DIXLDBVl.js → index-HoRNE_Oj.js} +3 -3
- package/dist/client/assets/{index-BSuuYE7a.js → index-jKafgZHH.js} +1 -1
- package/dist/client/assets/{input-ByJBGfq3.js → input-GtBoan0u.js} +1 -1
- package/dist/client/assets/json-CFpQXyKn.js +1 -0
- package/dist/client/assets/{layout-DRBUzMK7.js → layout-DtdXVJv4.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-BZ3JTPPT.js → lazy-highlighter-BAj2Mxm0.js} +1 -1
- package/dist/client/assets/{localstorage-keys-CrXjwcSZ.js → localstorage-keys-DdRmNbGe.js} +1 -1
- package/dist/client/assets/{login-baVguqcM.js → login-DHkcl1CZ.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Chn8Vl6o.js → mcp-oauth-pvU53iS3.js} +1 -1
- package/dist/client/assets/{members-BL6-e_ID.js → members-CX-ziwX2.js} +1 -1
- package/dist/client/assets/{monitoring-DSGI33MK.js → monitoring-5rf2nLo0.js} +1 -1
- package/dist/client/assets/{oauth-callback-BxWJgxm-.js → oauth-callback-NjwvQ7fr.js} +1 -1
- package/dist/client/assets/{page-D0r-m9VX.js → page-DQXzmwPi.js} +1 -1
- package/dist/client/assets/{popover-C_H6Z3YS.js → popover-DdVvJgdl.js} +1 -1
- package/dist/client/assets/prism-light-CixH9adM.js +1 -0
- package/dist/client/assets/{resource-tabs-Dptn276z.js → resource-tabs-D-d1_s9d.js} +1 -1
- package/dist/client/assets/{schema-iWDGcZfv.js → schema-zp4LhQ6R.js} +1 -1
- package/dist/client/assets/{select-KKeuY_8A.js → select-gKhGAtmi.js} +1 -1
- package/dist/client/assets/{settings-DOQRUeGN.js → settings-DOjDcDAR.js} +1 -1
- package/dist/client/assets/{shell-layout-DxFvs5RE.js → shell-layout-BDhhfHrp.js} +44 -44
- package/dist/client/assets/{spinner-C5mTiECQ.js → spinner-Uc4IX4M6.js} +1 -1
- package/dist/client/assets/{store-BsHJOv3r.js → store-B09vXexU.js} +1 -1
- package/dist/client/assets/{store-app-detail-D8K1UJ66.js → store-app-detail-BqI8KTAM.js} +1 -1
- package/dist/client/assets/{switch-BN3gNP3v.js → switch-8wTpXb1-.js} +1 -1
- package/dist/client/assets/{textarea-DYrEFGVo.js → textarea-CTPqKmyI.js} +1 -1
- package/dist/client/assets/{tool-set-selector-BU0xXwDF.js → tool-set-selector-B9UyeKAH.js} +1 -1
- package/dist/client/assets/{tooltip-ZzCYSPeH.js → tooltip-ocFCU6ZE.js} +1 -1
- package/dist/client/assets/{types-DndJPAWa.js → types-CqJfCRYk.js} +3 -3
- package/dist/client/assets/{upload-CsXE0eHm.js → upload-CXce3aGG.js} +1 -1
- package/dist/client/assets/{use-binding-CIVQUW9t.js → use-binding-BPQhbEIl.js} +1 -1
- package/dist/client/assets/{use-connection-CgusccPZ.js → use-connection-DbdMBpCj.js} +1 -1
- package/dist/client/assets/{use-gateway-iwW9W997.js → use-gateway-DN4bQAAB.js} +1 -1
- package/dist/client/assets/{use-list-state-B2svGg01.js → use-list-state-DhZmck5D.js} +1 -1
- package/dist/client/assets/{use-mcp-ByPLvFZj.js → use-mcp-CQqxPDky.js} +1 -1
- package/dist/client/assets/{use-members-dzf6tzsH.js → use-members-C17JGpEk.js} +1 -1
- package/dist/client/assets/{use-mobile-BqnROvZt.js → use-mobile-BnwnARpl.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DYa2j-qu.js → use-organization-settings-CTBiXWgx.js} +1 -1
- package/dist/client/assets/{use-tool-call-CFjw03Kh.js → use-tool-call-BxgOuqkM.js} +1 -1
- package/dist/client/assets/useQuery-CeKP0W1d.js +1 -0
- package/dist/client/assets/utils-oBMoklwF.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-BMLzl8gY.css +0 -1
- package/dist/client/assets/json-B2EH3aa6.js +0 -1
- package/dist/client/assets/prism-light-CKU-zSUS.js +0 -1
- package/dist/client/assets/useQuery-B5H-PpIX.js +0 -1
- package/dist/client/assets/utils-Ny57I_y6.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,at as Wn,j as h,au as Tn,av as ec,aw as ue,ax as tc,ay as Or,az as nc,aA as oc,aB as rc,af as sc,c as se,aC as ic,a5 as ye,aD as Zn}from"./index-DIXLDBVl.js";import{b as tn,c as Te,I as He}from"./use-connection-CgusccPZ.js";import{C as ac}from"./collection-header-DWpT3ZvE.js";import{C as cc}from"./collection-page-BDYpmZx2.js";import{E as Ye}from"./error-boundary-Sj1-czrQ.js";import{u as je}from"./use-tool-call-CFjw03Kh.js";import{u as Se}from"./tooltip-ZzCYSPeH.js";import{B as jn}from"./button-De8TtfIc.js";import{I as An}from"./icon-Dk9j-Z4d.js";import{V as lc}from"./collection-display-button-CANVxM78.js";import{u as Rr}from"./use-gateway-iwW9W997.js";import{c as nn}from"./utils-Ny57I_y6.js";import{i as ze,a as ko,b as uc,c as Po,d as wn,e as bn,f as Hr,s as Vr,D as Kn,g as Br,h as dc,Z as Un,L as Qn,u as Fr,j as fc,k as hc,l as Dn,m as Gr,n as Jn,o as Xr,p as Yr,q as qr,r as gc,t as mc,v as pc,w as To,x as yc,y as Wr,z as Zr,R as xc,S as vc,A as wc,B as Kr,C as bc,E as _c,F as Sc,G as Nc,H as Ec,I as Cc,J as Ur,K as jo,M as Mc,N as Ic,O as ct,P as kc,Q as Pc,T as Tc,U as jc,V as Ac,W as Dc,X as $c,Y as Lc,_ as zc,$ as Ae,a0 as Oc,a1 as Rc,a2 as on}from"./types-DndJPAWa.js";import{B as Hc}from"./badge-Sw-5Fjm_.js";import"./dropdown-menu-BMBTO1aI.js";import"./index-Dss36SHE.js";function De(){const e=new Date,t=new Date;t.setHours(e.getHours()-24),t.setSeconds(0,0);const n=new Date(e);return n.setHours(n.getHours()+1),n.setSeconds(0,0),{startDate:t.toISOString(),endDate:n.toISOString()}}var Qr="Toggle",Jr=C.forwardRef((e,t)=>{const{pressed:n,defaultPressed:o,onPressedChange:r,...s}=e,[i,a]=Wn({prop:n,onChange:r,defaultProp:o??!1,caller:Qr});return h.jsx(Tn.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:ec(e.onClick,()=>{e.disabled||a(!i)})})});Jr.displayName=Qr;var $e="ToggleGroup",[es]=tc($e,[Or]),ts=Or(),eo=ue.forwardRef((e,t)=>{const{type:n,...o}=e;if(n==="single"){const r=o;return h.jsx(Vc,{...r,ref:t})}if(n==="multiple"){const r=o;return h.jsx(Bc,{...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${$e}\``)});eo.displayName=$e;var[ns,os]=es($e),Vc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??"",onChange:r,caller:$e});return h.jsx(ns,{scope:e.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:ue.useCallback(()=>a(""),[a]),children:h.jsx(rs,{...s,ref:t})})}),Bc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??[],onChange:r,caller:$e}),l=ue.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ue.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return h.jsx(ns,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:l,onItemDeactivate:c,children:h.jsx(rs,{...s,ref:t})})});eo.displayName=$e;var[Fc,Gc]=es($e),rs=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:s,dir:i,loop:a=!0,...l}=e,c=ts(n),u=oc(i),d={role:"group",dir:u,...l};return h.jsx(Fc,{scope:n,rovingFocus:r,disabled:o,children:r?h.jsx(rc,{asChild:!0,...c,orientation:s,dir:u,loop:a,children:h.jsx(Tn.div,{...d,ref:t})}):h.jsx(Tn.div,{...d,ref:t})})}),Gt="ToggleGroupItem",ss=ue.forwardRef((e,t)=>{const n=os(Gt,e.__scopeToggleGroup),o=Gc(Gt,e.__scopeToggleGroup),r=ts(e.__scopeToggleGroup),s=n.value.includes(e.value),i=o.disabled||e.disabled,a={...e,pressed:s,disabled:i},l=ue.useRef(null);return o.rovingFocus?h.jsx(nc,{asChild:!0,...r,focusable:!i,active:s,ref:l,children:h.jsx(Ao,{...a,ref:t})}):h.jsx(Ao,{...a,ref:t})});ss.displayName=Gt;var Ao=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,s=os(Gt,n),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?i:void 0;return h.jsx(Jr,{...a,...r,ref:t,onPressedChange:l=>{l?s.onItemActivate(o):s.onItemDeactivate(o)}})}),Xc=eo,Yc=ss;const qc=sc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),is=C.createContext({size:"default",variant:"default"});function as(e){const t=se.c(20);let n,o,r,s,i;t[0]!==e?({className:o,variant:i,size:s,children:n,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);let a;t[6]!==o?(a=nn("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",o),t[6]=o,t[7]=a):a=t[7];let l;t[8]!==s||t[9]!==i?(l={variant:i,size:s},t[8]=s,t[9]=i,t[10]=l):l=t[10];let c;t[11]!==n||t[12]!==l?(c=h.jsx(is.Provider,{value:l,children:n}),t[11]=n,t[12]=l,t[13]=c):c=t[13];let u;return t[14]!==r||t[15]!==s||t[16]!==a||t[17]!==c||t[18]!==i?(u=h.jsx(Xc,{"data-slot":"toggle-group","data-variant":i,"data-size":s,className:a,...r,children:c}),t[14]=r,t[15]=s,t[16]=a,t[17]=c,t[18]=i,t[19]=u):u=t[19],u}function Ze(e){const t=se.c(18);let n,o,r,s,i;t[0]!==e?({className:o,children:n,variant:i,size:s,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);const a=C.useContext(is),l=a.variant||i,c=a.size||s;let u;t[6]!==o||t[7]!==a.size||t[8]!==a.variant||t[9]!==s||t[10]!==i?(u=nn(qc({variant:a.variant||i,size:a.size||s}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",o),t[6]=o,t[7]=a.size,t[8]=a.variant,t[9]=s,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==l||t[15]!==c||t[16]!==u?(d=h.jsx(Yc,{"data-slot":"toggle-group-item","data-variant":l,"data-size":c,className:u,...r,children:n}),t[12]=n,t[13]=r,t[14]=l,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Wc={value:()=>{}};function rn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function Zc(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=rn.prototype={constructor:zt,on:function(e,t){var n=this._,o=Zc(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=Kc(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Do(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Do(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function Kc(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Do(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Wc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var $n="http://www.w3.org/1999/xhtml";const $o={svg:"http://www.w3.org/2000/svg",xhtml:$n,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$o.hasOwnProperty(t)?{space:$o[t],local:e}:e}function Uc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$n&&t.documentElement.namespaceURI===$n?t.createElement(e):t.createElementNS(n,e)}}function Qc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function cs(e){var t=sn(e);return(t.local?Qc:Uc)(t)}function Jc(){}function to(e){return e==null?Jc:function(){return this.querySelector(e)}}function el(e){typeof e!="function"&&(e=to(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function tl(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nl(){return[]}function ls(e){return e==null?nl:function(){return this.querySelectorAll(e)}}function ol(e){return function(){return tl(e.apply(this,arguments))}}function rl(e){typeof e=="function"?e=ol(e):e=ls(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new le(o,r)}function us(e){return function(){return this.matches(e)}}function ds(e){return function(t){return t.matches(e)}}var sl=Array.prototype.find;function il(e){return function(){return sl.call(this.children,e)}}function al(){return this.firstElementChild}function cl(e){return this.select(e==null?al:il(typeof e=="function"?e:ds(e)))}var ll=Array.prototype.filter;function ul(){return Array.from(this.children)}function dl(e){return function(){return ll.call(this.children,e)}}function fl(e){return this.selectAll(e==null?ul:dl(typeof e=="function"?e:ds(e)))}function hl(e){typeof e!="function"&&(e=us(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new le(o,this._parents)}function fs(e){return new Array(e.length)}function gl(){return new le(this._enter||this._groups.map(fs),this._parents)}function Xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xt.prototype={constructor:Xt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ml(e){return function(){return e}}function pl(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new Xt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function yl(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,d=s.length,f=new Array(u),m;for(a=0;a<u;++a)(l=t[a])&&(f[a]=m=i.call(l,l.__data__,a,t)+"",c.has(m)?r[a]=l:c.set(m,l));for(a=0;a<d;++a)m=i.call(e,s[a],a,s)+"",(l=c.get(m))?(o[a]=l,l.__data__=s[a],c.delete(m)):n[a]=new Xt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function xl(e){return e.__data__}function vl(e,t){if(!arguments.length)return Array.from(this,xl);var n=t?yl:pl,o=this._parents,r=this._groups;typeof e!="function"&&(e=ml(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],d=r[c],f=d.length,m=wl(e.call(u,u&&u.__data__,c,o)),g=m.length,y=a[c]=new Array(g),v=i[c]=new Array(g),x=l[c]=new Array(f);n(u,d,y,v,x,m,t);for(var _=0,p=0,w,M;_<g;++_)if(w=y[_]){for(_>=p&&(p=_+1);!(M=v[p])&&++p<g;);w._next=M||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function wl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bl(){return new le(this._exit||this._groups.map(fs),this._parents)}function _l(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Sl(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),m,g=0;g<d;++g)(m=c[g]||u[g])&&(f[g]=m);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Nl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function El(e){e||(e=Cl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function Cl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ml(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Il(){return Array.from(this)}function kl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Pl(){let e=0;for(const t of this)++e;return e}function Tl(){return!this.node()}function jl(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Al(e){return function(){this.removeAttribute(e)}}function Dl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $l(e,t){return function(){this.setAttribute(e,t)}}function Ll(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ol(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Rl(e,t){var n=sn(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Dl:Al:typeof t=="function"?n.local?Ol:zl:n.local?Ll:$l)(n,t))}function hs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Hl(e){return function(){this.style.removeProperty(e)}}function Vl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Bl(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Fl(e,t,n){return arguments.length>1?this.each((t==null?Hl:typeof t=="function"?Bl:Vl)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||hs(e).getComputedStyle(e,null).getPropertyValue(t)}function Gl(e){return function(){delete this[e]}}function Xl(e,t){return function(){this[e]=t}}function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ql(e,t){return arguments.length>1?this.each((t==null?Gl:typeof t=="function"?Yl:Xl)(e,t)):this.node()[e]}function gs(e){return e.trim().split(/^|\s+/)}function no(e){return e.classList||new ms(e)}function ms(e){this._node=e,this._names=gs(e.getAttribute("class")||"")}ms.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ps(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ys(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Wl(e){return function(){ps(this,e)}}function Zl(e){return function(){ys(this,e)}}function Kl(e,t){return function(){(t.apply(this,arguments)?ps:ys)(this,e)}}function Ul(e,t){var n=gs(e+"");if(arguments.length<2){for(var o=no(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Kl:t?Wl:Zl)(n,t))}function Ql(){this.textContent=""}function Jl(e){return function(){this.textContent=e}}function eu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function tu(e){return arguments.length?this.each(e==null?Ql:(typeof e=="function"?eu:Jl)(e)):this.node().textContent}function nu(){this.innerHTML=""}function ou(e){return function(){this.innerHTML=e}}function ru(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function su(e){return arguments.length?this.each(e==null?nu:(typeof e=="function"?ru:ou)(e)):this.node().innerHTML}function iu(){this.nextSibling&&this.parentNode.appendChild(this)}function au(){return this.each(iu)}function cu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function lu(){return this.each(cu)}function uu(e){var t=typeof e=="function"?e:cs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function du(){return null}function fu(e,t){var n=typeof e=="function"?e:cs(e),o=t==null?du:typeof t=="function"?t:to(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function hu(){var e=this.parentNode;e&&e.removeChild(this)}function gu(){return this.each(hu)}function mu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yu(e){return this.select(e?pu:mu)}function xu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vu(e){return function(t){e.call(this,t,this.__data__)}}function wu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function bu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function _u(e,t,n){return function(){var o=this.__on,r,s=vu(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Su(e,t,n){var o=wu(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?_u:bu,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function xs(e,t,n){var o=hs(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Nu(e,t){return function(){return xs(this,e,t)}}function Eu(e,t){return function(){return xs(this,e,t.apply(this,arguments))}}function Cu(e,t){return this.each((typeof t=="function"?Eu:Nu)(e,t))}function*Mu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var vs=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],vs)}function Iu(){return this}le.prototype=St.prototype={constructor:le,select:el,selectAll:rl,selectChild:cl,selectChildren:fl,filter:hl,data:vl,enter:gl,exit:bl,join:_l,merge:Sl,selection:Iu,order:Nl,sort:El,call:Ml,nodes:Il,node:kl,size:Pl,empty:Tl,each:jl,attr:Rl,style:Fl,property:ql,classed:Ul,text:tu,html:su,raise:au,lower:lu,append:uu,insert:fu,remove:gu,clone:yu,datum:xu,on:Su,dispatch:Cu,[Symbol.iterator]:Mu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],vs)}function ku(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=ku(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Pu={passive:!1},mt={capture:!0,passive:!1};function _n(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function ws(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ke,mt);"onselectstart"in t?n.on("selectstart.drag",Ke,mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function bs(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,mt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const kt=e=>()=>e;function Ln(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Ln.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Tu(e){return!e.ctrlKey&&!e.button}function ju(){return this.parentNode}function Au(e,t){return t??{x:e.x,y:e.y}}function Du(){return navigator.maxTouchPoints||"ontouchstart"in this}function _s(){var e=Tu,t=ju,n=Au,o=Du,r={},s=rn("start","drag","end"),i=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",m).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Pu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,M){if(!(u||!e.call(this,w,M))){var S=p(this,t.call(this,w,M),w,M,"mouse");S&&(ce(w.view).on("mousemove.drag",g,mt).on("mouseup.drag",y,mt),ws(w.view),_n(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function g(w){if(Ke(w),!c){var M=w.clientX-a,S=w.clientY-l;c=M*M+S*S>d}r.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),bs(w.view,c),Ke(w),r.mouse("end",w)}function v(w,M){if(e.call(this,w,M)){var S=w.changedTouches,N=t.call(this,w,M),D=S.length,j,z;for(j=0;j<D;++j)(z=p(this,N,w,M,S[j].identifier,S[j]))&&(_n(w),z("start",w,S[j]))}}function x(w){var M=w.changedTouches,S=M.length,N,D;for(N=0;N<S;++N)(D=r[M[N].identifier])&&(Ke(w),D("drag",w,M[N]))}function _(w){var M=w.changedTouches,S=M.length,N,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(D=r[M[N].identifier])&&(_n(w),D("end",w,M[N]))}function p(w,M,S,N,D,j){var z=s.copy(),E=de(j||S,M),$,L,b;if((b=n.call(w,new Ln("beforestart",{sourceEvent:S,target:f,identifier:D,active:i,x:E[0],y:E[1],dx:0,dy:0,dispatch:z}),N))!=null)return $=b.x-E[0]||0,L=b.y-E[1]||0,function k(I,A,P){var T=E,O;switch(I){case"start":r[D]=k,O=i++;break;case"end":delete r[D],--i;case"drag":E=de(P||A,M),O=i;break}z.call(I,w,new Ln(I,{sourceEvent:A,subject:b,target:f,identifier:D,active:O,x:E[0]+$,y:E[1]+L,dx:E[0]-T[0],dy:E[1]-T[1],dispatch:z}),N)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:kt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:kt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:kt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:kt(!!w),f):o},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}var Lo=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ss(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*Lo,skewX:Math.atan(l)*Lo,scaleX:i,scaleY:a}}var Pt;function $u(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:Ss(t.a,t.b,t.c,t.d,t.e,t.f)}function Lu(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?zn:(e=e.matrix,Ss(e.a,e.b,e.c,e.d,e.e,e.f))}function Ns(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,d,f,m,g){if(c!==d||u!==f){var y=m.push("translate(",null,t,null,n);g.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d||f)&&m.push("translate("+d+t+f+n)}function i(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,m,g){if(c!==d||u!==f){var y=m.push(r(m)+"scale(",null,",",null,")");g.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d!==1||f!==1)&&m.push(r(m)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,f),i(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(m){for(var g=-1,y=f.length,v;++g<y;)d[(v=f[g]).i]=v.x(m);return d.join("")}}}var zu=Ns($u,"px, ","px)","deg)"),Ou=Ns(Lu,", ",")",")"),Ru=1e-12;function zo(e){return((e=Math.exp(e))+1/e)/2}function Hu(e){return((e=Math.exp(e))-1/e)/2}function Vu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ot=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],d=i[1],f=i[2],m=u-a,g=d-l,y=m*m+g*g,v,x;if(y<Ru)x=Math.log(f/c)/t,v=function(N){return[a+N*m,l+N*g,c*Math.exp(t*N*x)]};else{var _=Math.sqrt(y),p=(f*f-c*c+o*y)/(2*c*n*_),w=(f*f-c*c-o*y)/(2*f*n*_),M=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);x=(S-M)/t,v=function(N){var D=N*x,j=zo(M),z=c/(n*_)*(j*Vu(t*D+M)-Hu(M));return[a+z*m,l+z*g,c*j/zo(t*D+M)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Qe=0,dt=0,lt=0,Es=1e3,Yt,ft,qt=0,Ve=0,an=0,pt=typeof performance=="object"&&performance.now?performance:Date,Cs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Ve||(Cs(Bu),Ve=pt.now()+an)}function Bu(){Ve=0}function Wt(){this._call=this._time=this._next=null}Wt.prototype=Ms.prototype={constructor:Wt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:Yt=this,ft=this),this._call=e,this._time=n,On()},stop:function(){this._call&&(this._call=null,this._time=1/0,On())}};function Ms(e,t,n){var o=new Wt;return o.restart(e,t,n),o}function Fu(){oo(),++Qe;for(var e=Yt,t;e;)(t=Ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Oo(){Ve=(qt=pt.now())+an,Qe=dt=0;try{Fu()}finally{Qe=0,Xu(),Ve=0}}function Gu(){var e=pt.now(),t=e-qt;t>Es&&(an-=t,qt=e)}function Xu(){for(var e,t=Yt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Yt=n);ft=e,On(o)}function On(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Ve;t>24?(e<1/0&&(dt=setTimeout(Oo,e-pt.now()-an)),lt&&(lt=clearInterval(lt))):(lt||(qt=pt.now(),lt=setInterval(Gu,Es)),Qe=1,Cs(Oo))}}function Ro(e,t,n){var o=new Wt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Yu=rn("start","end","cancel","interrupt"),qu=[],Is=0,Ho=1,Rn=2,Rt=3,Vo=4,Hn=5,Ht=6;function cn(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Wu(e,n,{name:t,index:o,group:r,on:Yu,tween:qu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Is})}function ro(e,t){var n=ge(e,t);if(n.state>Is)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=ge(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Wu(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Ms(s,0,n.time);function s(c){n.state=Ho,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,d,f,m;if(n.state!==Ho)return l();for(u in o)if(m=o[u],m.name===n.name){if(m.state===Rt)return Ro(i);m.state===Vo?(m.state=Ht,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete o[u]):+u<t&&(m.state=Ht,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete o[u])}if(Ro(function(){n.state===Rt&&(n.state=Vo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Rt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(m=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=m);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Hn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Hn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ht,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Vt(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Rn&&o.state<Hn,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function Zu(e){return this.each(function(){Vt(this,e)})}function Ku(e,t){var n,o;return function(){var r=xe(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function Uu(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=xe(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function Qu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ge(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?Ku:Uu)(n,e,t))}function so(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ge(r,o).value[t]}}function ks(e,t){var n;return(typeof t=="number"?ze:t instanceof Po?ko:(n=Po(t))?(t=n,ko):uc)(e,t)}function Ju(e){return function(){this.removeAttribute(e)}}function ed(e){return function(){this.removeAttributeNS(e.space,e.local)}}function td(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function nd(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function od(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function rd(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function sd(e,t){var n=sn(e),o=n==="transform"?Ou:ks;return this.attrTween(e,typeof t=="function"?(n.local?rd:od)(n,o,so(this,"attr."+e,t)):t==null?(n.local?ed:Ju)(n):(n.local?nd:td)(n,o,t))}function id(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ad(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function cd(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&ad(e,s)),n}return r._value=t,r}function ld(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&id(e,s)),n}return r._value=t,r}function ud(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=sn(e);return this.tween(n,(o.local?cd:ld)(o,t))}function dd(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function fd(e,t){return t=+t,function(){ro(this,e).delay=t}}function hd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?dd:fd)(t,e)):ge(this.node(),t).delay}function gd(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function md(e,t){return t=+t,function(){xe(this,e).duration=t}}function pd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gd:md)(t,e)):ge(this.node(),t).duration}function yd(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function xd(e){var t=this._id;return arguments.length?this.each(yd(t,e)):ge(this.node(),t).ease}function vd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function wd(e){if(typeof e!="function")throw new Error;return this.each(vd(this._id,e))}function bd(e){typeof e!="function"&&(e=us(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function _d(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,d=i[a]=new Array(u),f,m=0;m<u;++m)(f=l[m]||c[m])&&(d[m]=f);for(;a<o;++a)i[a]=t[a];return new _e(i,this._parents,this._name,this._id)}function Sd(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Nd(e,t,n){var o,r,s=Sd(t)?ro:xe;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Ed(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(Nd(n,e,t))}function Cd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Md(){return this.on("end.remove",Cd(this._id))}function Id(e){var t=this._name,n=this._id;typeof e!="function"&&(e=to(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,cn(c[f],t,n,f,c,ge(u,n)));return new _e(s,this._parents,t,n)}function kd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ls(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),m,g=ge(u,n),y=0,v=f.length;y<v;++y)(m=f[y])&&cn(m,t,n,y,f,g);s.push(f),i.push(u)}return new _e(s,i,t,n)}var Pd=St.prototype.constructor;function Td(){return new Pd(this._groups,this._parents)}function jd(e,t){var n,o,r;return function(){var s=Ue(this,e),i=(this.style.removeProperty(e),Ue(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ps(e){return function(){this.style.removeProperty(e)}}function Ad(e,t,n){var o,r=n+"",s;return function(){var i=Ue(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Dd(e,t,n){var o,r,s;return function(){var i=Ue(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ue(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function $d(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=xe(this,e),c=l.on,u=l.value[s]==null?a||(a=Ps(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function Ld(e,t,n){var o=(e+="")=="transform"?zu:ks;return t==null?this.styleTween(e,jd(e,o)).on("end.style."+e,Ps(e)):typeof t=="function"?this.styleTween(e,Dd(e,o,so(this,"style."+e,t))).each($d(this._id,e)):this.styleTween(e,Ad(e,o,t),n).on("end.style."+e,null)}function zd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Od(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&zd(e,i,n)),o}return s._value=t,s}function Rd(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Od(e,t,n??""))}function Hd(e){return function(){this.textContent=e}}function Vd(e){return function(){var t=e(this);this.textContent=t??""}}function Bd(e){return this.tween("text",typeof e=="function"?Vd(so(this,"text",e)):Hd(e==null?"":e+""))}function Fd(e){return function(t){this.textContent=e.call(this,t)}}function Gd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Fd(r)),t}return o._value=e,o}function Xd(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Gd(e))}function Yd(){for(var e=this._name,t=this._id,n=Ts(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=ge(l,t);cn(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function qd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var Wd=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ts(){return++Wd}var we=St.prototype;_e.prototype={constructor:_e,select:Id,selectAll:kd,selectChild:we.selectChild,selectChildren:we.selectChildren,filter:bd,merge:_d,selection:Td,transition:Yd,call:we.call,nodes:we.nodes,node:we.node,size:we.size,empty:we.empty,each:we.each,on:Ed,attr:sd,attrTween:ud,style:Ld,styleTween:Rd,text:Bd,textTween:Xd,remove:Md,tween:Qu,delay:hd,duration:pd,ease:xd,easeVarying:wd,end:qd,[Symbol.iterator]:we[Symbol.iterator]};function Zd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kd={time:null,delay:0,duration:250,ease:Zd};function Ud(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Qd(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Ts(),(n=Kd).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&cn(l,e,t,c,i,n||Ud(l,t));return new _e(o,this._parents,e,t)}St.prototype.interrupt=Zu;St.prototype.transition=Qd;const Tt=e=>()=>e;function Jd(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ln=new be(1,0,0);js.prototype=be.prototype;function js(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ln;return e.__zoom}function Sn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function ef(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tf(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Bo(){return this.__zoom||ln}function nf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function of(){return navigator.maxTouchPoints||"ontouchstart"in this}function rf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function As(){var e=ef,t=tf,n=rf,o=nf,r=of,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ot,c=rn("start","zoom","end"),u,d,f,m=500,g=150,y=0,v=10;function x(b){b.property("__zoom",Bo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,k,I,A){var P=b.selection?b.selection():b;P.property("__zoom",Bo),b!==P?M(b,k,I,A):P.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},x.scaleBy=function(b,k,I,A){x.scaleTo(b,function(){var P=this.__zoom.k,T=typeof k=="function"?k.apply(this,arguments):k;return P*T},I,A)},x.scaleTo=function(b,k,I,A){x.transform(b,function(){var P=t.apply(this,arguments),T=this.__zoom,O=I==null?w(P):typeof I=="function"?I.apply(this,arguments):I,H=T.invert(O),R=typeof k=="function"?k.apply(this,arguments):k;return n(p(_(T,R),O,H),P,i)},I,A)},x.translateBy=function(b,k,I,A){x.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),i)},null,A)},x.translateTo=function(b,k,I,A,P){x.transform(b,function(){var T=t.apply(this,arguments),O=this.__zoom,H=A==null?w(T):typeof A=="function"?A.apply(this,arguments):A;return n(ln.translate(H[0],H[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof I=="function"?-I.apply(this,arguments):-I),T,i)},A,P)};function _(b,k){return k=Math.max(s[0],Math.min(s[1],k)),k===b.k?b:new be(k,b.x,b.y)}function p(b,k,I){var A=k[0]-I[0]*b.k,P=k[1]-I[1]*b.k;return A===b.x&&P===b.y?b:new be(b.k,A,P)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,k,I,A){b.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,T=arguments,O=S(P,T).event(A),H=t.apply(P,T),R=I==null?w(H):typeof I=="function"?I.apply(P,T):I,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=P.__zoom,q=typeof k=="function"?k.apply(P,T):k,K=l(B.invert(R).concat(F/B.k),q.invert(R).concat(F/q.k));return function(Y){if(Y===1)Y=q;else{var V=K(Y),X=F/V[2];Y=new be(X,R[0]-V[0]*X,R[1]-V[1]*X)}O.zoom(null,Y)}})}function S(b,k,I){return!I&&b.__zooming||new N(b,k)}function N(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();c.call(b,this.that,new Jd(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),k)}};function D(b,...k){if(!e.apply(this,arguments))return;var I=S(this,k).event(b),A=this.__zoom,P=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),T=de(b);if(I.wheel)(I.mouse[0][0]!==T[0]||I.mouse[0][1]!==T[1])&&(I.mouse[1]=A.invert(I.mouse[0]=T)),clearTimeout(I.wheel);else{if(A.k===P)return;I.mouse=[T,A.invert(T)],Vt(this),I.start()}ut(b),I.wheel=setTimeout(O,g),I.zoom("mouse",n(p(_(A,P),I.mouse[0],I.mouse[1]),I.extent,i));function O(){I.wheel=null,I.end()}}function j(b,...k){if(f||!e.apply(this,arguments))return;var I=b.currentTarget,A=S(this,k,!0).event(b),P=ce(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),T=de(b,I),O=b.clientX,H=b.clientY;ws(b.view),Sn(b),A.mouse=[T,this.__zoom.invert(T)],Vt(this),A.start();function R(B){if(ut(B),!A.moved){var q=B.clientX-O,K=B.clientY-H;A.moved=q*q+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,I),A.mouse[1]),A.extent,i))}function F(B){P.on("mousemove.zoom mouseup.zoom",null),bs(B.view,A.moved),ut(B),A.event(B).end()}}function z(b,...k){if(e.apply(this,arguments)){var I=this.__zoom,A=de(b.changedTouches?b.changedTouches[0]:b,this),P=I.invert(A),T=I.k*(b.shiftKey?.5:2),O=n(p(_(I,T),A,P),t.apply(this,k),i);ut(b),a>0?ce(this).transition().duration(a).call(M,O,A,b):ce(this).call(x.transform,O,A,b)}}function E(b,...k){if(e.apply(this,arguments)){var I=b.touches,A=I.length,P=S(this,k,b.changedTouches.length===A).event(b),T,O,H,R;for(Sn(b),O=0;O<A;++O)H=I[O],R=de(H,this),R=[R,this.__zoom.invert(R),H.identifier],P.touch0?!P.touch1&&P.touch0[2]!==R[2]&&(P.touch1=R,P.taps=0):(P.touch0=R,T=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(P.taps<2&&(d=R[0],u=setTimeout(function(){u=null},m)),Vt(this),P.start())}}function $(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,T,O,H,R;for(ut(b),T=0;T<P;++T)O=A[T],H=de(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=H:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=H);if(O=I.that.__zoom,I.touch1){var F=I.touch0[0],B=I.touch0[1],q=I.touch1[0],K=I.touch1[1],Y=(Y=q[0]-F[0])*Y+(Y=q[1]-F[1])*Y,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;O=_(O,Math.sqrt(Y/V)),H=[(F[0]+q[0])/2,(F[1]+q[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(I.touch0)H=I.touch0[0],R=I.touch0[1];else return;I.zoom("touch",n(p(O,H,R),I.extent,i))}}function L(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,T,O;for(Sn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},m),T=0;T<P;++T)O=A[T],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<v)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:Tt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Tt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Tt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Tt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],x):[s[0],s[1]]},x.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],x):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(y=(b=+b)*b,x):Math.sqrt(y)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ds=["Enter"," ","Escape"],$s={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const Ls={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Zt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Zt||(Zt={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Fo={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function zs(e){return e===null?null:e?"valid":"invalid"}const Os=e=>"id"in e&&"source"in e&&"target"in e,sf=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},af=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=i?Kt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return un(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return dn(n)},Et=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=un(n,Kt(r)),o=!0)}),o?dn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Mt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(i&&!d||f)continue;const m=u.width??c.width??c.initialWidth??null,g=u.height??c.height??c.initialHeight??null,y=vt(a,tt(c)),v=(m??0)*(g??0),x=s&&y>0;(!c.internals.handleBounds||x||y>=v||c.dragging)&&l.push(c)}return l},cf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function lf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function uf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=lf(e,i),l=Et(a),c=co(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Rs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let d=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const m=a.measured.width,g=a.measured.height;m&&g&&(d=[[l,c],[l+m,c+g]])}else a&&nt(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const f=nt(d)?Be(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:f.x-l+(i.measured.width??0)*u[0],y:f.y-c+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function df({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const m=s.has(f.id),g=!m&&f.parentId&&i.find(y=>y.id===f.parentId);(m||g)&&i.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=cf(i,l);for(const f of l)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:i};const d=await r({nodes:i,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:i}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Be=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hs(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Be(e,[[s,i],[s+o,i+r]],t)}const Go=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Vs=(e,t,n=15,o=40)=>{const r=Go(e.x,o,t.width-o)*n,s=Go(e.y,o,t.height-o)*n;return[r,s]},un=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),dn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Kt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Bs=(e,t)=>dn(un(Vn(e),Vn(t))),vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Xo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),ff=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Ct(a,i):a},Ut=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function hf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),s=Xe(e.left??e.x??0,t),i=Xe(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function gf(e,t,n,o,r,s){const{x:i,y:a}=Ut(e,[t,n,o]),{x:l,y:c}=Ut({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,s)=>{const i=hf(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,m=t/2-d*u,g=n/2-f*u,y=gf(e,m,g,u,t,n),v={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:u}},wt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Fs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Gs(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function mf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function pf(e){return{...$s,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=Mt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Ct(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Xs=e=>e?.getRootNode?.()||window?.document,yf=["INPUT","SELECT","TEXTAREA"];function Ys(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:yf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const qs=e=>"clientX"in e,he=(e,t)=>{const n=qs(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(i)}})};function Ws({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case G.Left:return[t-jt(t-o,s),n];case G.Right:return[t+jt(o-t,s),n];case G.Top:return[t,n-jt(n-r,s)];case G.Bottom:return[t,n+jt(r-n,s)]}}function Zs({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,curvature:i=.25}){const[a,l]=Wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=Wo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,f,m,g]=Ws({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,m,g]}function Ks({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function xf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function vf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=un(Kt(e),Kt(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return vt(i,dn(s))>0}const wf=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,bf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),_f=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||wf;let r;return Os(e)?r={...e}:r={...e,id:o(e)},bf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Us({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Ks({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Zo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},Sf=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nf({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:s,stepPosition:i}){const a=Zo[t],l=Zo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},d=Sf({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",m=d[f];let g=[],y,v;const x={x:0,y:0},_={x:0,y:0},[,,p,w]=Ks({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(y=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(y=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:y,y:c.y},{x:y,y:u.y}],N=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===m?g=f==="x"?S:N:g=f==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?g=a.x===m?N:S:g=a.y===m?S:N,t===o){const $=Math.abs(e[f]-n[f]);if($<=s){const L=Math.min(s-1,s-$);a[f]===m?x[f]=(c[f]>e[f]?-1:1)*L:_[f]=(u[f]>n[f]?-1:1)*L}}if(t!==o){const $=f==="x"?"y":"x",L=a[f]===l[$],b=c[$]>u[$],k=c[$]<u[$];(a[f]===1&&(!L&&b||L&&k)||a[f]!==1&&(!L&&k||L&&b))&&(g=f==="x"?S:N)}const D={x:c.x+x.x,y:c.y+x.y},j={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(D.x-g[0].x),Math.abs(j.x-g[0].x)),E=Math.max(Math.abs(D.y-g[0].y),Math.abs(j.y-g[0].y));z>=E?(y=(D.x+j.x)/2,v=g[0].y):(y=g[0].x,v=(D.y+j.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...g,{x:u.x+_.x,y:u.y+_.y},n],y,v,p,w]}function Ef(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,m,g,y]=Nf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,p)=>{let w="";return p>0&&p<d.length-1?w=Ef(d[p-1],_,d[p+1],i):w=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,m,g,y]}function Uo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Cf(e){const{sourceNode:t,targetNode:n}=e;if(!Uo(t)||!Uo(n))return null;const o=t.internals.handleBounds||Qo(t.handles),r=n.internals.handleBounds||Qo(n.handles),s=Jo(o?.source??[],e.sourceHandle),i=Jo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||G.Bottom,l=i?.position||G.Top,c=Fe(t,s,a),u=Fe(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Qo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=G.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case G.Top:return{x:r+i/2,y:s};case G.Right:return{x:r+i,y:s+a/2};case G.Bottom:return{x:r+i/2,y:s+a};case G.Left:return{x:r,y:s+a/2}}}function Jo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Mf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Fn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const Qs=1e3,If=10,uo={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},kf={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Pf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)go(r,e,t,o);else{const s=Nt(r,o.nodeOrigin),i=nt(r.extent)?r.extent:o.nodeExtent,a=Be(s,i,Ne(r));r.internals.positionAbsolute=a}}function Tf(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(kf,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?Qs:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Nt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,m=Be(d,f,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:m,handleBounds:Tf(c,u),z:Js(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&go(u,t,n,o,s)}return l}function jf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function go(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}jf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*If),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=s&&!ho(l)?Qs:0,{x:f,y:m,z:g}=Af(e,u,i,a,d,l),{positionAbsolute:y}=e.internals,v=f!==y.x||m!==y.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:m}:y,z:g}})}function Js(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Af(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Nt(e,n),u=nt(e.extent)?Be(c,e.extent,l):c;let d=Be({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Hs(d,l,t));const f=Js(e,r,s),m=t.internals.z??0;return{x:d.x,y:d.y,z:m>=f?m+1:f}}function mo(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??tt(a),c=Bs(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),d=a.origin??o,f=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,m=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,g=Math.max(u.width,Math.round(i.width)),y=Math.max(u.height,Math.round(i.height)),v=(g-u.width)*d[0],x=(y-u.height)*d[1];(f>0||m>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-m+x}}),n.get(l)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+m}})})),(u.width<i.width||u.height<i.height||f||m)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?d[0]*f-v:0),height:y+(m?d[1]*m-x:0)}})}),r}function Df(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const m of e.values()){const g=t.get(m.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const y=lo(m.nodeElement),v=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(v||!g.internals.handleBounds||m.force))){const _=m.nodeElement.getBoundingClientRect(),p=nt(g.extent)?g.extent:s;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Hs(w,y,t.get(g.parentId)):p&&(w=Be(w,p,y));const M={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:qo("source",m.nodeElement,_,d,g.id),target:qo("target",m.nodeElement,_,d,g.id)}}};t.set(g.id,M),g.parentId&&go(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:tt(M,r)}))}}if(f.length>0){const m=mo(f,t,n,r);c.push(...m)}return{changes:c,updatedInternals:l}}async function $f({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function er(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function ei(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;er("source",l,u,e,r,i),er("target",l,c,e,s,a),t.set(o.id,o)}}function ti(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:ti(n,t):!1}function tr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Lf(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!ti(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Nn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function zf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Ct(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Of({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,m=!1,g=!1,y=null;function v({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:M,nodeId:S,nodeClickDistance:N=0}){f=ce(w);function D({x:$,y:L}){const{nodeLookup:b,nodeExtent:k,snapGrid:I,snapToGrid:A,nodeOrigin:P,onNodeDrag:T,onSelectionDrag:O,onError:H,updateNodePositions:R}=t();s={x:$,y:L};let F=!1;const B=a.size>1,q=B&&k?Vn(Et(a)):null,K=B&&A?zf({dragItems:a,snapGrid:I,x:$,y:L}):null;for(const[Y,V]of a){if(!b.has(Y))continue;let X={x:$-V.distance.x,y:L-V.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:Ct(X,I));let Q=null;if(B&&k&&!V.extent&&q){const{positionAbsolute:Z}=V.internals,ee=Z.x-q.x+k[0][0],ne=Z.x+V.measured.width-q.x2+k[1][0],te=Z.y-q.y+k[0][1],ae=Z.y+V.measured.height-q.y2+k[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:W}=Rs({nodeId:Y,nextPosition:X,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:P,onError:H});F=F||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=W}if(g=g||F,!!F&&(R(a,!0),y&&(o||T||!S&&O))){const[Y,V]=Nn({nodeId:S,dragItems:a,nodeLookup:b});o?.(y,a,Y,V),T?.(y,Y,V),S||O?.(y,V)}}async function j(){if(!u)return;const{transform:$,panBy:L,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[I,A]=Vs(c,u,b);(I!==0||A!==0)&&(s.x=(s.x??0)-I/$[2],s.y=(s.y??0)-A/$[2],await L({x:I,y:A})&&D(s)),i=requestAnimationFrame(j)}function z($){const{nodeLookup:L,multiSelectionActive:b,nodesDraggable:k,transform:I,snapGrid:A,snapToGrid:P,selectNodesOnDrag:T,onNodeDragStart:O,onSelectionDragStart:H,unselectNodesAndEdges:R}=t();d=!0,(!T||!M)&&!b&&S&&(L.get(S)?.selected||R()),M&&T&&S&&e?.(S);const F=ht($.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:u});if(s=F,a=Lf(L,k,F,S),a.size>0&&(n||O||!S&&H)){const[B,q]=Nn({nodeId:S,dragItems:a,nodeLookup:L});n?.($.sourceEvent,a,B,q),O?.($.sourceEvent,B,q),S||H?.($.sourceEvent,q)}}const E=_s().clickDistance(N).on("start",$=>{const{domNode:L,nodeDragThreshold:b,transform:k,snapGrid:I,snapToGrid:A}=t();u=L?.getBoundingClientRect()||null,m=!1,g=!1,y=$.sourceEvent,b===0&&z($),s=ht($.sourceEvent,{transform:k,snapGrid:I,snapToGrid:A,containerBounds:u}),c=he($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:L,transform:b,snapGrid:k,snapToGrid:I,nodeDragThreshold:A,nodeLookup:P}=t(),T=ht($.sourceEvent,{transform:b,snapGrid:k,snapToGrid:I,containerBounds:u});if(y=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||S&&!P.has(S))&&(m=!0),!m){if(!l&&L&&d&&(l=!0,j()),!d){const O=he($.sourceEvent,u),H=O.x-c.x,R=O.y-c.y;Math.sqrt(H*H+R*R)>A&&z($)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&a&&d&&(c=he($.sourceEvent,u),D(T))}}).on("end",$=>{if(!(!d||m)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:L,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:I}=t();if(g&&(b(a,!1),g=!1),r||k||!S&&I){const[A,P]=Nn({nodeId:S,dragItems:a,nodeLookup:L,dragging:!1});r?.($.sourceEvent,a,A,P),k?.($.sourceEvent,A,P),S||I?.($.sourceEvent,P)}}}).filter($=>{const L=$.target;return!$.button&&(!_||!tr(L,`.${_}`,w))&&(!p||tr(L,p,w))});f.call(E)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function Rf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())vt(r,tt(s))>0&&o.push(s);return o}const Hf=250;function Vf(e,t,n,o){let r=[],s=1/0;const i=Rf(e,n,t+Hf);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Fe(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<s?(r=[{...c,x:u,y:d}],s=f):f===s&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ni(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Fe(i,l,l.position,!0)}:l}function oi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Bf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ri=()=>!0;function Ff(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:m,onConnectStart:g,onConnect:y,onConnectEnd:v,isValidConnection:x=ri,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:D}){const j=Xs(e.target);let z=0,E;const{x:$,y:L}=he(e),b=oi(s,D),k=a?.getBoundingClientRect();let I=!1;if(!k||!b)return;const A=ni(r,b,o,l,t);if(!A)return;let P=he(e,k),T=!1,O=null,H=!1,R=null;function F(){if(!u||!k)return;const[U,W]=Vs(P,k,S);f({x:U,y:W}),z=requestAnimationFrame(F)}const B={...A,nodeId:r,type:b,position:A.position},q=l.get(r);let Y={inProgress:!0,isValid:null,from:Fe(q,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:q,to:P,toHandle:null,toPosition:Fo[B.position],toNode:null,pointer:P};function V(){I=!0,p(Y),g?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&V();function X(U){if(!I){const{x:ae,y:Ee}=he(U),ve=ae-$,Le=Ee-L;if(!(ve*ve+Le*Le>N*N))return;V()}if(!M()||!B){Q(U);return}const W=w();P=he(U,k),E=Vf(Mt(P,W,!1,[1,1]),n,l,B),T||(F(),T=!0);const Z=si(U,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:j,lib:c,flowId:d,nodeLookup:l});R=Z.handleDomNode,O=Z.connection,H=Bf(!!E,Z.isValid);const ee=l.get(r),ne=ee?Fe(ee,B,G.Left,!0):Y.from,te={...Y,from:ne,isValid:H,to:Z.toHandle&&H?Ut({x:Z.toHandle.x,y:Z.toHandle.y},W):P,toHandle:Z.toHandle,toPosition:H&&Z.toHandle?Z.toHandle.position:Fo[B.position],toNode:Z.toHandle?l.get(Z.toHandle.nodeId):null,pointer:P};p(te),Y=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(I){(E||R)&&O&&H&&y?.(O);const{inProgress:W,...Z}=Y,ee={...Z,toPosition:Y.toHandle?Y.toPosition:null};v?.(U,ee),s&&_?.(U,ee)}m(),cancelAnimationFrame(z),T=!1,H=!1,O=null,R=null,j.removeEventListener("mousemove",X),j.removeEventListener("mouseup",Q),j.removeEventListener("touchmove",X),j.removeEventListener("touchend",Q)}}j.addEventListener("mousemove",X),j.addEventListener("mouseup",Q),j.addEventListener("touchmove",X),j.addEventListener("touchend",Q)}function si(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ri,nodeLookup:u}){const d=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:g}=he(e),y=i.elementFromPoint(m,g),v=y?.classList.contains(`${a}-flow__handle`)?y:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=oi(void 0,v),p=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!p||!_)return x;const N={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};x.connection=N;const j=M&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);x.isValid=j&&c(N),x.toHandle=ni(p,_,w,u,n,!0)}return x}const Xn={onPointerDown:Ff,isValid:si};function Gf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:m=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&wt()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,S*M);t.scaleTo(N)};let y=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[M[0]-y[0],M[1]-y[1]];y=M;const N=o()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),D={x:w[0]-S[0]*N,y:w[1]-S[1]*N},j=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},j,a)},_=As().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?g:null);r.call(_,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const fn=e=>({x:e.x,y:e.y,zoom:e.k}),En=({x:e,y:t,zoom:n})=>ln.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),ii=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Cn=(e,t=0,n=Xf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ai=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Yf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(qe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=de(u),x=ai(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let m=r===Re.Vertical?0:u.deltaX*f,g=r===Re.Horizontal?0:u.deltaY*f;!wt()&&u.shiftKey&&r!==Re.Vertical&&(m=u.deltaY*f,g=0),o.translateBy(n,-(m/d)*s,-(g/d)*s,{internal:!0});const y=fn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,y),e.panScrollTimeout=setTimeout(()=>{c?.(u,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,y))}}function qf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function Wf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=fn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Zf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&ii(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,fn(s.transform))}}function Kf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&ii(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=fn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function Uf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,m=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(qe(d,`${c}-flow__node`)||qe(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!s&&!n||i||u&&!g||qe(d,a)&&g||qe(d,l)&&(!g||r&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!m&&g||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&y}}function Qf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=As().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const m=f.on("wheel.zoom"),g=f.on("dblclick.zoom");d.wheelDelta(ai);function y(E,$){return f?new Promise(L=>{d?.interpolate($?.interpolate==="linear"?wn:Ot).transform(Cn(f,$?.duration,$?.ease,()=>L(!0)),E)}):Promise.resolve(!1)}function v({noWheelClassName:E,noPanClassName:$,onPaneContextMenu:L,userSelectionActive:b,panOnScroll:k,panOnDrag:I,panOnScrollMode:A,panOnScrollSpeed:P,preventScrolling:T,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:q,connectionInProgress:K,paneClickDistance:Y,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const X=k&&!F&&!b;d.clickDistance(V?1/0:!fe(Y)||Y<0?0:Y);const Q=X?Yf({zoomPanValues:c,noWheelClassName:E,d3Selection:f,d3Zoom:d,panOnScrollMode:A,panOnScrollSpeed:P,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):qf({noWheelClassName:E,preventScrolling:T,d3ZoomHandler:m});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const W=Wf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});d.on("start",W);const Z=Zf({zoomPanValues:c,panOnDrag:I,onPaneContextMenu:!!L,onPanZoom:s,onTransformChange:q});d.on("zoom",Z);const ee=Kf({zoomPanValues:c,panOnDrag:I,panOnScroll:k,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=Uf({zoomActivationKeyPressed:F,panOnDrag:I,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:R,zoomOnPinch:O,userSelectionActive:b,noPanClassName:$,noWheelClassName:E,lib:B,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(E,$,L){const b=En(E),k=d?.constrain()(b,$,L);return k&&await y(k),new Promise(I=>I(k))}async function p(E,$){const L=En(E);return await y(L,$),new Promise(b=>b(L))}function w(E){if(f){const $=En(E),L=f.property("__zoom");(L.k!==E.zoom||L.x!==E.x||L.y!==E.y)&&d?.transform(f,$,null,{sync:!0})}}function M(){const E=f?js(f.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function S(E,$){return f?new Promise(L=>{d?.interpolate($?.interpolate==="linear"?wn:Ot).scaleTo(Cn(f,$?.duration,$?.ease,()=>L(!0)),E)}):Promise.resolve(!1)}function N(E,$){return f?new Promise(L=>{d?.interpolate($?.interpolate==="linear"?wn:Ot).scaleBy(Cn(f,$?.duration,$?.ease,()=>L(!0)),E)}):Promise.resolve(!1)}function D(E){d?.scaleExtent(E)}function j(E){d?.translateExtent(E)}function z(E){const $=!fe(E)||E<0?0:E;d?.clickDistance($)}return{update:v,destroy:x,setViewport:p,setViewportConstrained:_,getViewport:M,scaleTo:S,scaleBy:N,setScaleExtent:D,setTranslateExtent:j,syncViewport:w,setClickDistance:z}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function Jf({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function nr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function or(e,t){return e?!t:t}function eh(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:m,ySnapped:g}=n,{minWidth:y,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:p,y:w,width:M,height:S,aspectRatio:N}=e;let D=Math.floor(u?m-e.pointerX:0),j=Math.floor(d?g-e.pointerY:0);const z=M+(l?-D:D),E=S+(c?-j:j),$=-s[0]*M,L=-s[1]*S;let b=At(z,y,v),k=At(E,x,_);if(i){let P=0,T=0;l&&D<0?P=Ce(p+D+$,i[0][0]):!l&&D>0&&(P=Me(p+z+$,i[1][0])),c&&j<0?T=Ce(w+j+L,i[0][1]):!c&&j>0&&(T=Me(w+E+L,i[1][1])),b=Math.max(b,P),k=Math.max(k,T)}if(a){let P=0,T=0;l&&D>0?P=Me(p+D,a[0][0]):!l&&D<0&&(P=Ce(p+z,a[1][0])),c&&j>0?T=Me(w+j,a[0][1]):!c&&j<0&&(T=Ce(w+E,a[1][1])),b=Math.max(b,P),k=Math.max(k,T)}if(r){if(u){const P=At(z/N,x,_)*N;if(b=Math.max(b,P),i){let T=0;!l&&!c||l&&!c&&f?T=Me(w+L+z/N,i[1][1])*N:T=Ce(w+L+(l?D:-D)/N,i[0][1])*N,b=Math.max(b,T)}if(a){let T=0;!l&&!c||l&&!c&&f?T=Ce(w+z/N,a[1][1])*N:T=Me(w+(l?D:-D)/N,a[0][1])*N,b=Math.max(b,T)}}if(d){const P=At(E*N,y,v)/N;if(k=Math.max(k,P),i){let T=0;!l&&!c||c&&!l&&f?T=Me(p+E*N+$,i[1][0])/N:T=Ce(p+(c?j:-j)*N+$,i[0][0])/N,k=Math.max(k,T)}if(a){let T=0;!l&&!c||c&&!l&&f?T=Ce(p+E*N,a[1][0])/N:T=Me(p+(c?j:-j)*N,a[0][0])/N,k=Math.max(k,T)}}}j=j+(j<0?k:-k),D=D+(D<0?b:-b),r&&(f?z>E*N?j=(or(l,c)?-D:D)/N:D=(or(l,c)?-j:j)*N:u?(j=D/N,c=l):(D=j*N,l=c));const I=l?p+D:p,A=c?w+j:w;return{width:M+(l?-D:D),height:S+(c?-j:j),x:s[0]*D*(l?-1:1)+I,y:s[1]*j*(c?-1:1)+A}}const ci={width:0,height:0,x:0,y:0},th={...ci,pointerX:0,pointerY:0,aspectRatio:1};function nh(e){return[[0,0],[e.measured.width,e.measured.height]]}function oh(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function rh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:nr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:m,onResize:g,onResizeEnd:y,shouldResize:v}){let x={...ci},_={...th};i={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:nr(c)};let p,w=null,M=[],S,N,D,j=!1;const z=_s().on("start",E=>{const{nodeLookup:$,transform:L,snapGrid:b,snapToGrid:k,nodeOrigin:I,paneDomNode:A}=n();if(p=$.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:T}=ht(E.sourceEvent,{transform:L,snapGrid:b,snapToGrid:k,containerBounds:w});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...x,pointerX:P,pointerY:T,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=$.get(p.parentId),N=S&&p.extent==="parent"?nh(S):void 0),M=[],D=void 0;for(const[O,H]of $)if(H.parentId===t&&(M.push({id:O,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const R=oh(H,p,H.origin??I);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}m?.(E,{...x})}).on("drag",E=>{const{transform:$,snapGrid:L,snapToGrid:b,nodeOrigin:k}=n(),I=ht(E.sourceEvent,{transform:$,snapGrid:L,snapToGrid:b,containerBounds:w}),A=[];if(!p)return;const{x:P,y:T,width:O,height:H}=x,R={},F=p.origin??k,{width:B,height:q,x:K,y:Y}=eh(_,i.controlDirection,I,i.boundaries,i.keepAspectRatio,F,N,D),V=B!==O,X=q!==H,Q=K!==P&&V,U=Y!==T&&X;if(!Q&&!U&&!V&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Y:x.y,x.x=R.x,x.y=R.y,M.length>0)){const ne=K-P,te=Y-T;for(const ae of M)ae.position={x:ae.position.x-ne+F[0]*(B-O),y:ae.position.y-te+F[1]*(q-H)},A.push(ae)}if((V||X)&&(R.width=V&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?q:x.height,x.width=R.width,x.height=R.height),S&&p.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const W=Jf({width:x.width,prevWidth:O,height:x.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...x,direction:W};v?.(E,Z)!==!1&&(j=!0,g?.(E,Z),o(R,A))}).on("end",E=>{j&&(y?.(E,{...x}),r?.({...x}),j=!1)});s.call(z)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const sh={},rr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const m=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,m))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(sh?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},ih=e=>e?rr(e):rr,{useDebugValue:ah}=ue,{useSyncExternalStoreWithSelector:ch}=ic,lh=e=>e;function li(e,t=lh,n){const o=ch(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ah(o),o}const sr=(e,t)=>{const n=ih(e),o=(r,s=t)=>li(n,r,s);return Object.assign(o,n),o},uh=(e,t)=>e?sr(e,t):sr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const hn=C.createContext(null),dh=hn.Provider,ui=pe.error001();function J(e,t){const n=C.useContext(hn);if(n===null)throw new Error(ui);return li(n,e,t)}function re(){const e=C.useContext(hn);if(e===null)throw new Error(ui);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},fh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},di="react-flow__node-desc",fi="react-flow__edge-desc",hh="react-flow__aria-live",gh=e=>e.ariaLiveMessage,mh=e=>e.ariaLabelConfig;function ph({rfId:e}){const t=J(gh);return h.jsx("div",{id:`${hh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:fh,children:t})}function yh({rfId:e,disableKeyboardA11y:t}){const n=J(mh);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${di}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${fi}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(ph,{rfId:e})]})}const gn=C.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});gn.displayName="Panel";function xh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(gn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const vh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function wh(e,t){return oe(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&oe(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function bh({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(vh,wh);return C.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const _h=e=>!!e.onSelectionChangeHandlers;function Sh({onSelectionChange:e}){const t=J(_h);return e||t?h.jsx(bh,{onSelectionChange:e}):null}const hi=[0,0],Nh={x:0,y:0,zoom:1},Eh=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ar=[...Eh,"rfId"],Ch=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),cr={translateExtent:yt,nodeOrigin:hi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Mh(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(Ch,oe),c=re();C.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=cr,a()}),[]);const u=C.useRef(cr);return C.useEffect(()=>{for(const d of ar){const f=e[d],m=u.current[d];f!==m&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?s(f):d==="nodeExtent"?i(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:pf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},ar.map(d=>e[d])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ih(e){const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function bt(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=C.useState(!1),r=C.useRef(!1),s=C.useRef(new Set([])),[i,a]=C.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
1
|
+
import{r as C,at as Wn,j as h,au as Tn,av as ec,aw as ue,ax as tc,ay as Or,az as nc,aA as oc,aB as rc,af as sc,c as se,aC as ic,a5 as ye,aD as Zn}from"./index-HoRNE_Oj.js";import{b as tn,c as Te,I as He}from"./use-connection-DbdMBpCj.js";import{C as ac}from"./collection-header-B92Inaku.js";import{C as cc}from"./collection-page-BfXTrpEI.js";import{E as Ye}from"./error-boundary-8a3_at8W.js";import{u as je}from"./use-tool-call-BxgOuqkM.js";import{u as Se}from"./tooltip-ocFCU6ZE.js";import{B as jn}from"./button-8a8UdvyR.js";import{I as An}from"./icon-CzxeHWBl.js";import{V as lc}from"./collection-display-button-CGcY64sw.js";import{u as Rr}from"./use-gateway-DN4bQAAB.js";import{c as nn}from"./utils-oBMoklwF.js";import{i as ze,a as ko,b as uc,c as Po,d as wn,e as bn,f as Hr,s as Vr,D as Kn,g as Br,h as dc,Z as Un,L as Qn,u as Fr,j as fc,k as hc,l as Dn,m as Gr,n as Jn,o as Xr,p as Yr,q as qr,r as gc,t as mc,v as pc,w as To,x as yc,y as Wr,z as Zr,R as xc,S as vc,A as wc,B as Kr,C as bc,E as _c,F as Sc,G as Nc,H as Ec,I as Cc,J as Ur,K as jo,M as Mc,N as Ic,O as ct,P as kc,Q as Pc,T as Tc,U as jc,V as Ac,W as Dc,X as $c,Y as Lc,_ as zc,$ as Ae,a0 as Oc,a1 as Rc,a2 as on}from"./types-CqJfCRYk.js";import{B as Hc}from"./badge-Ba7oj8pn.js";import"./dropdown-menu-BTTzlaf4.js";import"./index-DCY07ujJ.js";function De(){const e=new Date,t=new Date;t.setHours(e.getHours()-24),t.setSeconds(0,0);const n=new Date(e);return n.setHours(n.getHours()+1),n.setSeconds(0,0),{startDate:t.toISOString(),endDate:n.toISOString()}}var Qr="Toggle",Jr=C.forwardRef((e,t)=>{const{pressed:n,defaultPressed:o,onPressedChange:r,...s}=e,[i,a]=Wn({prop:n,onChange:r,defaultProp:o??!1,caller:Qr});return h.jsx(Tn.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:ec(e.onClick,()=>{e.disabled||a(!i)})})});Jr.displayName=Qr;var $e="ToggleGroup",[es]=tc($e,[Or]),ts=Or(),eo=ue.forwardRef((e,t)=>{const{type:n,...o}=e;if(n==="single"){const r=o;return h.jsx(Vc,{...r,ref:t})}if(n==="multiple"){const r=o;return h.jsx(Bc,{...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${$e}\``)});eo.displayName=$e;var[ns,os]=es($e),Vc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??"",onChange:r,caller:$e});return h.jsx(ns,{scope:e.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:ue.useCallback(()=>a(""),[a]),children:h.jsx(rs,{...s,ref:t})})}),Bc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??[],onChange:r,caller:$e}),l=ue.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ue.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return h.jsx(ns,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:l,onItemDeactivate:c,children:h.jsx(rs,{...s,ref:t})})});eo.displayName=$e;var[Fc,Gc]=es($e),rs=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:s,dir:i,loop:a=!0,...l}=e,c=ts(n),u=oc(i),d={role:"group",dir:u,...l};return h.jsx(Fc,{scope:n,rovingFocus:r,disabled:o,children:r?h.jsx(rc,{asChild:!0,...c,orientation:s,dir:u,loop:a,children:h.jsx(Tn.div,{...d,ref:t})}):h.jsx(Tn.div,{...d,ref:t})})}),Gt="ToggleGroupItem",ss=ue.forwardRef((e,t)=>{const n=os(Gt,e.__scopeToggleGroup),o=Gc(Gt,e.__scopeToggleGroup),r=ts(e.__scopeToggleGroup),s=n.value.includes(e.value),i=o.disabled||e.disabled,a={...e,pressed:s,disabled:i},l=ue.useRef(null);return o.rovingFocus?h.jsx(nc,{asChild:!0,...r,focusable:!i,active:s,ref:l,children:h.jsx(Ao,{...a,ref:t})}):h.jsx(Ao,{...a,ref:t})});ss.displayName=Gt;var Ao=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,s=os(Gt,n),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?i:void 0;return h.jsx(Jr,{...a,...r,ref:t,onPressedChange:l=>{l?s.onItemActivate(o):s.onItemDeactivate(o)}})}),Xc=eo,Yc=ss;const qc=sc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),is=C.createContext({size:"default",variant:"default"});function as(e){const t=se.c(20);let n,o,r,s,i;t[0]!==e?({className:o,variant:i,size:s,children:n,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);let a;t[6]!==o?(a=nn("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",o),t[6]=o,t[7]=a):a=t[7];let l;t[8]!==s||t[9]!==i?(l={variant:i,size:s},t[8]=s,t[9]=i,t[10]=l):l=t[10];let c;t[11]!==n||t[12]!==l?(c=h.jsx(is.Provider,{value:l,children:n}),t[11]=n,t[12]=l,t[13]=c):c=t[13];let u;return t[14]!==r||t[15]!==s||t[16]!==a||t[17]!==c||t[18]!==i?(u=h.jsx(Xc,{"data-slot":"toggle-group","data-variant":i,"data-size":s,className:a,...r,children:c}),t[14]=r,t[15]=s,t[16]=a,t[17]=c,t[18]=i,t[19]=u):u=t[19],u}function Ze(e){const t=se.c(18);let n,o,r,s,i;t[0]!==e?({className:o,children:n,variant:i,size:s,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);const a=C.useContext(is),l=a.variant||i,c=a.size||s;let u;t[6]!==o||t[7]!==a.size||t[8]!==a.variant||t[9]!==s||t[10]!==i?(u=nn(qc({variant:a.variant||i,size:a.size||s}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",o),t[6]=o,t[7]=a.size,t[8]=a.variant,t[9]=s,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==l||t[15]!==c||t[16]!==u?(d=h.jsx(Yc,{"data-slot":"toggle-group-item","data-variant":l,"data-size":c,className:u,...r,children:n}),t[12]=n,t[13]=r,t[14]=l,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Wc={value:()=>{}};function rn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function Zc(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=rn.prototype={constructor:zt,on:function(e,t){var n=this._,o=Zc(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=Kc(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Do(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Do(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function Kc(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Do(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Wc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var $n="http://www.w3.org/1999/xhtml";const $o={svg:"http://www.w3.org/2000/svg",xhtml:$n,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$o.hasOwnProperty(t)?{space:$o[t],local:e}:e}function Uc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$n&&t.documentElement.namespaceURI===$n?t.createElement(e):t.createElementNS(n,e)}}function Qc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function cs(e){var t=sn(e);return(t.local?Qc:Uc)(t)}function Jc(){}function to(e){return e==null?Jc:function(){return this.querySelector(e)}}function el(e){typeof e!="function"&&(e=to(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function tl(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nl(){return[]}function ls(e){return e==null?nl:function(){return this.querySelectorAll(e)}}function ol(e){return function(){return tl(e.apply(this,arguments))}}function rl(e){typeof e=="function"?e=ol(e):e=ls(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new le(o,r)}function us(e){return function(){return this.matches(e)}}function ds(e){return function(t){return t.matches(e)}}var sl=Array.prototype.find;function il(e){return function(){return sl.call(this.children,e)}}function al(){return this.firstElementChild}function cl(e){return this.select(e==null?al:il(typeof e=="function"?e:ds(e)))}var ll=Array.prototype.filter;function ul(){return Array.from(this.children)}function dl(e){return function(){return ll.call(this.children,e)}}function fl(e){return this.selectAll(e==null?ul:dl(typeof e=="function"?e:ds(e)))}function hl(e){typeof e!="function"&&(e=us(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new le(o,this._parents)}function fs(e){return new Array(e.length)}function gl(){return new le(this._enter||this._groups.map(fs),this._parents)}function Xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xt.prototype={constructor:Xt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ml(e){return function(){return e}}function pl(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new Xt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function yl(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,d=s.length,f=new Array(u),m;for(a=0;a<u;++a)(l=t[a])&&(f[a]=m=i.call(l,l.__data__,a,t)+"",c.has(m)?r[a]=l:c.set(m,l));for(a=0;a<d;++a)m=i.call(e,s[a],a,s)+"",(l=c.get(m))?(o[a]=l,l.__data__=s[a],c.delete(m)):n[a]=new Xt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function xl(e){return e.__data__}function vl(e,t){if(!arguments.length)return Array.from(this,xl);var n=t?yl:pl,o=this._parents,r=this._groups;typeof e!="function"&&(e=ml(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],d=r[c],f=d.length,m=wl(e.call(u,u&&u.__data__,c,o)),g=m.length,y=a[c]=new Array(g),v=i[c]=new Array(g),x=l[c]=new Array(f);n(u,d,y,v,x,m,t);for(var _=0,p=0,w,M;_<g;++_)if(w=y[_]){for(_>=p&&(p=_+1);!(M=v[p])&&++p<g;);w._next=M||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function wl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bl(){return new le(this._exit||this._groups.map(fs),this._parents)}function _l(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Sl(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),m,g=0;g<d;++g)(m=c[g]||u[g])&&(f[g]=m);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Nl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function El(e){e||(e=Cl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function Cl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ml(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Il(){return Array.from(this)}function kl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Pl(){let e=0;for(const t of this)++e;return e}function Tl(){return!this.node()}function jl(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Al(e){return function(){this.removeAttribute(e)}}function Dl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $l(e,t){return function(){this.setAttribute(e,t)}}function Ll(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ol(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Rl(e,t){var n=sn(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Dl:Al:typeof t=="function"?n.local?Ol:zl:n.local?Ll:$l)(n,t))}function hs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Hl(e){return function(){this.style.removeProperty(e)}}function Vl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Bl(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Fl(e,t,n){return arguments.length>1?this.each((t==null?Hl:typeof t=="function"?Bl:Vl)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||hs(e).getComputedStyle(e,null).getPropertyValue(t)}function Gl(e){return function(){delete this[e]}}function Xl(e,t){return function(){this[e]=t}}function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ql(e,t){return arguments.length>1?this.each((t==null?Gl:typeof t=="function"?Yl:Xl)(e,t)):this.node()[e]}function gs(e){return e.trim().split(/^|\s+/)}function no(e){return e.classList||new ms(e)}function ms(e){this._node=e,this._names=gs(e.getAttribute("class")||"")}ms.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ps(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ys(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Wl(e){return function(){ps(this,e)}}function Zl(e){return function(){ys(this,e)}}function Kl(e,t){return function(){(t.apply(this,arguments)?ps:ys)(this,e)}}function Ul(e,t){var n=gs(e+"");if(arguments.length<2){for(var o=no(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Kl:t?Wl:Zl)(n,t))}function Ql(){this.textContent=""}function Jl(e){return function(){this.textContent=e}}function eu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function tu(e){return arguments.length?this.each(e==null?Ql:(typeof e=="function"?eu:Jl)(e)):this.node().textContent}function nu(){this.innerHTML=""}function ou(e){return function(){this.innerHTML=e}}function ru(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function su(e){return arguments.length?this.each(e==null?nu:(typeof e=="function"?ru:ou)(e)):this.node().innerHTML}function iu(){this.nextSibling&&this.parentNode.appendChild(this)}function au(){return this.each(iu)}function cu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function lu(){return this.each(cu)}function uu(e){var t=typeof e=="function"?e:cs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function du(){return null}function fu(e,t){var n=typeof e=="function"?e:cs(e),o=t==null?du:typeof t=="function"?t:to(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function hu(){var e=this.parentNode;e&&e.removeChild(this)}function gu(){return this.each(hu)}function mu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yu(e){return this.select(e?pu:mu)}function xu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vu(e){return function(t){e.call(this,t,this.__data__)}}function wu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function bu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function _u(e,t,n){return function(){var o=this.__on,r,s=vu(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Su(e,t,n){var o=wu(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?_u:bu,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function xs(e,t,n){var o=hs(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Nu(e,t){return function(){return xs(this,e,t)}}function Eu(e,t){return function(){return xs(this,e,t.apply(this,arguments))}}function Cu(e,t){return this.each((typeof t=="function"?Eu:Nu)(e,t))}function*Mu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var vs=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],vs)}function Iu(){return this}le.prototype=St.prototype={constructor:le,select:el,selectAll:rl,selectChild:cl,selectChildren:fl,filter:hl,data:vl,enter:gl,exit:bl,join:_l,merge:Sl,selection:Iu,order:Nl,sort:El,call:Ml,nodes:Il,node:kl,size:Pl,empty:Tl,each:jl,attr:Rl,style:Fl,property:ql,classed:Ul,text:tu,html:su,raise:au,lower:lu,append:uu,insert:fu,remove:gu,clone:yu,datum:xu,on:Su,dispatch:Cu,[Symbol.iterator]:Mu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],vs)}function ku(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=ku(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Pu={passive:!1},mt={capture:!0,passive:!1};function _n(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function ws(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ke,mt);"onselectstart"in t?n.on("selectstart.drag",Ke,mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function bs(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,mt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const kt=e=>()=>e;function Ln(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Ln.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Tu(e){return!e.ctrlKey&&!e.button}function ju(){return this.parentNode}function Au(e,t){return t??{x:e.x,y:e.y}}function Du(){return navigator.maxTouchPoints||"ontouchstart"in this}function _s(){var e=Tu,t=ju,n=Au,o=Du,r={},s=rn("start","drag","end"),i=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",m).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Pu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,M){if(!(u||!e.call(this,w,M))){var S=p(this,t.call(this,w,M),w,M,"mouse");S&&(ce(w.view).on("mousemove.drag",g,mt).on("mouseup.drag",y,mt),ws(w.view),_n(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function g(w){if(Ke(w),!c){var M=w.clientX-a,S=w.clientY-l;c=M*M+S*S>d}r.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),bs(w.view,c),Ke(w),r.mouse("end",w)}function v(w,M){if(e.call(this,w,M)){var S=w.changedTouches,N=t.call(this,w,M),D=S.length,j,z;for(j=0;j<D;++j)(z=p(this,N,w,M,S[j].identifier,S[j]))&&(_n(w),z("start",w,S[j]))}}function x(w){var M=w.changedTouches,S=M.length,N,D;for(N=0;N<S;++N)(D=r[M[N].identifier])&&(Ke(w),D("drag",w,M[N]))}function _(w){var M=w.changedTouches,S=M.length,N,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(D=r[M[N].identifier])&&(_n(w),D("end",w,M[N]))}function p(w,M,S,N,D,j){var z=s.copy(),E=de(j||S,M),$,L,b;if((b=n.call(w,new Ln("beforestart",{sourceEvent:S,target:f,identifier:D,active:i,x:E[0],y:E[1],dx:0,dy:0,dispatch:z}),N))!=null)return $=b.x-E[0]||0,L=b.y-E[1]||0,function k(I,A,P){var T=E,O;switch(I){case"start":r[D]=k,O=i++;break;case"end":delete r[D],--i;case"drag":E=de(P||A,M),O=i;break}z.call(I,w,new Ln(I,{sourceEvent:A,subject:b,target:f,identifier:D,active:O,x:E[0]+$,y:E[1]+L,dx:E[0]-T[0],dy:E[1]-T[1],dispatch:z}),N)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:kt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:kt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:kt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:kt(!!w),f):o},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}var Lo=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ss(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*Lo,skewX:Math.atan(l)*Lo,scaleX:i,scaleY:a}}var Pt;function $u(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:Ss(t.a,t.b,t.c,t.d,t.e,t.f)}function Lu(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?zn:(e=e.matrix,Ss(e.a,e.b,e.c,e.d,e.e,e.f))}function Ns(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,d,f,m,g){if(c!==d||u!==f){var y=m.push("translate(",null,t,null,n);g.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d||f)&&m.push("translate("+d+t+f+n)}function i(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,m,g){if(c!==d||u!==f){var y=m.push(r(m)+"scale(",null,",",null,")");g.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d!==1||f!==1)&&m.push(r(m)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,f),i(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(m){for(var g=-1,y=f.length,v;++g<y;)d[(v=f[g]).i]=v.x(m);return d.join("")}}}var zu=Ns($u,"px, ","px)","deg)"),Ou=Ns(Lu,", ",")",")"),Ru=1e-12;function zo(e){return((e=Math.exp(e))+1/e)/2}function Hu(e){return((e=Math.exp(e))-1/e)/2}function Vu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ot=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],d=i[1],f=i[2],m=u-a,g=d-l,y=m*m+g*g,v,x;if(y<Ru)x=Math.log(f/c)/t,v=function(N){return[a+N*m,l+N*g,c*Math.exp(t*N*x)]};else{var _=Math.sqrt(y),p=(f*f-c*c+o*y)/(2*c*n*_),w=(f*f-c*c-o*y)/(2*f*n*_),M=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);x=(S-M)/t,v=function(N){var D=N*x,j=zo(M),z=c/(n*_)*(j*Vu(t*D+M)-Hu(M));return[a+z*m,l+z*g,c*j/zo(t*D+M)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Qe=0,dt=0,lt=0,Es=1e3,Yt,ft,qt=0,Ve=0,an=0,pt=typeof performance=="object"&&performance.now?performance:Date,Cs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Ve||(Cs(Bu),Ve=pt.now()+an)}function Bu(){Ve=0}function Wt(){this._call=this._time=this._next=null}Wt.prototype=Ms.prototype={constructor:Wt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:Yt=this,ft=this),this._call=e,this._time=n,On()},stop:function(){this._call&&(this._call=null,this._time=1/0,On())}};function Ms(e,t,n){var o=new Wt;return o.restart(e,t,n),o}function Fu(){oo(),++Qe;for(var e=Yt,t;e;)(t=Ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Oo(){Ve=(qt=pt.now())+an,Qe=dt=0;try{Fu()}finally{Qe=0,Xu(),Ve=0}}function Gu(){var e=pt.now(),t=e-qt;t>Es&&(an-=t,qt=e)}function Xu(){for(var e,t=Yt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Yt=n);ft=e,On(o)}function On(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Ve;t>24?(e<1/0&&(dt=setTimeout(Oo,e-pt.now()-an)),lt&&(lt=clearInterval(lt))):(lt||(qt=pt.now(),lt=setInterval(Gu,Es)),Qe=1,Cs(Oo))}}function Ro(e,t,n){var o=new Wt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Yu=rn("start","end","cancel","interrupt"),qu=[],Is=0,Ho=1,Rn=2,Rt=3,Vo=4,Hn=5,Ht=6;function cn(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Wu(e,n,{name:t,index:o,group:r,on:Yu,tween:qu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Is})}function ro(e,t){var n=ge(e,t);if(n.state>Is)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=ge(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Wu(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Ms(s,0,n.time);function s(c){n.state=Ho,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,d,f,m;if(n.state!==Ho)return l();for(u in o)if(m=o[u],m.name===n.name){if(m.state===Rt)return Ro(i);m.state===Vo?(m.state=Ht,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete o[u]):+u<t&&(m.state=Ht,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete o[u])}if(Ro(function(){n.state===Rt&&(n.state=Vo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Rt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(m=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=m);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Hn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Hn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ht,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Vt(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Rn&&o.state<Hn,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function Zu(e){return this.each(function(){Vt(this,e)})}function Ku(e,t){var n,o;return function(){var r=xe(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function Uu(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=xe(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function Qu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ge(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?Ku:Uu)(n,e,t))}function so(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ge(r,o).value[t]}}function ks(e,t){var n;return(typeof t=="number"?ze:t instanceof Po?ko:(n=Po(t))?(t=n,ko):uc)(e,t)}function Ju(e){return function(){this.removeAttribute(e)}}function ed(e){return function(){this.removeAttributeNS(e.space,e.local)}}function td(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function nd(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function od(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function rd(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function sd(e,t){var n=sn(e),o=n==="transform"?Ou:ks;return this.attrTween(e,typeof t=="function"?(n.local?rd:od)(n,o,so(this,"attr."+e,t)):t==null?(n.local?ed:Ju)(n):(n.local?nd:td)(n,o,t))}function id(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ad(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function cd(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&ad(e,s)),n}return r._value=t,r}function ld(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&id(e,s)),n}return r._value=t,r}function ud(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=sn(e);return this.tween(n,(o.local?cd:ld)(o,t))}function dd(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function fd(e,t){return t=+t,function(){ro(this,e).delay=t}}function hd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?dd:fd)(t,e)):ge(this.node(),t).delay}function gd(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function md(e,t){return t=+t,function(){xe(this,e).duration=t}}function pd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gd:md)(t,e)):ge(this.node(),t).duration}function yd(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function xd(e){var t=this._id;return arguments.length?this.each(yd(t,e)):ge(this.node(),t).ease}function vd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function wd(e){if(typeof e!="function")throw new Error;return this.each(vd(this._id,e))}function bd(e){typeof e!="function"&&(e=us(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function _d(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,d=i[a]=new Array(u),f,m=0;m<u;++m)(f=l[m]||c[m])&&(d[m]=f);for(;a<o;++a)i[a]=t[a];return new _e(i,this._parents,this._name,this._id)}function Sd(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Nd(e,t,n){var o,r,s=Sd(t)?ro:xe;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Ed(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(Nd(n,e,t))}function Cd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Md(){return this.on("end.remove",Cd(this._id))}function Id(e){var t=this._name,n=this._id;typeof e!="function"&&(e=to(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,cn(c[f],t,n,f,c,ge(u,n)));return new _e(s,this._parents,t,n)}function kd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ls(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),m,g=ge(u,n),y=0,v=f.length;y<v;++y)(m=f[y])&&cn(m,t,n,y,f,g);s.push(f),i.push(u)}return new _e(s,i,t,n)}var Pd=St.prototype.constructor;function Td(){return new Pd(this._groups,this._parents)}function jd(e,t){var n,o,r;return function(){var s=Ue(this,e),i=(this.style.removeProperty(e),Ue(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ps(e){return function(){this.style.removeProperty(e)}}function Ad(e,t,n){var o,r=n+"",s;return function(){var i=Ue(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Dd(e,t,n){var o,r,s;return function(){var i=Ue(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ue(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function $d(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=xe(this,e),c=l.on,u=l.value[s]==null?a||(a=Ps(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function Ld(e,t,n){var o=(e+="")=="transform"?zu:ks;return t==null?this.styleTween(e,jd(e,o)).on("end.style."+e,Ps(e)):typeof t=="function"?this.styleTween(e,Dd(e,o,so(this,"style."+e,t))).each($d(this._id,e)):this.styleTween(e,Ad(e,o,t),n).on("end.style."+e,null)}function zd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Od(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&zd(e,i,n)),o}return s._value=t,s}function Rd(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Od(e,t,n??""))}function Hd(e){return function(){this.textContent=e}}function Vd(e){return function(){var t=e(this);this.textContent=t??""}}function Bd(e){return this.tween("text",typeof e=="function"?Vd(so(this,"text",e)):Hd(e==null?"":e+""))}function Fd(e){return function(t){this.textContent=e.call(this,t)}}function Gd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Fd(r)),t}return o._value=e,o}function Xd(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Gd(e))}function Yd(){for(var e=this._name,t=this._id,n=Ts(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=ge(l,t);cn(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function qd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var Wd=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ts(){return++Wd}var we=St.prototype;_e.prototype={constructor:_e,select:Id,selectAll:kd,selectChild:we.selectChild,selectChildren:we.selectChildren,filter:bd,merge:_d,selection:Td,transition:Yd,call:we.call,nodes:we.nodes,node:we.node,size:we.size,empty:we.empty,each:we.each,on:Ed,attr:sd,attrTween:ud,style:Ld,styleTween:Rd,text:Bd,textTween:Xd,remove:Md,tween:Qu,delay:hd,duration:pd,ease:xd,easeVarying:wd,end:qd,[Symbol.iterator]:we[Symbol.iterator]};function Zd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kd={time:null,delay:0,duration:250,ease:Zd};function Ud(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Qd(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Ts(),(n=Kd).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&cn(l,e,t,c,i,n||Ud(l,t));return new _e(o,this._parents,e,t)}St.prototype.interrupt=Zu;St.prototype.transition=Qd;const Tt=e=>()=>e;function Jd(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ln=new be(1,0,0);js.prototype=be.prototype;function js(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ln;return e.__zoom}function Sn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function ef(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tf(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Bo(){return this.__zoom||ln}function nf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function of(){return navigator.maxTouchPoints||"ontouchstart"in this}function rf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function As(){var e=ef,t=tf,n=rf,o=nf,r=of,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ot,c=rn("start","zoom","end"),u,d,f,m=500,g=150,y=0,v=10;function x(b){b.property("__zoom",Bo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,k,I,A){var P=b.selection?b.selection():b;P.property("__zoom",Bo),b!==P?M(b,k,I,A):P.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},x.scaleBy=function(b,k,I,A){x.scaleTo(b,function(){var P=this.__zoom.k,T=typeof k=="function"?k.apply(this,arguments):k;return P*T},I,A)},x.scaleTo=function(b,k,I,A){x.transform(b,function(){var P=t.apply(this,arguments),T=this.__zoom,O=I==null?w(P):typeof I=="function"?I.apply(this,arguments):I,H=T.invert(O),R=typeof k=="function"?k.apply(this,arguments):k;return n(p(_(T,R),O,H),P,i)},I,A)},x.translateBy=function(b,k,I,A){x.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),i)},null,A)},x.translateTo=function(b,k,I,A,P){x.transform(b,function(){var T=t.apply(this,arguments),O=this.__zoom,H=A==null?w(T):typeof A=="function"?A.apply(this,arguments):A;return n(ln.translate(H[0],H[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof I=="function"?-I.apply(this,arguments):-I),T,i)},A,P)};function _(b,k){return k=Math.max(s[0],Math.min(s[1],k)),k===b.k?b:new be(k,b.x,b.y)}function p(b,k,I){var A=k[0]-I[0]*b.k,P=k[1]-I[1]*b.k;return A===b.x&&P===b.y?b:new be(b.k,A,P)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,k,I,A){b.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,T=arguments,O=S(P,T).event(A),H=t.apply(P,T),R=I==null?w(H):typeof I=="function"?I.apply(P,T):I,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=P.__zoom,q=typeof k=="function"?k.apply(P,T):k,K=l(B.invert(R).concat(F/B.k),q.invert(R).concat(F/q.k));return function(Y){if(Y===1)Y=q;else{var V=K(Y),X=F/V[2];Y=new be(X,R[0]-V[0]*X,R[1]-V[1]*X)}O.zoom(null,Y)}})}function S(b,k,I){return!I&&b.__zooming||new N(b,k)}function N(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();c.call(b,this.that,new Jd(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),k)}};function D(b,...k){if(!e.apply(this,arguments))return;var I=S(this,k).event(b),A=this.__zoom,P=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),T=de(b);if(I.wheel)(I.mouse[0][0]!==T[0]||I.mouse[0][1]!==T[1])&&(I.mouse[1]=A.invert(I.mouse[0]=T)),clearTimeout(I.wheel);else{if(A.k===P)return;I.mouse=[T,A.invert(T)],Vt(this),I.start()}ut(b),I.wheel=setTimeout(O,g),I.zoom("mouse",n(p(_(A,P),I.mouse[0],I.mouse[1]),I.extent,i));function O(){I.wheel=null,I.end()}}function j(b,...k){if(f||!e.apply(this,arguments))return;var I=b.currentTarget,A=S(this,k,!0).event(b),P=ce(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),T=de(b,I),O=b.clientX,H=b.clientY;ws(b.view),Sn(b),A.mouse=[T,this.__zoom.invert(T)],Vt(this),A.start();function R(B){if(ut(B),!A.moved){var q=B.clientX-O,K=B.clientY-H;A.moved=q*q+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,I),A.mouse[1]),A.extent,i))}function F(B){P.on("mousemove.zoom mouseup.zoom",null),bs(B.view,A.moved),ut(B),A.event(B).end()}}function z(b,...k){if(e.apply(this,arguments)){var I=this.__zoom,A=de(b.changedTouches?b.changedTouches[0]:b,this),P=I.invert(A),T=I.k*(b.shiftKey?.5:2),O=n(p(_(I,T),A,P),t.apply(this,k),i);ut(b),a>0?ce(this).transition().duration(a).call(M,O,A,b):ce(this).call(x.transform,O,A,b)}}function E(b,...k){if(e.apply(this,arguments)){var I=b.touches,A=I.length,P=S(this,k,b.changedTouches.length===A).event(b),T,O,H,R;for(Sn(b),O=0;O<A;++O)H=I[O],R=de(H,this),R=[R,this.__zoom.invert(R),H.identifier],P.touch0?!P.touch1&&P.touch0[2]!==R[2]&&(P.touch1=R,P.taps=0):(P.touch0=R,T=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(P.taps<2&&(d=R[0],u=setTimeout(function(){u=null},m)),Vt(this),P.start())}}function $(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,T,O,H,R;for(ut(b),T=0;T<P;++T)O=A[T],H=de(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=H:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=H);if(O=I.that.__zoom,I.touch1){var F=I.touch0[0],B=I.touch0[1],q=I.touch1[0],K=I.touch1[1],Y=(Y=q[0]-F[0])*Y+(Y=q[1]-F[1])*Y,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;O=_(O,Math.sqrt(Y/V)),H=[(F[0]+q[0])/2,(F[1]+q[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(I.touch0)H=I.touch0[0],R=I.touch0[1];else return;I.zoom("touch",n(p(O,H,R),I.extent,i))}}function L(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,T,O;for(Sn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},m),T=0;T<P;++T)O=A[T],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<v)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:Tt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Tt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Tt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Tt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],x):[s[0],s[1]]},x.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],x):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(y=(b=+b)*b,x):Math.sqrt(y)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ds=["Enter"," ","Escape"],$s={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const Ls={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Zt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Zt||(Zt={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Fo={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function zs(e){return e===null?null:e?"valid":"invalid"}const Os=e=>"id"in e&&"source"in e&&"target"in e,sf=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},af=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=i?Kt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return un(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return dn(n)},Et=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=un(n,Kt(r)),o=!0)}),o?dn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Mt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(i&&!d||f)continue;const m=u.width??c.width??c.initialWidth??null,g=u.height??c.height??c.initialHeight??null,y=vt(a,tt(c)),v=(m??0)*(g??0),x=s&&y>0;(!c.internals.handleBounds||x||y>=v||c.dragging)&&l.push(c)}return l},cf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function lf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function uf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=lf(e,i),l=Et(a),c=co(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Rs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let d=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const m=a.measured.width,g=a.measured.height;m&&g&&(d=[[l,c],[l+m,c+g]])}else a&&nt(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const f=nt(d)?Be(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:f.x-l+(i.measured.width??0)*u[0],y:f.y-c+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function df({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const m=s.has(f.id),g=!m&&f.parentId&&i.find(y=>y.id===f.parentId);(m||g)&&i.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=cf(i,l);for(const f of l)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:i};const d=await r({nodes:i,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:i}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Be=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hs(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Be(e,[[s,i],[s+o,i+r]],t)}const Go=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Vs=(e,t,n=15,o=40)=>{const r=Go(e.x,o,t.width-o)*n,s=Go(e.y,o,t.height-o)*n;return[r,s]},un=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),dn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Kt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Bs=(e,t)=>dn(un(Vn(e),Vn(t))),vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Xo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),ff=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Ct(a,i):a},Ut=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function hf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),s=Xe(e.left??e.x??0,t),i=Xe(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function gf(e,t,n,o,r,s){const{x:i,y:a}=Ut(e,[t,n,o]),{x:l,y:c}=Ut({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,s)=>{const i=hf(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,m=t/2-d*u,g=n/2-f*u,y=gf(e,m,g,u,t,n),v={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:u}},wt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Fs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Gs(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function mf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function pf(e){return{...$s,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=Mt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Ct(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Xs=e=>e?.getRootNode?.()||window?.document,yf=["INPUT","SELECT","TEXTAREA"];function Ys(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:yf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const qs=e=>"clientX"in e,he=(e,t)=>{const n=qs(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(i)}})};function Ws({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case G.Left:return[t-jt(t-o,s),n];case G.Right:return[t+jt(o-t,s),n];case G.Top:return[t,n-jt(n-r,s)];case G.Bottom:return[t,n+jt(r-n,s)]}}function Zs({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,curvature:i=.25}){const[a,l]=Wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=Wo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,f,m,g]=Ws({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,m,g]}function Ks({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function xf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function vf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=un(Kt(e),Kt(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return vt(i,dn(s))>0}const wf=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,bf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),_f=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||wf;let r;return Os(e)?r={...e}:r={...e,id:o(e)},bf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Us({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Ks({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Zo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},Sf=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nf({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:s,stepPosition:i}){const a=Zo[t],l=Zo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},d=Sf({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",m=d[f];let g=[],y,v;const x={x:0,y:0},_={x:0,y:0},[,,p,w]=Ks({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(y=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(y=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:y,y:c.y},{x:y,y:u.y}],N=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===m?g=f==="x"?S:N:g=f==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?g=a.x===m?N:S:g=a.y===m?S:N,t===o){const $=Math.abs(e[f]-n[f]);if($<=s){const L=Math.min(s-1,s-$);a[f]===m?x[f]=(c[f]>e[f]?-1:1)*L:_[f]=(u[f]>n[f]?-1:1)*L}}if(t!==o){const $=f==="x"?"y":"x",L=a[f]===l[$],b=c[$]>u[$],k=c[$]<u[$];(a[f]===1&&(!L&&b||L&&k)||a[f]!==1&&(!L&&k||L&&b))&&(g=f==="x"?S:N)}const D={x:c.x+x.x,y:c.y+x.y},j={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(D.x-g[0].x),Math.abs(j.x-g[0].x)),E=Math.max(Math.abs(D.y-g[0].y),Math.abs(j.y-g[0].y));z>=E?(y=(D.x+j.x)/2,v=g[0].y):(y=g[0].x,v=(D.y+j.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...g,{x:u.x+_.x,y:u.y+_.y},n],y,v,p,w]}function Ef(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,m,g,y]=Nf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,p)=>{let w="";return p>0&&p<d.length-1?w=Ef(d[p-1],_,d[p+1],i):w=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,m,g,y]}function Uo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Cf(e){const{sourceNode:t,targetNode:n}=e;if(!Uo(t)||!Uo(n))return null;const o=t.internals.handleBounds||Qo(t.handles),r=n.internals.handleBounds||Qo(n.handles),s=Jo(o?.source??[],e.sourceHandle),i=Jo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||G.Bottom,l=i?.position||G.Top,c=Fe(t,s,a),u=Fe(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Qo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=G.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case G.Top:return{x:r+i/2,y:s};case G.Right:return{x:r+i,y:s+a/2};case G.Bottom:return{x:r+i/2,y:s+a};case G.Left:return{x:r,y:s+a/2}}}function Jo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Mf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Fn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const Qs=1e3,If=10,uo={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},kf={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Pf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)go(r,e,t,o);else{const s=Nt(r,o.nodeOrigin),i=nt(r.extent)?r.extent:o.nodeExtent,a=Be(s,i,Ne(r));r.internals.positionAbsolute=a}}function Tf(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(kf,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?Qs:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Nt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,m=Be(d,f,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:m,handleBounds:Tf(c,u),z:Js(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&go(u,t,n,o,s)}return l}function jf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function go(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}jf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*If),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=s&&!ho(l)?Qs:0,{x:f,y:m,z:g}=Af(e,u,i,a,d,l),{positionAbsolute:y}=e.internals,v=f!==y.x||m!==y.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:m}:y,z:g}})}function Js(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Af(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Nt(e,n),u=nt(e.extent)?Be(c,e.extent,l):c;let d=Be({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Hs(d,l,t));const f=Js(e,r,s),m=t.internals.z??0;return{x:d.x,y:d.y,z:m>=f?m+1:f}}function mo(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??tt(a),c=Bs(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),d=a.origin??o,f=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,m=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,g=Math.max(u.width,Math.round(i.width)),y=Math.max(u.height,Math.round(i.height)),v=(g-u.width)*d[0],x=(y-u.height)*d[1];(f>0||m>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-m+x}}),n.get(l)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+m}})})),(u.width<i.width||u.height<i.height||f||m)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?d[0]*f-v:0),height:y+(m?d[1]*m-x:0)}})}),r}function Df(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const m of e.values()){const g=t.get(m.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const y=lo(m.nodeElement),v=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(v||!g.internals.handleBounds||m.force))){const _=m.nodeElement.getBoundingClientRect(),p=nt(g.extent)?g.extent:s;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Hs(w,y,t.get(g.parentId)):p&&(w=Be(w,p,y));const M={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:qo("source",m.nodeElement,_,d,g.id),target:qo("target",m.nodeElement,_,d,g.id)}}};t.set(g.id,M),g.parentId&&go(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:tt(M,r)}))}}if(f.length>0){const m=mo(f,t,n,r);c.push(...m)}return{changes:c,updatedInternals:l}}async function $f({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function er(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function ei(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;er("source",l,u,e,r,i),er("target",l,c,e,s,a),t.set(o.id,o)}}function ti(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:ti(n,t):!1}function tr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Lf(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!ti(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Nn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function zf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Ct(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Of({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,m=!1,g=!1,y=null;function v({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:M,nodeId:S,nodeClickDistance:N=0}){f=ce(w);function D({x:$,y:L}){const{nodeLookup:b,nodeExtent:k,snapGrid:I,snapToGrid:A,nodeOrigin:P,onNodeDrag:T,onSelectionDrag:O,onError:H,updateNodePositions:R}=t();s={x:$,y:L};let F=!1;const B=a.size>1,q=B&&k?Vn(Et(a)):null,K=B&&A?zf({dragItems:a,snapGrid:I,x:$,y:L}):null;for(const[Y,V]of a){if(!b.has(Y))continue;let X={x:$-V.distance.x,y:L-V.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:Ct(X,I));let Q=null;if(B&&k&&!V.extent&&q){const{positionAbsolute:Z}=V.internals,ee=Z.x-q.x+k[0][0],ne=Z.x+V.measured.width-q.x2+k[1][0],te=Z.y-q.y+k[0][1],ae=Z.y+V.measured.height-q.y2+k[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:W}=Rs({nodeId:Y,nextPosition:X,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:P,onError:H});F=F||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=W}if(g=g||F,!!F&&(R(a,!0),y&&(o||T||!S&&O))){const[Y,V]=Nn({nodeId:S,dragItems:a,nodeLookup:b});o?.(y,a,Y,V),T?.(y,Y,V),S||O?.(y,V)}}async function j(){if(!u)return;const{transform:$,panBy:L,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[I,A]=Vs(c,u,b);(I!==0||A!==0)&&(s.x=(s.x??0)-I/$[2],s.y=(s.y??0)-A/$[2],await L({x:I,y:A})&&D(s)),i=requestAnimationFrame(j)}function z($){const{nodeLookup:L,multiSelectionActive:b,nodesDraggable:k,transform:I,snapGrid:A,snapToGrid:P,selectNodesOnDrag:T,onNodeDragStart:O,onSelectionDragStart:H,unselectNodesAndEdges:R}=t();d=!0,(!T||!M)&&!b&&S&&(L.get(S)?.selected||R()),M&&T&&S&&e?.(S);const F=ht($.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:u});if(s=F,a=Lf(L,k,F,S),a.size>0&&(n||O||!S&&H)){const[B,q]=Nn({nodeId:S,dragItems:a,nodeLookup:L});n?.($.sourceEvent,a,B,q),O?.($.sourceEvent,B,q),S||H?.($.sourceEvent,q)}}const E=_s().clickDistance(N).on("start",$=>{const{domNode:L,nodeDragThreshold:b,transform:k,snapGrid:I,snapToGrid:A}=t();u=L?.getBoundingClientRect()||null,m=!1,g=!1,y=$.sourceEvent,b===0&&z($),s=ht($.sourceEvent,{transform:k,snapGrid:I,snapToGrid:A,containerBounds:u}),c=he($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:L,transform:b,snapGrid:k,snapToGrid:I,nodeDragThreshold:A,nodeLookup:P}=t(),T=ht($.sourceEvent,{transform:b,snapGrid:k,snapToGrid:I,containerBounds:u});if(y=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||S&&!P.has(S))&&(m=!0),!m){if(!l&&L&&d&&(l=!0,j()),!d){const O=he($.sourceEvent,u),H=O.x-c.x,R=O.y-c.y;Math.sqrt(H*H+R*R)>A&&z($)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&a&&d&&(c=he($.sourceEvent,u),D(T))}}).on("end",$=>{if(!(!d||m)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:L,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:I}=t();if(g&&(b(a,!1),g=!1),r||k||!S&&I){const[A,P]=Nn({nodeId:S,dragItems:a,nodeLookup:L,dragging:!1});r?.($.sourceEvent,a,A,P),k?.($.sourceEvent,A,P),S||I?.($.sourceEvent,P)}}}).filter($=>{const L=$.target;return!$.button&&(!_||!tr(L,`.${_}`,w))&&(!p||tr(L,p,w))});f.call(E)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function Rf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())vt(r,tt(s))>0&&o.push(s);return o}const Hf=250;function Vf(e,t,n,o){let r=[],s=1/0;const i=Rf(e,n,t+Hf);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Fe(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<s?(r=[{...c,x:u,y:d}],s=f):f===s&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ni(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Fe(i,l,l.position,!0)}:l}function oi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Bf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ri=()=>!0;function Ff(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:m,onConnectStart:g,onConnect:y,onConnectEnd:v,isValidConnection:x=ri,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:D}){const j=Xs(e.target);let z=0,E;const{x:$,y:L}=he(e),b=oi(s,D),k=a?.getBoundingClientRect();let I=!1;if(!k||!b)return;const A=ni(r,b,o,l,t);if(!A)return;let P=he(e,k),T=!1,O=null,H=!1,R=null;function F(){if(!u||!k)return;const[U,W]=Vs(P,k,S);f({x:U,y:W}),z=requestAnimationFrame(F)}const B={...A,nodeId:r,type:b,position:A.position},q=l.get(r);let Y={inProgress:!0,isValid:null,from:Fe(q,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:q,to:P,toHandle:null,toPosition:Fo[B.position],toNode:null,pointer:P};function V(){I=!0,p(Y),g?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&V();function X(U){if(!I){const{x:ae,y:Ee}=he(U),ve=ae-$,Le=Ee-L;if(!(ve*ve+Le*Le>N*N))return;V()}if(!M()||!B){Q(U);return}const W=w();P=he(U,k),E=Vf(Mt(P,W,!1,[1,1]),n,l,B),T||(F(),T=!0);const Z=si(U,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:j,lib:c,flowId:d,nodeLookup:l});R=Z.handleDomNode,O=Z.connection,H=Bf(!!E,Z.isValid);const ee=l.get(r),ne=ee?Fe(ee,B,G.Left,!0):Y.from,te={...Y,from:ne,isValid:H,to:Z.toHandle&&H?Ut({x:Z.toHandle.x,y:Z.toHandle.y},W):P,toHandle:Z.toHandle,toPosition:H&&Z.toHandle?Z.toHandle.position:Fo[B.position],toNode:Z.toHandle?l.get(Z.toHandle.nodeId):null,pointer:P};p(te),Y=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(I){(E||R)&&O&&H&&y?.(O);const{inProgress:W,...Z}=Y,ee={...Z,toPosition:Y.toHandle?Y.toPosition:null};v?.(U,ee),s&&_?.(U,ee)}m(),cancelAnimationFrame(z),T=!1,H=!1,O=null,R=null,j.removeEventListener("mousemove",X),j.removeEventListener("mouseup",Q),j.removeEventListener("touchmove",X),j.removeEventListener("touchend",Q)}}j.addEventListener("mousemove",X),j.addEventListener("mouseup",Q),j.addEventListener("touchmove",X),j.addEventListener("touchend",Q)}function si(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ri,nodeLookup:u}){const d=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:g}=he(e),y=i.elementFromPoint(m,g),v=y?.classList.contains(`${a}-flow__handle`)?y:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=oi(void 0,v),p=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!p||!_)return x;const N={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};x.connection=N;const j=M&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);x.isValid=j&&c(N),x.toHandle=ni(p,_,w,u,n,!0)}return x}const Xn={onPointerDown:Ff,isValid:si};function Gf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:m=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&wt()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,S*M);t.scaleTo(N)};let y=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[M[0]-y[0],M[1]-y[1]];y=M;const N=o()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),D={x:w[0]-S[0]*N,y:w[1]-S[1]*N},j=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},j,a)},_=As().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?g:null);r.call(_,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const fn=e=>({x:e.x,y:e.y,zoom:e.k}),En=({x:e,y:t,zoom:n})=>ln.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),ii=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Cn=(e,t=0,n=Xf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ai=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Yf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(qe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=de(u),x=ai(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let m=r===Re.Vertical?0:u.deltaX*f,g=r===Re.Horizontal?0:u.deltaY*f;!wt()&&u.shiftKey&&r!==Re.Vertical&&(m=u.deltaY*f,g=0),o.translateBy(n,-(m/d)*s,-(g/d)*s,{internal:!0});const y=fn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,y),e.panScrollTimeout=setTimeout(()=>{c?.(u,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,y))}}function qf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function Wf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=fn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Zf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&ii(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,fn(s.transform))}}function Kf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&ii(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=fn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function Uf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,m=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(qe(d,`${c}-flow__node`)||qe(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!s&&!n||i||u&&!g||qe(d,a)&&g||qe(d,l)&&(!g||r&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!m&&g||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&y}}function Qf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=As().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const m=f.on("wheel.zoom"),g=f.on("dblclick.zoom");d.wheelDelta(ai);function y(E,$){return f?new Promise(L=>{d?.interpolate($?.interpolate==="linear"?wn:Ot).transform(Cn(f,$?.duration,$?.ease,()=>L(!0)),E)}):Promise.resolve(!1)}function v({noWheelClassName:E,noPanClassName:$,onPaneContextMenu:L,userSelectionActive:b,panOnScroll:k,panOnDrag:I,panOnScrollMode:A,panOnScrollSpeed:P,preventScrolling:T,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:q,connectionInProgress:K,paneClickDistance:Y,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const X=k&&!F&&!b;d.clickDistance(V?1/0:!fe(Y)||Y<0?0:Y);const Q=X?Yf({zoomPanValues:c,noWheelClassName:E,d3Selection:f,d3Zoom:d,panOnScrollMode:A,panOnScrollSpeed:P,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):qf({noWheelClassName:E,preventScrolling:T,d3ZoomHandler:m});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const W=Wf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});d.on("start",W);const Z=Zf({zoomPanValues:c,panOnDrag:I,onPaneContextMenu:!!L,onPanZoom:s,onTransformChange:q});d.on("zoom",Z);const ee=Kf({zoomPanValues:c,panOnDrag:I,panOnScroll:k,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=Uf({zoomActivationKeyPressed:F,panOnDrag:I,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:R,zoomOnPinch:O,userSelectionActive:b,noPanClassName:$,noWheelClassName:E,lib:B,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(E,$,L){const b=En(E),k=d?.constrain()(b,$,L);return k&&await y(k),new Promise(I=>I(k))}async function p(E,$){const L=En(E);return await y(L,$),new Promise(b=>b(L))}function w(E){if(f){const $=En(E),L=f.property("__zoom");(L.k!==E.zoom||L.x!==E.x||L.y!==E.y)&&d?.transform(f,$,null,{sync:!0})}}function M(){const E=f?js(f.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function S(E,$){return f?new Promise(L=>{d?.interpolate($?.interpolate==="linear"?wn:Ot).scaleTo(Cn(f,$?.duration,$?.ease,()=>L(!0)),E)}):Promise.resolve(!1)}function N(E,$){return f?new Promise(L=>{d?.interpolate($?.interpolate==="linear"?wn:Ot).scaleBy(Cn(f,$?.duration,$?.ease,()=>L(!0)),E)}):Promise.resolve(!1)}function D(E){d?.scaleExtent(E)}function j(E){d?.translateExtent(E)}function z(E){const $=!fe(E)||E<0?0:E;d?.clickDistance($)}return{update:v,destroy:x,setViewport:p,setViewportConstrained:_,getViewport:M,scaleTo:S,scaleBy:N,setScaleExtent:D,setTranslateExtent:j,syncViewport:w,setClickDistance:z}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function Jf({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function nr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function or(e,t){return e?!t:t}function eh(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:m,ySnapped:g}=n,{minWidth:y,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:p,y:w,width:M,height:S,aspectRatio:N}=e;let D=Math.floor(u?m-e.pointerX:0),j=Math.floor(d?g-e.pointerY:0);const z=M+(l?-D:D),E=S+(c?-j:j),$=-s[0]*M,L=-s[1]*S;let b=At(z,y,v),k=At(E,x,_);if(i){let P=0,T=0;l&&D<0?P=Ce(p+D+$,i[0][0]):!l&&D>0&&(P=Me(p+z+$,i[1][0])),c&&j<0?T=Ce(w+j+L,i[0][1]):!c&&j>0&&(T=Me(w+E+L,i[1][1])),b=Math.max(b,P),k=Math.max(k,T)}if(a){let P=0,T=0;l&&D>0?P=Me(p+D,a[0][0]):!l&&D<0&&(P=Ce(p+z,a[1][0])),c&&j>0?T=Me(w+j,a[0][1]):!c&&j<0&&(T=Ce(w+E,a[1][1])),b=Math.max(b,P),k=Math.max(k,T)}if(r){if(u){const P=At(z/N,x,_)*N;if(b=Math.max(b,P),i){let T=0;!l&&!c||l&&!c&&f?T=Me(w+L+z/N,i[1][1])*N:T=Ce(w+L+(l?D:-D)/N,i[0][1])*N,b=Math.max(b,T)}if(a){let T=0;!l&&!c||l&&!c&&f?T=Ce(w+z/N,a[1][1])*N:T=Me(w+(l?D:-D)/N,a[0][1])*N,b=Math.max(b,T)}}if(d){const P=At(E*N,y,v)/N;if(k=Math.max(k,P),i){let T=0;!l&&!c||c&&!l&&f?T=Me(p+E*N+$,i[1][0])/N:T=Ce(p+(c?j:-j)*N+$,i[0][0])/N,k=Math.max(k,T)}if(a){let T=0;!l&&!c||c&&!l&&f?T=Ce(p+E*N,a[1][0])/N:T=Me(p+(c?j:-j)*N,a[0][0])/N,k=Math.max(k,T)}}}j=j+(j<0?k:-k),D=D+(D<0?b:-b),r&&(f?z>E*N?j=(or(l,c)?-D:D)/N:D=(or(l,c)?-j:j)*N:u?(j=D/N,c=l):(D=j*N,l=c));const I=l?p+D:p,A=c?w+j:w;return{width:M+(l?-D:D),height:S+(c?-j:j),x:s[0]*D*(l?-1:1)+I,y:s[1]*j*(c?-1:1)+A}}const ci={width:0,height:0,x:0,y:0},th={...ci,pointerX:0,pointerY:0,aspectRatio:1};function nh(e){return[[0,0],[e.measured.width,e.measured.height]]}function oh(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function rh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:nr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:m,onResize:g,onResizeEnd:y,shouldResize:v}){let x={...ci},_={...th};i={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:nr(c)};let p,w=null,M=[],S,N,D,j=!1;const z=_s().on("start",E=>{const{nodeLookup:$,transform:L,snapGrid:b,snapToGrid:k,nodeOrigin:I,paneDomNode:A}=n();if(p=$.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:T}=ht(E.sourceEvent,{transform:L,snapGrid:b,snapToGrid:k,containerBounds:w});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...x,pointerX:P,pointerY:T,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=$.get(p.parentId),N=S&&p.extent==="parent"?nh(S):void 0),M=[],D=void 0;for(const[O,H]of $)if(H.parentId===t&&(M.push({id:O,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const R=oh(H,p,H.origin??I);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}m?.(E,{...x})}).on("drag",E=>{const{transform:$,snapGrid:L,snapToGrid:b,nodeOrigin:k}=n(),I=ht(E.sourceEvent,{transform:$,snapGrid:L,snapToGrid:b,containerBounds:w}),A=[];if(!p)return;const{x:P,y:T,width:O,height:H}=x,R={},F=p.origin??k,{width:B,height:q,x:K,y:Y}=eh(_,i.controlDirection,I,i.boundaries,i.keepAspectRatio,F,N,D),V=B!==O,X=q!==H,Q=K!==P&&V,U=Y!==T&&X;if(!Q&&!U&&!V&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Y:x.y,x.x=R.x,x.y=R.y,M.length>0)){const ne=K-P,te=Y-T;for(const ae of M)ae.position={x:ae.position.x-ne+F[0]*(B-O),y:ae.position.y-te+F[1]*(q-H)},A.push(ae)}if((V||X)&&(R.width=V&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?q:x.height,x.width=R.width,x.height=R.height),S&&p.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const W=Jf({width:x.width,prevWidth:O,height:x.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...x,direction:W};v?.(E,Z)!==!1&&(j=!0,g?.(E,Z),o(R,A))}).on("end",E=>{j&&(y?.(E,{...x}),r?.({...x}),j=!1)});s.call(z)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const sh={},rr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const m=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,m))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(sh?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},ih=e=>e?rr(e):rr,{useDebugValue:ah}=ue,{useSyncExternalStoreWithSelector:ch}=ic,lh=e=>e;function li(e,t=lh,n){const o=ch(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ah(o),o}const sr=(e,t)=>{const n=ih(e),o=(r,s=t)=>li(n,r,s);return Object.assign(o,n),o},uh=(e,t)=>e?sr(e,t):sr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const hn=C.createContext(null),dh=hn.Provider,ui=pe.error001();function J(e,t){const n=C.useContext(hn);if(n===null)throw new Error(ui);return li(n,e,t)}function re(){const e=C.useContext(hn);if(e===null)throw new Error(ui);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},fh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},di="react-flow__node-desc",fi="react-flow__edge-desc",hh="react-flow__aria-live",gh=e=>e.ariaLiveMessage,mh=e=>e.ariaLabelConfig;function ph({rfId:e}){const t=J(gh);return h.jsx("div",{id:`${hh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:fh,children:t})}function yh({rfId:e,disableKeyboardA11y:t}){const n=J(mh);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${di}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${fi}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(ph,{rfId:e})]})}const gn=C.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});gn.displayName="Panel";function xh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(gn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const vh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function wh(e,t){return oe(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&oe(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function bh({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(vh,wh);return C.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const _h=e=>!!e.onSelectionChangeHandlers;function Sh({onSelectionChange:e}){const t=J(_h);return e||t?h.jsx(bh,{onSelectionChange:e}):null}const hi=[0,0],Nh={x:0,y:0,zoom:1},Eh=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ar=[...Eh,"rfId"],Ch=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),cr={translateExtent:yt,nodeOrigin:hi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Mh(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(Ch,oe),c=re();C.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=cr,a()}),[]);const u=C.useRef(cr);return C.useEffect(()=>{for(const d of ar){const f=e[d],m=u.current[d];f!==m&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?s(f):d==="nodeExtent"?i(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:pf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},ar.map(d=>e[d])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ih(e){const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function bt(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=C.useState(!1),r=C.useRef(!1),s=C.useRef(new Set([])),[i,a]=C.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,aP as A,at as $,j as c,aQ as L,ax as z,aR as G,aM as _,au as j,av as P,aS as w,aN as E,aT as H,aU as K,aV as U,aW as V,aX as W,aY as Z,aZ as Q,a_ as X,a$ as Y,c as R}from"./index-
|
|
1
|
+
import{r as i,aP as A,at as $,j as c,aQ as L,ax as z,aR as G,aM as _,au as j,av as P,aS as w,aN as E,aT as H,aU as K,aV as U,aW as V,aX as W,aY as Z,aZ as Q,a_ as X,a$ as Y,c as R}from"./index-HoRNE_Oj.js";import{c as q}from"./utils-oBMoklwF.js";var m="Popover",[b]=z(m,[A]),g=A(),[B,d]=b(m),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:a,modal:s=!1}=t,p=g(e),l=i.useRef(null),[u,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:a,caller:m});return c.jsx(L,{...p,children:c.jsx(B,{scope:e,contentId:G(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(C=>!C),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:s,children:o})})};N.displayName=m;var F="PopoverAnchor",J=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(F,o),a=g(o),{onCustomAnchorAdd:s,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(s(),()=>p()),[s,p]),c.jsx(w,{...a,...r,ref:e})});J.displayName=F;var S="PopoverTrigger",y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(S,o),a=g(o),s=_(e,n.triggerRef),p=c.jsx(j.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":I(n.open),...r,ref:s,onClick:P(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(w,{asChild:!0,...a,children:p})});y.displayName=S;var O="PopoverPortal",[ee,oe]=b(O,{forceMount:void 0}),M=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,a=d(O,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(E,{present:o||a.open,children:c.jsx(H,{asChild:!0,container:n,children:r})})})};M.displayName=O;var v="PopoverContent",D=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,a=d(v,t.__scopePopover);return c.jsx(E,{present:r||a.open,children:a.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});D.displayName=v;var te=V("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(null),n=_(e,r),a=i.useRef(!1);return i.useEffect(()=>{const s=r.current;if(s)return K(s)},[]),c.jsx(U,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(t.onCloseAutoFocus,s=>{s.preventDefault(),a.current||o.triggerRef.current?.focus()}),onPointerDownOutside:P(t.onPointerDownOutside,s=>{const p=s.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,u=p.button===2||l;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:P(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||o.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const s=a.target;o.triggerRef.current?.contains(s)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&n.current&&a.preventDefault()}})}),T=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:h,...x}=t,f=d(v,o),C=g(o);return W(),c.jsx(Z,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:a,children:c.jsx(Q,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(X,{"data-state":I(f.open),role:"dialog",id:f.contentId,...C,...x,ref:e,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),k="PopoverClose",ae=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(k,o);return c.jsx(j.button,{type:"button",...r,ref:e,onClick:P(t.onClick,()=>n.onOpenChange(!1))})});ae.displayName=k;var se="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=g(o);return c.jsx(Y,{...n,...r,ref:e})});ce.displayName=se;function I(t){return t?"open":"closed"}var ie=N,pe=y,le=M,ue=D;function ve(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function Pe(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(pe,{"data-slot":"popover-trigger",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(t){const e=R.c(12);let o,r,n,a;e[0]!==t?({className:o,align:n,sideOffset:a,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=a):(o=e[1],r=e[2],n=e[3],a=e[4]);const s=n===void 0?"center":n,p=a===void 0?4:a;let l;e[5]!==o?(l=q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let u;return e[7]!==s||e[8]!==r||e[9]!==p||e[10]!==l?(u=c.jsx(le,{children:c.jsx(ue,{"data-slot":"popover-content",align:s,sideOffset:p,className:l,...r})}),e[7]=s,e[8]=r,e[9]=p,e[10]=l,e[11]=u):u=e[11],u}export{ve as P,Pe as a,ge as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,h as i}from"./core-DHnxmqjc.js";import{X as s}from"./index-HoRNE_Oj.js";var g=o();const t=s(g);var a=i(t,{});a.registerLanguage=function(e,r){return t.register(r)};a.alias=function(e,r){return t.alias(e,r)};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a2 as U,j as t,c as F,a5 as W,r as M}from"./index-
|
|
1
|
+
import{a2 as U,j as t,c as F,a5 as W,r as M}from"./index-HoRNE_Oj.js";import{u as Y}from"./useQuery-CeKP0W1d.js";import{I as K}from"./icon-CzxeHWBl.js";import{e as J}from"./registry-utils-ulDDT0d8.js";import{C as P}from"./collection-display-button-CGcY64sw.js";import{C as X}from"./collection-search-C7G2QK3t.js";import{C as Z}from"./collection-table-wrapper-DdGYlOCN.js";import{E as H}from"./empty-state-CwiQR0XJ.js";import{I as ee}from"./use-connection-DbdMBpCj.js";import{C as te}from"./card-Cyeg7tCo.js";import{V as oe}from"./layout-DtdXVJv4.js";import{c as $}from"./utils-oBMoklwF.js";import{B as re}from"./badge-Ba7oj8pn.js";import{B as se}from"./button-8a8UdvyR.js";function ne(o){return o.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function ae(o){return o.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,a)=>a.includes("target=")?e.replace(/target="[^"]*"/gi,'target="_blank"'):`<a ${a} target="_blank" rel="noopener noreferrer">`)}function ie(o){let e=ne(o);return e=ae(e),e}function Ee({repository:o}){const e=o?J(o):null,{data:a,isLoading:c}=Y({queryKey:U.githubReadme(e?.owner,e?.repo),queryFn:async()=>{if(!e)return null;try{const s=await fetch(`https://api.github.com/repos/${e.owner}/${e.repo}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!s.ok){if(s.status===404)return null;throw new Error(`Failed to fetch README: ${s.statusText}`)}const m=await s.text();return ie(m)}catch(s){return console.error("Error fetching README:",s),null}},enabled:!!e&&!!o,staleTime:3600*1e3,gcTime:1440*60*1e3});return c?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(K,{name:"progress_activity",size:32,className:"animate-spin text-muted-foreground"})}):a?t.jsx("div",{className:"p-5 markdown-body",style:{backgroundColor:"transparent"},dangerouslySetInnerHTML:{__html:a}}):t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[t.jsx(K,{name:"description",size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),t.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]})}function Re(o){const e=F.c(39),{tools:a,connectionId:c,org:s,onToolClick:m,showToolbar:u,emptyMessage:f}=o,h=u===void 0?!0:u,p=f===void 0?"This connection doesn't have any tools yet.":f,d=W(),[n,A]=M.useState(""),[x,q]=M.useState("table"),[i,_]=M.useState("name"),[l,V]=M.useState("asc");let C;e[0]!==l||e[1]!==i?(C=r=>{i===r?(V(ue),l==="desc"&&_(void 0)):(_(r),V("asc"))},e[0]=l,e[1]=i,e[2]=C):C=e[2];const g=C;let S;e[3]!==c||e[4]!==d||e[5]!==m||e[6]!==s?(S=r=>{m?m(r):c&&s&&d({to:"/$org/mcps/$connectionId/$collectionName/$itemId",params:{org:s,connectionId:c,collectionName:"tools",itemId:encodeURIComponent(r.name)}})},e[3]=c,e[4]=d,e[5]=m,e[6]=s,e[7]=S):S=e[7];const T=S;let E;if(e[8]!==n||e[9]!==l||e[10]!==i||e[11]!==a){const r=!a||a.length===0?[]:n.trim()?(()=>{const L=n.toLowerCase();return a.filter(w=>w.name.toLowerCase().includes(L)||w.description&&w.description.toLowerCase().includes(L))})():a;E=!i||!l?r:[...r].sort((L,w)=>{const O=L[i]||"",Q=w[i]||"",B=String(O).localeCompare(String(Q));return l==="asc"?B:-B}),e[8]=n,e[9]=l,e[10]=i,e[11]=a,e[12]=E}else E=e[12];const v=E;let R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=[{id:"name",header:"Name",render:de,sortable:!0},{id:"description",header:"Description",render:me,cellClassName:"flex-1",sortable:!0}],e[13]=R):R=e[13];const z=R;let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=z.filter(ce).map(le),e[14]=k):k=e[14];const G=k;let b;e[15]!==g||e[16]!==h||e[17]!==l||e[18]!==i||e[19]!==x?(b=h&&t.jsx(oe,{children:t.jsx(P,{viewMode:x,onViewModeChange:q,sortKey:i,sortDirection:l,onSort:g,sortOptions:G})}),e[15]=g,e[16]=h,e[17]=l,e[18]=i,e[19]=x,e[20]=b):b=e[20];let I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=r=>{r.key==="Escape"&&(A(""),r.target.blur())},e[21]=I):I=e[21];let j;e[22]!==n?(j=t.jsx(X,{value:n,onChange:A,placeholder:"Search tools...",onKeyDown:I}),e[22]=n,e[23]=j):j=e[23];let y;e[24]!==p||e[25]!==g||e[26]!==T||e[27]!==n||e[28]!==l||e[29]!==i||e[30]!==v||e[31]!==x?(y=x==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:v.length===0?t.jsx(H,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":p}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:v.map(r=>t.jsx(te,{className:"cursor-pointer transition-colors",onClick:()=>T(r),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ee,{icon:null,name:r.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:r.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:r.description||"No description"})]})]})},r.name))})}):t.jsx(Z,{columns:z,data:v,isLoading:!1,sortKey:i,sortDirection:l,onSort:g,onRowClick:r=>T(r),emptyState:t.jsx(H,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":p})}),e[24]=p,e[25]=g,e[26]=T,e[27]=n,e[28]=l,e[29]=i,e[30]=v,e[31]=x,e[32]=y):y=e[32];let N;e[33]!==j||e[34]!==y?(N=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[j,y]}),e[33]=j,e[34]=y,e[35]=N):N=e[35];let D;return e[36]!==N||e[37]!==b?(D=t.jsxs(t.Fragment,{children:[b,N]}),e[36]=N,e[37]=b,e[38]=D):D=e[38],D}function le(o){return{id:o.id,label:typeof o.header=="string"?o.header:o.id}}function ce(o){return o.sortable}function me(o){return t.jsx("span",{className:"text-sm text-foreground",children:o.description||"—"})}function de(o){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:o.name})}function ue(o){return o==="asc"?"desc":o==="desc"?null:"asc"}function ke(o){const e=F.c(12),{tabs:a,activeTab:c,onTabChange:s,className:m}=o;let u;e[0]!==m?(u=$("flex items-center gap-2 overflow-x-auto no-scrollbar",m),e[0]=m,e[1]=u):u=e[1];let f;if(e[2]!==c||e[3]!==s||e[4]!==a){let p;e[6]!==c||e[7]!==s?(p=d=>{const n=c===d.id;return t.jsxs(se,{variant:"outline",size:"sm",onClick:()=>s(d.id),className:$("h-8 rounded-lg border border-transparent bg-transparent px-3 py-1 hover:bg-muted",n&&"bg-muted border-input text-foreground font-medium",!n&&"text-muted-foreground font-normal"),children:[d.label,d.count!==void 0&&t.jsx(re,{variant:"secondary",className:$("ml-2 h-5 min-w-5 px-1 rounded-full text-[10px] font-mono",n?"bg-background text-foreground":"bg-muted-foreground/10 text-muted-foreground"),children:d.count})]},d.id)},e[6]=c,e[7]=s,e[8]=p):p=e[8],f=a.map(p),e[2]=c,e[3]=s,e[4]=a,e[5]=f}else f=e[5];let h;return e[9]!==u||e[10]!==f?(h=t.jsx("div",{className:u,children:f}),e[9]=u,e[10]=f,e[11]=h):h=e[11],h}export{ke as R,Re as T,Ee as a};
|