@xopcai/xopc 0.0.177 → 0.0.178
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/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-Wu2ikfbM.js → activity-store-BzGX__8I.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0_biISn.js → agent-avatar-dicebear-BzxntcaZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-TpIpJk59.js → agents-DC9F12Kw.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DljBt-N5.js → api-hi6f2Xtp.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CKoZRi7Y.js → app-management-settings-panel-fTY1F7ac.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DOdXhNDo.js → appearance-settings-BZ-IxQfB.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cxbn5hy8.js → apps-page-5bKr05Fa.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D18gyP76.js → archive-plugin-ZSLLG8wB.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CZh9fc8u.js → attachment-load-D4YktqIF.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DKrVoiiK.js → automation-suggestion-card-B7mxFRtf.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DYv16QMU.js → automations-page-Dg6dmt5g.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DdSyGL6M.js → binary-plugins-BIkPxfxj.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BOpNApiX.js → block-editor-Q3v_YQom.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DlcqaGu1.js → browser-settings-page-BHoo6Rpq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-C0SnSj_R.js → browser-workflow-inputs-M5lTEW1I.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CzlzH7HA.js → browser-workflows-page-B3T1KYk4.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-QPX4wsGZ.js → capabilities-settings-panel-BlsqN8Fu.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-RM6S7ES5.js → capability-presets-api-DE09c0VB.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DmCeusO8.js → capability-presets-settings-panel-DJeT8_B4.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-B4sha-30.js → channel-recipient-api-CFR5FBfS.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-HcKoP1wm.js → channels-settings-C4VVjYEm.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BPsKIyoM.js → connector-logo-B1mD-3pM.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DwbThFvd.js → connectors-page-DNcrDThX.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DjL1GWON.js → desktop-pet-B1urphOZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-u_abAXh7.js → desktop-pet-settings-DTL6J3EP.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BoZGualI.js → directory-picker-path-field-BYQJ2XUS.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-s3gn3f9h.js → dreaming-settings-BXcb8fwx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DIbMngCF.js → extension-debug-page-O1Xu1r4Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D94f2bWQ.js → extension-page-C2Jraq8l.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B7TI13ex.js → extension-settings-page-DcXQDTpG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Do77rV8R.js → gateway-config-api-DmPIZrvg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Dt1PNJmb.js → gateway-settings-DmObBx9b.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-WaXTw3fi.js → gateway-startup-retry-BZEkOdPm.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DEiOOLGU.js → goal-create-dialog-BRhmmBe9.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-C1Qj4o1K.js → goal-detail-page-C1k7_s_O.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-BL0fAEns.js → goals-config-api-Fwu1wjEP.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-qJDcEDzc.js → goals-page-hOu9uA3q.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-DV3ZlrdI.js → goals-settings-DY-JjvHz.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C3kzg6ai.js → heartbeat-settings-BtKu2NWT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BgISY8i-.js → image-generation-api-05Gg8wsU.js} +1 -1
- package/dist/gateway/static/root/assets/{index-C1h0zkNo.js → index-C0CGebQ1.js} +7 -7
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-0KSmaPu0.js → keyboard-shortcuts-settings-CfmDR9Sc.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DcD4mVId.js → local-app-workbench-page-EjsNT7nJ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BMrU8u7w.js → local-apps-page-Df8BW1A_.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DVGhFXRz.js → locale-store-CTwSy7yW.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CW5m9Cov.js → logs-page-Dswjlraa.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BVqbtN9o.js → markdown-split-B3FvKbaP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dr_wtkNJ.js → media-plugins-DsjrvvB6.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-BWZRXsq6.js → notes-page-tuzIwy3c.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-DdnwNz9x.js → notes-workbench-DSh3-hMY.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-DWWgy0bF.js → page-tabs-ke9s4nYi.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Bnfs93ZP.js → preview-open-alternatives-Cp1eI4S9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BR7QFmT-.js → product-open-page-dXQCMAtH.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-B8GeS4dl.js → project-detail-page-D0QPRHR_.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DOeu1Hk_.js → projects-page-CI5Vz62F.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-De94rxnE.js → remote-access-hub-S1jpzBS5.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BzS-rRTP.js → save-bar-controls-Bl30zjHc.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cl2IIDAN.js → schedule-field-DqhmXQKo.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BjKjp5eZ.js → schema-form-DkUCy6vf.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-A7p8G0OJ.js → sessions-page-CTm66k7h.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BSDNBfHn.js → settings-form-section-C6ZbNpdy.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BD4peoAv.js → settings-loading-skeleton-Bk58_cr7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-S-P3U7at.js → settings-page-k8iE_NdX.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BQTLh-86.js → settings-page-layout-DgFSya2e.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-W3p6kNyA.js → setup-status-panel-B_KDlyZA.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DQjMxyvw.js → share-preview-page-CV7nL_J9.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Xo3N99PO.js → shares-settings-DK6XK95e.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C019Ml5q.js → skills-page-BGHvVbay.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CXnpudm6.js → skills-page.utils-kahBIHg0.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BhFwdYJP.js → system-settings-panel-JV3-MG5F.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DQI-HPL-.js → theme-store-DFLyzoLO.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-C0DCya4U.js → time-picker-XwpxdZFr.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C-M3Fv2N.js → typed-models-lib-60Aqo-UJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-Bndq4y4I.js → use-channel-catalog-CnTkHDnw.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-fYBzpus-.js → user-context-page-DBCMk-Vn.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-p_g4UI1-.js → voice-api-key-field-CNa8qUgS.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DI0gCZRw.js → work-discovery-page-C1UIdsCl.js} +1 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +1 -0
- package/dist/gateway/static/root/assets/{work-page-Z-nUaS_n.js → work-page-D5qYmCTq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CHEXVvhH.js → workflow-run-setup-panel-yV_x595t.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BDfwnM-Y.js → workflows-page-yrK17ZZ5.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +3 -0
- package/dist/src/agent/embedded/run-for-session.js +18 -5
- package/dist/src/agent/embedded/run-turn.js +6 -3
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/provider-auth-service.js +3 -0
- package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
- package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
- package/dist/src/session/store.d.ts +2 -0
- package/dist/src/session/store.js +30 -0
- package/package.json +3 -11
- package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +0 -1
- package/dist/gateway/static/root/assets/index-Da36E3WH.css +0 -1
- package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +0 -1
package/dist/gateway/static/root/assets/{workflows-page-BDfwnM-Y.js → workflows-page-yrK17ZZ5.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,f as o,l as s,t as c}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as l}from"./check-DUBLcKHA.js";import{t as u}from"./cn-JdwAhgNB.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-r8L6Ur3A.js";import{l as p,n as m}from"./locale-store-DVGhFXRz.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{$ as g,A as _,Ac as v,Al as y,As as b,B as x,Bs as S,C,Cl as w,Ct as T,D as E,E as D,F as O,Gl as k,Gr as A,Gs as j,I as M,Ic as N,Is as P,J as F,Ji as I,Jl as L,K as R,Ks as z,L as B,M as V,Mc as H,N as U,Ns as ee,Nu as W,O as te,P as ne,Q as re,Ql as G,Rr as ie,S as K,St as ae,Su as oe,T as se,To as ce,Tt as le,W as ue,X as q,Y as de,Yc as fe,Z as pe,Zl as me,_u as he,at as ge,cl as _e,ct as ve,dl as ye,dt as be,et as xe,ft as Se,g as J,gc as Ce,gt as we,hl as Te,hu as Ee,is as De,it as Oe,j as ke,lt as Ae,lu as je,mt as Me,nl as Ne,ns as Pe,nt as Fe,oa as Ie,oc as Le,pl as Re,pt as ze,q as Be,ro as Ve,rt as He,st as Ue,ts as We,ut as Ge,vt as Ke,w as qe,ws as Je,wt as Ye,wu as Xe,xc as Ze,xt as Qe,yc as $e,yl as et,yt as tt,z as nt}from"./index-C1h0zkNo.js";import{t as rt}from"./with-selector-aYPsXwdl.js";import{t as it}from"./page-tabs-DWWgy0bF.js";import{i as at,r as ot,t as st}from"./workflow-run-setup-panel-CHEXVvhH.js";var Y=e(t(),1),X=r(),ct=[`queued`,`running`,`succeeded`,`attention`],lt=new Set([`failed`,`timeout`,`cancelled`]);function ut(e){return e.metadata?.sessionKey?.trim()||null}function dt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function ft(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function pt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||ft(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||ft(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?dt(n,t):null}function mt(e,t=90){return pt(e,t)??dt(e.title?.trim()||e.definitionId,t)}function ht(e,t=44){return dt(e.title?.trim()||e.definitionId,t)}function gt(e,t){let n=t.trim().toLowerCase();return n?[pt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function _t(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!g(e,t.triggerFilter??`all`)?!1:gt(e,t.searchQuery))}function vt(e){return e.completedAtMs??e.createdAtMs}function yt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:lt.has(e.status)?`attention`:null}function bt(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>vt(t)-vt(e))}function xt(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=yt(r,t);e&&n[e].push(r)}return ct.map(e=>{if(e===`succeeded`){let t=bt(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:bt(e,n[e])}})}function St(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return tt(-r,`second`,n);let i=Math.round(r/60);if(i<60)return tt(-i,`minute`,n);let a=Math.round(i/60);return a<48?tt(-a,`hour`,n):tt(-Math.round(a/24),`day`,n)}function Ct(e){return e.status===`queued`||e.status===`running`}function wt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var Z=i(),Tt=(0,Y.memo)(function(e){let t=(0,X.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:l,onRetry:d}=e,p=f(r).workflows,[m,h]=(0,Y.useState)(!1),g;t[0]===n?g=t[1]:(g=ut(n),t[0]=n,t[1]=g);let _=!g,v;t[2]===n?v=t[3]:(v=Ct(n),t[2]=n,t[3]=v);let y=v,x=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=F(y?a-T:n.metrics.durationMs),D=q(p.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=mt(n),t[7]=n,t[8]=O);let A=O,M;t[9]===n?M=t[10]:(M=ht(n),t[9]=n,t[10]=M);let N=M,P;t[11]!==s||t[12]!==n?(P=()=>{s(n)},t[11]=s,t[12]=n,t[13]=P):P=t[13];let I=P,L;t[14]!==_||t[15]!==c||t[16]!==n?(L=()=>{_||c(n)},t[14]=_,t[15]=c,t[16]=n,t[17]=L):L=t[17];let R=L,z=o&&`ring-1 ring-accent/30`,B;t[18]===z?B=t[19]:(B=u(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,z,`hover:bg-surface-hover`),t[18]=z,t[19]=B);let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=u(`w-full text-left`,Je.focusRingPanel),t[20]=V):V=t[20];let H;t[21]===A?H=t[22]:(H=(0,Z.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:A}),t[21]=A,t[22]=H);let U;t[23]===N?U=t[24]:(U=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:N}),t[23]=N,t[24]=U);let ee;t[25]!==H||t[26]!==U?(ee=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[H,U]}),t[25]=H,t[26]=U,t[27]=ee):ee=t[27];let W;t[28]===n.status?W=t[29]:(W=u(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,xe(n.status)),t[28]=n.status,t[29]=W);let te;t[30]!==i||t[31]!==a||t[32]!==T?(te=St(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=te):te=t[33];let ne;t[34]===te?ne=t[35]:(ne=(0,Z.jsx)(`span`,{children:te}),t[34]=te,t[35]=ne);let re=E===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:q(p.taskElapsed,{duration:E})})]}),G;t[36]!==ne||t[37]!==re?(G=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[ne,re]}),t[36]=ne,t[37]=re,t[38]=G):G=t[38];let ie=n.metrics.artifactCount>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,K=o?(0,Z.jsx)(`span`,{className:`font-medium text-accent-fg`,children:p.taskOpenDetails}):null,ae;t[39]!==ie||t[40]!==K?(ae=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[ie,K]}),t[39]=ie,t[40]=K,t[41]=ae):ae=t[41];let oe=_&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,se;t[42]===oe?se=t[43]:(se=u(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Je.focusRingPanel,oe),t[42]=oe,t[43]=se);let ce;t[44]!==_||t[45]!==R||t[46]!==p.continueInChat||t[47]!==se?(ce=(0,Z.jsx)(`button`,{type:`button`,className:se,disabled:_,onClick:R,children:p.continueInChat}),t[44]=_,t[45]=R,t[46]=p.continueInChat,t[47]=se,t[48]=ce):ce=t[48];let le;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(le=u(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Je.focusRingPanel),t[49]=le):le=t[49];let ue;t[50]!==I||t[51]!==p.taskOpenDetails?(ue=(0,Z.jsx)(`button`,{type:`button`,className:le,onClick:I,children:p.taskOpenDetails}),t[50]=I,t[51]=p.taskOpenDetails,t[52]=ue):ue=t[52];let de;t[53]!==ce||t[54]!==ue?(de=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ce,ue]}),t[53]=ce,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]===h?fe=t[57]:(fe=()=>h(Dt),t[56]=h,t[57]=fe);let pe;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[58]=pe):pe=t[58];let me;t[59]!==p.taskActionsAria||t[60]!==m||t[61]!==fe?(me=(0,Z.jsx)(b,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":p.taskActionsAria,"aria-expanded":m,onClick:fe,children:pe}),t[59]=p.taskActionsAria,t[60]=m,t[61]=fe,t[62]=me):me=t[62];let he;t[63]!==y||t[64]!==p.cancel||t[65]!==p.rerun||t[66]!==p.taskCloseMenu||t[67]!==m||t[68]!==l||t[69]!==d||t[70]!==n||t[71]!==h?(he=m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":p.taskCloseMenu,onClick:()=>h(!1)}),(0,Z.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[y?(0,Z.jsx)(Et,{label:p.cancel,tone:`danger`,onClick:()=>{h(!1),l(n.id)}}):null,wt(n)?(0,Z.jsx)(Et,{label:p.rerun,onClick:()=>{h(!1),d(n.id)}}):null]})]}):null,t[63]=y,t[64]=p.cancel,t[65]=p.rerun,t[66]=p.taskCloseMenu,t[67]=m,t[68]=l,t[69]=d,t[70]=n,t[71]=h,t[72]=he):he=t[72];let ge;return t[73]!==me||t[74]!==he?(ge=(0,Z.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[me,he]}),t[73]=me,t[74]=he,t[75]=ge):ge=t[75],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:I,"aria-label":`${p.taskOpenDetails}: ${A}`,"aria-current":o?`true`:void 0,className:V,children:[(0,Z.jsxs)(`div`,{className:`pr-7`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[ee,(0,Z.jsx)(`span`,{className:W,children:p.status[n.status]??n.status})]}),G]}),x?(0,Z.jsxs)(`div`,{className:`mt-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:q(p.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{children:[C,`%`]})]}),(0,Z.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,ae,w?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}),q(p.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),de,ge]})});function Et(e){let t=(0,X.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=u(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(0,Z.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l):l=t[7],l}function Dt(e){return!e}function Ot(e,t){return t.boardColumns[e]}var kt=(0,Y.memo)(function(e){let t=(0,X.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:l,onCancelRun:d,onRetryRun:p}=e,m=f(r).workflows,[h,g]=(0,Y.useState)(!1),_=n.id===`succeeded`,v=_?5:n.runs.length,y;t[0]!==v||t[1]!==n.runs||t[2]!==h||t[3]!==_?(y=_&&!h?n.runs.slice(0,v):n.runs,t[0]=v,t[1]=n.runs,t[2]=h,t[3]=_,t[4]=y):y=t[4];let x=y,S=_&&n.runs.length>5&&!h,C=_&&h,w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=u(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=w):w=t[5];let T;t[6]===n.runs.length?T=t[7]:(T=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&x.length===0?(0,Z.jsx)(At,{}):x.length===0?(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:m.boardColumnEmpty}):x.map(e=>(0,Z.jsx)(Tt,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:d,onRetry:p},e.id)),O=S?(0,Z.jsx)(b,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!0),children:q(m.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,A;t[9]!==C||t[10]!==m||t[11]!==g?(A=C?(0,Z.jsx)(b,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!1),children:m.boardCollapseSucceeded}):null,t[9]=C,t[10]=m,t[11]=g,t[12]=A):A=t[12];let j;return t[13]!==D||t[14]!==O||t[15]!==A?(j=(0,Z.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[D,O,A]}),t[13]=D,t[14]=O,t[15]=A,t[16]=j):j=t[16],(0,Z.jsxs)(`section`,{className:w,"aria-label":Ot(n.id,m),children:[(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Ot(n.id,m)}),T]}),E]}),j]})});function At(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ve,{className:`size-4/5`}),(0,Z.jsx)(Ve,{className:`mt-2 h-3 w-24`})]}),(0,Z.jsx)(Ve,{className:`h-5 w-14 rounded-full`})]}),(0,Z.jsx)(Ve,{className:`mt-3 h-3 w-2/3`}),(0,Z.jsx)(Ve,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function jt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Mt=(0,Y.memo)(function(e){let t=(0,X.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(Nt),t[0]=n,t[1]=g);let _=g,v=(0,Y.useRef)(null),y=(0,Y.useRef)(null),[x,S]=(0,Y.useState)(Pt),[C,w]=(0,Y.useState)(!1),T,E;t[2]===_?(T=t[3],E=t[4]):(T=()=>{if(!_)return;let e=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(e)},E=[_],t[2]=_,t[3]=T,t[4]=E),(0,Y.useEffect)(T,E);let D;t[5]!==x||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(D=xt(_t(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),x),t[5]=x,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=D):D=t[10];let O=D,k=O.reduce(Ft,0),A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,w(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=A):A=t[11];let j=A,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{if(e.button!==0||jt(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=M):M=t[12];let N=M,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,w(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=P):P=t[13];let F=P;if(!u&&k===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,Z.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,Z.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Z.jsx)(b,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let I=C?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,w(!1))},t[27]=z):z=t[27];let B;if(t[28]!==O||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==x||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==x||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,Z.jsx)(kt,{column:e,language:r,localeTag:i,nowMs:x,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=x,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=O.map(e),t[28]=O,t[29]=r,t[30]=u,t[31]=i,t[32]=x,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,Z.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,Z.jsx)(`div`,{ref:v,className:R,onPointerDown:N,onPointerMove:F,onPointerUp:j,onPointerCancel:j,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function Nt(e){return e.status===`queued`||e.status===`running`}function Pt(){return Date.now()}function Ft(e,t){return e+t.runs.length}function It(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?q(t.agentScaleExact,{count:n.min}):q(t.agentScaleRange,{min:n.min,max:n.max}):null}function Lt(e){let t=(0,X.c)(73),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s}=e,c;t[0]!==n||t[1]!==r?(c=we(n,r),t[0]=n,t[1]=r,t[2]=c):c=t[2];let l=c,d;t[3]!==n||t[4]!==i?(d=It(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=u(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,Z.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,Z.jsx)(oe,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=u(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Je.focusRingPanel),t[17]=x):x=t[17];let C;t[18]!==n||t[19]!==o?(C=()=>o(n),t[18]=n,t[19]=o,t[20]=C):C=t[20];let w;t[21]!==n.title||t[22]!==C?(w=(0,Z.jsx)(`button`,{type:`button`,className:x,onClick:C,children:n.title}),t[21]=n.title,t[22]=C,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==y?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,w]}),t[24]=w,t[25]=y,t[26]=T):T=t[26];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[27]!==n||t[28]!==s?(D=()=>s(n),t[27]=n,t[28]=s,t[29]=D):D=t[29];let O;t[30]===p?O=t[31]:(O=p?(0,Z.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}):(0,Z.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),t[30]=p,t[31]=O);let k;t[32]!==E||t[33]!==D||t[34]!==O?(k=(0,Z.jsx)(b,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:O}),t[32]=E,t[33]=D,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==T||t[37]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,k]}),t[36]=T,t[37]=k,t[38]=A):A=t[38];let j=l.whenToUse||l.description||n.description,M;t[39]===j?M=t[40]:(M=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:j}),t[39]=j,t[40]=M);let P;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Te,{className:`size-3`,"aria-hidden":!0}),t[41]=P):P=t[41];let F;t[42]!==n.phases.length||t[43]!==i.phaseCount?(F=q(i.phaseCount,{count:n.phases.length}),t[42]=n.phases.length,t[43]=i.phaseCount,t[44]=F):F=t[44];let I;t[45]===F?I=t[46]:(I=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[45]=F,t[46]=I);let L;t[47]===f?L=t[48]:(L=f?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(S,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[47]=f,t[48]=L);let R;t[49]!==I||t[50]!==L?(R=(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[49]=I,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==n||t[53]!==a?(z=()=>a(n),t[52]=n,t[53]=a,t[54]=z):z=t[54];let B;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[55]=B):B=t[55];let V;t[56]!==i.configureAndRun||t[57]!==z?(V=(0,Z.jsxs)(b,{type:`button`,variant:`primary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[56]=i.configureAndRun,t[57]=z,t[58]=V):V=t[58];let U;t[59]!==n||t[60]!==o?(U=()=>o(n),t[59]=n,t[60]=o,t[61]=U):U=t[61];let ee;t[62]!==i.viewDetails||t[63]!==U?(ee=(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:U,children:i.viewDetails}),t[62]=i.viewDetails,t[63]=U,t[64]=ee):ee=t[64];let W;t[65]!==V||t[66]!==ee?(W=(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,ee]}),t[65]=V,t[66]=ee,t[67]=W):W=t[67];let te;return t[68]!==A||t[69]!==M||t[70]!==R||t[71]!==W?(te=(0,Z.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[A,M,R,W]}),t[68]=A,t[69]=M,t[70]=R,t[71]=W,t[72]=te):te=t[72],te}function Rt(e){let t=(0,X.c)(44),{definitions:n,runs:r,language:i,onPick:a,onDetail:o,onEdit:s}=e,[c]=(0,Y.useState)(Vt),l=f(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(`all`),[_,v]=(0,Y.useState)(`all`),y;t[0]!==h||t[1]!==n||t[2]!==p||t[3]!==_?(y=Be(n,p,h,_),t[0]=h,t[1]=n,t[2]=p,t[3]=_,t[4]=y):y=t[4];let b=y,x;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(Bt)),i=new Set;x=[...r].sort(zt).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=x}else x=t[7];let S=x,C=q(l.workflowCount,{count:b.length}),w;t[8]===C?w=t[9]:(w=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[8]=C,t[9]=w);let T=l.sourceFilterAria,E;t[10]!==l.sources||t[11]!==v||t[12]!==_?(E=be.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:u(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,_===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Je.focusRingPanel),"aria-pressed":_===e,onClick:()=>v(e),children:l.sources[e]},e)),t[10]=l.sources,t[11]=v,t[12]=_,t[13]=E):E=t[13];let D;t[14]!==l.sourceFilterAria||t[15]!==E?(D=(0,Z.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":T,children:E}),t[14]=l.sourceFilterAria,t[15]=E,t[16]=D):D=t[16];let O=l.categoryFilterAria,k;t[17]===g?k=t[18]:(k=e=>g(e.target.value),t[17]=g,t[18]=k);let A;t[19]===l.categories?A=t[20]:(A=Ue.map(e=>(0,Z.jsx)(De,{value:e,children:l.categories[e]},e)),t[19]=l.categories,t[20]=A);let j;t[21]!==h||t[22]!==l.categoryFilterAria||t[23]!==k||t[24]!==A?(j=(0,Z.jsx)(Pe,{value:h,"aria-label":O,onChange:k,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:A}),t[21]=h,t[22]=l.categoryFilterAria,t[23]=k,t[24]=A,t[25]=j):j=t[25];let M;t[26]!==j||t[27]!==D?(M=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[D,j]}),t[26]=j,t[27]=D,t[28]=M):M=t[28];let N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=N):N=t[29];let P;t[30]===m?P=t[31]:(P=e=>m(e.target.value),t[30]=m,t[31]=P);let F=l.librarySearchPlaceholder,I;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(I=u(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,Je.focusRingPanel),t[32]=I):I=t[32];let L;t[33]!==l.librarySearchPlaceholder||t[34]!==p||t[35]!==P?(L=(0,Z.jsxs)(`div`,{className:`relative max-w-xl`,children:[N,(0,Z.jsx)(`input`,{value:p,onChange:P,placeholder:F,className:I})]}),t[33]=l.librarySearchPlaceholder,t[34]=p,t[35]=P,t[36]=L):L=t[36];let R;return t[37]!==b||t[38]!==l||t[39]!==i||t[40]!==o||t[41]!==s||t[42]!==a?(R=b.length===0?(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l.noDefinitions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:l.noDefinitionsHint})]}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:b.map(e=>(0,Z.jsx)(Lt,{definition:e,language:i,labels:l,onPick:a,onDetail:o,onEdit:s},e.id))}),t[37]=b,t[38]=l,t[39]=i,t[40]=o,t[41]=s,t[42]=a,t[43]=R):R=t[43],(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[S.length>0&&!p&&h===`all`&&_===`all`?(0,Z.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,Z.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:l.recentlyUsed}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:S.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,Z.jsxs)(`button`,{type:`button`,className:u(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,Je.focusRingPanel),onClick:()=>a(t),children:[(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:St(n,c,d)})]}),(0,Z.jsx)(H,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:l.allWorkflows}),w]}),M]}),L]}),R]})]})}function zt(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function Bt(e){return[e.id,e]}function Vt(){return Date.now()}var Ht=(0,Y.memo)(function(e){let t=(0,X.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:l}=e,d,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O,k;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){m=f(r).workflows;let e;t[22]===n?e=t[23]:(e=Ct(n),t[22]=n,t[23]=e),d=e;let s;t[24]===n?s=t[25]:(s=wt(n),t[24]=n,t[25]=s),h=s;let c;t[26]===n?c=t[27]:(c=ut(n),t[26]=n,t[27]=c),p=!!c;let l=n.startedAtMs??n.createdAtMs,b=F(d?a-l:n.metrics.durationMs),A;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(A=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=A):A=t[30];let M=A;x=`group border-b border-edge-subtle last:border-b-0`,y=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,O=`button`,t[31]!==o||t[32]!==n?(k=()=>o(n),t[31]=o,t[32]=n,t[33]=k):k=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(_=u(`min-w-0 flex-1 text-left`,Je.focusRingPanel),t[34]=_):_=t[34];let N=m.taskOpenDetails,P;t[35]===n?P=t[36]:(P=mt(n),t[35]=n,t[36]=P),v=`${N}: ${P}`,E=`flex min-w-0 items-start gap-3`;let I;t[37]===n.status?I=t[38]:(I=u(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,xe(n.status)),t[37]=n.status,t[38]=I),D=(0,Z.jsx)(`span`,{className:I,children:m.status[n.status]??n.status}),g=`min-w-0 flex-1`;let L;t[39]===n?L=t[40]:(L=mt(n),t[39]=n,t[40]=L),t[41]===L?S=t[42]:(S=(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:L}),t[41]=L,t[42]=S);let R;t[43]===n?R=t[44]:(R=ht(n),t[43]=n,t[44]=R);let z;t[45]===R?z=t[46]:(z=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:R}),t[45]=R,t[46]=z);let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=B):B=t[47];let V;t[48]!==i||t[49]!==a||t[50]!==l?(V=St(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=V):V=t[51];let H;t[52]===V?H=t[53]:(H=(0,Z.jsx)(`span`,{children:V}),t[52]=V,t[53]=H);let U=b===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:q(m.taskElapsed,{duration:b})})]});t[54]!==z||t[55]!==H||t[56]!==U?(C=(0,Z.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[z,B,H,U]}),t[54]=z,t[55]=H,t[56]=U,t[57]=C):C=t[57],w=d&&n.metrics.agentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,Z.jsx)(`span`,{children:q(m.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[M,`%`]})]}),(0,Z.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,Z.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${M}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}),q(m.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=k}else d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],O=t[20],k=t[21];let A;t[58]!==g||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(A=(0,Z.jsxs)(`span`,{className:g,children:[S,C,w,T]}),t[58]=g,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=A):A=t[63];let M;t[64]!==A||t[65]!==E||t[66]!==D?(M=(0,Z.jsxs)(`div`,{className:E,children:[D,A]}),t[64]=A,t[65]=E,t[66]=D,t[67]=M):M=t[67];let N;t[68]!==_||t[69]!==v||t[70]!==M||t[71]!==O||t[72]!==k?(N=(0,Z.jsx)(`button`,{type:O,onClick:k,className:_,"aria-label":v,children:M}),t[68]=_,t[69]=v,t[70]=M,t[71]=O,t[72]=k,t[73]=N):N=t[73];let P;t[74]!==m.rerun||t[75]!==l||t[76]!==h||t[77]!==n.id?(P=h?(0,Z.jsx)(b,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:m.rerun}):null,t[74]=m.rerun,t[75]=l,t[76]=h,t[77]=n.id,t[78]=P):P=t[78];let I;t[79]!==p||t[80]!==m.continueInChat||t[81]!==s||t[82]!==n?(I=n.status===`succeeded`&&p?(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:m.continueInChat}):null,t[79]=p,t[80]=m.continueInChat,t[81]=s,t[82]=n,t[83]=I):I=t[83];let L;t[84]!==d||t[85]!==m.cancel||t[86]!==c||t[87]!==n.id?(L=d?(0,Z.jsx)(b,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:m.cancel}):null,t[84]=d,t[85]=m.cancel,t[86]=c,t[87]=n.id,t[88]=L):L=t[88];let R;t[89]!==o||t[90]!==n?(R=()=>o(n),t[89]=o,t[90]=n,t[91]=R):R=t[91];let z;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),t[92]=z):z=t[92];let B;t[93]!==m.taskOpenDetails||t[94]!==R?(B=(0,Z.jsx)(b,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":m.taskOpenDetails,onClick:R,children:z}),t[93]=m.taskOpenDetails,t[94]=R,t[95]=B):B=t[95];let V;t[96]!==P||t[97]!==I||t[98]!==L||t[99]!==B?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[P,I,L,B]}),t[96]=P,t[97]=I,t[98]=L,t[99]=B,t[100]=V):V=t[100];let H;t[101]!==y||t[102]!==N||t[103]!==V?(H=(0,Z.jsxs)(`div`,{className:y,children:[N,V]}),t[101]=y,t[102]=N,t[103]=V,t[104]=H):H=t[104];let U;return t[105]!==x||t[106]!==H?(U=(0,Z.jsx)(`article`,{className:x,children:H}),t[105]=x,t[106]=H,t[107]=U):U=t[107],U});function Ut(e){let t=(0,X.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:l,refreshAll:u}=n,d;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==l?(d=s.length>1?(0,Z.jsx)(Pe,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:s.map(e=>(0,Z.jsx)(De,{value:e.id,children:ie(e,f(i).agentsSettings)},e.id))}):null,t[0]=s,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=l,t[5]=d):d=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[6]=p):p=t[6];let m;t[7]===r.addWorkflow?m=t[8]:(m=(0,Z.jsx)(b,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Z.jsxs)(c,{to:`/workflows/new`,children:[p,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=m);let h;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(h=(0,Z.jsx)(Ie,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==d||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[d,m,h]}),t[13]=d,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}var Wt=new Set([`failed`,`timeout`,`cancelled`]),Gt=[{id:`runs`,icon:_e},{id:`library`,icon:ye}],Kt={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function qt(e){return Wt.has(e.status)}function Jt(e,t){return t===`all`?!0:t===`attention`?qt(e):e.status===t}function Yt(e){return[...e].sort((e,t)=>{let n=(Kt[e.status]??4)-(Kt[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function Xt(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Zt(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ve,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ve,{className:`h-4 w-52 max-w-full`}),(0,Z.jsx)(Ve,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,Z.jsx)(Ve,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Qt(e){let t=(0,X.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,runs:c,searchQuery:l,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:x,setPageTab:S,runLayout:C,setRunLayout:w,openRunDetails:T,openRunInChat:E,openDefinitionDetails:D,openWorkflowEditor:O,startWorkflow:k,actionError:A,loading:M,error:N,cancelRun:P,retryRun:F}=n,I=ce(nn),L=ce(tn),R=Date.now(),z=Yt(c.filter(qt)),B;t[0]===g?B=t[1]:(B=e=>Jt(e,g),t[0]=g,t[1]=B);let V=Yt(_t(c,{searchQuery:l,workflowFilterId:f,triggerFilter:m}).filter(B)),H=!!(l||f||m!==`all`||g!==`all`),U,W;if(t[2]!==L||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==x||t[8]!==I||t[9]!==n?(U=()=>{if(!o){L();return}return I({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,Z.jsx)(Ut,{vm:n})}),()=>L()},W=[L,o,a.librarySubtitle,a.runsSubtitle,a.title,x,I,n],t[2]=L,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=x,t[8]=I,t[9]=n,t[10]=U,t[11]=W):(U=t[10],W=t[11]),(0,Y.useLayoutEffect)(U,W),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(y,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,Z.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let te=a.pageTabsAria,ne=Gt.map(e=>{let{id:t,icon:n}=e;return(0,Z.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":x===t,"aria-controls":`workflow-panel-${t}`,tabIndex:x===t?0:-1,draggable:!1,className:u(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>S(t),onKeyDown:e=>{let n=Xt(e.key,t);n&&(e.preventDefault(),S(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,Z.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&z.length>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:z.length}):null]},t)}),re;t[20]!==a.pageTabsAria||t[21]!==ne?(re=(0,Z.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":te,role:`tablist`,children:ne}),t[20]=a.pageTabsAria,t[21]=ne,t[22]=re):re=t[22];let G;t[23]!==A||t[24]!==N?(G=A??N?(0,Z.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:A??N}):null,t[23]=A,t[24]=N,t[25]=G):G=t[25];let ie=x===`runs`?(0,Z.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[z.length>0?(0,Z.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:z.length})]}),(0,Z.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[mt(z[0]),` · `,St(z[0].completedAtMs??z[0].createdAtMs,R,i)]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>T(z[0]),children:a.attentionView}),(0,Z.jsx)(b,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void F(z[0].id),children:a.rerun})]})]})}):null,(0,Z.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,Z.jsx)(Ce,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{value:l,onChange:e=>d(e.target.value),placeholder:a.runsSearchPlaceholder,className:u(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,Je.focusRingPanel)})]}),(0,Z.jsx)(Pe,{value:g,"aria-label":a.statusFilterAria,onChange:e=>_(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,Z.jsx)(De,{value:e,children:a.runStatuses[e]},e))}),(0,Z.jsxs)(Pe,{value:m,"aria-label":a.boardTriggerFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(De,{value:`all`,children:a.boardTriggerFilterAll}),(0,Z.jsx)(De,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,Z.jsx)(De,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,Z.jsx)(De,{value:`chat`,children:a.boardTriggerFilterChat}),(0,Z.jsx)(De,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,Z.jsxs)(Pe,{value:f,"aria-label":a.boardWorkflowFilterAria,onChange:e=>p(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(De,{value:``,children:a.boardWorkflowFilterAll}),s.map(en)]}),H?(0,Z.jsxs)(b,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,Z.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,Z.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,Z.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Je.focusRingPanel),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:[(0,Z.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,Z.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Je.focusRingPanel),"aria-pressed":C===`board`,onClick:()=>w(`board`),children:[(0,Z.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),C===`list`?(0,Z.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,Z.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:V.length})]}),M&&V.length===0?Array.from({length:4}).map($t):V.length>0?V.map(e=>(0,Z.jsx)(Ht,{run:e,language:r,localeTag:i,nowMs:R,onOpen:T,onOpenChat:E,onCancel:e=>void P(e),onRetry:e=>void F(e)},e.id)):(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(y,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:H?a.noRunResultsTitle:a.noRunsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:H?a.noRunResultsHint:a.noRunsStartHint}),(0,Z.jsx)(b,{type:`button`,variant:H?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:H?v:()=>S(`library`),children:H?a.clearFilters:a.chooseWorkflow})]})]}):(0,Z.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,Z.jsx)(Mt,{runs:V,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:M,onOpenRun:T,onOpenRunChat:E,onCancelRun:e=>void P(e),onRetryRun:e=>void F(e),onStart:()=>S(`library`)})})]}):(0,Z.jsxs)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`h2`,{id:`workflow-library-heading`,className:`text-base font-semibold text-fg`,children:a.libraryTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.libraryDescription})]}),(0,Z.jsx)(Rt,{definitions:s,runs:c,language:r,onPick:k,onDetail:D,onEdit:O})]}),K;return t[26]!==G||t[27]!==ie||t[28]!==re?(K=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[re,G,ie]})}),t[26]=G,t[27]=ie,t[28]=re,t[29]=K):K=t[29],K}function $t(e,t){return(0,Z.jsx)(Zt,{},t)}function en(e){return(0,Z.jsx)(De,{value:e.id,children:e.title},e.id)}function tn(e){return e.clearPageHeader}function nn(e){return e.setPageHeader}function rn(){let e=(0,X.c)(114),t=m(ln),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,a=p(cn),c=!!a,l=s(),[u,d]=o(),g;e[2]===u?g=e[3]:(g=u.get(`q`)??``,e[2]=u,e[3]=g);let v=g,y;e[4]===u?y=e[5]:(y=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=y);let b=y,x;e[6]===u?x=e[7]:(x=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=x);let S=x,w,T,E,D;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;w=u.get(`agent`)?.trim()??``,T=ve.has(n)?n:`runs`,E=Ge.has(r)?r:`list`,D=ze.has(t)?t:`all`,e[8]=u,e[9]=w,e[10]=T,e[11]=E,e[12]=D}else w=e[9],T=e[10],E=e[11],D=e[12];let k=D,[j,M]=(0,Y.useState)(null),N;e[13]!==c||e[14]!==a?(N=c?[`workflow-agents`,a]:null,e[13]=c,e[14]=a,e[15]=N):N=e[15];let P;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(P={revalidateOnFocus:!1},e[16]=P):P=e[16];let F=h(N,A,P),I;bb0:{let e=F.data?.agents??[];if(w&&(e.length===0||e.some(e=>e.id===w))){I=w;break bb0}I=F.data?.defaultId}let L=I,R;e[17]!==c||e[18]!==a?(R=c?[`workflow-definitions`,a]:null,e[17]=c,e[18]=a,e[19]=R):R=e[19];let z;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[20]=z):z=e[20];let B=h(R,_,z),H;e[21]!==c||e[22]!==L||e[23]!==a?(H=c&&L?[`workflow-runs`,a,L]:null,e[21]=c,e[22]=L,e[23]=a,e[24]=H):H=e[24];let U;e[25]===L?U=e[26]:(U=()=>V(100,{ownerAgentId:L}),e[25]=L,e[26]=U);let ee;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={revalidateOnFocus:!1,refreshInterval:on},e[27]=ee):ee=e[27];let W=h(H,U,ee),te;e[28]===B.data?te=e[29]:(te=B.data??[],e[28]=B.data,e[29]=te);let ne=te,re;e[30]===W.data?re=e[31]:(re=W.data??[],e[30]=W.data,e[31]=re);let G=re,ie;e[32]===d?ie=e[33]:(ie=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[32]=d,e[33]=ie);let K=ie,ae;e[34]===K?ae=e[35]:(ae=e=>K(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[34]=K,e[35]=ae);let oe=ae,se;e[36]===K?se=e[37]:(se=e=>K(t=>{let n=e.trim();n?t.set(ge,n):t.delete(ge)}),e[36]=K,e[37]=se);let ce=se,le;e[38]===K?le=e[39]:(le=e=>K(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[38]=K,e[39]=le);let ue=le,q;e[40]===K?q=e[41]:(q=e=>K(t=>{e&&e!==`all`?t.set(Me,e):t.delete(Me)}),e[40]=K,e[41]=q);let de=q,fe;e[42]===K?fe=e[43]:(fe=e=>K(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[42]=K,e[43]=fe);let pe=fe,me;e[44]===K?me=e[45]:(me=e=>K(t=>{e===`list`?t.delete(Ae):t.set(Ae,e)}),e[44]=K,e[45]=me);let he=me,_e;e[46]===K?_e=e[47]:(_e=e=>K(t=>{e===`all`?t.delete(Se):t.set(Se,e)}),e[46]=K,e[47]=_e);let ye=_e,be;e[48]===K?be=e[49]:(be=()=>K(an),e[48]=K,e[49]=be);let xe=be,J=L?`?agentId=${encodeURIComponent(L)}`:``,Ce;e[50]!==l||e[51]!==J?(Ce=e=>l(`/workflows/${e.id}${J}`),e[50]=l,e[51]=J,e[52]=Ce):Ce=e[52];let we=Ce,Te=we,Ee;e[53]!==l||e[54]!==L||e[55]!==J?(Ee=e=>{l(e.metadata.source===`user`?`/workflows/${e.id}/edit${J}`:`/workflows/new?copy=${encodeURIComponent(e.id)}${L?`&agentId=${encodeURIComponent(L)}`:``}`)},e[53]=l,e[54]=L,e[55]=J,e[56]=Ee):Ee=e[56];let De=Ee,Oe;e[57]!==l||e[58]!==J?(Oe=e=>l(`/workflows/runs/${e.id}${J}`),e[57]=l,e[58]=J,e[59]=Oe):Oe=e[59];let ke=Oe,je;e[60]===l?je=e[61]:(je=e=>{let t=ut(e);t&&l(Fe(t))},e[60]=l,e[61]=je);let Ne=je,Pe;e[62]!==r.cancelFailed||e[63]!==L||e[64]!==W?(Pe=async e=>{try{await C(e,{ownerAgentId:L}),await W.mutate()}catch(e){let t=e;M(t instanceof Error?t.message:r.cancelFailed)}},e[62]=r.cancelFailed,e[63]=L,e[64]=W,e[65]=Pe):Pe=e[65];let Ie=Pe,Le;e[66]!==r.retryFailed||e[67]!==l||e[68]!==L||e[69]!==J?(Le=async e=>{try{l(`/workflows/runs/${(await O(e,{ownerAgentId:L})).runId}${J}`)}catch(e){let t=e;M(t instanceof Error?t.message:r.retryFailed)}},e[66]=r.retryFailed,e[67]=l,e[68]=L,e[69]=J,e[70]=Le):Le=e[70];let Re=Le,Be,Ve;e[71]===W?(Be=e[72],Ve=e[73]):(Be=()=>{let e=()=>void W.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},Ve=[W],e[71]=W,e[72]=Be,e[73]=Ve),(0,Y.useEffect)(Be,Ve);let He;e[74]!==F||e[75]!==B||e[76]!==W?(He=()=>{Promise.all([F.mutate(),B.mutate(),W.mutate()])},e[74]=F,e[75]=B,e[76]=W,e[77]=He):He=e[77];let Ue=He,We=F.isLoading||B.isLoading||W.isLoading,Ke=F.error?.message??B.error?.message??W.error?.message??null,qe;e[78]===F.data?.agents?qe=e[79]:(qe=F.data?.agents??[],e[78]=F.data?.agents,e[79]=qe);let Je;return e[80]!==j||e[81]!==Ie||e[82]!==xe||e[83]!==ne||e[84]!==Ke||e[85]!==c||e[86]!==r||e[87]!==t||e[88]!==We||e[89]!==i||e[90]!==we||e[91]!==ke||e[92]!==Ne||e[93]!==De||e[94]!==L||e[95]!==T||e[96]!==Ue||e[97]!==Re||e[98]!==E||e[99]!==G||e[100]!==v||e[101]!==ce||e[102]!==pe||e[103]!==he||e[104]!==oe||e[105]!==ye||e[106]!==de||e[107]!==ue||e[108]!==Te||e[109]!==k||e[110]!==qe||e[111]!==S||e[112]!==b?(Je={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:v,setSearchQuery:oe,ownerAgentId:L,agentOptions:qe,setOwnerAgentId:ce,workflowFilterId:b,setWorkflowFilterId:ue,triggerFilter:S,setTriggerFilter:de,statusFilter:k,setStatusFilter:ye,clearRunFilters:xe,pageTab:T,setPageTab:pe,runLayout:E,setRunLayout:he,definitions:ne,runs:G,openDefinitionDetails:we,startWorkflow:Te,openWorkflowEditor:De,openRunDetails:ke,openRunInChat:Ne,actionError:j,loading:We,error:Ke,refreshAll:Ue,cancelRun:Ie,retryRun:Re},e[80]=j,e[81]=Ie,e[82]=xe,e[83]=ne,e[84]=Ke,e[85]=c,e[86]=r,e[87]=t,e[88]=We,e[89]=i,e[90]=we,e[91]=ke,e[92]=Ne,e[93]=De,e[94]=L,e[95]=T,e[96]=Ue,e[97]=Re,e[98]=E,e[99]=G,e[100]=v,e[101]=ce,e[102]=pe,e[103]=he,e[104]=oe,e[105]=ye,e[106]=de,e[107]=ue,e[108]=Te,e[109]=k,e[110]=qe,e[111]=S,e[112]=b,e[113]=Je):Je=e[113],Je}function an(e){e.delete(`q`),e.delete(`wf`),e.delete(Me),e.delete(Se)}function on(e){return e?.some(sn)?3e3:0}function sn(e){return e.status===`queued`||e.status===`running`}function cn(e){return e.token}function ln(e){return e.language}function un(){let e=(0,X.c)(2),t=rn(),n;return e[0]===t?n=e[1]:(n=(0,Z.jsx)(Qt,{vm:t}),e[0]=t,e[1]=n),n}function dn(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=dn(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var fn={value:()=>{}};function pn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new mn(n)}function mn(e){this._=e}function hn(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}mn.prototype=pn.prototype={constructor:mn,on:function(e,t){var n=this._,r=hn(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=gn(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=_n(n[i],e.name,t);else if(t==null)for(i in n)n[i]=_n(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new mn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function gn(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function _n(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=fn,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var vn={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function yn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),vn.hasOwnProperty(t)?{space:vn[t],local:e}:e}function bn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function xn(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Sn(e){var t=yn(e);return(t.local?xn:bn)(t)}function Cn(){}function wn(e){return e==null?Cn:function(){return this.querySelector(e)}}function Tn(e){typeof e!=`function`&&(e=wn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new pi(r,this._parents)}function En(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Dn(){return[]}function On(e){return e==null?Dn:function(){return this.querySelectorAll(e)}}function kn(e){return function(){return En(e.apply(this,arguments))}}function An(e){e=typeof e==`function`?kn(e):On(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new pi(r,i)}function jn(e){return function(){return this.matches(e)}}function Mn(e){return function(t){return t.matches(e)}}var Nn=Array.prototype.find;function Pn(e){return function(){return Nn.call(this.children,e)}}function Fn(){return this.firstElementChild}function In(e){return this.select(e==null?Fn:Pn(typeof e==`function`?e:Mn(e)))}var Ln=Array.prototype.filter;function Rn(){return Array.from(this.children)}function zn(e){return function(){return Ln.call(this.children,e)}}function Bn(e){return this.selectAll(e==null?Rn:zn(typeof e==`function`?e:Mn(e)))}function Vn(e){typeof e!=`function`&&(e=jn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new pi(r,this._parents)}function Hn(e){return Array(e.length)}function Un(){return new pi(this._enter||this._groups.map(Hn),this._parents)}function Wn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wn.prototype={constructor:Wn,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 Gn(e){return function(){return e}}function Kn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Wn(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function qn(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Wn(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Jn(e){return e.__data__}function Yn(e,t){if(!arguments.length)return Array.from(this,Jn);var n=t?qn:Kn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Gn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Xn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new pi(o,r),o._enter=s,o._exit=c,o}function Xn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Zn(){return new pi(this._exit||this._groups.map(Hn),this._parents)}function Qn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function $n(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new pi(s,this._parents)}function er(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function tr(e){e||=nr;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new pi(i,this._parents).order()}function nr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function rr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ir(){return Array.from(this)}function ar(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function or(){let e=0;for(let t of this)++e;return e}function sr(){return!this.node()}function cr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function lr(e){return function(){this.removeAttribute(e)}}function ur(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dr(e,t){return function(){this.setAttribute(e,t)}}function fr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function pr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function mr(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 hr(e,t){var n=yn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?ur:lr:typeof t==`function`?n.local?mr:pr:n.local?fr:dr)(n,t))}function gr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function _r(e){return function(){this.style.removeProperty(e)}}function vr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function br(e,t,n){return arguments.length>1?this.each((t==null?_r:typeof t==`function`?yr:vr)(e,t,n??``)):xr(this.node(),e)}function xr(e,t){return e.style.getPropertyValue(t)||gr(e).getComputedStyle(e,null).getPropertyValue(t)}function Sr(e){return function(){delete this[e]}}function Cr(e,t){return function(){this[e]=t}}function wr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Tr(e,t){return arguments.length>1?this.each((t==null?Sr:typeof t==`function`?wr:Cr)(e,t)):this.node()[e]}function Er(e){return e.trim().split(/^|\s+/)}function Dr(e){return e.classList||new Or(e)}function Or(e){this._node=e,this._names=Er(e.getAttribute(`class`)||``)}Or.prototype={add:function(e){this._names.indexOf(e)<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 kr(e,t){for(var n=Dr(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ar(e,t){for(var n=Dr(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function jr(e){return function(){kr(this,e)}}function Mr(e){return function(){Ar(this,e)}}function Nr(e,t){return function(){(t.apply(this,arguments)?kr:Ar)(this,e)}}function Pr(e,t){var n=Er(e+``);if(arguments.length<2){for(var r=Dr(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Nr:t?jr:Mr)(n,t))}function Fr(){this.textContent=``}function Ir(e){return function(){this.textContent=e}}function Lr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Rr(e){return arguments.length?this.each(e==null?Fr:(typeof e==`function`?Lr:Ir)(e)):this.node().textContent}function zr(){this.innerHTML=``}function Br(e){return function(){this.innerHTML=e}}function Vr(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Hr(e){return arguments.length?this.each(e==null?zr:(typeof e==`function`?Vr:Br)(e)):this.node().innerHTML}function Ur(){this.nextSibling&&this.parentNode.appendChild(this)}function Wr(){return this.each(Ur)}function Gr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kr(){return this.each(Gr)}function qr(e){var t=typeof e==`function`?e:Sn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Jr(){return null}function Yr(e,t){var n=typeof e==`function`?e:Sn(e),r=t==null?Jr:typeof t==`function`?t:wn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Xr(){var e=this.parentNode;e&&e.removeChild(this)}function Zr(){return this.each(Xr)}function Qr(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $r(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ei(e){return this.select(e?$r:Qr)}function ti(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function ni(e){return function(t){e.call(this,t,this.__data__)}}function ri(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function ii(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ai(e,t,n){return function(){var r=this.__on,i,a=ni(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function oi(e,t,n){var r=ri(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ai:ii,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function si(e,t,n){var r=gr(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function ci(e,t){return function(){return si(this,e,t)}}function li(e,t){return function(){return si(this,e,t.apply(this,arguments))}}function ui(e,t){return this.each((typeof t==`function`?li:ci)(e,t))}function*di(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var fi=[null];function pi(e,t){this._groups=e,this._parents=t}function mi(){return new pi([[document.documentElement]],fi)}function hi(){return this}pi.prototype=mi.prototype={constructor:pi,select:Tn,selectAll:An,selectChild:In,selectChildren:Bn,filter:Vn,data:Yn,enter:Un,exit:Zn,join:Qn,merge:$n,selection:hi,order:er,sort:tr,call:rr,nodes:ir,node:ar,size:or,empty:sr,each:cr,attr:hr,style:br,property:Tr,classed:Pr,text:Rr,html:Hr,raise:Wr,lower:Kr,append:qr,insert:Yr,remove:Zr,clone:ei,datum:ti,on:oi,dispatch:ui,[Symbol.iterator]:di};function gi(e){return typeof e==`string`?new pi([[document.querySelector(e)]],[document.documentElement]):new pi([[e]],fi)}function _i(e){let t;for(;t=e.sourceEvent;)e=t;return e}function vi(e,t){if(e=_i(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var yi={passive:!1},bi={capture:!0,passive:!1};function xi(e){e.stopImmediatePropagation()}function Si(e){e.preventDefault(),e.stopImmediatePropagation()}function Ci(e){var t=e.document.documentElement,n=gi(e).on(`dragstart.drag`,Si,bi);`onselectstart`in t?n.on(`selectstart.drag`,Si,bi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function wi(e,t){var n=e.document.documentElement,r=gi(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Si,bi),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ti=e=>()=>e;function Ei(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,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:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Ei.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Di(e){return!e.ctrlKey&&!e.button}function Oi(){return this.parentNode}function ki(e,t){return t??{x:e.x,y:e.y}}function Ai(){return navigator.maxTouchPoints||`ontouchstart`in this}function ji(){var e=Di,t=Oi,n=ki,r=Ai,i={},a=pn(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,yi).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(gi(n.view).on(`mousemove.drag`,m,bi).on(`mouseup.drag`,h,bi),Ci(n.view),xi(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Si(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){gi(e.view).on(`mousemove.drag mouseup.drag`,null),wi(e.view,l),Si(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(xi(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(Si(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(xi(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=vi(l||r,t),p,m,h;if((h=n.call(e,new Ei(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=vi(l||a,t),_=o;break}u.call(r,e,new Ei(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Ti(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Ti(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Ti(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Ti(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function Mi(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ni(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Pi(){}var Fi=.7,Ii=1/Fi,Li=`\\s*([+-]?\\d+)\\s*`,Ri=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,zi=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,Bi=/^#([0-9a-f]{3,8})$/,Vi=RegExp(`^rgb\\(${Li},${Li},${Li}\\)$`),Hi=RegExp(`^rgb\\(${zi},${zi},${zi}\\)$`),Ui=RegExp(`^rgba\\(${Li},${Li},${Li},${Ri}\\)$`),Wi=RegExp(`^rgba\\(${zi},${zi},${zi},${Ri}\\)$`),Gi=RegExp(`^hsl\\(${Ri},${zi},${zi}\\)$`),Ki=RegExp(`^hsla\\(${Ri},${zi},${zi},${Ri}\\)$`),qi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Mi(Pi,Qi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ji,formatHex:Ji,formatHex8:Yi,formatHsl:Xi,formatRgb:Zi,toString:Zi});function Ji(){return this.rgb().formatHex()}function Yi(){return this.rgb().formatHex8()}function Xi(){return da(this).formatHsl()}function Zi(){return this.rgb().formatRgb()}function Qi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=Bi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$i(t):n===3?new ra(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ea(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ea(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Vi.exec(e))?new ra(t[1],t[2],t[3],1):(t=Hi.exec(e))?new ra(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ui.exec(e))?ea(t[1],t[2],t[3],t[4]):(t=Wi.exec(e))?ea(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Gi.exec(e))?ua(t[1],t[2]/100,t[3]/100,1):(t=Ki.exec(e))?ua(t[1],t[2]/100,t[3]/100,t[4]):qi.hasOwnProperty(e)?$i(qi[e]):e===`transparent`?new ra(NaN,NaN,NaN,0):null}function $i(e){return new ra(e>>16&255,e>>8&255,e&255,1)}function ea(e,t,n,r){return r<=0&&(e=t=n=NaN),new ra(e,t,n,r)}function ta(e){return e instanceof Pi||(e=Qi(e)),e?(e=e.rgb(),new ra(e.r,e.g,e.b,e.opacity)):new ra}function na(e,t,n,r){return arguments.length===1?ta(e):new ra(e,t,n,r??1)}function ra(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Mi(ra,na,Ni(Pi,{brighter(e){return e=e==null?Ii:Ii**+e,new ra(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Fi:Fi**+e,new ra(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ra(ca(this.r),ca(this.g),ca(this.b),sa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ia,formatHex:ia,formatHex8:aa,formatRgb:oa,toString:oa}));function ia(){return`#${la(this.r)}${la(this.g)}${la(this.b)}`}function aa(){return`#${la(this.r)}${la(this.g)}${la(this.b)}${la((isNaN(this.opacity)?1:this.opacity)*255)}`}function oa(){let e=sa(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ca(this.r)}, ${ca(this.g)}, ${ca(this.b)}${e===1?`)`:`, ${e})`}`}function sa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ca(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function la(e){return e=ca(e),(e<16?`0`:``)+e.toString(16)}function ua(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new pa(e,t,n,r)}function da(e){if(e instanceof pa)return new pa(e.h,e.s,e.l,e.opacity);if(e instanceof Pi||(e=Qi(e)),!e)return new pa;if(e instanceof pa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new pa(o,s,c,e.opacity)}function fa(e,t,n,r){return arguments.length===1?da(e):new pa(e,t,n,r??1)}function pa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Mi(pa,fa,Ni(Pi,{brighter(e){return e=e==null?Ii:Ii**+e,new pa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Fi:Fi**+e,new pa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new ra(ga(e>=240?e-240:e+120,i,r),ga(e,i,r),ga(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new pa(ma(this.h),ha(this.s),ha(this.l),sa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=sa(this.opacity);return`${e===1?`hsl(`:`hsla(`}${ma(this.h)}, ${ha(this.s)*100}%, ${ha(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function ma(e){return e=(e||0)%360,e<0?e+360:e}function ha(e){return Math.max(0,Math.min(1,e||0))}function ga(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var _a=e=>()=>e;function va(e,t){return function(n){return e+n*t}}function ya(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ba(e){return(e=+e)==1?xa:function(t,n){return n-t?ya(t,n,e):_a(isNaN(t)?n:t)}}function xa(e,t){var n=t-e;return n?va(e,n):_a(isNaN(e)?t:e)}var Sa=(function e(t){var n=ba(t);function r(e,t){var r=n((e=na(e)).r,(t=na(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=xa(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Ca(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function wa(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ta(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Pa(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Ea(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Da(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Oa(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Pa(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var ka=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Aa=new RegExp(ka.source,`g`);function ja(e){return function(){return e}}function Ma(e){return function(t){return e(t)+``}}function Na(e,t){var n=ka.lastIndex=Aa.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=ka.exec(e))&&(i=Aa.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Da(r,i)})),n=Aa.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Ma(c[0].x):ja(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Pa(e,t){var n=typeof t,r;return t==null||n===`boolean`?_a(t):(n===`number`?Da:n===`string`?(r=Qi(t))?(t=r,Sa):Na:t instanceof Qi?Sa:t instanceof Date?Ea:wa(t)?Ca:Array.isArray(t)?Ta:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Oa:Da)(e,t)}var Fa=180/Math.PI,Ia={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function La(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Fa,skewX:Math.atan(c)*Fa,scaleX:o,scaleY:s}}var Ra;function za(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Ia:La(t.a,t.b,t.c,t.d,t.e,t.f)}function Ba(e){return e==null||(Ra||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Ra.setAttribute(`transform`,e),!(e=Ra.transform.baseVal.consolidate()))?Ia:(e=e.matrix,La(e.a,e.b,e.c,e.d,e.e,e.f))}function Va(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Da(e,i)},{i:c-2,x:Da(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Da(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Da(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Da(e,n)},{i:s-2,x:Da(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Ha=Va(za,`px, `,`px)`,`deg)`),Ua=Va(Ba,`, `,`)`,`)`),Wa=1e-12;function Ga(e){return((e=Math.exp(e))+1/e)/2}function Ka(e){return((e=Math.exp(e))-1/e)/2}function qa(e){return((e=Math.exp(2*e))-1)/(e+1)}var Ja=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Wa)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=Ga(y),c=s/(n*g)*(i*qa(t*r+y)-Ka(y));return[a+c*d,o+c*f,s*i/Ga(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),Ya=0,Xa=0,Za=0,Qa=1e3,$a,eo,to=0,no=0,ro=0,io=typeof performance==`object`&&performance.now?performance:Date,ao=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return no||=(ao(so),io.now()+ro)}function so(){no=0}function co(){this._call=this._time=this._next=null}co.prototype=lo.prototype={constructor:co,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&eo!==this&&(eo?eo._next=this:$a=this,eo=this),this._call=e,this._time=n,ho()},stop:function(){this._call&&(this._call=null,this._time=1/0,ho())}};function lo(e,t,n){var r=new co;return r.restart(e,t,n),r}function uo(){oo(),++Ya;for(var e=$a,t;e;)(t=no-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ya}function fo(){no=(to=io.now())+ro,Ya=Xa=0;try{uo()}finally{Ya=0,mo(),no=0}}function po(){var e=io.now(),t=e-to;t>Qa&&(ro-=t,to=e)}function mo(){for(var e,t=$a,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$a=n);eo=e,ho(r)}function ho(e){Ya||(Xa&&=clearTimeout(Xa),e-no>24?(e<1/0&&(Xa=setTimeout(fo,e-io.now()-ro)),Za&&=clearInterval(Za)):(Za||=(to=io.now(),setInterval(po,Qa)),Ya=1,ao(fo)))}function go(e,t,n){var r=new co;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var _o=pn(`start`,`end`,`cancel`,`interrupt`),vo=[];function yo(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Co(e,n,{name:t,index:r,group:i,on:_o,tween:vo,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function bo(e,t){var n=So(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function xo(e,t){var n=So(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function So(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Co(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=lo(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return go(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(go(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function wo(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function To(e){return this.each(function(){wo(this,e)})}function Eo(e,t){var n,r;return function(){var i=xo(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Do(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=xo(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Oo(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=So(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Eo:Do)(n,e,t))}function ko(e,t,n){var r=e._id;return e.each(function(){var e=xo(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return So(e,r).value[t]}}function Ao(e,t){var n;return(typeof t==`number`?Da:t instanceof Qi?Sa:(n=Qi(t))?(t=n,Sa):Na)(e,t)}function jo(e){return function(){this.removeAttribute(e)}}function Mo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function No(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Po(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Fo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Io(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Lo(e,t){var n=yn(e),r=n===`transform`?Ua:Ao;return this.attrTween(e,typeof t==`function`?(n.local?Io:Fo)(n,r,ko(this,`attr.`+e,t)):t==null?(n.local?Mo:jo)(n):(n.local?Po:No)(n,r,t))}function Ro(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zo(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Bo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&zo(e,i)),n}return i._value=t,i}function Vo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ro(e,i)),n}return i._value=t,i}function Ho(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 Error();var r=yn(e);return this.tween(n,(r.local?Bo:Vo)(r,t))}function Uo(e,t){return function(){bo(this,e).delay=+t.apply(this,arguments)}}function Wo(e,t){return t=+t,function(){bo(this,e).delay=t}}function Go(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Uo:Wo)(t,e)):So(this.node(),t).delay}function Ko(e,t){return function(){xo(this,e).duration=+t.apply(this,arguments)}}function qo(e,t){return t=+t,function(){xo(this,e).duration=t}}function Jo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ko:qo)(t,e)):So(this.node(),t).duration}function Yo(e,t){if(typeof t!=`function`)throw Error();return function(){xo(this,e).ease=t}}function Xo(e){var t=this._id;return arguments.length?this.each(Yo(t,e)):So(this.node(),t).ease}function Zo(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();xo(this,e).ease=n}}function Qo(e){if(typeof e!=`function`)throw Error();return this.each(Zo(this._id,e))}function $o(e){typeof e!=`function`&&(e=jn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Os(r,this._parents,this._name,this._id)}function es(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Os(o,this._parents,this._name,this._id)}function ts(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ns(e,t,n){var r,i,a=ts(t)?bo:xo;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function rs(e,t){var n=this._id;return arguments.length<2?So(this.node(),n).on.on(e):this.each(ns(n,e,t))}function is(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function as(){return this.on(`end.remove`,is(this._id))}function os(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=wn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,yo(l[f],t,n,f,l,So(u,n)));return new Os(a,this._parents,t,n)}function ss(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=On(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=So(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&yo(p,t,n,h,f,m);a.push(f),o.push(u)}return new Os(a,o,t,n)}var cs=mi.prototype.constructor;function ls(){return new cs(this._groups,this._parents)}function us(e,t){var n,r,i;return function(){var a=xr(this,e),o=(this.style.removeProperty(e),xr(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ds(e){return function(){this.style.removeProperty(e)}}function fs(e,t,n){var r,i=n+``,a;return function(){var o=xr(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function ps(e,t,n){var r,i,a;return function(){var o=xr(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),xr(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function ms(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=xo(this,e),l=c.on,u=c.value[a]==null?s||=ds(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function hs(e,t,n){var r=(e+=``)==`transform`?Ha:Ao;return t==null?this.styleTween(e,us(e,r)).on(`end.style.`+e,ds(e)):typeof t==`function`?this.styleTween(e,ps(e,r,ko(this,`style.`+e,t))).each(ms(this._id,e)):this.styleTween(e,fs(e,r,t),n).on(`end.style.`+e,null)}function gs(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function _s(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&gs(e,a,n)),r}return a._value=t,a}function vs(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,_s(e,t,n??``))}function ys(e){return function(){this.textContent=e}}function bs(e){return function(){var t=e(this);this.textContent=t??``}}function xs(e){return this.tween(`text`,typeof e==`function`?bs(ko(this,`text`,e)):ys(e==null?``:e+``))}function Ss(e){return function(t){this.textContent=e.call(this,t)}}function Cs(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Ss(r)),t}return r._value=e,r}function ws(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 Error();return this.tween(t,Cs(e))}function Ts(){for(var e=this._name,t=this._id,n=As(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=So(c,t);yo(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Os(r,this._parents,e,n)}function Es(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=xo(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Ds=0;function Os(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ks(e){return mi().transition(e)}function As(){return++Ds}var js=mi.prototype;Os.prototype=ks.prototype={constructor:Os,select:os,selectAll:ss,selectChild:js.selectChild,selectChildren:js.selectChildren,filter:$o,merge:es,selection:ls,transition:Ts,call:js.call,nodes:js.nodes,node:js.node,size:js.size,empty:js.empty,each:js.each,on:rs,attr:Lo,attrTween:Ho,style:hs,styleTween:vs,text:xs,textTween:ws,remove:as,tween:Oo,delay:Go,duration:Jo,ease:Xo,easeVarying:Qo,end:Es,[Symbol.iterator]:js[Symbol.iterator]};function Ms(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ns={time:null,delay:0,duration:250,ease:Ms};function Ps(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Fs(e){var t,n;e instanceof Os?(t=e._id,e=e._name):(t=As(),(n=Ns).time=oo(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&yo(c,e,t,l,o,n||Ps(c,t));return new Os(r,this._parents,e,t)}mi.prototype.interrupt=To,mi.prototype.transition=Fs;var Is=e=>()=>e;function Ls(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:r,enumerable:!0,configurable:!0},_:{value:i}})}function Rs(e,t,n){this.k=e,this.x=t,this.y=n}Rs.prototype={constructor:Rs,scale:function(e){return e===1?this:new Rs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Rs(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 zs=new Rs(1,0,0);Bs.prototype=Rs.prototype;function Bs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return zs;return e.__zoom}function Vs(e){e.stopImmediatePropagation()}function Hs(e){e.preventDefault(),e.stopImmediatePropagation()}function Us(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Ws(){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 Gs(){return this.__zoom||zs}function Ks(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qs(){return navigator.maxTouchPoints||`ontouchstart`in this}function Js(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Ys(){var e=Us,t=Ws,n=Js,r=Ks,i=qs,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ja,l=pn(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Gs).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Gs),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(zs.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Rs(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Rs(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Rs(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=gi(this.that).datum();l.call(e,this.that,new Ls(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=vi(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],wo(this),s.start();Hs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=gi(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=vi(t,i),l=t.clientX,u=t.clientY;Ci(t.view),Vs(t),a.mouse=[c,this.__zoom.invert(c)],wo(this),a.start();function d(e){if(Hs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=vi(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),wi(e.view,a.moved),Hs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=vi(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Hs(r),s>0?gi(this).transition().duration(s).call(x,d,c,r):gi(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Vs(t),s=0;s<i;++s)c=r[s],l=vi(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),wo(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Hs(e),s=0;s<a;++s)c=i[s],l=vi(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Vs(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=vi(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=gi(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Is(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Is(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Is(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Is([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Xs={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.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 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:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", 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.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Zs=[[-1/0,-1/0],[1/0,1/0]],Qs=[`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`},ec;(function(e){e.Strict=`strict`,e.Loose=`loose`})(ec||={});var tc;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(tc||={});var nc;(function(e){e.Partial=`partial`,e.Full=`full`})(nc||={});var rc={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ic;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ic||={});var ac;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(ac||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var oc={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function sc(e){return e===null?null:e?`valid`:`invalid`}var cc=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,lc=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),uc=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),dc=(e,t=[0,0])=>{let{width:n,height:r}=Gc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},fc=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:Dc(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):uc(n)?n:t.nodeLookup.get(n.id)),Tc(e,i?kc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),pc=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Tc(n,kc(e)),r=!0)}),r?Dc(n):{x:0,y:0,width:0,height:0}},mc=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=jc(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},hc=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function gc(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Gc(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function _c({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Hc(pc(gc(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function vc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,Xs.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&Wc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Wc(d)?xc(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Xs.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function yc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=hc(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var bc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),xc=(e={x:0,y:0},t,n)=>({x:bc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:bc(e.y,t[0][1],t[1][1]-(n?.height??0))});function Sc(e,t,n){let{width:r,height:i}=Gc(n),{x:a,y:o}=n.internals.positionAbsolute;return xc(e,[[a,o],[a+r,o+i]],t)}var Cc=(e,t,n)=>e<t?bc(Math.abs(e-t),1,t)/t:e>n?-bc(Math.abs(e-n),1,t)/t:0,wc=(e,t,n=15,r=40)=>[Cc(e.x,r,t.width-r)*n,Cc(e.y,r,t.height-r)*n],Tc=(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)}),Ec=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Dc=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Oc=(e,t=[0,0])=>{let{x:n,y:r}=uc(e)?e.internals.positionAbsolute:dc(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},kc=(e,t=[0,0])=>{let{x:n,y:r}=uc(e)?e.internals.positionAbsolute:dc(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Ac=(e,t)=>Dc(Tc(Ec(e),Ec(t))),jc=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},Mc=(e,t)=>jc(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Nc=e=>Pc(e.width)&&Pc(e.height)&&Pc(e.x)&&Pc(e.y),Pc=e=>!isNaN(e)&&isFinite(e),Fc=(e,t)=>(e,t)=>{},Ic=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Lc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?Ic(s,o):s},Rc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function zc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Bc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=zc(e,n),i=zc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=zc(e.top??e.y??0,n),i=zc(e.bottom??e.y??0,n),a=zc(e.left??e.x??0,t),o=zc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Vc(e,t,n,r,i,a){let{x:o,y:s}=Rc(e,[t,n,r]),{x:c,y:l}=Rc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Hc=(e,t,n,r,i,a)=>{let o=Bc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=bc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Vc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Uc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Wc(e){return e!=null&&e!==`parent`}function Gc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Kc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function qc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function Jc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Yc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Xc(e){return{...$s,...e||{}}}function Zc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=rl(e),s=Lc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?Ic(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Qc=e=>({width:e.offsetWidth,height:e.offsetHeight}),$c=e=>e?.getRootNode?.()||window?.document,el=[`INPUT`,`SELECT`,`TEXTAREA`];function tl(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?el.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var nl=e=>`clientX`in e,rl=(e,t)=>{let n=nl(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},il=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Qc(t)}})};function al({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function ol(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function sl({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-ol(t-r,a),n];case Q.Right:return[t+ol(r-t,a),n];case Q.Top:return[t,n-ol(n-i,a)];case Q.Bottom:return[t,n+ol(i-n,a)]}}function cl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=sl({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=sl({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=al({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function ll({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function ul({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function dl({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Tc(kc(e),kc(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),Mc({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Dc(a))>0}var fl=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,pl=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),ml=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Xs.error006()),t;let r=n.getEdgeId||fl,i;return i=cc(e)?{...e}:{...e,id:r(e)},pl(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function hl({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=ll({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var gl={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},_l=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},vl=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function yl({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=gl[t],c=gl[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=_l({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=ll({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function bl(e,t,n,r){let i=Math.min(vl(e,t)/2,vl(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function xl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=yl({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=bl(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function Sl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Cl(e){let{sourceNode:t,targetNode:n}=e;if(!Sl(t)||!Sl(n))return null;let r=t.internals.handleBounds||wl(t.handles),i=n.internals.handleBounds||wl(n.handles),a=El(r?.source??[],e.sourceHandle),o=El(e.connectionMode===ec.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,Xs.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=Tl(t,a,s),u=Tl(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function wl(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Tl(e,t,n=Q.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Gc(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function El(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Dl(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Ol(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=Dl(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var kl=1e3,Al=10,jl={nodeOrigin:[0,0],nodeExtent:Zs,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Ml={...jl,checkEquality:!0};function Nl(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Pl(e,t,n){let r=Nl(jl,n);for(let n of e.values())if(n.parentId)zl(n,e,t,r);else{let e=xc(dc(n,r.nodeOrigin),Wc(n.extent)?n.extent:r.nodeExtent,Gc(n));n.internals.positionAbsolute=e}}function Fl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function Il(e){return e===`manual`}function Ll(e,t,n,r={}){let i=Nl(Ml,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Il(i.zIndexMode)?kl:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=xc(dc(u,i.nodeOrigin),Wc(u.extent)?u.extent:i.nodeExtent,Gc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Fl(u,e),z:Bl(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&zl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Rl(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function zl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Nl(jl,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Rl(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Al),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Vl(e,u,o,s,a&&!Il(c)?kl:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Bl(e,t,n){let r=Pc(e.zIndex)?e.zIndex:0;return Il(n)?r:r+(e.selected?t:0)}function Vl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Gc(e),l=dc(e,n),u=Wc(e.extent)?xc(l,e.extent,c):l,d=xc({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Sc(d,c,t));let f=Bl(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Hl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Ac(a.get(n.parentId)?.expandedRect??Oc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Gc(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Ul(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Qc(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=Wc(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=Sc(h,s,n))}else m&&(h=xc(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:il(`source`,r.nodeElement,p,d,e.id),target:il(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&zl(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Oc(g,i)}))}}if(f.length>0){let e=Hl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Wl({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Gl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Kl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Gl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Gl(`target`,s,c,e,i,o),t.set(r.id,r)}}function ql(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:ql(n,t):!1}function Jl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Yl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!ql(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Xl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Zl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=Ic(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Ql({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=gi(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Ec(pc(s)):null,x=v&&l?Zl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:Ic(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=vc({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Xl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=wc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Zc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Yl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Xl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=ji().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Zc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=rl(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Zc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=rl(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=rl(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Xl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!Jl(t,`.${g}`,v))&&(!_||Jl(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function $l(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())Mc(i,Oc(e))>0&&r.push(e);return r}var eu=250;function tu(e,t,n,r){let i=[],a=1/0,o=$l(e,n,t+eu);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Tl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function nu(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Tl(o,c,c.position,!0)}:c}function ru(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function iu(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var au=()=>!0;function ou(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=au,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=$c(e.target),E=0,D,{x:O,y:k}=rl(e),A=ru(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=nu(i,A,r,c,t);if(!N)return;let P=rl(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=wc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},V=c.get(i),H={inProgress:!0,isValid:null,from:Tl(V,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:V,to:P,toHandle:null,toPosition:oc[B.position],toNode:null,pointer:P};function U(){M=!0,y(H),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&U();function ee(e){if(!M){let{x:t,y:n}=rl(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;U()}if(!x()||!B){W(e);return}let a=b();P=rl(e,j),D=tu(Lc(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=su(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=iu(!!D,s.isValid);let u=c.get(i),f=u?Tl(u,B,Q.Left,!0):H.from,p={...H,from:f,isValid:L,to:s.toHandle&&L?Rc({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:oc[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),H=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=H,r={...n,toPosition:H.toHandle?H.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ee),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,ee),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,ee),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,ee),T.addEventListener(`touchend`,W)}function su(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=au,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=rl(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=ru(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===ec.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=nu(t,e,a,u,n,!0)}return _}var cu={onPointerDown:ou,isValid:su};function lu({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=gi(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Uc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Ys().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:vi}}var uu=e=>({x:e.x,y:e.y,zoom:e.k}),du=({x:e,y:t,zoom:n})=>zs.translate(e,t).scale(n),fu=(e,t)=>e.target.closest(`.${t}`),pu=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),mu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,hu=(e,t=0,n=mu,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},gu=e=>{let t=e.ctrlKey&&Uc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function _u({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(fu(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=vi(u),t=d*2**gu(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===tc.Vertical?0:u.deltaX*f,m=i===tc.Horizontal?0:u.deltaY*f;!Uc()&&u.shiftKey&&i!==tc.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=uu(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function vu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=fu(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function yu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=uu(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function bu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&pu(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,uu(a.transform))}}function xu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&pu(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=uu(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Su({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(fu(d,`${l}-flow__node`)||fu(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||fu(d,s)&&m||fu(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Cu({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=Ys().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=gi(e).call(f);y({x:i.x,y:i.y,zoom:bc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(gu);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Pa:Ja).transform(hu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!Pc(E)||E<0?0:E);let k=O?_u({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):vu({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=yu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=bu({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=xu({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=Su({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=du(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=du(e);return await g(n,t),n}function x(e){if(p){let t=du(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?Bs(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Pa:Ja).scaleTo(hu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Pa:Ja).scaleBy(hu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!Pc(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var wu;(function(e){e.Line=`line`,e.Handle=`handle`})(wu||={});function Tu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Eu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function Du(e,t){return Math.max(0,t-e)}function Ou(e,t){return Math.max(0,e-t)}function ku(e,t,n){return Math.max(0,t-e,e-n)}function Au(e,t){return e?!t:t}function ju(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=ku(E,h,g),j=ku(D,_,v);if(o){let e=0,t=0;c&&w<0?e=Du(y+w+O,o[0][0]):!c&&w>0&&(e=Ou(y+E+O,o[1][0])),l&&T<0?t=Du(b+T+k,o[0][1]):!l&&T>0&&(t=Ou(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Ou(y+w,s[0][0]):!c&&w<0&&(e=Du(y+E,s[1][0])),l&&T>0?t=Ou(b+T,s[0][1]):!l&&T<0&&(t=Du(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=ku(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Ou(b+k+E/C,o[1][1])*C:Du(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?Du(b+E/C,s[1][1])*C:Ou(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=ku(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Ou(y+D*C+O,o[1][0])/C:Du(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?Du(y+D*C,s[1][0])/C:Ou(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(Au(c,l)?-w:w)/C:w=(Au(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Mu={width:0,height:0,x:0,y:0},Nu={...Mu,pointerX:0,pointerY:0,aspectRatio:1};function Pu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function Fu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=gi(e),o={controlDirection:Eu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Mu},h={...Nu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Eu(e)};let g,_=null,v=[],y,b,x,S=!1,C=ji().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Zc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Wc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=Pu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Zc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=ju(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=Tu({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var Iu=e(rt(),1),Lu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Ru=e=>e?Lu(e):Lu,{useDebugValue:zu}=Y.default,{useSyncExternalStoreWithSelector:Bu}=Iu.default,Vu=e=>e;function Hu(e,t=Vu,n){let r=Bu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zu(r),r}var Uu=(e,t)=>{let n=Ru(e),r=(e,r=t)=>Hu(n,e,r);return Object.assign(r,n),r},Wu=(e,t)=>e?Uu(e,t):Uu;function Gu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}n();var Ku=(0,Y.createContext)(null),qu=Ku.Provider,Ju=Xs.error001(`react`);function $(e,t){let n=(0,Y.useContext)(Ku);if(n===null)throw Error(Ju);return Hu(n,e,t)}function Yu(){let e=(0,Y.useContext)(Ku);if(e===null)throw Error(Ju);return(0,Y.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Xu={display:`none`},Zu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Qu=`react-flow__node-desc`,$u=`react-flow__edge-desc`,ed=`react-flow__aria-live`,td=e=>e.ariaLiveMessage,nd=e=>e.ariaLabelConfig;function rd({rfId:e}){let t=$(td);return(0,Z.jsx)(`div`,{id:`${ed}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Zu,children:t})}function id({rfId:e,disableKeyboardA11y:t}){let n=$(nd);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{id:`${Qu}-${e}`,style:Xu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Z.jsx)(`div`,{id:`${$u}-${e}`,style:Xu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Z.jsx)(rd,{rfId:e})]})}var ad=(0,Y.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,Z.jsx)(`div`,{className:dn([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));ad.displayName=`Panel`;var od=`https://reactflow.dev?utm_source=attribution`;function sd({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Z.jsx)(ad,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${od}`,children:(0,Z.jsx)(`a`,{href:od,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var cd=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},ld=e=>e.id;function ud(e,t){return Gu(e.selectedNodes.map(ld),t.selectedNodes.map(ld))&&Gu(e.selectedEdges.map(ld),t.selectedEdges.map(ld))}function dd({onSelectionChange:e}){let t=Yu(),{selectedNodes:n,selectedEdges:r}=$(cd,ud);return(0,Y.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var fd=e=>!!e.onSelectionChangeHandlers;function pd({onSelectionChange:e}){let t=$(fd);return e||t?(0,Z.jsx)(dd,{onSelectionChange:e}):null}var md=[0,0],hd={x:0,y:0,zoom:1},gd=[...`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`.split(`.`),`rfId`],_d=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}),vd={translateExtent:Zs,nodeOrigin:md,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function yd(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(_d,Gu),l=Yu();(0,Y.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=vd,s()}),[]);let u=(0,Y.useRef)(vd);return(0,Y.useEffect)(()=>{for(let s of gd){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Xc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},gd.map(t=>e[t])),null}function bd(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function xd(e){let[t,n]=(0,Y.useState)(e===`system`?null:e);return(0,Y.useEffect)(()=>{if(e!==`system`){n(e);return}let t=bd(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?bd()?.matches?`dark`:`light`:t}var Sd=typeof document<`u`?document:null;function Cd(e=null,t={target:Sd,actInsideInputWithModifier:!0}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(!1),a=(0,Y.useRef)(new Set([])),[o,s]=(0,Y.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,f as o,l as s,t as c}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as l}from"./check-DUBLcKHA.js";import{t as u}from"./cn-JdwAhgNB.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-DP6tPKk-.js";import{l as p,n as m}from"./locale-store-CTwSy7yW.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{$ as g,A as _,Ac as v,Al as y,As as b,B as x,Bs as S,C,Cl as w,Ct as T,D as E,E as D,F as O,Gl as k,Gr as A,Gs as j,I as M,Ic as N,Is as P,J as F,Ji as I,Jl as L,K as R,Ks as z,L as B,M as V,Mc as H,N as U,Ns as ee,Nu as W,O as te,P as ne,Q as re,Ql as G,Rr as ie,S as K,St as ae,Su as oe,T as se,To as ce,Tt as le,W as ue,X as q,Y as de,Yc as fe,Z as pe,Zl as me,_u as he,at as ge,cl as _e,ct as ve,dl as ye,dt as be,et as xe,ft as Se,g as J,gc as Ce,gt as we,hl as Te,hu as Ee,is as De,it as Oe,j as ke,lt as Ae,lu as je,mt as Me,nl as Ne,ns as Pe,nt as Fe,oa as Ie,oc as Le,pl as Re,pt as ze,q as Be,ro as Ve,rt as He,st as Ue,ts as We,ut as Ge,vt as Ke,w as qe,ws as Je,wt as Ye,wu as Xe,xc as Ze,xt as Qe,yc as $e,yl as et,yt as tt,z as nt}from"./index-C0CGebQ1.js";import{t as rt}from"./with-selector-aYPsXwdl.js";import{t as it}from"./page-tabs-ke9s4nYi.js";import{i as at,r as ot,t as st}from"./workflow-run-setup-panel-yV_x595t.js";var Y=e(t(),1),X=r(),ct=[`queued`,`running`,`succeeded`,`attention`],lt=new Set([`failed`,`timeout`,`cancelled`]);function ut(e){return e.metadata?.sessionKey?.trim()||null}function dt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function ft(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function pt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||ft(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||ft(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?dt(n,t):null}function mt(e,t=90){return pt(e,t)??dt(e.title?.trim()||e.definitionId,t)}function ht(e,t=44){return dt(e.title?.trim()||e.definitionId,t)}function gt(e,t){let n=t.trim().toLowerCase();return n?[pt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function _t(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!g(e,t.triggerFilter??`all`)?!1:gt(e,t.searchQuery))}function vt(e){return e.completedAtMs??e.createdAtMs}function yt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:lt.has(e.status)?`attention`:null}function bt(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>vt(t)-vt(e))}function xt(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=yt(r,t);e&&n[e].push(r)}return ct.map(e=>{if(e===`succeeded`){let t=bt(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:bt(e,n[e])}})}function St(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return tt(-r,`second`,n);let i=Math.round(r/60);if(i<60)return tt(-i,`minute`,n);let a=Math.round(i/60);return a<48?tt(-a,`hour`,n):tt(-Math.round(a/24),`day`,n)}function Ct(e){return e.status===`queued`||e.status===`running`}function wt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var Z=i(),Tt=(0,Y.memo)(function(e){let t=(0,X.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:l,onRetry:d}=e,p=f(r).workflows,[m,h]=(0,Y.useState)(!1),g;t[0]===n?g=t[1]:(g=ut(n),t[0]=n,t[1]=g);let _=!g,v;t[2]===n?v=t[3]:(v=Ct(n),t[2]=n,t[3]=v);let y=v,x=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=F(y?a-T:n.metrics.durationMs),D=q(p.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=mt(n),t[7]=n,t[8]=O);let A=O,M;t[9]===n?M=t[10]:(M=ht(n),t[9]=n,t[10]=M);let N=M,P;t[11]!==s||t[12]!==n?(P=()=>{s(n)},t[11]=s,t[12]=n,t[13]=P):P=t[13];let I=P,L;t[14]!==_||t[15]!==c||t[16]!==n?(L=()=>{_||c(n)},t[14]=_,t[15]=c,t[16]=n,t[17]=L):L=t[17];let R=L,z=o&&`ring-1 ring-accent/30`,B;t[18]===z?B=t[19]:(B=u(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,z,`hover:bg-surface-hover`),t[18]=z,t[19]=B);let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=u(`w-full text-left`,Je.focusRingPanel),t[20]=V):V=t[20];let H;t[21]===A?H=t[22]:(H=(0,Z.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:A}),t[21]=A,t[22]=H);let U;t[23]===N?U=t[24]:(U=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:N}),t[23]=N,t[24]=U);let ee;t[25]!==H||t[26]!==U?(ee=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[H,U]}),t[25]=H,t[26]=U,t[27]=ee):ee=t[27];let W;t[28]===n.status?W=t[29]:(W=u(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,xe(n.status)),t[28]=n.status,t[29]=W);let te;t[30]!==i||t[31]!==a||t[32]!==T?(te=St(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=te):te=t[33];let ne;t[34]===te?ne=t[35]:(ne=(0,Z.jsx)(`span`,{children:te}),t[34]=te,t[35]=ne);let re=E===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:q(p.taskElapsed,{duration:E})})]}),G;t[36]!==ne||t[37]!==re?(G=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[ne,re]}),t[36]=ne,t[37]=re,t[38]=G):G=t[38];let ie=n.metrics.artifactCount>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,K=o?(0,Z.jsx)(`span`,{className:`font-medium text-accent-fg`,children:p.taskOpenDetails}):null,ae;t[39]!==ie||t[40]!==K?(ae=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[ie,K]}),t[39]=ie,t[40]=K,t[41]=ae):ae=t[41];let oe=_&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,se;t[42]===oe?se=t[43]:(se=u(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Je.focusRingPanel,oe),t[42]=oe,t[43]=se);let ce;t[44]!==_||t[45]!==R||t[46]!==p.continueInChat||t[47]!==se?(ce=(0,Z.jsx)(`button`,{type:`button`,className:se,disabled:_,onClick:R,children:p.continueInChat}),t[44]=_,t[45]=R,t[46]=p.continueInChat,t[47]=se,t[48]=ce):ce=t[48];let le;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(le=u(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Je.focusRingPanel),t[49]=le):le=t[49];let ue;t[50]!==I||t[51]!==p.taskOpenDetails?(ue=(0,Z.jsx)(`button`,{type:`button`,className:le,onClick:I,children:p.taskOpenDetails}),t[50]=I,t[51]=p.taskOpenDetails,t[52]=ue):ue=t[52];let de;t[53]!==ce||t[54]!==ue?(de=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ce,ue]}),t[53]=ce,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]===h?fe=t[57]:(fe=()=>h(Dt),t[56]=h,t[57]=fe);let pe;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[58]=pe):pe=t[58];let me;t[59]!==p.taskActionsAria||t[60]!==m||t[61]!==fe?(me=(0,Z.jsx)(b,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":p.taskActionsAria,"aria-expanded":m,onClick:fe,children:pe}),t[59]=p.taskActionsAria,t[60]=m,t[61]=fe,t[62]=me):me=t[62];let he;t[63]!==y||t[64]!==p.cancel||t[65]!==p.rerun||t[66]!==p.taskCloseMenu||t[67]!==m||t[68]!==l||t[69]!==d||t[70]!==n||t[71]!==h?(he=m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":p.taskCloseMenu,onClick:()=>h(!1)}),(0,Z.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[y?(0,Z.jsx)(Et,{label:p.cancel,tone:`danger`,onClick:()=>{h(!1),l(n.id)}}):null,wt(n)?(0,Z.jsx)(Et,{label:p.rerun,onClick:()=>{h(!1),d(n.id)}}):null]})]}):null,t[63]=y,t[64]=p.cancel,t[65]=p.rerun,t[66]=p.taskCloseMenu,t[67]=m,t[68]=l,t[69]=d,t[70]=n,t[71]=h,t[72]=he):he=t[72];let ge;return t[73]!==me||t[74]!==he?(ge=(0,Z.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[me,he]}),t[73]=me,t[74]=he,t[75]=ge):ge=t[75],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:I,"aria-label":`${p.taskOpenDetails}: ${A}`,"aria-current":o?`true`:void 0,className:V,children:[(0,Z.jsxs)(`div`,{className:`pr-7`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[ee,(0,Z.jsx)(`span`,{className:W,children:p.status[n.status]??n.status})]}),G]}),x?(0,Z.jsxs)(`div`,{className:`mt-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:q(p.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{children:[C,`%`]})]}),(0,Z.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,ae,w?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}),q(p.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),de,ge]})});function Et(e){let t=(0,X.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=u(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(0,Z.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l):l=t[7],l}function Dt(e){return!e}function Ot(e,t){return t.boardColumns[e]}var kt=(0,Y.memo)(function(e){let t=(0,X.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:l,onCancelRun:d,onRetryRun:p}=e,m=f(r).workflows,[h,g]=(0,Y.useState)(!1),_=n.id===`succeeded`,v=_?5:n.runs.length,y;t[0]!==v||t[1]!==n.runs||t[2]!==h||t[3]!==_?(y=_&&!h?n.runs.slice(0,v):n.runs,t[0]=v,t[1]=n.runs,t[2]=h,t[3]=_,t[4]=y):y=t[4];let x=y,S=_&&n.runs.length>5&&!h,C=_&&h,w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=u(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=w):w=t[5];let T;t[6]===n.runs.length?T=t[7]:(T=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&x.length===0?(0,Z.jsx)(At,{}):x.length===0?(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:m.boardColumnEmpty}):x.map(e=>(0,Z.jsx)(Tt,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:d,onRetry:p},e.id)),O=S?(0,Z.jsx)(b,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!0),children:q(m.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,A;t[9]!==C||t[10]!==m||t[11]!==g?(A=C?(0,Z.jsx)(b,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!1),children:m.boardCollapseSucceeded}):null,t[9]=C,t[10]=m,t[11]=g,t[12]=A):A=t[12];let j;return t[13]!==D||t[14]!==O||t[15]!==A?(j=(0,Z.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[D,O,A]}),t[13]=D,t[14]=O,t[15]=A,t[16]=j):j=t[16],(0,Z.jsxs)(`section`,{className:w,"aria-label":Ot(n.id,m),children:[(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Ot(n.id,m)}),T]}),E]}),j]})});function At(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ve,{className:`size-4/5`}),(0,Z.jsx)(Ve,{className:`mt-2 h-3 w-24`})]}),(0,Z.jsx)(Ve,{className:`h-5 w-14 rounded-full`})]}),(0,Z.jsx)(Ve,{className:`mt-3 h-3 w-2/3`}),(0,Z.jsx)(Ve,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function jt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Mt=(0,Y.memo)(function(e){let t=(0,X.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(Nt),t[0]=n,t[1]=g);let _=g,v=(0,Y.useRef)(null),y=(0,Y.useRef)(null),[x,S]=(0,Y.useState)(Pt),[C,w]=(0,Y.useState)(!1),T,E;t[2]===_?(T=t[3],E=t[4]):(T=()=>{if(!_)return;let e=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(e)},E=[_],t[2]=_,t[3]=T,t[4]=E),(0,Y.useEffect)(T,E);let D;t[5]!==x||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(D=xt(_t(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),x),t[5]=x,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=D):D=t[10];let O=D,k=O.reduce(Ft,0),A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,w(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=A):A=t[11];let j=A,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{if(e.button!==0||jt(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=M):M=t[12];let N=M,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,w(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=P):P=t[13];let F=P;if(!u&&k===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,Z.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,Z.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Z.jsx)(b,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let I=C?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,w(!1))},t[27]=z):z=t[27];let B;if(t[28]!==O||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==x||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==x||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,Z.jsx)(kt,{column:e,language:r,localeTag:i,nowMs:x,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=x,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=O.map(e),t[28]=O,t[29]=r,t[30]=u,t[31]=i,t[32]=x,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,Z.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,Z.jsx)(`div`,{ref:v,className:R,onPointerDown:N,onPointerMove:F,onPointerUp:j,onPointerCancel:j,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function Nt(e){return e.status===`queued`||e.status===`running`}function Pt(){return Date.now()}function Ft(e,t){return e+t.runs.length}function It(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?q(t.agentScaleExact,{count:n.min}):q(t.agentScaleRange,{min:n.min,max:n.max}):null}function Lt(e){let t=(0,X.c)(73),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s}=e,c;t[0]!==n||t[1]!==r?(c=we(n,r),t[0]=n,t[1]=r,t[2]=c):c=t[2];let l=c,d;t[3]!==n||t[4]!==i?(d=It(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=u(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,Z.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,Z.jsx)(oe,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=u(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Je.focusRingPanel),t[17]=x):x=t[17];let C;t[18]!==n||t[19]!==o?(C=()=>o(n),t[18]=n,t[19]=o,t[20]=C):C=t[20];let w;t[21]!==n.title||t[22]!==C?(w=(0,Z.jsx)(`button`,{type:`button`,className:x,onClick:C,children:n.title}),t[21]=n.title,t[22]=C,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==y?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,w]}),t[24]=w,t[25]=y,t[26]=T):T=t[26];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[27]!==n||t[28]!==s?(D=()=>s(n),t[27]=n,t[28]=s,t[29]=D):D=t[29];let O;t[30]===p?O=t[31]:(O=p?(0,Z.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}):(0,Z.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),t[30]=p,t[31]=O);let k;t[32]!==E||t[33]!==D||t[34]!==O?(k=(0,Z.jsx)(b,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:O}),t[32]=E,t[33]=D,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==T||t[37]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,k]}),t[36]=T,t[37]=k,t[38]=A):A=t[38];let j=l.whenToUse||l.description||n.description,M;t[39]===j?M=t[40]:(M=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:j}),t[39]=j,t[40]=M);let P;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Te,{className:`size-3`,"aria-hidden":!0}),t[41]=P):P=t[41];let F;t[42]!==n.phases.length||t[43]!==i.phaseCount?(F=q(i.phaseCount,{count:n.phases.length}),t[42]=n.phases.length,t[43]=i.phaseCount,t[44]=F):F=t[44];let I;t[45]===F?I=t[46]:(I=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[45]=F,t[46]=I);let L;t[47]===f?L=t[48]:(L=f?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(S,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[47]=f,t[48]=L);let R;t[49]!==I||t[50]!==L?(R=(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[49]=I,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==n||t[53]!==a?(z=()=>a(n),t[52]=n,t[53]=a,t[54]=z):z=t[54];let B;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[55]=B):B=t[55];let V;t[56]!==i.configureAndRun||t[57]!==z?(V=(0,Z.jsxs)(b,{type:`button`,variant:`primary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[56]=i.configureAndRun,t[57]=z,t[58]=V):V=t[58];let U;t[59]!==n||t[60]!==o?(U=()=>o(n),t[59]=n,t[60]=o,t[61]=U):U=t[61];let ee;t[62]!==i.viewDetails||t[63]!==U?(ee=(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:U,children:i.viewDetails}),t[62]=i.viewDetails,t[63]=U,t[64]=ee):ee=t[64];let W;t[65]!==V||t[66]!==ee?(W=(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,ee]}),t[65]=V,t[66]=ee,t[67]=W):W=t[67];let te;return t[68]!==A||t[69]!==M||t[70]!==R||t[71]!==W?(te=(0,Z.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[A,M,R,W]}),t[68]=A,t[69]=M,t[70]=R,t[71]=W,t[72]=te):te=t[72],te}function Rt(e){let t=(0,X.c)(44),{definitions:n,runs:r,language:i,onPick:a,onDetail:o,onEdit:s}=e,[c]=(0,Y.useState)(Vt),l=f(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(`all`),[_,v]=(0,Y.useState)(`all`),y;t[0]!==h||t[1]!==n||t[2]!==p||t[3]!==_?(y=Be(n,p,h,_),t[0]=h,t[1]=n,t[2]=p,t[3]=_,t[4]=y):y=t[4];let b=y,x;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(Bt)),i=new Set;x=[...r].sort(zt).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=x}else x=t[7];let S=x,C=q(l.workflowCount,{count:b.length}),w;t[8]===C?w=t[9]:(w=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[8]=C,t[9]=w);let T=l.sourceFilterAria,E;t[10]!==l.sources||t[11]!==v||t[12]!==_?(E=be.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:u(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,_===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Je.focusRingPanel),"aria-pressed":_===e,onClick:()=>v(e),children:l.sources[e]},e)),t[10]=l.sources,t[11]=v,t[12]=_,t[13]=E):E=t[13];let D;t[14]!==l.sourceFilterAria||t[15]!==E?(D=(0,Z.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":T,children:E}),t[14]=l.sourceFilterAria,t[15]=E,t[16]=D):D=t[16];let O=l.categoryFilterAria,k;t[17]===g?k=t[18]:(k=e=>g(e.target.value),t[17]=g,t[18]=k);let A;t[19]===l.categories?A=t[20]:(A=Ue.map(e=>(0,Z.jsx)(De,{value:e,children:l.categories[e]},e)),t[19]=l.categories,t[20]=A);let j;t[21]!==h||t[22]!==l.categoryFilterAria||t[23]!==k||t[24]!==A?(j=(0,Z.jsx)(Pe,{value:h,"aria-label":O,onChange:k,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:A}),t[21]=h,t[22]=l.categoryFilterAria,t[23]=k,t[24]=A,t[25]=j):j=t[25];let M;t[26]!==j||t[27]!==D?(M=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[D,j]}),t[26]=j,t[27]=D,t[28]=M):M=t[28];let N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=N):N=t[29];let P;t[30]===m?P=t[31]:(P=e=>m(e.target.value),t[30]=m,t[31]=P);let F=l.librarySearchPlaceholder,I;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(I=u(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,Je.focusRingPanel),t[32]=I):I=t[32];let L;t[33]!==l.librarySearchPlaceholder||t[34]!==p||t[35]!==P?(L=(0,Z.jsxs)(`div`,{className:`relative max-w-xl`,children:[N,(0,Z.jsx)(`input`,{value:p,onChange:P,placeholder:F,className:I})]}),t[33]=l.librarySearchPlaceholder,t[34]=p,t[35]=P,t[36]=L):L=t[36];let R;return t[37]!==b||t[38]!==l||t[39]!==i||t[40]!==o||t[41]!==s||t[42]!==a?(R=b.length===0?(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l.noDefinitions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:l.noDefinitionsHint})]}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:b.map(e=>(0,Z.jsx)(Lt,{definition:e,language:i,labels:l,onPick:a,onDetail:o,onEdit:s},e.id))}),t[37]=b,t[38]=l,t[39]=i,t[40]=o,t[41]=s,t[42]=a,t[43]=R):R=t[43],(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[S.length>0&&!p&&h===`all`&&_===`all`?(0,Z.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,Z.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:l.recentlyUsed}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:S.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,Z.jsxs)(`button`,{type:`button`,className:u(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,Je.focusRingPanel),onClick:()=>a(t),children:[(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:St(n,c,d)})]}),(0,Z.jsx)(H,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:l.allWorkflows}),w]}),M]}),L]}),R]})]})}function zt(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function Bt(e){return[e.id,e]}function Vt(){return Date.now()}var Ht=(0,Y.memo)(function(e){let t=(0,X.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:l}=e,d,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O,k;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){m=f(r).workflows;let e;t[22]===n?e=t[23]:(e=Ct(n),t[22]=n,t[23]=e),d=e;let s;t[24]===n?s=t[25]:(s=wt(n),t[24]=n,t[25]=s),h=s;let c;t[26]===n?c=t[27]:(c=ut(n),t[26]=n,t[27]=c),p=!!c;let l=n.startedAtMs??n.createdAtMs,b=F(d?a-l:n.metrics.durationMs),A;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(A=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=A):A=t[30];let M=A;x=`group border-b border-edge-subtle last:border-b-0`,y=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,O=`button`,t[31]!==o||t[32]!==n?(k=()=>o(n),t[31]=o,t[32]=n,t[33]=k):k=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(_=u(`min-w-0 flex-1 text-left`,Je.focusRingPanel),t[34]=_):_=t[34];let N=m.taskOpenDetails,P;t[35]===n?P=t[36]:(P=mt(n),t[35]=n,t[36]=P),v=`${N}: ${P}`,E=`flex min-w-0 items-start gap-3`;let I;t[37]===n.status?I=t[38]:(I=u(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,xe(n.status)),t[37]=n.status,t[38]=I),D=(0,Z.jsx)(`span`,{className:I,children:m.status[n.status]??n.status}),g=`min-w-0 flex-1`;let L;t[39]===n?L=t[40]:(L=mt(n),t[39]=n,t[40]=L),t[41]===L?S=t[42]:(S=(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:L}),t[41]=L,t[42]=S);let R;t[43]===n?R=t[44]:(R=ht(n),t[43]=n,t[44]=R);let z;t[45]===R?z=t[46]:(z=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:R}),t[45]=R,t[46]=z);let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=B):B=t[47];let V;t[48]!==i||t[49]!==a||t[50]!==l?(V=St(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=V):V=t[51];let H;t[52]===V?H=t[53]:(H=(0,Z.jsx)(`span`,{children:V}),t[52]=V,t[53]=H);let U=b===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:q(m.taskElapsed,{duration:b})})]});t[54]!==z||t[55]!==H||t[56]!==U?(C=(0,Z.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[z,B,H,U]}),t[54]=z,t[55]=H,t[56]=U,t[57]=C):C=t[57],w=d&&n.metrics.agentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,Z.jsx)(`span`,{children:q(m.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[M,`%`]})]}),(0,Z.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,Z.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${M}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}),q(m.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=k}else d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],O=t[20],k=t[21];let A;t[58]!==g||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(A=(0,Z.jsxs)(`span`,{className:g,children:[S,C,w,T]}),t[58]=g,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=A):A=t[63];let M;t[64]!==A||t[65]!==E||t[66]!==D?(M=(0,Z.jsxs)(`div`,{className:E,children:[D,A]}),t[64]=A,t[65]=E,t[66]=D,t[67]=M):M=t[67];let N;t[68]!==_||t[69]!==v||t[70]!==M||t[71]!==O||t[72]!==k?(N=(0,Z.jsx)(`button`,{type:O,onClick:k,className:_,"aria-label":v,children:M}),t[68]=_,t[69]=v,t[70]=M,t[71]=O,t[72]=k,t[73]=N):N=t[73];let P;t[74]!==m.rerun||t[75]!==l||t[76]!==h||t[77]!==n.id?(P=h?(0,Z.jsx)(b,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:m.rerun}):null,t[74]=m.rerun,t[75]=l,t[76]=h,t[77]=n.id,t[78]=P):P=t[78];let I;t[79]!==p||t[80]!==m.continueInChat||t[81]!==s||t[82]!==n?(I=n.status===`succeeded`&&p?(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:m.continueInChat}):null,t[79]=p,t[80]=m.continueInChat,t[81]=s,t[82]=n,t[83]=I):I=t[83];let L;t[84]!==d||t[85]!==m.cancel||t[86]!==c||t[87]!==n.id?(L=d?(0,Z.jsx)(b,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:m.cancel}):null,t[84]=d,t[85]=m.cancel,t[86]=c,t[87]=n.id,t[88]=L):L=t[88];let R;t[89]!==o||t[90]!==n?(R=()=>o(n),t[89]=o,t[90]=n,t[91]=R):R=t[91];let z;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),t[92]=z):z=t[92];let B;t[93]!==m.taskOpenDetails||t[94]!==R?(B=(0,Z.jsx)(b,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":m.taskOpenDetails,onClick:R,children:z}),t[93]=m.taskOpenDetails,t[94]=R,t[95]=B):B=t[95];let V;t[96]!==P||t[97]!==I||t[98]!==L||t[99]!==B?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[P,I,L,B]}),t[96]=P,t[97]=I,t[98]=L,t[99]=B,t[100]=V):V=t[100];let H;t[101]!==y||t[102]!==N||t[103]!==V?(H=(0,Z.jsxs)(`div`,{className:y,children:[N,V]}),t[101]=y,t[102]=N,t[103]=V,t[104]=H):H=t[104];let U;return t[105]!==x||t[106]!==H?(U=(0,Z.jsx)(`article`,{className:x,children:H}),t[105]=x,t[106]=H,t[107]=U):U=t[107],U});function Ut(e){let t=(0,X.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:l,refreshAll:u}=n,d;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==l?(d=s.length>1?(0,Z.jsx)(Pe,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:s.map(e=>(0,Z.jsx)(De,{value:e.id,children:ie(e,f(i).agentsSettings)},e.id))}):null,t[0]=s,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=l,t[5]=d):d=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[6]=p):p=t[6];let m;t[7]===r.addWorkflow?m=t[8]:(m=(0,Z.jsx)(b,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Z.jsxs)(c,{to:`/workflows/new`,children:[p,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=m);let h;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(h=(0,Z.jsx)(Ie,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==d||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[d,m,h]}),t[13]=d,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}var Wt=new Set([`failed`,`timeout`,`cancelled`]),Gt=[{id:`runs`,icon:_e},{id:`library`,icon:ye}],Kt={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function qt(e){return Wt.has(e.status)}function Jt(e,t){return t===`all`?!0:t===`attention`?qt(e):e.status===t}function Yt(e){return[...e].sort((e,t)=>{let n=(Kt[e.status]??4)-(Kt[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function Xt(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Zt(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ve,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ve,{className:`h-4 w-52 max-w-full`}),(0,Z.jsx)(Ve,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,Z.jsx)(Ve,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Qt(e){let t=(0,X.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,runs:c,searchQuery:l,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:x,setPageTab:S,runLayout:C,setRunLayout:w,openRunDetails:T,openRunInChat:E,openDefinitionDetails:D,openWorkflowEditor:O,startWorkflow:k,actionError:A,loading:M,error:N,cancelRun:P,retryRun:F}=n,I=ce(nn),L=ce(tn),R=Date.now(),z=Yt(c.filter(qt)),B;t[0]===g?B=t[1]:(B=e=>Jt(e,g),t[0]=g,t[1]=B);let V=Yt(_t(c,{searchQuery:l,workflowFilterId:f,triggerFilter:m}).filter(B)),H=!!(l||f||m!==`all`||g!==`all`),U,W;if(t[2]!==L||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==x||t[8]!==I||t[9]!==n?(U=()=>{if(!o){L();return}return I({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,Z.jsx)(Ut,{vm:n})}),()=>L()},W=[L,o,a.librarySubtitle,a.runsSubtitle,a.title,x,I,n],t[2]=L,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=x,t[8]=I,t[9]=n,t[10]=U,t[11]=W):(U=t[10],W=t[11]),(0,Y.useLayoutEffect)(U,W),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(y,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,Z.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let te=a.pageTabsAria,ne=Gt.map(e=>{let{id:t,icon:n}=e;return(0,Z.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":x===t,"aria-controls":`workflow-panel-${t}`,tabIndex:x===t?0:-1,draggable:!1,className:u(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>S(t),onKeyDown:e=>{let n=Xt(e.key,t);n&&(e.preventDefault(),S(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,Z.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&z.length>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:z.length}):null]},t)}),re;t[20]!==a.pageTabsAria||t[21]!==ne?(re=(0,Z.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":te,role:`tablist`,children:ne}),t[20]=a.pageTabsAria,t[21]=ne,t[22]=re):re=t[22];let G;t[23]!==A||t[24]!==N?(G=A??N?(0,Z.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:A??N}):null,t[23]=A,t[24]=N,t[25]=G):G=t[25];let ie=x===`runs`?(0,Z.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[z.length>0?(0,Z.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:z.length})]}),(0,Z.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[mt(z[0]),` · `,St(z[0].completedAtMs??z[0].createdAtMs,R,i)]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>T(z[0]),children:a.attentionView}),(0,Z.jsx)(b,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void F(z[0].id),children:a.rerun})]})]})}):null,(0,Z.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,Z.jsx)(Ce,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{value:l,onChange:e=>d(e.target.value),placeholder:a.runsSearchPlaceholder,className:u(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,Je.focusRingPanel)})]}),(0,Z.jsx)(Pe,{value:g,"aria-label":a.statusFilterAria,onChange:e=>_(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,Z.jsx)(De,{value:e,children:a.runStatuses[e]},e))}),(0,Z.jsxs)(Pe,{value:m,"aria-label":a.boardTriggerFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(De,{value:`all`,children:a.boardTriggerFilterAll}),(0,Z.jsx)(De,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,Z.jsx)(De,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,Z.jsx)(De,{value:`chat`,children:a.boardTriggerFilterChat}),(0,Z.jsx)(De,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,Z.jsxs)(Pe,{value:f,"aria-label":a.boardWorkflowFilterAria,onChange:e=>p(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(De,{value:``,children:a.boardWorkflowFilterAll}),s.map(en)]}),H?(0,Z.jsxs)(b,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,Z.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,Z.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,Z.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Je.focusRingPanel),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:[(0,Z.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,Z.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Je.focusRingPanel),"aria-pressed":C===`board`,onClick:()=>w(`board`),children:[(0,Z.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),C===`list`?(0,Z.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,Z.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:V.length})]}),M&&V.length===0?Array.from({length:4}).map($t):V.length>0?V.map(e=>(0,Z.jsx)(Ht,{run:e,language:r,localeTag:i,nowMs:R,onOpen:T,onOpenChat:E,onCancel:e=>void P(e),onRetry:e=>void F(e)},e.id)):(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(y,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:H?a.noRunResultsTitle:a.noRunsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:H?a.noRunResultsHint:a.noRunsStartHint}),(0,Z.jsx)(b,{type:`button`,variant:H?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:H?v:()=>S(`library`),children:H?a.clearFilters:a.chooseWorkflow})]})]}):(0,Z.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,Z.jsx)(Mt,{runs:V,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:M,onOpenRun:T,onOpenRunChat:E,onCancelRun:e=>void P(e),onRetryRun:e=>void F(e),onStart:()=>S(`library`)})})]}):(0,Z.jsxs)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`h2`,{id:`workflow-library-heading`,className:`text-base font-semibold text-fg`,children:a.libraryTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.libraryDescription})]}),(0,Z.jsx)(Rt,{definitions:s,runs:c,language:r,onPick:k,onDetail:D,onEdit:O})]}),K;return t[26]!==G||t[27]!==ie||t[28]!==re?(K=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[re,G,ie]})}),t[26]=G,t[27]=ie,t[28]=re,t[29]=K):K=t[29],K}function $t(e,t){return(0,Z.jsx)(Zt,{},t)}function en(e){return(0,Z.jsx)(De,{value:e.id,children:e.title},e.id)}function tn(e){return e.clearPageHeader}function nn(e){return e.setPageHeader}function rn(){let e=(0,X.c)(114),t=m(ln),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,a=p(cn),c=!!a,l=s(),[u,d]=o(),g;e[2]===u?g=e[3]:(g=u.get(`q`)??``,e[2]=u,e[3]=g);let v=g,y;e[4]===u?y=e[5]:(y=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=y);let b=y,x;e[6]===u?x=e[7]:(x=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=x);let S=x,w,T,E,D;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;w=u.get(`agent`)?.trim()??``,T=ve.has(n)?n:`runs`,E=Ge.has(r)?r:`list`,D=ze.has(t)?t:`all`,e[8]=u,e[9]=w,e[10]=T,e[11]=E,e[12]=D}else w=e[9],T=e[10],E=e[11],D=e[12];let k=D,[j,M]=(0,Y.useState)(null),N;e[13]!==c||e[14]!==a?(N=c?[`workflow-agents`,a]:null,e[13]=c,e[14]=a,e[15]=N):N=e[15];let P;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(P={revalidateOnFocus:!1},e[16]=P):P=e[16];let F=h(N,A,P),I;bb0:{let e=F.data?.agents??[];if(w&&(e.length===0||e.some(e=>e.id===w))){I=w;break bb0}I=F.data?.defaultId}let L=I,R;e[17]!==c||e[18]!==a?(R=c?[`workflow-definitions`,a]:null,e[17]=c,e[18]=a,e[19]=R):R=e[19];let z;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[20]=z):z=e[20];let B=h(R,_,z),H;e[21]!==c||e[22]!==L||e[23]!==a?(H=c&&L?[`workflow-runs`,a,L]:null,e[21]=c,e[22]=L,e[23]=a,e[24]=H):H=e[24];let U;e[25]===L?U=e[26]:(U=()=>V(100,{ownerAgentId:L}),e[25]=L,e[26]=U);let ee;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={revalidateOnFocus:!1,refreshInterval:on},e[27]=ee):ee=e[27];let W=h(H,U,ee),te;e[28]===B.data?te=e[29]:(te=B.data??[],e[28]=B.data,e[29]=te);let ne=te,re;e[30]===W.data?re=e[31]:(re=W.data??[],e[30]=W.data,e[31]=re);let G=re,ie;e[32]===d?ie=e[33]:(ie=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[32]=d,e[33]=ie);let K=ie,ae;e[34]===K?ae=e[35]:(ae=e=>K(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[34]=K,e[35]=ae);let oe=ae,se;e[36]===K?se=e[37]:(se=e=>K(t=>{let n=e.trim();n?t.set(ge,n):t.delete(ge)}),e[36]=K,e[37]=se);let ce=se,le;e[38]===K?le=e[39]:(le=e=>K(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[38]=K,e[39]=le);let ue=le,q;e[40]===K?q=e[41]:(q=e=>K(t=>{e&&e!==`all`?t.set(Me,e):t.delete(Me)}),e[40]=K,e[41]=q);let de=q,fe;e[42]===K?fe=e[43]:(fe=e=>K(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[42]=K,e[43]=fe);let pe=fe,me;e[44]===K?me=e[45]:(me=e=>K(t=>{e===`list`?t.delete(Ae):t.set(Ae,e)}),e[44]=K,e[45]=me);let he=me,_e;e[46]===K?_e=e[47]:(_e=e=>K(t=>{e===`all`?t.delete(Se):t.set(Se,e)}),e[46]=K,e[47]=_e);let ye=_e,be;e[48]===K?be=e[49]:(be=()=>K(an),e[48]=K,e[49]=be);let xe=be,J=L?`?agentId=${encodeURIComponent(L)}`:``,Ce;e[50]!==l||e[51]!==J?(Ce=e=>l(`/workflows/${e.id}${J}`),e[50]=l,e[51]=J,e[52]=Ce):Ce=e[52];let we=Ce,Te=we,Ee;e[53]!==l||e[54]!==L||e[55]!==J?(Ee=e=>{l(e.metadata.source===`user`?`/workflows/${e.id}/edit${J}`:`/workflows/new?copy=${encodeURIComponent(e.id)}${L?`&agentId=${encodeURIComponent(L)}`:``}`)},e[53]=l,e[54]=L,e[55]=J,e[56]=Ee):Ee=e[56];let De=Ee,Oe;e[57]!==l||e[58]!==J?(Oe=e=>l(`/workflows/runs/${e.id}${J}`),e[57]=l,e[58]=J,e[59]=Oe):Oe=e[59];let ke=Oe,je;e[60]===l?je=e[61]:(je=e=>{let t=ut(e);t&&l(Fe(t))},e[60]=l,e[61]=je);let Ne=je,Pe;e[62]!==r.cancelFailed||e[63]!==L||e[64]!==W?(Pe=async e=>{try{await C(e,{ownerAgentId:L}),await W.mutate()}catch(e){let t=e;M(t instanceof Error?t.message:r.cancelFailed)}},e[62]=r.cancelFailed,e[63]=L,e[64]=W,e[65]=Pe):Pe=e[65];let Ie=Pe,Le;e[66]!==r.retryFailed||e[67]!==l||e[68]!==L||e[69]!==J?(Le=async e=>{try{l(`/workflows/runs/${(await O(e,{ownerAgentId:L})).runId}${J}`)}catch(e){let t=e;M(t instanceof Error?t.message:r.retryFailed)}},e[66]=r.retryFailed,e[67]=l,e[68]=L,e[69]=J,e[70]=Le):Le=e[70];let Re=Le,Be,Ve;e[71]===W?(Be=e[72],Ve=e[73]):(Be=()=>{let e=()=>void W.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},Ve=[W],e[71]=W,e[72]=Be,e[73]=Ve),(0,Y.useEffect)(Be,Ve);let He;e[74]!==F||e[75]!==B||e[76]!==W?(He=()=>{Promise.all([F.mutate(),B.mutate(),W.mutate()])},e[74]=F,e[75]=B,e[76]=W,e[77]=He):He=e[77];let Ue=He,We=F.isLoading||B.isLoading||W.isLoading,Ke=F.error?.message??B.error?.message??W.error?.message??null,qe;e[78]===F.data?.agents?qe=e[79]:(qe=F.data?.agents??[],e[78]=F.data?.agents,e[79]=qe);let Je;return e[80]!==j||e[81]!==Ie||e[82]!==xe||e[83]!==ne||e[84]!==Ke||e[85]!==c||e[86]!==r||e[87]!==t||e[88]!==We||e[89]!==i||e[90]!==we||e[91]!==ke||e[92]!==Ne||e[93]!==De||e[94]!==L||e[95]!==T||e[96]!==Ue||e[97]!==Re||e[98]!==E||e[99]!==G||e[100]!==v||e[101]!==ce||e[102]!==pe||e[103]!==he||e[104]!==oe||e[105]!==ye||e[106]!==de||e[107]!==ue||e[108]!==Te||e[109]!==k||e[110]!==qe||e[111]!==S||e[112]!==b?(Je={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:v,setSearchQuery:oe,ownerAgentId:L,agentOptions:qe,setOwnerAgentId:ce,workflowFilterId:b,setWorkflowFilterId:ue,triggerFilter:S,setTriggerFilter:de,statusFilter:k,setStatusFilter:ye,clearRunFilters:xe,pageTab:T,setPageTab:pe,runLayout:E,setRunLayout:he,definitions:ne,runs:G,openDefinitionDetails:we,startWorkflow:Te,openWorkflowEditor:De,openRunDetails:ke,openRunInChat:Ne,actionError:j,loading:We,error:Ke,refreshAll:Ue,cancelRun:Ie,retryRun:Re},e[80]=j,e[81]=Ie,e[82]=xe,e[83]=ne,e[84]=Ke,e[85]=c,e[86]=r,e[87]=t,e[88]=We,e[89]=i,e[90]=we,e[91]=ke,e[92]=Ne,e[93]=De,e[94]=L,e[95]=T,e[96]=Ue,e[97]=Re,e[98]=E,e[99]=G,e[100]=v,e[101]=ce,e[102]=pe,e[103]=he,e[104]=oe,e[105]=ye,e[106]=de,e[107]=ue,e[108]=Te,e[109]=k,e[110]=qe,e[111]=S,e[112]=b,e[113]=Je):Je=e[113],Je}function an(e){e.delete(`q`),e.delete(`wf`),e.delete(Me),e.delete(Se)}function on(e){return e?.some(sn)?3e3:0}function sn(e){return e.status===`queued`||e.status===`running`}function cn(e){return e.token}function ln(e){return e.language}function un(){let e=(0,X.c)(2),t=rn(),n;return e[0]===t?n=e[1]:(n=(0,Z.jsx)(Qt,{vm:t}),e[0]=t,e[1]=n),n}function dn(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=dn(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var fn={value:()=>{}};function pn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new mn(n)}function mn(e){this._=e}function hn(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}mn.prototype=pn.prototype={constructor:mn,on:function(e,t){var n=this._,r=hn(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=gn(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=_n(n[i],e.name,t);else if(t==null)for(i in n)n[i]=_n(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new mn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function gn(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function _n(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=fn,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var vn={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function yn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),vn.hasOwnProperty(t)?{space:vn[t],local:e}:e}function bn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function xn(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Sn(e){var t=yn(e);return(t.local?xn:bn)(t)}function Cn(){}function wn(e){return e==null?Cn:function(){return this.querySelector(e)}}function Tn(e){typeof e!=`function`&&(e=wn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new pi(r,this._parents)}function En(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Dn(){return[]}function On(e){return e==null?Dn:function(){return this.querySelectorAll(e)}}function kn(e){return function(){return En(e.apply(this,arguments))}}function An(e){e=typeof e==`function`?kn(e):On(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new pi(r,i)}function jn(e){return function(){return this.matches(e)}}function Mn(e){return function(t){return t.matches(e)}}var Nn=Array.prototype.find;function Pn(e){return function(){return Nn.call(this.children,e)}}function Fn(){return this.firstElementChild}function In(e){return this.select(e==null?Fn:Pn(typeof e==`function`?e:Mn(e)))}var Ln=Array.prototype.filter;function Rn(){return Array.from(this.children)}function zn(e){return function(){return Ln.call(this.children,e)}}function Bn(e){return this.selectAll(e==null?Rn:zn(typeof e==`function`?e:Mn(e)))}function Vn(e){typeof e!=`function`&&(e=jn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new pi(r,this._parents)}function Hn(e){return Array(e.length)}function Un(){return new pi(this._enter||this._groups.map(Hn),this._parents)}function Wn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wn.prototype={constructor:Wn,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 Gn(e){return function(){return e}}function Kn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Wn(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function qn(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Wn(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Jn(e){return e.__data__}function Yn(e,t){if(!arguments.length)return Array.from(this,Jn);var n=t?qn:Kn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Gn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Xn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new pi(o,r),o._enter=s,o._exit=c,o}function Xn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Zn(){return new pi(this._exit||this._groups.map(Hn),this._parents)}function Qn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function $n(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new pi(s,this._parents)}function er(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function tr(e){e||=nr;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new pi(i,this._parents).order()}function nr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function rr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ir(){return Array.from(this)}function ar(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function or(){let e=0;for(let t of this)++e;return e}function sr(){return!this.node()}function cr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function lr(e){return function(){this.removeAttribute(e)}}function ur(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dr(e,t){return function(){this.setAttribute(e,t)}}function fr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function pr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function mr(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 hr(e,t){var n=yn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?ur:lr:typeof t==`function`?n.local?mr:pr:n.local?fr:dr)(n,t))}function gr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function _r(e){return function(){this.style.removeProperty(e)}}function vr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function br(e,t,n){return arguments.length>1?this.each((t==null?_r:typeof t==`function`?yr:vr)(e,t,n??``)):xr(this.node(),e)}function xr(e,t){return e.style.getPropertyValue(t)||gr(e).getComputedStyle(e,null).getPropertyValue(t)}function Sr(e){return function(){delete this[e]}}function Cr(e,t){return function(){this[e]=t}}function wr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Tr(e,t){return arguments.length>1?this.each((t==null?Sr:typeof t==`function`?wr:Cr)(e,t)):this.node()[e]}function Er(e){return e.trim().split(/^|\s+/)}function Dr(e){return e.classList||new Or(e)}function Or(e){this._node=e,this._names=Er(e.getAttribute(`class`)||``)}Or.prototype={add:function(e){this._names.indexOf(e)<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 kr(e,t){for(var n=Dr(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ar(e,t){for(var n=Dr(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function jr(e){return function(){kr(this,e)}}function Mr(e){return function(){Ar(this,e)}}function Nr(e,t){return function(){(t.apply(this,arguments)?kr:Ar)(this,e)}}function Pr(e,t){var n=Er(e+``);if(arguments.length<2){for(var r=Dr(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Nr:t?jr:Mr)(n,t))}function Fr(){this.textContent=``}function Ir(e){return function(){this.textContent=e}}function Lr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Rr(e){return arguments.length?this.each(e==null?Fr:(typeof e==`function`?Lr:Ir)(e)):this.node().textContent}function zr(){this.innerHTML=``}function Br(e){return function(){this.innerHTML=e}}function Vr(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Hr(e){return arguments.length?this.each(e==null?zr:(typeof e==`function`?Vr:Br)(e)):this.node().innerHTML}function Ur(){this.nextSibling&&this.parentNode.appendChild(this)}function Wr(){return this.each(Ur)}function Gr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kr(){return this.each(Gr)}function qr(e){var t=typeof e==`function`?e:Sn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Jr(){return null}function Yr(e,t){var n=typeof e==`function`?e:Sn(e),r=t==null?Jr:typeof t==`function`?t:wn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Xr(){var e=this.parentNode;e&&e.removeChild(this)}function Zr(){return this.each(Xr)}function Qr(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $r(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ei(e){return this.select(e?$r:Qr)}function ti(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function ni(e){return function(t){e.call(this,t,this.__data__)}}function ri(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function ii(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ai(e,t,n){return function(){var r=this.__on,i,a=ni(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function oi(e,t,n){var r=ri(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ai:ii,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function si(e,t,n){var r=gr(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function ci(e,t){return function(){return si(this,e,t)}}function li(e,t){return function(){return si(this,e,t.apply(this,arguments))}}function ui(e,t){return this.each((typeof t==`function`?li:ci)(e,t))}function*di(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var fi=[null];function pi(e,t){this._groups=e,this._parents=t}function mi(){return new pi([[document.documentElement]],fi)}function hi(){return this}pi.prototype=mi.prototype={constructor:pi,select:Tn,selectAll:An,selectChild:In,selectChildren:Bn,filter:Vn,data:Yn,enter:Un,exit:Zn,join:Qn,merge:$n,selection:hi,order:er,sort:tr,call:rr,nodes:ir,node:ar,size:or,empty:sr,each:cr,attr:hr,style:br,property:Tr,classed:Pr,text:Rr,html:Hr,raise:Wr,lower:Kr,append:qr,insert:Yr,remove:Zr,clone:ei,datum:ti,on:oi,dispatch:ui,[Symbol.iterator]:di};function gi(e){return typeof e==`string`?new pi([[document.querySelector(e)]],[document.documentElement]):new pi([[e]],fi)}function _i(e){let t;for(;t=e.sourceEvent;)e=t;return e}function vi(e,t){if(e=_i(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var yi={passive:!1},bi={capture:!0,passive:!1};function xi(e){e.stopImmediatePropagation()}function Si(e){e.preventDefault(),e.stopImmediatePropagation()}function Ci(e){var t=e.document.documentElement,n=gi(e).on(`dragstart.drag`,Si,bi);`onselectstart`in t?n.on(`selectstart.drag`,Si,bi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function wi(e,t){var n=e.document.documentElement,r=gi(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Si,bi),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ti=e=>()=>e;function Ei(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,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:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Ei.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Di(e){return!e.ctrlKey&&!e.button}function Oi(){return this.parentNode}function ki(e,t){return t??{x:e.x,y:e.y}}function Ai(){return navigator.maxTouchPoints||`ontouchstart`in this}function ji(){var e=Di,t=Oi,n=ki,r=Ai,i={},a=pn(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,yi).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(gi(n.view).on(`mousemove.drag`,m,bi).on(`mouseup.drag`,h,bi),Ci(n.view),xi(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Si(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){gi(e.view).on(`mousemove.drag mouseup.drag`,null),wi(e.view,l),Si(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(xi(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(Si(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(xi(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=vi(l||r,t),p,m,h;if((h=n.call(e,new Ei(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=vi(l||a,t),_=o;break}u.call(r,e,new Ei(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Ti(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Ti(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Ti(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Ti(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function Mi(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ni(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Pi(){}var Fi=.7,Ii=1/Fi,Li=`\\s*([+-]?\\d+)\\s*`,Ri=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,zi=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,Bi=/^#([0-9a-f]{3,8})$/,Vi=RegExp(`^rgb\\(${Li},${Li},${Li}\\)$`),Hi=RegExp(`^rgb\\(${zi},${zi},${zi}\\)$`),Ui=RegExp(`^rgba\\(${Li},${Li},${Li},${Ri}\\)$`),Wi=RegExp(`^rgba\\(${zi},${zi},${zi},${Ri}\\)$`),Gi=RegExp(`^hsl\\(${Ri},${zi},${zi}\\)$`),Ki=RegExp(`^hsla\\(${Ri},${zi},${zi},${Ri}\\)$`),qi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Mi(Pi,Qi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ji,formatHex:Ji,formatHex8:Yi,formatHsl:Xi,formatRgb:Zi,toString:Zi});function Ji(){return this.rgb().formatHex()}function Yi(){return this.rgb().formatHex8()}function Xi(){return da(this).formatHsl()}function Zi(){return this.rgb().formatRgb()}function Qi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=Bi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$i(t):n===3?new ra(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ea(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ea(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Vi.exec(e))?new ra(t[1],t[2],t[3],1):(t=Hi.exec(e))?new ra(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ui.exec(e))?ea(t[1],t[2],t[3],t[4]):(t=Wi.exec(e))?ea(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Gi.exec(e))?ua(t[1],t[2]/100,t[3]/100,1):(t=Ki.exec(e))?ua(t[1],t[2]/100,t[3]/100,t[4]):qi.hasOwnProperty(e)?$i(qi[e]):e===`transparent`?new ra(NaN,NaN,NaN,0):null}function $i(e){return new ra(e>>16&255,e>>8&255,e&255,1)}function ea(e,t,n,r){return r<=0&&(e=t=n=NaN),new ra(e,t,n,r)}function ta(e){return e instanceof Pi||(e=Qi(e)),e?(e=e.rgb(),new ra(e.r,e.g,e.b,e.opacity)):new ra}function na(e,t,n,r){return arguments.length===1?ta(e):new ra(e,t,n,r??1)}function ra(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Mi(ra,na,Ni(Pi,{brighter(e){return e=e==null?Ii:Ii**+e,new ra(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Fi:Fi**+e,new ra(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ra(ca(this.r),ca(this.g),ca(this.b),sa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ia,formatHex:ia,formatHex8:aa,formatRgb:oa,toString:oa}));function ia(){return`#${la(this.r)}${la(this.g)}${la(this.b)}`}function aa(){return`#${la(this.r)}${la(this.g)}${la(this.b)}${la((isNaN(this.opacity)?1:this.opacity)*255)}`}function oa(){let e=sa(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ca(this.r)}, ${ca(this.g)}, ${ca(this.b)}${e===1?`)`:`, ${e})`}`}function sa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ca(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function la(e){return e=ca(e),(e<16?`0`:``)+e.toString(16)}function ua(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new pa(e,t,n,r)}function da(e){if(e instanceof pa)return new pa(e.h,e.s,e.l,e.opacity);if(e instanceof Pi||(e=Qi(e)),!e)return new pa;if(e instanceof pa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new pa(o,s,c,e.opacity)}function fa(e,t,n,r){return arguments.length===1?da(e):new pa(e,t,n,r??1)}function pa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Mi(pa,fa,Ni(Pi,{brighter(e){return e=e==null?Ii:Ii**+e,new pa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Fi:Fi**+e,new pa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new ra(ga(e>=240?e-240:e+120,i,r),ga(e,i,r),ga(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new pa(ma(this.h),ha(this.s),ha(this.l),sa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=sa(this.opacity);return`${e===1?`hsl(`:`hsla(`}${ma(this.h)}, ${ha(this.s)*100}%, ${ha(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function ma(e){return e=(e||0)%360,e<0?e+360:e}function ha(e){return Math.max(0,Math.min(1,e||0))}function ga(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var _a=e=>()=>e;function va(e,t){return function(n){return e+n*t}}function ya(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ba(e){return(e=+e)==1?xa:function(t,n){return n-t?ya(t,n,e):_a(isNaN(t)?n:t)}}function xa(e,t){var n=t-e;return n?va(e,n):_a(isNaN(e)?t:e)}var Sa=(function e(t){var n=ba(t);function r(e,t){var r=n((e=na(e)).r,(t=na(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=xa(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Ca(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function wa(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ta(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Pa(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Ea(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Da(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Oa(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Pa(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var ka=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Aa=new RegExp(ka.source,`g`);function ja(e){return function(){return e}}function Ma(e){return function(t){return e(t)+``}}function Na(e,t){var n=ka.lastIndex=Aa.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=ka.exec(e))&&(i=Aa.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Da(r,i)})),n=Aa.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Ma(c[0].x):ja(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Pa(e,t){var n=typeof t,r;return t==null||n===`boolean`?_a(t):(n===`number`?Da:n===`string`?(r=Qi(t))?(t=r,Sa):Na:t instanceof Qi?Sa:t instanceof Date?Ea:wa(t)?Ca:Array.isArray(t)?Ta:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Oa:Da)(e,t)}var Fa=180/Math.PI,Ia={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function La(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Fa,skewX:Math.atan(c)*Fa,scaleX:o,scaleY:s}}var Ra;function za(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Ia:La(t.a,t.b,t.c,t.d,t.e,t.f)}function Ba(e){return e==null||(Ra||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Ra.setAttribute(`transform`,e),!(e=Ra.transform.baseVal.consolidate()))?Ia:(e=e.matrix,La(e.a,e.b,e.c,e.d,e.e,e.f))}function Va(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Da(e,i)},{i:c-2,x:Da(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Da(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Da(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Da(e,n)},{i:s-2,x:Da(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Ha=Va(za,`px, `,`px)`,`deg)`),Ua=Va(Ba,`, `,`)`,`)`),Wa=1e-12;function Ga(e){return((e=Math.exp(e))+1/e)/2}function Ka(e){return((e=Math.exp(e))-1/e)/2}function qa(e){return((e=Math.exp(2*e))-1)/(e+1)}var Ja=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Wa)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=Ga(y),c=s/(n*g)*(i*qa(t*r+y)-Ka(y));return[a+c*d,o+c*f,s*i/Ga(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),Ya=0,Xa=0,Za=0,Qa=1e3,$a,eo,to=0,no=0,ro=0,io=typeof performance==`object`&&performance.now?performance:Date,ao=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return no||=(ao(so),io.now()+ro)}function so(){no=0}function co(){this._call=this._time=this._next=null}co.prototype=lo.prototype={constructor:co,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&eo!==this&&(eo?eo._next=this:$a=this,eo=this),this._call=e,this._time=n,ho()},stop:function(){this._call&&(this._call=null,this._time=1/0,ho())}};function lo(e,t,n){var r=new co;return r.restart(e,t,n),r}function uo(){oo(),++Ya;for(var e=$a,t;e;)(t=no-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ya}function fo(){no=(to=io.now())+ro,Ya=Xa=0;try{uo()}finally{Ya=0,mo(),no=0}}function po(){var e=io.now(),t=e-to;t>Qa&&(ro-=t,to=e)}function mo(){for(var e,t=$a,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$a=n);eo=e,ho(r)}function ho(e){Ya||(Xa&&=clearTimeout(Xa),e-no>24?(e<1/0&&(Xa=setTimeout(fo,e-io.now()-ro)),Za&&=clearInterval(Za)):(Za||=(to=io.now(),setInterval(po,Qa)),Ya=1,ao(fo)))}function go(e,t,n){var r=new co;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var _o=pn(`start`,`end`,`cancel`,`interrupt`),vo=[];function yo(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Co(e,n,{name:t,index:r,group:i,on:_o,tween:vo,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function bo(e,t){var n=So(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function xo(e,t){var n=So(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function So(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Co(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=lo(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return go(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(go(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function wo(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function To(e){return this.each(function(){wo(this,e)})}function Eo(e,t){var n,r;return function(){var i=xo(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Do(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=xo(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Oo(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=So(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Eo:Do)(n,e,t))}function ko(e,t,n){var r=e._id;return e.each(function(){var e=xo(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return So(e,r).value[t]}}function Ao(e,t){var n;return(typeof t==`number`?Da:t instanceof Qi?Sa:(n=Qi(t))?(t=n,Sa):Na)(e,t)}function jo(e){return function(){this.removeAttribute(e)}}function Mo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function No(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Po(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Fo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Io(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Lo(e,t){var n=yn(e),r=n===`transform`?Ua:Ao;return this.attrTween(e,typeof t==`function`?(n.local?Io:Fo)(n,r,ko(this,`attr.`+e,t)):t==null?(n.local?Mo:jo)(n):(n.local?Po:No)(n,r,t))}function Ro(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zo(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Bo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&zo(e,i)),n}return i._value=t,i}function Vo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ro(e,i)),n}return i._value=t,i}function Ho(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 Error();var r=yn(e);return this.tween(n,(r.local?Bo:Vo)(r,t))}function Uo(e,t){return function(){bo(this,e).delay=+t.apply(this,arguments)}}function Wo(e,t){return t=+t,function(){bo(this,e).delay=t}}function Go(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Uo:Wo)(t,e)):So(this.node(),t).delay}function Ko(e,t){return function(){xo(this,e).duration=+t.apply(this,arguments)}}function qo(e,t){return t=+t,function(){xo(this,e).duration=t}}function Jo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ko:qo)(t,e)):So(this.node(),t).duration}function Yo(e,t){if(typeof t!=`function`)throw Error();return function(){xo(this,e).ease=t}}function Xo(e){var t=this._id;return arguments.length?this.each(Yo(t,e)):So(this.node(),t).ease}function Zo(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();xo(this,e).ease=n}}function Qo(e){if(typeof e!=`function`)throw Error();return this.each(Zo(this._id,e))}function $o(e){typeof e!=`function`&&(e=jn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Os(r,this._parents,this._name,this._id)}function es(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Os(o,this._parents,this._name,this._id)}function ts(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ns(e,t,n){var r,i,a=ts(t)?bo:xo;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function rs(e,t){var n=this._id;return arguments.length<2?So(this.node(),n).on.on(e):this.each(ns(n,e,t))}function is(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function as(){return this.on(`end.remove`,is(this._id))}function os(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=wn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,yo(l[f],t,n,f,l,So(u,n)));return new Os(a,this._parents,t,n)}function ss(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=On(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=So(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&yo(p,t,n,h,f,m);a.push(f),o.push(u)}return new Os(a,o,t,n)}var cs=mi.prototype.constructor;function ls(){return new cs(this._groups,this._parents)}function us(e,t){var n,r,i;return function(){var a=xr(this,e),o=(this.style.removeProperty(e),xr(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ds(e){return function(){this.style.removeProperty(e)}}function fs(e,t,n){var r,i=n+``,a;return function(){var o=xr(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function ps(e,t,n){var r,i,a;return function(){var o=xr(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),xr(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function ms(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=xo(this,e),l=c.on,u=c.value[a]==null?s||=ds(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function hs(e,t,n){var r=(e+=``)==`transform`?Ha:Ao;return t==null?this.styleTween(e,us(e,r)).on(`end.style.`+e,ds(e)):typeof t==`function`?this.styleTween(e,ps(e,r,ko(this,`style.`+e,t))).each(ms(this._id,e)):this.styleTween(e,fs(e,r,t),n).on(`end.style.`+e,null)}function gs(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function _s(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&gs(e,a,n)),r}return a._value=t,a}function vs(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,_s(e,t,n??``))}function ys(e){return function(){this.textContent=e}}function bs(e){return function(){var t=e(this);this.textContent=t??``}}function xs(e){return this.tween(`text`,typeof e==`function`?bs(ko(this,`text`,e)):ys(e==null?``:e+``))}function Ss(e){return function(t){this.textContent=e.call(this,t)}}function Cs(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Ss(r)),t}return r._value=e,r}function ws(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 Error();return this.tween(t,Cs(e))}function Ts(){for(var e=this._name,t=this._id,n=As(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=So(c,t);yo(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Os(r,this._parents,e,n)}function Es(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=xo(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Ds=0;function Os(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ks(e){return mi().transition(e)}function As(){return++Ds}var js=mi.prototype;Os.prototype=ks.prototype={constructor:Os,select:os,selectAll:ss,selectChild:js.selectChild,selectChildren:js.selectChildren,filter:$o,merge:es,selection:ls,transition:Ts,call:js.call,nodes:js.nodes,node:js.node,size:js.size,empty:js.empty,each:js.each,on:rs,attr:Lo,attrTween:Ho,style:hs,styleTween:vs,text:xs,textTween:ws,remove:as,tween:Oo,delay:Go,duration:Jo,ease:Xo,easeVarying:Qo,end:Es,[Symbol.iterator]:js[Symbol.iterator]};function Ms(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ns={time:null,delay:0,duration:250,ease:Ms};function Ps(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Fs(e){var t,n;e instanceof Os?(t=e._id,e=e._name):(t=As(),(n=Ns).time=oo(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&yo(c,e,t,l,o,n||Ps(c,t));return new Os(r,this._parents,e,t)}mi.prototype.interrupt=To,mi.prototype.transition=Fs;var Is=e=>()=>e;function Ls(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:r,enumerable:!0,configurable:!0},_:{value:i}})}function Rs(e,t,n){this.k=e,this.x=t,this.y=n}Rs.prototype={constructor:Rs,scale:function(e){return e===1?this:new Rs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Rs(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 zs=new Rs(1,0,0);Bs.prototype=Rs.prototype;function Bs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return zs;return e.__zoom}function Vs(e){e.stopImmediatePropagation()}function Hs(e){e.preventDefault(),e.stopImmediatePropagation()}function Us(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Ws(){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 Gs(){return this.__zoom||zs}function Ks(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qs(){return navigator.maxTouchPoints||`ontouchstart`in this}function Js(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Ys(){var e=Us,t=Ws,n=Js,r=Ks,i=qs,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ja,l=pn(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Gs).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Gs),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(zs.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Rs(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Rs(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Rs(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=gi(this.that).datum();l.call(e,this.that,new Ls(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=vi(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],wo(this),s.start();Hs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=gi(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=vi(t,i),l=t.clientX,u=t.clientY;Ci(t.view),Vs(t),a.mouse=[c,this.__zoom.invert(c)],wo(this),a.start();function d(e){if(Hs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=vi(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),wi(e.view,a.moved),Hs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=vi(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Hs(r),s>0?gi(this).transition().duration(s).call(x,d,c,r):gi(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Vs(t),s=0;s<i;++s)c=r[s],l=vi(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),wo(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Hs(e),s=0;s<a;++s)c=i[s],l=vi(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Vs(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=vi(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=gi(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Is(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Is(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Is(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Is([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Xs={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.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 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:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", 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.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Zs=[[-1/0,-1/0],[1/0,1/0]],Qs=[`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`},ec;(function(e){e.Strict=`strict`,e.Loose=`loose`})(ec||={});var tc;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(tc||={});var nc;(function(e){e.Partial=`partial`,e.Full=`full`})(nc||={});var rc={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ic;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ic||={});var ac;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(ac||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var oc={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function sc(e){return e===null?null:e?`valid`:`invalid`}var cc=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,lc=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),uc=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),dc=(e,t=[0,0])=>{let{width:n,height:r}=Gc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},fc=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:Dc(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):uc(n)?n:t.nodeLookup.get(n.id)),Tc(e,i?kc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),pc=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Tc(n,kc(e)),r=!0)}),r?Dc(n):{x:0,y:0,width:0,height:0}},mc=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=jc(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},hc=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function gc(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Gc(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function _c({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Hc(pc(gc(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function vc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,Xs.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&Wc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Wc(d)?xc(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Xs.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function yc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=hc(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var bc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),xc=(e={x:0,y:0},t,n)=>({x:bc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:bc(e.y,t[0][1],t[1][1]-(n?.height??0))});function Sc(e,t,n){let{width:r,height:i}=Gc(n),{x:a,y:o}=n.internals.positionAbsolute;return xc(e,[[a,o],[a+r,o+i]],t)}var Cc=(e,t,n)=>e<t?bc(Math.abs(e-t),1,t)/t:e>n?-bc(Math.abs(e-n),1,t)/t:0,wc=(e,t,n=15,r=40)=>[Cc(e.x,r,t.width-r)*n,Cc(e.y,r,t.height-r)*n],Tc=(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)}),Ec=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Dc=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Oc=(e,t=[0,0])=>{let{x:n,y:r}=uc(e)?e.internals.positionAbsolute:dc(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},kc=(e,t=[0,0])=>{let{x:n,y:r}=uc(e)?e.internals.positionAbsolute:dc(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Ac=(e,t)=>Dc(Tc(Ec(e),Ec(t))),jc=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},Mc=(e,t)=>jc(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Nc=e=>Pc(e.width)&&Pc(e.height)&&Pc(e.x)&&Pc(e.y),Pc=e=>!isNaN(e)&&isFinite(e),Fc=(e,t)=>(e,t)=>{},Ic=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Lc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?Ic(s,o):s},Rc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function zc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Bc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=zc(e,n),i=zc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=zc(e.top??e.y??0,n),i=zc(e.bottom??e.y??0,n),a=zc(e.left??e.x??0,t),o=zc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Vc(e,t,n,r,i,a){let{x:o,y:s}=Rc(e,[t,n,r]),{x:c,y:l}=Rc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Hc=(e,t,n,r,i,a)=>{let o=Bc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=bc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Vc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Uc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Wc(e){return e!=null&&e!==`parent`}function Gc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Kc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function qc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function Jc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Yc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Xc(e){return{...$s,...e||{}}}function Zc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=rl(e),s=Lc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?Ic(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Qc=e=>({width:e.offsetWidth,height:e.offsetHeight}),$c=e=>e?.getRootNode?.()||window?.document,el=[`INPUT`,`SELECT`,`TEXTAREA`];function tl(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?el.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var nl=e=>`clientX`in e,rl=(e,t)=>{let n=nl(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},il=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Qc(t)}})};function al({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function ol(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function sl({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-ol(t-r,a),n];case Q.Right:return[t+ol(r-t,a),n];case Q.Top:return[t,n-ol(n-i,a)];case Q.Bottom:return[t,n+ol(i-n,a)]}}function cl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=sl({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=sl({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=al({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function ll({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function ul({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function dl({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Tc(kc(e),kc(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),Mc({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Dc(a))>0}var fl=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,pl=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),ml=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Xs.error006()),t;let r=n.getEdgeId||fl,i;return i=cc(e)?{...e}:{...e,id:r(e)},pl(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function hl({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=ll({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var gl={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},_l=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},vl=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function yl({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=gl[t],c=gl[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=_l({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=ll({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function bl(e,t,n,r){let i=Math.min(vl(e,t)/2,vl(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function xl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=yl({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=bl(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function Sl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Cl(e){let{sourceNode:t,targetNode:n}=e;if(!Sl(t)||!Sl(n))return null;let r=t.internals.handleBounds||wl(t.handles),i=n.internals.handleBounds||wl(n.handles),a=El(r?.source??[],e.sourceHandle),o=El(e.connectionMode===ec.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,Xs.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=Tl(t,a,s),u=Tl(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function wl(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Tl(e,t,n=Q.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Gc(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function El(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Dl(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Ol(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=Dl(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var kl=1e3,Al=10,jl={nodeOrigin:[0,0],nodeExtent:Zs,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Ml={...jl,checkEquality:!0};function Nl(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Pl(e,t,n){let r=Nl(jl,n);for(let n of e.values())if(n.parentId)zl(n,e,t,r);else{let e=xc(dc(n,r.nodeOrigin),Wc(n.extent)?n.extent:r.nodeExtent,Gc(n));n.internals.positionAbsolute=e}}function Fl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function Il(e){return e===`manual`}function Ll(e,t,n,r={}){let i=Nl(Ml,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Il(i.zIndexMode)?kl:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=xc(dc(u,i.nodeOrigin),Wc(u.extent)?u.extent:i.nodeExtent,Gc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Fl(u,e),z:Bl(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&zl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Rl(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function zl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Nl(jl,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Rl(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Al),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Vl(e,u,o,s,a&&!Il(c)?kl:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Bl(e,t,n){let r=Pc(e.zIndex)?e.zIndex:0;return Il(n)?r:r+(e.selected?t:0)}function Vl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Gc(e),l=dc(e,n),u=Wc(e.extent)?xc(l,e.extent,c):l,d=xc({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Sc(d,c,t));let f=Bl(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Hl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Ac(a.get(n.parentId)?.expandedRect??Oc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Gc(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Ul(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Qc(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=Wc(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=Sc(h,s,n))}else m&&(h=xc(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:il(`source`,r.nodeElement,p,d,e.id),target:il(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&zl(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Oc(g,i)}))}}if(f.length>0){let e=Hl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Wl({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Gl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Kl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Gl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Gl(`target`,s,c,e,i,o),t.set(r.id,r)}}function ql(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:ql(n,t):!1}function Jl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Yl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!ql(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Xl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Zl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=Ic(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Ql({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=gi(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Ec(pc(s)):null,x=v&&l?Zl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:Ic(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=vc({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Xl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=wc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Zc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Yl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Xl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=ji().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Zc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=rl(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Zc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=rl(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=rl(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Xl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!Jl(t,`.${g}`,v))&&(!_||Jl(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function $l(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())Mc(i,Oc(e))>0&&r.push(e);return r}var eu=250;function tu(e,t,n,r){let i=[],a=1/0,o=$l(e,n,t+eu);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Tl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function nu(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Tl(o,c,c.position,!0)}:c}function ru(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function iu(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var au=()=>!0;function ou(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=au,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=$c(e.target),E=0,D,{x:O,y:k}=rl(e),A=ru(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=nu(i,A,r,c,t);if(!N)return;let P=rl(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=wc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},V=c.get(i),H={inProgress:!0,isValid:null,from:Tl(V,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:V,to:P,toHandle:null,toPosition:oc[B.position],toNode:null,pointer:P};function U(){M=!0,y(H),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&U();function ee(e){if(!M){let{x:t,y:n}=rl(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;U()}if(!x()||!B){W(e);return}let a=b();P=rl(e,j),D=tu(Lc(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=su(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=iu(!!D,s.isValid);let u=c.get(i),f=u?Tl(u,B,Q.Left,!0):H.from,p={...H,from:f,isValid:L,to:s.toHandle&&L?Rc({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:oc[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),H=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=H,r={...n,toPosition:H.toHandle?H.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ee),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,ee),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,ee),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,ee),T.addEventListener(`touchend`,W)}function su(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=au,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=rl(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=ru(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===ec.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=nu(t,e,a,u,n,!0)}return _}var cu={onPointerDown:ou,isValid:su};function lu({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=gi(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Uc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Ys().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:vi}}var uu=e=>({x:e.x,y:e.y,zoom:e.k}),du=({x:e,y:t,zoom:n})=>zs.translate(e,t).scale(n),fu=(e,t)=>e.target.closest(`.${t}`),pu=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),mu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,hu=(e,t=0,n=mu,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},gu=e=>{let t=e.ctrlKey&&Uc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function _u({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(fu(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=vi(u),t=d*2**gu(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===tc.Vertical?0:u.deltaX*f,m=i===tc.Horizontal?0:u.deltaY*f;!Uc()&&u.shiftKey&&i!==tc.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=uu(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function vu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=fu(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function yu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=uu(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function bu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&pu(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,uu(a.transform))}}function xu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&pu(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=uu(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Su({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(fu(d,`${l}-flow__node`)||fu(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||fu(d,s)&&m||fu(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Cu({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=Ys().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=gi(e).call(f);y({x:i.x,y:i.y,zoom:bc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(gu);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Pa:Ja).transform(hu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!Pc(E)||E<0?0:E);let k=O?_u({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):vu({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=yu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=bu({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=xu({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=Su({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=du(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=du(e);return await g(n,t),n}function x(e){if(p){let t=du(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?Bs(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Pa:Ja).scaleTo(hu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Pa:Ja).scaleBy(hu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!Pc(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var wu;(function(e){e.Line=`line`,e.Handle=`handle`})(wu||={});function Tu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Eu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function Du(e,t){return Math.max(0,t-e)}function Ou(e,t){return Math.max(0,e-t)}function ku(e,t,n){return Math.max(0,t-e,e-n)}function Au(e,t){return e?!t:t}function ju(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=ku(E,h,g),j=ku(D,_,v);if(o){let e=0,t=0;c&&w<0?e=Du(y+w+O,o[0][0]):!c&&w>0&&(e=Ou(y+E+O,o[1][0])),l&&T<0?t=Du(b+T+k,o[0][1]):!l&&T>0&&(t=Ou(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Ou(y+w,s[0][0]):!c&&w<0&&(e=Du(y+E,s[1][0])),l&&T>0?t=Ou(b+T,s[0][1]):!l&&T<0&&(t=Du(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=ku(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Ou(b+k+E/C,o[1][1])*C:Du(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?Du(b+E/C,s[1][1])*C:Ou(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=ku(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Ou(y+D*C+O,o[1][0])/C:Du(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?Du(y+D*C,s[1][0])/C:Ou(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(Au(c,l)?-w:w)/C:w=(Au(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Mu={width:0,height:0,x:0,y:0},Nu={...Mu,pointerX:0,pointerY:0,aspectRatio:1};function Pu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function Fu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=gi(e),o={controlDirection:Eu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Mu},h={...Nu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Eu(e)};let g,_=null,v=[],y,b,x,S=!1,C=ji().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Zc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Wc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=Pu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Zc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=ju(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=Tu({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var Iu=e(rt(),1),Lu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Ru=e=>e?Lu(e):Lu,{useDebugValue:zu}=Y.default,{useSyncExternalStoreWithSelector:Bu}=Iu.default,Vu=e=>e;function Hu(e,t=Vu,n){let r=Bu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zu(r),r}var Uu=(e,t)=>{let n=Ru(e),r=(e,r=t)=>Hu(n,e,r);return Object.assign(r,n),r},Wu=(e,t)=>e?Uu(e,t):Uu;function Gu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}n();var Ku=(0,Y.createContext)(null),qu=Ku.Provider,Ju=Xs.error001(`react`);function $(e,t){let n=(0,Y.useContext)(Ku);if(n===null)throw Error(Ju);return Hu(n,e,t)}function Yu(){let e=(0,Y.useContext)(Ku);if(e===null)throw Error(Ju);return(0,Y.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Xu={display:`none`},Zu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Qu=`react-flow__node-desc`,$u=`react-flow__edge-desc`,ed=`react-flow__aria-live`,td=e=>e.ariaLiveMessage,nd=e=>e.ariaLabelConfig;function rd({rfId:e}){let t=$(td);return(0,Z.jsx)(`div`,{id:`${ed}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Zu,children:t})}function id({rfId:e,disableKeyboardA11y:t}){let n=$(nd);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{id:`${Qu}-${e}`,style:Xu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Z.jsx)(`div`,{id:`${$u}-${e}`,style:Xu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Z.jsx)(rd,{rfId:e})]})}var ad=(0,Y.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,Z.jsx)(`div`,{className:dn([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));ad.displayName=`Panel`;var od=`https://reactflow.dev?utm_source=attribution`;function sd({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Z.jsx)(ad,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${od}`,children:(0,Z.jsx)(`a`,{href:od,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var cd=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},ld=e=>e.id;function ud(e,t){return Gu(e.selectedNodes.map(ld),t.selectedNodes.map(ld))&&Gu(e.selectedEdges.map(ld),t.selectedEdges.map(ld))}function dd({onSelectionChange:e}){let t=Yu(),{selectedNodes:n,selectedEdges:r}=$(cd,ud);return(0,Y.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var fd=e=>!!e.onSelectionChangeHandlers;function pd({onSelectionChange:e}){let t=$(fd);return e||t?(0,Z.jsx)(dd,{onSelectionChange:e}):null}var md=[0,0],hd={x:0,y:0,zoom:1},gd=[...`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`.split(`.`),`rfId`],_d=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}),vd={translateExtent:Zs,nodeOrigin:md,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function yd(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(_d,Gu),l=Yu();(0,Y.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=vd,s()}),[]);let u=(0,Y.useRef)(vd);return(0,Y.useEffect)(()=>{for(let s of gd){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Xc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},gd.map(t=>e[t])),null}function bd(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function xd(e){let[t,n]=(0,Y.useState)(e===`system`?null:e);return(0,Y.useEffect)(()=>{if(e!==`system`){n(e);return}let t=bd(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?bd()?.matches?`dark`:`light`:t}var Sd=typeof document<`u`?document:null;function Cd(e=null,t={target:Sd,actInsideInputWithModifier:!0}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(!1),a=(0,Y.useRef)(new Set([])),[o,s]=(0,Y.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|